From 341ff833a114adbbb867a8e998ff9a9ef59c3d30 Mon Sep 17 00:00:00 2001 From: Rex Date: Thu, 3 Oct 2024 16:47:43 +0800 Subject: [PATCH] export plugins --- dist/rexcolorcomponents.js | 56 +- dist/rexcolorcomponents.min.js | 4 +- dist/rexcolorinput.js | 56 +- dist/rexcolorinput.min.js | 2 +- dist/rexcolorpicker.js | 11 +- dist/rexcolorpicker.min.js | 2 +- dist/rexconfirmdialog.js | 56 +- dist/rexconfirmdialog.min.js | 2 +- dist/rexdropdownlist.js | 56 +- dist/rexdropdownlist.min.js | 2 +- dist/rexgameobjectshellplugin.js | 56 +- dist/rexgameobjectshellplugin.min.js | 4 +- dist/rexgridtable.js | 56 +- dist/rexgridtable.min.js | 2 +- dist/rexlineprogress.js | 45 +- dist/rexlineprogress.min.js | 2 +- dist/rexlineprogressplugin.js | 45 +- dist/rexlineprogressplugin.min.js | 2 +- dist/rexmdscenario.js | 56 +- dist/rexmdscenario.min.js | 2 +- dist/rexmdscenarioplugin.js | 56 +- dist/rexmdscenarioplugin.min.js | 4 +- dist/rexnameinputdialog.js | 56 +- dist/rexnameinputdialog.min.js | 2 +- dist/rexnumberbar.js | 56 +- dist/rexnumberbar.min.js | 2 +- dist/rexroundrectangle.js | 11 +- dist/rexroundrectangle.min.js | 2 +- dist/rexroundrectangleplugin.js | 11 +- dist/rexroundrectangleplugin.min.js | 2 +- dist/rexroundrectangleprogressplugin.js | 3351 +++++++++++++++++++ dist/rexroundrectangleprogressplugin.min.js | 1 + dist/rexscrollablepanel.js | 56 +- dist/rexscrollablepanel.min.js | 2 +- dist/rexscrollbar.js | 56 +- dist/rexscrollbar.min.js | 2 +- dist/rexsimpledropdownlist.js | 56 +- dist/rexsimpledropdownlist.min.js | 2 +- dist/rexsimplelabel.js | 56 +- dist/rexsimplelabel.min.js | 2 +- dist/rexslider.js | 56 +- dist/rexslider.min.js | 2 +- dist/rexstatesroundrectangle.js | 11 +- dist/rexstatesroundrectangle.min.js | 2 +- dist/rextextarea.js | 56 +- dist/rextextarea.min.js | 2 +- dist/rextextareainput.js | 56 +- dist/rextextareainput.min.js | 2 +- dist/rextrees.js | 56 +- dist/rextrees.min.js | 2 +- dist/rextweaker.js | 56 +- dist/rextweaker.min.js | 4 +- dist/rexuiplugin.js | 56 +- dist/rexuiplugin.min.js | 6 +- plugin-list.js | 1 - 55 files changed, 4098 insertions(+), 573 deletions(-) create mode 100644 dist/rexroundrectangleprogressplugin.js create mode 100644 dist/rexroundrectangleprogressplugin.min.js diff --git a/dist/rexcolorcomponents.js b/dist/rexcolorcomponents.js index deeac82bf8..70d103ea31 100644 --- a/dist/rexcolorcomponents.js +++ b/dist/rexcolorcomponents.js @@ -19052,6 +19052,10 @@ Render$2 ); + var IsArcCorner = function (radius) { + return ((radius.x > 0) && (radius.y > 0)); + }; + var LineTo = function (x, y, pathData) { var cnt = pathData.length; if (cnt >= 2) { @@ -19133,8 +19137,7 @@ geom.setTo(0, 0, width, height, radius); } - var iteration = GetValue$D(radiusConfig, 'iteration', undefined); - this.setIteration(iteration); + this.setIteration(GetValue$D(radiusConfig, 'iteration', undefined)); this.setPosition(x, y); this.setFillStyle(fillColor, fillAlpha); @@ -19387,10 +19390,6 @@ } - var IsArcCorner = function (radius) { - return ((radius.x > 0) && (radius.y > 0)); - }; - const ShapeTypeMap = { rectangle: 0, circle: 1 @@ -20904,6 +20903,7 @@ var skewX = this.skewX; var width = this.width - Math.abs(skewX); var height = this.height; + var trackFill = this.getShape('trackFill'); trackFill.fillStyle(this.trackColor); if (trackFill.isFilled) { @@ -20912,8 +20912,7 @@ 0, 0, // x0, y0 width, height, // x1, y1 skewX // skewX - ) - .close(); + ); } var bar = this.getShape('bar'); @@ -20933,8 +20932,7 @@ barX0, 0, // x0, y0 barX1, height, // x1, y1 skewX // skew - ) - .close(); + ); } var trackStroke = this.getShape('trackStroke'); @@ -20945,8 +20943,7 @@ 0, 0, // x0, y0 width, height, // x1, y1 skewX // skewX - ) - .end(); + ); } }; @@ -20966,6 +20963,8 @@ .lineTo(x0, y0).lineTo(startX, y0); } + lines.close(); + return lines; }; @@ -20976,24 +20975,33 @@ constructor(scene, x, y, width, height, barColor, value, config) { if (IsPlainObject$9(x)) { config = x; - x = GetValue$A(config, 'x', 0); - y = GetValue$A(config, 'y', 0); - width = GetValue$A(config, 'width', 2); - height = GetValue$A(config, 'height', 2); - barColor = GetValue$A(config, 'barColor', undefined); - value = GetValue$A(config, 'value', 0); + + x = config.x; + y = config.y; + width = config.width; + height = config.height; + barColor = config.barColor; + value = config.value; } else if (IsPlainObject$9(width)) { config = width; - width = GetValue$A(config, 'width', 2); - height = GetValue$A(config, 'height', 2); - barColor = GetValue$A(config, 'barColor', undefined); - value = GetValue$A(config, 'value', 0); + + width = config.width; + height = config.height; + barColor = config.barColor; + value = config.value; } else if (IsPlainObject$9(barColor)) { config = barColor; - barColor = GetValue$A(config, 'barColor', undefined); - value = GetValue$A(config, 'value', 0); + + barColor = config.barColor; + value = config.value; } + if (x === undefined) { x = 0; } + if (y === undefined) { y = 0; } + if (width === undefined) { width = 2; } + if (height === undefined) { height = width; } + if (value === undefined) { value = 0; } + super(scene, x, y, width, height, config); this.type = 'rexLineProgress'; diff --git a/dist/rexcolorcomponents.min.js b/dist/rexcolorcomponents.min.js index 9cfa3c3a8c..a453609e7e 100644 --- a/dist/rexcolorcomponents.min.js +++ b/dist/rexcolorcomponents.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 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}},Pe=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,_e=Phaser.Utils.Objects.GetValue;var ke=function(t,e){return void 0===e?t:t[e]},Ee=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=_e(e,"left",0),t.right=_e(e,"right",0),t.top=_e(e,"top",0),t.bottom=_e(e,"bottom",0)),t},Me={getInnerPadding(t){return ke(this.space,t)},setInnerPadding(t,e){return Ee(this.space,t,e),this},getOuterPadding(t){return ke(this.getSizerConfig(this).padding,t)},setOuterPadding(t,e){return Ee(this.getSizerConfig(this).padding,t,e),this},getChildOuterPadding(t,e){return"string"==typeof t&&(t=this.getElement(t)),ke(this.getSizerConfig(t).padding,e)},setChildOuterPadding(t,e,i){return"string"==typeof t&&(t=this.getElement(t)),Ee(this.getSizerConfig(t).padding,e,i),this}},Re=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}},Le=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},De=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}},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},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},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}},ze=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?vi:pi,this.repeatCounter=0,this}stop(){return this.state=ui,this}update(t,e){this.state!==ui&&this.state!==fi&&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=gi)):(this.nowTime=this.duration,this.state=fi):this.nowTime>=0&&(this.state=vi))}get t(){var t;switch(this.state){case ui:case pi:case gi:t=0;break;case vi:t=this.nowTime/this.duration;break;case fi:t=1}return di(t,0,1)}set t(t){(t=di(t,-1,1))<0?(this.state=pi,this.nowTime=-this.delay*t):(this.state=vi,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===ui}get isDelay(){return this.state===pi}get isCountDown(){return this.state===vi}get isRunning(){return this.state===pi||this.state===vi}get isDone(){return this.state===fi}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}}const ui=0,pi=1,vi=2,gi=3,fi=-1;class mi extends ai{constructor(t,e){super(t,e),this.timer=new ci}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 yi=Phaser.Utils.Objects.GetValue,xi=Phaser.Utils.Objects.GetAdvancedValue,bi=Phaser.Tweens.Builders.GetEaseFunction;class Ci extends mi{resetFromJSON(t){return this.timer.resetFromJSON(yi(t,"timer")),this.setEnable(yi(t,"enable",!0)),this.setTarget(yi(t,"target",this.parent)),this.setDelay(xi(t,"delay",0)),this.setDuration(xi(t,"duration",1e3)),this.setEase(yi(t,"ease","Linear")),this.setRepeat(yi(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=bi(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,Si=Phaser.Utils.Objects.GetAdvancedValue,Oi=Phaser.Math.Linear;let Pi=class extends Ci{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(Si(t,"start",void 0),Si(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=Si(t,"x",this.parent.scaleX),this.startY=Si(t,"y",this.parent.scaleY)),"number"==typeof e?(this.endX=e,this.endY=e):(this.endX=Si(e,"x",void 0),this.endY=Si(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 _i=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 Pi(t,a):r.resetFromJSON(a),r.restart(),r},ki=function(t,e,i,s,r,n){void 0===s&&(s="Linear"),r instanceof Pi&&(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 Pi(t,h):n.resetFromJSON(h),n.restart(),n},Ei=function(t,e){return new Promise((function(i,s){t.once(e,(function(){i()}))}))},Mi=function(t){return Ei(t,"complete")};const Ri=Phaser.Utils.Objects.IsPlainObject;var Li={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(Ri(t)){var s=t;t=s.duration,e=s.orientation,i=s.ease}var r=void 0===this._scaleBehavior;return this._scaleBehavior=_i(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(Ri(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=ki(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(Ri(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 Pi(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),Mi(this._scaleBehavior)},isRunningScaleYoyo(){return this._scaleBehavior&&(this._scaleBehavior.completeEventName="scaleyoyo.complete")},isRunningEaseScale(){return this.isRunningPopUp()||this.isRunningScaleDown()||this.isRunningScaleYoyo()}},Di={};Object.assign(Di,Li),Di.onInitScale=function(){Li.onInitScale.call(this);var t=this;this._scaleBehavior.on("update",(function(){var e=me.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const Ai=Phaser.Utils.Objects.GetValue,Yi=Phaser.Utils.Objects.GetAdvancedValue,Wi=Phaser.Math.Linear;class Xi extends Ci{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(Yi(t,"start",this.parent.alpha),Yi(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=zi[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 zi={stop:0,destroy:1,yoyo:2},Fi=Phaser.Utils.Objects.IsPlainObject;var ji=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 Xi(t,h):s.resetFromJSON(h),s.restart(),s},Ii=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 Bi=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(Bi(t)){var i=t;t=i.duration,e=i.alpha}var s=void 0===this._fade;return this._fade=ji(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(Bi(t)){var i=t;t=i.duration,e=i.destroy}var s=void 0===this._fade;return this._fade=Ii(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()}},Ni={};Object.assign(Ni,Hi),Ni.onInitFade=function(){Hi.onInitFade.call(this);var t=this;this._fade.on("update",(function(){var e=me.getParentSizer(t);e&&e.resetChildAlphaState(t)}))};const Vi=Phaser.Utils.Objects.GetValue,Gi=Phaser.Utils.Objects.GetAdvancedValue,Ui=Phaser.Math.Linear;class $i extends Ci{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){if(super.resetFromJSON(t),this.setMode(Vi(t,"mode",0)),t&&(t.hasOwnProperty("x")||t.hasOwnProperty("y"))){var e=Gi(t,"x",void 0),i=Gi(t,"y",void 0);this.setTargetPosition(e,i)}else this.setTargetPosition(t);return this}setMode(t){return"string"==typeof t&&(t=Ji[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=Gi(i,"startX",void 0),this.startY=Gi(i,"startY",void 0),this.endX=Gi(i,"endX",void 0),this.endY=Gi(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=Ui(this.startX,this.endX,i)),this.hasMoveY&&(t.y=Ui(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Ji={stop:0,destroy:1,yoyo:2};var Ki=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,Zi=Phaser.Math.Distance.Between;var Qi={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*Zi(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 $i&&(h=n,n=void 0),void 0===n&&(n=!1);var a={};return a.mode=n?1:0,void 0!==i&&(a.startX=Ki(i,t.x),a.endX=t.x),void 0!==s&&(a.startY=Ki(s,t.y),a.endY=t.y),a.duration=e,a.ease=void 0===r?"Linear":r,void 0===h?h=new $i(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),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*Zi(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 $i&&(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=Ki(i,t.x)),void 0!==s&&(a.startY=t.y,a.endY=Ki(s,t.y)),a.duration=e,a.ease=void 0===r?"Linear":r,void 0===h?h=new $i(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),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}},ts={};Object.assign(ts,Qi),ts.onInitEaseMove=function(){Qi.onInitEaseMove.call(this);var t=this;this._easeMove.on("update",(function(){var e=me.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const es=Phaser.Utils.Objects.GetValue;class is extends ri{constructor(t,e){super(t,e),this.timer=new ci,this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.timer.resetFromJSON(es(t,"timer")),this.setEnable(es(t,"enable",!0)),this.setMode(es(t,"mode",1)),this.isRunning=es(t,"isRunning",!1),this.setMagnitudeMode(es(t,"magnitudeMode",1)),this.setAxisMode(es(t,"axis",0)),this.setDuration(es(t,"duration",500)),this.setMagnitude(es(t,"magnitude",10)),this.ox=es(t,"ox",void 0),this.oy=es(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=ss[t]),this.mode=t,this}setMagnitudeMode(t){return"string"==typeof t&&(t=ns[t]),this.magnitudeMode=t,this}setAxisMode(t){return"string"==typeof t&&(t=rs[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=es(i,"magnitude",void 0),t=es(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 ss={effect:0,behavior:1},rs={both:0,"h&v":0,"x&y":0,horizontal:1,h:1,x:1,vertical:2,v:2,y:2},ns={constant:0,decay:1},hs=Phaser.Utils.Objects.IsPlainObject;var as={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 is(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 os=Phaser.Utils.Objects.GetValue,ls=Phaser.Math.Linear;class ds extends Ci{constructor(t,e){super(t,e),this.resetFromJSON(),this.boot()}start(t){if(this.timer.isRunning)return this;var e=this.target;this.propertyKey=os(t,"key","value");var i=e[this.propertyKey];return this.fromValue=os(t,"from",i),this.toValue=os(t,"to",i),this.setEase(os(t,"ease",this.ease)),this.setDuration(os(t,"duration",this.duration)),this.setRepeat(os(t,"repeat",0)),this.setDelay(os(t,"delay",0)),this.setRepeatDelay(os(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]=ls(this.fromValue,this.toValue,i)}}const cs=Phaser.Utils.Objects.IsPlainObject;class us extends Qe{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 ds(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(cs(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(cs(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 ps={easeDataTo(t,e,i,s){return this._easeData||(this._easeData=new us(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),Ei(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}},vs=Phaser.Utils.Array.Remove,gs={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=$e(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}},Rs={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}},Ls={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}},Ds={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,Ms,Rs,Ls,Ds);const Ys=Phaser.Utils.Objects.GetValue;class Ws extends Qe{constructor(t,e){super(t,e),this.setTransitInTime(Ys(e,"duration.in",200)),this.setTransitOutTime(Ys(e,"duration.out",200)),this.setTransitInCallback(Ys(e,"transitIn")),this.setTransitOutCallback(Ys(e,"transitOut")),this.oneShotMode=Ys(e,"destroy",!1),this.delayCallTimer=void 0,this._state=new Es(this,{eventEmitter:!1,initState:Ys(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,As);var Xs=function(t){if(t.parentContainer)return Xs(t.parentContainer);var e=function(t){var e=t.displayList;return U(e)?e:null}(t);return e?Xs(e):t};class zs extends Qe{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=Xs(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;let js=class extends Fs{constructor(t,e,i){super(t,0,0,2,2,e,1),this.fullWindow=new zs(this),this.setAlpha(i)}get tint(){return this.fillColor}set tint(t){this.setFillStyle(t,this.fillAlpha)}};const Is=Phaser.Utils.Objects.GetValue;class Bs extends Qe{constructor(t,e){super(t,{eventEmitter:!1}),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setHitAreaMode(Is(t,"hitAreaMode",0)),this.setEnable(Is(t,"enable",!0)),this.setStopMode(Is(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 Ns=Phaser.Utils.Objects.GetValue;class Vs extends js{constructor(t,e){super(t,Ns(e,"color",0),Ns(e,"alpha",.8)),this.touchEventStop=new Bs(this,{hitAreaMode:1})}}var Gs={popUp(t,e){void 0!==t._modalScaleSave?(t.scaleX=t._modalScaleSave,t.scaleY=t._modalScaleSave):t._modalScaleSave=t.scaleX,_i(t,e)},scaleDown(t,e){ki(t,e,void 0,void 0,!1)},fadeIn(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,ji(t,e)},fadeOut(t,e){Ii(t,e,!1)}},Us=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,ji(t,e,t.alpha)},$s=function(t,e){Ii(t,e,!1)},Js=function(t,e,i,s,r){return!(!t||s&&!s(t,e,i)||!rt(t,!0).contains(e,i)||r&&!r(t,e,i))};const Ks=Phaser.Utils.Objects.GetValue;let qs=class extends Ws{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=Zs.popUp),null==e.transitOut&&(e.transitOut=Zs.scaleDown),e.destroy=Ks(e,"destroy",!0),super(t,e);var i=Ks(e,"cover");this.cover=!1!==i?function(t,e){var i=t.scene,s=new Vs(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(Ks(i,"transitIn",Us)),this.setCoverTransitOutCallback(Ks(i,"transitOut",$s)));var s=Ks(e,"touchOutsideClose",!1),r=Ks(e,"duration.hold",-1),n=Ks(e,"timeOutClose",r>=0),h=Ks(e,"anyTouchClose",!1);Ks(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),Ks(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&&Js(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=Zs[t]),t){case Zs.popUp:t=Gs.popUp;break;case Zs.fadeIn:t=Gs.fadeIn}return super.setTransitInCallback(t),this}setTransitOutCallback(t){switch("string"==typeof t&&(t=Zs[t]),t){case Zs.scaleDown:t=Gs.scaleDown;break;case Zs.fadeOut:t=Gs.fadeOut}return super.setTransitOutCallback(t),this}setCoverTransitInCallback(t){return this.coverTransitInCallback=t,this}setCoverTransitOutCallback(t){return this.coverTransitOutCallback=t,this}};const Zs={popUp:0,fadeIn:1,scaleDown:0,fadeOut:1};var Qs=function(t){return t&&"function"==typeof t},tr={modal(t,e){return Qs(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}},er=function(t,e,i,s,r){Qs(e)&&(r=s,s=i,i=e,e=this);var n=this.scene.events;return this.bindEvent(e,n,t,i,s,r),this},ir={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 er.call(this,"preupdate",t,e,i,s),this},bindSceneUpdateEvent(t,e,i,s){return er.call(this,"update",t,e,i,s),this},bindScenePostupdateEvent(t,e,i,s){return er.call(this,"postupdate",t,e,i,s),this},bindSceneRenderEvent(t,e,i,s){return er.call(this,"render",t,e,i,s),this},bindScenePauseEvent(t,e,i,s){return er.call(this,"pause",t,e,i,s),this},bindSceneResumeEvent(t,e,i,s){return er.call(this,"resume",t,e,i,s),this},bindSceneSleepEvent(t,e,i,s){return er.call(this,"sleep",t,e,i,s),this},bindSceneWakeEvent(t,e,i,s){return er.call(this,"wake",t,e,i,s),this},bindSceneShutdownEvent(t,e,i,s){return er.call(this,"shutdown",t,e,i,s),this}},sr=function(t,e,i){var s=t.camera;return s?(void 0===i?i={}:!0===i&&(i=rr),s===e?(i.x=t.worldX,i.y=t.worldY):s.getWorldPoint(t.x,t.y,i),i):null},rr={},nr=function(t,e,i,s){var r,n=t.scene.sys.cameras.main,h=0===t.scrollFactorX&&0===t.scrollFactorY;if(e)return h?Js(t,e.x,e.y,i,s):!!(r=sr(e,n,!0))&&Js(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 fr={press:0,pointerdown:0,release:1,pointerup:1};var mr={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 gr(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}},yr=function(t,e,i,s,r){if(e)return!(i&&!i(t,e)||!xr(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 br.length=0,!0;return br.length=0,!1},br=[];const Cr=Phaser.Utils.Objects.GetValue;class wr extends Qe{constructor(t,e){super(t,e),this._enable=void 0;var i=Cr(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(Cr(t,"enable",!0)),this.setMode(Cr(t,"mode",1)),this.setClickInterval(Cr(t,"clickInterval",100)),this.setDragThreshold(Cr(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=Sr[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?yr:nr)(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 Sr={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 Pr extends ks{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 _r extends Qe{constructor(t,e){super(t,e),this._enable=void 0,this.cooldown=new Pr,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 kr={isPointerInBounds(t){return void 0===t?t=this:"string"==typeof t&&(t=this.getElement(t)),!!t&&nr(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 _r(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 _r(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}},Er={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,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=Gr,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===Ur&&this.onDragEnd(),this.pointer=void 0,this.tracerState=Gr,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=$r,this}isPointerInGameObject(t,e,i){var s=this.lastPointer;return!!s&&nr(t,s,e,i)}}const Gr=0,Ur=1,$r="IDLE",Jr=Phaser.Utils.Objects.GetValue,Kr=Phaser.Math.Distance.Between;class qr extends Vr{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=Zr},eventEmitter:!1};this.setRecongizedStateObject(new ks(s))}resetFromJSON(t){super.resetFromJSON(t),this.setHoldTime(Jr(t,"time",250)),this.setTapInterval(Jr(t,"tapInterval",200)),this.setDragThreshold(Jr(t,"threshold",9)),this.setTapOffset(Jr(t,"tapOffset",10));var e=Jr(t,"taps",void 0);return void 0!==e?this.setTaps(e):(this.setMaxTaps(Jr(t,"maxTaps",void 0)),this.setMinTaps(Jr(t,"minTaps",void 0))),this}onDragStart(){switch(this.state){case Zr:this.state=Qr;break;case Qr:var t=this.lastPointer;Kr(t.upX,t.upY,t.x,t.y)>this.tapOffset&&(this.state=tn,this.state=Qr);break;case tn:this.state=Qr}}onDragEnd(){this.state===Qr&&(this.tapsCount++,this.emit("tapping",this,this.gameObject,this.lastPointer),void 0!==this.maxTaps&&this.tapsCount===this.maxTaps&&(this.state=tn))}onDrag(){this.state!==Zr&&this.pointer.getDistance()>this.dragThreshold&&(this.state=Zr)}preUpdate(t,e){if(this.isRunning&&this.enable&&this.state===Qr){var i=this.lastPointer;i.isDown?t-i.downTime>this.holdTime&&(this.state=Zr):t-i.upTime>this.tapInterval&&(void 0===this.minTaps||this.tapsCount>=this.minTaps?this.state=tn:this.state=Zr)}}postUpdate(t,e){this.isRunning&&this.enable&&this.state===tn&&(this.state=Zr)}get isTapped(){return this.state===tn}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 Zr="IDLE",Qr="BEGIN",tn="RECOGNIZED",en=Phaser.Utils.Objects.GetValue;class sn extends Vr{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=rn},eventEmitter:!1};this.setRecongizedStateObject(new ks(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(en(t,"threshold",9)),this.setHoldTime(en(t,"time",251)),this}onDragStart(){this.state=nn,0===this.holdTime&&(this.state=hn)}onDragEnd(){this.state=rn}onDrag(){this.state!==rn&&this.pointer.getDistance()>this.dragThreshold&&(this.state=rn)}preUpdate(t,e){this.isRunning&&this.enable&&this.state===nn&&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 rn="IDLE",nn="BEGIN",hn="RECOGNIZED";Phaser.Utils.Objects.GetValue;var an=function(t){return qe(t).loop.delta};const on=Phaser.Math.Distance.Between,ln=Phaser.Math.Angle.Between;var dn={getDt:function(){return an(this.scene)},getVelocity:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return on(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 ln(e.x,e.y,t.x,t.y)}},cn={"up&down":0,"left&right":1,"4dir":2,"8dir":3},un={};const pn=Phaser.Utils.Objects.GetValue,vn=Phaser.Math.RadToDeg;class gn extends Vr{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=fn},eventEmitter:!1};this.setRecongizedStateObject(new ks(s)),this.clearDirectionStates()}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(pn(t,"threshold",10)),this.setVelocityThreshold(pn(t,"velocityThreshold",1e3)),this.setDirectionMode(pn(t,"dir","8dir")),this}onDragStart(){this.state=mn}onDragEnd(){this.state=fn}onDrag(){this.state===mn&&(this.validDrag||(this.validDrag=0===this.dragThreshold||this.pointer.getDistance()>=this.dragThreshold),this.validDrag&&this.dragVelocity>this.velocityThreshold&&(this.state=yn))}postUpdate(t,e){this.isRunning&&this.enable&&this.state===yn&&(this.state=fn)}get isSwiped(){return this.state===yn}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=un),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}}(vn(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,dn);const fn="IDLE",mn="BEGIN",yn="RECOGNIZED",xn=Phaser.Utils.Objects.GetValue,bn=Phaser.Utils.Array.SpliceOne,Cn=Phaser.Math.Distance.Between,wn=Phaser.Math.Angle.Between;class Sn{constructor(t,e){var i=$e(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(xn(e,"inputConfig",void 0)),this.setEventEmitter(xn(e,"eventEmitter",void 0)),this._enable=void 0,this.pointers=[],this.movedState={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setEnable(xn(t,"enable",!0)),this.bounds=xn(t,"bounds",void 0),this.tracerState=Pn,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 Pn:this.tracerState=Tn,this.onDrag1Start();break;case Tn:this.tracerState=_n,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],bn(this.pointers,e),this.tracerState){case Tn:this.tracerState=Pn,this.onDrag1End();break;case _n: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 _n:this.onDrag2()}}}dragCancel(){return this.tracerState===_n&&this.onDrag2End(),this.pointers.length=0,gt(this.movedState),this.tracerState=Pn,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!==_n)return 0;var t=this.pointers[0],e=this.pointers[1];return Cn(t.x,t.y,e.x,e.y)}get angleBetween(){if(this.tracerState!==_n)return 0;var t=this.pointers[0],e=this.pointers[1];return wn(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!==_n)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.x+e.x)/2}get centerY(){if(this.tracerState!==_n)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.y+e.y)/2}get prevCenterX(){if(this.tracerState!==_n)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!==_n)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&&nr(t,s,e,i)}isPointer1InGameObject(t,e,i){var s=this.pointers[1];return!!s&&nr(t,s,e,i)}}Object.assign(Sn.prototype,Ve);var On={};const Pn=0,Tn=1,_n=2,kn="IDLE";Phaser.Utils.Objects.GetValue;const En=Phaser.Math.RotateAround;var Mn=function(t,e,i,s){return En(t,e,i,s),t.rotation+=s,t},Rn={};const Ln=Phaser.Utils.Objects.GetValue,Dn=Phaser.Math.Angle.WrapDegrees,An=Phaser.Math.Angle.ShortestBetween,Yn=Phaser.Math.RadToDeg,Wn=Phaser.Math.DegToRad;var Xn={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,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=Dn(Yn(this.angleBetween));this.angle=An(this.prevAngle,t),this.prevAngle=t,this.state=jn}break;case jn:t=Dn(Yn(this.angleBetween)),this.angle=An(this.prevAngle,t),this.prevAngle=t,this.emit("rotate",this)}}get isRotated(){return this.state===jn}get rotation(){return Wn(this.angle)}setDragThreshold(t){return this.dragThreshold=t,this}}.prototype,Xn);const zn="IDLE",Fn="BEGIN",jn="RECOGNIZED",In=Phaser.Utils.Objects.GetValue;var Bn=function(t){var e=In(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){Rr(i.eventEmitter,`${i.eventNamePrefix}${t.tapsCount}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Hn=Phaser.Utils.Objects.GetValue;var Nn=function(t){var e=Hn(t,"press",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._press=new sn(this,e),this._press.on("pressstart",(function(t,e,s){Rr(i.eventEmitter,`${i.eventNamePrefix}pressstart`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this).on("pressend",(function(t,e,s){Rr(i.eventEmitter,`${i.eventNamePrefix}pressend`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Vn=Phaser.Utils.Objects.GetValue;var Gn=function(t){var e=Vn(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";Rr(i.eventEmitter,`${i.eventNamePrefix}swipe${r}`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Un=Phaser.Utils.Objects.GetValue;var $n=function(t,e){return t.setInteractive(),Un(e,"dropZone",!1)&&(t.input.dropZone=!0),t._childrenInteractive={targetSizers:Un(e,"targets",[t]),targetMode:Un(e,"targetMode","parent"),eventEmitter:Un(e,"eventEmitter",t),eventNamePrefix:Un(e,"inputEventPrefix","child.")},Dr.call(t,e),Wr.call(t,e),Fr.call(t,e),Hr.call(t,e),Bn.call(t,e),Nn.call(t,e),Gn.call(t,e),t},Jn={getSizerConfig:function(t){return void 0===t&&(t=this),Et(t)},getChildPrevState:function(t){var e=Et(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=ae(e,"color"),s=ae(e,"lineWidth");var o=ae(e,"name",!1);o&&(r=ae(o,"createTextCallback",le),n=ae(o,"createTextCallbackScope",void 0),"string"==typeof(h=ae(o,"align","left-top"))&&(h=Yt[h]))}if(void 0===i&&(i=16777215),void 0===s&&(s=1),r&&!t.children){t.children=new oe(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)}}for(var d,c,u=this.getAllShownChildren([this]),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 rh=Phaser.Utils.Objects.IsPlainObject,nh=Phaser.Utils.Objects.GetValue,hh=Phaser.Display.Align.CENTER,ah={min:0,full:-1};var oh=function(t,e,i,s,r,n,h,a,o,l){ve.call(this,t);var d=t.isRexSpace,c=typeof e;if(null===e)return this;if("number"===c);else if("string"===c)e=ah[e];else if(rh(e)){var u;e=nh(u=e,"proportion",void 0),i=nh(u,"align",hh),s=nh(u,"padding",0),r=nh(u,"expand",!1),n=nh(u,"key",void 0),h=nh(u,"index",void 0),t.isRexSizer||(a=nh(u,"minWidth",void 0),o=nh(u,"minHeight",void 0)),l=nh(u,"fitRatio",0)}return"string"==typeof i&&(i=Yt[i]),void 0===e&&(e=d?1:0),void 0===i&&(i=hh),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===a&&(d?a=0:t.isRexSizer||(a=t._minWidth)),void 0===o&&(d?o=0:t.isRexSizer||(o=t._minHeight)),void 0===l||!1===l?l=0:!0===l&&(l=Q(t)/tt(t)),(u=this.getSizerConfig(t)).proportion=e,u.align=i,u.padding=ue(s),u.expand=r,u.fitRatio=0===e?l:0,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},lh={add:oh,addSpace(t){return this.insertSpace(void 0,t),this},insertSpace(t,e){return void 0===e&&(e=1),oh.call(this,new ih(this.scene),{proportion:e,minWidth:0,minHeight:0,index:t}),this},insert(t,e,i,s,r,n,h,a){return rh(i)&&(i.index=t),oh.call(this,e,i,s,r,n,h,t,a),this},insertAtPosition(t,e,i,s,r,n,h,a,o){var l=sh.call(this,t,e);return-1===l&&(l=void 0),this.insert(l,i,s,r,n,h,a,o),this}};const dh=kt.prototype.clear;var ch=function(t){this.backgroundChildren&&(this.backgroundChildren.length=0);var e,i=!t&&this.sizerEventsEnable;if(i&&(e=this.getChildren([])),dh.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}},vh={getChildAlign(t){return this.getSizerConfig(t).align},setChildAlign(t,e){return"string"==typeof e&&(e=Yt[e]),this.getSizerConfig(t).align=e,this}},gh={getChildProportion(t){return this.getSizerConfig(t).proportion},setChildProportion(t,e){return this.getSizerConfig(t).proportion=e,this}},fh={getChildExpand(t){return this.getSizerConfig(t).expand},setChildExpand(t,e){return this.getSizerConfig(t).expand=e,this}},mh={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}},yh={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&&(Ie(t,0,0),e.resolved=!1,this.hasRatioFitChild=!0);return this._childrenProportion=void 0,this.hasProportion0Child=!1,this.proportionLength=void 0,ze.call(this),this},layoutChildren:function(){for(var t,e,i,s,r,n,h,a,o,l,d=this.sizerChildren,c=this.innerLeft,u=this.innerTop,p=this.innerWidth,v=this.innerHeight,g=c,f=u,m=this.startChildIndex,y=0,x=d.length;y0?(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)||Le.call(this)},runWidthWrap:function(t){this.wrapResult||(1===this.orientation&&th.call(this,t,void 0),De.call(this,t))},hasHeightWrap:function(){return!(!this.hasRatioFitChild||0!==this.orientation)||Ye.call(this)},runHeightWrap:function(t){this.wrapResult||(0===this.orientation&&th.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(yh,lh,ph,vh,gh,fh,mh);var xh=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},bh={x:0,h:0,horizontal:0,"left-to-right":0,y:1,v:1,vertical:1,"top-to-bottom":1};const Ch=Phaser.Utils.Objects.IsPlainObject,wh=Phaser.Utils.Objects.GetValue;class Sh extends qn{constructor(t,e,i,s,r,n,h){Ch(e)?(e=wh(h=e,"x",0),i=wh(h,"y",0),s=wh(h,"width",void 0),r=wh(h,"height",void 0),n=wh(h,"orientation",0)):Ch(s)?(s=wh(h=s,"width",void 0),r=wh(h,"height",void 0),n=wh(h,"orientation",0)):Ch(n)&&(n=wh(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(wh(h,"space.item",0)),this.setStartChildIndex(wh(h,"startChildIndex",0)),this.setRTL(wh(h,"rtl",!1)),this.addChildrenMap("items",this.sizerChildren)}setOrientation(t){return this.orientation=function(t){return"string"==typeof t&&(t=bh[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=xh.call(this)),this._childrenProportion}}Object.assign(Sh.prototype,yh);var Oh=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}},Ph=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},Th={appendText:Ph,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 _h extends Sh{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&&(Oh(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&&(Oh(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&&Oh(t,this.iconWidth,this.iconHeight);var e=this.childrenMap.action;e&&void 0!==this.actionWidth&&void 0!==this.actionHeight&&Oh(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(_h.prototype,Th);var kh=function(t,e,i,s,r){if(this.clear().fillStyle(16777215),1===this.shapeType){i=i.left;var n=Math.min(t,e)/2;this.fillCircle(-t*(s-.5),-e*(r-.5),n+i)}else this.fillRect(-t*s-i.left,-e*r-i.top,t+i.left+i.right,e+i.top+i.bottom)},Eh=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};const Mh=Phaser.GameObjects.Graphics;class Rh extends Mh{constructor(t,e,i){void 0===e&&(e=0),"string"==typeof e&&(e=Lh[e]),super(t.scene),this.parent=t,this.shapeType=e,this.padding=ue(i),this.setPosition().resize().setVisible(!1)}destroy(){return this.parent=void 0,super.destroy(),this}setPosition(t,e){var i=this.parent;return void 0===t&&(t=i.x),void 0===e&&(e=i.y),super.setPosition(t,e),this}resize(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=ue(i));var r=this.width!==t||this.height!==e,n=this.padding!==i&&!Eh(this.padding,i);return r||n?(this.width=t,this.height=e,n&&ft(i,this.padding),this.originX=s.originX,this.originY=s.originY,kh.call(this,t,e,i,s.originX,s.originY),this):this}setOrigin(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,kh.call(this,this.width,this.height,this.padding,t,e)),this}}const Lh={rectangle:0,circle:1};var Dh=function(t,e,i,s){var r=new Rh(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 Ah=Phaser.GameObjects.Text;var Yh=function(t){return t instanceof Ah};const Wh=Phaser.GameObjects.BitmapText;var Xh=function(t){return t instanceof Wh},zh=function(t){return Xh(t)?2:Yh(t)?0:1},Fh=/^[\x00-\x7F]+$/,jh=function(t){return Fh.test(t)},Ih=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},Hh=0,Nh=1,Vh=2,Gh=0,Uh=1,$h=2,Jh=/(?:\r\n|\r|\n)/;const Kh={none:Gh,word:Uh,char:$h,character:$h,mix:3},qh=Phaser.Renderer.WebGL.Utils;var Zh={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=qh.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 Qh=Phaser.Display.Color;var ta={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 Qh);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}},ea=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)},ia={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,ea(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 sa=Phaser.Display.Canvas.CanvasPool,ra=Phaser.GameObjects.GameObject,na=Phaser.Utils.String.UUID;class ha extends ra{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=sa.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=na(),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(){sa.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 aa=Phaser.GameObjects.Components;Phaser.Class.mixin(ha,[aa.Alpha,aa.BlendMode,aa.Crop,aa.Depth,aa.Flip,aa.GetBounds,aa.Mask,aa.Origin,aa.Pipeline,aa.PostPipeline,aa.ScrollFactor,aa.Tint,aa.Transform,aa.Visible,Zh,ta,ia]);var oa={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:Ss(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&>(this.data),this}};class la{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(la.prototype,oa);var da={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 ca=Phaser.Math.RotateAround;var ua;const pa=Phaser.Geom.Rectangle;var va,ga=function(t){void 0===va&&(va=new pa);var e=t.drawTLX,i=t.drawTLY;return va.setTo(e,i,t.drawTRX-e,t.drawBLY-i),va};const fa=Phaser.Math.RotateAround;var ma,ya=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&&fa(s,0,0,t.rotation),s.x=s.x*t.scaleX+t.drawX,s.y=s.y*t.scaleY+t.drawY,s};const xa=Phaser.GameObjects.Components.TransformMatrix;var ba,Ca,wa={},Sa=function(t,e,i,s,r){var n=ya(e,i,s,!0),h=function(t,e,i,s){void 0===s?s={}:!0===s&&(s=wa);var r=e-t.width*t.originX,n=i-t.height*t.originY;return void 0===ba&&(ba=new xa,Ca=new xa),t.parentContainer?t.getWorldTransformMatrix(ba,Ca):ba.applyITRS(t.x,t.y,t.rotation,t.scaleX,t.scaleY),ba.transformPoint(r,n,s),s}(t,n.x,n.y,r);return h},Oa=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 Sa(t,e,n,h,r)},Pa={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===ua&&(ua={}),s=ua),s.x=(t-i.drawX)/i.scaleX,s.y=(e-i.drawY)/i.scaleY,0!==i.rotation&&ca(s,0,0,-i.rotation),s}(t,e,this,!0);return ga(this).contains(i.x,i.y)},getWorldPosition:function(t,e,i){return Oa(this.parent,this,t,e,i)}};Object.assign(Pa,da);const Ta=Phaser.Math.DegToRad,_a=Phaser.Math.RadToDeg,ka=Phaser.Utils.Objects.GetValue;class Ea extends la{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 _a(this._rotation)}set angle(t){this.rotation=Ta(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=ka(t,"width",void 0),i=ka(t,"height",void 0),s=ka(t,"scaleX",void 0),r=ka(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(Ea.prototype,Pa);const Ma=Phaser.Utils.String.Pad;var Ra=function(t,e,i){if(null==t)return t;switch(typeof t){case"string":default:return t;case"number":return`#${Ma(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}},La=function(t,e,i){return e.hasOwnProperty(t)?e[t]:i[t]};const Da=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=Da(t,"x",0),i=Da(t,"y",0));var s=this.cornerRadius;s.tl=Ya(Da(t,"tl",void 0),e,i),s.tr=Ya(Da(t,"tr",void 0),e,i),s.bl=Ya(Da(t,"bl",void 0),e,i),s.br=Ya(Da(t,"br",void 0),e,i)}get radiusTL(){var t=this.cornerRadius.tl;return Math.max(t.x,t.y)}set radiusTL(t){Wa(this.cornerRadius.tl,t)}get radiusTR(){var t=this.cornerRadius.tr;return Math.max(t.x,t.y)}set radiusTR(t){Wa(this.cornerRadius.tr,t)}get radiusBL(){var t=this.cornerRadius.bl;return Math.max(t.x,t.y)}set radiusBL(t){Wa(this.cornerRadius.bl,t)}get radiusBR(){var t=this.cornerRadius.br;return Math.max(t.x,t.y)}set radiusBR(t){Wa(this.cornerRadius.br,t)}};var Ya=function(t,e,i){return void 0===t?t={x:e,y:i}:"number"==typeof t&&(t={x:t,y:t}),Xa(t),t},Wa=function(t,e){"number"==typeof e?(t.x=e,t.y=e):(t.x=Da(e,"x",0),t.y=Da(e,"y",0)),Xa(t)},Xa=function(t){t.convex=t.x>=0||t.y>=0,t.x=Math.abs(t.x),t.y=Math.abs(t.y)};const za=Phaser.Math.DegToRad;var Fa=function(t){return!t.hasOwnProperty("convex")||t.convex},ja=function(t){return t.x>0&&t.y>0},Ia=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,ja(a)?(o=a.x*g,l=a.y*f,Fa(a)?Ia(t,o,l,o,l,180,270,!1,h):Ia(t,0,0,o,l,90,0,!0,h),d=0,c=l):(t.lineTo(0,0),d=0,c=0),a=m.tr,ja(a)?(o=a.x*g,l=a.y*f,Fa(a)?Ia(t,s-o,l,o,l,270,360,!1,h):Ia(t,s,0,o,l,180,90,!0,h)):t.lineTo(s,0),a=m.br,ja(a)?(o=a.x*g,l=a.y*f,Fa(a)?Ia(t,s-o,r-l,o,l,0,90,!1,h):Ia(t,s,r,o,l,270,180,!0,h)):t.lineTo(s,r),a=m.bl,ja(a)?(o=a.x*g,l=a.y*f,Fa(a)?Ia(t,o,r-l,o,l,90,180,!1,h):Ia(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())},Ha=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),Ba(t.canvas,t.context,d,d,o,l,r,e,i,s,n,h,a)}};const Na=Phaser.Utils.Objects.GetValue;class Va extends Ea{constructor(t,e){super(t,"background"),this.setScrollFactor(0),this.setColor(Na(e,"color",null),Na(e,"color2",null),Na(e,"horizontalGradient",!0)),this.setStroke(Na(e,"stroke",null),Na(e,"strokeThickness",2)),this.setCornerRadius(Na(e,"cornerRadius",0),Na(e,"cornerIteration",null))}set color(t){t=Ra(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=Ra(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=Ra(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,La("color2",t,this),La("horizontalGradient",t,this)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,La("strokeThickness",t,this)),t.hasOwnProperty("cornerRadius")&&this.setCornerRadius(t.cornerRadius,La("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(){Ha(this.parent,this.color,this.stroke,this.strokeThickness,this.cornerRadius,this.color2,this.horizontalGradient,this.cornerIteration)}}const Ga=Phaser.Utils.Objects.GetValue;class Ua extends Ea{constructor(t,e){super(t,"innerbounds"),this.setScrollFactor(0),this.setColor(Ga(e,"color",null),Ga(e,"color2",null),Ga(e,"horizontalGradient",!0)),this.setStroke(Ga(e,"stroke",null),Ga(e,"strokeThickness",2))}set color(t){t=Ra(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=Ra(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=Ra(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,Ga(t,"color2",null),Ga(t,"horizontalGradient",!0)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,Ga(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 $a=Phaser.Utils.Objects.GetValue;let Ja=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($a(t,"bold",!1)),this.setItalic($a(t,"italic",!1)),this.setFontSize($a(t,"fontSize","16px")),this.setFontFamily($a(t,"fontFamily","Courier")),this.setColor($a(t,"color","#fff")),this.setStrokeStyle($a(t,"stroke",null),$a(t,"strokeThickness",0)),this.setShadow($a(t,"shadowColor",null),$a(t,"shadowOffsetX",0),$a(t,"shadowOffsetY",0),$a(t,"shadowBlur",0)),this.setOffset($a(t,"offsetX",0),$a(t,"offsetY",0)),this.setSpace($a(t,"leftSpace",0),$a(t,"rightSpace",0)),this.setAlign($a(t,"align",void 0)),this.setBackgroundColor($a(t,"backgroundColor",null)),this.setBackgroundHeight($a(t,"backgroundHeight",void 0)),this.setBackgroundBottomY($a(t,"backgroundBottomY",void 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(La("stroke",t,this),La("strokeThickness",t,this)),t.hasOwnProperty("shadowColor")&&this.setShadowColor(t.shadowColor),(t.hasOwnProperty("shadowOffsetX")||t.hasOwnProperty("shadowOffsetY"))&&this.setShadowOffset(La("shadowOffsetX",t,this),La("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),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=Ra(t),this}get hasFill(){return null!=this.color}setStrokeStyle(t,e){return this.stroke=Ra(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=Ra(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=Ra(t),this}get hasBackgroundColor(){return null!=this.backgroundColor}setBackgroundHeight(t){return this.backgroundHeight=t,this}setBackgroundBottomY(t){return this.backgroundBottomY=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 Ka=Phaser.Utils.Array.Remove,qa=Phaser.Utils.Array.Remove,Za="text",Qa="image",to="drawer",eo="space",io="command";var so=function(t){return t.type===Za&&"\n"===t.text},ro=function(t){return t.type===Za&&"\f"===t.text},no=function(t){return t.type===Za};class ho extends Ea{constructor(t,e,i){super(t,Za),this.updateTextFlag=!1,this.style=new Ja(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,s=this.drawTRX-i+1,r=e.backgroundBottomY;null==r&&(r=this.drawBLY);var n=e.backgroundHeight;null==n&&(n=r-this.drawTLY);var h=r-n;t.fillRect(i,h,s,n)}var a=e.hasFill,o=e.hasStroke;(a||o)&&(e.syncFont(t).syncStyle(t),o&&(e.syncShadow(t),t.strokeText(this.text,0,0)),a&&(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 ao=function(t,e){var i=this.createCharChildren(t,e);return this.addChild(i),this};const oo=Phaser.Display.Canvas.CanvasPool;var lo=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=oo.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),oo.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 co extends Ea{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(){lo(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 uo extends Ea{constructor(t,e,i,s){super(t,to),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 Ea{constructor(t,e){super(t,eo),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 vo extends la{constructor(t,e,i,s,r){super(t,io),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 go(t){if(null===t||"object"!=typeof t)return t;if(Array.isArray(t))return t.map((t=>go(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]=go(t[i]));return e}var fo=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 yo=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=wo.call(this)).height,h=l.ascent,i=Math.floor((o-h)/n))}else{var l;n=(l=wo.call(this)).height,h=l.ascent}}else this.fixedHeight>0?void 0===(i=Oo(t,"maxLines"))&&(o=this.fixedHeight-s,i=Math.floor(o/n)):i=Oo(t,"maxLines",0);void 0===h&&(h=n);var d=0===i,c=Oo(t,"wrapMode");void 0===c&&(c=Oo(t,"charWrap",!1)?"char":"word"),"string"==typeof c&&(c=mo[c]);var u=Oo(t,"wrapWidth",void 0);void 0===u&&(this.fixedWidth>0?u=this.fixedWidth-r:(u=1/0,c=0));for(var p=Oo(t,"letterSpacing",0),v=Oo(t,"hAlign",0),g=Oo(t,"vAlign",0),f=Oo(t,"justifyPercentage",.25),m=fo({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=_o(t,"maxLines",void 0))){var h=this.fixedWidth-r;i=Math.floor(h/n)+1}}else i=_o(t,"maxLines",0);var a=0===i,o=_o(t,"fixedCharacterHeight",void 0);if(void 0===o){var l=_o(t,"charPerLine",void 0);if(void 0!==l){var d=this.fixedHeight-s;o=Math.floor(d/l)}}var c=_o(t,"wrapHeight",void 0);void 0===c&&(c=this.fixedHeight>0?this.fixedHeight-s:1/0);for(var u=_o(t,"letterSpacing",0),p=_o(t,"rtl",!0),v=_o(t,"hAlign",p?2:0),g=_o(t,"vAlign",0),f=fo({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 X=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 Ee(i,t,e),this.dirty=this.dirty||s!=i.left||r!=i.right||n!=i.top||h!=i.bottom,this},getPadding:function(t){return ke(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),Ka(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 qa(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(Za);return null===i?i=new ho(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)),Oa(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 Zo=Phaser.Utils.Objects.GetFastValue;var Qo={};class tl{constructor(t){this.pools=Zo(t,"pools",Qo)}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;ei&&(r=Math.floor(i));for(var n={},h=ol(t,r,e,i,n),a=0;a<=nl&&0!==h;a++){if((r+=h)<0){r=0;break}h=ol(t,r,e,i,n)}return a===nl&&console.warn("FontSizeFit: Test count exceeds 65535"),t.setFontSize(r),ll(t,e,i),t},al=function(t,e,i){return void 0===i[e]&&(t.setFontSize(e),i[e]={width:t.width,height:t.height}),i[e]},ol=function(t,e,i,s,r){var n,h=al(t,e,r),a=al(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)},ll=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 dl=Phaser.Utils.Objects.GetValue,cl=Phaser.Utils.Objects.GetValue;class ul extends _h{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexLabel";var i,s=cl(e,"background",void 0),r=cl(e,"icon",void 0),n=cl(e,"iconMask",void 0),h=cl(e,"text",void 0),a=cl(e,"action",void 0),o=cl(e,"actionMask",void 0),l=cl(e,"align",void 0);if(s&&this.addBackground(s),r){0===this.orientation?(h||a)&&(i={right:cl(e,"space.icon",0),top:cl(e,"space.iconTop",0),bottom:cl(e,"space.iconBottom",0),left:cl(e,"space.iconLeft",0)}):(h||a)&&(i={bottom:cl(e,"space.icon",0),left:cl(e,"space.iconLeft",0),right:cl(e,"space.iconRight",0),top:cl(e,"space.iconTop",0)});var d=cl(e,"squareFitIcon",!1)?1:0;if(this.add(r,{proportion:0,padding:i,fitRatio:d}),n&&(n=Dh.call(this,r,r,1)),!d){var c=cl(e,"iconSize",void 0);this.setIconSize(cl(e,"iconWidth",c),cl(e,"iconHeight",c))}}if(h){var u=cl(e,"wrapText",!1),p=cl(e,"adjustTextFontSize",!1);u?(!0===u&&(u="word"),function(t,e){switch(zh(t)){case 0:switch("string"==typeof e&&(e=Kh[e]||0),t.style.wrapMode=e,e){case 2:case 3:t.style.wordWrapCallback=Ih;break;default:t.style.wordWrapCallback=null}break;case 1:"string"==typeof e&&(e=Kh[e]||0),t.style.wrapMode=e}}(h,u),e.expandTextWidth=!0,rl(h)):p&&(e.expandTextWidth=!0,e.expandTextHeight=!0,function(t,e){"number"==typeof e&&(e={minWidth:e});var i=dl(e,"minWidth",0),s=dl(e,"minHeight",0),r=dl(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 hl(t,e,i),t}):(t.runWidthWrap=function(e){return t.setFixedSize&&t.setFixedSize(0,0),hl(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=cl(e,"space.text",0),m=cl(e,"expandTextWidth",!1),y=cl(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:cl(e,"space.actionTop",0),bottom:cl(e,"space.actionBottom",0),right:cl(e,"space.actionRight",0)}:{left:cl(e,"space.actionLeft",0),right:cl(e,"space.actionRight",0),bottom:cl(e,"space.actionBottom",0)},d=cl(e,"squareFitAction",!1)?1:0,this.add(a,{proportion:0,padding:i,fitRatio:d}),o&&(o=Dh.call(this,a,a,1)),!d)){var x=cl(e,"actionSize");this.setActionSize(cl(e,"actionWidth",x),cl(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 pl=Phaser.Renderer.WebGL.Utils,vl=function(t,e,i,s,r,n){for(var h=pl.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+")"},xl=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 bl=Phaser.Renderer.Canvas.SetTransform;var Cl={renderWebGL:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.pipelines.set(e.pipeline),n=ml(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&&vl(r,h,e,l,a,o),e.isStroked&&fl(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(bl(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(Sl.prototype,Cl);var Ol=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 Pl=Phaser.Math.DegToRad;var Tl=function(t,e,i,s,r,n,h,a,o){h&&n>r?n-=360:!h&&n0&&t.y>0};const Ll={rectangle:0,circle:1};var Dl=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},Al=function(t,e,i){if(void 0===i&&(i={}),Array.isArray(e))for(var s=0,r=e.length;s0,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};const kd=Phaser.Utils.Objects.GetValue,Ed=Phaser.Utils.Objects.IsPlainObject;class Md extends(ed(Ul)){constructor(t,e,i,s,r,n,h,a){Ed(e)?(e=kd(a=e,"x",0),i=kd(a,"y",0),s=kd(a,"width",2),r=kd(a,"height",2),n=kd(a,"barColor",void 0),h=kd(a,"value",0)):Ed(s)?(s=kd(a=s,"width",2),r=kd(a,"height",2),n=kd(a,"barColor",void 0),h=kd(a,"value",0)):Ed(n)&&(n=kd(a=n,"barColor",void 0),h=kd(a,"value",0)),super(t,e,i,s,r,a),this.type="rexLineProgress",this.bootProgressBase(a),this.addShape((new Td).setName("trackFill")).addShape((new Td).setName("bar")).addShape((new Td).setName("trackStroke")),this.setTrackColor(kd(a,"trackColor",void 0)),this.setBarColor(n),this.setTrackStroke(kd(a,"trackStrokeThickness",2),kd(a,"trackStrokeColor",void 0)),this.setSkewX(kd(a,"skewX",0)),this.setRTL(kd(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 Rd={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&&_d(s,0,0,e,i,t).close();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),_d(h,r,0,n,i,t).close());var a=this.getShape("trackStroke");a.lineStyle(this.trackStrokeThickness,this.trackStrokeColor),a.isStroked&&_d(a,0,0,e,i,t).end()}};Object.assign(Md.prototype,Rd);var Ld=function(t){return null==t||""===t||0===t.length},Dd=function(t,e,i,s){if(void 0===s&&(s="."),"object"==typeof t){if(Ld(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(Ld(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=go(i),s=go(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 qd(t)?(this.stretchMode.edge=Qd(Zd(t,"edge",0)),this.stretchMode.internal=Qd(Zd(t,"internal",0))):(t=Qd(t),this.stretchMode.edge=t,this.stretchMode.internal=t),this},getStretchMode:function(t,e){return ec.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 sc=Phaser.Utils.Objects.IsPlainObject,rc=Phaser.Utils.Objects.GetValue,nc=Phaser.GameObjects;var hc=void 0,ac=function(t,e){if(hc||(hc={},qe(t).events.once("destroy",(function(){for(var t in hc)hc[t].destroy();hc=void 0}))),!hc.hasOwnProperty(e)){var i=qe(t).scene.systemScene;(t=new nc[e](i)).setOrigin(0),hc[e]=t}return hc[e]};const oc=Phaser.GameObjects.RenderTexture;class lc extends(function(t,e){class i extends t{constructor(t,i,s,r,n,h,a,o,l,d){if(sc(i)?(i=rc(d=i,"x",0),s=rc(d,"y",0),r=rc(d,"width",1),n=rc(d,"height",1),h=rc(d,"key",void 0),a=rc(d,"baseFrame",void 0),o=rc(d,"columns",void 0),l=rc(d,"rows",void 0)):sc(r)?(r=rc(d=r,"width",1),n=rc(d,"height",1),h=rc(d,"key",void 0),a=rc(d,"baseFrame",void 0),o=rc(d,"columns",void 0),l=rc(d,"rows",void 0)):sc(h)?(h=rc(d=h,"key",void 0),a=rc(d,"baseFrame",void 0),o=rc(d,"columns",void 0),l=rc(d,"rows",void 0)):sc(a)?(a=rc(d=a,"baseFrame",void 0),o=rc(d,"columns",void 0),l=rc(d,"rows",void 0)):Array.isArray(a)?(d=l,l=o,o=a,a=rc(d,"baseFrame",void 0)):sc(o)&&(o=rc(d=o,"columns",void 0),l=rc(d,"rows",void 0)),void 0===a&&(a=rc(d,"frame",void 0)),void 0===o){var c=rc(d,"leftWidth",void 0),u=rc(d,"rightWidth",void 0);void 0!==c&&void 0!==u&&(o=[c,void 0,u])}if(void 0===l){var p=rc(d,"topHeight",void 0),v=rc(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(rc(d,"getFrameNameCallback",void 0)),this.setStretchMode(rc(d,"stretchMode",0)),this.setPreserveRatio(rc(d,"preserveRatio",!0));var g=rc(d,"maxFixedPartScale",1),f=rc(d,"maxFixedPartScaleX",g),m=rc(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,ic),i}(oc,"rexNinePatch")){}var dc={_drawImage:function(t,e,i,s,r,n){var h=ac(this,"Image").setTexture(t,e).setDisplaySize(r,n);this.draw(h,i,s)},_drawTileSprite:function(t,e,i,s,r,n){var h=ac(this,"TileSprite").setTexture(t,e).setSize(r,n);this.draw(h,i,s)}};Object.assign(lc.prototype,dc);let cc=class extends Qe{constructor(t,e){return super(t),new Proxy(this,this)}get(t,e){if(Wd(t,e))return t[e];var i=t.parent;return Wd(i,e)?i[e]:void 0}set(t,e,i){return Wd(t,e)?t[e]=i:Wd(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 uc=Phaser.Utils.Objects.GetValue;class pc extends lc{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexStatesNinePatch";var i=uc(e,"effects",!0);i&&Id(this,i),this.style=new cc(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign(pc.prototype,Fl);const vc=["alpha","tint","flipX","flipY"];var gc=function(t,e){if(!e)return t;for(var i=0,s=vc.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}},Pe=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,_e=Phaser.Utils.Objects.GetValue;var ke=function(t,e){return void 0===e?t:t[e]},Ee=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=_e(e,"left",0),t.right=_e(e,"right",0),t.top=_e(e,"top",0),t.bottom=_e(e,"bottom",0)),t},Me={getInnerPadding(t){return ke(this.space,t)},setInnerPadding(t,e){return Ee(this.space,t,e),this},getOuterPadding(t){return ke(this.getSizerConfig(this).padding,t)},setOuterPadding(t,e){return Ee(this.getSizerConfig(this).padding,t,e),this},getChildOuterPadding(t,e){return"string"==typeof t&&(t=this.getElement(t)),ke(this.getSizerConfig(t).padding,e)},setChildOuterPadding(t,e,i){return"string"==typeof t&&(t=this.getElement(t)),Ee(this.getSizerConfig(t).padding,e,i),this}},Re=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}},Le=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},De=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}},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},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},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}},ze=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?vi:pi,this.repeatCounter=0,this}stop(){return this.state=ci,this}update(t,e){this.state!==ci&&this.state!==fi&&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=gi)):(this.nowTime=this.duration,this.state=fi):this.nowTime>=0&&(this.state=vi))}get t(){var t;switch(this.state){case ci:case pi:case gi:t=0;break;case vi:t=this.nowTime/this.duration;break;case fi:t=1}return di(t,0,1)}set t(t){(t=di(t,-1,1))<0?(this.state=pi,this.nowTime=-this.delay*t):(this.state=vi,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===ci}get isDelay(){return this.state===pi}get isCountDown(){return this.state===vi}get isRunning(){return this.state===pi||this.state===vi}get isDone(){return this.state===fi}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}}const ci=0,pi=1,vi=2,gi=3,fi=-1;class mi extends ai{constructor(t,e){super(t,e),this.timer=new ui}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 yi=Phaser.Utils.Objects.GetValue,xi=Phaser.Utils.Objects.GetAdvancedValue,bi=Phaser.Tweens.Builders.GetEaseFunction;class Ci extends mi{resetFromJSON(t){return this.timer.resetFromJSON(yi(t,"timer")),this.setEnable(yi(t,"enable",!0)),this.setTarget(yi(t,"target",this.parent)),this.setDelay(xi(t,"delay",0)),this.setDuration(xi(t,"duration",1e3)),this.setEase(yi(t,"ease","Linear")),this.setRepeat(yi(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=bi(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,Si=Phaser.Utils.Objects.GetAdvancedValue,Oi=Phaser.Math.Linear;let Pi=class extends Ci{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(Si(t,"start",void 0),Si(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=Si(t,"x",this.parent.scaleX),this.startY=Si(t,"y",this.parent.scaleY)),"number"==typeof e?(this.endX=e,this.endY=e):(this.endX=Si(e,"x",void 0),this.endY=Si(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 _i=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 Pi(t,a):r.resetFromJSON(a),r.restart(),r},ki=function(t,e,i,s,r,n){void 0===s&&(s="Linear"),r instanceof Pi&&(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 Pi(t,h):n.resetFromJSON(h),n.restart(),n},Ei=function(t,e){return new Promise((function(i,s){t.once(e,(function(){i()}))}))},Mi=function(t){return Ei(t,"complete")};const Ri=Phaser.Utils.Objects.IsPlainObject;var Li={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(Ri(t)){var s=t;t=s.duration,e=s.orientation,i=s.ease}var r=void 0===this._scaleBehavior;return this._scaleBehavior=_i(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(Ri(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=ki(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(Ri(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 Pi(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),Mi(this._scaleBehavior)},isRunningScaleYoyo(){return this._scaleBehavior&&(this._scaleBehavior.completeEventName="scaleyoyo.complete")},isRunningEaseScale(){return this.isRunningPopUp()||this.isRunningScaleDown()||this.isRunningScaleYoyo()}},Di={};Object.assign(Di,Li),Di.onInitScale=function(){Li.onInitScale.call(this);var t=this;this._scaleBehavior.on("update",(function(){var e=me.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const Ai=Phaser.Utils.Objects.GetValue,Yi=Phaser.Utils.Objects.GetAdvancedValue,Wi=Phaser.Math.Linear;class Xi extends Ci{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(Yi(t,"start",this.parent.alpha),Yi(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=zi[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 zi={stop:0,destroy:1,yoyo:2},Fi=Phaser.Utils.Objects.IsPlainObject;var ji=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 Xi(t,h):s.resetFromJSON(h),s.restart(),s},Ii=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 Bi=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(Bi(t)){var i=t;t=i.duration,e=i.alpha}var s=void 0===this._fade;return this._fade=ji(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(Bi(t)){var i=t;t=i.duration,e=i.destroy}var s=void 0===this._fade;return this._fade=Ii(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()}},Ni={};Object.assign(Ni,Hi),Ni.onInitFade=function(){Hi.onInitFade.call(this);var t=this;this._fade.on("update",(function(){var e=me.getParentSizer(t);e&&e.resetChildAlphaState(t)}))};const Vi=Phaser.Utils.Objects.GetValue,Gi=Phaser.Utils.Objects.GetAdvancedValue,Ui=Phaser.Math.Linear;class $i extends Ci{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){if(super.resetFromJSON(t),this.setMode(Vi(t,"mode",0)),t&&(t.hasOwnProperty("x")||t.hasOwnProperty("y"))){var e=Gi(t,"x",void 0),i=Gi(t,"y",void 0);this.setTargetPosition(e,i)}else this.setTargetPosition(t);return this}setMode(t){return"string"==typeof t&&(t=Ji[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=Gi(i,"startX",void 0),this.startY=Gi(i,"startY",void 0),this.endX=Gi(i,"endX",void 0),this.endY=Gi(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=Ui(this.startX,this.endX,i)),this.hasMoveY&&(t.y=Ui(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Ji={stop:0,destroy:1,yoyo:2};var Ki=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,Zi=Phaser.Math.Distance.Between;var Qi={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*Zi(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 $i&&(h=n,n=void 0),void 0===n&&(n=!1);var a={};return a.mode=n?1:0,void 0!==i&&(a.startX=Ki(i,t.x),a.endX=t.x),void 0!==s&&(a.startY=Ki(s,t.y),a.endY=t.y),a.duration=e,a.ease=void 0===r?"Linear":r,void 0===h?h=new $i(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),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*Zi(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 $i&&(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=Ki(i,t.x)),void 0!==s&&(a.startY=t.y,a.endY=Ki(s,t.y)),a.duration=e,a.ease=void 0===r?"Linear":r,void 0===h?h=new $i(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),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}},ts={};Object.assign(ts,Qi),ts.onInitEaseMove=function(){Qi.onInitEaseMove.call(this);var t=this;this._easeMove.on("update",(function(){var e=me.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const es=Phaser.Utils.Objects.GetValue;class is extends ri{constructor(t,e){super(t,e),this.timer=new ui,this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.timer.resetFromJSON(es(t,"timer")),this.setEnable(es(t,"enable",!0)),this.setMode(es(t,"mode",1)),this.isRunning=es(t,"isRunning",!1),this.setMagnitudeMode(es(t,"magnitudeMode",1)),this.setAxisMode(es(t,"axis",0)),this.setDuration(es(t,"duration",500)),this.setMagnitude(es(t,"magnitude",10)),this.ox=es(t,"ox",void 0),this.oy=es(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=ss[t]),this.mode=t,this}setMagnitudeMode(t){return"string"==typeof t&&(t=ns[t]),this.magnitudeMode=t,this}setAxisMode(t){return"string"==typeof t&&(t=rs[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=es(i,"magnitude",void 0),t=es(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 ss={effect:0,behavior:1},rs={both:0,"h&v":0,"x&y":0,horizontal:1,h:1,x:1,vertical:2,v:2,y:2},ns={constant:0,decay:1},hs=Phaser.Utils.Objects.IsPlainObject;var as={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 is(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 os=Phaser.Utils.Objects.GetValue,ls=Phaser.Math.Linear;class ds extends Ci{constructor(t,e){super(t,e),this.resetFromJSON(),this.boot()}start(t){if(this.timer.isRunning)return this;var e=this.target;this.propertyKey=os(t,"key","value");var i=e[this.propertyKey];return this.fromValue=os(t,"from",i),this.toValue=os(t,"to",i),this.setEase(os(t,"ease",this.ease)),this.setDuration(os(t,"duration",this.duration)),this.setRepeat(os(t,"repeat",0)),this.setDelay(os(t,"delay",0)),this.setRepeatDelay(os(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]=ls(this.fromValue,this.toValue,i)}}const us=Phaser.Utils.Objects.IsPlainObject;class cs extends Qe{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 ds(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(us(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(us(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 ps={easeDataTo(t,e,i,s){return this._easeData||(this._easeData=new cs(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),Ei(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}},vs=Phaser.Utils.Array.Remove,gs={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=$e(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}},Rs={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}},Ls={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}},Ds={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,Ms,Rs,Ls,Ds);const Ys=Phaser.Utils.Objects.GetValue;class Ws extends Qe{constructor(t,e){super(t,e),this.setTransitInTime(Ys(e,"duration.in",200)),this.setTransitOutTime(Ys(e,"duration.out",200)),this.setTransitInCallback(Ys(e,"transitIn")),this.setTransitOutCallback(Ys(e,"transitOut")),this.oneShotMode=Ys(e,"destroy",!1),this.delayCallTimer=void 0,this._state=new Es(this,{eventEmitter:!1,initState:Ys(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,As);var Xs=function(t){if(t.parentContainer)return Xs(t.parentContainer);var e=function(t){var e=t.displayList;return U(e)?e:null}(t);return e?Xs(e):t};class zs extends Qe{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=Xs(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;let js=class extends Fs{constructor(t,e,i){super(t,0,0,2,2,e,1),this.fullWindow=new zs(this),this.setAlpha(i)}get tint(){return this.fillColor}set tint(t){this.setFillStyle(t,this.fillAlpha)}};const Is=Phaser.Utils.Objects.GetValue;class Bs extends Qe{constructor(t,e){super(t,{eventEmitter:!1}),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setHitAreaMode(Is(t,"hitAreaMode",0)),this.setEnable(Is(t,"enable",!0)),this.setStopMode(Is(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 Ns=Phaser.Utils.Objects.GetValue;class Vs extends js{constructor(t,e){super(t,Ns(e,"color",0),Ns(e,"alpha",.8)),this.touchEventStop=new Bs(this,{hitAreaMode:1})}}var Gs={popUp(t,e){void 0!==t._modalScaleSave?(t.scaleX=t._modalScaleSave,t.scaleY=t._modalScaleSave):t._modalScaleSave=t.scaleX,_i(t,e)},scaleDown(t,e){ki(t,e,void 0,void 0,!1)},fadeIn(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,ji(t,e)},fadeOut(t,e){Ii(t,e,!1)}},Us=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,ji(t,e,t.alpha)},$s=function(t,e){Ii(t,e,!1)},Js=function(t,e,i,s,r){return!(!t||s&&!s(t,e,i)||!rt(t,!0).contains(e,i)||r&&!r(t,e,i))};const Ks=Phaser.Utils.Objects.GetValue;let qs=class extends Ws{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=Zs.popUp),null==e.transitOut&&(e.transitOut=Zs.scaleDown),e.destroy=Ks(e,"destroy",!0),super(t,e);var i=Ks(e,"cover");this.cover=!1!==i?function(t,e){var i=t.scene,s=new Vs(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(Ks(i,"transitIn",Us)),this.setCoverTransitOutCallback(Ks(i,"transitOut",$s)));var s=Ks(e,"touchOutsideClose",!1),r=Ks(e,"duration.hold",-1),n=Ks(e,"timeOutClose",r>=0),h=Ks(e,"anyTouchClose",!1);Ks(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),Ks(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&&Js(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=Zs[t]),t){case Zs.popUp:t=Gs.popUp;break;case Zs.fadeIn:t=Gs.fadeIn}return super.setTransitInCallback(t),this}setTransitOutCallback(t){switch("string"==typeof t&&(t=Zs[t]),t){case Zs.scaleDown:t=Gs.scaleDown;break;case Zs.fadeOut:t=Gs.fadeOut}return super.setTransitOutCallback(t),this}setCoverTransitInCallback(t){return this.coverTransitInCallback=t,this}setCoverTransitOutCallback(t){return this.coverTransitOutCallback=t,this}};const Zs={popUp:0,fadeIn:1,scaleDown:0,fadeOut:1};var Qs=function(t){return t&&"function"==typeof t},tr={modal(t,e){return Qs(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}},er=function(t,e,i,s,r){Qs(e)&&(r=s,s=i,i=e,e=this);var n=this.scene.events;return this.bindEvent(e,n,t,i,s,r),this},ir={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 er.call(this,"preupdate",t,e,i,s),this},bindSceneUpdateEvent(t,e,i,s){return er.call(this,"update",t,e,i,s),this},bindScenePostupdateEvent(t,e,i,s){return er.call(this,"postupdate",t,e,i,s),this},bindSceneRenderEvent(t,e,i,s){return er.call(this,"render",t,e,i,s),this},bindScenePauseEvent(t,e,i,s){return er.call(this,"pause",t,e,i,s),this},bindSceneResumeEvent(t,e,i,s){return er.call(this,"resume",t,e,i,s),this},bindSceneSleepEvent(t,e,i,s){return er.call(this,"sleep",t,e,i,s),this},bindSceneWakeEvent(t,e,i,s){return er.call(this,"wake",t,e,i,s),this},bindSceneShutdownEvent(t,e,i,s){return er.call(this,"shutdown",t,e,i,s),this}},sr=function(t,e,i){var s=t.camera;return s?(void 0===i?i={}:!0===i&&(i=rr),s===e?(i.x=t.worldX,i.y=t.worldY):s.getWorldPoint(t.x,t.y,i),i):null},rr={},nr=function(t,e,i,s){var r,n=t.scene.sys.cameras.main,h=0===t.scrollFactorX&&0===t.scrollFactorY;if(e)return h?Js(t,e.x,e.y,i,s):!!(r=sr(e,n,!0))&&Js(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 fr={press:0,pointerdown:0,release:1,pointerup:1};var mr={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 gr(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}},yr=function(t,e,i,s,r){if(e)return!(i&&!i(t,e)||!xr(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 br.length=0,!0;return br.length=0,!1},br=[];const Cr=Phaser.Utils.Objects.GetValue;class wr extends Qe{constructor(t,e){super(t,e),this._enable=void 0;var i=Cr(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(Cr(t,"enable",!0)),this.setMode(Cr(t,"mode",1)),this.setClickInterval(Cr(t,"clickInterval",100)),this.setDragThreshold(Cr(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=Sr[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?yr:nr)(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 Sr={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 Pr extends ks{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 _r extends Qe{constructor(t,e){super(t,e),this._enable=void 0,this.cooldown=new Pr,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 kr={isPointerInBounds(t){return void 0===t?t=this:"string"==typeof t&&(t=this.getElement(t)),!!t&&nr(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 _r(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 _r(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}},Er={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,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=Gr,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===Ur&&this.onDragEnd(),this.pointer=void 0,this.tracerState=Gr,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=$r,this}isPointerInGameObject(t,e,i){var s=this.lastPointer;return!!s&&nr(t,s,e,i)}}const Gr=0,Ur=1,$r="IDLE",Jr=Phaser.Utils.Objects.GetValue,Kr=Phaser.Math.Distance.Between;class qr extends Vr{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=Zr},eventEmitter:!1};this.setRecongizedStateObject(new ks(s))}resetFromJSON(t){super.resetFromJSON(t),this.setHoldTime(Jr(t,"time",250)),this.setTapInterval(Jr(t,"tapInterval",200)),this.setDragThreshold(Jr(t,"threshold",9)),this.setTapOffset(Jr(t,"tapOffset",10));var e=Jr(t,"taps",void 0);return void 0!==e?this.setTaps(e):(this.setMaxTaps(Jr(t,"maxTaps",void 0)),this.setMinTaps(Jr(t,"minTaps",void 0))),this}onDragStart(){switch(this.state){case Zr:this.state=Qr;break;case Qr:var t=this.lastPointer;Kr(t.upX,t.upY,t.x,t.y)>this.tapOffset&&(this.state=tn,this.state=Qr);break;case tn:this.state=Qr}}onDragEnd(){this.state===Qr&&(this.tapsCount++,this.emit("tapping",this,this.gameObject,this.lastPointer),void 0!==this.maxTaps&&this.tapsCount===this.maxTaps&&(this.state=tn))}onDrag(){this.state!==Zr&&this.pointer.getDistance()>this.dragThreshold&&(this.state=Zr)}preUpdate(t,e){if(this.isRunning&&this.enable&&this.state===Qr){var i=this.lastPointer;i.isDown?t-i.downTime>this.holdTime&&(this.state=Zr):t-i.upTime>this.tapInterval&&(void 0===this.minTaps||this.tapsCount>=this.minTaps?this.state=tn:this.state=Zr)}}postUpdate(t,e){this.isRunning&&this.enable&&this.state===tn&&(this.state=Zr)}get isTapped(){return this.state===tn}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 Zr="IDLE",Qr="BEGIN",tn="RECOGNIZED",en=Phaser.Utils.Objects.GetValue;class sn extends Vr{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=rn},eventEmitter:!1};this.setRecongizedStateObject(new ks(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(en(t,"threshold",9)),this.setHoldTime(en(t,"time",251)),this}onDragStart(){this.state=nn,0===this.holdTime&&(this.state=hn)}onDragEnd(){this.state=rn}onDrag(){this.state!==rn&&this.pointer.getDistance()>this.dragThreshold&&(this.state=rn)}preUpdate(t,e){this.isRunning&&this.enable&&this.state===nn&&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 rn="IDLE",nn="BEGIN",hn="RECOGNIZED";Phaser.Utils.Objects.GetValue;var an=function(t){return qe(t).loop.delta};const on=Phaser.Math.Distance.Between,ln=Phaser.Math.Angle.Between;var dn={getDt:function(){return an(this.scene)},getVelocity:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return on(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 ln(e.x,e.y,t.x,t.y)}},un={"up&down":0,"left&right":1,"4dir":2,"8dir":3},cn={};const pn=Phaser.Utils.Objects.GetValue,vn=Phaser.Math.RadToDeg;class gn extends Vr{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=fn},eventEmitter:!1};this.setRecongizedStateObject(new ks(s)),this.clearDirectionStates()}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(pn(t,"threshold",10)),this.setVelocityThreshold(pn(t,"velocityThreshold",1e3)),this.setDirectionMode(pn(t,"dir","8dir")),this}onDragStart(){this.state=mn}onDragEnd(){this.state=fn}onDrag(){this.state===mn&&(this.validDrag||(this.validDrag=0===this.dragThreshold||this.pointer.getDistance()>=this.dragThreshold),this.validDrag&&this.dragVelocity>this.velocityThreshold&&(this.state=yn))}postUpdate(t,e){this.isRunning&&this.enable&&this.state===yn&&(this.state=fn)}get isSwiped(){return this.state===yn}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=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}}(vn(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,dn);const fn="IDLE",mn="BEGIN",yn="RECOGNIZED",xn=Phaser.Utils.Objects.GetValue,bn=Phaser.Utils.Array.SpliceOne,Cn=Phaser.Math.Distance.Between,wn=Phaser.Math.Angle.Between;class Sn{constructor(t,e){var i=$e(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(xn(e,"inputConfig",void 0)),this.setEventEmitter(xn(e,"eventEmitter",void 0)),this._enable=void 0,this.pointers=[],this.movedState={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setEnable(xn(t,"enable",!0)),this.bounds=xn(t,"bounds",void 0),this.tracerState=Pn,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 Pn:this.tracerState=Tn,this.onDrag1Start();break;case Tn:this.tracerState=_n,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],bn(this.pointers,e),this.tracerState){case Tn:this.tracerState=Pn,this.onDrag1End();break;case _n: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 _n:this.onDrag2()}}}dragCancel(){return this.tracerState===_n&&this.onDrag2End(),this.pointers.length=0,gt(this.movedState),this.tracerState=Pn,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!==_n)return 0;var t=this.pointers[0],e=this.pointers[1];return Cn(t.x,t.y,e.x,e.y)}get angleBetween(){if(this.tracerState!==_n)return 0;var t=this.pointers[0],e=this.pointers[1];return wn(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!==_n)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.x+e.x)/2}get centerY(){if(this.tracerState!==_n)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.y+e.y)/2}get prevCenterX(){if(this.tracerState!==_n)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!==_n)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&&nr(t,s,e,i)}isPointer1InGameObject(t,e,i){var s=this.pointers[1];return!!s&&nr(t,s,e,i)}}Object.assign(Sn.prototype,Ve);var On={};const Pn=0,Tn=1,_n=2,kn="IDLE";Phaser.Utils.Objects.GetValue;const En=Phaser.Math.RotateAround;var Mn=function(t,e,i,s){return En(t,e,i,s),t.rotation+=s,t},Rn={};const Ln=Phaser.Utils.Objects.GetValue,Dn=Phaser.Math.Angle.WrapDegrees,An=Phaser.Math.Angle.ShortestBetween,Yn=Phaser.Math.RadToDeg,Wn=Phaser.Math.DegToRad;var Xn={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,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=Dn(Yn(this.angleBetween));this.angle=An(this.prevAngle,t),this.prevAngle=t,this.state=jn}break;case jn:t=Dn(Yn(this.angleBetween)),this.angle=An(this.prevAngle,t),this.prevAngle=t,this.emit("rotate",this)}}get isRotated(){return this.state===jn}get rotation(){return Wn(this.angle)}setDragThreshold(t){return this.dragThreshold=t,this}}.prototype,Xn);const zn="IDLE",Fn="BEGIN",jn="RECOGNIZED",In=Phaser.Utils.Objects.GetValue;var Bn=function(t){var e=In(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){Rr(i.eventEmitter,`${i.eventNamePrefix}${t.tapsCount}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Hn=Phaser.Utils.Objects.GetValue;var Nn=function(t){var e=Hn(t,"press",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._press=new sn(this,e),this._press.on("pressstart",(function(t,e,s){Rr(i.eventEmitter,`${i.eventNamePrefix}pressstart`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this).on("pressend",(function(t,e,s){Rr(i.eventEmitter,`${i.eventNamePrefix}pressend`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Vn=Phaser.Utils.Objects.GetValue;var Gn=function(t){var e=Vn(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";Rr(i.eventEmitter,`${i.eventNamePrefix}swipe${r}`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Un=Phaser.Utils.Objects.GetValue;var $n=function(t,e){return t.setInteractive(),Un(e,"dropZone",!1)&&(t.input.dropZone=!0),t._childrenInteractive={targetSizers:Un(e,"targets",[t]),targetMode:Un(e,"targetMode","parent"),eventEmitter:Un(e,"eventEmitter",t),eventNamePrefix:Un(e,"inputEventPrefix","child.")},Dr.call(t,e),Wr.call(t,e),Fr.call(t,e),Hr.call(t,e),Bn.call(t,e),Nn.call(t,e),Gn.call(t,e),t},Jn={getSizerConfig:function(t){return void 0===t&&(t=this),Et(t)},getChildPrevState:function(t){var e=Et(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=ae(e,"color"),s=ae(e,"lineWidth");var o=ae(e,"name",!1);o&&(r=ae(o,"createTextCallback",le),n=ae(o,"createTextCallbackScope",void 0),"string"==typeof(h=ae(o,"align","left-top"))&&(h=Yt[h]))}if(void 0===i&&(i=16777215),void 0===s&&(s=1),r&&!t.children){t.children=new oe(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)}}for(var d,u,c=this.getAllShownChildren([this]),p=0,v=c.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 rh=Phaser.Utils.Objects.IsPlainObject,nh=Phaser.Utils.Objects.GetValue,hh=Phaser.Display.Align.CENTER,ah={min:0,full:-1};var oh=function(t,e,i,s,r,n,h,a,o,l){ve.call(this,t);var d=t.isRexSpace,u=typeof e;if(null===e)return this;if("number"===u);else if("string"===u)e=ah[e];else if(rh(e)){var c;e=nh(c=e,"proportion",void 0),i=nh(c,"align",hh),s=nh(c,"padding",0),r=nh(c,"expand",!1),n=nh(c,"key",void 0),h=nh(c,"index",void 0),t.isRexSizer||(a=nh(c,"minWidth",void 0),o=nh(c,"minHeight",void 0)),l=nh(c,"fitRatio",0)}return"string"==typeof i&&(i=Yt[i]),void 0===e&&(e=d?1:0),void 0===i&&(i=hh),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===a&&(d?a=0:t.isRexSizer||(a=t._minWidth)),void 0===o&&(d?o=0:t.isRexSizer||(o=t._minHeight)),void 0===l||!1===l?l=0:!0===l&&(l=Q(t)/tt(t)),(c=this.getSizerConfig(t)).proportion=e,c.align=i,c.padding=ce(s),c.expand=r,c.fitRatio=0===e?l:0,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},lh={add:oh,addSpace(t){return this.insertSpace(void 0,t),this},insertSpace(t,e){return void 0===e&&(e=1),oh.call(this,new ih(this.scene),{proportion:e,minWidth:0,minHeight:0,index:t}),this},insert(t,e,i,s,r,n,h,a){return rh(i)&&(i.index=t),oh.call(this,e,i,s,r,n,h,t,a),this},insertAtPosition(t,e,i,s,r,n,h,a,o){var l=sh.call(this,t,e);return-1===l&&(l=void 0),this.insert(l,i,s,r,n,h,a,o),this}};const dh=kt.prototype.clear;var uh=function(t){this.backgroundChildren&&(this.backgroundChildren.length=0);var e,i=!t&&this.sizerEventsEnable;if(i&&(e=this.getChildren([])),dh.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,uh.call(this,t),this}},vh={getChildAlign(t){return this.getSizerConfig(t).align},setChildAlign(t,e){return"string"==typeof e&&(e=Yt[e]),this.getSizerConfig(t).align=e,this}},gh={getChildProportion(t){return this.getSizerConfig(t).proportion},setChildProportion(t,e){return this.getSizerConfig(t).proportion=e,this}},fh={getChildExpand(t){return this.getSizerConfig(t).expand},setChildExpand(t,e){return this.getSizerConfig(t).expand=e,this}},mh={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}},yh={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,u=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,u=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,u?u=!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&&(Ie(t,0,0),e.resolved=!1,this.hasRatioFitChild=!0);return this._childrenProportion=void 0,this.hasProportion0Child=!1,this.proportionLength=void 0,ze.call(this),this},layoutChildren:function(){for(var t,e,i,s,r,n,h,a,o,l,d=this.sizerChildren,u=this.innerLeft,c=this.innerTop,p=this.innerWidth,v=this.innerHeight,g=u,f=c,m=this.startChildIndex,y=0,x=d.length;y0?(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)||Le.call(this)},runWidthWrap:function(t){this.wrapResult||(1===this.orientation&&th.call(this,t,void 0),De.call(this,t))},hasHeightWrap:function(){return!(!this.hasRatioFitChild||0!==this.orientation)||Ye.call(this)},runHeightWrap:function(t){this.wrapResult||(0===this.orientation&&th.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(yh,lh,ph,vh,gh,fh,mh);var xh=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},bh={x:0,h:0,horizontal:0,"left-to-right":0,y:1,v:1,vertical:1,"top-to-bottom":1};const Ch=Phaser.Utils.Objects.IsPlainObject,wh=Phaser.Utils.Objects.GetValue;class Sh extends qn{constructor(t,e,i,s,r,n,h){Ch(e)?(e=wh(h=e,"x",0),i=wh(h,"y",0),s=wh(h,"width",void 0),r=wh(h,"height",void 0),n=wh(h,"orientation",0)):Ch(s)?(s=wh(h=s,"width",void 0),r=wh(h,"height",void 0),n=wh(h,"orientation",0)):Ch(n)&&(n=wh(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(wh(h,"space.item",0)),this.setStartChildIndex(wh(h,"startChildIndex",0)),this.setRTL(wh(h,"rtl",!1)),this.addChildrenMap("items",this.sizerChildren)}setOrientation(t){return this.orientation=function(t){return"string"==typeof t&&(t=bh[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=xh.call(this)),this._childrenProportion}}Object.assign(Sh.prototype,yh);var Oh=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}},Ph=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},Th={appendText:Ph,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 _h extends Sh{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&&(Oh(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&&(Oh(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&&Oh(t,this.iconWidth,this.iconHeight);var e=this.childrenMap.action;e&&void 0!==this.actionWidth&&void 0!==this.actionHeight&&Oh(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(_h.prototype,Th);var kh=function(t,e,i,s,r){if(this.clear().fillStyle(16777215),1===this.shapeType){i=i.left;var n=Math.min(t,e)/2;this.fillCircle(-t*(s-.5),-e*(r-.5),n+i)}else this.fillRect(-t*s-i.left,-e*r-i.top,t+i.left+i.right,e+i.top+i.bottom)},Eh=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};const Mh=Phaser.GameObjects.Graphics;class Rh extends Mh{constructor(t,e,i){void 0===e&&(e=0),"string"==typeof e&&(e=Lh[e]),super(t.scene),this.parent=t,this.shapeType=e,this.padding=ce(i),this.setPosition().resize().setVisible(!1)}destroy(){return this.parent=void 0,super.destroy(),this}setPosition(t,e){var i=this.parent;return void 0===t&&(t=i.x),void 0===e&&(e=i.y),super.setPosition(t,e),this}resize(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=ce(i));var r=this.width!==t||this.height!==e,n=this.padding!==i&&!Eh(this.padding,i);return r||n?(this.width=t,this.height=e,n&&ft(i,this.padding),this.originX=s.originX,this.originY=s.originY,kh.call(this,t,e,i,s.originX,s.originY),this):this}setOrigin(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,kh.call(this,this.width,this.height,this.padding,t,e)),this}}const Lh={rectangle:0,circle:1};var Dh=function(t,e,i,s){var r=new Rh(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 Ah=Phaser.GameObjects.Text;var Yh=function(t){return t instanceof Ah};const Wh=Phaser.GameObjects.BitmapText;var Xh=function(t){return t instanceof Wh},zh=function(t){return Xh(t)?2:Yh(t)?0:1},Fh=/^[\x00-\x7F]+$/,jh=function(t){return Fh.test(t)},Ih=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},Hh=0,Nh=1,Vh=2,Gh=0,Uh=1,$h=2,Jh=/(?:\r\n|\r|\n)/;const Kh={none:Gh,word:Uh,char:$h,character:$h,mix:3},qh=Phaser.Renderer.WebGL.Utils;var Zh={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=qh.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 Qh=Phaser.Display.Color;var ta={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 u=d.cutWidth,c=d.cutHeight;void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=u),void 0===n&&(n=c),void 0===h&&(h=0),void 0===a&&(a=0),void 0===o&&(o=u),void 0===l&&(l=c);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 Qh);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}},ea=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 u=d.getContext("2d",{willReadFrequently:!0});u.clearRect(0,0,n,h),u.drawImage(e,s,r,n,h),l.gl&&a&&l.canvasToTexture(d,a.source[0].glTexture,!0,0)},ia={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,ea(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 sa=Phaser.Display.Canvas.CanvasPool,ra=Phaser.GameObjects.GameObject,na=Phaser.Utils.String.UUID;class ha extends ra{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=sa.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=na(),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(){sa.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 aa=Phaser.GameObjects.Components;Phaser.Class.mixin(ha,[aa.Alpha,aa.BlendMode,aa.Crop,aa.Depth,aa.Flip,aa.GetBounds,aa.Mask,aa.Origin,aa.Pipeline,aa.PostPipeline,aa.ScrollFactor,aa.Tint,aa.Transform,aa.Visible,Zh,ta,ia]);var oa={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:Ss(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&>(this.data),this}};class la{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(la.prototype,oa);var da={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 ua=Phaser.Math.RotateAround;var ca;const pa=Phaser.Geom.Rectangle;var va,ga=function(t){void 0===va&&(va=new pa);var e=t.drawTLX,i=t.drawTLY;return va.setTo(e,i,t.drawTRX-e,t.drawBLY-i),va};const fa=Phaser.Math.RotateAround;var ma,ya=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&&fa(s,0,0,t.rotation),s.x=s.x*t.scaleX+t.drawX,s.y=s.y*t.scaleY+t.drawY,s};const xa=Phaser.GameObjects.Components.TransformMatrix;var ba,Ca,wa={},Sa=function(t,e,i,s,r){var n=ya(e,i,s,!0),h=function(t,e,i,s){void 0===s?s={}:!0===s&&(s=wa);var r=e-t.width*t.originX,n=i-t.height*t.originY;return void 0===ba&&(ba=new xa,Ca=new xa),t.parentContainer?t.getWorldTransformMatrix(ba,Ca):ba.applyITRS(t.x,t.y,t.rotation,t.scaleX,t.scaleY),ba.transformPoint(r,n,s),s}(t,n.x,n.y,r);return h},Oa=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 Sa(t,e,n,h,r)},Pa={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===ca&&(ca={}),s=ca),s.x=(t-i.drawX)/i.scaleX,s.y=(e-i.drawY)/i.scaleY,0!==i.rotation&&ua(s,0,0,-i.rotation),s}(t,e,this,!0);return ga(this).contains(i.x,i.y)},getWorldPosition:function(t,e,i){return Oa(this.parent,this,t,e,i)}};Object.assign(Pa,da);const Ta=Phaser.Math.DegToRad,_a=Phaser.Math.RadToDeg,ka=Phaser.Utils.Objects.GetValue;class Ea extends la{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 _a(this._rotation)}set angle(t){this.rotation=Ta(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=ka(t,"width",void 0),i=ka(t,"height",void 0),s=ka(t,"scaleX",void 0),r=ka(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(Ea.prototype,Pa);const Ma=Phaser.Utils.String.Pad;var Ra=function(t,e,i){if(null==t)return t;switch(typeof t){case"string":default:return t;case"number":return`#${Ma(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}},La=function(t,e,i){return e.hasOwnProperty(t)?e[t]:i[t]};const Da=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=Da(t,"x",0),i=Da(t,"y",0));var s=this.cornerRadius;s.tl=Ya(Da(t,"tl",void 0),e,i),s.tr=Ya(Da(t,"tr",void 0),e,i),s.bl=Ya(Da(t,"bl",void 0),e,i),s.br=Ya(Da(t,"br",void 0),e,i)}get radiusTL(){var t=this.cornerRadius.tl;return Math.max(t.x,t.y)}set radiusTL(t){Wa(this.cornerRadius.tl,t)}get radiusTR(){var t=this.cornerRadius.tr;return Math.max(t.x,t.y)}set radiusTR(t){Wa(this.cornerRadius.tr,t)}get radiusBL(){var t=this.cornerRadius.bl;return Math.max(t.x,t.y)}set radiusBL(t){Wa(this.cornerRadius.bl,t)}get radiusBR(){var t=this.cornerRadius.br;return Math.max(t.x,t.y)}set radiusBR(t){Wa(this.cornerRadius.br,t)}};var Ya=function(t,e,i){return void 0===t?t={x:e,y:i}:"number"==typeof t&&(t={x:t,y:t}),Xa(t),t},Wa=function(t,e){"number"==typeof e?(t.x=e,t.y=e):(t.x=Da(e,"x",0),t.y=Da(e,"y",0)),Xa(t)},Xa=function(t){t.convex=t.x>=0||t.y>=0,t.x=Math.abs(t.x),t.y=Math.abs(t.y)};const za=Phaser.Math.DegToRad;var Fa=function(t){return!t.hasOwnProperty("convex")||t.convex},ja=function(t){return t.x>0&&t.y>0},Ia=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=c.cornerRadius;t.save(),t.beginPath(),t.translate(e,i),a=m.tl,ja(a)?(o=a.x*g,l=a.y*f,Fa(a)?Ia(t,o,l,o,l,180,270,!1,h):Ia(t,0,0,o,l,90,0,!0,h),d=0,u=l):(t.lineTo(0,0),d=0,u=0),a=m.tr,ja(a)?(o=a.x*g,l=a.y*f,Fa(a)?Ia(t,s-o,l,o,l,270,360,!1,h):Ia(t,s,0,o,l,180,90,!0,h)):t.lineTo(s,0),a=m.br,ja(a)?(o=a.x*g,l=a.y*f,Fa(a)?Ia(t,s-o,r-l,o,l,0,90,!1,h):Ia(t,s,r,o,l,270,180,!0,h)):t.lineTo(s,r),a=m.bl,ja(a)?(o=a.x*g,l=a.y*f,Fa(a)?Ia(t,o,r-l,o,l,90,180,!1,h):Ia(t,0,r,o,l,360,270,!0,h)):t.lineTo(0,r),t.lineTo(d,u),t.closePath(),t.restore()}(e,i,s,r,n,h,c),null!=a)&&(null!=d&&((p=u?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())},Ha=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),Ba(t.canvas,t.context,d,d,o,l,r,e,i,s,n,h,a)}};const Na=Phaser.Utils.Objects.GetValue;class Va extends Ea{constructor(t,e){super(t,"background"),this.setScrollFactor(0),this.setColor(Na(e,"color",null),Na(e,"color2",null),Na(e,"horizontalGradient",!0)),this.setStroke(Na(e,"stroke",null),Na(e,"strokeThickness",2)),this.setCornerRadius(Na(e,"cornerRadius",0),Na(e,"cornerIteration",null))}set color(t){t=Ra(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=Ra(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=Ra(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,La("color2",t,this),La("horizontalGradient",t,this)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,La("strokeThickness",t,this)),t.hasOwnProperty("cornerRadius")&&this.setCornerRadius(t.cornerRadius,La("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(){Ha(this.parent,this.color,this.stroke,this.strokeThickness,this.cornerRadius,this.color2,this.horizontalGradient,this.cornerIteration)}}const Ga=Phaser.Utils.Objects.GetValue;class Ua extends Ea{constructor(t,e){super(t,"innerbounds"),this.setScrollFactor(0),this.setColor(Ga(e,"color",null),Ga(e,"color2",null),Ga(e,"horizontalGradient",!0)),this.setStroke(Ga(e,"stroke",null),Ga(e,"strokeThickness",2))}set color(t){t=Ra(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=Ra(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=Ra(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,Ga(t,"color2",null),Ga(t,"horizontalGradient",!0)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,Ga(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 $a=Phaser.Utils.Objects.GetValue;let Ja=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($a(t,"bold",!1)),this.setItalic($a(t,"italic",!1)),this.setFontSize($a(t,"fontSize","16px")),this.setFontFamily($a(t,"fontFamily","Courier")),this.setColor($a(t,"color","#fff")),this.setStrokeStyle($a(t,"stroke",null),$a(t,"strokeThickness",0)),this.setShadow($a(t,"shadowColor",null),$a(t,"shadowOffsetX",0),$a(t,"shadowOffsetY",0),$a(t,"shadowBlur",0)),this.setOffset($a(t,"offsetX",0),$a(t,"offsetY",0)),this.setSpace($a(t,"leftSpace",0),$a(t,"rightSpace",0)),this.setAlign($a(t,"align",void 0)),this.setBackgroundColor($a(t,"backgroundColor",null)),this.setBackgroundHeight($a(t,"backgroundHeight",void 0)),this.setBackgroundBottomY($a(t,"backgroundBottomY",void 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(La("stroke",t,this),La("strokeThickness",t,this)),t.hasOwnProperty("shadowColor")&&this.setShadowColor(t.shadowColor),(t.hasOwnProperty("shadowOffsetX")||t.hasOwnProperty("shadowOffsetY"))&&this.setShadowOffset(La("shadowOffsetX",t,this),La("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),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=Ra(t),this}get hasFill(){return null!=this.color}setStrokeStyle(t,e){return this.stroke=Ra(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=Ra(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=Ra(t),this}get hasBackgroundColor(){return null!=this.backgroundColor}setBackgroundHeight(t){return this.backgroundHeight=t,this}setBackgroundBottomY(t){return this.backgroundBottomY=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 Ka=Phaser.Utils.Array.Remove,qa=Phaser.Utils.Array.Remove,Za="text",Qa="image",to="drawer",eo="space",io="command";var so=function(t){return t.type===Za&&"\n"===t.text},ro=function(t){return t.type===Za&&"\f"===t.text},no=function(t){return t.type===Za};class ho extends Ea{constructor(t,e,i){super(t,Za),this.updateTextFlag=!1,this.style=new Ja(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,s=this.drawTRX-i+1,r=e.backgroundBottomY;null==r&&(r=this.drawBLY);var n=e.backgroundHeight;null==n&&(n=r-this.drawTLY);var h=r-n;t.fillRect(i,h,s,n)}var a=e.hasFill,o=e.hasStroke;(a||o)&&(e.syncFont(t).syncStyle(t),o&&(e.syncShadow(t),t.strokeText(this.text,0,0)),a&&(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 ao=function(t,e){var i=this.createCharChildren(t,e);return this.addChild(i),this};const oo=Phaser.Display.Canvas.CanvasPool;var lo=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=oo.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),oo.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 uo extends Ea{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(){lo(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 co extends Ea{constructor(t,e,i,s){super(t,to),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 Ea{constructor(t,e){super(t,eo),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 vo extends la{constructor(t,e,i,s,r){super(t,io),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 go(t){if(null===t||"object"!=typeof t)return t;if(Array.isArray(t))return t.map((t=>go(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]=go(t[i]));return e}var fo=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 yo=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,u=!1;o0&&!a){var o=this.fixedHeight-s;i>0?n=o/i:(n=(l=wo.call(this)).height,h=l.ascent,i=Math.floor((o-h)/n))}else{var l;n=(l=wo.call(this)).height,h=l.ascent}}else this.fixedHeight>0?void 0===(i=Oo(t,"maxLines"))&&(o=this.fixedHeight-s,i=Math.floor(o/n)):i=Oo(t,"maxLines",0);void 0===h&&(h=n);var d=0===i,u=Oo(t,"wrapMode");void 0===u&&(u=Oo(t,"charWrap",!1)?"char":"word"),"string"==typeof u&&(u=mo[u]);var c=Oo(t,"wrapWidth",void 0);void 0===c&&(this.fixedWidth>0?c=this.fixedWidth-r:(c=1/0,u=0));for(var p=Oo(t,"letterSpacing",0),v=Oo(t,"hAlign",0),g=Oo(t,"vAlign",0),f=Oo(t,"justifyPercentage",.25),m=fo({callback:"runWordWrap",start:e,padding:this.wrapPadding,letterSpacing:p,maxLines:i,hAlign:v,vAlign:g,justifyPercentage:f,ascent:h,lineHeight:n,wrapWidth:c,wrapMode:u}),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=_o(t,"maxLines",void 0))){var h=this.fixedWidth-r;i=Math.floor(h/n)+1}}else i=_o(t,"maxLines",0);var a=0===i,o=_o(t,"fixedCharacterHeight",void 0);if(void 0===o){var l=_o(t,"charPerLine",void 0);if(void 0!==l){var d=this.fixedHeight-s;o=Math.floor(d/l)}}var u=_o(t,"wrapHeight",void 0);void 0===u&&(u=this.fixedHeight>0?this.fixedHeight-s:1/0);for(var c=_o(t,"letterSpacing",0),p=_o(t,"rtl",!0),v=_o(t,"hAlign",p?2:0),g=_o(t,"vAlign",0),f=fo({callback:"runVerticalWrap",start:e,padding:this.wrapPadding,letterSpacing:c,maxLines:i,hAlign:v,vAlign:g,lineWidth:n,fixedCharacterHeight:o,wrapHeight:u,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 X=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 u=0,c=o.length;u0?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 Ee(i,t,e),this.dirty=this.dirty||s!=i.left||r!=i.right||n!=i.top||h!=i.bottom,this},getPadding:function(t){return ke(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),Ka(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 qa(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(Za);return null===i?i=new ho(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)),Oa(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 Zo=Phaser.Utils.Objects.GetFastValue;var Qo={};class tl{constructor(t){this.pools=Zo(t,"pools",Qo)}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;ei&&(r=Math.floor(i));for(var n={},h=ol(t,r,e,i,n),a=0;a<=nl&&0!==h;a++){if((r+=h)<0){r=0;break}h=ol(t,r,e,i,n)}return a===nl&&console.warn("FontSizeFit: Test count exceeds 65535"),t.setFontSize(r),ll(t,e,i),t},al=function(t,e,i){return void 0===i[e]&&(t.setFontSize(e),i[e]={width:t.width,height:t.height}),i[e]},ol=function(t,e,i,s,r){var n,h=al(t,e,r),a=al(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)},ll=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 dl=Phaser.Utils.Objects.GetValue,ul=Phaser.Utils.Objects.GetValue;class cl extends _h{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexLabel";var i,s=ul(e,"background",void 0),r=ul(e,"icon",void 0),n=ul(e,"iconMask",void 0),h=ul(e,"text",void 0),a=ul(e,"action",void 0),o=ul(e,"actionMask",void 0),l=ul(e,"align",void 0);if(s&&this.addBackground(s),r){0===this.orientation?(h||a)&&(i={right:ul(e,"space.icon",0),top:ul(e,"space.iconTop",0),bottom:ul(e,"space.iconBottom",0),left:ul(e,"space.iconLeft",0)}):(h||a)&&(i={bottom:ul(e,"space.icon",0),left:ul(e,"space.iconLeft",0),right:ul(e,"space.iconRight",0),top:ul(e,"space.iconTop",0)});var d=ul(e,"squareFitIcon",!1)?1:0;if(this.add(r,{proportion:0,padding:i,fitRatio:d}),n&&(n=Dh.call(this,r,r,1)),!d){var u=ul(e,"iconSize",void 0);this.setIconSize(ul(e,"iconWidth",u),ul(e,"iconHeight",u))}}if(h){var c=ul(e,"wrapText",!1),p=ul(e,"adjustTextFontSize",!1);c?(!0===c&&(c="word"),function(t,e){switch(zh(t)){case 0:switch("string"==typeof e&&(e=Kh[e]||0),t.style.wrapMode=e,e){case 2:case 3:t.style.wordWrapCallback=Ih;break;default:t.style.wordWrapCallback=null}break;case 1:"string"==typeof e&&(e=Kh[e]||0),t.style.wrapMode=e}}(h,c),e.expandTextWidth=!0,rl(h)):p&&(e.expandTextWidth=!0,e.expandTextHeight=!0,function(t,e){"number"==typeof e&&(e={minWidth:e});var i=dl(e,"minWidth",0),s=dl(e,"minHeight",0),r=dl(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 hl(t,e,i),t}):(t.runWidthWrap=function(e){return t.setFixedSize&&t.setFixedSize(0,0),hl(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=ul(e,"space.text",0),m=ul(e,"expandTextWidth",!1),y=ul(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:ul(e,"space.actionTop",0),bottom:ul(e,"space.actionBottom",0),right:ul(e,"space.actionRight",0)}:{left:ul(e,"space.actionLeft",0),right:ul(e,"space.actionRight",0),bottom:ul(e,"space.actionBottom",0)},d=ul(e,"squareFitAction",!1)?1:0,this.add(a,{proportion:0,padding:i,fitRatio:d}),o&&(o=Dh.call(this,a,a,1)),!d)){var x=ul(e,"actionSize");this.setActionSize(ul(e,"actionWidth",x),ul(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 pl=Phaser.Renderer.WebGL.Utils,vl=function(t,e,i,s,r,n){for(var h=pl.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+")"},xl=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 bl=Phaser.Renderer.Canvas.SetTransform;var Cl={renderWebGL:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.pipelines.set(e.pipeline),n=ml(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&&vl(r,h,e,l,a,o),e.isStroked&&fl(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(bl(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 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(Sl.prototype,Cl);var Ol=function(t){return t.x>0&&t.y>0},Pl=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 Tl=Phaser.Math.DegToRad;var _l=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 kd=Phaser.Utils.Objects.GetValue,Ed=Phaser.Utils.Objects.IsPlainObject;class Md extends(ed(Ul)){constructor(t,e,i,s,r,n,h,a){Ed(e)?(e=(a=e).x,i=a.y,s=a.width,r=a.height,n=a.barColor,h=a.value):Ed(s)?(s=(a=s).width,r=a.height,n=a.barColor,h=a.value):Ed(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 Td).setName("trackFill")).addShape((new Td).setName("bar")).addShape((new Td).setName("trackStroke")),this.setTrackColor(kd(a,"trackColor",void 0)),this.setBarColor(n),this.setTrackStroke(kd(a,"trackStrokeThickness",2),kd(a,"trackStrokeColor",void 0)),this.setSkewX(kd(a,"skewX",0)),this.setRTL(kd(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 Rd={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&&_d(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),_d(h,r,0,n,i,t));var a=this.getShape("trackStroke");a.lineStyle(this.trackStrokeThickness,this.trackStrokeColor),a.isStroked&&_d(a,0,0,e,i,t)}};Object.assign(Md.prototype,Rd);var Ld=function(t){return null==t||""===t||0===t.length},Dd=function(t,e,i,s){if(void 0===s&&(s="."),"object"==typeof t){if(Ld(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(Ld(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=go(i),s=go(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,u=n.height,c=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,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 g=(c-v)*o;d>=0?d+=g:d=g,c=v}if(p>v){var f=(p-v)*l;u>=0?u+=f:u=f,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 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 qd(t)?(this.stretchMode.edge=Qd(Zd(t,"edge",0)),this.stretchMode.internal=Qd(Zd(t,"internal",0))):(t=Qd(t),this.stretchMode.edge=t,this.stretchMode.internal=t),this},getStretchMode:function(t,e){return eu.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 su=Phaser.Utils.Objects.IsPlainObject,ru=Phaser.Utils.Objects.GetValue,nu=Phaser.GameObjects;var hu=void 0,au=function(t,e){if(hu||(hu={},qe(t).events.once("destroy",(function(){for(var t in hu)hu[t].destroy();hu=void 0}))),!hu.hasOwnProperty(e)){var i=qe(t).scene.systemScene;(t=new nu[e](i)).setOrigin(0),hu[e]=t}return hu[e]};const ou=Phaser.GameObjects.RenderTexture;class lu extends(function(t,e){class i extends t{constructor(t,i,s,r,n,h,a,o,l,d){if(su(i)?(i=ru(d=i,"x",0),s=ru(d,"y",0),r=ru(d,"width",1),n=ru(d,"height",1),h=ru(d,"key",void 0),a=ru(d,"baseFrame",void 0),o=ru(d,"columns",void 0),l=ru(d,"rows",void 0)):su(r)?(r=ru(d=r,"width",1),n=ru(d,"height",1),h=ru(d,"key",void 0),a=ru(d,"baseFrame",void 0),o=ru(d,"columns",void 0),l=ru(d,"rows",void 0)):su(h)?(h=ru(d=h,"key",void 0),a=ru(d,"baseFrame",void 0),o=ru(d,"columns",void 0),l=ru(d,"rows",void 0)):su(a)?(a=ru(d=a,"baseFrame",void 0),o=ru(d,"columns",void 0),l=ru(d,"rows",void 0)):Array.isArray(a)?(d=l,l=o,o=a,a=ru(d,"baseFrame",void 0)):su(o)&&(o=ru(d=o,"columns",void 0),l=ru(d,"rows",void 0)),void 0===a&&(a=ru(d,"frame",void 0)),void 0===o){var u=ru(d,"leftWidth",void 0),c=ru(d,"rightWidth",void 0);void 0!==u&&void 0!==c&&(o=[u,void 0,c])}if(void 0===l){var p=ru(d,"topHeight",void 0),v=ru(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(ru(d,"getFrameNameCallback",void 0)),this.setStretchMode(ru(d,"stretchMode",0)),this.setPreserveRatio(ru(d,"preserveRatio",!0));var g=ru(d,"maxFixedPartScale",1),f=ru(d,"maxFixedPartScaleX",g),m=ru(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,iu),i}(ou,"rexNinePatch")){}var du={_drawImage:function(t,e,i,s,r,n){var h=au(this,"Image").setTexture(t,e).setDisplaySize(r,n);this.draw(h,i,s)},_drawTileSprite:function(t,e,i,s,r,n){var h=au(this,"TileSprite").setTexture(t,e).setSize(r,n);this.draw(h,i,s)}};Object.assign(lu.prototype,du);let uu=class extends Qe{constructor(t,e){return super(t),new Proxy(this,this)}get(t,e){if(Wd(t,e))return t[e];var i=t.parent;return Wd(i,e)?i[e]:void 0}set(t,e,i){return Wd(t,e)?t[e]=i:Wd(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 cu=Phaser.Utils.Objects.GetValue;class pu extends lu{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexStatesNinePatch";var i=cu(e,"effects",!0);i&&Id(this,i),this.style=new uu(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign(pu.prototype,Fl);const vu=["alpha","tint","flipX","flipY"];var gu=function(t,e){if(!e)return t;for(var i=0,s=vu.length;i * @copyright 2018 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */const _c=Phaser.Display.Canvas.CanvasPool;var kc=function(t){var e=_c.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 _c.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,_c.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!==Gh&&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=Kh[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]=Mc(t,l,d);else{var u=Ec(t,l,d);c&&(u=c(u)),this[a]=u}}var p=Mc(t,"font",null);this._font=null===p?this.fontStyle+" "+this.fontSize+" "+this.fontFamily:p;var v=Mc(t,"fill",null);null!==v&&(this.color=Ra(v));var g=Mc(t,"metrics",!1);return g?this.metrics={ascent:Mc(g,"ascent",0),descent:Mc(g,"descent",0),fontSize:Mc(g,"fontSize",0)}:!e&&this.metrics||(this.metrics=kc(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=kc(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=Mc(t,"fontFamily","Courier"),this.fontSize=Mc(t,"fontSize","16px"),this.fontStyle=Mc(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=Ra(t,this.parent.canvas,this.parent.context),this.backgroundColor2=Ra(e,this.parent.canvas,this.parent.context),this.backgroundHorizontalGradient=i,this.update(!1)}setBackgroundStrokeColor(t,e){return this.backgroundStrokeColor=Ra(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=Ra(t,this.parent.canvas,this.parent.context),this.update(!1)}setColor(t){return this.color=Ra(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=Ra(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=Ra(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=Ra(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=Ra(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=Ra(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=Ra(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=Ra(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=Kh[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=Mc(e,"fontFamily",this.fontFamily),this.fontSize=Mc(e,"fontSize",this.fontSize),this.fontStyle=Mc(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 Lc={draw(t,e,i,s){var r=this.penManager;this.hitAreaManager.clear();var n=this.context;n.save();var h=this.defaultStyle;this.clear(),Ha(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 Dc=Phaser.Utils.Objects.GetValue,Ac=Hh,Yc=Nh;class Wc{constructor(t){this.prop={},this.resetFromJSON(t)}resetFromJSON(t){this.text=Dc(t,"text",""),this.x=Dc(t,"x",0),this.y=Dc(t,"y",0),this.width=Dc(t,"width",0);var e=Dc(t,"prop",null);null===e&&(e={}),this.prop=e,this.newLineMode=Dc(t,"newLineMode",0),this.startIndex=Dc(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!==Ac&&(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,zc=Hh,Fc=Vh;class jc{constructor(t){this.pens=[],this.lines=[],this.maxLinesWidth=void 0,this.pensPool=t.pensPool,this.linesPool=t.linesPool,this.tagToText=Xc(t,"tagToText",Wt),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&&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 Ic={};const Bc=Phaser.Geom.Rectangle;var Hc=new qo;class Nc{constructor(){this.hitAreas=[]}destroy(){this.clear()}clear(){for(var t=0,e=this.hitAreas.length;ts&&ru(g)){""!==x?h.push(n.getLine(x,b,qc)):0===C&&r>0&&h.push(n.getLine("",0,qc)),h.push(...iu(g,e,tu,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,qc)),x=g,b=f,o=s):(x+=g,b=m),C===w-1&&h.push(n.getLine(x,b,l))}return h},su=function(t,e){var i;switch(e){case Qc:i=[];for(var s=0,r=(t=t.split(" ")).length;s0&&e!==hu&&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 jc({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 up(this.sizerChildren,null),ch.call(this,t),this}},vp={setColumnSpace(t){if(this.space.column||(this.space.column=[]),this.space.column.length=this.columnCount-1,"number"==typeof t)up(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,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===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,up(this.sizerChildren,null),this.columnProportions=[],this.columnProportions.length=t,"number"==typeof i)up(this.columnProportions,i);else for(var n=0;n0?e+=t:0===t&&(this.hasColumnProportion0Child=!0);return e},bp=function(){for(var t,e=0,i=0;i0?e+=t:0===t&&(this.hasRowProportion0Child=!0);return e};const Cp=Phaser.Utils.Objects.IsPlainObject,wp=Phaser.Utils.Objects.GetValue;class Sp extends qn{constructor(t,e,i,s,r,n,h,a,o,l){Cp(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),h=wp(l,"row",0),a=wp(l,"columnProportions",0),o=wp(l,"rowProportions",0)):Cp(s)?(s=wp(l=s,"width",void 0),r=wp(l,"height",void 0),n=wp(l,"column",l.col||0),h=wp(l,"row",0),a=wp(l,"columnProportions",0),o=wp(l,"rowProportions",0)):Cp(n)?(n=wp(l=n,"column",l.col||0),h=wp(l,"row",0),a=wp(l,"columnProportions",0),o=wp(l,"rowProportions",0)):Cp(a)&&(a=wp(l=a,"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,h,a,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=xp.call(this)),this._totalColumnProportions}get totalRowProportions(){return void 0===this._totalRowProportions&&(this._totalRowProportions=bp.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(Sp.prototype,yp);const Op=Phaser.Utils.Objects.GetValue,Pp=Phaser.Math.Percent;var Tp=function(t,e,i){var s;return t.y===e.y?s=Pp(i.x,t.x,e.x):t.x===e.x&&(s=Pp(i.y,t.y,e.y)),s},_p=function(t,e,i){var s,r;this.enable&&(kp.x=e,kp.y=i,this.reverseAxis?(s=this.getEndPoint(),r=this.getStartPoint()):(s=this.getStartPoint(),r=this.getEndPoint()),this.value=Tp(s,r,kp))},kp={},Ep=function(t,e,i){if(this.enable&&t.isDown){var s,r;Mp.x=t.worldX,Mp.y=t.worldY,this.reverseAxis?(s=this.getEndPoint(),r=this.getStartPoint()):(s=this.getStartPoint(),r=this.getEndPoint());var n=Tp(s,r,Mp);this.stopEaseValue(),0===this.easeValueDuration||Math.abs(this.value-n)<.1?this.value=n:this.easeValueTo(n)}},Mp={},Rp=function(t,e){void 0===e&&(e=Lp);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},Lp={};const Dp=Phaser.Display.Align.LEFT_CENTER,Ap=Phaser.Display.Align.TOP_CENTER;var Yp={};const Wp=Phaser.Display.Align.RIGHT_CENTER,Xp=Phaser.Display.Align.BOTTOM_CENTER;var zp={};const Fp=Phaser.Math.Linear;var jp={};const Ip=Phaser.Display.Align.LEFT_CENTER,Bp=Phaser.Display.Align.TOP_CENTER,Hp=Phaser.Display.Align.RIGHT_CENTER,Np=Phaser.Display.Align.BOTTOM_CENTER,Vp=Phaser.Utils.Objects.GetValue,Gp=Phaser.Utils.Objects.IsPlainObject,Up=Phaser.Math.Clamp,$p=Phaser.Math.Snap.To;class Jp extends(ed(Sh)){constructor(t,e){super(t,e),this.type="rexSlider",this.bootProgressBase(e),this.reverseAxis=Vp(e,"reverseAxis",!1);var i=Vp(e,"background",void 0),s=Vp(e,"track",void 0),r=Vp(e,"indicator",void 0),n=Vp(e,"thumb",void 0);if(i&&(Gp(i)&&(i=fc(t,i)),this.addBackground(i)),s&&(Gp(s)&&(s=fc(t,s)),this.add(s,{proportion:1,expand:!0,minWidth:0===this.orientation?0:void 0,minHeight:1===this.orientation?0:void 0})),r&&(Gp(r)&&(r=fc(t,r)),this.pin(r)),n){Gp(n)&&(n=fc(t,n)),this.pin(n);var h=Vp(e,"thumbOffsetX",0),a=Vp(e,"thumbOffsetY",0);this.setThumbOffset(h,a)}var o=Vp(e,"input",0);switch("string"==typeof o&&(o=Kp[o]),o){case 0:n&&(n.setInteractive(),this.scene.input.setDraggable(n),n.on("drag",_p,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",Ep,this).on("pointermove",Ep,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(Vp(e,"enable",void 0)),this.setGap(Vp(e,"gap",void 0)),this.setValue(Vp(e,"value",0),Vp(e,"min",void 0),Vp(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}setThumbOffset(t,e){return this.thumbOffsetX=t,this.thumbOffsetY=e,this}get value(){return this._value}set value(t){void 0!==this.gap&&(t=$p(t,this.gap));var e=this._value;this._value=Up(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 Kp={pan:0,drag:0,click:1,none:-1};var qp={getStartPoint:function(t){if(void 0===t&&(t=Yp),this.childrenMap.thumb){var e=0===this.orientation?Dp:Ap;Rp.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=zp),this.childrenMap.thumb){var e=0===this.orientation?Wp:Xp;Rp.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=jp),s.x=Fp(e.x,i.x,t),s.y=Fp(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;Ie(e,i,s),r=n?0===this.orientation?Hp:Np:0===this.orientation?Ip:Bp,ne(e,this,r),this.resetChildPositionState(e)}};Object.assign(Jp.prototype,qp);const Zp=Phaser.Utils.Objects.GetValue;class Qp extends Sh{constructor(t,e){super(t,e),this.type="rexScrollBar";var i,s,r=Zp(e,"background",void 0),n=Zp(e,"buttons",void 0),h=Zp(n,"top",Zp(n,"left",void 0)),a=Zp(n,"bottom",Zp(n,"right",void 0)),o=Zp(e,"slider",void 0);(r&&this.addBackground(r),h&&(this.add(h),new _r(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===Zp(o,"width",void 0)?1:0:void 0===Zp(o,"height",void 0)?1:0,i=new Jp(t,o),t.add.existing(i),this.add(i,{proportion:s}));a&&(this.add(a),new _r(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=Zp(e,"valuechangeCallback",null);if(null!==d){var c=Zp(e,"valuechangeCallbackScope",void 0);this.on("valuechange",d,c)}this.setEnable(Zp(e,"enable",void 0)),this.setValue(Zp(e,"value",0)),this.setScrollStep(Zp(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}}class tv extends ks{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 ev=Phaser.Utils.Objects.GetValue,iv=Phaser.Math.Distance.Between;class sv extends Qe{constructor(t,e){super(t,e),this._enable=void 0,this.rectBoundsInteractive=ev(e,"rectBoundsInteractive",!1),this.rectBoundsInteractive||t.setInteractive(ev(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(ev(t,"enable",!0)),this.holdThreshold=ev(t,"holdThreshold",50),this.pointerOutReleaseEnable=ev(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 an(this.scene)}get speed(){return this.x===this.preX&&this.y===this.preY?0:iv(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&&!nr(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&&!nr(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 rv=Phaser.Utils.Objects.GetValue;class nv{constructor(t){this.resetFromJSON(t)}resetFromJSON(t){return this.setValue(rv(t,"value",0)),this.setSpeed(rv(t,"speed",0)),this.setAcceleration(rv(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 hv{constructor(){this.value,this.dir,this.movement=new nv}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 dv={y:0,v:0,vertical:0,x:1,h:1,horizontal:1},cv=Phaser.Utils.Objects.GetValue;class uv extends Qe{constructor(t,e){switch(super(t,e),this.parent!==this.scene?this.focusMode=cv(e,"focus",!0):this.focusMode=!1,"boolean"==typeof this.focusMode&&(this.focusMode=this.focusMode?1:0),this.setSpeed(cv(e,"speed",.1)),this.setEnable(cv(e,"enable",!0)),this.focusMode){case 0:case 2:this.scene.input.on("wheel",this.onSceneScroll,this);break;default:t.setInteractive(cv(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||nr(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 pv=Phaser.Utils.Objects.GetValue;var vv=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)?pv(s,l,void 0):pv(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=ft(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 Qp(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);var p=pv(r,"position",0);"string"==typeof p&&(p=gv[p]);var v,g,f=pv(s,`space.slider${i}`,void 0);void 0===f&&void 0===(f=pv(s,"space.slider",void 0))&&(a?f=0:v=pv(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:pv(v,"right",v)}):(d=0,c=1,u=void 0===v?g?{right:f}:f:{right:pv(v,"left",v)}):0===p?(d=1,c=2,u=void 0===v?g?{top:f}:f:{top:pv(v,"bottom",v)}):(d=1,c=0,u=void 0===v?g?{bottom:f}:f:{bottom:pv(v,"top",v)}),e.add(n,{column:d,row:c,align:"center",padding:u,expand:!0}),t[`hideUnscrollableSlider${i}`]=pv(r,"hideUnscrollableSlider",!1),t[`adaptThumb${i}SizeMode`]=pv(r,"adaptThumbSize",!1),t[`minThumb${i}Size`]=pv(r,"minThumbSize",void 0)}else t[`hideUnscrollableSlider${i}`]=!1,t[`adaptThumb${i}SizeMode`]=!1,t[`minThumb${i}Size`]=void 0;var m,y,x=pv(s,"scrollDetectionMode");"string"==typeof x&&(x=fv[x]);var b=`scroller${i}`;(m=a||s.hasOwnProperty(b)?pv(s,b,!0):pv(s,"scroller",!0))&&o&&(!0===m&&(m={}),m.orientation=h?0:1,void 0!==x&&(m.rectBoundsInteractive=1===x),y=new lv(o,m),o.isRexContainerLite&&o.sendChildToBack(o));var C,w,S,O,P,T=pv(s,a?`mouseWheelScroller${i}`:"mouseWheelScroller",!1);T&&o&&(void 0!==x&&(T.focus=1===x?2:0),C=new uv(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.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 gv={right:0,left:1,bottom:0,top:1},fv={gameObject:0,rectBounds:1},mv=Phaser.Utils.Objects.GetValue;var yv=function(t,e){var i=t.scene,s=[0,1,0],r=[0,1,0],n=mv(e,"width"),h=mv(e,"height");n||mv(e,"child.expandWidth",!0)||(s[1]=0),h||mv(e,"child.expandHeight",!0)||(r[1]=0);var a=new Sp(i,{column:3,row:3,columnProportions:s,rowProportions:r});switch(function(t,e,i){var s=Op(i,"child"),r=Op(s,"gameObject",void 0);if(r){var n=Op(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=Op(n,"top",0),h.bottom=Op(n,"bottom",0),a.left=Op(n,"left",0),a.right=Op(n,"right",0);break;case 1:h.top=Op(n,"left",0),h.bottom=Op(n,"right",0),a.top=Op(n,"top",0),a.bottom=Op(n,"bottom",0);break;default:h.top=Op(n,"top",0),h.bottom=Op(n,"bottom",0),h.left=Op(n,"left",0),h.right=Op(n,"right",0)}e.add(r,{column:1,row:1,align:Op(s,"align","center"),padding:a,expand:{width:Op(s,"expandWidth",!0),height:Op(s,"expandHeight",!0)}})}t.addChildrenMap("child",r)}(t,a,e),t.scrollMode){case 0:vv(t,a,"y",e);break;case 1:vv(t,a,"x",e);break;default:vv(t,a,"y",e),vv(t,a,"x",e)}return a},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}`]}if(s){var n="Y"===t?this.scaleY:this.scaleX;s.setBounds(e,i*n)}r&&r.setEnable(e!==i)},bv=function(t){switch(this.scrollMode){case 0:case 1:(e=this.childrenMap.slider)&&this.hideUnscrollableSlider&&this.setChildVisible(e,this.isOverflow);break;default:t=t.toUpperCase();var e=this.childrenMap[`slider${t}`],i=this[`hideUnscrollableSlider${t}`],s=this[`isOverflow${t}`];e&&i&&this.setChildVisible(e,s)}},Cv=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(_v.call(this,-this.textOY)),0),e=kv.call(this,t)+this.textOY,i=Ev.call(this,t);return function(t,e){switch(zh(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,Mv.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,ze.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,Lv.call(this,t,n,h),he(t,s,r,n,h,e.align),e.preOffsetY=0,Mv.call(this),this.textMask&&(this.textMask.setPosition().resize(),this.resetChildPositionState(this.textMask)))}};const Av=Phaser.Utils.Objects.IsPlainObject,Yv=Phaser.Utils.Objects.GetValue,Wv=Phaser.Display.Align.TOP_LEFT;class Xv extends qn{constructor(t,e,i,s,r,n){Av(e)?(e=Yv(n=e,"x",0),i=Yv(n,"y",0),s=Yv(n,"width",void 0),r=Yv(n,"height",void 0)):Av(s)&&(s=Yv(n=s,"width",void 0),r=Yv(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=Yv(n,"content",""),this._textOY=0,this.execeedTopState=!1,this.execeedBottomState=!1,this.setClampMode(Yv(n,"clampTextOY",!0)),this.alwaysScrollable=Yv(n,"alwaysScrollable",!1);var h=Yv(n,"background",void 0),a=Yv(n,"text",void 0);void 0===a&&(a=zv(t)),this.textCropEnable=Yv(n,"textCrop",!!a.setCrop);var o=Yv(n,"textMask",!this.textCropEnable);h&&this.addBackground(h),this.add(a),this.sizerChildren=[a];var l=this.getSizerConfig(a);l.align=Wv,l.padding=ue(0),l.expand=!0,this.textObject=a,this.textObjectType=zh(a),l.preOffsetY=0,l.offsetY=0,o&&(this.textMask=Dh.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(_v.call(this,this._textObjectRealHeight))),this._visibleLinesCount}get topTextOY(){return 0}get bottomTextOY(){return-this.textVisibleHeight}get textHeight(){return void 0===this._textHeight&&(this._textHeight=kv.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 zv=function(t){return t.add.text(0,0,"")};Object.assign(Xv.prototype,Dv);var Fv={setText(t){return this.childrenMap.child.setText(t),this.resizeController(),this},appendText(t){return this.setText(this.text+t),this}},jv={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 Iv=Phaser.Utils.Objects.GetValue;class Bv extends Pv{constructor(t,e){void 0===e&&(e={});var i=Iv(e,"text",void 0),s=Iv(e,"textWidth",void 0),r=Iv(e,"textHeight",void 0),n=Iv(e,"textCrop",!!i.setCrop),h=Iv(e,"textMask",!n),a=Iv(e,"content",""),o=new Xv(t,{width:s,height:r,text:i,textMask:h,textCrop:n&&!h,content:a,clampTextOY:Iv(e,"clampChildOY",!1),alwaysScrollable:Iv(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=Iv(e,"space",void 0);l&&(l.child=Iv(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(Bv.prototype,Fv,jv);const Hv=Phaser.Utils.Objects.GetValue;var Nv=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 Zu(t,0,0,"",e);break;case"label":s=new Uv(t,e);break;case"textarea":s=function(t,e,i){e=e?go(e):{};var s=Hv(i,"background",fc),r=Hv(i,"text",Nv),n=Hv(i,"track",fc),h=Hv(i,"thumb",fc);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 Bv(t,e);return t.add.existing(o),o}(t,e);break;default:s=new xc(t,e)}return gc(s,e),t.add.existing(s),s},Vv=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 pc(t,e):new Vd(t,e);break;case"roundRectangle":s=new jl(t,e);break;default:s=new Jd(t,e)}return gc(s,e),t.add.existing(s),s};const Gv=Phaser.Utils.Objects.GetValue;class Uv extends ul{constructor(t,e,i){e=function(t,e,i){e=e?go(e):{};var s=Gv(i,"background",fc),r=Gv(i,"text",Nv),n=Gv(i,"icon",Vv),h=Gv(i,"action",Vv);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 $v(this.getChildren(),"setActiveState",t),this}setHoverState(t){return $v(this.getChildren(),"setHoverState",t),this}setDisableState(t){return $v(this.getChildren(),"setDisableState",t),this}}var $v=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)):(vg(this),gg(this)),this}setNumberInput(){return this.onUpdateCallback=pg,this}setSelectAllWhenFocusEnable(t){return void 0===t&&(t=!0),this.selectAllWhenFocus=t,this}setRequestCursorPosition(t){return this.isOpened?(this.requestCursorPosition=t,this):this}}const yg=Phaser.Utils.Objects.GetValue,xg=["inputType","onOpen","clickOutSideTarget","onFocus","onClose","onBlur","onUpdate","enterClose","readOnly","maxLength","minLength","selectAll"];var bg=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}_g.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(kg(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 Eg=new _g,Mg=/^[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,Rg=/\S/,Lg=new _g;Lg.equals=function(t,e){return this.options.ignoreCase&&(t=t.toLowerCase(),e=e.toLowerCase()),t===e||this.options.ignoreWhitespace&&!Rg.test(t)&&!Rg.test(e)},Lg.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(Wg(t,null,null,i),i," ")},Yg.equals=function(t,e){return _g.prototype.equals.call(Yg,t.replace(/,([\r\n])/g,"$1"),e.replace(/,([\r\n])/g,"$1"))};const Xg=new _g;Xg.tokenize=function(t){return t.slice()},Xg.join=Xg.removeEmpty=function(t){return t};const zg=Phaser.Utils.Array.Remove;var Fg=function(t,e){var i=t.text;if(e!==i){if(null==i&&(i=""),zg(t.children,t.lastInsertCursor),""===e)t.removeChildren();else for(var s=(o=i,l=e,Eg.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},Ng={cursorMoveLeft(){if(!this.isOpened)return this;var t=Ig(this.cursorPosition-1,0,this.inputText.length);return this.setCursorPosition(t),this},cursorMoveRight(){if(!this.isOpened)return this;var t=Ig(this.cursorPosition+1,0,this.inputText.length);return this.setCursorPosition(t),this},cursorMoveUp(){if(!this.isOpened)return this;var t=Bg(this.characterCountOfLines,this.cursorPosition);t.lineIndex-=1;var e=Ig(Hg(this.characterCountOfLines,t),0,this.inputText.length);return this.setCursorPosition(e),this},cursorMoveDown(){if(!this.isOpened)return this;var t=Bg(this.characterCountOfLines,this.cursorPosition);t.lineIndex+=1;var e=Ig(Hg(this.characterCountOfLines,t),0,this.inputText.length);return this.setCursorPosition(e),this}};const Vg=Phaser.Utils.Objects.IsPlainObject;class Gg extends sl{constructor(t,e,i,s,r,n){Vg(e)?n=e:Vg(s)&&(n=s),void 0===n&&(n={}),function(t,e){var i=!e.textArea;if(bg(e,"wrap.vAlign")||Dd(e,"wrap.vAlign",s=i?"center":"top"),bg(e,"wrap.wrapMode")||Dd(e,"wrap.wrapMode","char"),bg(e,"wrap.maxLines")||Dd(e,"wrap.maxLines",s=i?1:void 0),i&&Dd(e,"wrap.wrapWidth",1/0),bg(e,"wrap.useDefaultTextHeight")||Dd(e,"wrap.useDefaultTextHeight",!0),e.edit||(e.edit={}),!bg(e.edit,"inputType")){var s=i?"text":"textarea";Dd(e.edit,"inputType",s)}if(!0===e.clickOutSideTarget){var r=new wg(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");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=yg(e,"edit");return void 0===i&&(i={}),qv(e,i,xg),new mg(t,i)}(this,n),Sg.call(this),n.focusStyle&&Object.assign(a,n.focusStyle),Tg.call(this,a),n.cursorStyle&&Object.assign(o,n.cursorStyle),Pg.call(this,o);var l=n.onAddChar;l&&this.on("addchar",l);var d=n.onCursorOut;d&&this.on("cursorout",d);var c=n.onCursorIn;c&&this.on("cursorin",c);var u,p=n.onMoveCursor;p&&this.on("movecursor",p),this.setParseTextCallback(n.parseTextCallback),this.lastInsertCursor=((u=this.createCharChild("|")).text="",u),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(u=0;u0&&this.wrapMode!==Gh&&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=Kh[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],u=o[2];if("wrapCallback"===a||"wrapCallbackScope"===a)this[a]=Mu(t,l,d);else{var c=Eu(t,l,d);u&&(c=u(c)),this[a]=c}}var p=Mu(t,"font",null);this._font=null===p?this.fontStyle+" "+this.fontSize+" "+this.fontFamily:p;var v=Mu(t,"fill",null);null!==v&&(this.color=Ra(v));var g=Mu(t,"metrics",!1);return g?this.metrics={ascent:Mu(g,"ascent",0),descent:Mu(g,"descent",0),fontSize:Mu(g,"fontSize",0)}:!e&&this.metrics||(this.metrics=ku(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=ku(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=Mu(t,"fontFamily","Courier"),this.fontSize=Mu(t,"fontSize","16px"),this.fontStyle=Mu(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=Ra(t,this.parent.canvas,this.parent.context),this.backgroundColor2=Ra(e,this.parent.canvas,this.parent.context),this.backgroundHorizontalGradient=i,this.update(!1)}setBackgroundStrokeColor(t,e){return this.backgroundStrokeColor=Ra(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=Ra(t,this.parent.canvas,this.parent.context),this.update(!1)}setColor(t){return this.color=Ra(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=Ra(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=Ra(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=Ra(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=Ra(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=Ra(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=Ra(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=Ra(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=Kh[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=Mu(e,"fontFamily",this.fontFamily),this.fontSize=Mu(e,"fontSize",this.fontSize),this.fontStyle=Mu(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 Lu={draw(t,e,i,s){var r=this.penManager;this.hitAreaManager.clear();var n=this.context;n.save();var h=this.defaultStyle;this.clear(),Ha(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,u,c,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;c="center"===v?Math.max((s-o*g)/2,0):"bottom"===v?Math.max(s-o*g-2,0):0,c+=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 u,c=t.prop.area;if(c)u={key:c};else{var p=t.prop.url;u={key:`url:${p}`,url:p}}this.hitAreaManager.add(e,i-this.startYOffset,t.width,this.defaultStyle.lineHeight,u)}},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 Du=Phaser.Utils.Objects.GetValue,Au=Hh,Yu=Nh;class Wu{constructor(t){this.prop={},this.resetFromJSON(t)}resetFromJSON(t){this.text=Du(t,"text",""),this.x=Du(t,"x",0),this.y=Du(t,"y",0),this.width=Du(t,"width",0);var e=Du(t,"prop",null);null===e&&(e={}),this.prop=e,this.newLineMode=Du(t,"newLineMode",0),this.startIndex=Du(t,"startIndex",0)}get plainText(){var t=this.text;return this.newLineMode===Yu&&(t+="\n"),t}get wrapText(){var t=this.text;return this.newLineMode!==Au&&(t+="\n"),t}get rawTextLength(){var t=this.text.length;return this.newLineMode===Yu&&(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 Xu=Phaser.Utils.Objects.GetFastValue,zu=Hh,Fu=Vh;class ju{constructor(t){this.pens=[],this.lines=[],this.maxLinesWidth=void 0,this.pensPool=t.pensPool,this.linesPool=t.linesPool,this.tagToText=Xu(t,"tagToText",Wt),this.tagToTextScope=Xu(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?u+=this.tagToText.call(this.tagToTextScope,h,l,d):u+=this.tagToText(h,l,d),d=l,!(o>=e)));c++);return u}get length(){return this.lines.length}set length(t){this.clear()}}var Iu={};const Bu=Phaser.Geom.Rectangle;var Hu=new qo;class Nu{constructor(){this.hitAreas=[]}destroy(){this.clear()}clear(){for(var t=0,e=this.hitAreas.length;ts&&rc(g)){""!==x?h.push(n.getLine(x,b,qu)):0===C&&r>0&&h.push(n.getLine("",0,qu)),h.push(...ic(g,e,tc,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,qu)),x=g,b=f,o=s):(x+=g,b=m),C===w-1&&h.push(n.getLine(x,b,l))}return h},sc=function(t,e){var i;switch(e){case Qu:i=[];for(var s=0,r=(t=t.split(" ")).length;s0&&e!==hc&&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 ju({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 cp(this.sizerChildren,null),uh.call(this,t),this}},vp={setColumnSpace(t){if(this.space.column||(this.space.column=[]),this.space.column.length=this.columnCount-1,"number"==typeof t)cp(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,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===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,cp(this.sizerChildren,null),this.columnProportions=[],this.columnProportions.length=t,"number"==typeof i)cp(this.columnProportions,i);else for(var n=0;n0?e+=t:0===t&&(this.hasColumnProportion0Child=!0);return e},bp=function(){for(var t,e=0,i=0;i0?e+=t:0===t&&(this.hasRowProportion0Child=!0);return e};const Cp=Phaser.Utils.Objects.IsPlainObject,wp=Phaser.Utils.Objects.GetValue;class Sp extends qn{constructor(t,e,i,s,r,n,h,a,o,l){Cp(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),h=wp(l,"row",0),a=wp(l,"columnProportions",0),o=wp(l,"rowProportions",0)):Cp(s)?(s=wp(l=s,"width",void 0),r=wp(l,"height",void 0),n=wp(l,"column",l.col||0),h=wp(l,"row",0),a=wp(l,"columnProportions",0),o=wp(l,"rowProportions",0)):Cp(n)?(n=wp(l=n,"column",l.col||0),h=wp(l,"row",0),a=wp(l,"columnProportions",0),o=wp(l,"rowProportions",0)):Cp(a)&&(a=wp(l=a,"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,h,a,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=xp.call(this)),this._totalColumnProportions}get totalRowProportions(){return void 0===this._totalRowProportions&&(this._totalRowProportions=bp.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(Sp.prototype,yp);const Op=Phaser.Utils.Objects.GetValue,Pp=Phaser.Math.Percent;var Tp=function(t,e,i){var s;return t.y===e.y?s=Pp(i.x,t.x,e.x):t.x===e.x&&(s=Pp(i.y,t.y,e.y)),s},_p=function(t,e,i){var s,r;this.enable&&(kp.x=e,kp.y=i,this.reverseAxis?(s=this.getEndPoint(),r=this.getStartPoint()):(s=this.getStartPoint(),r=this.getEndPoint()),this.value=Tp(s,r,kp))},kp={},Ep=function(t,e,i){if(this.enable&&t.isDown){var s,r;Mp.x=t.worldX,Mp.y=t.worldY,this.reverseAxis?(s=this.getEndPoint(),r=this.getStartPoint()):(s=this.getStartPoint(),r=this.getEndPoint());var n=Tp(s,r,Mp);this.stopEaseValue(),0===this.easeValueDuration||Math.abs(this.value-n)<.1?this.value=n:this.easeValueTo(n)}},Mp={},Rp=function(t,e){void 0===e&&(e=Lp);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},Lp={};const Dp=Phaser.Display.Align.LEFT_CENTER,Ap=Phaser.Display.Align.TOP_CENTER;var Yp={};const Wp=Phaser.Display.Align.RIGHT_CENTER,Xp=Phaser.Display.Align.BOTTOM_CENTER;var zp={};const Fp=Phaser.Math.Linear;var jp={};const Ip=Phaser.Display.Align.LEFT_CENTER,Bp=Phaser.Display.Align.TOP_CENTER,Hp=Phaser.Display.Align.RIGHT_CENTER,Np=Phaser.Display.Align.BOTTOM_CENTER,Vp=Phaser.Utils.Objects.GetValue,Gp=Phaser.Utils.Objects.IsPlainObject,Up=Phaser.Math.Clamp,$p=Phaser.Math.Snap.To;class Jp extends(ed(Sh)){constructor(t,e){super(t,e),this.type="rexSlider",this.bootProgressBase(e),this.reverseAxis=Vp(e,"reverseAxis",!1);var i=Vp(e,"background",void 0),s=Vp(e,"track",void 0),r=Vp(e,"indicator",void 0),n=Vp(e,"thumb",void 0);if(i&&(Gp(i)&&(i=fu(t,i)),this.addBackground(i)),s&&(Gp(s)&&(s=fu(t,s)),this.add(s,{proportion:1,expand:!0,minWidth:0===this.orientation?0:void 0,minHeight:1===this.orientation?0:void 0})),r&&(Gp(r)&&(r=fu(t,r)),this.pin(r)),n){Gp(n)&&(n=fu(t,n)),this.pin(n);var h=Vp(e,"thumbOffsetX",0),a=Vp(e,"thumbOffsetY",0);this.setThumbOffset(h,a)}var o=Vp(e,"input",0);switch("string"==typeof o&&(o=Kp[o]),o){case 0:n&&(n.setInteractive(),this.scene.input.setDraggable(n),n.on("drag",_p,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",Ep,this).on("pointermove",Ep,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(Vp(e,"enable",void 0)),this.setGap(Vp(e,"gap",void 0)),this.setValue(Vp(e,"value",0),Vp(e,"min",void 0),Vp(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}setThumbOffset(t,e){return this.thumbOffsetX=t,this.thumbOffsetY=e,this}get value(){return this._value}set value(t){void 0!==this.gap&&(t=$p(t,this.gap));var e=this._value;this._value=Up(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 Kp={pan:0,drag:0,click:1,none:-1};var qp={getStartPoint:function(t){if(void 0===t&&(t=Yp),this.childrenMap.thumb){var e=0===this.orientation?Dp:Ap;Rp.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=zp),this.childrenMap.thumb){var e=0===this.orientation?Wp:Xp;Rp.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=jp),s.x=Fp(e.x,i.x,t),s.y=Fp(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;Ie(e,i,s),r=n?0===this.orientation?Hp:Np:0===this.orientation?Ip:Bp,ne(e,this,r),this.resetChildPositionState(e)}};Object.assign(Jp.prototype,qp);const Zp=Phaser.Utils.Objects.GetValue;class Qp extends Sh{constructor(t,e){super(t,e),this.type="rexScrollBar";var i,s,r=Zp(e,"background",void 0),n=Zp(e,"buttons",void 0),h=Zp(n,"top",Zp(n,"left",void 0)),a=Zp(n,"bottom",Zp(n,"right",void 0)),o=Zp(e,"slider",void 0);(r&&this.addBackground(r),h&&(this.add(h),new _r(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===Zp(o,"width",void 0)?1:0:void 0===Zp(o,"height",void 0)?1:0,i=new Jp(t,o),t.add.existing(i),this.add(i,{proportion:s}));a&&(this.add(a),new _r(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=Zp(e,"valuechangeCallback",null);if(null!==d){var u=Zp(e,"valuechangeCallbackScope",void 0);this.on("valuechange",d,u)}this.setEnable(Zp(e,"enable",void 0)),this.setValue(Zp(e,"value",0)),this.setScrollStep(Zp(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}}class tv extends ks{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 ev=Phaser.Utils.Objects.GetValue,iv=Phaser.Math.Distance.Between;class sv extends Qe{constructor(t,e){super(t,e),this._enable=void 0,this.rectBoundsInteractive=ev(e,"rectBoundsInteractive",!1),this.rectBoundsInteractive||t.setInteractive(ev(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(ev(t,"enable",!0)),this.holdThreshold=ev(t,"holdThreshold",50),this.pointerOutReleaseEnable=ev(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 an(this.scene)}get speed(){return this.x===this.preX&&this.y===this.preY?0:iv(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&&!nr(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&&!nr(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 rv=Phaser.Utils.Objects.GetValue;class nv{constructor(t){this.resetFromJSON(t)}resetFromJSON(t){return this.setValue(rv(t,"value",0)),this.setSpeed(rv(t,"speed",0)),this.setAcceleration(rv(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 hv{constructor(){this.value,this.dir,this.movement=new nv}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 dv={y:0,v:0,vertical:0,x:1,h:1,horizontal:1},uv=Phaser.Utils.Objects.GetValue;class cv extends Qe{constructor(t,e){switch(super(t,e),this.parent!==this.scene?this.focusMode=uv(e,"focus",!0):this.focusMode=!1,"boolean"==typeof this.focusMode&&(this.focusMode=this.focusMode?1:0),this.setSpeed(uv(e,"speed",.1)),this.setEnable(uv(e,"enable",!0)),this.focusMode){case 0:case 2:this.scene.input.on("wheel",this.onSceneScroll,this);break;default:t.setInteractive(uv(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||nr(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 pv=Phaser.Utils.Objects.GetValue;var vv=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)?pv(s,l,void 0):pv(s,"slider",void 0)){var d,u,c;!0===r&&(r={}),r.orientation=h?1:0,n=function(t,e){void 0===e&&(e={});var i=ft(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 Qp(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);var p=pv(r,"position",0);"string"==typeof p&&(p=gv[p]);var v,g,f=pv(s,`space.slider${i}`,void 0);void 0===f&&void 0===(f=pv(s,"space.slider",void 0))&&(a?f=0:v=pv(s,"space.child",0)),g=void 0===v?"number"==typeof f:"number"==typeof v,h?0===p?(d=2,u=1,c=void 0===v?g?{left:f}:f:{left:pv(v,"right",v)}):(d=0,u=1,c=void 0===v?g?{right:f}:f:{right:pv(v,"left",v)}):0===p?(d=1,u=2,c=void 0===v?g?{top:f}:f:{top:pv(v,"bottom",v)}):(d=1,u=0,c=void 0===v?g?{bottom:f}:f:{bottom:pv(v,"top",v)}),e.add(n,{column:d,row:u,align:"center",padding:c,expand:!0}),t[`hideUnscrollableSlider${i}`]=pv(r,"hideUnscrollableSlider",!1),t[`adaptThumb${i}SizeMode`]=pv(r,"adaptThumbSize",!1),t[`minThumb${i}Size`]=pv(r,"minThumbSize",void 0)}else t[`hideUnscrollableSlider${i}`]=!1,t[`adaptThumb${i}SizeMode`]=!1,t[`minThumb${i}Size`]=void 0;var m,y,x=pv(s,"scrollDetectionMode");"string"==typeof x&&(x=fv[x]);var b=`scroller${i}`;(m=a||s.hasOwnProperty(b)?pv(s,b,!0):pv(s,"scroller",!0))&&o&&(!0===m&&(m={}),m.orientation=h?0:1,void 0!==x&&(m.rectBoundsInteractive=1===x),y=new lv(o,m),o.isRexContainerLite&&o.sendChildToBack(o));var C,w,S,O,P,T=pv(s,a?`mouseWheelScroller${i}`:"mouseWheelScroller",!1);T&&o&&(void 0!==x&&(T.focus=1===x?2:0),C=new cv(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.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 gv={right:0,left:1,bottom:0,top:1},fv={gameObject:0,rectBounds:1},mv=Phaser.Utils.Objects.GetValue;var yv=function(t,e){var i=t.scene,s=[0,1,0],r=[0,1,0],n=mv(e,"width"),h=mv(e,"height");n||mv(e,"child.expandWidth",!0)||(s[1]=0),h||mv(e,"child.expandHeight",!0)||(r[1]=0);var a=new Sp(i,{column:3,row:3,columnProportions:s,rowProportions:r});switch(function(t,e,i){var s=Op(i,"child"),r=Op(s,"gameObject",void 0);if(r){var n=Op(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=Op(n,"top",0),h.bottom=Op(n,"bottom",0),a.left=Op(n,"left",0),a.right=Op(n,"right",0);break;case 1:h.top=Op(n,"left",0),h.bottom=Op(n,"right",0),a.top=Op(n,"top",0),a.bottom=Op(n,"bottom",0);break;default:h.top=Op(n,"top",0),h.bottom=Op(n,"bottom",0),h.left=Op(n,"left",0),h.right=Op(n,"right",0)}e.add(r,{column:1,row:1,align:Op(s,"align","center"),padding:a,expand:{width:Op(s,"expandWidth",!0),height:Op(s,"expandHeight",!0)}})}t.addChildrenMap("child",r)}(t,a,e),t.scrollMode){case 0:vv(t,a,"y",e);break;case 1:vv(t,a,"x",e);break;default:vv(t,a,"y",e),vv(t,a,"x",e)}return a},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}`]}if(s){var n="Y"===t?this.scaleY:this.scaleX;s.setBounds(e,i*n)}r&&r.setEnable(e!==i)},bv=function(t){switch(this.scrollMode){case 0:case 1:(e=this.childrenMap.slider)&&this.hideUnscrollableSlider&&this.setChildVisible(e,this.isOverflow);break;default:t=t.toUpperCase();var e=this.childrenMap[`slider${t}`],i=this[`hideUnscrollableSlider${t}`],s=this[`isOverflow${t}`];e&&i&&this.setChildVisible(e,s)}},Cv=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(_v.call(this,-this.textOY)),0),e=kv.call(this,t)+this.textOY,i=Ev.call(this,t);return function(t,e){switch(zh(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,Mv.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,ze.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,Lv.call(this,t,n,h),he(t,s,r,n,h,e.align),e.preOffsetY=0,Mv.call(this),this.textMask&&(this.textMask.setPosition().resize(),this.resetChildPositionState(this.textMask)))}};const Av=Phaser.Utils.Objects.IsPlainObject,Yv=Phaser.Utils.Objects.GetValue,Wv=Phaser.Display.Align.TOP_LEFT;class Xv extends qn{constructor(t,e,i,s,r,n){Av(e)?(e=Yv(n=e,"x",0),i=Yv(n,"y",0),s=Yv(n,"width",void 0),r=Yv(n,"height",void 0)):Av(s)&&(s=Yv(n=s,"width",void 0),r=Yv(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=Yv(n,"content",""),this._textOY=0,this.execeedTopState=!1,this.execeedBottomState=!1,this.setClampMode(Yv(n,"clampTextOY",!0)),this.alwaysScrollable=Yv(n,"alwaysScrollable",!1);var h=Yv(n,"background",void 0),a=Yv(n,"text",void 0);void 0===a&&(a=zv(t)),this.textCropEnable=Yv(n,"textCrop",!!a.setCrop);var o=Yv(n,"textMask",!this.textCropEnable);h&&this.addBackground(h),this.add(a),this.sizerChildren=[a];var l=this.getSizerConfig(a);l.align=Wv,l.padding=ce(0),l.expand=!0,this.textObject=a,this.textObjectType=zh(a),l.preOffsetY=0,l.offsetY=0,o&&(this.textMask=Dh.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(_v.call(this,this._textObjectRealHeight))),this._visibleLinesCount}get topTextOY(){return 0}get bottomTextOY(){return-this.textVisibleHeight}get textHeight(){return void 0===this._textHeight&&(this._textHeight=kv.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 zv=function(t){return t.add.text(0,0,"")};Object.assign(Xv.prototype,Dv);var Fv={setText(t){return this.childrenMap.child.setText(t),this.resizeController(),this},appendText(t){return this.setText(this.text+t),this}},jv={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 Iv=Phaser.Utils.Objects.GetValue;class Bv extends Pv{constructor(t,e){void 0===e&&(e={});var i=Iv(e,"text",void 0),s=Iv(e,"textWidth",void 0),r=Iv(e,"textHeight",void 0),n=Iv(e,"textCrop",!!i.setCrop),h=Iv(e,"textMask",!n),a=Iv(e,"content",""),o=new Xv(t,{width:s,height:r,text:i,textMask:h,textCrop:n&&!h,content:a,clampTextOY:Iv(e,"clampChildOY",!1),alwaysScrollable:Iv(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=Iv(e,"space",void 0);l&&(l.child=Iv(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(Bv.prototype,Fv,jv);const Hv=Phaser.Utils.Objects.GetValue;var Nv=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 Zc(t,0,0,"",e);break;case"label":s=new Uv(t,e);break;case"textarea":s=function(t,e,i){e=e?go(e):{};var s=Hv(i,"background",fu),r=Hv(i,"text",Nv),n=Hv(i,"track",fu),h=Hv(i,"thumb",fu);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 Bv(t,e);return t.add.existing(o),o}(t,e);break;default:s=new xu(t,e)}return gu(s,e),t.add.existing(s),s},Vv=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 pu(t,e):new Vd(t,e);break;case"roundRectangle":s=new jl(t,e);break;default:s=new Jd(t,e)}return gu(s,e),t.add.existing(s),s};const Gv=Phaser.Utils.Objects.GetValue;class Uv extends cl{constructor(t,e,i){e=function(t,e,i){e=e?go(e):{};var s=Gv(i,"background",fu),r=Gv(i,"text",Nv),n=Gv(i,"icon",Vv),h=Gv(i,"action",Vv);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 $v(this.getChildren(),"setActiveState",t),this}setHoverState(t){return $v(this.getChildren(),"setHoverState",t),this}setDisableState(t){return $v(this.getChildren(),"setDisableState",t),this}}var $v=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,u=a+t.drawBLY;e=o<0?0-o:l>r?r-l:0,i=d<0?0-d:u>n?n-u: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)):(vg(this),gg(this)),this}setNumberInput(){return this.onUpdateCallback=pg,this}setSelectAllWhenFocusEnable(t){return void 0===t&&(t=!0),this.selectAllWhenFocus=t,this}setRequestCursorPosition(t){return this.isOpened?(this.requestCursorPosition=t,this):this}}const yg=Phaser.Utils.Objects.GetValue,xg=["inputType","onOpen","clickOutSideTarget","onFocus","onClose","onBlur","onUpdate","enterClose","readOnly","maxLength","minLength","selectAll"];var bg=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}_g.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:[]}],u=this.extractCommon(d[0],e,t,0);if(d[0].newPos+1>=h&&u+1>=a)return n([{value:this.join(e),count:e.length}]);function c(){for(let s=-1*o;s<=o;s+=2){let o,l=d[s-1],u=d[s+1],c=(u?u.newPos:0)-s;l&&(d[s-1]=void 0);let p=l&&l.newPos+1=h&&c+1>=a)return n(kg(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();c()||t()}),0)}();else for(;o<=l;){let t=c();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 Eg=new _g,Mg=/^[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,Rg=/\S/,Lg=new _g;Lg.equals=function(t,e){return this.options.ignoreCase&&(t=t.toLowerCase(),e=e.toLowerCase()),t===e||this.options.ignoreWhitespace&&!Rg.test(t)&&!Rg.test(e)},Lg.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(Wg(t,null,null,i),i," ")},Yg.equals=function(t,e){return _g.prototype.equals.call(Yg,t.replace(/,([\r\n])/g,"$1"),e.replace(/,([\r\n])/g,"$1"))};const Xg=new _g;Xg.tokenize=function(t){return t.slice()},Xg.join=Xg.removeEmpty=function(t){return t};const zg=Phaser.Utils.Array.Remove;var Fg=function(t,e){var i=t.text;if(e!==i){if(null==i&&(i=""),zg(t.children,t.lastInsertCursor),""===e)t.removeChildren();else for(var s=(o=i,l=e,Eg.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},Ng={cursorMoveLeft(){if(!this.isOpened)return this;var t=Ig(this.cursorPosition-1,0,this.inputText.length);return this.setCursorPosition(t),this},cursorMoveRight(){if(!this.isOpened)return this;var t=Ig(this.cursorPosition+1,0,this.inputText.length);return this.setCursorPosition(t),this},cursorMoveUp(){if(!this.isOpened)return this;var t=Bg(this.characterCountOfLines,this.cursorPosition);t.lineIndex-=1;var e=Ig(Hg(this.characterCountOfLines,t),0,this.inputText.length);return this.setCursorPosition(e),this},cursorMoveDown(){if(!this.isOpened)return this;var t=Bg(this.characterCountOfLines,this.cursorPosition);t.lineIndex+=1;var e=Ig(Hg(this.characterCountOfLines,t),0,this.inputText.length);return this.setCursorPosition(e),this}};const Vg=Phaser.Utils.Objects.IsPlainObject;class Gg extends sl{constructor(t,e,i,s,r,n){Vg(e)?n=e:Vg(s)&&(n=s),void 0===n&&(n={}),function(t,e){var i=!e.textArea;if(bg(e,"wrap.vAlign")||Dd(e,"wrap.vAlign",s=i?"center":"top"),bg(e,"wrap.wrapMode")||Dd(e,"wrap.wrapMode","char"),bg(e,"wrap.maxLines")||Dd(e,"wrap.maxLines",s=i?1:void 0),i&&Dd(e,"wrap.wrapWidth",1/0),bg(e,"wrap.useDefaultTextHeight")||Dd(e,"wrap.useDefaultTextHeight",!0),e.edit||(e.edit={}),!bg(e.edit,"inputType")){var s=i?"text":"textarea";Dd(e.edit,"inputType",s)}if(!0===e.clickOutSideTarget){var r=new wg(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");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=yg(e,"edit");return void 0===i&&(i={}),qv(e,i,xg),new mg(t,i)}(this,n),Sg.call(this),n.focusStyle&&Object.assign(a,n.focusStyle),Tg.call(this,a),n.cursorStyle&&Object.assign(o,n.cursorStyle),Pg.call(this,o);var l=n.onAddChar;l&&this.on("addchar",l);var d=n.onCursorOut;d&&this.on("cursorout",d);var u=n.onCursorIn;u&&this.on("cursorin",u);var c,p=n.onMoveCursor;p&&this.on("movecursor",p),this.setParseTextCallback(n.parseTextCallback),this.lastInsertCursor=((c=this.createCharChild("|")).text="",c),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) && (radius.y > 0)); + }; + var LineTo = function (x, y, pathData) { var cnt = pathData.length; if (cnt >= 2) { @@ -13511,8 +13515,7 @@ geom.setTo(0, 0, width, height, radius); } - var iteration = GetValue$V(radiusConfig, 'iteration', undefined); - this.setIteration(iteration); + this.setIteration(GetValue$V(radiusConfig, 'iteration', undefined)); this.setPosition(x, y); this.setFillStyle(fillColor, fillAlpha); @@ -13765,10 +13768,6 @@ } - var IsArcCorner$1 = function (radius) { - return ((radius.x > 0) && (radius.y > 0)); - }; - const ShapeTypeMap = { rectangle: 0, circle: 1 @@ -24565,6 +24564,7 @@ var skewX = this.skewX; var width = this.width - Math.abs(skewX); var height = this.height; + var trackFill = this.getShape('trackFill'); trackFill.fillStyle(this.trackColor); if (trackFill.isFilled) { @@ -24573,8 +24573,7 @@ 0, 0, // x0, y0 width, height, // x1, y1 skewX // skewX - ) - .close(); + ); } var bar = this.getShape('bar'); @@ -24594,8 +24593,7 @@ barX0, 0, // x0, y0 barX1, height, // x1, y1 skewX // skew - ) - .close(); + ); } var trackStroke = this.getShape('trackStroke'); @@ -24606,8 +24604,7 @@ 0, 0, // x0, y0 width, height, // x1, y1 skewX // skewX - ) - .end(); + ); } }; @@ -24627,6 +24624,8 @@ .lineTo(x0, y0).lineTo(startX, y0); } + lines.close(); + return lines; }; @@ -24637,24 +24636,33 @@ constructor(scene, x, y, width, height, barColor, value, config) { if (IsPlainObject$8(x)) { config = x; - x = GetValue$z(config, 'x', 0); - y = GetValue$z(config, 'y', 0); - width = GetValue$z(config, 'width', 2); - height = GetValue$z(config, 'height', 2); - barColor = GetValue$z(config, 'barColor', undefined); - value = GetValue$z(config, 'value', 0); + + x = config.x; + y = config.y; + width = config.width; + height = config.height; + barColor = config.barColor; + value = config.value; } else if (IsPlainObject$8(width)) { config = width; - width = GetValue$z(config, 'width', 2); - height = GetValue$z(config, 'height', 2); - barColor = GetValue$z(config, 'barColor', undefined); - value = GetValue$z(config, 'value', 0); + + width = config.width; + height = config.height; + barColor = config.barColor; + value = config.value; } else if (IsPlainObject$8(barColor)) { config = barColor; - barColor = GetValue$z(config, 'barColor', undefined); - value = GetValue$z(config, 'value', 0); + + barColor = config.barColor; + value = config.value; } + if (x === undefined) { x = 0; } + if (y === undefined) { y = 0; } + if (width === undefined) { width = 2; } + if (height === undefined) { height = width; } + if (value === undefined) { value = 0; } + super(scene, x, y, width, height, config); this.type = 'rexLineProgress'; diff --git a/dist/rexcolorinput.min.js b/dist/rexcolorinput.min.js index c852d441f3..996204db58 100644 --- a/dist/rexcolorinput.min.js +++ b/dist/rexcolorinput.min.js @@ -1,4 +1,4 @@ -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 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=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},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}},z=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}},X=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}},Oe=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,Te=Phaser.Utils.Objects.GetValue;var _e=function(t,e){return void 0===e?t:t[e]},Ee=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=Te(e,"left",0),t.right=Te(e,"right",0),t.top=Te(e,"top",0),t.bottom=Te(e,"bottom",0)),t},Me={getInnerPadding(t){return _e(this.space,t)},setInnerPadding(t,e){return Ee(this.space,t,e),this},getOuterPadding(t){return _e(this.getSizerConfig(this).padding,t)},setOuterPadding(t,e){return Ee(this.getSizerConfig(this).padding,t,e),this},getChildOuterPadding(t,e){return"string"==typeof t&&(t=this.getElement(t)),_e(this.getSizerConfig(t).padding,e)},setChildOuterPadding(t,e,i){return"string"==typeof t&&(t=this.getElement(t)),Ee(this.getSizerConfig(t).padding,e,i),this}},Re=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}},Le=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},De=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}},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},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},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}},Xe=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?vi:pi,this.repeatCounter=0,this}stop(){return this.state=ui,this}update(t,e){this.state!==ui&&this.state!==fi&&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=gi)):(this.nowTime=this.duration,this.state=fi):this.nowTime>=0&&(this.state=vi))}get t(){var t;switch(this.state){case ui:case pi:case gi:t=0;break;case vi:t=this.nowTime/this.duration;break;case fi:t=1}return di(t,0,1)}set t(t){(t=di(t,-1,1))<0?(this.state=pi,this.nowTime=-this.delay*t):(this.state=vi,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===ui}get isDelay(){return this.state===pi}get isCountDown(){return this.state===vi}get isRunning(){return this.state===pi||this.state===vi}get isDone(){return this.state===fi}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}}const ui=0,pi=1,vi=2,gi=3,fi=-1;class mi extends ai{constructor(t,e){super(t,e),this.timer=new ci}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 yi=Phaser.Utils.Objects.GetValue,xi=Phaser.Utils.Objects.GetAdvancedValue,bi=Phaser.Tweens.Builders.GetEaseFunction;class Ci extends mi{resetFromJSON(t){return this.timer.resetFromJSON(yi(t,"timer")),this.setEnable(yi(t,"enable",!0)),this.setTarget(yi(t,"target",this.parent)),this.setDelay(xi(t,"delay",0)),this.setDuration(xi(t,"duration",1e3)),this.setEase(yi(t,"ease","Linear")),this.setRepeat(yi(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=bi(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,Si=Phaser.Utils.Objects.GetAdvancedValue,Pi=Phaser.Math.Linear;let Oi=class extends Ci{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(Si(t,"start",void 0),Si(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=Si(t,"x",this.parent.scaleX),this.startY=Si(t,"y",this.parent.scaleY)),"number"==typeof e?(this.endX=e,this.endY=e):(this.endX=Si(e,"x",void 0),this.endY=Si(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=Pi(this.startX,this.endX,i)),this.hasScaleY&&(t.scaleY=Pi(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 Ti=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 Oi(t,a):r.resetFromJSON(a),r.restart(),r},_i=function(t,e,i,s,r,n){void 0===s&&(s="Linear"),r instanceof Oi&&(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 Oi(t,h):n.resetFromJSON(h),n.restart(),n},Ei=function(t,e){return new Promise((function(i,s){t.once(e,(function(){i()}))}))},Mi=function(t){return Ei(t,"complete")};const Ri=Phaser.Utils.Objects.IsPlainObject;var Li={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(Ri(t)){var s=t;t=s.duration,e=s.orientation,i=s.ease}var r=void 0===this._scaleBehavior;return this._scaleBehavior=Ti(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(Ri(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=_i(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(Ri(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 Oi(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),Mi(this._scaleBehavior)},isRunningScaleYoyo(){return this._scaleBehavior&&(this._scaleBehavior.completeEventName="scaleyoyo.complete")},isRunningEaseScale(){return this.isRunningPopUp()||this.isRunningScaleDown()||this.isRunningScaleYoyo()}},Di={};Object.assign(Di,Li),Di.onInitScale=function(){Li.onInitScale.call(this);var t=this;this._scaleBehavior.on("update",(function(){var e=me.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const Ai=Phaser.Utils.Objects.GetValue,zi=Phaser.Utils.Objects.GetAdvancedValue,Yi=Phaser.Math.Linear;class Wi extends Ci{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(zi(t,"start",this.parent.alpha),zi(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=Xi[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 Xi={stop:0,destroy:1,yoyo:2},ji=Phaser.Utils.Objects.IsPlainObject;var Fi=function(t,e,i,s){var r,n;ji(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},Ii=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 Bi=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(Bi(t)){var i=t;t=i.duration,e=i.alpha}var s=void 0===this._fade;return this._fade=Fi(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(Bi(t)){var i=t;t=i.duration,e=i.destroy}var s=void 0===this._fade;return this._fade=Ii(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()}},Gi={};Object.assign(Gi,Hi),Gi.onInitFade=function(){Hi.onInitFade.call(this);var t=this;this._fade.on("update",(function(){var e=me.getParentSizer(t);e&&e.resetChildAlphaState(t)}))};const Vi=Phaser.Utils.Objects.GetValue,Ni=Phaser.Utils.Objects.GetAdvancedValue,Ui=Phaser.Math.Linear;class $i extends Ci{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){if(super.resetFromJSON(t),this.setMode(Vi(t,"mode",0)),t&&(t.hasOwnProperty("x")||t.hasOwnProperty("y"))){var e=Ni(t,"x",void 0),i=Ni(t,"y",void 0);this.setTargetPosition(e,i)}else this.setTargetPosition(t);return this}setMode(t){return"string"==typeof t&&(t=Ji[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=Ni(i,"startX",void 0),this.startY=Ni(i,"startY",void 0),this.endX=Ni(i,"endX",void 0),this.endY=Ni(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=Ui(this.startX,this.endX,i)),this.hasMoveY&&(t.y=Ui(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Ji={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 Ki=Phaser.Utils.Objects.IsPlainObject,Zi=Phaser.Math.Distance.Between;var Qi={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(Ki(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*Zi(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 $i&&(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 $i(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),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(Ki(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*Zi(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 $i&&(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 $i(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),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}},ts={};Object.assign(ts,Qi),ts.onInitEaseMove=function(){Qi.onInitEaseMove.call(this);var t=this;this._easeMove.on("update",(function(){var e=me.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const es=Phaser.Utils.Objects.GetValue;class is extends ri{constructor(t,e){super(t,e),this.timer=new ci,this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.timer.resetFromJSON(es(t,"timer")),this.setEnable(es(t,"enable",!0)),this.setMode(es(t,"mode",1)),this.isRunning=es(t,"isRunning",!1),this.setMagnitudeMode(es(t,"magnitudeMode",1)),this.setAxisMode(es(t,"axis",0)),this.setDuration(es(t,"duration",500)),this.setMagnitude(es(t,"magnitude",10)),this.ox=es(t,"ox",void 0),this.oy=es(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=ss[t]),this.mode=t,this}setMagnitudeMode(t){return"string"==typeof t&&(t=ns[t]),this.magnitudeMode=t,this}setAxisMode(t){return"string"==typeof t&&(t=rs[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=es(i,"magnitude",void 0),t=es(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 ss={effect:0,behavior:1},rs={both:0,"h&v":0,"x&y":0,horizontal:1,h:1,x:1,vertical:2,v:2,y:2},ns={constant:0,decay:1},hs=Phaser.Utils.Objects.IsPlainObject;var as={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 is(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 os=Phaser.Utils.Objects.GetValue,ls=Phaser.Math.Linear;class ds extends Ci{constructor(t,e){super(t,e),this.resetFromJSON(),this.boot()}start(t){if(this.timer.isRunning)return this;var e=this.target;this.propertyKey=os(t,"key","value");var i=e[this.propertyKey];return this.fromValue=os(t,"from",i),this.toValue=os(t,"to",i),this.setEase(os(t,"ease",this.ease)),this.setDuration(os(t,"duration",this.duration)),this.setRepeat(os(t,"repeat",0)),this.setDelay(os(t,"delay",0)),this.setRepeatDelay(os(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]=ls(this.fromValue,this.toValue,i)}}const cs=Phaser.Utils.Objects.IsPlainObject;class us extends Qe{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 ds(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(cs(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(cs(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 ps={easeDataTo(t,e,i,s){return this._easeData||(this._easeData=new us(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),Ei(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}},vs=Phaser.Utils.Array.Remove,gs={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=$e(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}},Rs={setTransitInTime(t){return this.transitInTime=t,this},setTransitOutTime(t){return this.transitOutTime=t,this},setTransitInCallback(t){return t||(t=Yt),this.transitInCallback=t,this},setTransitOutCallback(t){return t||(t=Yt),this.transitOutCallback=t,this}},Ls={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}},Ds={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,Ms,Rs,Ls,Ds);const zs=Phaser.Utils.Objects.GetValue;class Ys extends Qe{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 Es(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(Ys.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 Xs extends Qe{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 js=Phaser.GameObjects.Rectangle;let Fs=class extends js{constructor(t,e,i){super(t,0,0,2,2,e,1),this.fullWindow=new Xs(this),this.setAlpha(i)}get tint(){return this.fillColor}set tint(t){this.setFillStyle(t,this.fillAlpha)}};const Is=Phaser.Utils.Objects.GetValue;class Bs extends Qe{constructor(t,e){super(t,{eventEmitter:!1}),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setHitAreaMode(Is(t,"hitAreaMode",0)),this.setEnable(Is(t,"enable",!0)),this.setStopMode(Is(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 Gs=Phaser.Utils.Objects.GetValue;class Vs extends Fs{constructor(t,e){super(t,Gs(e,"color",0),Gs(e,"alpha",.8)),this.touchEventStop=new Bs(this,{hitAreaMode:1})}}var Ns={popUp(t,e){void 0!==t._modalScaleSave?(t.scaleX=t._modalScaleSave,t.scaleY=t._modalScaleSave):t._modalScaleSave=t.scaleX,Ti(t,e)},scaleDown(t,e){_i(t,e,void 0,void 0,!1)},fadeIn(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Fi(t,e)},fadeOut(t,e){Ii(t,e,!1)}},Us=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Fi(t,e,t.alpha)},$s=function(t,e){Ii(t,e,!1)},Js=function(t,e,i,s,r){return!(!t||s&&!s(t,e,i)||!rt(t,!0).contains(e,i)||r&&!r(t,e,i))};const qs=Phaser.Utils.Objects.GetValue;let Ks=class extends Ys{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=Zs.popUp),null==e.transitOut&&(e.transitOut=Zs.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 Vs(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",Us)),this.setCoverTransitOutCallback(qs(i,"transitOut",$s)));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&&Js(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=Zs[t]),t){case Zs.popUp:t=Ns.popUp;break;case Zs.fadeIn:t=Ns.fadeIn}return super.setTransitInCallback(t),this}setTransitOutCallback(t){switch("string"==typeof t&&(t=Zs[t]),t){case Zs.scaleDown:t=Ns.scaleDown;break;case Zs.fadeOut:t=Ns.fadeOut}return super.setTransitOutCallback(t),this}setCoverTransitInCallback(t){return this.coverTransitInCallback=t,this}setCoverTransitOutCallback(t){return this.coverTransitOutCallback=t,this}};const Zs={popUp:0,fadeIn:1,scaleDown:0,fadeOut:1};var Qs=function(t){return t&&"function"==typeof t},tr={modal(t,e){return Qs(t)&&(e=t,t=void 0),void 0===this._modalBehavior&&(this.onCreateModalBehavior&&this.onCreateModalBehavior(this,t),this._modalBehavior=function(t,e){var i=new Ks(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}},er=function(t,e,i,s,r){Qs(e)&&(r=s,s=i,i=e,e=this);var n=this.scene.events;return this.bindEvent(e,n,t,i,s,r),this},ir={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 er.call(this,"preupdate",t,e,i,s),this},bindSceneUpdateEvent(t,e,i,s){return er.call(this,"update",t,e,i,s),this},bindScenePostupdateEvent(t,e,i,s){return er.call(this,"postupdate",t,e,i,s),this},bindSceneRenderEvent(t,e,i,s){return er.call(this,"render",t,e,i,s),this},bindScenePauseEvent(t,e,i,s){return er.call(this,"pause",t,e,i,s),this},bindSceneResumeEvent(t,e,i,s){return er.call(this,"resume",t,e,i,s),this},bindSceneSleepEvent(t,e,i,s){return er.call(this,"sleep",t,e,i,s),this},bindSceneWakeEvent(t,e,i,s){return er.call(this,"wake",t,e,i,s),this},bindSceneShutdownEvent(t,e,i,s){return er.call(this,"shutdown",t,e,i,s),this}},sr=function(t,e,i){var s=t.camera;return s?(void 0===i?i={}:!0===i&&(i=rr),s===e?(i.x=t.worldX,i.y=t.worldY):s.getWorldPoint(t.x,t.y,i),i):null},rr={},nr=function(t,e,i,s){var r,n=t.scene.sys.cameras.main,h=0===t.scrollFactorX&&0===t.scrollFactorY;if(e)return h?Js(t,e.x,e.y,i,s):!!(r=sr(e,n,!0))&&Js(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 fr={press:0,pointerdown:0,release:1,pointerup:1};var mr={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 gr(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}},yr=function(t,e,i,s,r){if(e)return!(i&&!i(t,e)||!xr(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 br.length=0,!0;return br.length=0,!1},br=[];const Cr=Phaser.Utils.Objects.GetValue;class wr extends Qe{constructor(t,e){super(t,e),this._enable=void 0;var i=Cr(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(Cr(t,"enable",!0)),this.setMode(Cr(t,"mode",1)),this.setClickInterval(Cr(t,"clickInterval",100)),this.setDragThreshold(Cr(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=Sr[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?yr:nr)(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 Sr={press:0,pointerdown:0,release:1,pointerup:1};var Pr={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 Or extends _s{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 Tr extends Qe{constructor(t,e){super(t,e),this._enable=void 0,this.cooldown=new Or,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 _r={isPointerInBounds(t){return void 0===t?t=this:"string"==typeof t&&(t=this.getElement(t)),!!t&&nr(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 Tr(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 Tr(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}},Er={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,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=Nr,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===Ur&&this.onDragEnd(),this.pointer=void 0,this.tracerState=Nr,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=$r,this}isPointerInGameObject(t,e,i){var s=this.lastPointer;return!!s&&nr(t,s,e,i)}}const Nr=0,Ur=1,$r="IDLE",Jr=Phaser.Utils.Objects.GetValue,qr=Phaser.Math.Distance.Between;class Kr extends Vr{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=Zr},eventEmitter:!1};this.setRecongizedStateObject(new _s(s))}resetFromJSON(t){super.resetFromJSON(t),this.setHoldTime(Jr(t,"time",250)),this.setTapInterval(Jr(t,"tapInterval",200)),this.setDragThreshold(Jr(t,"threshold",9)),this.setTapOffset(Jr(t,"tapOffset",10));var e=Jr(t,"taps",void 0);return void 0!==e?this.setTaps(e):(this.setMaxTaps(Jr(t,"maxTaps",void 0)),this.setMinTaps(Jr(t,"minTaps",void 0))),this}onDragStart(){switch(this.state){case Zr:this.state=Qr;break;case Qr:var t=this.lastPointer;qr(t.upX,t.upY,t.x,t.y)>this.tapOffset&&(this.state=tn,this.state=Qr);break;case tn:this.state=Qr}}onDragEnd(){this.state===Qr&&(this.tapsCount++,this.emit("tapping",this,this.gameObject,this.lastPointer),void 0!==this.maxTaps&&this.tapsCount===this.maxTaps&&(this.state=tn))}onDrag(){this.state!==Zr&&this.pointer.getDistance()>this.dragThreshold&&(this.state=Zr)}preUpdate(t,e){if(this.isRunning&&this.enable&&this.state===Qr){var i=this.lastPointer;i.isDown?t-i.downTime>this.holdTime&&(this.state=Zr):t-i.upTime>this.tapInterval&&(void 0===this.minTaps||this.tapsCount>=this.minTaps?this.state=tn:this.state=Zr)}}postUpdate(t,e){this.isRunning&&this.enable&&this.state===tn&&(this.state=Zr)}get isTapped(){return this.state===tn}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 Zr="IDLE",Qr="BEGIN",tn="RECOGNIZED",en=Phaser.Utils.Objects.GetValue;class sn extends Vr{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=rn},eventEmitter:!1};this.setRecongizedStateObject(new _s(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(en(t,"threshold",9)),this.setHoldTime(en(t,"time",251)),this}onDragStart(){this.state=nn,0===this.holdTime&&(this.state=hn)}onDragEnd(){this.state=rn}onDrag(){this.state!==rn&&this.pointer.getDistance()>this.dragThreshold&&(this.state=rn)}preUpdate(t,e){this.isRunning&&this.enable&&this.state===nn&&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 rn="IDLE",nn="BEGIN",hn="RECOGNIZED";Phaser.Utils.Objects.GetValue;var an=function(t){return Ke(t).loop.delta};const on=Phaser.Math.Distance.Between,ln=Phaser.Math.Angle.Between;var dn={getDt:function(){return an(this.scene)},getVelocity:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return on(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 ln(e.x,e.y,t.x,t.y)}},cn={"up&down":0,"left&right":1,"4dir":2,"8dir":3},un={};const pn=Phaser.Utils.Objects.GetValue,vn=Phaser.Math.RadToDeg;class gn extends Vr{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=fn},eventEmitter:!1};this.setRecongizedStateObject(new _s(s)),this.clearDirectionStates()}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(pn(t,"threshold",10)),this.setVelocityThreshold(pn(t,"velocityThreshold",1e3)),this.setDirectionMode(pn(t,"dir","8dir")),this}onDragStart(){this.state=mn}onDragEnd(){this.state=fn}onDrag(){this.state===mn&&(this.validDrag||(this.validDrag=0===this.dragThreshold||this.pointer.getDistance()>=this.dragThreshold),this.validDrag&&this.dragVelocity>this.velocityThreshold&&(this.state=yn))}postUpdate(t,e){this.isRunning&&this.enable&&this.state===yn&&(this.state=fn)}get isSwiped(){return this.state===yn}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=un),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}}(vn(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,dn);const fn="IDLE",mn="BEGIN",yn="RECOGNIZED",xn=Phaser.Utils.Objects.GetValue,bn=Phaser.Utils.Array.SpliceOne,Cn=Phaser.Math.Distance.Between,wn=Phaser.Math.Angle.Between;class Sn{constructor(t,e){var i=$e(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(xn(e,"inputConfig",void 0)),this.setEventEmitter(xn(e,"eventEmitter",void 0)),this._enable=void 0,this.pointers=[],this.movedState={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setEnable(xn(t,"enable",!0)),this.bounds=xn(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=kn,this.onDrag1Start();break;case kn: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],bn(this.pointers,e),this.tracerState){case kn:this.tracerState=On,this.onDrag1End();break;case Tn: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 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 Cn(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 wn(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;Pn.x=e.x-i.x,Pn.y=e.y-i.y}else Pn.x=0,Pn.y=0;return Pn}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=_n,this}isPointer0InGameObject(t,e,i){var s=this.pointers[0];return!!s&&nr(t,s,e,i)}isPointer1InGameObject(t,e,i){var s=this.pointers[1];return!!s&&nr(t,s,e,i)}}Object.assign(Sn.prototype,Ve);var Pn={};const On=0,kn=1,Tn=2,_n="IDLE";Phaser.Utils.Objects.GetValue;const En=Phaser.Math.RotateAround;var Mn=function(t,e,i,s){return En(t,e,i,s),t.rotation+=s,t},Rn={};const Ln=Phaser.Utils.Objects.GetValue,Dn=Phaser.Math.Angle.WrapDegrees,An=Phaser.Math.Angle.ShortestBetween,zn=Phaser.Math.RadToDeg,Yn=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=Rn),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=Dn(zn(this.angleBetween));this.angle=An(this.prevAngle,t),this.prevAngle=t,this.state=Fn}break;case Fn:t=Dn(zn(this.angleBetween)),this.angle=An(this.prevAngle,t),this.prevAngle=t,this.emit("rotate",this)}}get isRotated(){return this.state===Fn}get rotation(){return Yn(this.angle)}setDragThreshold(t){return this.dragThreshold=t,this}}.prototype,Wn);const Xn="IDLE",jn="BEGIN",Fn="RECOGNIZED",In=Phaser.Utils.Objects.GetValue;var Bn=function(t){var e=In(t,"tap",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._tap=new Kr(this,e),this._tap.on("tap",(function(t,e,s){Rr(i.eventEmitter,`${i.eventNamePrefix}${t.tapsCount}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Hn=Phaser.Utils.Objects.GetValue;var Gn=function(t){var e=Hn(t,"press",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._press=new sn(this,e),this._press.on("pressstart",(function(t,e,s){Rr(i.eventEmitter,`${i.eventNamePrefix}pressstart`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this).on("pressend",(function(t,e,s){Rr(i.eventEmitter,`${i.eventNamePrefix}pressend`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Vn=Phaser.Utils.Objects.GetValue;var Nn=function(t){var e=Vn(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";Rr(i.eventEmitter,`${i.eventNamePrefix}swipe${r}`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Un=Phaser.Utils.Objects.GetValue;var $n=function(t,e){return t.setInteractive(),Un(e,"dropZone",!1)&&(t.input.dropZone=!0),t._childrenInteractive={targetSizers:Un(e,"targets",[t]),targetMode:Un(e,"targetMode","parent"),eventEmitter:Un(e,"eventEmitter",t),eventNamePrefix:Un(e,"inputEventPrefix","child.")},Dr.call(t,e),Yr.call(t,e),jr.call(t,e),Hr.call(t,e),Bn.call(t,e),Gn.call(t,e),Nn.call(t,e),t},Jn={getSizerConfig:function(t){return void 0===t&&(t=this),Et(t)},getChildPrevState:function(t){var e=Et(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=ae(e,"color"),s=ae(e,"lineWidth");var o=ae(e,"name",!1);o&&(r=ae(o,"createTextCallback",le),n=ae(o,"createTextCallbackScope",void 0),"string"==typeof(h=ae(o,"align","left-top"))&&(h=zt[h]))}if(void 0===i&&(i=16777215),void 0===s&&(s=1),r&&!t.children){t.children=new oe(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)}}for(var d,c,u=this.getAllShownChildren([this]),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 rh=Phaser.Utils.Objects.IsPlainObject,nh=Phaser.Utils.Objects.GetValue,hh=Phaser.Display.Align.CENTER,ah={min:0,full:-1};var oh=function(t,e,i,s,r,n,h,a,o,l){ve.call(this,t);var d=t.isRexSpace,c=typeof e;if(null===e)return this;if("number"===c);else if("string"===c)e=ah[e];else if(rh(e)){var u;e=nh(u=e,"proportion",void 0),i=nh(u,"align",hh),s=nh(u,"padding",0),r=nh(u,"expand",!1),n=nh(u,"key",void 0),h=nh(u,"index",void 0),t.isRexSizer||(a=nh(u,"minWidth",void 0),o=nh(u,"minHeight",void 0)),l=nh(u,"fitRatio",0)}return"string"==typeof i&&(i=zt[i]),void 0===e&&(e=d?1:0),void 0===i&&(i=hh),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===a&&(d?a=0:t.isRexSizer||(a=t._minWidth)),void 0===o&&(d?o=0:t.isRexSizer||(o=t._minHeight)),void 0===l||!1===l?l=0:!0===l&&(l=Q(t)/tt(t)),(u=this.getSizerConfig(t)).proportion=e,u.align=i,u.padding=ue(s),u.expand=r,u.fitRatio=0===e?l:0,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},lh={add:oh,addSpace(t){return this.insertSpace(void 0,t),this},insertSpace(t,e){return void 0===e&&(e=1),oh.call(this,new ih(this.scene),{proportion:e,minWidth:0,minHeight:0,index:t}),this},insert(t,e,i,s,r,n,h,a){return rh(i)&&(i.index=t),oh.call(this,e,i,s,r,n,h,t,a),this},insertAtPosition(t,e,i,s,r,n,h,a,o){var l=sh.call(this,t,e);return-1===l&&(l=void 0),this.insert(l,i,s,r,n,h,a,o),this}};const dh=_t.prototype.clear;var ch=function(t){this.backgroundChildren&&(this.backgroundChildren.length=0);var e,i=!t&&this.sizerEventsEnable;if(i&&(e=this.getChildren([])),dh.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}},vh={getChildAlign(t){return this.getSizerConfig(t).align},setChildAlign(t,e){return"string"==typeof e&&(e=zt[e]),this.getSizerConfig(t).align=e,this}},gh={getChildProportion(t){return this.getSizerConfig(t).proportion},setChildProportion(t,e){return this.getSizerConfig(t).proportion=e,this}},fh={getChildExpand(t){return this.getSizerConfig(t).expand},setChildExpand(t,e){return this.getSizerConfig(t).expand=e,this}},mh={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}},yh={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&&(Ie(t,0,0),e.resolved=!1,this.hasRatioFitChild=!0);return this._childrenProportion=void 0,this.hasProportion0Child=!1,this.proportionLength=void 0,Xe.call(this),this},layoutChildren:function(){for(var t,e,i,s,r,n,h,a,o,l,d=this.sizerChildren,c=this.innerLeft,u=this.innerTop,p=this.innerWidth,v=this.innerHeight,g=c,f=u,m=this.startChildIndex,y=0,x=d.length;y0?(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)||Le.call(this)},runWidthWrap:function(t){this.wrapResult||(1===this.orientation&&th.call(this,t,void 0),De.call(this,t))},hasHeightWrap:function(){return!(!this.hasRatioFitChild||0!==this.orientation)||ze.call(this)},runHeightWrap:function(t){this.wrapResult||(0===this.orientation&&th.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],h=n&&n.isRexSpace;return"center"===t?h||this.insertSpace(r+1):h&&this.remove(n,!0),this}};Object.assign(yh,lh,ph,vh,gh,fh,mh);var xh=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},bh={x:0,h:0,horizontal:0,"left-to-right":0,y:1,v:1,vertical:1,"top-to-bottom":1},Ch=function(t){return"string"==typeof t&&(t=bh[t]),t};const wh=Phaser.Utils.Objects.IsPlainObject,Sh=Phaser.Utils.Objects.GetValue;class Ph extends Kn{constructor(t,e,i,s,r,n,h){wh(e)?(e=Sh(h=e,"x",0),i=Sh(h,"y",0),s=Sh(h,"width",void 0),r=Sh(h,"height",void 0),n=Sh(h,"orientation",0)):wh(s)?(s=Sh(h=s,"width",void 0),r=Sh(h,"height",void 0),n=Sh(h,"orientation",0)):wh(n)&&(n=Sh(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(Sh(h,"space.item",0)),this.setStartChildIndex(Sh(h,"startChildIndex",0)),this.setRTL(Sh(h,"rtl",!1)),this.addChildrenMap("items",this.sizerChildren)}setOrientation(t){return this.orientation=Ch(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=xh.call(this)),this._childrenProportion}}Object.assign(Ph.prototype,yh);var Oh=Phaser.Renderer.WebGL.Utils,kh=function(t,e,i,s,r,n){for(var h=Oh.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+")"},Rh=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 Lh=Phaser.Renderer.Canvas.SetTransform;var Dh={renderWebGL:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.pipelines.set(e.pipeline),n=Eh(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&&_h(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(Lh(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(zh.prototype,Dh);const Yh=Phaser.Utils.Objects.GetValue;let Wh=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=Yh(t,"x",0),i=Yh(t,"y",0));var s=this.cornerRadius;s.tl=Xh(Yh(t,"tl",void 0),e,i),s.tr=Xh(Yh(t,"tr",void 0),e,i),s.bl=Xh(Yh(t,"bl",void 0),e,i),s.br=Xh(Yh(t,"br",void 0),e,i)}get radiusTL(){var t=this.cornerRadius.tl;return Math.max(t.x,t.y)}set radiusTL(t){jh(this.cornerRadius.tl,t)}get radiusTR(){var t=this.cornerRadius.tr;return Math.max(t.x,t.y)}set radiusTR(t){jh(this.cornerRadius.tr,t)}get radiusBL(){var t=this.cornerRadius.bl;return Math.max(t.x,t.y)}set radiusBL(t){jh(this.cornerRadius.bl,t)}get radiusBR(){var t=this.cornerRadius.br;return Math.max(t.x,t.y)}set radiusBR(t){jh(this.cornerRadius.br,t)}};var Xh=function(t,e,i){return void 0===t?t={x:e,y:i}:"number"==typeof t&&(t={x:t,y:t}),Fh(t),t},jh=function(t,e){"number"==typeof e?(t.x=e,t.y=e):(t.x=Yh(e,"x",0),t.y=Yh(e,"y",0)),Fh(t)},Fh=function(t){t.convex=t.x>=0||t.y>=0,t.x=Math.abs(t.x),t.y=Math.abs(t.y)},Ih=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 Bh=Phaser.Math.DegToRad;var Hh=function(t,e,i,s,r,n,h,a,o){h&&n>r?n-=360:!h&&n0&&t.y>0};const Jh={rectangle:0,circle:1},qh=Phaser.Renderer.WebGL.Utils;var Kh={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=qh.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 Zh=Phaser.Display.Color;var Qh={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 Zh);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}},ta=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)},ea={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,ta(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 ia=Phaser.Display.Canvas.CanvasPool,sa=Phaser.GameObjects.GameObject,ra=Phaser.Utils.String.UUID;let na=class extends sa{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=ia.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=ra(),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(){ia.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 ha=Phaser.GameObjects.Components;Phaser.Class.mixin(na,[ha.Alpha,ha.BlendMode,ha.Crop,ha.Depth,ha.Flip,ha.GetBounds,ha.Mask,ha.Origin,ha.Pipeline,ha.PostPipeline,ha.ScrollFactor,ha.Tint,ha.Transform,ha.Visible,Kh,Qh,ea]);var aa={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:Ss(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&>(this.data),this}};class oa{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(oa.prototype,aa);var la={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 da=Phaser.Math.RotateAround;var ca;const ua=Phaser.Geom.Rectangle;var pa,va=function(t){void 0===pa&&(pa=new ua);var e=t.drawTLX,i=t.drawTLY;return pa.setTo(e,i,t.drawTRX-e,t.drawBLY-i),pa};const ga=Phaser.Math.RotateAround;var fa,ma=function(t,e,i,s){return void 0===s?s={}:!0===s&&(void 0===fa&&(fa={}),s=fa),s.x=e,s.y=i,0!==t.rotation&&ga(s,0,0,t.rotation),s.x=s.x*t.scaleX+t.drawX,s.y=s.y*t.scaleY+t.drawY,s};const ya=Phaser.GameObjects.Components.TransformMatrix;var xa,ba,Ca={},wa=function(t,e,i,s,r){var n=ma(e,i,s,!0),h=function(t,e,i,s){void 0===s?s={}:!0===s&&(s=Ca);var r=e-t.width*t.originX,n=i-t.height*t.originY;return void 0===xa&&(xa=new ya,ba=new ya),t.parentContainer?t.getWorldTransformMatrix(xa,ba):xa.applyITRS(t.x,t.y,t.rotation,t.scaleX,t.scaleY),xa.transformPoint(r,n,s),s}(t,n.x,n.y,r);return h},Sa=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 wa(t,e,n,h,r)},Pa={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===ca&&(ca={}),s=ca),s.x=(t-i.drawX)/i.scaleX,s.y=(e-i.drawY)/i.scaleY,0!==i.rotation&&da(s,0,0,-i.rotation),s}(t,e,this,!0);return va(this).contains(i.x,i.y)},getWorldPosition:function(t,e,i){return Sa(this.parent,this,t,e,i)}};Object.assign(Pa,la);const Oa=Phaser.Math.DegToRad,ka=Phaser.Math.RadToDeg,Ta=Phaser.Utils.Objects.GetValue;class _a extends oa{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 ka(this._rotation)}set angle(t){this.rotation=Oa(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=Ta(t,"width",void 0),i=Ta(t,"height",void 0),s=Ta(t,"scaleX",void 0),r=Ta(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(_a.prototype,Pa);const Ea=Phaser.Utils.String.Pad;var Ma=function(t,e,i){if(null==t)return t;switch(typeof t){case"string":default:return t;case"number":return`#${Ea(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}},Ra=function(t,e,i){return e.hasOwnProperty(t)?e[t]:i[t]};const La=Phaser.Math.DegToRad;var Da=function(t){return!t.hasOwnProperty("convex")||t.convex},Aa=function(t){return t.x>0&&t.y>0},za=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,Aa(a)?(o=a.x*g,l=a.y*f,Da(a)?za(t,o,l,o,l,180,270,!1,h):za(t,0,0,o,l,90,0,!0,h),d=0,c=l):(t.lineTo(0,0),d=0,c=0),a=m.tr,Aa(a)?(o=a.x*g,l=a.y*f,Da(a)?za(t,s-o,l,o,l,270,360,!1,h):za(t,s,0,o,l,180,90,!0,h)):t.lineTo(s,0),a=m.br,Aa(a)?(o=a.x*g,l=a.y*f,Da(a)?za(t,s-o,r-l,o,l,0,90,!1,h):za(t,s,r,o,l,270,180,!0,h)):t.lineTo(s,r),a=m.bl,Aa(a)?(o=a.x*g,l=a.y*f,Da(a)?za(t,o,r-l,o,l,90,180,!1,h):za(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())},Wa=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),Ya(t.canvas,t.context,d,d,o,l,r,e,i,s,n,h,a)}};const Xa=Phaser.Utils.Objects.GetValue;class ja extends _a{constructor(t,e){super(t,"background"),this.setScrollFactor(0),this.setColor(Xa(e,"color",null),Xa(e,"color2",null),Xa(e,"horizontalGradient",!0)),this.setStroke(Xa(e,"stroke",null),Xa(e,"strokeThickness",2)),this.setCornerRadius(Xa(e,"cornerRadius",0),Xa(e,"cornerIteration",null))}set color(t){t=Ma(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=Ma(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=Ma(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,Ra("color2",t,this),Ra("horizontalGradient",t,this)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,Ra("strokeThickness",t,this)),t.hasOwnProperty("cornerRadius")&&this.setCornerRadius(t.cornerRadius,Ra("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(){Wa(this.parent,this.color,this.stroke,this.strokeThickness,this.cornerRadius,this.color2,this.horizontalGradient,this.cornerIteration)}}const Fa=Phaser.Utils.Objects.GetValue;class Ia extends _a{constructor(t,e){super(t,"innerbounds"),this.setScrollFactor(0),this.setColor(Fa(e,"color",null),Fa(e,"color2",null),Fa(e,"horizontalGradient",!0)),this.setStroke(Fa(e,"stroke",null),Fa(e,"strokeThickness",2))}set color(t){t=Ma(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=Ma(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=Ma(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,Fa(t,"color2",null),Fa(t,"horizontalGradient",!0)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,Fa(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 Ba=Phaser.Utils.Objects.GetValue;let Ha=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(Ba(t,"bold",!1)),this.setItalic(Ba(t,"italic",!1)),this.setFontSize(Ba(t,"fontSize","16px")),this.setFontFamily(Ba(t,"fontFamily","Courier")),this.setColor(Ba(t,"color","#fff")),this.setStrokeStyle(Ba(t,"stroke",null),Ba(t,"strokeThickness",0)),this.setShadow(Ba(t,"shadowColor",null),Ba(t,"shadowOffsetX",0),Ba(t,"shadowOffsetY",0),Ba(t,"shadowBlur",0)),this.setOffset(Ba(t,"offsetX",0),Ba(t,"offsetY",0)),this.setSpace(Ba(t,"leftSpace",0),Ba(t,"rightSpace",0)),this.setAlign(Ba(t,"align",void 0)),this.setBackgroundColor(Ba(t,"backgroundColor",null)),this.setBackgroundHeight(Ba(t,"backgroundHeight",void 0)),this.setBackgroundBottomY(Ba(t,"backgroundBottomY",void 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(Ra("stroke",t,this),Ra("strokeThickness",t,this)),t.hasOwnProperty("shadowColor")&&this.setShadowColor(t.shadowColor),(t.hasOwnProperty("shadowOffsetX")||t.hasOwnProperty("shadowOffsetY"))&&this.setShadowOffset(Ra("shadowOffsetX",t,this),Ra("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),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=Ma(t),this}get hasFill(){return null!=this.color}setStrokeStyle(t,e){return this.stroke=Ma(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=Ma(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=Ma(t),this}get hasBackgroundColor(){return null!=this.backgroundColor}setBackgroundHeight(t){return this.backgroundHeight=t,this}setBackgroundBottomY(t){return this.backgroundBottomY=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 Ga=Phaser.Utils.Array.Remove,Va=Phaser.Utils.Array.Remove,Na="text",Ua="image",$a="drawer",Ja="space",qa="command";var Ka=function(t){return t.type===Na&&"\n"===t.text},Za=function(t){return t.type===Na&&"\f"===t.text},Qa=function(t){return t.type===Na};class to extends _a{constructor(t,e,i){super(t,Na),this.updateTextFlag=!1,this.style=new Ha(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,s=this.drawTRX-i+1,r=e.backgroundBottomY;null==r&&(r=this.drawBLY);var n=e.backgroundHeight;null==n&&(n=r-this.drawTLY);var h=r-n;t.fillRect(i,h,s,n)}var a=e.hasFill,o=e.hasStroke;(a||o)&&(e.syncFont(t).syncStyle(t),o&&(e.syncShadow(t),t.strokeText(this.text,0,0)),a&&(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 eo=function(t,e){var i=this.createCharChildren(t,e);return this.addChild(i),this};const io=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=io.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),io.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 ro extends _a{constructor(t,e,i){super(t,Ua),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 no extends _a{constructor(t,e,i,s){super(t,$a),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 ho extends _a{constructor(t,e){super(t,Ja),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 ao extends oa{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 oo(t){if(null===t||"object"!=typeof t)return t;if(Array.isArray(t))return t.map((t=>oo(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]=oo(t[i]));return e}var lo=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 uo=/^[\x00-\x7F]+$/,po=function(t){return uo.test(t)},vo=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=yo.call(this)).height,h=l.ascent,i=Math.floor((o-h)/n))}else{var l;n=(l=yo.call(this)).height,h=l.ascent}}else this.fixedHeight>0?void 0===(i=bo(t,"maxLines"))&&(o=this.fixedHeight-s,i=Math.floor(o/n)):i=bo(t,"maxLines",0);void 0===h&&(h=n);var d=0===i,c=bo(t,"wrapMode");void 0===c&&(c=bo(t,"charWrap",!1)?"char":"word"),"string"==typeof c&&(c=co[c]);var u=bo(t,"wrapWidth",void 0);void 0===u&&(this.fixedWidth>0?u=this.fixedWidth-r:(u=1/0,c=0));for(var p=bo(t,"letterSpacing",0),v=bo(t,"hAlign",0),g=bo(t,"vAlign",0),f=bo(t,"justifyPercentage",.25),m=lo({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=So(t,"maxLines",void 0))){var h=this.fixedWidth-r;i=Math.floor(h/n)+1}}else i=So(t,"maxLines",0);var a=0===i,o=So(t,"fixedCharacterHeight",void 0);if(void 0===o){var l=So(t,"charPerLine",void 0);if(void 0!==l){var d=this.fixedHeight-s;o=Math.floor(d/l)}}var c=So(t,"wrapHeight",void 0);void 0===c&&(c=this.fixedHeight>0?this.fixedHeight-s:1/0);for(var u=So(t,"letterSpacing",0),p=So(t,"rtl",!0),v=So(t,"hAlign",p?2:0),g=So(t,"vAlign",0),f=lo({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 W=this.fixedWidth>0?this.fixedWidth:f.linesWidth+r,X=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 Ee(i,t,e),this.dirty=this.dirty||s!=i.left||r!=i.right||n!=i.top||h!=i.bottom,this},getPadding:function(t){return _e(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),Ga(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 Va(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(Na);return null===i?i=new to(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)),Sa(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 $o=Phaser.Utils.Objects.GetFastValue;var Jo={};class qo{constructor(t){this.pools=$o(t,"pools",Jo)}free(t){if(!this.pools)return this;var e=t.type;return this.pools.hasOwnProperty(e)||(this.pools[e]=new Uo),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)):(xl(this),bl(this)),this}setNumberInput(){return this.onUpdateCallback=yl,this}setSelectAllWhenFocusEnable(t){return void 0===t&&(t=!0),this.selectAllWhenFocus=t,this}setRequestCursorPosition(t){return this.isOpened?(this.requestCursorPosition=t,this):this}}const Sl=Phaser.Utils.Objects.GetValue,Pl=["inputType","onOpen","clickOutSideTarget","onFocus","onClose","onBlur","onUpdate","enterClose","readOnly","maxLength","minLength","selectAll"];var Ol=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}Wl.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(Xl(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 jl=new Wl,Fl=/^[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,Il=/\S/,Bl=new Wl;Bl.equals=function(t,e){return this.options.ignoreCase&&(t=t.toLowerCase(),e=e.toLowerCase()),t===e||this.options.ignoreWhitespace&&!Il.test(t)&&!Il.test(e)},Bl.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(Nl(t,null,null,i),i," ")},Vl.equals=function(t,e){return Wl.prototype.equals.call(Vl,t.replace(/,([\r\n])/g,"$1"),e.replace(/,([\r\n])/g,"$1"))};const Ul=new Wl;Ul.tokenize=function(t){return t.slice()},Ul.join=Ul.removeEmpty=function(t){return t};const $l=Phaser.Utils.Array.Remove;var Jl=function(t,e){var i=t.text;if(e!==i){if(null==i&&(i=""),$l(t.children,t.lastInsertCursor),""===e)t.removeChildren();else for(var s=(o=i,l=e,jl.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},td={cursorMoveLeft(){if(!this.isOpened)return this;var t=Kl(this.cursorPosition-1,0,this.inputText.length);return this.setCursorPosition(t),this},cursorMoveRight(){if(!this.isOpened)return this;var t=Kl(this.cursorPosition+1,0,this.inputText.length);return this.setCursorPosition(t),this},cursorMoveUp(){if(!this.isOpened)return this;var t=Zl(this.characterCountOfLines,this.cursorPosition);t.lineIndex-=1;var e=Kl(Ql(this.characterCountOfLines,t),0,this.inputText.length);return this.setCursorPosition(e),this},cursorMoveDown(){if(!this.isOpened)return this;var t=Zl(this.characterCountOfLines,this.cursorPosition);t.lineIndex+=1;var e=Kl(Ql(this.characterCountOfLines,t),0,this.inputText.length);return this.setCursorPosition(e),this}};const ed=Phaser.Utils.Objects.IsPlainObject;class id extends Qo{constructor(t,e,i,s,r,n){ed(e)?n=e:ed(s)&&(n=s),void 0===n&&(n={}),function(t,e){var i=!e.textArea;if(Ol(e,"wrap.vAlign")||Tl(e,"wrap.vAlign",s=i?"center":"top"),Ol(e,"wrap.wrapMode")||Tl(e,"wrap.wrapMode","char"),Ol(e,"wrap.maxLines")||Tl(e,"wrap.maxLines",s=i?1:void 0),i&&Tl(e,"wrap.wrapWidth",1/0),Ol(e,"wrap.useDefaultTextHeight")||Tl(e,"wrap.useDefaultTextHeight",!0),e.edit||(e.edit={}),!Ol(e.edit,"inputType")){var s=i?"text":"textarea";Tl(e.edit,"inputType",s)}if(!0===e.clickOutSideTarget){var r=new El(t);t.add.existing(r),e.clickOutSideTarget=r}}(t,n);var h=n.text;h&&delete n.text;var a=Ml(n.background,"focus"),o=Ml(n.style,"cursor");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=Sl(e,"edit");return void 0===i&&(i={}),il(e,i,Pl),new wl(t,i)}(this,n),Rl.call(this),n.focusStyle&&Object.assign(a,n.focusStyle),Yl.call(this,a),n.cursorStyle&&Object.assign(o,n.cursorStyle),zl.call(this,o);var l=n.onAddChar;l&&this.on("addchar",l);var d=n.onCursorOut;d&&this.on("cursorout",d);var c=n.onCursorIn;c&&this.on("cursorin",c);var u,p=n.onMoveCursor;p&&this.on("movecursor",p),this.setParseTextCallback(n.parseTextCallback),this.lastInsertCursor=((u=this.createCharChild("|")).text="",u),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)),(d=this.getSizerConfig(t)).align=i,d.padding=ue(s),Od(r)?(d.expandWidth=kd(r,"width",!1),d.expandHeight=kd(r,"height",!1)):(d.expandWidth=r,d.expandHeight=r),t.isRexSizer||(d.expandWidth&&(t.minWidth=void 0===n?Q(t):n),d.expandHeight&&(t.minHeight=void 0===h?tt(t):h)),d.alignOffsetX=a,d.alignOffsetY=o,d.aspectRatio=l,this.sizerChildren.hasOwnProperty(e)&&this.sizerChildren[e].destroy(),this.sizerChildren[e]=t,c&&this.addChildrenMap(e,t),this}},Md={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]),Ce.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}},Rd={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=this.innerLeft,c=this.innerTop,u=this.innerWidth,p=this.innerHeight,v=this.sizerChildren;for(var g in v)(t=v[g]).rexSizer.hidden||(i=(e=t.rexSizer).padding,dr.call(this,t),a=this.getExpandedChildWidth(t),o=this.getExpandedChildHeight(t),e.aspectRatio>0&&(Sd.width=e.aspectRatio,Sd.height=1,Pd.width=a,Pd.height=o,a=(l=bd(Sd,Pd,"FIT",!0)).width,o=l.height),t.isRexSizer?(t.runLayout(this,a,o),Zn(t,this)):Ie(t,a,o),s=d+i.left*this.scaleX,n=u-(i.left+i.right)*this.scaleX,r=c+i.top*this.scaleY,h=p-(i.top+i.bottom)*this.scaleY,cr.call(this,t,s,r,n,h,e.align,e.alignOffsetX,e.alignOffsetY))}};Object.assign(Rd,Ed,Md);const Ld=Phaser.Utils.Objects.IsPlainObject,Dd=Phaser.Utils.Objects.GetValue;class Ad extends Kn{constructor(t,e,i,s,r,n){Ld(e)?(e=Dd(n=e,"x",0),i=Dd(n,"y",0),s=Dd(n,"width",void 0),r=Dd(n,"height",void 0)):Ld(s)&&(s=Dd(n=s,"width",void 0),r=Dd(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(Ad.prototype,Rd);var zd={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 Yd extends na{}Object.assign(Yd.prototype,zd);const Wd=Phaser.Display.Color,Xd=Phaser.Math.Percent,jd=Phaser.Display.Color,Fd=Phaser.Math.Percent,Id=Phaser.Display.Color.ColorToRGBA,Bd=Phaser.Display.Color.HSVToRGB;class Hd extends Yd{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 jd,this.setOrientation(n),this.setSize(s,r)}setOrientation(t){return this.orientation=Ch(t),this}updateTexture(){return function(t,e,i){void 0===i&&(i=!1);var s=t.width,r=t.height,n=new Wd;if(i)for(var h=0;h0&&r.push(o.join("")),r},Cc=0,wc=1,Sc=2,Pc=0,Oc=1,kc=2,Tc=/(?:\r\n|\r|\n)/;const _c={none:Pc,word:Oc,char:kc,character:kc,mix:3};var Ec=function(t,e){return void 0===e&&(e=0),t._minWidth=e,t.runWidthWrap=function(t){return t instanceof Qo}(t)?function(t){return function(e){return t.setFixedSize(e,0).runWordWrap(),t.minHeight=t.height,t}}(t):mc(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 gc(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 Mc=65535;var Rc=function(t,e,i){if(null==e)return t;if(0===e)return Ac(t,0,i),t;var s=t.text.length;if(0===s)return Ac(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=Dc(t,r,e,i,n),a=0;a<=Mc&&0!==h;a++){if((r+=h)<0){r=0;break}h=Dc(t,r,e,i,n)}return a===Mc&&console.warn("FontSizeFit: Test count exceeds 65535"),t.setFontSize(r),Ac(t,e,i),t},Lc=function(t,e,i){return void 0===i[e]&&(t.setFontSize(e),i[e]={width:t.width,height:t.height}),i[e]},Dc=function(t,e,i,s,r){var n,h=Lc(t,e,r),a=Lc(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)},Ac=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 zc=Phaser.Utils.Objects.GetValue,Yc=Phaser.Utils.Objects.GetValue;class Wc extends oc{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexLabel";var i,s=Yc(e,"background",void 0),r=Yc(e,"icon",void 0),n=Yc(e,"iconMask",void 0),h=Yc(e,"text",void 0),a=Yc(e,"action",void 0),o=Yc(e,"actionMask",void 0),l=Yc(e,"align",void 0);if(s&&this.addBackground(s),r){0===this.orientation?(h||a)&&(i={right:Yc(e,"space.icon",0),top:Yc(e,"space.iconTop",0),bottom:Yc(e,"space.iconBottom",0),left:Yc(e,"space.iconLeft",0)}):(h||a)&&(i={bottom:Yc(e,"space.icon",0),left:Yc(e,"space.iconLeft",0),right:Yc(e,"space.iconRight",0),top:Yc(e,"space.iconTop",0)});var d=Yc(e,"squareFitIcon",!1)?1:0;if(this.add(r,{proportion:0,padding:i,fitRatio:d}),n&&(n=pc.call(this,r,r,1)),!d){var c=Yc(e,"iconSize",void 0);this.setIconSize(Yc(e,"iconWidth",c),Yc(e,"iconHeight",c))}}if(h){var u=Yc(e,"wrapText",!1),p=Yc(e,"adjustTextFontSize",!1);u?(!0===u&&(u="word"),function(t,e){switch(yc(t)){case 0:switch("string"==typeof e&&(e=_c[e]||0),t.style.wrapMode=e,e){case 2:case 3:t.style.wordWrapCallback=xc;break;default:t.style.wordWrapCallback=null}break;case 1:"string"==typeof e&&(e=_c[e]||0),t.style.wrapMode=e}}(h,u),e.expandTextWidth=!0,Ec(h)):p&&(e.expandTextWidth=!0,e.expandTextHeight=!0,function(t,e){"number"==typeof e&&(e={minWidth:e});var i=zc(e,"minWidth",0),s=zc(e,"minHeight",0),r=zc(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 Rc(t,e,i),t}):(t.runWidthWrap=function(e){return t.setFixedSize&&t.setFixedSize(0,0),Rc(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=Yc(e,"space.text",0),m=Yc(e,"expandTextWidth",!1),y=Yc(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:Yc(e,"space.actionTop",0),bottom:Yc(e,"space.actionBottom",0),right:Yc(e,"space.actionRight",0)}:{left:Yc(e,"space.actionLeft",0),right:Yc(e,"space.actionRight",0),bottom:Yc(e,"space.actionBottom",0)},d=Yc(e,"squareFitAction",!1)?1:0,this.add(a,{proportion:0,padding:i,fitRatio:d}),o&&(o=pc.call(this,a,a,1)),!d)){var x=Yc(e,"actionSize");this.setActionSize(Yc(e,"actionWidth",x),Yc(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 Xc=Phaser.Utils.Objects.GetValue;class jc extends Qe{constructor(t,e){super(t,e),this.style=Xc(e,"style",this);var i=Xc(e,"propertiesMap");this.activeStyle=Fc(e,"active",i),this.hoverStyle=Fc(e,"hover",i),this.disableStyle=Fc(e,"disable",i),this.onModifyStyle=Xc(e,"onModifyStyle")}getStyle(t){return Dl(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 Al(e,t)?void 0:(this.modifyStyle(t),e)}}setActiveState(t){return Ic.call(this,"active",t),this}setHoverState(t){return Ic.call(this,"hover",t),this}setDisableState(t){return Ic.call(this,"disable",t),this}}var Fc=function(t,e,i){var s=Ml(t,e);if(i)for(var r in s)i.hasOwnProperty(r)&&(s[i[r]]=s[r],delete s[r]);return s},Ic=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))},Bc={addStyleManager(t){return this.styleManager=new jc(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 Hc extends Uh{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexStatesRoundRectangleShape",e.style=this,e.propertiesMap=Gc,this.addStyleManager(e),delete e.style,delete e.propertiesMap}}const Gc={color:"fillColor",alpha:"fillAlpha",strokeWidth:"lineWidth"};Object.assign(Hc.prototype,Bc);const Vc=Phaser.GameObjects.GetCalcMatrix,Nc=Phaser.Renderer.Canvas.SetTransform;var Uc={renderWebGL:function(t,e,i,s){e.updateData(),i.addToRenderList(e);var r=t.pipelines.set(e.pipeline),n=Vc(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};const Ru=Phaser.Utils.Objects.GetValue,Lu=Phaser.Utils.Objects.IsPlainObject;class Du extends(ru(qc)){constructor(t,e,i,s,r,n,h,a){Lu(e)?(e=Ru(a=e,"x",0),i=Ru(a,"y",0),s=Ru(a,"width",2),r=Ru(a,"height",2),n=Ru(a,"barColor",void 0),h=Ru(a,"value",0)):Lu(s)?(s=Ru(a=s,"width",2),r=Ru(a,"height",2),n=Ru(a,"barColor",void 0),h=Ru(a,"value",0)):Lu(n)&&(n=Ru(a=n,"barColor",void 0),h=Ru(a,"value",0)),super(t,e,i,s,r,a),this.type="rexLineProgress",this.bootProgressBase(a),this.addShape((new Eu).setName("trackFill")).addShape((new Eu).setName("bar")).addShape((new Eu).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&&Mu(s,0,0,e,i,t).close();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),Mu(h,r,0,n,i,t).close());var a=this.getShape("trackStroke");a.lineStyle(this.trackStrokeThickness,this.trackStrokeColor),a.isStroked&&Mu(a,0,0,e,i,t).end()}};Object.assign(Du.prototype,Au);class zu extends Du{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"),Tl(e,"easeValue.duration",e.easeDuration),Tl(e,"easeValue.ease",e.ease),super(t,e),this.type="rexStatesBarRectangleShape",this.barState=!1,e.style=this,e.propertiesMap=Yu,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 Yu={color:"trackColor",strokeColor:"trackStrokeColor",strokeWidth:"trackStrokeThickness"};Object.assign(zu.prototype,Bc);var Wu=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},Xu=function(t){return t.preFX?t.preFX:t.postFX?t.postFX:null},ju=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=oo(i),s=oo(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 P=typeof(m=this.getFrameNameCallback(o,C,e));"string"!==P&&"number"!==P||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 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={},Ke(t).events.once("destroy",(function(){for(var t in ap)ap[t].destroy();ap=void 0}))),!ap.hasOwnProperty(e)){var i=Ke(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 Qe{constructor(t,e){return super(t),new Proxy(this,this)}get(t,e){if(Wu(t,e))return t[e];var i=t.parent;return Wu(i,e)?i[e]:void 0}set(t,e,i){return Wu(t,e)?t[e]=i:Wu(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&&Bu(this,i),this.style=new up(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign(vp.prototype,Bc);const gp=["alpha","tint","flipX","flipY"];var fp=function(t,e){if(!e)return t;for(var i=0,s=gp.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=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},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}},z=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}},X=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}},Oe=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,Te=Phaser.Utils.Objects.GetValue;var _e=function(t,e){return void 0===e?t:t[e]},Ee=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=Te(e,"left",0),t.right=Te(e,"right",0),t.top=Te(e,"top",0),t.bottom=Te(e,"bottom",0)),t},Me={getInnerPadding(t){return _e(this.space,t)},setInnerPadding(t,e){return Ee(this.space,t,e),this},getOuterPadding(t){return _e(this.getSizerConfig(this).padding,t)},setOuterPadding(t,e){return Ee(this.getSizerConfig(this).padding,t,e),this},getChildOuterPadding(t,e){return"string"==typeof t&&(t=this.getElement(t)),_e(this.getSizerConfig(t).padding,e)},setChildOuterPadding(t,e,i){return"string"==typeof t&&(t=this.getElement(t)),Ee(this.getSizerConfig(t).padding,e,i),this}},Re=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}},Le=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},De=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}},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},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},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}},Xe=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?vi:pi,this.repeatCounter=0,this}stop(){return this.state=ui,this}update(t,e){this.state!==ui&&this.state!==fi&&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=gi)):(this.nowTime=this.duration,this.state=fi):this.nowTime>=0&&(this.state=vi))}get t(){var t;switch(this.state){case ui:case pi:case gi:t=0;break;case vi:t=this.nowTime/this.duration;break;case fi:t=1}return di(t,0,1)}set t(t){(t=di(t,-1,1))<0?(this.state=pi,this.nowTime=-this.delay*t):(this.state=vi,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===ui}get isDelay(){return this.state===pi}get isCountDown(){return this.state===vi}get isRunning(){return this.state===pi||this.state===vi}get isDone(){return this.state===fi}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}}const ui=0,pi=1,vi=2,gi=3,fi=-1;class mi extends ai{constructor(t,e){super(t,e),this.timer=new ci}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 yi=Phaser.Utils.Objects.GetValue,xi=Phaser.Utils.Objects.GetAdvancedValue,bi=Phaser.Tweens.Builders.GetEaseFunction;class Ci extends mi{resetFromJSON(t){return this.timer.resetFromJSON(yi(t,"timer")),this.setEnable(yi(t,"enable",!0)),this.setTarget(yi(t,"target",this.parent)),this.setDelay(xi(t,"delay",0)),this.setDuration(xi(t,"duration",1e3)),this.setEase(yi(t,"ease","Linear")),this.setRepeat(yi(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=bi(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,Si=Phaser.Utils.Objects.GetAdvancedValue,Pi=Phaser.Math.Linear;let Oi=class extends Ci{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(Si(t,"start",void 0),Si(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=Si(t,"x",this.parent.scaleX),this.startY=Si(t,"y",this.parent.scaleY)),"number"==typeof e?(this.endX=e,this.endY=e):(this.endX=Si(e,"x",void 0),this.endY=Si(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=Pi(this.startX,this.endX,i)),this.hasScaleY&&(t.scaleY=Pi(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 Ti=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 Oi(t,a):r.resetFromJSON(a),r.restart(),r},_i=function(t,e,i,s,r,n){void 0===s&&(s="Linear"),r instanceof Oi&&(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 Oi(t,h):n.resetFromJSON(h),n.restart(),n},Ei=function(t,e){return new Promise((function(i,s){t.once(e,(function(){i()}))}))},Mi=function(t){return Ei(t,"complete")};const Ri=Phaser.Utils.Objects.IsPlainObject;var Li={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(Ri(t)){var s=t;t=s.duration,e=s.orientation,i=s.ease}var r=void 0===this._scaleBehavior;return this._scaleBehavior=Ti(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(Ri(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=_i(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(Ri(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 Oi(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),Mi(this._scaleBehavior)},isRunningScaleYoyo(){return this._scaleBehavior&&(this._scaleBehavior.completeEventName="scaleyoyo.complete")},isRunningEaseScale(){return this.isRunningPopUp()||this.isRunningScaleDown()||this.isRunningScaleYoyo()}},Di={};Object.assign(Di,Li),Di.onInitScale=function(){Li.onInitScale.call(this);var t=this;this._scaleBehavior.on("update",(function(){var e=me.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const Ai=Phaser.Utils.Objects.GetValue,zi=Phaser.Utils.Objects.GetAdvancedValue,Yi=Phaser.Math.Linear;class Wi extends Ci{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(zi(t,"start",this.parent.alpha),zi(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=Xi[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 Xi={stop:0,destroy:1,yoyo:2},ji=Phaser.Utils.Objects.IsPlainObject;var Fi=function(t,e,i,s){var r,n;ji(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},Ii=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 Bi=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(Bi(t)){var i=t;t=i.duration,e=i.alpha}var s=void 0===this._fade;return this._fade=Fi(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(Bi(t)){var i=t;t=i.duration,e=i.destroy}var s=void 0===this._fade;return this._fade=Ii(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()}},Gi={};Object.assign(Gi,Hi),Gi.onInitFade=function(){Hi.onInitFade.call(this);var t=this;this._fade.on("update",(function(){var e=me.getParentSizer(t);e&&e.resetChildAlphaState(t)}))};const Vi=Phaser.Utils.Objects.GetValue,Ni=Phaser.Utils.Objects.GetAdvancedValue,Ui=Phaser.Math.Linear;class $i extends Ci{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){if(super.resetFromJSON(t),this.setMode(Vi(t,"mode",0)),t&&(t.hasOwnProperty("x")||t.hasOwnProperty("y"))){var e=Ni(t,"x",void 0),i=Ni(t,"y",void 0);this.setTargetPosition(e,i)}else this.setTargetPosition(t);return this}setMode(t){return"string"==typeof t&&(t=Ji[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=Ni(i,"startX",void 0),this.startY=Ni(i,"startY",void 0),this.endX=Ni(i,"endX",void 0),this.endY=Ni(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=Ui(this.startX,this.endX,i)),this.hasMoveY&&(t.y=Ui(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Ji={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 Ki=Phaser.Utils.Objects.IsPlainObject,Zi=Phaser.Math.Distance.Between;var Qi={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(Ki(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*Zi(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 $i&&(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 $i(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),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(Ki(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*Zi(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 $i&&(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 $i(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),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}},ts={};Object.assign(ts,Qi),ts.onInitEaseMove=function(){Qi.onInitEaseMove.call(this);var t=this;this._easeMove.on("update",(function(){var e=me.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const es=Phaser.Utils.Objects.GetValue;class is extends ri{constructor(t,e){super(t,e),this.timer=new ci,this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.timer.resetFromJSON(es(t,"timer")),this.setEnable(es(t,"enable",!0)),this.setMode(es(t,"mode",1)),this.isRunning=es(t,"isRunning",!1),this.setMagnitudeMode(es(t,"magnitudeMode",1)),this.setAxisMode(es(t,"axis",0)),this.setDuration(es(t,"duration",500)),this.setMagnitude(es(t,"magnitude",10)),this.ox=es(t,"ox",void 0),this.oy=es(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=ss[t]),this.mode=t,this}setMagnitudeMode(t){return"string"==typeof t&&(t=ns[t]),this.magnitudeMode=t,this}setAxisMode(t){return"string"==typeof t&&(t=rs[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=es(i,"magnitude",void 0),t=es(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 ss={effect:0,behavior:1},rs={both:0,"h&v":0,"x&y":0,horizontal:1,h:1,x:1,vertical:2,v:2,y:2},ns={constant:0,decay:1},hs=Phaser.Utils.Objects.IsPlainObject;var as={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 is(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 os=Phaser.Utils.Objects.GetValue,ls=Phaser.Math.Linear;class ds extends Ci{constructor(t,e){super(t,e),this.resetFromJSON(),this.boot()}start(t){if(this.timer.isRunning)return this;var e=this.target;this.propertyKey=os(t,"key","value");var i=e[this.propertyKey];return this.fromValue=os(t,"from",i),this.toValue=os(t,"to",i),this.setEase(os(t,"ease",this.ease)),this.setDuration(os(t,"duration",this.duration)),this.setRepeat(os(t,"repeat",0)),this.setDelay(os(t,"delay",0)),this.setRepeatDelay(os(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]=ls(this.fromValue,this.toValue,i)}}const cs=Phaser.Utils.Objects.IsPlainObject;class us extends Qe{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 ds(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(cs(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(cs(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 ps={easeDataTo(t,e,i,s){return this._easeData||(this._easeData=new us(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),Ei(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}},vs=Phaser.Utils.Array.Remove,gs={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=$e(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}},Rs={setTransitInTime(t){return this.transitInTime=t,this},setTransitOutTime(t){return this.transitOutTime=t,this},setTransitInCallback(t){return t||(t=Yt),this.transitInCallback=t,this},setTransitOutCallback(t){return t||(t=Yt),this.transitOutCallback=t,this}},Ls={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}},Ds={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,Ms,Rs,Ls,Ds);const zs=Phaser.Utils.Objects.GetValue;class Ys extends Qe{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 Es(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(Ys.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 Xs extends Qe{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 js=Phaser.GameObjects.Rectangle;let Fs=class extends js{constructor(t,e,i){super(t,0,0,2,2,e,1),this.fullWindow=new Xs(this),this.setAlpha(i)}get tint(){return this.fillColor}set tint(t){this.setFillStyle(t,this.fillAlpha)}};const Is=Phaser.Utils.Objects.GetValue;class Bs extends Qe{constructor(t,e){super(t,{eventEmitter:!1}),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setHitAreaMode(Is(t,"hitAreaMode",0)),this.setEnable(Is(t,"enable",!0)),this.setStopMode(Is(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 Gs=Phaser.Utils.Objects.GetValue;class Vs extends Fs{constructor(t,e){super(t,Gs(e,"color",0),Gs(e,"alpha",.8)),this.touchEventStop=new Bs(this,{hitAreaMode:1})}}var Ns={popUp(t,e){void 0!==t._modalScaleSave?(t.scaleX=t._modalScaleSave,t.scaleY=t._modalScaleSave):t._modalScaleSave=t.scaleX,Ti(t,e)},scaleDown(t,e){_i(t,e,void 0,void 0,!1)},fadeIn(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Fi(t,e)},fadeOut(t,e){Ii(t,e,!1)}},Us=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Fi(t,e,t.alpha)},$s=function(t,e){Ii(t,e,!1)},Js=function(t,e,i,s,r){return!(!t||s&&!s(t,e,i)||!rt(t,!0).contains(e,i)||r&&!r(t,e,i))};const qs=Phaser.Utils.Objects.GetValue;let Ks=class extends Ys{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=Zs.popUp),null==e.transitOut&&(e.transitOut=Zs.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 Vs(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",Us)),this.setCoverTransitOutCallback(qs(i,"transitOut",$s)));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&&Js(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=Zs[t]),t){case Zs.popUp:t=Ns.popUp;break;case Zs.fadeIn:t=Ns.fadeIn}return super.setTransitInCallback(t),this}setTransitOutCallback(t){switch("string"==typeof t&&(t=Zs[t]),t){case Zs.scaleDown:t=Ns.scaleDown;break;case Zs.fadeOut:t=Ns.fadeOut}return super.setTransitOutCallback(t),this}setCoverTransitInCallback(t){return this.coverTransitInCallback=t,this}setCoverTransitOutCallback(t){return this.coverTransitOutCallback=t,this}};const Zs={popUp:0,fadeIn:1,scaleDown:0,fadeOut:1};var Qs=function(t){return t&&"function"==typeof t},tr={modal(t,e){return Qs(t)&&(e=t,t=void 0),void 0===this._modalBehavior&&(this.onCreateModalBehavior&&this.onCreateModalBehavior(this,t),this._modalBehavior=function(t,e){var i=new Ks(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}},er=function(t,e,i,s,r){Qs(e)&&(r=s,s=i,i=e,e=this);var n=this.scene.events;return this.bindEvent(e,n,t,i,s,r),this},ir={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 er.call(this,"preupdate",t,e,i,s),this},bindSceneUpdateEvent(t,e,i,s){return er.call(this,"update",t,e,i,s),this},bindScenePostupdateEvent(t,e,i,s){return er.call(this,"postupdate",t,e,i,s),this},bindSceneRenderEvent(t,e,i,s){return er.call(this,"render",t,e,i,s),this},bindScenePauseEvent(t,e,i,s){return er.call(this,"pause",t,e,i,s),this},bindSceneResumeEvent(t,e,i,s){return er.call(this,"resume",t,e,i,s),this},bindSceneSleepEvent(t,e,i,s){return er.call(this,"sleep",t,e,i,s),this},bindSceneWakeEvent(t,e,i,s){return er.call(this,"wake",t,e,i,s),this},bindSceneShutdownEvent(t,e,i,s){return er.call(this,"shutdown",t,e,i,s),this}},sr=function(t,e,i){var s=t.camera;return s?(void 0===i?i={}:!0===i&&(i=rr),s===e?(i.x=t.worldX,i.y=t.worldY):s.getWorldPoint(t.x,t.y,i),i):null},rr={},nr=function(t,e,i,s){var r,n=t.scene.sys.cameras.main,h=0===t.scrollFactorX&&0===t.scrollFactorY;if(e)return h?Js(t,e.x,e.y,i,s):!!(r=sr(e,n,!0))&&Js(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 fr={press:0,pointerdown:0,release:1,pointerup:1};var mr={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 gr(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}},yr=function(t,e,i,s,r){if(e)return!(i&&!i(t,e)||!xr(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 br.length=0,!0;return br.length=0,!1},br=[];const Cr=Phaser.Utils.Objects.GetValue;class wr extends Qe{constructor(t,e){super(t,e),this._enable=void 0;var i=Cr(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(Cr(t,"enable",!0)),this.setMode(Cr(t,"mode",1)),this.setClickInterval(Cr(t,"clickInterval",100)),this.setDragThreshold(Cr(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=Sr[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?yr:nr)(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 Sr={press:0,pointerdown:0,release:1,pointerup:1};var Pr={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 Or extends _s{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 Tr extends Qe{constructor(t,e){super(t,e),this._enable=void 0,this.cooldown=new Or,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 _r={isPointerInBounds(t){return void 0===t?t=this:"string"==typeof t&&(t=this.getElement(t)),!!t&&nr(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 Tr(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 Tr(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}},Er={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,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=Nr,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===Ur&&this.onDragEnd(),this.pointer=void 0,this.tracerState=Nr,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=$r,this}isPointerInGameObject(t,e,i){var s=this.lastPointer;return!!s&&nr(t,s,e,i)}}const Nr=0,Ur=1,$r="IDLE",Jr=Phaser.Utils.Objects.GetValue,qr=Phaser.Math.Distance.Between;class Kr extends Vr{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=Zr},eventEmitter:!1};this.setRecongizedStateObject(new _s(s))}resetFromJSON(t){super.resetFromJSON(t),this.setHoldTime(Jr(t,"time",250)),this.setTapInterval(Jr(t,"tapInterval",200)),this.setDragThreshold(Jr(t,"threshold",9)),this.setTapOffset(Jr(t,"tapOffset",10));var e=Jr(t,"taps",void 0);return void 0!==e?this.setTaps(e):(this.setMaxTaps(Jr(t,"maxTaps",void 0)),this.setMinTaps(Jr(t,"minTaps",void 0))),this}onDragStart(){switch(this.state){case Zr:this.state=Qr;break;case Qr:var t=this.lastPointer;qr(t.upX,t.upY,t.x,t.y)>this.tapOffset&&(this.state=tn,this.state=Qr);break;case tn:this.state=Qr}}onDragEnd(){this.state===Qr&&(this.tapsCount++,this.emit("tapping",this,this.gameObject,this.lastPointer),void 0!==this.maxTaps&&this.tapsCount===this.maxTaps&&(this.state=tn))}onDrag(){this.state!==Zr&&this.pointer.getDistance()>this.dragThreshold&&(this.state=Zr)}preUpdate(t,e){if(this.isRunning&&this.enable&&this.state===Qr){var i=this.lastPointer;i.isDown?t-i.downTime>this.holdTime&&(this.state=Zr):t-i.upTime>this.tapInterval&&(void 0===this.minTaps||this.tapsCount>=this.minTaps?this.state=tn:this.state=Zr)}}postUpdate(t,e){this.isRunning&&this.enable&&this.state===tn&&(this.state=Zr)}get isTapped(){return this.state===tn}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 Zr="IDLE",Qr="BEGIN",tn="RECOGNIZED",en=Phaser.Utils.Objects.GetValue;class sn extends Vr{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=rn},eventEmitter:!1};this.setRecongizedStateObject(new _s(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(en(t,"threshold",9)),this.setHoldTime(en(t,"time",251)),this}onDragStart(){this.state=nn,0===this.holdTime&&(this.state=hn)}onDragEnd(){this.state=rn}onDrag(){this.state!==rn&&this.pointer.getDistance()>this.dragThreshold&&(this.state=rn)}preUpdate(t,e){this.isRunning&&this.enable&&this.state===nn&&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 rn="IDLE",nn="BEGIN",hn="RECOGNIZED";Phaser.Utils.Objects.GetValue;var an=function(t){return Ke(t).loop.delta};const on=Phaser.Math.Distance.Between,ln=Phaser.Math.Angle.Between;var dn={getDt:function(){return an(this.scene)},getVelocity:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return on(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 ln(e.x,e.y,t.x,t.y)}},cn={"up&down":0,"left&right":1,"4dir":2,"8dir":3},un={};const pn=Phaser.Utils.Objects.GetValue,vn=Phaser.Math.RadToDeg;class gn extends Vr{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=fn},eventEmitter:!1};this.setRecongizedStateObject(new _s(s)),this.clearDirectionStates()}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(pn(t,"threshold",10)),this.setVelocityThreshold(pn(t,"velocityThreshold",1e3)),this.setDirectionMode(pn(t,"dir","8dir")),this}onDragStart(){this.state=mn}onDragEnd(){this.state=fn}onDrag(){this.state===mn&&(this.validDrag||(this.validDrag=0===this.dragThreshold||this.pointer.getDistance()>=this.dragThreshold),this.validDrag&&this.dragVelocity>this.velocityThreshold&&(this.state=yn))}postUpdate(t,e){this.isRunning&&this.enable&&this.state===yn&&(this.state=fn)}get isSwiped(){return this.state===yn}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=un),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}}(vn(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,dn);const fn="IDLE",mn="BEGIN",yn="RECOGNIZED",xn=Phaser.Utils.Objects.GetValue,bn=Phaser.Utils.Array.SpliceOne,Cn=Phaser.Math.Distance.Between,wn=Phaser.Math.Angle.Between;class Sn{constructor(t,e){var i=$e(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(xn(e,"inputConfig",void 0)),this.setEventEmitter(xn(e,"eventEmitter",void 0)),this._enable=void 0,this.pointers=[],this.movedState={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setEnable(xn(t,"enable",!0)),this.bounds=xn(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=kn,this.onDrag1Start();break;case kn: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],bn(this.pointers,e),this.tracerState){case kn:this.tracerState=On,this.onDrag1End();break;case Tn: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 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 Cn(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 wn(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;Pn.x=e.x-i.x,Pn.y=e.y-i.y}else Pn.x=0,Pn.y=0;return Pn}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=_n,this}isPointer0InGameObject(t,e,i){var s=this.pointers[0];return!!s&&nr(t,s,e,i)}isPointer1InGameObject(t,e,i){var s=this.pointers[1];return!!s&&nr(t,s,e,i)}}Object.assign(Sn.prototype,Ve);var Pn={};const On=0,kn=1,Tn=2,_n="IDLE";Phaser.Utils.Objects.GetValue;const En=Phaser.Math.RotateAround;var Mn=function(t,e,i,s){return En(t,e,i,s),t.rotation+=s,t},Rn={};const Ln=Phaser.Utils.Objects.GetValue,Dn=Phaser.Math.Angle.WrapDegrees,An=Phaser.Math.Angle.ShortestBetween,zn=Phaser.Math.RadToDeg,Yn=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=Rn),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=Dn(zn(this.angleBetween));this.angle=An(this.prevAngle,t),this.prevAngle=t,this.state=Fn}break;case Fn:t=Dn(zn(this.angleBetween)),this.angle=An(this.prevAngle,t),this.prevAngle=t,this.emit("rotate",this)}}get isRotated(){return this.state===Fn}get rotation(){return Yn(this.angle)}setDragThreshold(t){return this.dragThreshold=t,this}}.prototype,Wn);const Xn="IDLE",jn="BEGIN",Fn="RECOGNIZED",In=Phaser.Utils.Objects.GetValue;var Bn=function(t){var e=In(t,"tap",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._tap=new Kr(this,e),this._tap.on("tap",(function(t,e,s){Rr(i.eventEmitter,`${i.eventNamePrefix}${t.tapsCount}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Hn=Phaser.Utils.Objects.GetValue;var Gn=function(t){var e=Hn(t,"press",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._press=new sn(this,e),this._press.on("pressstart",(function(t,e,s){Rr(i.eventEmitter,`${i.eventNamePrefix}pressstart`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this).on("pressend",(function(t,e,s){Rr(i.eventEmitter,`${i.eventNamePrefix}pressend`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Vn=Phaser.Utils.Objects.GetValue;var Nn=function(t){var e=Vn(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";Rr(i.eventEmitter,`${i.eventNamePrefix}swipe${r}`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Un=Phaser.Utils.Objects.GetValue;var $n=function(t,e){return t.setInteractive(),Un(e,"dropZone",!1)&&(t.input.dropZone=!0),t._childrenInteractive={targetSizers:Un(e,"targets",[t]),targetMode:Un(e,"targetMode","parent"),eventEmitter:Un(e,"eventEmitter",t),eventNamePrefix:Un(e,"inputEventPrefix","child.")},Dr.call(t,e),Yr.call(t,e),jr.call(t,e),Hr.call(t,e),Bn.call(t,e),Gn.call(t,e),Nn.call(t,e),t},Jn={getSizerConfig:function(t){return void 0===t&&(t=this),Et(t)},getChildPrevState:function(t){var e=Et(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=ae(e,"color"),s=ae(e,"lineWidth");var o=ae(e,"name",!1);o&&(r=ae(o,"createTextCallback",le),n=ae(o,"createTextCallbackScope",void 0),"string"==typeof(h=ae(o,"align","left-top"))&&(h=zt[h]))}if(void 0===i&&(i=16777215),void 0===s&&(s=1),r&&!t.children){t.children=new oe(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)}}for(var d,c,u=this.getAllShownChildren([this]),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 rh=Phaser.Utils.Objects.IsPlainObject,nh=Phaser.Utils.Objects.GetValue,hh=Phaser.Display.Align.CENTER,ah={min:0,full:-1};var oh=function(t,e,i,s,r,n,h,a,o,l){ve.call(this,t);var d=t.isRexSpace,c=typeof e;if(null===e)return this;if("number"===c);else if("string"===c)e=ah[e];else if(rh(e)){var u;e=nh(u=e,"proportion",void 0),i=nh(u,"align",hh),s=nh(u,"padding",0),r=nh(u,"expand",!1),n=nh(u,"key",void 0),h=nh(u,"index",void 0),t.isRexSizer||(a=nh(u,"minWidth",void 0),o=nh(u,"minHeight",void 0)),l=nh(u,"fitRatio",0)}return"string"==typeof i&&(i=zt[i]),void 0===e&&(e=d?1:0),void 0===i&&(i=hh),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===a&&(d?a=0:t.isRexSizer||(a=t._minWidth)),void 0===o&&(d?o=0:t.isRexSizer||(o=t._minHeight)),void 0===l||!1===l?l=0:!0===l&&(l=Q(t)/tt(t)),(u=this.getSizerConfig(t)).proportion=e,u.align=i,u.padding=ue(s),u.expand=r,u.fitRatio=0===e?l:0,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},lh={add:oh,addSpace(t){return this.insertSpace(void 0,t),this},insertSpace(t,e){return void 0===e&&(e=1),oh.call(this,new ih(this.scene),{proportion:e,minWidth:0,minHeight:0,index:t}),this},insert(t,e,i,s,r,n,h,a){return rh(i)&&(i.index=t),oh.call(this,e,i,s,r,n,h,t,a),this},insertAtPosition(t,e,i,s,r,n,h,a,o){var l=sh.call(this,t,e);return-1===l&&(l=void 0),this.insert(l,i,s,r,n,h,a,o),this}};const dh=_t.prototype.clear;var ch=function(t){this.backgroundChildren&&(this.backgroundChildren.length=0);var e,i=!t&&this.sizerEventsEnable;if(i&&(e=this.getChildren([])),dh.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}},vh={getChildAlign(t){return this.getSizerConfig(t).align},setChildAlign(t,e){return"string"==typeof e&&(e=zt[e]),this.getSizerConfig(t).align=e,this}},gh={getChildProportion(t){return this.getSizerConfig(t).proportion},setChildProportion(t,e){return this.getSizerConfig(t).proportion=e,this}},fh={getChildExpand(t){return this.getSizerConfig(t).expand},setChildExpand(t,e){return this.getSizerConfig(t).expand=e,this}},mh={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}},yh={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&&(Ie(t,0,0),e.resolved=!1,this.hasRatioFitChild=!0);return this._childrenProportion=void 0,this.hasProportion0Child=!1,this.proportionLength=void 0,Xe.call(this),this},layoutChildren:function(){for(var t,e,i,s,r,n,h,a,o,l,d=this.sizerChildren,c=this.innerLeft,u=this.innerTop,p=this.innerWidth,v=this.innerHeight,g=c,f=u,m=this.startChildIndex,y=0,x=d.length;y0?(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)||Le.call(this)},runWidthWrap:function(t){this.wrapResult||(1===this.orientation&&th.call(this,t,void 0),De.call(this,t))},hasHeightWrap:function(){return!(!this.hasRatioFitChild||0!==this.orientation)||ze.call(this)},runHeightWrap:function(t){this.wrapResult||(0===this.orientation&&th.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],h=n&&n.isRexSpace;return"center"===t?h||this.insertSpace(r+1):h&&this.remove(n,!0),this}};Object.assign(yh,lh,ph,vh,gh,fh,mh);var xh=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},bh={x:0,h:0,horizontal:0,"left-to-right":0,y:1,v:1,vertical:1,"top-to-bottom":1},Ch=function(t){return"string"==typeof t&&(t=bh[t]),t};const wh=Phaser.Utils.Objects.IsPlainObject,Sh=Phaser.Utils.Objects.GetValue;class Ph extends Kn{constructor(t,e,i,s,r,n,h){wh(e)?(e=Sh(h=e,"x",0),i=Sh(h,"y",0),s=Sh(h,"width",void 0),r=Sh(h,"height",void 0),n=Sh(h,"orientation",0)):wh(s)?(s=Sh(h=s,"width",void 0),r=Sh(h,"height",void 0),n=Sh(h,"orientation",0)):wh(n)&&(n=Sh(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(Sh(h,"space.item",0)),this.setStartChildIndex(Sh(h,"startChildIndex",0)),this.setRTL(Sh(h,"rtl",!1)),this.addChildrenMap("items",this.sizerChildren)}setOrientation(t){return this.orientation=Ch(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=xh.call(this)),this._childrenProportion}}Object.assign(Ph.prototype,yh);var Oh=Phaser.Renderer.WebGL.Utils,kh=function(t,e,i,s,r,n){for(var h=Oh.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+")"},Rh=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 Lh=Phaser.Renderer.Canvas.SetTransform;var Dh={renderWebGL:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.pipelines.set(e.pipeline),n=Eh(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&&_h(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(Lh(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(zh.prototype,Dh);const Yh=Phaser.Utils.Objects.GetValue;let Wh=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=Yh(t,"x",0),i=Yh(t,"y",0));var s=this.cornerRadius;s.tl=Xh(Yh(t,"tl",void 0),e,i),s.tr=Xh(Yh(t,"tr",void 0),e,i),s.bl=Xh(Yh(t,"bl",void 0),e,i),s.br=Xh(Yh(t,"br",void 0),e,i)}get radiusTL(){var t=this.cornerRadius.tl;return Math.max(t.x,t.y)}set radiusTL(t){jh(this.cornerRadius.tl,t)}get radiusTR(){var t=this.cornerRadius.tr;return Math.max(t.x,t.y)}set radiusTR(t){jh(this.cornerRadius.tr,t)}get radiusBL(){var t=this.cornerRadius.bl;return Math.max(t.x,t.y)}set radiusBL(t){jh(this.cornerRadius.bl,t)}get radiusBR(){var t=this.cornerRadius.br;return Math.max(t.x,t.y)}set radiusBR(t){jh(this.cornerRadius.br,t)}};var Xh=function(t,e,i){return void 0===t?t={x:e,y:i}:"number"==typeof t&&(t={x:t,y:t}),Fh(t),t},jh=function(t,e){"number"==typeof e?(t.x=e,t.y=e):(t.x=Yh(e,"x",0),t.y=Yh(e,"y",0)),Fh(t)},Fh=function(t){t.convex=t.x>=0||t.y>=0,t.x=Math.abs(t.x),t.y=Math.abs(t.y)},Ih=function(t){return t.x>0&&t.y>0},Bh=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 Hh=Phaser.Math.DegToRad;var Gh=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(_a.prototype,Pa);const Ea=Phaser.Utils.String.Pad;var Ma=function(t,e,i){if(null==t)return t;switch(typeof t){case"string":default:return t;case"number":return`#${Ea(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}},Ra=function(t,e,i){return e.hasOwnProperty(t)?e[t]:i[t]};const La=Phaser.Math.DegToRad;var Da=function(t){return!t.hasOwnProperty("convex")||t.convex},Aa=function(t){return t.x>0&&t.y>0},za=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,Aa(a)?(o=a.x*g,l=a.y*f,Da(a)?za(t,o,l,o,l,180,270,!1,h):za(t,0,0,o,l,90,0,!0,h),d=0,c=l):(t.lineTo(0,0),d=0,c=0),a=m.tr,Aa(a)?(o=a.x*g,l=a.y*f,Da(a)?za(t,s-o,l,o,l,270,360,!1,h):za(t,s,0,o,l,180,90,!0,h)):t.lineTo(s,0),a=m.br,Aa(a)?(o=a.x*g,l=a.y*f,Da(a)?za(t,s-o,r-l,o,l,0,90,!1,h):za(t,s,r,o,l,270,180,!0,h)):t.lineTo(s,r),a=m.bl,Aa(a)?(o=a.x*g,l=a.y*f,Da(a)?za(t,o,r-l,o,l,90,180,!1,h):za(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())},Wa=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),Ya(t.canvas,t.context,d,d,o,l,r,e,i,s,n,h,a)}};const Xa=Phaser.Utils.Objects.GetValue;class ja extends _a{constructor(t,e){super(t,"background"),this.setScrollFactor(0),this.setColor(Xa(e,"color",null),Xa(e,"color2",null),Xa(e,"horizontalGradient",!0)),this.setStroke(Xa(e,"stroke",null),Xa(e,"strokeThickness",2)),this.setCornerRadius(Xa(e,"cornerRadius",0),Xa(e,"cornerIteration",null))}set color(t){t=Ma(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=Ma(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=Ma(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,Ra("color2",t,this),Ra("horizontalGradient",t,this)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,Ra("strokeThickness",t,this)),t.hasOwnProperty("cornerRadius")&&this.setCornerRadius(t.cornerRadius,Ra("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(){Wa(this.parent,this.color,this.stroke,this.strokeThickness,this.cornerRadius,this.color2,this.horizontalGradient,this.cornerIteration)}}const Fa=Phaser.Utils.Objects.GetValue;class Ia extends _a{constructor(t,e){super(t,"innerbounds"),this.setScrollFactor(0),this.setColor(Fa(e,"color",null),Fa(e,"color2",null),Fa(e,"horizontalGradient",!0)),this.setStroke(Fa(e,"stroke",null),Fa(e,"strokeThickness",2))}set color(t){t=Ma(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=Ma(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=Ma(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,Fa(t,"color2",null),Fa(t,"horizontalGradient",!0)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,Fa(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 Ba=Phaser.Utils.Objects.GetValue;let Ha=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(Ba(t,"bold",!1)),this.setItalic(Ba(t,"italic",!1)),this.setFontSize(Ba(t,"fontSize","16px")),this.setFontFamily(Ba(t,"fontFamily","Courier")),this.setColor(Ba(t,"color","#fff")),this.setStrokeStyle(Ba(t,"stroke",null),Ba(t,"strokeThickness",0)),this.setShadow(Ba(t,"shadowColor",null),Ba(t,"shadowOffsetX",0),Ba(t,"shadowOffsetY",0),Ba(t,"shadowBlur",0)),this.setOffset(Ba(t,"offsetX",0),Ba(t,"offsetY",0)),this.setSpace(Ba(t,"leftSpace",0),Ba(t,"rightSpace",0)),this.setAlign(Ba(t,"align",void 0)),this.setBackgroundColor(Ba(t,"backgroundColor",null)),this.setBackgroundHeight(Ba(t,"backgroundHeight",void 0)),this.setBackgroundBottomY(Ba(t,"backgroundBottomY",void 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(Ra("stroke",t,this),Ra("strokeThickness",t,this)),t.hasOwnProperty("shadowColor")&&this.setShadowColor(t.shadowColor),(t.hasOwnProperty("shadowOffsetX")||t.hasOwnProperty("shadowOffsetY"))&&this.setShadowOffset(Ra("shadowOffsetX",t,this),Ra("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),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=Ma(t),this}get hasFill(){return null!=this.color}setStrokeStyle(t,e){return this.stroke=Ma(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=Ma(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=Ma(t),this}get hasBackgroundColor(){return null!=this.backgroundColor}setBackgroundHeight(t){return this.backgroundHeight=t,this}setBackgroundBottomY(t){return this.backgroundBottomY=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 Ga=Phaser.Utils.Array.Remove,Va=Phaser.Utils.Array.Remove,Na="text",Ua="image",$a="drawer",Ja="space",qa="command";var Ka=function(t){return t.type===Na&&"\n"===t.text},Za=function(t){return t.type===Na&&"\f"===t.text},Qa=function(t){return t.type===Na};class to extends _a{constructor(t,e,i){super(t,Na),this.updateTextFlag=!1,this.style=new Ha(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,s=this.drawTRX-i+1,r=e.backgroundBottomY;null==r&&(r=this.drawBLY);var n=e.backgroundHeight;null==n&&(n=r-this.drawTLY);var h=r-n;t.fillRect(i,h,s,n)}var a=e.hasFill,o=e.hasStroke;(a||o)&&(e.syncFont(t).syncStyle(t),o&&(e.syncShadow(t),t.strokeText(this.text,0,0)),a&&(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 eo=function(t,e){var i=this.createCharChildren(t,e);return this.addChild(i),this};const io=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=io.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),io.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 ro extends _a{constructor(t,e,i){super(t,Ua),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 no extends _a{constructor(t,e,i,s){super(t,$a),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 ho extends _a{constructor(t,e){super(t,Ja),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 ao extends oa{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 oo(t){if(null===t||"object"!=typeof t)return t;if(Array.isArray(t))return t.map((t=>oo(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]=oo(t[i]));return e}var lo=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 uo=/^[\x00-\x7F]+$/,po=function(t){return uo.test(t)},vo=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=yo.call(this)).height,h=l.ascent,i=Math.floor((o-h)/n))}else{var l;n=(l=yo.call(this)).height,h=l.ascent}}else this.fixedHeight>0?void 0===(i=bo(t,"maxLines"))&&(o=this.fixedHeight-s,i=Math.floor(o/n)):i=bo(t,"maxLines",0);void 0===h&&(h=n);var d=0===i,c=bo(t,"wrapMode");void 0===c&&(c=bo(t,"charWrap",!1)?"char":"word"),"string"==typeof c&&(c=co[c]);var u=bo(t,"wrapWidth",void 0);void 0===u&&(this.fixedWidth>0?u=this.fixedWidth-r:(u=1/0,c=0));for(var p=bo(t,"letterSpacing",0),v=bo(t,"hAlign",0),g=bo(t,"vAlign",0),f=bo(t,"justifyPercentage",.25),m=lo({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=So(t,"maxLines",void 0))){var h=this.fixedWidth-r;i=Math.floor(h/n)+1}}else i=So(t,"maxLines",0);var a=0===i,o=So(t,"fixedCharacterHeight",void 0);if(void 0===o){var l=So(t,"charPerLine",void 0);if(void 0!==l){var d=this.fixedHeight-s;o=Math.floor(d/l)}}var c=So(t,"wrapHeight",void 0);void 0===c&&(c=this.fixedHeight>0?this.fixedHeight-s:1/0);for(var u=So(t,"letterSpacing",0),p=So(t,"rtl",!0),v=So(t,"hAlign",p?2:0),g=So(t,"vAlign",0),f=lo({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 W=this.fixedWidth>0?this.fixedWidth:f.linesWidth+r,X=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 Ee(i,t,e),this.dirty=this.dirty||s!=i.left||r!=i.right||n!=i.top||h!=i.bottom,this},getPadding:function(t){return _e(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),Ga(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 Va(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(Na);return null===i?i=new to(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)),Sa(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 $o=Phaser.Utils.Objects.GetFastValue;var Jo={};class qo{constructor(t){this.pools=$o(t,"pools",Jo)}free(t){if(!this.pools)return this;var e=t.type;return this.pools.hasOwnProperty(e)||(this.pools[e]=new Uo),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)):(xl(this),bl(this)),this}setNumberInput(){return this.onUpdateCallback=yl,this}setSelectAllWhenFocusEnable(t){return void 0===t&&(t=!0),this.selectAllWhenFocus=t,this}setRequestCursorPosition(t){return this.isOpened?(this.requestCursorPosition=t,this):this}}const Sl=Phaser.Utils.Objects.GetValue,Pl=["inputType","onOpen","clickOutSideTarget","onFocus","onClose","onBlur","onUpdate","enterClose","readOnly","maxLength","minLength","selectAll"];var Ol=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}Wl.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(Xl(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 jl=new Wl,Fl=/^[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,Il=/\S/,Bl=new Wl;Bl.equals=function(t,e){return this.options.ignoreCase&&(t=t.toLowerCase(),e=e.toLowerCase()),t===e||this.options.ignoreWhitespace&&!Il.test(t)&&!Il.test(e)},Bl.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(Nl(t,null,null,i),i," ")},Vl.equals=function(t,e){return Wl.prototype.equals.call(Vl,t.replace(/,([\r\n])/g,"$1"),e.replace(/,([\r\n])/g,"$1"))};const Ul=new Wl;Ul.tokenize=function(t){return t.slice()},Ul.join=Ul.removeEmpty=function(t){return t};const $l=Phaser.Utils.Array.Remove;var Jl=function(t,e){var i=t.text;if(e!==i){if(null==i&&(i=""),$l(t.children,t.lastInsertCursor),""===e)t.removeChildren();else for(var s=(o=i,l=e,jl.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},td={cursorMoveLeft(){if(!this.isOpened)return this;var t=Kl(this.cursorPosition-1,0,this.inputText.length);return this.setCursorPosition(t),this},cursorMoveRight(){if(!this.isOpened)return this;var t=Kl(this.cursorPosition+1,0,this.inputText.length);return this.setCursorPosition(t),this},cursorMoveUp(){if(!this.isOpened)return this;var t=Zl(this.characterCountOfLines,this.cursorPosition);t.lineIndex-=1;var e=Kl(Ql(this.characterCountOfLines,t),0,this.inputText.length);return this.setCursorPosition(e),this},cursorMoveDown(){if(!this.isOpened)return this;var t=Zl(this.characterCountOfLines,this.cursorPosition);t.lineIndex+=1;var e=Kl(Ql(this.characterCountOfLines,t),0,this.inputText.length);return this.setCursorPosition(e),this}};const ed=Phaser.Utils.Objects.IsPlainObject;class id extends Qo{constructor(t,e,i,s,r,n){ed(e)?n=e:ed(s)&&(n=s),void 0===n&&(n={}),function(t,e){var i=!e.textArea;if(Ol(e,"wrap.vAlign")||Tl(e,"wrap.vAlign",s=i?"center":"top"),Ol(e,"wrap.wrapMode")||Tl(e,"wrap.wrapMode","char"),Ol(e,"wrap.maxLines")||Tl(e,"wrap.maxLines",s=i?1:void 0),i&&Tl(e,"wrap.wrapWidth",1/0),Ol(e,"wrap.useDefaultTextHeight")||Tl(e,"wrap.useDefaultTextHeight",!0),e.edit||(e.edit={}),!Ol(e.edit,"inputType")){var s=i?"text":"textarea";Tl(e.edit,"inputType",s)}if(!0===e.clickOutSideTarget){var r=new El(t);t.add.existing(r),e.clickOutSideTarget=r}}(t,n);var h=n.text;h&&delete n.text;var a=Ml(n.background,"focus"),o=Ml(n.style,"cursor");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=Sl(e,"edit");return void 0===i&&(i={}),il(e,i,Pl),new wl(t,i)}(this,n),Rl.call(this),n.focusStyle&&Object.assign(a,n.focusStyle),Yl.call(this,a),n.cursorStyle&&Object.assign(o,n.cursorStyle),zl.call(this,o);var l=n.onAddChar;l&&this.on("addchar",l);var d=n.onCursorOut;d&&this.on("cursorout",d);var c=n.onCursorIn;c&&this.on("cursorin",c);var u,p=n.onMoveCursor;p&&this.on("movecursor",p),this.setParseTextCallback(n.parseTextCallback),this.lastInsertCursor=((u=this.createCharChild("|")).text="",u),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)),(d=this.getSizerConfig(t)).align=i,d.padding=ue(s),Od(r)?(d.expandWidth=kd(r,"width",!1),d.expandHeight=kd(r,"height",!1)):(d.expandWidth=r,d.expandHeight=r),t.isRexSizer||(d.expandWidth&&(t.minWidth=void 0===n?Q(t):n),d.expandHeight&&(t.minHeight=void 0===h?tt(t):h)),d.alignOffsetX=a,d.alignOffsetY=o,d.aspectRatio=l,this.sizerChildren.hasOwnProperty(e)&&this.sizerChildren[e].destroy(),this.sizerChildren[e]=t,c&&this.addChildrenMap(e,t),this}},Md={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]),Ce.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}},Rd={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=this.innerLeft,c=this.innerTop,u=this.innerWidth,p=this.innerHeight,v=this.sizerChildren;for(var g in v)(t=v[g]).rexSizer.hidden||(i=(e=t.rexSizer).padding,dr.call(this,t),a=this.getExpandedChildWidth(t),o=this.getExpandedChildHeight(t),e.aspectRatio>0&&(Sd.width=e.aspectRatio,Sd.height=1,Pd.width=a,Pd.height=o,a=(l=bd(Sd,Pd,"FIT",!0)).width,o=l.height),t.isRexSizer?(t.runLayout(this,a,o),Zn(t,this)):Ie(t,a,o),s=d+i.left*this.scaleX,n=u-(i.left+i.right)*this.scaleX,r=c+i.top*this.scaleY,h=p-(i.top+i.bottom)*this.scaleY,cr.call(this,t,s,r,n,h,e.align,e.alignOffsetX,e.alignOffsetY))}};Object.assign(Rd,Ed,Md);const Ld=Phaser.Utils.Objects.IsPlainObject,Dd=Phaser.Utils.Objects.GetValue;class Ad extends Kn{constructor(t,e,i,s,r,n){Ld(e)?(e=Dd(n=e,"x",0),i=Dd(n,"y",0),s=Dd(n,"width",void 0),r=Dd(n,"height",void 0)):Ld(s)&&(s=Dd(n=s,"width",void 0),r=Dd(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(Ad.prototype,Rd);var zd={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 Yd extends na{}Object.assign(Yd.prototype,zd);const Wd=Phaser.Display.Color,Xd=Phaser.Math.Percent,jd=Phaser.Display.Color,Fd=Phaser.Math.Percent,Id=Phaser.Display.Color.ColorToRGBA,Bd=Phaser.Display.Color.HSVToRGB;class Hd extends Yd{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 jd,this.setOrientation(n),this.setSize(s,r)}setOrientation(t){return this.orientation=Ch(t),this}updateTexture(){return function(t,e,i){void 0===i&&(i=!1);var s=t.width,r=t.height,n=new Wd;if(i)for(var h=0;h0&&r.push(o.join("")),r},Cc=0,wc=1,Sc=2,Pc=0,Oc=1,kc=2,Tc=/(?:\r\n|\r|\n)/;const _c={none:Pc,word:Oc,char:kc,character:kc,mix:3};var Ec=function(t,e){return void 0===e&&(e=0),t._minWidth=e,t.runWidthWrap=function(t){return t instanceof Qo}(t)?function(t){return function(e){return t.setFixedSize(e,0).runWordWrap(),t.minHeight=t.height,t}}(t):mc(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 gc(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 Mc=65535;var Rc=function(t,e,i){if(null==e)return t;if(0===e)return Ac(t,0,i),t;var s=t.text.length;if(0===s)return Ac(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=Dc(t,r,e,i,n),a=0;a<=Mc&&0!==h;a++){if((r+=h)<0){r=0;break}h=Dc(t,r,e,i,n)}return a===Mc&&console.warn("FontSizeFit: Test count exceeds 65535"),t.setFontSize(r),Ac(t,e,i),t},Lc=function(t,e,i){return void 0===i[e]&&(t.setFontSize(e),i[e]={width:t.width,height:t.height}),i[e]},Dc=function(t,e,i,s,r){var n,h=Lc(t,e,r),a=Lc(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)},Ac=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 zc=Phaser.Utils.Objects.GetValue,Yc=Phaser.Utils.Objects.GetValue;class Wc extends oc{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexLabel";var i,s=Yc(e,"background",void 0),r=Yc(e,"icon",void 0),n=Yc(e,"iconMask",void 0),h=Yc(e,"text",void 0),a=Yc(e,"action",void 0),o=Yc(e,"actionMask",void 0),l=Yc(e,"align",void 0);if(s&&this.addBackground(s),r){0===this.orientation?(h||a)&&(i={right:Yc(e,"space.icon",0),top:Yc(e,"space.iconTop",0),bottom:Yc(e,"space.iconBottom",0),left:Yc(e,"space.iconLeft",0)}):(h||a)&&(i={bottom:Yc(e,"space.icon",0),left:Yc(e,"space.iconLeft",0),right:Yc(e,"space.iconRight",0),top:Yc(e,"space.iconTop",0)});var d=Yc(e,"squareFitIcon",!1)?1:0;if(this.add(r,{proportion:0,padding:i,fitRatio:d}),n&&(n=pc.call(this,r,r,1)),!d){var c=Yc(e,"iconSize",void 0);this.setIconSize(Yc(e,"iconWidth",c),Yc(e,"iconHeight",c))}}if(h){var u=Yc(e,"wrapText",!1),p=Yc(e,"adjustTextFontSize",!1);u?(!0===u&&(u="word"),function(t,e){switch(yc(t)){case 0:switch("string"==typeof e&&(e=_c[e]||0),t.style.wrapMode=e,e){case 2:case 3:t.style.wordWrapCallback=xc;break;default:t.style.wordWrapCallback=null}break;case 1:"string"==typeof e&&(e=_c[e]||0),t.style.wrapMode=e}}(h,u),e.expandTextWidth=!0,Ec(h)):p&&(e.expandTextWidth=!0,e.expandTextHeight=!0,function(t,e){"number"==typeof e&&(e={minWidth:e});var i=zc(e,"minWidth",0),s=zc(e,"minHeight",0),r=zc(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 Rc(t,e,i),t}):(t.runWidthWrap=function(e){return t.setFixedSize&&t.setFixedSize(0,0),Rc(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=Yc(e,"space.text",0),m=Yc(e,"expandTextWidth",!1),y=Yc(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:Yc(e,"space.actionTop",0),bottom:Yc(e,"space.actionBottom",0),right:Yc(e,"space.actionRight",0)}:{left:Yc(e,"space.actionLeft",0),right:Yc(e,"space.actionRight",0),bottom:Yc(e,"space.actionBottom",0)},d=Yc(e,"squareFitAction",!1)?1:0,this.add(a,{proportion:0,padding:i,fitRatio:d}),o&&(o=pc.call(this,a,a,1)),!d)){var x=Yc(e,"actionSize");this.setActionSize(Yc(e,"actionWidth",x),Yc(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 Xc=Phaser.Utils.Objects.GetValue;class jc extends Qe{constructor(t,e){super(t,e),this.style=Xc(e,"style",this);var i=Xc(e,"propertiesMap");this.activeStyle=Fc(e,"active",i),this.hoverStyle=Fc(e,"hover",i),this.disableStyle=Fc(e,"disable",i),this.onModifyStyle=Xc(e,"onModifyStyle")}getStyle(t){return Dl(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 Al(e,t)?void 0:(this.modifyStyle(t),e)}}setActiveState(t){return Ic.call(this,"active",t),this}setHoverState(t){return Ic.call(this,"hover",t),this}setDisableState(t){return Ic.call(this,"disable",t),this}}var Fc=function(t,e,i){var s=Ml(t,e);if(i)for(var r in s)i.hasOwnProperty(r)&&(s[i[r]]=s[r],delete s[r]);return s},Ic=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))},Bc={addStyleManager(t){return this.styleManager=new jc(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 Hc extends $h{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexStatesRoundRectangleShape",e.style=this,e.propertiesMap=Gc,this.addStyleManager(e),delete e.style,delete e.propertiesMap}}const Gc={color:"fillColor",alpha:"fillAlpha",strokeWidth:"lineWidth"};Object.assign(Hc.prototype,Bc);const Vc=Phaser.GameObjects.GetCalcMatrix,Nc=Phaser.Renderer.Canvas.SetTransform;var Uc={renderWebGL:function(t,e,i,s){e.updateData(),i.addToRenderList(e);var r=t.pipelines.set(e.pipeline),n=Vc(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 Ru=Phaser.Utils.Objects.GetValue,Lu=Phaser.Utils.Objects.IsPlainObject;class Du extends(ru(qc)){constructor(t,e,i,s,r,n,h,a){Lu(e)?(e=(a=e).x,i=a.y,s=a.width,r=a.height,n=a.barColor,h=a.value):Lu(s)?(s=(a=s).width,r=a.height,n=a.barColor,h=a.value):Lu(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 Eu).setName("trackFill")).addShape((new Eu).setName("bar")).addShape((new Eu).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&&Mu(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),Mu(h,r,0,n,i,t));var a=this.getShape("trackStroke");a.lineStyle(this.trackStrokeThickness,this.trackStrokeColor),a.isStroked&&Mu(a,0,0,e,i,t)}};Object.assign(Du.prototype,Au);class zu extends Du{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"),Tl(e,"easeValue.duration",e.easeDuration),Tl(e,"easeValue.ease",e.ease),super(t,e),this.type="rexStatesBarRectangleShape",this.barState=!1,e.style=this,e.propertiesMap=Yu,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 Yu={color:"trackColor",strokeColor:"trackStrokeColor",strokeWidth:"trackStrokeThickness"};Object.assign(zu.prototype,Bc);var Wu=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},Xu=function(t){return t.preFX?t.preFX:t.postFX?t.postFX:null},ju=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=oo(i),s=oo(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 P=typeof(m=this.getFrameNameCallback(o,C,e));"string"!==P&&"number"!==P||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 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={},Ke(t).events.once("destroy",(function(){for(var t in ap)ap[t].destroy();ap=void 0}))),!ap.hasOwnProperty(e)){var i=Ke(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 Qe{constructor(t,e){return super(t),new Proxy(this,this)}get(t,e){if(Wu(t,e))return t[e];var i=t.parent;return Wu(i,e)?i[e]:void 0}set(t,e,i){return Wu(t,e)?t[e]=i:Wu(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&&Bu(this,i),this.style=new up(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign(vp.prototype,Bc);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. diff --git a/dist/rexcolorpicker.js b/dist/rexcolorpicker.js index a3e6a2d277..82d0d87d68 100644 --- a/dist/rexcolorpicker.js +++ b/dist/rexcolorpicker.js @@ -14575,6 +14575,10 @@ radius.y = Math.abs(radius.y); }; + var IsArcCorner = function (radius) { + return ((radius.x > 0) && (radius.y > 0)); + }; + var LineTo = function (x, y, pathData) { var cnt = pathData.length; if (cnt >= 2) { @@ -14656,8 +14660,7 @@ geom.setTo(0, 0, width, height, radius); } - var iteration = GetValue$1(radiusConfig, 'iteration', undefined); - this.setIteration(iteration); + this.setIteration(GetValue$1(radiusConfig, 'iteration', undefined)); this.setPosition(x, y); this.setFillStyle(fillColor, fillAlpha); @@ -14910,10 +14913,6 @@ } - var IsArcCorner = function (radius) { - return ((radius.x > 0) && (radius.y > 0)); - }; - const ShapeTypeMap = { rectangle: 0, circle: 1 diff --git a/dist/rexcolorpicker.min.js b/dist/rexcolorpicker.min.js index e307c78c1b..677bcd61ca 100644 --- a/dist/rexcolorpicker.min.js +++ b/dist/rexcolorpicker.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 O={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=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},R={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},D={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}},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}},X=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 N={getChildren(t){if(t)for(var e=0,i=this.children.length;e=0;e--)this.remove(this.backgroundChildren[e],t);return this}},Pe=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 we=/(\S+)\[(\d+)\]/i,Te=Phaser.Utils.Objects.GetValue;var _e=function(t,e){return void 0===e?t:t[e]},Oe=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=Te(e,"left",0),t.right=Te(e,"right",0),t.top=Te(e,"top",0),t.bottom=Te(e,"bottom",0)),t},Ee={getInnerPadding(t){return _e(this.space,t)},setInnerPadding(t,e){return Oe(this.space,t,e),this},getOuterPadding(t){return _e(this.getSizerConfig(this).padding,t)},setOuterPadding(t,e){return Oe(this.getSizerConfig(this).padding,t,e),this},getChildOuterPadding(t,e){return"string"==typeof t&&(t=this.getElement(t)),_e(this.getSizerConfig(t).padding,e)},setChildOuterPadding(t,e,i){return"string"==typeof t&&(t=this.getElement(t)),Oe(this.getSizerConfig(t).padding,e,i),this}},ke=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}},Re=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},Me=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},De=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}},Le=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},ze=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},Ae={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?ui:ci,this.repeatCounter=0,this}stop(){return this.state=di,this}update(t,e){this.state!==di&&this.state!==vi&&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=pi)):(this.nowTime=this.duration,this.state=vi):this.nowTime>=0&&(this.state=ui))}get t(){var t;switch(this.state){case di:case ci:case pi:t=0;break;case ui:t=this.nowTime/this.duration;break;case vi:t=1}return oi(t,0,1)}set t(t){(t=oi(t,-1,1))<0?(this.state=ci,this.nowTime=-this.delay*t):(this.state=ui,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===di}get isDelay(){return this.state===ci}get isCountDown(){return this.state===ui}get isRunning(){return this.state===ci||this.state===ui}get isDone(){return this.state===vi}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}}const di=0,ci=1,ui=2,pi=3,vi=-1;class gi extends ni{constructor(t,e){super(t,e),this.timer=new li}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 fi=Phaser.Utils.Objects.GetValue,mi=Phaser.Utils.Objects.GetAdvancedValue,yi=Phaser.Tweens.Builders.GetEaseFunction;class Ci extends gi{resetFromJSON(t){return this.timer.resetFromJSON(fi(t,"timer")),this.setEnable(fi(t,"enable",!0)),this.setTarget(fi(t,"target",this.parent)),this.setDelay(mi(t,"delay",0)),this.setDuration(mi(t,"duration",1e3)),this.setEase(fi(t,"ease","Linear")),this.setRepeat(fi(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=yi(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 bi=Phaser.Utils.Objects.GetValue,xi=Phaser.Utils.Objects.GetAdvancedValue,Si=Phaser.Math.Linear;class Pi extends Ci{constructor(t,e){super(t,e),this.scaleStart={},this.scaleEnd={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(bi(t,"mode",0)),this.setScaleRange(xi(t,"start",void 0),xi(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=wi[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=Si(this.startX,this.endX,i)),this.hasScaleY&&(t.scaleY=Si(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const wi={stop:0,destroy:1,yoyo:2};var Ti=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 Pi(t,a):r.resetFromJSON(a),r.restart(),r},_i=function(t,e,i,s,r,n){void 0===s&&(s="Linear"),r instanceof Pi&&(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 Pi(t,h):n.resetFromJSON(h),n.restart(),n},Oi=function(t,e){return new Promise((function(i,s){t.once(e,(function(){i()}))}))},Ei=function(t){return Oi(t,"complete")};const ki=Phaser.Utils.Objects.IsPlainObject;var Ri={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(ki(t)){var s=t;t=s.duration,e=s.orientation,i=s.ease}var r=void 0===this._scaleBehavior;return this._scaleBehavior=Ti(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),Ei(this._scaleBehavior)},isRunningPopUp(){return this._scaleBehavior&&"popup.complete"===this._scaleBehavior.completeEventName},scaleDownDestroy(t,e,i,s){if(ki(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=_i(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),Ei(this._scaleBehavior)},scaleDown(t,e,i){return this.scaleDownDestroy(t,e,i,!1),this},scaleDownPromise(t,e,i){return this.scaleDown(t,e,i),Ei(this._scaleBehavior)},isRunningScaleDown(){return this._scaleBehavior&&"scaledown.complete"===this._scaleBehavior.completeEventName},scaleYoyo(t,e,i,s,r){if(ki(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 Pi(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),Ei(this._scaleBehavior)},isRunningScaleYoyo(){return this._scaleBehavior&&(this._scaleBehavior.completeEventName="scaleyoyo.complete")},isRunningEaseScale(){return this.isRunningPopUp()||this.isRunningScaleDown()||this.isRunningScaleYoyo()}},Mi={};Object.assign(Mi,Ri),Mi.onInitScale=function(){Ri.onInitScale.call(this);var t=this;this._scaleBehavior.on("update",(function(){var e=ge.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const Di=Phaser.Utils.Objects.GetValue,Li=Phaser.Utils.Objects.GetAdvancedValue,zi=Phaser.Math.Linear;class Ai extends Ci{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(Di(t,"mode",0)),this.setAlphaRange(Li(t,"start",this.parent.alpha),Li(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=zi(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 Xi=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 Ai(t,h):s.resetFromJSON(h),s.restart(),s},Yi=function(t,e,i,s){i instanceof Ai&&(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 Ai(t,r):s.resetFromJSON(r),s.restart(),s};const ji=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(ji(t)){var i=t;t=i.duration,e=i.alpha}var s=void 0===this._fade;return this._fade=Xi(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadein.complete",this},fadeInPromise(t,e){return this.fadeIn(t,e),Ei(this._fade)},isRunningFadeIn(){return this._fade&&"fadein.complete"===this._fade.completeEventName},fadeOutDestroy(t,e){if(ji(t)){var i=t;t=i.duration,e=i.destroy}var s=void 0===this._fade;return this._fade=Yi(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadeout.complete",this},fadeOutDestroyPromise(t,e){return this.fadeOutDestroy(t,e),Ei(this._fade)},fadeOut(t){return this.fadeOutDestroy(t,!1),this},fadeOutPromise(t){return this.fadeOut(t),Ei(this._fade)},isRunningFadeOut(){return this._fade&&"fadeout.complete"===this._fade.completeEventName},isRunningEaseFade(){return this.isRunningFadeIn()||this.isRunningFadeOut()}},Wi={};Object.assign(Wi,Ni),Wi.onInitFade=function(){Ni.onInitFade.call(this);var t=this;this._fade.on("update",(function(){var e=ge.getParentSizer(t);e&&e.resetChildAlphaState(t)}))};const Ui=Phaser.Utils.Objects.GetValue,Bi=Phaser.Utils.Objects.GetAdvancedValue,Hi=Phaser.Math.Linear;class Vi extends Ci{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){if(super.resetFromJSON(t),this.setMode(Ui(t,"mode",0)),t&&(t.hasOwnProperty("x")||t.hasOwnProperty("y"))){var e=Bi(t,"x",void 0),i=Bi(t,"y",void 0);this.setTargetPosition(e,i)}else this.setTargetPosition(t);return this}setMode(t){return"string"==typeof t&&(t=Gi[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=Bi(i,"startX",void 0),this.startY=Bi(i,"startY",void 0),this.endX=Bi(i,"endX",void 0),this.endY=Bi(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=Hi(this.startX,this.endX,i)),this.hasMoveY&&(t.y=Hi(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Gi={stop:0,destroy:1,yoyo:2};var Ji=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 $i=Phaser.Utils.Objects.IsPlainObject,qi=Phaser.Math.Distance.Between;var Zi={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($i(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*qi(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 Vi&&(h=n,n=void 0),void 0===n&&(n=!1);var a={};return a.mode=n?1:0,void 0!==i&&(a.startX=Ji(i,t.x),a.endX=t.x),void 0!==s&&(a.startY=Ji(s,t.y),a.endY=t.y),a.duration=e,a.ease=void 0===r?"Linear":r,void 0===h?h=new Vi(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),Ei(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),Ei(this._easeMove)},isRunningMoveFrom(){return this._easeMove&&(this._easeMove.completeEventName="movefrom.complete")},moveTo(t,e,i,s,r){if($i(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*qi(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 Vi&&(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=Ji(i,t.x)),void 0!==s&&(a.startY=t.y,a.endY=Ji(s,t.y)),a.duration=e,a.ease=void 0===r?"Linear":r,void 0===h?h=new Vi(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),Ei(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),Ei(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}},Ki={};Object.assign(Ki,Zi),Ki.onInitEaseMove=function(){Zi.onInitEaseMove.call(this);var t=this;this._easeMove.on("update",(function(){var e=ge.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const Qi=Phaser.Utils.Objects.GetValue;class ts extends ii{constructor(t,e){super(t,e),this.timer=new li,this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.timer.resetFromJSON(Qi(t,"timer")),this.setEnable(Qi(t,"enable",!0)),this.setMode(Qi(t,"mode",1)),this.isRunning=Qi(t,"isRunning",!1),this.setMagnitudeMode(Qi(t,"magnitudeMode",1)),this.setAxisMode(Qi(t,"axis",0)),this.setDuration(Qi(t,"duration",500)),this.setMagnitude(Qi(t,"magnitude",10)),this.ox=Qi(t,"ox",void 0),this.oy=Qi(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=es[t]),this.mode=t,this}setMagnitudeMode(t){return"string"==typeof t&&(t=ss[t]),this.magnitudeMode=t,this}setAxisMode(t){return"string"==typeof t&&(t=is[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=Qi(i,"magnitude",void 0),t=Qi(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 es={effect:0,behavior:1},is={both:0,"h&v":0,"x&y":0,horizontal:1,h:1,x:1,vertical:2,v:2,y:2},ss={constant:0,decay:1},rs=Phaser.Utils.Objects.IsPlainObject;var ns={shake(t,e,i){if(rs(t)){var s=t;t=s.duration,e=s.magnitude,i=s.magnitudeMode}return void 0===this._shake&&(this._shake=new ts(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),Ei(this._shake)}};const hs=Phaser.Utils.Objects.GetValue,as=Phaser.Math.Linear;class os extends Ci{constructor(t,e){super(t,e),this.resetFromJSON(),this.boot()}start(t){if(this.timer.isRunning)return this;var e=this.target;this.propertyKey=hs(t,"key","value");var i=e[this.propertyKey];return this.fromValue=hs(t,"from",i),this.toValue=hs(t,"to",i),this.setEase(hs(t,"ease",this.ease)),this.setDuration(hs(t,"duration",this.duration)),this.setRepeat(hs(t,"repeat",0)),this.setDelay(hs(t,"delay",0)),this.setRepeatDelay(hs(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]=as(this.fromValue,this.toValue,i)}}const ls=Phaser.Utils.Objects.IsPlainObject;class ds extends Ze{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 os(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(ls(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(ls(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 cs={easeDataTo(t,e,i,s){return this._easeData||(this._easeData=new ds(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),Oi(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}},us=Phaser.Utils.Array.Remove,ps={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 Es={delayCall(t,e,i){return this.delayCallTimer=function(t,e,i,s,r){var n=Ve(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}},ks={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}},Rs={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}},Ms={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}},Ds={};Object.assign(Ds,Es,ks,Rs,Ms);const Ls=Phaser.Utils.Objects.GetValue;class zs extends Ze{constructor(t,e){super(t,e),this.setTransitInTime(Ls(e,"duration.in",200)),this.setTransitOutTime(Ls(e,"duration.out",200)),this.setTransitInCallback(Ls(e,"transitIn")),this.setTransitOutCallback(Ls(e,"transitOut")),this.oneShotMode=Ls(e,"destroy",!1),this.delayCallTimer=void 0,this._state=new Os(this,{eventEmitter:!1,initState:Ls(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(zs.prototype,Ds);var As=function(t){if(t.parentContainer)return As(t.parentContainer);var e=function(t){var e=t.displayList;return G(e)?e:null}(t);return e?As(e):t};class Is extends Ze{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=As(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 Xs extends Fs{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 Ys=Phaser.Utils.Objects.GetValue;class js extends Ze{constructor(t,e){super(t,{eventEmitter:!1}),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setHitAreaMode(Ys(t,"hitAreaMode",0)),this.setEnable(Ys(t,"enable",!0)),this.setStopMode(Ys(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 Ws=Phaser.Utils.Objects.GetValue;class Us extends Xs{constructor(t,e){super(t,Ws(e,"color",0),Ws(e,"alpha",.8)),this.touchEventStop=new js(this,{hitAreaMode:1})}}var Bs={popUp(t,e){void 0!==t._modalScaleSave?(t.scaleX=t._modalScaleSave,t.scaleY=t._modalScaleSave):t._modalScaleSave=t.scaleX,Ti(t,e)},scaleDown(t,e){_i(t,e,void 0,void 0,!1)},fadeIn(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Xi(t,e)},fadeOut(t,e){Yi(t,e,!1)}},Hs=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Xi(t,e,t.alpha)},Vs=function(t,e){Yi(t,e,!1)},Gs=function(t,e,i,s,r){return!(!t||s&&!s(t,e,i)||!rt(t,!0).contains(e,i)||r&&!r(t,e,i))};const Js=Phaser.Utils.Objects.GetValue;let $s=class extends zs{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=qs.popUp),null==e.transitOut&&(e.transitOut=qs.scaleDown),e.destroy=Js(e,"destroy",!0),super(t,e);var i=Js(e,"cover");this.cover=!1!==i?function(t,e){var i=t.scene,s=new Us(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(Js(i,"transitIn",Hs)),this.setCoverTransitOutCallback(Js(i,"transitOut",Vs)));var s=Js(e,"touchOutsideClose",!1),r=Js(e,"duration.hold",-1),n=Js(e,"timeOutClose",r>=0),h=Js(e,"anyTouchClose",!1);Js(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),Js(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&&Gs(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=qs[t]),t){case qs.popUp:t=Bs.popUp;break;case qs.fadeIn:t=Bs.fadeIn}return super.setTransitInCallback(t),this}setTransitOutCallback(t){switch("string"==typeof t&&(t=qs[t]),t){case qs.scaleDown:t=Bs.scaleDown;break;case qs.fadeOut:t=Bs.fadeOut}return super.setTransitOutCallback(t),this}setCoverTransitInCallback(t){return this.coverTransitInCallback=t,this}setCoverTransitOutCallback(t){return this.coverTransitOutCallback=t,this}};const qs={popUp:0,fadeIn:1,scaleDown:0,fadeOut:1};var Zs=function(t){return t&&"function"==typeof t},Ks={modal(t,e){return Zs(t)&&(e=t,t=void 0),void 0===this._modalBehavior&&(this.onCreateModalBehavior&&this.onCreateModalBehavior(this,t),this._modalBehavior=function(t,e){var i=new $s(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}},Qs=function(t,e,i,s,r){Zs(e)&&(r=s,s=i,i=e,e=this);var n=this.scene.events;return this.bindEvent(e,n,t,i,s,r),this},tr={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 Qs.call(this,"preupdate",t,e,i,s),this},bindSceneUpdateEvent(t,e,i,s){return Qs.call(this,"update",t,e,i,s),this},bindScenePostupdateEvent(t,e,i,s){return Qs.call(this,"postupdate",t,e,i,s),this},bindSceneRenderEvent(t,e,i,s){return Qs.call(this,"render",t,e,i,s),this},bindScenePauseEvent(t,e,i,s){return Qs.call(this,"pause",t,e,i,s),this},bindSceneResumeEvent(t,e,i,s){return Qs.call(this,"resume",t,e,i,s),this},bindSceneSleepEvent(t,e,i,s){return Qs.call(this,"sleep",t,e,i,s),this},bindSceneWakeEvent(t,e,i,s){return Qs.call(this,"wake",t,e,i,s),this},bindSceneShutdownEvent(t,e,i,s){return Qs.call(this,"shutdown",t,e,i,s),this}},er=function(t,e,i){var s=t.camera;return s?(void 0===i?i={}:!0===i&&(i=ir),s===e?(i.x=t.worldX,i.y=t.worldY):s.getWorldPoint(t.x,t.y,i),i):null},ir={},sr=function(t,e,i,s){var r,n=t.scene.sys.cameras.main,h=0===t.scrollFactorX&&0===t.scrollFactorY;if(e)return h?Gs(t,e.x,e.y,i,s):!!(r=er(e,n,!0))&&Gs(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 vr={press:0,pointerdown:0,release:1,pointerup:1};var gr={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 pr(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}},fr=function(t,e,i,s,r){if(e)return!(i&&!i(t,e)||!mr(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 yr.length=0,!0;return yr.length=0,!1},yr=[];const Cr=Phaser.Utils.Objects.GetValue;class br extends Ze{constructor(t,e){super(t,e),this._enable=void 0;var i=Cr(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(Cr(t,"enable",!0)),this.setMode(Cr(t,"mode",1)),this.setClickInterval(Cr(t,"clickInterval",100)),this.setDragThreshold(Cr(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?fr:sr)(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 Sr={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 br(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 Pr extends _s{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 wr=Phaser.Utils.Objects.GetValue;class Tr extends Ze{constructor(t,e){super(t,e),this._enable=void 0,this.cooldown=new Pr,this.parent.setInteractive(wr(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.prevIsInTouch=!1,this.isInTouching=!1,this.setEnable(wr(t,"enable",!0)),this.setCooldown(wr(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 _r={isPointerInBounds(t){return void 0===t?t=this:"string"==typeof t&&(t=this.getElement(t)),!!t&&sr(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 Tr(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 Tr(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}},Or={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}},Er=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=Br,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===Hr&&this.onDragEnd(),this.pointer=void 0,this.tracerState=Br,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=Vr,this}isPointerInGameObject(t,e,i){var s=this.lastPointer;return!!s&&sr(t,s,e,i)}}const Br=0,Hr=1,Vr="IDLE",Gr=Phaser.Utils.Objects.GetValue,Jr=Phaser.Math.Distance.Between;class $r extends Ur{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=qr},eventEmitter:!1};this.setRecongizedStateObject(new _s(s))}resetFromJSON(t){super.resetFromJSON(t),this.setHoldTime(Gr(t,"time",250)),this.setTapInterval(Gr(t,"tapInterval",200)),this.setDragThreshold(Gr(t,"threshold",9)),this.setTapOffset(Gr(t,"tapOffset",10));var e=Gr(t,"taps",void 0);return void 0!==e?this.setTaps(e):(this.setMaxTaps(Gr(t,"maxTaps",void 0)),this.setMinTaps(Gr(t,"minTaps",void 0))),this}onDragStart(){switch(this.state){case qr:this.state=Zr;break;case Zr:var t=this.lastPointer;Jr(t.upX,t.upY,t.x,t.y)>this.tapOffset&&(this.state=Kr,this.state=Zr);break;case Kr:this.state=Zr}}onDragEnd(){this.state===Zr&&(this.tapsCount++,this.emit("tapping",this,this.gameObject,this.lastPointer),void 0!==this.maxTaps&&this.tapsCount===this.maxTaps&&(this.state=Kr))}onDrag(){this.state!==qr&&this.pointer.getDistance()>this.dragThreshold&&(this.state=qr)}preUpdate(t,e){if(this.isRunning&&this.enable&&this.state===Zr){var i=this.lastPointer;i.isDown?t-i.downTime>this.holdTime&&(this.state=qr):t-i.upTime>this.tapInterval&&(void 0===this.minTaps||this.tapsCount>=this.minTaps?this.state=Kr:this.state=qr)}}postUpdate(t,e){this.isRunning&&this.enable&&this.state===Kr&&(this.state=qr)}get isTapped(){return this.state===Kr}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 qr="IDLE",Zr="BEGIN",Kr="RECOGNIZED",Qr=Phaser.Utils.Objects.GetValue;class tn extends Ur{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=en},eventEmitter:!1};this.setRecongizedStateObject(new _s(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(Qr(t,"threshold",9)),this.setHoldTime(Qr(t,"time",251)),this}onDragStart(){this.state=sn,0===this.holdTime&&(this.state=rn)}onDragEnd(){this.state=en}onDrag(){this.state!==en&&this.pointer.getDistance()>this.dragThreshold&&(this.state=en)}preUpdate(t,e){this.isRunning&&this.enable&&this.state===sn&&t-this.pointer.downTime>=this.holdTime&&(this.state=rn)}get isPressed(){return this.state===rn}setHoldTime(t){return this.holdTime=t,this}setDragThreshold(t){return this.dragThreshold=t,this}}const en="IDLE",sn="BEGIN",rn="RECOGNIZED";Phaser.Utils.Objects.GetValue;const nn=Phaser.Math.Distance.Between,hn=Phaser.Math.Angle.Between;var an={getDt:function(){var t;return t=this.scene,$e(t).loop.delta},getVelocity:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return nn(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 hn(e.x,e.y,t.x,t.y)}},on={"up&down":0,"left&right":1,"4dir":2,"8dir":3},ln={};const dn=Phaser.Utils.Objects.GetValue,cn=Phaser.Math.RadToDeg;class un extends Ur{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=pn},eventEmitter:!1};this.setRecongizedStateObject(new _s(s)),this.clearDirectionStates()}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(dn(t,"threshold",10)),this.setVelocityThreshold(dn(t,"velocityThreshold",1e3)),this.setDirectionMode(dn(t,"dir","8dir")),this}onDragStart(){this.state=vn}onDragEnd(){this.state=pn}onDrag(){this.state===vn&&(this.validDrag||(this.validDrag=0===this.dragThreshold||this.pointer.getDistance()>=this.dragThreshold),this.validDrag&&this.dragVelocity>this.velocityThreshold&&(this.state=gn))}postUpdate(t,e){this.isRunning&&this.enable&&this.state===gn&&(this.state=pn)}get isSwiped(){return this.state===gn}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=on[t]),this.dirMode=t,this}updateDirectionStates(){return function(t,e,i){switch(void 0===i?i={}:!0===i&&(i=ln),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(un.prototype,an);const pn="IDLE",vn="BEGIN",gn="RECOGNIZED",fn=Phaser.Utils.Objects.GetValue,mn=Phaser.Utils.Array.SpliceOne,yn=Phaser.Math.Distance.Between,Cn=Phaser.Math.Angle.Between;class bn{constructor(t,e){var i=Ve(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(fn(e,"inputConfig",void 0)),this.setEventEmitter(fn(e,"eventEmitter",void 0)),this._enable=void 0,this.pointers=[],this.movedState={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setEnable(fn(t,"enable",!0)),this.bounds=fn(t,"bounds",void 0),this.tracerState=Sn,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 Sn:this.tracerState=Pn,this.onDrag1Start();break;case Pn:this.tracerState=wn,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],mn(this.pointers,e),this.tracerState){case Pn:this.tracerState=Sn,this.onDrag1End();break;case wn:this.tracerState=Pn,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 Pn:this.onDrag1();break;case wn:this.onDrag2()}}}dragCancel(){return this.tracerState===wn&&this.onDrag2End(),this.pointers.length=0,gt(this.movedState),this.tracerState=Sn,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!==wn)return 0;var t=this.pointers[0],e=this.pointers[1];return yn(t.x,t.y,e.x,e.y)}get angleBetween(){if(this.tracerState!==wn)return 0;var t=this.pointers[0],e=this.pointers[1];return Cn(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!==wn)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.x+e.x)/2}get centerY(){if(this.tracerState!==wn)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.y+e.y)/2}get prevCenterX(){if(this.tracerState!==wn)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!==wn)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=Tn,this}isPointer0InGameObject(t,e,i){var s=this.pointers[0];return!!s&&sr(t,s,e,i)}isPointer1InGameObject(t,e,i){var s=this.pointers[1];return!!s&&sr(t,s,e,i)}}Object.assign(bn.prototype,Ue);var xn={};const Sn=0,Pn=1,wn=2,Tn="IDLE";Phaser.Utils.Objects.GetValue;const _n=Phaser.Math.RotateAround;var On=function(t,e,i,s){return _n(t,e,i,s),t.rotation+=s,t},En={};const kn=Phaser.Utils.Objects.GetValue,Rn=Phaser.Math.Angle.WrapDegrees,Mn=Phaser.Math.Angle.ShortestBetween,Dn=Phaser.Math.RadToDeg,Ln=Phaser.Math.DegToRad;var zn={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=En),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=Rn(Dn(this.angleBetween));this.angle=Mn(this.prevAngle,t),this.prevAngle=t,this.state=Fn}break;case Fn:t=Rn(Dn(this.angleBetween)),this.angle=Mn(this.prevAngle,t),this.prevAngle=t,this.emit("rotate",this)}}get isRotated(){return this.state===Fn}get rotation(){return Ln(this.angle)}setDragThreshold(t){return this.dragThreshold=t,this}}.prototype,zn);const An="IDLE",In="BEGIN",Fn="RECOGNIZED",Xn=Phaser.Utils.Objects.GetValue;var Yn=function(t){var e=Xn(t,"tap",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._tap=new $r(this,e),this._tap.on("tap",(function(t,e,s){kr(i.eventEmitter,`${i.eventNamePrefix}${t.tapsCount}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const jn=Phaser.Utils.Objects.GetValue;var Nn=function(t){var e=jn(t,"press",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._press=new tn(this,e),this._press.on("pressstart",(function(t,e,s){kr(i.eventEmitter,`${i.eventNamePrefix}pressstart`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this).on("pressend",(function(t,e,s){kr(i.eventEmitter,`${i.eventNamePrefix}pressend`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Wn=Phaser.Utils.Objects.GetValue;var Un=function(t){var e=Wn(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 un(this,e),this._swipe.on("swipe",(function(t,e,s){var r=t.left?"left":t.right?"right":t.up?"up":"down";kr(i.eventEmitter,`${i.eventNamePrefix}swipe${r}`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Bn=Phaser.Utils.Objects.GetValue;var Hn=function(t,e){return t.setInteractive(),Bn(e,"dropZone",!1)&&(t.input.dropZone=!0),t._childrenInteractive={targetSizers:Bn(e,"targets",[t]),targetMode:Bn(e,"targetMode","parent"),eventEmitter:Bn(e,"eventEmitter",t),eventNamePrefix:Bn(e,"inputEventPrefix","child.")},Mr.call(t,e),zr.call(t,e),Fr.call(t,e),Nr.call(t,e),Yn.call(t,e),Nn.call(t,e),Un.call(t,e),t},Vn={getSizerConfig:function(t){return void 0===t&&(t=this),Et(t)},getChildPrevState:function(t){var e=Et(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,h,a=t.scene;if("number"==typeof e)i=e;else{i=ne(e,"color"),s=ne(e,"lineWidth");var o=ne(e,"name",!1);o&&(r=ne(o,"createTextCallback",ae),n=ne(o,"createTextCallbackScope",void 0),"string"==typeof(h=ne(o,"align","left-top"))&&(h=zt[h]))}if(void 0===i&&(i=16777215),void 0===s&&(s=1),r&&!t.children){t.children=new he(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)}}for(var d,c,u=this.getAllShownChildren([this]),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 eh=Phaser.Utils.Objects.IsPlainObject,ih=Phaser.Utils.Objects.GetValue,sh=Phaser.Display.Align.CENTER,rh={min:0,full:-1};var nh=function(t,e,i,s,r,n,h,a,o,l){ue.call(this,t);var d=t.isRexSpace,c=typeof e;if(null===e)return this;if("number"===c);else if("string"===c)e=rh[e];else if(eh(e)){var u;e=ih(u=e,"proportion",void 0),i=ih(u,"align",sh),s=ih(u,"padding",0),r=ih(u,"expand",!1),n=ih(u,"key",void 0),h=ih(u,"index",void 0),t.isRexSizer||(a=ih(u,"minWidth",void 0),o=ih(u,"minHeight",void 0)),l=ih(u,"fitRatio",0)}return"string"==typeof i&&(i=zt[i]),void 0===e&&(e=d?1:0),void 0===i&&(i=sh),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===a&&(d?a=0:t.isRexSizer||(a=t._minWidth)),void 0===o&&(d?o=0:t.isRexSizer||(o=t._minHeight)),void 0===l||!1===l?l=0:!0===l&&(l=Q(t)/tt(t)),(u=this.getSizerConfig(t)).proportion=e,u.align=i,u.padding=de(s),u.expand=r,u.fitRatio=0===e?l:0,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},hh={add:nh,addSpace(t){return this.insertSpace(void 0,t),this},insertSpace(t,e){return void 0===e&&(e=1),nh.call(this,new Qn(this.scene),{proportion:e,minWidth:0,minHeight:0,index:t}),this},insert(t,e,i,s,r,n,h,a){return eh(i)&&(i.index=t),nh.call(this,e,i,s,r,n,h,t,a),this},insertAtPosition(t,e,i,s,r,n,h,a,o){var l=th.call(this,t,e);return-1===l&&(l=void 0),this.insert(l,i,s,r,n,h,a,o),this}};const ah=Ot.prototype.clear;var oh=function(t){this.backgroundChildren&&(this.backgroundChildren.length=0);var e,i=!t&&this.sizerEventsEnable;if(i&&(e=this.getChildren([])),ah.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,oh.call(this,t),this}},ch={getChildAlign(t){return this.getSizerConfig(t).align},setChildAlign(t,e){return"string"==typeof e&&(e=zt[e]),this.getSizerConfig(t).align=e,this}},uh={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}},vh={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}},gh={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&&(Ye(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=this.sizerChildren,c=this.innerLeft,u=this.innerTop,p=this.innerWidth,v=this.innerHeight,g=c,f=u,m=this.startChildIndex,y=0,C=d.length;y0?(e=t-this.getChildrenWidth(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},resolveHeight:function(t){if(void 0!==(t=De.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)||Re.call(this)},runWidthWrap:function(t){this.wrapResult||(1===this.orientation&&Zn.call(this,t,void 0),Me.call(this,t))},hasHeightWrap:function(){return!(!this.hasRatioFitChild||0!==this.orientation)||Le.call(this)},runHeightWrap:function(t){this.wrapResult||(0===this.orientation&&Zn.call(this,void 0,t),ze.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(gh,hh,dh,ch,uh,ph,vh);var fh=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},mh={x:0,h:0,horizontal:0,"left-to-right":0,y:1,v:1,vertical:1,"top-to-bottom":1},yh=function(t){return"string"==typeof t&&(t=mh[t]),t};const Ch=Phaser.Utils.Objects.IsPlainObject,bh=Phaser.Utils.Objects.GetValue;class xh extends Jn{constructor(t,e,i,s,r,n,h){Ch(e)?(e=bh(h=e,"x",0),i=bh(h,"y",0),s=bh(h,"width",void 0),r=bh(h,"height",void 0),n=bh(h,"orientation",0)):Ch(s)?(s=bh(h=s,"width",void 0),r=bh(h,"height",void 0),n=bh(h,"orientation",0)):Ch(n)&&(n=bh(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(bh(h,"space.item",0)),this.setStartChildIndex(bh(h,"startChildIndex",0)),this.setRTL(bh(h,"rtl",!1)),this.addChildrenMap("items",this.sizerChildren)}setOrientation(t){return this.orientation=yh(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=fh.call(this)),this._childrenProportion}}Object.assign(xh.prototype,gh);var Sh=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=Ph[i])}void 0===s?s={}:!0===s&&(s=wh);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 Ph={fit:0,FIT:0,envelop:1,ENVELOP:1};var wh={},Th={},_h={};const Oh=Phaser.Utils.Objects.IsPlainObject,Eh=Phaser.Utils.Objects.GetValue,kh=Phaser.Display.Align.CENTER,Rh=Phaser.Utils.String.UUID;var Mh={add:function(t,e,i,s,r,n,h,a,o,l){ue.call(this,t),Oh(e)&&(e=Eh(d=e,"key",void 0),i=Eh(d,"align",kh),s=Eh(d,"padding",0),r=Eh(d,"expand",!0),t.isRexSizer||(n=Eh(d,"minWidth",t._minWidth),h=Eh(d,"minHeight",t._minHeighted)),a=Eh(d,"offsetX",0),o=Eh(d,"offsetY",0),l=Eh(d,"aspectRatio",0));var d,c=void 0!==e;return c||(e=Rh()),"string"==typeof i&&(i=zt[i]),void 0===i&&(i=kh),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===l?l=0:!0===l&&(l=Q(t)/tt(t)),l>0&&(r=!0,void 0===n&&(n=0),void 0===h&&(h=0)),(d=this.getSizerConfig(t)).align=i,d.padding=de(s),Oh(r)?(d.expandWidth=Eh(r,"width",!1),d.expandHeight=Eh(r,"height",!1)):(d.expandWidth=r,d.expandHeight=r),t.isRexSizer||(d.expandWidth&&(t.minWidth=void 0===n?Q(t):n),d.expandHeight&&(t.minHeight=void 0===h?tt(t):h)),d.alignOffsetX=a,d.alignOffsetY=o,d.aspectRatio=l,this.sizerChildren.hasOwnProperty(e)&&this.sizerChildren[e].destroy(),this.sizerChildren[e]=t,c&&this.addChildrenMap(e,t),this}},Dh={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]),Ce.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 oh.call(this,t),this}},Lh={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=this.innerLeft,c=this.innerTop,u=this.innerWidth,p=this.innerHeight,v=this.sizerChildren;for(var g in v)(t=v[g]).rexSizer.hidden||(i=(e=t.rexSizer).padding,or.call(this,t),a=this.getExpandedChildWidth(t),o=this.getExpandedChildHeight(t),e.aspectRatio>0&&(Th.width=e.aspectRatio,Th.height=1,_h.width=a,_h.height=o,a=(l=Sh(Th,_h,"FIT",!0)).width,o=l.height),t.isRexSizer?(t.runLayout(this,a,o),$n(t,this)):Ye(t,a,o),s=d+i.left*this.scaleX,n=u-(i.left+i.right)*this.scaleX,r=c+i.top*this.scaleY,h=p-(i.top+i.bottom)*this.scaleY,lr.call(this,t,s,r,n,h,e.align,e.alignOffsetX,e.alignOffsetY))}};Object.assign(Lh,Mh,Dh);const zh=Phaser.Utils.Objects.IsPlainObject,Ah=Phaser.Utils.Objects.GetValue;class Ih extends Jn{constructor(t,e,i,s,r,n){zh(e)?(e=Ah(n=e,"x",0),i=Ah(n,"y",0),s=Ah(n,"width",void 0),r=Ah(n,"height",void 0)):zh(s)&&(s=Ah(n=s,"width",void 0),r=Ah(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(Ih.prototype,Lh);const Fh=Phaser.Renderer.WebGL.Utils;var Xh={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=Fh.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 Yh=Phaser.Display.Color;var jh={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 Yh);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}},Nh={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 Wh=Phaser.Display.Canvas.CanvasPool,Uh=Phaser.GameObjects.GameObject,Bh=Phaser.Utils.String.UUID;let Hh=class extends Uh{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=Bh(),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 Vh=Phaser.GameObjects.Components;Phaser.Class.mixin(Hh,[Vh.Alpha,Vh.BlendMode,Vh.Crop,Vh.Depth,Vh.Flip,Vh.GetBounds,Vh.Mask,Vh.Origin,Vh.Pipeline,Vh.PostPipeline,Vh.ScrollFactor,Vh.Tint,Vh.Transform,Vh.Visible,Xh,jh,Nh]);var Gh={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 Jh extends Hh{}Object.assign(Jh.prototype,Gh);const $h=Phaser.Display.Color,qh=Phaser.Math.Percent,Zh=Phaser.Display.Color,Kh=Phaser.Math.Percent,Qh=Phaser.Display.Color.ColorToRGBA,ta=Phaser.Display.Color.HSVToRGB;class ea extends Jh{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 Zh,this.setOrientation(n),this.setSize(s,r)}setOrientation(t){return this.orientation=yh(t),this}updateTexture(){return function(t,e,i){void 0===i&&(i=!1);var s=t.width,r=t.height,n=new $h;if(i)for(var h=0;h>>16,a=(65280&r)>>>8,o=255&r;t.fillStyle="rgba("+h+","+a+","+o+","+n+")"}(r,e),r.fill()),e.isStroked&&(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}(r,e),r.stroke()),r.restore()}}};const oa=Phaser.GameObjects.Shape;class la extends oa{get fillColor(){return this._fillColor}set fillColor(t){this._fillColor=t,this.isFilled=null!=t&&this._fillAlpha>0}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(la.prototype,aa);const da=Phaser.Utils.Objects.GetValue;let ca=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=da(t,"x",0),i=da(t,"y",0));var s=this.cornerRadius;s.tl=ua(da(t,"tl",void 0),e,i),s.tr=ua(da(t,"tr",void 0),e,i),s.bl=ua(da(t,"bl",void 0),e,i),s.br=ua(da(t,"br",void 0),e,i)}get radiusTL(){var t=this.cornerRadius.tl;return Math.max(t.x,t.y)}set radiusTL(t){pa(this.cornerRadius.tl,t)}get radiusTR(){var t=this.cornerRadius.tr;return Math.max(t.x,t.y)}set radiusTR(t){pa(this.cornerRadius.tr,t)}get radiusBL(){var t=this.cornerRadius.bl;return Math.max(t.x,t.y)}set radiusBL(t){pa(this.cornerRadius.bl,t)}get radiusBR(){var t=this.cornerRadius.br;return Math.max(t.x,t.y)}set radiusBR(t){pa(this.cornerRadius.br,t)}};var ua=function(t,e,i){return void 0===t?t={x:e,y:i}:"number"==typeof t&&(t={x:t,y:t}),va(t),t},pa=function(t,e){"number"==typeof e?(t.x=e,t.y=e):(t.x=da(e,"x",0),t.y=da(e,"y",0)),va(t)},va=function(t){t.convex=t.x>=0||t.y>=0,t.x=Math.abs(t.x),t.y=Math.abs(t.y)},ga=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 fa=Phaser.Math.DegToRad;var ma=function(t,e,i,s,r,n,h,a,o){h&&n>r?n-=360:!h&&n0&&t.y>0};const Pa={rectangle:0,circle:1};var wa,Ta=Phaser.Math.RotateAround,_a=function(t,e,i,s){void 0===s?s={}:!0===s&&(void 0===wa&&(wa={}),s=wa),e-=t.width*t.originX,i-=t.height*t.originY;var r={x:e*t.scaleX,y:i*t.scaleY};return Ta(r,0,0,-t.rotation),s.x=t.x+e,s.y=t.y+i,s};class Oa extends Ih{constructor(t,e){void 0===e&&(e={}),super(t,e);var i=null!=e.width?1:0,s=new ea(t).setOrientation(i);t.add.existing(s),this.type="rexColorPicker.HPalette",s.setInteractive().on("pointerdown",this.onPaletteCanvasPointerDown,this).on("pointermove",this.onPaletteCanvasPointerDown,this);var r=new xa(t,{strokeColor:16777215,strokeWidth:2});t.add.existing(r),this.add(s,{key:"paletteCanvas",expand:!0}).add(r,{key:"marker",expand:!1})}resize(t,e){if(this.width===t&&this.height===e)return this;super.resize(t,e);var i=Math.min(t,e);return this.childrenMap.marker.setSize(i,i),this}onPaletteCanvasPointerDown(t,e,i,s){if(t.isDown){var r=this.childrenMap.paletteCanvas.getColor(e,i);this.setMarkerPosition(r),this.emit("input",r)}}get color(){return this.childrenMap.paletteCanvas.color}setColor(t){return this.color===t||(this.childrenMap.paletteCanvas.setColor(t),this.setMarkerPosition(t)),this}setMarkerPosition(t){var e=this.childrenMap.paletteCanvas,i=this.childrenMap.marker,s=e.colorToLocalPosition(t,!0);return _a(e,s.x,s.y,i),this.resetChildPositionState(i),this}getHue(t,e){return this.childrenMap.paletteCanvas.getHue(t,e)}}const Ea=Phaser.Display.Color,ka=Phaser.Math.Percent,Ra=Phaser.Display.Color.ColorToRGBA,Ma=Phaser.Display.Color.HSVToRGB;class Da extends Jh{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.SVPaletteCanvas",void 0===n&&(n=1),this.colorObject=new Ea,this.setHue(n),this.setSize(s,r)}get color(){return this.colorObject.color}get hue(){return this._hue}set hue(t){this._hue!==t&&(this._hue=t,this.colorObject.h=t,this.dirty=!0)}setHue(t){return this.hue=t,this}updateTexture(){return function(t,e,i){for(var s=t.width,r=t.height,n=e.getImageData(0,0,s,r),h=n.data,a=new $h,o=0;o=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 O={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=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},R={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},D={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}},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}},X=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 N={getChildren(t){if(t)for(var e=0,i=this.children.length;e=0;e--)this.remove(this.backgroundChildren[e],t);return this}},Pe=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 we=/(\S+)\[(\d+)\]/i,Te=Phaser.Utils.Objects.GetValue;var _e=function(t,e){return void 0===e?t:t[e]},Oe=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=Te(e,"left",0),t.right=Te(e,"right",0),t.top=Te(e,"top",0),t.bottom=Te(e,"bottom",0)),t},Ee={getInnerPadding(t){return _e(this.space,t)},setInnerPadding(t,e){return Oe(this.space,t,e),this},getOuterPadding(t){return _e(this.getSizerConfig(this).padding,t)},setOuterPadding(t,e){return Oe(this.getSizerConfig(this).padding,t,e),this},getChildOuterPadding(t,e){return"string"==typeof t&&(t=this.getElement(t)),_e(this.getSizerConfig(t).padding,e)},setChildOuterPadding(t,e,i){return"string"==typeof t&&(t=this.getElement(t)),Oe(this.getSizerConfig(t).padding,e,i),this}},ke=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}},Re=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},Me=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},De=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}},Le=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},ze=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},Ae={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?ui:ci,this.repeatCounter=0,this}stop(){return this.state=di,this}update(t,e){this.state!==di&&this.state!==vi&&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=pi)):(this.nowTime=this.duration,this.state=vi):this.nowTime>=0&&(this.state=ui))}get t(){var t;switch(this.state){case di:case ci:case pi:t=0;break;case ui:t=this.nowTime/this.duration;break;case vi:t=1}return oi(t,0,1)}set t(t){(t=oi(t,-1,1))<0?(this.state=ci,this.nowTime=-this.delay*t):(this.state=ui,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===di}get isDelay(){return this.state===ci}get isCountDown(){return this.state===ui}get isRunning(){return this.state===ci||this.state===ui}get isDone(){return this.state===vi}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}}const di=0,ci=1,ui=2,pi=3,vi=-1;class gi extends ni{constructor(t,e){super(t,e),this.timer=new li}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 fi=Phaser.Utils.Objects.GetValue,mi=Phaser.Utils.Objects.GetAdvancedValue,yi=Phaser.Tweens.Builders.GetEaseFunction;class Ci extends gi{resetFromJSON(t){return this.timer.resetFromJSON(fi(t,"timer")),this.setEnable(fi(t,"enable",!0)),this.setTarget(fi(t,"target",this.parent)),this.setDelay(mi(t,"delay",0)),this.setDuration(mi(t,"duration",1e3)),this.setEase(fi(t,"ease","Linear")),this.setRepeat(fi(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=yi(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 bi=Phaser.Utils.Objects.GetValue,xi=Phaser.Utils.Objects.GetAdvancedValue,Si=Phaser.Math.Linear;class Pi extends Ci{constructor(t,e){super(t,e),this.scaleStart={},this.scaleEnd={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(bi(t,"mode",0)),this.setScaleRange(xi(t,"start",void 0),xi(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=wi[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=Si(this.startX,this.endX,i)),this.hasScaleY&&(t.scaleY=Si(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const wi={stop:0,destroy:1,yoyo:2};var Ti=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 Pi(t,a):r.resetFromJSON(a),r.restart(),r},_i=function(t,e,i,s,r,n){void 0===s&&(s="Linear"),r instanceof Pi&&(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 Pi(t,h):n.resetFromJSON(h),n.restart(),n},Oi=function(t,e){return new Promise((function(i,s){t.once(e,(function(){i()}))}))},Ei=function(t){return Oi(t,"complete")};const ki=Phaser.Utils.Objects.IsPlainObject;var Ri={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(ki(t)){var s=t;t=s.duration,e=s.orientation,i=s.ease}var r=void 0===this._scaleBehavior;return this._scaleBehavior=Ti(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),Ei(this._scaleBehavior)},isRunningPopUp(){return this._scaleBehavior&&"popup.complete"===this._scaleBehavior.completeEventName},scaleDownDestroy(t,e,i,s){if(ki(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=_i(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),Ei(this._scaleBehavior)},scaleDown(t,e,i){return this.scaleDownDestroy(t,e,i,!1),this},scaleDownPromise(t,e,i){return this.scaleDown(t,e,i),Ei(this._scaleBehavior)},isRunningScaleDown(){return this._scaleBehavior&&"scaledown.complete"===this._scaleBehavior.completeEventName},scaleYoyo(t,e,i,s,r){if(ki(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 Pi(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),Ei(this._scaleBehavior)},isRunningScaleYoyo(){return this._scaleBehavior&&(this._scaleBehavior.completeEventName="scaleyoyo.complete")},isRunningEaseScale(){return this.isRunningPopUp()||this.isRunningScaleDown()||this.isRunningScaleYoyo()}},Mi={};Object.assign(Mi,Ri),Mi.onInitScale=function(){Ri.onInitScale.call(this);var t=this;this._scaleBehavior.on("update",(function(){var e=ge.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const Di=Phaser.Utils.Objects.GetValue,Li=Phaser.Utils.Objects.GetAdvancedValue,zi=Phaser.Math.Linear;class Ai extends Ci{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(Di(t,"mode",0)),this.setAlphaRange(Li(t,"start",this.parent.alpha),Li(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=zi(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 Xi=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 Ai(t,h):s.resetFromJSON(h),s.restart(),s},Yi=function(t,e,i,s){i instanceof Ai&&(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 Ai(t,r):s.resetFromJSON(r),s.restart(),s};const ji=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(ji(t)){var i=t;t=i.duration,e=i.alpha}var s=void 0===this._fade;return this._fade=Xi(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadein.complete",this},fadeInPromise(t,e){return this.fadeIn(t,e),Ei(this._fade)},isRunningFadeIn(){return this._fade&&"fadein.complete"===this._fade.completeEventName},fadeOutDestroy(t,e){if(ji(t)){var i=t;t=i.duration,e=i.destroy}var s=void 0===this._fade;return this._fade=Yi(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadeout.complete",this},fadeOutDestroyPromise(t,e){return this.fadeOutDestroy(t,e),Ei(this._fade)},fadeOut(t){return this.fadeOutDestroy(t,!1),this},fadeOutPromise(t){return this.fadeOut(t),Ei(this._fade)},isRunningFadeOut(){return this._fade&&"fadeout.complete"===this._fade.completeEventName},isRunningEaseFade(){return this.isRunningFadeIn()||this.isRunningFadeOut()}},Wi={};Object.assign(Wi,Ni),Wi.onInitFade=function(){Ni.onInitFade.call(this);var t=this;this._fade.on("update",(function(){var e=ge.getParentSizer(t);e&&e.resetChildAlphaState(t)}))};const Ui=Phaser.Utils.Objects.GetValue,Bi=Phaser.Utils.Objects.GetAdvancedValue,Hi=Phaser.Math.Linear;class Vi extends Ci{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){if(super.resetFromJSON(t),this.setMode(Ui(t,"mode",0)),t&&(t.hasOwnProperty("x")||t.hasOwnProperty("y"))){var e=Bi(t,"x",void 0),i=Bi(t,"y",void 0);this.setTargetPosition(e,i)}else this.setTargetPosition(t);return this}setMode(t){return"string"==typeof t&&(t=Gi[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=Bi(i,"startX",void 0),this.startY=Bi(i,"startY",void 0),this.endX=Bi(i,"endX",void 0),this.endY=Bi(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=Hi(this.startX,this.endX,i)),this.hasMoveY&&(t.y=Hi(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Gi={stop:0,destroy:1,yoyo:2};var Ji=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 $i=Phaser.Utils.Objects.IsPlainObject,qi=Phaser.Math.Distance.Between;var Zi={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($i(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*qi(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 Vi&&(h=n,n=void 0),void 0===n&&(n=!1);var a={};return a.mode=n?1:0,void 0!==i&&(a.startX=Ji(i,t.x),a.endX=t.x),void 0!==s&&(a.startY=Ji(s,t.y),a.endY=t.y),a.duration=e,a.ease=void 0===r?"Linear":r,void 0===h?h=new Vi(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),Ei(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),Ei(this._easeMove)},isRunningMoveFrom(){return this._easeMove&&(this._easeMove.completeEventName="movefrom.complete")},moveTo(t,e,i,s,r){if($i(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*qi(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 Vi&&(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=Ji(i,t.x)),void 0!==s&&(a.startY=t.y,a.endY=Ji(s,t.y)),a.duration=e,a.ease=void 0===r?"Linear":r,void 0===h?h=new Vi(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),Ei(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),Ei(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}},Ki={};Object.assign(Ki,Zi),Ki.onInitEaseMove=function(){Zi.onInitEaseMove.call(this);var t=this;this._easeMove.on("update",(function(){var e=ge.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const Qi=Phaser.Utils.Objects.GetValue;class ts extends ii{constructor(t,e){super(t,e),this.timer=new li,this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.timer.resetFromJSON(Qi(t,"timer")),this.setEnable(Qi(t,"enable",!0)),this.setMode(Qi(t,"mode",1)),this.isRunning=Qi(t,"isRunning",!1),this.setMagnitudeMode(Qi(t,"magnitudeMode",1)),this.setAxisMode(Qi(t,"axis",0)),this.setDuration(Qi(t,"duration",500)),this.setMagnitude(Qi(t,"magnitude",10)),this.ox=Qi(t,"ox",void 0),this.oy=Qi(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=es[t]),this.mode=t,this}setMagnitudeMode(t){return"string"==typeof t&&(t=ss[t]),this.magnitudeMode=t,this}setAxisMode(t){return"string"==typeof t&&(t=is[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=Qi(i,"magnitude",void 0),t=Qi(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 es={effect:0,behavior:1},is={both:0,"h&v":0,"x&y":0,horizontal:1,h:1,x:1,vertical:2,v:2,y:2},ss={constant:0,decay:1},rs=Phaser.Utils.Objects.IsPlainObject;var ns={shake(t,e,i){if(rs(t)){var s=t;t=s.duration,e=s.magnitude,i=s.magnitudeMode}return void 0===this._shake&&(this._shake=new ts(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),Ei(this._shake)}};const hs=Phaser.Utils.Objects.GetValue,as=Phaser.Math.Linear;class os extends Ci{constructor(t,e){super(t,e),this.resetFromJSON(),this.boot()}start(t){if(this.timer.isRunning)return this;var e=this.target;this.propertyKey=hs(t,"key","value");var i=e[this.propertyKey];return this.fromValue=hs(t,"from",i),this.toValue=hs(t,"to",i),this.setEase(hs(t,"ease",this.ease)),this.setDuration(hs(t,"duration",this.duration)),this.setRepeat(hs(t,"repeat",0)),this.setDelay(hs(t,"delay",0)),this.setRepeatDelay(hs(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]=as(this.fromValue,this.toValue,i)}}const ls=Phaser.Utils.Objects.IsPlainObject;class ds extends Ze{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 os(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(ls(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(ls(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 cs={easeDataTo(t,e,i,s){return this._easeData||(this._easeData=new ds(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),Oi(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}},us=Phaser.Utils.Array.Remove,ps={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 Es={delayCall(t,e,i){return this.delayCallTimer=function(t,e,i,s,r){var n=Ve(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}},ks={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}},Rs={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}},Ms={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}},Ds={};Object.assign(Ds,Es,ks,Rs,Ms);const Ls=Phaser.Utils.Objects.GetValue;class zs extends Ze{constructor(t,e){super(t,e),this.setTransitInTime(Ls(e,"duration.in",200)),this.setTransitOutTime(Ls(e,"duration.out",200)),this.setTransitInCallback(Ls(e,"transitIn")),this.setTransitOutCallback(Ls(e,"transitOut")),this.oneShotMode=Ls(e,"destroy",!1),this.delayCallTimer=void 0,this._state=new Os(this,{eventEmitter:!1,initState:Ls(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(zs.prototype,Ds);var As=function(t){if(t.parentContainer)return As(t.parentContainer);var e=function(t){var e=t.displayList;return G(e)?e:null}(t);return e?As(e):t};class Is extends Ze{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=As(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 Xs extends Fs{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 Ys=Phaser.Utils.Objects.GetValue;class js extends Ze{constructor(t,e){super(t,{eventEmitter:!1}),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setHitAreaMode(Ys(t,"hitAreaMode",0)),this.setEnable(Ys(t,"enable",!0)),this.setStopMode(Ys(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 Ws=Phaser.Utils.Objects.GetValue;class Us extends Xs{constructor(t,e){super(t,Ws(e,"color",0),Ws(e,"alpha",.8)),this.touchEventStop=new js(this,{hitAreaMode:1})}}var Bs={popUp(t,e){void 0!==t._modalScaleSave?(t.scaleX=t._modalScaleSave,t.scaleY=t._modalScaleSave):t._modalScaleSave=t.scaleX,Ti(t,e)},scaleDown(t,e){_i(t,e,void 0,void 0,!1)},fadeIn(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Xi(t,e)},fadeOut(t,e){Yi(t,e,!1)}},Hs=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Xi(t,e,t.alpha)},Vs=function(t,e){Yi(t,e,!1)},Gs=function(t,e,i,s,r){return!(!t||s&&!s(t,e,i)||!rt(t,!0).contains(e,i)||r&&!r(t,e,i))};const Js=Phaser.Utils.Objects.GetValue;let $s=class extends zs{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=qs.popUp),null==e.transitOut&&(e.transitOut=qs.scaleDown),e.destroy=Js(e,"destroy",!0),super(t,e);var i=Js(e,"cover");this.cover=!1!==i?function(t,e){var i=t.scene,s=new Us(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(Js(i,"transitIn",Hs)),this.setCoverTransitOutCallback(Js(i,"transitOut",Vs)));var s=Js(e,"touchOutsideClose",!1),r=Js(e,"duration.hold",-1),n=Js(e,"timeOutClose",r>=0),h=Js(e,"anyTouchClose",!1);Js(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),Js(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&&Gs(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=qs[t]),t){case qs.popUp:t=Bs.popUp;break;case qs.fadeIn:t=Bs.fadeIn}return super.setTransitInCallback(t),this}setTransitOutCallback(t){switch("string"==typeof t&&(t=qs[t]),t){case qs.scaleDown:t=Bs.scaleDown;break;case qs.fadeOut:t=Bs.fadeOut}return super.setTransitOutCallback(t),this}setCoverTransitInCallback(t){return this.coverTransitInCallback=t,this}setCoverTransitOutCallback(t){return this.coverTransitOutCallback=t,this}};const qs={popUp:0,fadeIn:1,scaleDown:0,fadeOut:1};var Zs=function(t){return t&&"function"==typeof t},Ks={modal(t,e){return Zs(t)&&(e=t,t=void 0),void 0===this._modalBehavior&&(this.onCreateModalBehavior&&this.onCreateModalBehavior(this,t),this._modalBehavior=function(t,e){var i=new $s(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}},Qs=function(t,e,i,s,r){Zs(e)&&(r=s,s=i,i=e,e=this);var n=this.scene.events;return this.bindEvent(e,n,t,i,s,r),this},tr={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 Qs.call(this,"preupdate",t,e,i,s),this},bindSceneUpdateEvent(t,e,i,s){return Qs.call(this,"update",t,e,i,s),this},bindScenePostupdateEvent(t,e,i,s){return Qs.call(this,"postupdate",t,e,i,s),this},bindSceneRenderEvent(t,e,i,s){return Qs.call(this,"render",t,e,i,s),this},bindScenePauseEvent(t,e,i,s){return Qs.call(this,"pause",t,e,i,s),this},bindSceneResumeEvent(t,e,i,s){return Qs.call(this,"resume",t,e,i,s),this},bindSceneSleepEvent(t,e,i,s){return Qs.call(this,"sleep",t,e,i,s),this},bindSceneWakeEvent(t,e,i,s){return Qs.call(this,"wake",t,e,i,s),this},bindSceneShutdownEvent(t,e,i,s){return Qs.call(this,"shutdown",t,e,i,s),this}},er=function(t,e,i){var s=t.camera;return s?(void 0===i?i={}:!0===i&&(i=ir),s===e?(i.x=t.worldX,i.y=t.worldY):s.getWorldPoint(t.x,t.y,i),i):null},ir={},sr=function(t,e,i,s){var r,n=t.scene.sys.cameras.main,h=0===t.scrollFactorX&&0===t.scrollFactorY;if(e)return h?Gs(t,e.x,e.y,i,s):!!(r=er(e,n,!0))&&Gs(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 vr={press:0,pointerdown:0,release:1,pointerup:1};var gr={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 pr(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}},fr=function(t,e,i,s,r){if(e)return!(i&&!i(t,e)||!mr(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 yr.length=0,!0;return yr.length=0,!1},yr=[];const Cr=Phaser.Utils.Objects.GetValue;class br extends Ze{constructor(t,e){super(t,e),this._enable=void 0;var i=Cr(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(Cr(t,"enable",!0)),this.setMode(Cr(t,"mode",1)),this.setClickInterval(Cr(t,"clickInterval",100)),this.setDragThreshold(Cr(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?fr:sr)(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 Sr={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 br(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 Pr extends _s{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 wr=Phaser.Utils.Objects.GetValue;class Tr extends Ze{constructor(t,e){super(t,e),this._enable=void 0,this.cooldown=new Pr,this.parent.setInteractive(wr(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.prevIsInTouch=!1,this.isInTouching=!1,this.setEnable(wr(t,"enable",!0)),this.setCooldown(wr(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 _r={isPointerInBounds(t){return void 0===t?t=this:"string"==typeof t&&(t=this.getElement(t)),!!t&&sr(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 Tr(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 Tr(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}},Or={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}},Er=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=Br,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===Hr&&this.onDragEnd(),this.pointer=void 0,this.tracerState=Br,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=Vr,this}isPointerInGameObject(t,e,i){var s=this.lastPointer;return!!s&&sr(t,s,e,i)}}const Br=0,Hr=1,Vr="IDLE",Gr=Phaser.Utils.Objects.GetValue,Jr=Phaser.Math.Distance.Between;class $r extends Ur{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=qr},eventEmitter:!1};this.setRecongizedStateObject(new _s(s))}resetFromJSON(t){super.resetFromJSON(t),this.setHoldTime(Gr(t,"time",250)),this.setTapInterval(Gr(t,"tapInterval",200)),this.setDragThreshold(Gr(t,"threshold",9)),this.setTapOffset(Gr(t,"tapOffset",10));var e=Gr(t,"taps",void 0);return void 0!==e?this.setTaps(e):(this.setMaxTaps(Gr(t,"maxTaps",void 0)),this.setMinTaps(Gr(t,"minTaps",void 0))),this}onDragStart(){switch(this.state){case qr:this.state=Zr;break;case Zr:var t=this.lastPointer;Jr(t.upX,t.upY,t.x,t.y)>this.tapOffset&&(this.state=Kr,this.state=Zr);break;case Kr:this.state=Zr}}onDragEnd(){this.state===Zr&&(this.tapsCount++,this.emit("tapping",this,this.gameObject,this.lastPointer),void 0!==this.maxTaps&&this.tapsCount===this.maxTaps&&(this.state=Kr))}onDrag(){this.state!==qr&&this.pointer.getDistance()>this.dragThreshold&&(this.state=qr)}preUpdate(t,e){if(this.isRunning&&this.enable&&this.state===Zr){var i=this.lastPointer;i.isDown?t-i.downTime>this.holdTime&&(this.state=qr):t-i.upTime>this.tapInterval&&(void 0===this.minTaps||this.tapsCount>=this.minTaps?this.state=Kr:this.state=qr)}}postUpdate(t,e){this.isRunning&&this.enable&&this.state===Kr&&(this.state=qr)}get isTapped(){return this.state===Kr}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 qr="IDLE",Zr="BEGIN",Kr="RECOGNIZED",Qr=Phaser.Utils.Objects.GetValue;class tn extends Ur{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=en},eventEmitter:!1};this.setRecongizedStateObject(new _s(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(Qr(t,"threshold",9)),this.setHoldTime(Qr(t,"time",251)),this}onDragStart(){this.state=sn,0===this.holdTime&&(this.state=rn)}onDragEnd(){this.state=en}onDrag(){this.state!==en&&this.pointer.getDistance()>this.dragThreshold&&(this.state=en)}preUpdate(t,e){this.isRunning&&this.enable&&this.state===sn&&t-this.pointer.downTime>=this.holdTime&&(this.state=rn)}get isPressed(){return this.state===rn}setHoldTime(t){return this.holdTime=t,this}setDragThreshold(t){return this.dragThreshold=t,this}}const en="IDLE",sn="BEGIN",rn="RECOGNIZED";Phaser.Utils.Objects.GetValue;const nn=Phaser.Math.Distance.Between,hn=Phaser.Math.Angle.Between;var an={getDt:function(){var t;return t=this.scene,$e(t).loop.delta},getVelocity:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return nn(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 hn(e.x,e.y,t.x,t.y)}},on={"up&down":0,"left&right":1,"4dir":2,"8dir":3},ln={};const dn=Phaser.Utils.Objects.GetValue,cn=Phaser.Math.RadToDeg;class un extends Ur{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=pn},eventEmitter:!1};this.setRecongizedStateObject(new _s(s)),this.clearDirectionStates()}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(dn(t,"threshold",10)),this.setVelocityThreshold(dn(t,"velocityThreshold",1e3)),this.setDirectionMode(dn(t,"dir","8dir")),this}onDragStart(){this.state=vn}onDragEnd(){this.state=pn}onDrag(){this.state===vn&&(this.validDrag||(this.validDrag=0===this.dragThreshold||this.pointer.getDistance()>=this.dragThreshold),this.validDrag&&this.dragVelocity>this.velocityThreshold&&(this.state=gn))}postUpdate(t,e){this.isRunning&&this.enable&&this.state===gn&&(this.state=pn)}get isSwiped(){return this.state===gn}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=on[t]),this.dirMode=t,this}updateDirectionStates(){return function(t,e,i){switch(void 0===i?i={}:!0===i&&(i=ln),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(un.prototype,an);const pn="IDLE",vn="BEGIN",gn="RECOGNIZED",fn=Phaser.Utils.Objects.GetValue,mn=Phaser.Utils.Array.SpliceOne,yn=Phaser.Math.Distance.Between,Cn=Phaser.Math.Angle.Between;class bn{constructor(t,e){var i=Ve(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(fn(e,"inputConfig",void 0)),this.setEventEmitter(fn(e,"eventEmitter",void 0)),this._enable=void 0,this.pointers=[],this.movedState={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setEnable(fn(t,"enable",!0)),this.bounds=fn(t,"bounds",void 0),this.tracerState=Sn,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 Sn:this.tracerState=Pn,this.onDrag1Start();break;case Pn:this.tracerState=wn,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],mn(this.pointers,e),this.tracerState){case Pn:this.tracerState=Sn,this.onDrag1End();break;case wn:this.tracerState=Pn,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 Pn:this.onDrag1();break;case wn:this.onDrag2()}}}dragCancel(){return this.tracerState===wn&&this.onDrag2End(),this.pointers.length=0,gt(this.movedState),this.tracerState=Sn,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!==wn)return 0;var t=this.pointers[0],e=this.pointers[1];return yn(t.x,t.y,e.x,e.y)}get angleBetween(){if(this.tracerState!==wn)return 0;var t=this.pointers[0],e=this.pointers[1];return Cn(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!==wn)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.x+e.x)/2}get centerY(){if(this.tracerState!==wn)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.y+e.y)/2}get prevCenterX(){if(this.tracerState!==wn)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!==wn)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=Tn,this}isPointer0InGameObject(t,e,i){var s=this.pointers[0];return!!s&&sr(t,s,e,i)}isPointer1InGameObject(t,e,i){var s=this.pointers[1];return!!s&&sr(t,s,e,i)}}Object.assign(bn.prototype,Ue);var xn={};const Sn=0,Pn=1,wn=2,Tn="IDLE";Phaser.Utils.Objects.GetValue;const _n=Phaser.Math.RotateAround;var On=function(t,e,i,s){return _n(t,e,i,s),t.rotation+=s,t},En={};const kn=Phaser.Utils.Objects.GetValue,Rn=Phaser.Math.Angle.WrapDegrees,Mn=Phaser.Math.Angle.ShortestBetween,Dn=Phaser.Math.RadToDeg,Ln=Phaser.Math.DegToRad;var zn={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=En),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=Rn(Dn(this.angleBetween));this.angle=Mn(this.prevAngle,t),this.prevAngle=t,this.state=Fn}break;case Fn:t=Rn(Dn(this.angleBetween)),this.angle=Mn(this.prevAngle,t),this.prevAngle=t,this.emit("rotate",this)}}get isRotated(){return this.state===Fn}get rotation(){return Ln(this.angle)}setDragThreshold(t){return this.dragThreshold=t,this}}.prototype,zn);const An="IDLE",In="BEGIN",Fn="RECOGNIZED",Xn=Phaser.Utils.Objects.GetValue;var Yn=function(t){var e=Xn(t,"tap",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._tap=new $r(this,e),this._tap.on("tap",(function(t,e,s){kr(i.eventEmitter,`${i.eventNamePrefix}${t.tapsCount}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const jn=Phaser.Utils.Objects.GetValue;var Nn=function(t){var e=jn(t,"press",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._press=new tn(this,e),this._press.on("pressstart",(function(t,e,s){kr(i.eventEmitter,`${i.eventNamePrefix}pressstart`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this).on("pressend",(function(t,e,s){kr(i.eventEmitter,`${i.eventNamePrefix}pressend`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Wn=Phaser.Utils.Objects.GetValue;var Un=function(t){var e=Wn(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 un(this,e),this._swipe.on("swipe",(function(t,e,s){var r=t.left?"left":t.right?"right":t.up?"up":"down";kr(i.eventEmitter,`${i.eventNamePrefix}swipe${r}`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Bn=Phaser.Utils.Objects.GetValue;var Hn=function(t,e){return t.setInteractive(),Bn(e,"dropZone",!1)&&(t.input.dropZone=!0),t._childrenInteractive={targetSizers:Bn(e,"targets",[t]),targetMode:Bn(e,"targetMode","parent"),eventEmitter:Bn(e,"eventEmitter",t),eventNamePrefix:Bn(e,"inputEventPrefix","child.")},Mr.call(t,e),zr.call(t,e),Fr.call(t,e),Nr.call(t,e),Yn.call(t,e),Nn.call(t,e),Un.call(t,e),t},Vn={getSizerConfig:function(t){return void 0===t&&(t=this),Et(t)},getChildPrevState:function(t){var e=Et(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,h,a=t.scene;if("number"==typeof e)i=e;else{i=ne(e,"color"),s=ne(e,"lineWidth");var o=ne(e,"name",!1);o&&(r=ne(o,"createTextCallback",ae),n=ne(o,"createTextCallbackScope",void 0),"string"==typeof(h=ne(o,"align","left-top"))&&(h=zt[h]))}if(void 0===i&&(i=16777215),void 0===s&&(s=1),r&&!t.children){t.children=new he(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)}}for(var d,c,u=this.getAllShownChildren([this]),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 eh=Phaser.Utils.Objects.IsPlainObject,ih=Phaser.Utils.Objects.GetValue,sh=Phaser.Display.Align.CENTER,rh={min:0,full:-1};var nh=function(t,e,i,s,r,n,h,a,o,l){ue.call(this,t);var d=t.isRexSpace,c=typeof e;if(null===e)return this;if("number"===c);else if("string"===c)e=rh[e];else if(eh(e)){var u;e=ih(u=e,"proportion",void 0),i=ih(u,"align",sh),s=ih(u,"padding",0),r=ih(u,"expand",!1),n=ih(u,"key",void 0),h=ih(u,"index",void 0),t.isRexSizer||(a=ih(u,"minWidth",void 0),o=ih(u,"minHeight",void 0)),l=ih(u,"fitRatio",0)}return"string"==typeof i&&(i=zt[i]),void 0===e&&(e=d?1:0),void 0===i&&(i=sh),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===a&&(d?a=0:t.isRexSizer||(a=t._minWidth)),void 0===o&&(d?o=0:t.isRexSizer||(o=t._minHeight)),void 0===l||!1===l?l=0:!0===l&&(l=Q(t)/tt(t)),(u=this.getSizerConfig(t)).proportion=e,u.align=i,u.padding=de(s),u.expand=r,u.fitRatio=0===e?l:0,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},hh={add:nh,addSpace(t){return this.insertSpace(void 0,t),this},insertSpace(t,e){return void 0===e&&(e=1),nh.call(this,new Qn(this.scene),{proportion:e,minWidth:0,minHeight:0,index:t}),this},insert(t,e,i,s,r,n,h,a){return eh(i)&&(i.index=t),nh.call(this,e,i,s,r,n,h,t,a),this},insertAtPosition(t,e,i,s,r,n,h,a,o){var l=th.call(this,t,e);return-1===l&&(l=void 0),this.insert(l,i,s,r,n,h,a,o),this}};const ah=Ot.prototype.clear;var oh=function(t){this.backgroundChildren&&(this.backgroundChildren.length=0);var e,i=!t&&this.sizerEventsEnable;if(i&&(e=this.getChildren([])),ah.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,oh.call(this,t),this}},ch={getChildAlign(t){return this.getSizerConfig(t).align},setChildAlign(t,e){return"string"==typeof e&&(e=zt[e]),this.getSizerConfig(t).align=e,this}},uh={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}},vh={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}},gh={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&&(Ye(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=this.sizerChildren,c=this.innerLeft,u=this.innerTop,p=this.innerWidth,v=this.innerHeight,g=c,f=u,m=this.startChildIndex,y=0,C=d.length;y0?(e=t-this.getChildrenWidth(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},resolveHeight:function(t){if(void 0!==(t=De.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)||Re.call(this)},runWidthWrap:function(t){this.wrapResult||(1===this.orientation&&Zn.call(this,t,void 0),Me.call(this,t))},hasHeightWrap:function(){return!(!this.hasRatioFitChild||0!==this.orientation)||Le.call(this)},runHeightWrap:function(t){this.wrapResult||(0===this.orientation&&Zn.call(this,void 0,t),ze.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(gh,hh,dh,ch,uh,ph,vh);var fh=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},mh={x:0,h:0,horizontal:0,"left-to-right":0,y:1,v:1,vertical:1,"top-to-bottom":1},yh=function(t){return"string"==typeof t&&(t=mh[t]),t};const Ch=Phaser.Utils.Objects.IsPlainObject,bh=Phaser.Utils.Objects.GetValue;class xh extends Jn{constructor(t,e,i,s,r,n,h){Ch(e)?(e=bh(h=e,"x",0),i=bh(h,"y",0),s=bh(h,"width",void 0),r=bh(h,"height",void 0),n=bh(h,"orientation",0)):Ch(s)?(s=bh(h=s,"width",void 0),r=bh(h,"height",void 0),n=bh(h,"orientation",0)):Ch(n)&&(n=bh(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(bh(h,"space.item",0)),this.setStartChildIndex(bh(h,"startChildIndex",0)),this.setRTL(bh(h,"rtl",!1)),this.addChildrenMap("items",this.sizerChildren)}setOrientation(t){return this.orientation=yh(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=fh.call(this)),this._childrenProportion}}Object.assign(xh.prototype,gh);var Sh=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=Ph[i])}void 0===s?s={}:!0===s&&(s=wh);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 Ph={fit:0,FIT:0,envelop:1,ENVELOP:1};var wh={},Th={},_h={};const Oh=Phaser.Utils.Objects.IsPlainObject,Eh=Phaser.Utils.Objects.GetValue,kh=Phaser.Display.Align.CENTER,Rh=Phaser.Utils.String.UUID;var Mh={add:function(t,e,i,s,r,n,h,a,o,l){ue.call(this,t),Oh(e)&&(e=Eh(d=e,"key",void 0),i=Eh(d,"align",kh),s=Eh(d,"padding",0),r=Eh(d,"expand",!0),t.isRexSizer||(n=Eh(d,"minWidth",t._minWidth),h=Eh(d,"minHeight",t._minHeighted)),a=Eh(d,"offsetX",0),o=Eh(d,"offsetY",0),l=Eh(d,"aspectRatio",0));var d,c=void 0!==e;return c||(e=Rh()),"string"==typeof i&&(i=zt[i]),void 0===i&&(i=kh),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===l?l=0:!0===l&&(l=Q(t)/tt(t)),l>0&&(r=!0,void 0===n&&(n=0),void 0===h&&(h=0)),(d=this.getSizerConfig(t)).align=i,d.padding=de(s),Oh(r)?(d.expandWidth=Eh(r,"width",!1),d.expandHeight=Eh(r,"height",!1)):(d.expandWidth=r,d.expandHeight=r),t.isRexSizer||(d.expandWidth&&(t.minWidth=void 0===n?Q(t):n),d.expandHeight&&(t.minHeight=void 0===h?tt(t):h)),d.alignOffsetX=a,d.alignOffsetY=o,d.aspectRatio=l,this.sizerChildren.hasOwnProperty(e)&&this.sizerChildren[e].destroy(),this.sizerChildren[e]=t,c&&this.addChildrenMap(e,t),this}},Dh={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]),Ce.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 oh.call(this,t),this}},Lh={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=this.innerLeft,c=this.innerTop,u=this.innerWidth,p=this.innerHeight,v=this.sizerChildren;for(var g in v)(t=v[g]).rexSizer.hidden||(i=(e=t.rexSizer).padding,or.call(this,t),a=this.getExpandedChildWidth(t),o=this.getExpandedChildHeight(t),e.aspectRatio>0&&(Th.width=e.aspectRatio,Th.height=1,_h.width=a,_h.height=o,a=(l=Sh(Th,_h,"FIT",!0)).width,o=l.height),t.isRexSizer?(t.runLayout(this,a,o),$n(t,this)):Ye(t,a,o),s=d+i.left*this.scaleX,n=u-(i.left+i.right)*this.scaleX,r=c+i.top*this.scaleY,h=p-(i.top+i.bottom)*this.scaleY,lr.call(this,t,s,r,n,h,e.align,e.alignOffsetX,e.alignOffsetY))}};Object.assign(Lh,Mh,Dh);const zh=Phaser.Utils.Objects.IsPlainObject,Ah=Phaser.Utils.Objects.GetValue;class Ih extends Jn{constructor(t,e,i,s,r,n){zh(e)?(e=Ah(n=e,"x",0),i=Ah(n,"y",0),s=Ah(n,"width",void 0),r=Ah(n,"height",void 0)):zh(s)&&(s=Ah(n=s,"width",void 0),r=Ah(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(Ih.prototype,Lh);const Fh=Phaser.Renderer.WebGL.Utils;var Xh={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=Fh.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 Yh=Phaser.Display.Color;var jh={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 Yh);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}},Nh={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 Wh=Phaser.Display.Canvas.CanvasPool,Uh=Phaser.GameObjects.GameObject,Bh=Phaser.Utils.String.UUID;let Hh=class extends Uh{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=Bh(),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 Vh=Phaser.GameObjects.Components;Phaser.Class.mixin(Hh,[Vh.Alpha,Vh.BlendMode,Vh.Crop,Vh.Depth,Vh.Flip,Vh.GetBounds,Vh.Mask,Vh.Origin,Vh.Pipeline,Vh.PostPipeline,Vh.ScrollFactor,Vh.Tint,Vh.Transform,Vh.Visible,Xh,jh,Nh]);var Gh={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 Jh extends Hh{}Object.assign(Jh.prototype,Gh);const $h=Phaser.Display.Color,qh=Phaser.Math.Percent,Zh=Phaser.Display.Color,Kh=Phaser.Math.Percent,Qh=Phaser.Display.Color.ColorToRGBA,ta=Phaser.Display.Color.HSVToRGB;class ea extends Jh{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 Zh,this.setOrientation(n),this.setSize(s,r)}setOrientation(t){return this.orientation=yh(t),this}updateTexture(){return function(t,e,i){void 0===i&&(i=!1);var s=t.width,r=t.height,n=new $h;if(i)for(var h=0;h>>16,a=(65280&r)>>>8,o=255&r;t.fillStyle="rgba("+h+","+a+","+o+","+n+")"}(r,e),r.fill()),e.isStroked&&(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}(r,e),r.stroke()),r.restore()}}};const oa=Phaser.GameObjects.Shape;class la extends oa{get fillColor(){return this._fillColor}set fillColor(t){this._fillColor=t,this.isFilled=null!=t&&this._fillAlpha>0}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(la.prototype,aa);const da=Phaser.Utils.Objects.GetValue;let ca=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=da(t,"x",0),i=da(t,"y",0));var s=this.cornerRadius;s.tl=ua(da(t,"tl",void 0),e,i),s.tr=ua(da(t,"tr",void 0),e,i),s.bl=ua(da(t,"bl",void 0),e,i),s.br=ua(da(t,"br",void 0),e,i)}get radiusTL(){var t=this.cornerRadius.tl;return Math.max(t.x,t.y)}set radiusTL(t){pa(this.cornerRadius.tl,t)}get radiusTR(){var t=this.cornerRadius.tr;return Math.max(t.x,t.y)}set radiusTR(t){pa(this.cornerRadius.tr,t)}get radiusBL(){var t=this.cornerRadius.bl;return Math.max(t.x,t.y)}set radiusBL(t){pa(this.cornerRadius.bl,t)}get radiusBR(){var t=this.cornerRadius.br;return Math.max(t.x,t.y)}set radiusBR(t){pa(this.cornerRadius.br,t)}};var ua=function(t,e,i){return void 0===t?t={x:e,y:i}:"number"==typeof t&&(t={x:t,y:t}),va(t),t},pa=function(t,e){"number"==typeof e?(t.x=e,t.y=e):(t.x=da(e,"x",0),t.y=da(e,"y",0)),va(t)},va=function(t){t.convex=t.x>=0||t.y>=0,t.x=Math.abs(t.x),t.y=Math.abs(t.y)},ga=function(t){return t.x>0&&t.y>0},fa=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 ma=Phaser.Math.DegToRad;var ya=function(t,e,i,s,r,n,h,a,o){h&&n>r?n-=360:!h&&n 0) && (radius.y > 0)); + }; + var LineTo = function (x, y, pathData) { var cnt = pathData.length; if (cnt >= 2) { @@ -23129,8 +23133,7 @@ geom.setTo(0, 0, width, height, radius); } - var iteration = GetValue$w(radiusConfig, 'iteration', undefined); - this.setIteration(iteration); + this.setIteration(GetValue$w(radiusConfig, 'iteration', undefined)); this.setPosition(x, y); this.setFillStyle(fillColor, fillAlpha); @@ -23383,10 +23386,6 @@ } - var IsArcCorner = function (radius) { - return ((radius.x > 0) && (radius.y > 0)); - }; - const ShapeTypeMap = { rectangle: 0, circle: 1 @@ -24900,6 +24899,7 @@ var skewX = this.skewX; var width = this.width - Math.abs(skewX); var height = this.height; + var trackFill = this.getShape('trackFill'); trackFill.fillStyle(this.trackColor); if (trackFill.isFilled) { @@ -24908,8 +24908,7 @@ 0, 0, // x0, y0 width, height, // x1, y1 skewX // skewX - ) - .close(); + ); } var bar = this.getShape('bar'); @@ -24929,8 +24928,7 @@ barX0, 0, // x0, y0 barX1, height, // x1, y1 skewX // skew - ) - .close(); + ); } var trackStroke = this.getShape('trackStroke'); @@ -24941,8 +24939,7 @@ 0, 0, // x0, y0 width, height, // x1, y1 skewX // skewX - ) - .end(); + ); } }; @@ -24962,6 +24959,8 @@ .lineTo(x0, y0).lineTo(startX, y0); } + lines.close(); + return lines; }; @@ -24972,24 +24971,33 @@ constructor(scene, x, y, width, height, barColor, value, config) { if (IsPlainObject$6(x)) { config = x; - x = GetValue$t(config, 'x', 0); - y = GetValue$t(config, 'y', 0); - width = GetValue$t(config, 'width', 2); - height = GetValue$t(config, 'height', 2); - barColor = GetValue$t(config, 'barColor', undefined); - value = GetValue$t(config, 'value', 0); + + x = config.x; + y = config.y; + width = config.width; + height = config.height; + barColor = config.barColor; + value = config.value; } else if (IsPlainObject$6(width)) { config = width; - width = GetValue$t(config, 'width', 2); - height = GetValue$t(config, 'height', 2); - barColor = GetValue$t(config, 'barColor', undefined); - value = GetValue$t(config, 'value', 0); + + width = config.width; + height = config.height; + barColor = config.barColor; + value = config.value; } else if (IsPlainObject$6(barColor)) { config = barColor; - barColor = GetValue$t(config, 'barColor', undefined); - value = GetValue$t(config, 'value', 0); + + barColor = config.barColor; + value = config.value; } + if (x === undefined) { x = 0; } + if (y === undefined) { y = 0; } + if (width === undefined) { width = 2; } + if (height === undefined) { height = width; } + if (value === undefined) { value = 0; } + super(scene, x, y, width, height, config); this.type = 'rexLineProgress'; diff --git a/dist/rexconfirmdialog.min.js b/dist/rexconfirmdialog.min.js index 83872b47cd..2ccff645fe 100644 --- a/dist/rexconfirmdialog.min.js +++ b/dist/rexconfirmdialog.min.js @@ -1,4 +1,4 @@ -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}},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}},Pe=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 _e=/(\S+)\[(\d+)\]/i,Te=Phaser.Utils.Objects.GetValue;var ke=function(t,e){return void 0===e?t:t[e]},Ee=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=Te(e,"left",0),t.right=Te(e,"right",0),t.top=Te(e,"top",0),t.bottom=Te(e,"bottom",0)),t},Me={getInnerPadding(t){return ke(this.space,t)},setInnerPadding(t,e){return Ee(this.space,t,e),this},getOuterPadding(t){return ke(this.getSizerConfig(this).padding,t)},setOuterPadding(t,e){return Ee(this.getSizerConfig(this).padding,t,e),this},getChildOuterPadding(t,e){return"string"==typeof t&&(t=this.getElement(t)),ke(this.getSizerConfig(t).padding,e)},setChildOuterPadding(t,e,i){return"string"==typeof t&&(t=this.getElement(t)),Ee(this.getSizerConfig(t).padding,e,i),this}},Re=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}},Le=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},De=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},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},Be={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}},We=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?vi:pi,this.repeatCounter=0,this}stop(){return this.state=ui,this}update(t,e){this.state!==ui&&this.state!==fi&&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=gi)):(this.nowTime=this.duration,this.state=fi):this.nowTime>=0&&(this.state=vi))}get t(){var t;switch(this.state){case ui:case pi:case gi:t=0;break;case vi:t=this.nowTime/this.duration;break;case fi:t=1}return di(t,0,1)}set t(t){(t=di(t,-1,1))<0?(this.state=pi,this.nowTime=-this.delay*t):(this.state=vi,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===ui}get isDelay(){return this.state===pi}get isCountDown(){return this.state===vi}get isRunning(){return this.state===pi||this.state===vi}get isDone(){return this.state===fi}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}}const ui=0,pi=1,vi=2,gi=3,fi=-1;class mi extends ai{constructor(t,e){super(t,e),this.timer=new ci}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 yi=Phaser.Utils.Objects.GetValue,bi=Phaser.Utils.Objects.GetAdvancedValue,xi=Phaser.Tweens.Builders.GetEaseFunction;class Si extends mi{resetFromJSON(t){return this.timer.resetFromJSON(yi(t,"timer")),this.setEnable(yi(t,"enable",!0)),this.setTarget(yi(t,"target",this.parent)),this.setDelay(bi(t,"delay",0)),this.setDuration(bi(t,"duration",1e3)),this.setEase(yi(t,"ease","Linear")),this.setRepeat(yi(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 Ci=Phaser.Utils.Objects.GetValue,wi=Phaser.Utils.Objects.GetAdvancedValue,Oi=Phaser.Math.Linear;let Pi=class extends Si{constructor(t,e){super(t,e),this.scaleStart={},this.scaleEnd={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(Ci(t,"mode",0)),this.setScaleRange(wi(t,"start",void 0),wi(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=_i[t]),this.mode=t,this}setScaleRange(t,e){return"number"==typeof t?(this.startX=t,this.startY=t):(this.startX=wi(t,"x",this.parent.scaleX),this.startY=wi(t,"y",this.parent.scaleY)),"number"==typeof e?(this.endX=e,this.endY=e):(this.endX=wi(e,"x",void 0),this.endY=wi(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 _i={stop:0,destroy:1,yoyo:2};var Ti=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 Pi(t,a):r.resetFromJSON(a),r.restart(),r},ki=function(t,e,i,s,r,n){void 0===s&&(s="Linear"),r instanceof Pi&&(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 Pi(t,h):n.resetFromJSON(h),n.restart(),n},Ei=function(t,e){return new Promise((function(i,s){t.once(e,(function(){i()}))}))},Mi=function(t){return Ei(t,"complete")};const Ri=Phaser.Utils.Objects.IsPlainObject;var Li={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(Ri(t)){var s=t;t=s.duration,e=s.orientation,i=s.ease}var r=void 0===this._scaleBehavior;return this._scaleBehavior=Ti(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(Ri(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=ki(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(Ri(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 Pi(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),Mi(this._scaleBehavior)},isRunningScaleYoyo(){return this._scaleBehavior&&(this._scaleBehavior.completeEventName="scaleyoyo.complete")},isRunningEaseScale(){return this.isRunningPopUp()||this.isRunningScaleDown()||this.isRunningScaleYoyo()}},Di={};Object.assign(Di,Li),Di.onInitScale=function(){Li.onInitScale.call(this);var t=this;this._scaleBehavior.on("update",(function(){var e=me.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const zi=Phaser.Utils.Objects.GetValue,Ai=Phaser.Utils.Objects.GetAdvancedValue,Yi=Phaser.Math.Linear;class Bi extends Si{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=Wi[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 Wi={stop:0,destroy:1,yoyo:2},Xi=Phaser.Utils.Objects.IsPlainObject;var ji=function(t,e,i,s){var r,n;Xi(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 Bi(t,h):s.resetFromJSON(h),s.restart(),s},Ii=function(t,e,i,s){i instanceof Bi&&(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 Bi(t,r):s.resetFromJSON(r),s.restart(),s};const Fi=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(Fi(t)){var i=t;t=i.duration,e=i.alpha}var s=void 0===this._fade;return this._fade=ji(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(Fi(t)){var i=t;t=i.duration,e=i.destroy}var s=void 0===this._fade;return this._fade=Ii(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()}},Ni={};Object.assign(Ni,Hi),Ni.onInitFade=function(){Hi.onInitFade.call(this);var t=this;this._fade.on("update",(function(){var e=me.getParentSizer(t);e&&e.resetChildAlphaState(t)}))};const Gi=Phaser.Utils.Objects.GetValue,Vi=Phaser.Utils.Objects.GetAdvancedValue,Ui=Phaser.Math.Linear;class $i extends Si{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){if(super.resetFromJSON(t),this.setMode(Gi(t,"mode",0)),t&&(t.hasOwnProperty("x")||t.hasOwnProperty("y"))){var e=Vi(t,"x",void 0),i=Vi(t,"y",void 0);this.setTargetPosition(e,i)}else this.setTargetPosition(t);return this}setMode(t){return"string"==typeof t&&(t=Ji[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=Vi(i,"startX",void 0),this.startY=Vi(i,"startY",void 0),this.endX=Vi(i,"endX",void 0),this.endY=Vi(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=Ui(this.startX,this.endX,i)),this.hasMoveY&&(t.y=Ui(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Ji={stop:0,destroy:1,yoyo:2};var Ki=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,Zi=Phaser.Math.Distance.Between;var Qi={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*Zi(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 $i&&(h=n,n=void 0),void 0===n&&(n=!1);var a={};return a.mode=n?1:0,void 0!==i&&(a.startX=Ki(i,t.x),a.endX=t.x),void 0!==s&&(a.startY=Ki(s,t.y),a.endY=t.y),a.duration=e,a.ease=void 0===r?"Linear":r,void 0===h?h=new $i(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),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*Zi(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 $i&&(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=Ki(i,t.x)),void 0!==s&&(a.startY=t.y,a.endY=Ki(s,t.y)),a.duration=e,a.ease=void 0===r?"Linear":r,void 0===h?h=new $i(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),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}},ts={};Object.assign(ts,Qi),ts.onInitEaseMove=function(){Qi.onInitEaseMove.call(this);var t=this;this._easeMove.on("update",(function(){var e=me.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const es=Phaser.Utils.Objects.GetValue;class is extends ri{constructor(t,e){super(t,e),this.timer=new ci,this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.timer.resetFromJSON(es(t,"timer")),this.setEnable(es(t,"enable",!0)),this.setMode(es(t,"mode",1)),this.isRunning=es(t,"isRunning",!1),this.setMagnitudeMode(es(t,"magnitudeMode",1)),this.setAxisMode(es(t,"axis",0)),this.setDuration(es(t,"duration",500)),this.setMagnitude(es(t,"magnitude",10)),this.ox=es(t,"ox",void 0),this.oy=es(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=ss[t]),this.mode=t,this}setMagnitudeMode(t){return"string"==typeof t&&(t=ns[t]),this.magnitudeMode=t,this}setAxisMode(t){return"string"==typeof t&&(t=rs[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=es(i,"magnitude",void 0),t=es(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 ss={effect:0,behavior:1},rs={both:0,"h&v":0,"x&y":0,horizontal:1,h:1,x:1,vertical:2,v:2,y:2},ns={constant:0,decay:1},hs=Phaser.Utils.Objects.IsPlainObject;var as={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 is(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 os=Phaser.Utils.Objects.GetValue,ls=Phaser.Math.Linear;class ds extends Si{constructor(t,e){super(t,e),this.resetFromJSON(),this.boot()}start(t){if(this.timer.isRunning)return this;var e=this.target;this.propertyKey=os(t,"key","value");var i=e[this.propertyKey];return this.fromValue=os(t,"from",i),this.toValue=os(t,"to",i),this.setEase(os(t,"ease",this.ease)),this.setDuration(os(t,"duration",this.duration)),this.setRepeat(os(t,"repeat",0)),this.setDelay(os(t,"delay",0)),this.setRepeatDelay(os(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]=ls(this.fromValue,this.toValue,i)}}const cs=Phaser.Utils.Objects.IsPlainObject;class us extends Qe{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 ds(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(cs(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(cs(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 ps={easeDataTo(t,e,i,s){return this._easeData||(this._easeData=new us(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),Ei(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}},vs=Phaser.Utils.Array.Remove,gs={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=$e(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}},zs={setTransitInTime(t){return this.transitInTime=t,this},setTransitOutTime(t){return this.transitOutTime=t,this},setTransitInCallback(t){return t||(t=Yt),this.transitInCallback=t,this},setTransitOutCallback(t){return t||(t=Yt),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}},Ys={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}},Bs={};Object.assign(Bs,Ds,zs,As,Ys);const Ws=Phaser.Utils.Objects.GetValue;class Xs extends Qe{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(Xs.prototype,Bs);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 Qe{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 Fs=Phaser.GameObjects.Rectangle;class Hs extends Fs{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 Qe{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,Ti(t,e)},scaleDown(t,e){ki(t,e,void 0,void 0,!1)},fadeIn(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,ji(t,e)},fadeOut(t,e){Ii(t,e,!1)}},Ks=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,ji(t,e,t.alpha)},qs=function(t,e){Ii(t,e,!1)},Zs=function(t,e,i,s,r){return!(!t||s&&!s(t,e,i)||!rt(t,!0).contains(e,i)||r&&!r(t,e,i))};const Qs=Phaser.Utils.Objects.GetValue;let tr=class extends Xs{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 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}},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 Or.length=0,!0;return Or.length=0,!1},Or=[];const Pr=Phaser.Utils.Objects.GetValue;class _r extends Qe{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=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 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 _r(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 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 Mr=Phaser.Utils.Objects.GetValue;class Rr extends Qe{constructor(t,e){super(t,e),this._enable=void 0,this.cooldown=new Er,this.parent.setInteractive(Mr(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.prevIsInTouch=!1,this.isInTouching=!1,this.setEnable(Mr(t,"enable",!0)),this.setCooldown(Mr(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 Lr={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 Rr(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 Rr(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}},Dr={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}},zr=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=Kr,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=Kr,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&&or(t,s,e,i)}}const Kr=0,qr=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 qe(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=xn},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=xn}onDrag(){this.state===Sn&&(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=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 xn="IDLE",Sn="BEGIN",Cn="RECOGNIZED",wn=Phaser.Utils.Objects.GetValue,On=Phaser.Utils.Array.SpliceOne,Pn=Phaser.Math.Distance.Between,_n=Phaser.Math.Angle.Between;class Tn{constructor(t,e){var i=$e(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,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=Mn,this.onDrag1Start();break;case Mn:this.tracerState=Rn,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],On(this.pointers,e),this.tracerState){case Mn:this.tracerState=En,this.onDrag1End();break;case Rn:this.tracerState=Mn,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 Mn:this.onDrag1();break;case Rn:this.onDrag2()}}}dragCancel(){return this.tracerState===Rn&&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!==Rn)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!==Rn)return 0;var t=this.pointers[0],e=this.pointers[1];return _n(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!==Rn)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.x+e.x)/2}get centerY(){if(this.tracerState!==Rn)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.y+e.y)/2}get prevCenterX(){if(this.tracerState!==Rn)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!==Rn)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=Ln,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,Ge);var kn={};const En=0,Mn=1,Rn=2,Ln="IDLE";Phaser.Utils.Objects.GetValue;const Dn=Phaser.Math.RotateAround;var zn=function(t,e,i,s){return Dn(t,e,i,s),t.rotation+=s,t},An={};const Yn=Phaser.Utils.Objects.GetValue,Bn=Phaser.Math.Angle.WrapDegrees,Wn=Phaser.Math.Angle.ShortestBetween,Xn=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=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=Bn(Xn(this.angleBetween));this.angle=Wn(this.prevAngle,t),this.prevAngle=t,this.state=Nn}break;case Nn:t=Bn(Xn(this.angleBetween)),this.angle=Wn(this.prevAngle,t),this.prevAngle=t,this.emit("rotate",this)}}get isRotated(){return this.state===Nn}get rotation(){return jn(this.angle)}setDragThreshold(t){return this.dragThreshold=t,this}}.prototype,In);const Fn="IDLE",Hn="BEGIN",Nn="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 en(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)}),this)}};const Un=Phaser.Utils.Objects.GetValue;var $n=function(t){var e=Un(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)}),this).on("pressend",(function(t,e,s){Ar(i.eventEmitter,`${i.eventNamePrefix}pressend`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Jn=Phaser.Utils.Objects.GetValue;var Kn=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";Ar(i.eventEmitter,`${i.eventNamePrefix}swipe${r}`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const qn=Phaser.Utils.Objects.GetValue;var Zn=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.")},Br.call(t,e),jr.call(t,e),Hr.call(t,e),Ur.call(t,e),Vn.call(t,e),$n.call(t,e),Kn.call(t,e),t},Qn={getSizerConfig:function(t){return void 0===t&&(t=this),Et(t)},getChildPrevState:function(t){var e=Et(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=ae(e,"color"),s=ae(e,"lineWidth");var o=ae(e,"name",!1);o&&(r=ae(o,"createTextCallback",le),n=ae(o,"createTextCallbackScope",void 0),"string"==typeof(h=ae(o,"align","left-top"))&&(h=At[h]))}if(void 0===i&&(i=16777215),void 0===s&&(s=1),r&&!t.children){t.children=new oe(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)}}for(var d,c,u=this.getAllShownChildren([this]),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){ve.call(this,t);var d=t.isRexSpace,c=typeof e;if(null===e)return this;if("number"===c);else if("string"===c)e=ch[e];else if(oh(e)){var u;e=lh(u=e,"proportion",void 0),i=lh(u,"align",dh),s=lh(u,"padding",0),r=lh(u,"expand",!1),n=lh(u,"key",void 0),h=lh(u,"index",void 0),t.isRexSizer||(a=lh(u,"minWidth",void 0),o=lh(u,"minHeight",void 0)),l=lh(u,"fitRatio",0)}return"string"==typeof i&&(i=At[i]),void 0===e&&(e=d?1:0),void 0===i&&(i=dh),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===a&&(d?a=0:t.isRexSizer||(a=t._minWidth)),void 0===o&&(d?o=0:t.isRexSizer||(o=t._minHeight)),void 0===l||!1===l?l=0:!0===l&&(l=Q(t)/tt(t)),(u=this.getSizerConfig(t)).proportion=e,u.align=i,u.padding=ue(s),u.expand=r,u.fitRatio=0===e?l:0,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=kt.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}},xh={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}},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&&(Ie(t,0,0),e.resolved=!1,this.hasRatioFitChild=!0);return this._childrenProportion=void 0,this.hasProportion0Child=!1,this.proportionLength=void 0,We.call(this),this},layoutChildren:function(){for(var t,e,i,s,r,n,h,a,o,l,d=this.sizerChildren,c=this.innerLeft,u=this.innerTop,p=this.innerWidth,v=this.innerHeight,g=c,f=u,m=this.startChildIndex,y=0,b=d.length;y0?(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)||Le.call(this)},runWidthWrap:function(t){this.wrapResult||(1===this.orientation&&rh.call(this,t,void 0),De.call(this,t))},hasHeightWrap:function(){return!(!this.hasRatioFitChild||0!==this.orientation)||Ae.call(this)},runHeightWrap:function(t){this.wrapResult||(0===this.orientation&&rh.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],h=n&&n.isRexSpace;return"center"===t?h||this.insertSpace(r+1):h&&this.remove(n,!0),this}};Object.assign(Ch,ph,mh,yh,bh,xh,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},Oh={x:0,h:0,horizontal:0,"left-to-right":0,y:1,v:1,vertical:1,"top-to-bottom":1},Ph=function(t){return"string"==typeof t&&(t=Oh[t]),t};const _h=Phaser.Utils.Objects.IsPlainObject,Th=Phaser.Utils.Objects.GetValue;class kh extends eh{constructor(t,e,i,s,r,n,h){_h(e)?(e=Th(h=e,"x",0),i=Th(h,"y",0),s=Th(h,"width",void 0),r=Th(h,"height",void 0),n=Th(h,"orientation",0)):_h(s)?(s=Th(h=s,"width",void 0),r=Th(h,"height",void 0),n=Th(h,"orientation",0)):_h(n)&&(n=Th(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(Th(h,"space.item",0)),this.setStartChildIndex(Th(h,"startChildIndex",0)),this.setRTL(Th(h,"rtl",!1)),this.addChildrenMap("items",this.sizerChildren)}setOrientation(t){return this.orientation=Ph(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(kh.prototype,Ch);var Eh=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=Mh[i])}void 0===s?s={}:!0===s&&(s=Rh);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 Mh={fit:0,FIT:0,envelop:1,ENVELOP:1};var Rh={},Lh={},Dh={};const zh=Phaser.Utils.Objects.IsPlainObject,Ah=Phaser.Utils.Objects.GetValue,Yh=Phaser.Display.Align.CENTER,Bh=Phaser.Utils.String.UUID;var Wh={add:function(t,e,i,s,r,n,h,a,o,l){ve.call(this,t),zh(e)&&(e=Ah(d=e,"key",void 0),i=Ah(d,"align",Yh),s=Ah(d,"padding",0),r=Ah(d,"expand",!0),t.isRexSizer||(n=Ah(d,"minWidth",t._minWidth),h=Ah(d,"minHeight",t._minHeighted)),a=Ah(d,"offsetX",0),o=Ah(d,"offsetY",0),l=Ah(d,"aspectRatio",0));var d,c=void 0!==e;return c||(e=Bh()),"string"==typeof i&&(i=At[i]),void 0===i&&(i=Yh),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===l?l=0:!0===l&&(l=Q(t)/tt(t)),l>0&&(r=!0,void 0===n&&(n=0),void 0===h&&(h=0)),(d=this.getSizerConfig(t)).align=i,d.padding=ue(s),zh(r)?(d.expandWidth=Ah(r,"width",!1),d.expandHeight=Ah(r,"height",!1)):(d.expandWidth=r,d.expandHeight=r),t.isRexSizer||(d.expandWidth&&(t.minWidth=void 0===n?Q(t):n),d.expandHeight&&(t.minHeight=void 0===h?tt(t):h)),d.alignOffsetX=a,d.alignOffsetY=o,d.aspectRatio=l,this.sizerChildren.hasOwnProperty(e)&&this.sizerChildren[e].destroy(),this.sizerChildren[e]=t,c&&this.addChildrenMap(e,t),this}},Xh={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]),Se.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 gh.call(this,t),this}},jh={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=this.innerLeft,c=this.innerTop,u=this.innerWidth,p=this.innerHeight,v=this.sizerChildren;for(var g in v)(t=v[g]).rexSizer.hidden||(i=(e=t.rexSizer).padding,vr.call(this,t),a=this.getExpandedChildWidth(t),o=this.getExpandedChildHeight(t),e.aspectRatio>0&&(Lh.width=e.aspectRatio,Lh.height=1,Dh.width=a,Dh.height=o,a=(l=Eh(Lh,Dh,"FIT",!0)).width,o=l.height),t.isRexSizer?(t.runLayout(this,a,o),ih(t,this)):Ie(t,a,o),s=d+i.left*this.scaleX,n=u-(i.left+i.right)*this.scaleX,r=c+i.top*this.scaleY,h=p-(i.top+i.bottom)*this.scaleY,gr.call(this,t,s,r,n,h,e.align,e.alignOffsetX,e.alignOffsetY))}};Object.assign(jh,Wh,Xh);const Ih=Phaser.Utils.Objects.IsPlainObject,Fh=Phaser.Utils.Objects.GetValue;class Hh extends eh{constructor(t,e,i,s,r,n){Ih(e)?(e=Fh(n=e,"x",0),i=Fh(n,"y",0),s=Fh(n,"width",void 0),r=Fh(n,"height",void 0)):Ih(s)&&(s=Fh(n=s,"width",void 0),r=Fh(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(Hh.prototype,jh);const Nh=kh.prototype.add,Gh=kh.prototype.addSpace;var Vh=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)&&Gh.call(this),Nh.call(this,t,{proportion:i,expand:!0});var s=!this.buttonsExpand&&"center"===this.buttonsAlign;s&&Gh.call(this),this.hasTailSpace=s}else Nh.call(this,t,{proportion:i,expand:!0}),this.hasTailSpace=!1;else if(this.hasTailSpace){var r=this.sizerChildren.length-1;Nh.call(this,t,{index:r,proportion:i,expand:!0})}else Nh.call(this,t,{proportion:i,expand:!0});return e&&this.buttonGroup.add(t),this},Uh={addButton(t){if(lr(t))for(var e=t,i=0,s=e.length;i=0;i--)Kh.call(this,e[i],t);return this}},Zh=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)}},Qh=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,Zh.call(e,t,i,s)}},enumerable:!0,configurable:!0}),t.selected=!1},ta={add(t){return this.buttons.push(t),t._click||(t._click=new br(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`),Qh.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=va(a.left,a.centerY,t,e))&&(r=o,s=n);var o,l=i[n+1];l&&l.y===a.y||r>(o=va(a.right,a.centerY,t,e))&&(r=o,s=n+1)}}return s};const fa=Phaser.Utils.Objects.IsPlainObject,ma=Phaser.Utils.Objects.GetValue,ya=Phaser.Display.Align.CENTER;var ba=function(t,e,i,s){return"\n"===t?(this.addNewLine(),this):(ve.call(this,t),fa(e)&&(e=ma(r=e,"padding",0),i=ma(r,"key",void 0),s=ma(r,"index",void 0)),void 0===e&&(e=0),(r=this.getSizerConfig(t)).align=ya,r.padding=ue(e),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},xa={add(t,e,i){if(lr(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,gh.call(this,t),this}},wa={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&&Ma.addNewLine(this)}else for(n=0,h=t.length;n=0;i--)Aa.call(this,e[i],t);return this}};const Ba=Phaser.Utils.Objects.GetValue;class Wa 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 aa({parent:this,eventEmitter:Ba(e,"eventEmitter",this),groupName:Ba(e,"groupName",void 0),clickConfig:Ba(e,"click",void 0)}).setButtonsType(e);var s=Ba(e,"background",void 0),r=Ba(e,"buttons",void 0);this.buttonsAlign=Ba(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(Wa.prototype,La,Ya,ha,la);var Xa=function(){return Array.prototype.reduce.call(arguments,ja,0)},ja=function(t,e){return t+e};const Ia=Phaser.Utils.Objects.IsPlainObject,Fa=Phaser.Utils.Objects.GetValue,Ha=Phaser.Display.Align.CENTER;var Na=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 Va(this.sizerChildren,null),gh.call(this,t),this}},$a={setColumnSpace(t){if(this.space.column||(this.space.column=[]),this.space.column.length=this.columnCount-1,"number"==typeof t)Va(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},Za={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===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,Va(this.sizerChildren,null),this.columnProportions=[],this.columnProportions.length=t,"number"==typeof i)Va(this.columnProportions,i);else for(var n=0;n0?e+=t:0===t&&(this.hasColumnProportion0Child=!0);return e},to=function(){for(var t,e=0,i=0;i0?e+=t:0===t&&(this.hasRowProportion0Child=!0);return e};const eo=Phaser.Utils.Objects.IsPlainObject,io=Phaser.Utils.Objects.GetValue;class so extends eh{constructor(t,e,i,s,r,n,h,a,o,l){eo(e)?(e=io(l=e,"x",0),i=io(l,"y",0),s=io(l,"width",void 0),r=io(l,"height",void 0),n=io(l,"column",l.col||0),h=io(l,"row",0),a=io(l,"columnProportions",0),o=io(l,"rowProportions",0)):eo(s)?(s=io(l=s,"width",void 0),r=io(l,"height",void 0),n=io(l,"column",l.col||0),h=io(l,"row",0),a=io(l,"columnProportions",0),o=io(l,"rowProportions",0)):eo(n)?(n=io(l=n,"column",l.col||0),h=io(l,"row",0),a=io(l,"columnProportions",0),o=io(l,"rowProportions",0)):eo(a)&&(a=io(l=a,"columnProportions",0),o=io(l,"rowProportions",0)),super(t,e,i,s,r,l),this.type="rexGridSizer",this.sizerChildren=[],this.addChildrenMap("items",this.sizerChildren),this.setCreateCellContainerCallback(io(l,"createCellContainerCallback")),this.setIndentLeft(io(l,"space.indentLeftOdd",0),io(l,"space.indentLeftEven",0)),this.setIndentTop(io(l,"space.indentTopOdd",0),io(l,"space.indentTopEven",0)),this.resetGrid(n,h,a,o,io(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=Qa.call(this)),this._totalColumnProportions}get totalRowProportions(){return void 0===this._totalRowProportions&&(this._totalRowProportions=to.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(so.prototype,Za);const ro=so.prototype.add;var no={addButton(t,e,i){return ro.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--)oo.call(this,e[i],t);return this}};const co=Phaser.Utils.Objects.GetValue;class uo extends so{constructor(t,e){void 0===e&&(e={});var i=co(e,"row",0),s=co(e,"column",e.col||0),r=co(e,"createCellContainerCallback"),n=co(e,"buttons",void 0),h=co(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},jo=0,Io=1,Fo=2,Ho=0,No=1,Go=2,Vo=/(?:\r\n|\r|\n)/;const Uo={none:Ho,word:No,char:Go,character:Go,mix:3},$o=Phaser.Renderer.WebGL.Utils;var Jo={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=$o.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 Ko=Phaser.Display.Color;var qo={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 Ko);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}},Zo=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)},Qo={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,Zo(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 tl=Phaser.Display.Canvas.CanvasPool,el=Phaser.GameObjects.GameObject,il=Phaser.Utils.String.UUID;class sl extends el{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=tl.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(){tl.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 rl=Phaser.GameObjects.Components;Phaser.Class.mixin(sl,[rl.Alpha,rl.BlendMode,rl.Crop,rl.Depth,rl.Flip,rl.GetBounds,rl.Mask,rl.Origin,rl.Pipeline,rl.PostPipeline,rl.ScrollFactor,rl.Tint,rl.Transform,rl.Visible,Jo,qo,Qo]);var nl={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&>(this.data),this}};class hl{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(hl.prototype,nl);var al={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 ol=Phaser.Math.RotateAround;var ll;const dl=Phaser.Geom.Rectangle;var cl,ul=function(t){void 0===cl&&(cl=new dl);var e=t.drawTLX,i=t.drawTLY;return cl.setTo(e,i,t.drawTRX-e,t.drawBLY-i),cl};const pl=Phaser.Math.RotateAround;var vl,gl=function(t,e,i,s){return void 0===s?s={}:!0===s&&(void 0===vl&&(vl={}),s=vl),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 fl=Phaser.GameObjects.Components.TransformMatrix;var ml,yl,bl={},xl=function(t,e,i,s,r){var n=gl(e,i,s,!0),h=function(t,e,i,s){void 0===s?s={}:!0===s&&(s=bl);var r=e-t.width*t.originX,n=i-t.height*t.originY;return void 0===ml&&(ml=new fl,yl=new fl),t.parentContainer?t.getWorldTransformMatrix(ml,yl):ml.applyITRS(t.x,t.y,t.rotation,t.scaleX,t.scaleY),ml.transformPoint(r,n,s),s}(t,n.x,n.y,r);return h},Sl=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 xl(t,e,n,h,r)},Cl={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===ll&&(ll={}),s=ll),s.x=(t-i.drawX)/i.scaleX,s.y=(e-i.drawY)/i.scaleY,0!==i.rotation&&ol(s,0,0,-i.rotation),s}(t,e,this,!0);return ul(this).contains(i.x,i.y)},getWorldPosition:function(t,e,i){return Sl(this.parent,this,t,e,i)}};Object.assign(Cl,al);const wl=Phaser.Math.DegToRad,Ol=Phaser.Math.RadToDeg,Pl=Phaser.Utils.Objects.GetValue;class _l extends hl{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 Ol(this._rotation)}set angle(t){this.rotation=wl(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=Pl(t,"width",void 0),i=Pl(t,"height",void 0),s=Pl(t,"scaleX",void 0),r=Pl(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(_l.prototype,Cl);const Tl=Phaser.Utils.String.Pad;var kl=function(t,e,i){if(null==t)return t;switch(typeof t){case"string":default:return t;case"number":return`#${Tl(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}},El=function(t,e,i){return e.hasOwnProperty(t)?e[t]:i[t]};const Ml=Phaser.Utils.Objects.GetValue;let Rl=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=Ml(t,"x",0),i=Ml(t,"y",0));var s=this.cornerRadius;s.tl=Ll(Ml(t,"tl",void 0),e,i),s.tr=Ll(Ml(t,"tr",void 0),e,i),s.bl=Ll(Ml(t,"bl",void 0),e,i),s.br=Ll(Ml(t,"br",void 0),e,i)}get radiusTL(){var t=this.cornerRadius.tl;return Math.max(t.x,t.y)}set radiusTL(t){Dl(this.cornerRadius.tl,t)}get radiusTR(){var t=this.cornerRadius.tr;return Math.max(t.x,t.y)}set radiusTR(t){Dl(this.cornerRadius.tr,t)}get radiusBL(){var t=this.cornerRadius.bl;return Math.max(t.x,t.y)}set radiusBL(t){Dl(this.cornerRadius.bl,t)}get radiusBR(){var t=this.cornerRadius.br;return Math.max(t.x,t.y)}set radiusBR(t){Dl(this.cornerRadius.br,t)}};var Ll=function(t,e,i){return void 0===t?t={x:e,y:i}:"number"==typeof t&&(t={x:t,y:t}),zl(t),t},Dl=function(t,e){"number"==typeof e?(t.x=e,t.y=e):(t.x=Ml(e,"x",0),t.y=Ml(e,"y",0)),zl(t)},zl=function(t){t.convex=t.x>=0||t.y>=0,t.x=Math.abs(t.x),t.y=Math.abs(t.y)};const Al=Phaser.Math.DegToRad;var Yl=function(t){return!t.hasOwnProperty("convex")||t.convex},Bl=function(t){return t.x>0&&t.y>0},Wl=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,Bl(a)?(o=a.x*g,l=a.y*f,Yl(a)?Wl(t,o,l,o,l,180,270,!1,h):Wl(t,0,0,o,l,90,0,!0,h),d=0,c=l):(t.lineTo(0,0),d=0,c=0),a=m.tr,Bl(a)?(o=a.x*g,l=a.y*f,Yl(a)?Wl(t,s-o,l,o,l,270,360,!1,h):Wl(t,s,0,o,l,180,90,!0,h)):t.lineTo(s,0),a=m.br,Bl(a)?(o=a.x*g,l=a.y*f,Yl(a)?Wl(t,s-o,r-l,o,l,0,90,!1,h):Wl(t,s,r,o,l,270,180,!0,h)):t.lineTo(s,r),a=m.bl,Bl(a)?(o=a.x*g,l=a.y*f,Yl(a)?Wl(t,o,r-l,o,l,90,180,!1,h):Wl(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())},jl=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),Xl(t.canvas,t.context,d,d,o,l,r,e,i,s,n,h,a)}};const Il=Phaser.Utils.Objects.GetValue;class Fl extends _l{constructor(t,e){super(t,"background"),this.setScrollFactor(0),this.setColor(Il(e,"color",null),Il(e,"color2",null),Il(e,"horizontalGradient",!0)),this.setStroke(Il(e,"stroke",null),Il(e,"strokeThickness",2)),this.setCornerRadius(Il(e,"cornerRadius",0),Il(e,"cornerIteration",null))}set color(t){t=kl(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=kl(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=kl(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,El("color2",t,this),El("horizontalGradient",t,this)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,El("strokeThickness",t,this)),t.hasOwnProperty("cornerRadius")&&this.setCornerRadius(t.cornerRadius,El("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(){jl(this.parent,this.color,this.stroke,this.strokeThickness,this.cornerRadius,this.color2,this.horizontalGradient,this.cornerIteration)}}const Hl=Phaser.Utils.Objects.GetValue;class Nl extends _l{constructor(t,e){super(t,"innerbounds"),this.setScrollFactor(0),this.setColor(Hl(e,"color",null),Hl(e,"color2",null),Hl(e,"horizontalGradient",!0)),this.setStroke(Hl(e,"stroke",null),Hl(e,"strokeThickness",2))}set color(t){t=kl(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=kl(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=kl(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,Hl(t,"color2",null),Hl(t,"horizontalGradient",!0)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,Hl(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 Gl=Phaser.Utils.Objects.GetValue;let Vl=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(Gl(t,"bold",!1)),this.setItalic(Gl(t,"italic",!1)),this.setFontSize(Gl(t,"fontSize","16px")),this.setFontFamily(Gl(t,"fontFamily","Courier")),this.setColor(Gl(t,"color","#fff")),this.setStrokeStyle(Gl(t,"stroke",null),Gl(t,"strokeThickness",0)),this.setShadow(Gl(t,"shadowColor",null),Gl(t,"shadowOffsetX",0),Gl(t,"shadowOffsetY",0),Gl(t,"shadowBlur",0)),this.setOffset(Gl(t,"offsetX",0),Gl(t,"offsetY",0)),this.setSpace(Gl(t,"leftSpace",0),Gl(t,"rightSpace",0)),this.setAlign(Gl(t,"align",void 0)),this.setBackgroundColor(Gl(t,"backgroundColor",null)),this.setBackgroundHeight(Gl(t,"backgroundHeight",void 0)),this.setBackgroundBottomY(Gl(t,"backgroundBottomY",void 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(El("stroke",t,this),El("strokeThickness",t,this)),t.hasOwnProperty("shadowColor")&&this.setShadowColor(t.shadowColor),(t.hasOwnProperty("shadowOffsetX")||t.hasOwnProperty("shadowOffsetY"))&&this.setShadowOffset(El("shadowOffsetX",t,this),El("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),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=kl(t),this}get hasFill(){return null!=this.color}setStrokeStyle(t,e){return this.stroke=kl(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=kl(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=kl(t),this}get hasBackgroundColor(){return null!=this.backgroundColor}setBackgroundHeight(t){return this.backgroundHeight=t,this}setBackgroundBottomY(t){return this.backgroundBottomY=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 Ul=Phaser.Utils.Array.Remove,$l=Phaser.Utils.Array.Remove,Jl="text",Kl="image",ql="drawer",Zl="space",Ql="command";var td=function(t){return t.type===Jl&&"\n"===t.text},ed=function(t){return t.type===Jl&&"\f"===t.text},id=function(t){return t.type===Jl};class sd extends _l{constructor(t,e,i){super(t,Jl),this.updateTextFlag=!1,this.style=new Vl(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,s=this.drawTRX-i+1,r=e.backgroundBottomY;null==r&&(r=this.drawBLY);var n=e.backgroundHeight;null==n&&(n=r-this.drawTLY);var h=r-n;t.fillRect(i,h,s,n)}var a=e.hasFill,o=e.hasStroke;(a||o)&&(e.syncFont(t).syncStyle(t),o&&(e.syncShadow(t),t.strokeText(this.text,0,0)),a&&(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 rd=function(t,e){var i=this.createCharChildren(t,e);return this.addChild(i),this};const nd=Phaser.Display.Canvas.CanvasPool;var hd=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=nd.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),nd.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 ad extends _l{constructor(t,e,i){super(t,Kl),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(){hd(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 od extends _l{constructor(t,e,i,s){super(t,ql),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 ld extends _l{constructor(t,e){super(t,Zl),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 dd extends hl{constructor(t,e,i,s,r){super(t,Ql),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 cd(t){if(null===t||"object"!=typeof t)return t;if(Array.isArray(t))return t.map((t=>cd(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]=cd(t[i]));return e}var ud=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 vd=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=yd.call(this)).height,h=l.ascent,i=Math.floor((o-h)/n))}else{var l;n=(l=yd.call(this)).height,h=l.ascent}}else this.fixedHeight>0?void 0===(i=xd(t,"maxLines"))&&(o=this.fixedHeight-s,i=Math.floor(o/n)):i=xd(t,"maxLines",0);void 0===h&&(h=n);var d=0===i,c=xd(t,"wrapMode");void 0===c&&(c=xd(t,"charWrap",!1)?"char":"word"),"string"==typeof c&&(c=pd[c]);var u=xd(t,"wrapWidth",void 0);void 0===u&&(this.fixedWidth>0?u=this.fixedWidth-r:(u=1/0,c=0));for(var p=xd(t,"letterSpacing",0),v=xd(t,"hAlign",0),g=xd(t,"vAlign",0),f=xd(t,"justifyPercentage",.25),m=ud({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=wd(t,"maxLines",void 0))){var h=this.fixedWidth-r;i=Math.floor(h/n)+1}}else i=wd(t,"maxLines",0);var a=0===i,o=wd(t,"fixedCharacterHeight",void 0);if(void 0===o){var l=wd(t,"charPerLine",void 0);if(void 0!==l){var d=this.fixedHeight-s;o=Math.floor(d/l)}}var c=wd(t,"wrapHeight",void 0);void 0===c&&(c=this.fixedHeight>0?this.fixedHeight-s:1/0);for(var u=wd(t,"letterSpacing",0),p=wd(t,"rtl",!0),v=wd(t,"hAlign",p?2:0),g=wd(t,"vAlign",0),f=ud({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 B=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 Ee(i,t,e),this.dirty=this.dirty||s!=i.left||r!=i.right||n!=i.top||h!=i.bottom,this},getPadding:function(t){return ke(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),Ul(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 $l(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(Jl);return null===i?i=new sd(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)),Sl(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 $d=Phaser.Utils.Objects.GetFastValue;var Jd={};class Kd{constructor(t){this.pools=$d(t,"pools",Jd)}free(t){if(!this.pools)return this;var e=t.type;return this.pools.hasOwnProperty(e)||(this.pools[e]=new Ud),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=rc(t,r,e,i,n),a=0;a<=ec&&0!==h;a++){if((r+=h)<0){r=0;break}h=rc(t,r,e,i,n)}return a===ec&&console.warn("FontSizeFit: Test count exceeds 65535"),t.setFontSize(r),nc(t,e,i),t},sc=function(t,e,i){return void 0===i[e]&&(t.setFontSize(e),i[e]={width:t.width,height:t.height}),i[e]},rc=function(t,e,i,s,r){var n,h=sc(t,e,r),a=sc(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)},nc=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,ac=Phaser.Utils.Objects.GetValue;class oc extends Oo{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexLabel";var i,s=ac(e,"background",void 0),r=ac(e,"icon",void 0),n=ac(e,"iconMask",void 0),h=ac(e,"text",void 0),a=ac(e,"action",void 0),o=ac(e,"actionMask",void 0),l=ac(e,"align",void 0);if(s&&this.addBackground(s),r){0===this.orientation?(h||a)&&(i={right:ac(e,"space.icon",0),top:ac(e,"space.iconTop",0),bottom:ac(e,"space.iconBottom",0),left:ac(e,"space.iconLeft",0)}):(h||a)&&(i={bottom:ac(e,"space.icon",0),left:ac(e,"space.iconLeft",0),right:ac(e,"space.iconRight",0),top:ac(e,"space.iconTop",0)});var d=ac(e,"squareFitIcon",!1)?1:0;if(this.add(r,{proportion:0,padding:i,fitRatio:d}),n&&(n=Mo.call(this,r,r,1)),!d){var c=ac(e,"iconSize",void 0);this.setIconSize(ac(e,"iconWidth",c),ac(e,"iconHeight",c))}}if(h){var u=ac(e,"wrapText",!1),p=ac(e,"adjustTextFontSize",!1);u?(!0===u&&(u="word"),function(t,e){switch(Ao(t)){case 0:switch("string"==typeof e&&(e=Uo[e]||0),t.style.wrapMode=e,e){case 2:case 3:t.style.wordWrapCallback=Wo;break;default:t.style.wordWrapCallback=null}break;case 1:"string"==typeof e&&(e=Uo[e]||0),t.style.wrapMode=e}}(h,u),e.expandTextWidth=!0,tc(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 ic(t,e,i),t}):(t.runWidthWrap=function(e){return t.setFixedSize&&t.setFixedSize(0,0),ic(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=ac(e,"space.text",0),m=ac(e,"expandTextWidth",!1),y=ac(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:ac(e,"space.actionTop",0),bottom:ac(e,"space.actionBottom",0),right:ac(e,"space.actionRight",0)}:{left:ac(e,"space.actionLeft",0),right:ac(e,"space.actionRight",0),bottom:ac(e,"space.actionBottom",0)},d=ac(e,"squareFitAction",!1)?1:0,this.add(a,{proportion:0,padding:i,fitRatio:d}),o&&(o=Mo.call(this,a,a,1)),!d)){var b=ac(e,"actionSize");this.setActionSize(ac(e,"actionWidth",b),ac(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 lc=Phaser.Renderer.WebGL.Utils,dc=function(t,e,i,s,r,n){for(var h=lc.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+")"},gc=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 fc=Phaser.Renderer.Canvas.SetTransform;var mc={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&&dc(r,h,e,l,a,o),e.isStroked&&uc(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(fc(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(bc.prototype,mc);var xc=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 Sc=Phaser.Math.DegToRad;var Cc=function(t,e,i,s,r,n,h,a,o){h&&n>r?n-=360:!h&&n0&&t.y>0};const kc={rectangle:0,circle:1},Ec=Phaser.Utils.Objects.GetValue;class Mc extends Qe{constructor(t,e){super(t,e),this.style=Ec(e,"style",this);var i=Ec(e,"propertiesMap");this.activeStyle=Rc(e,"active",i),this.hoverStyle=Rc(e,"hover",i),this.disableStyle=Rc(e,"disable",i),this.onModifyStyle=Ec(e,"onModifyStyle")}getStyle(t){return function(t,e,i){if(void 0===i&&(i={}),Array.isArray(e))for(var s=0,r=e.length;s0,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};const Cu=Phaser.Utils.Objects.GetValue,wu=Phaser.Utils.Objects.IsPlainObject;class Ou extends(Jc(Ic)){constructor(t,e,i,s,r,n,h,a){wu(e)?(e=Cu(a=e,"x",0),i=Cu(a,"y",0),s=Cu(a,"width",2),r=Cu(a,"height",2),n=Cu(a,"barColor",void 0),h=Cu(a,"value",0)):wu(s)?(s=Cu(a=s,"width",2),r=Cu(a,"height",2),n=Cu(a,"barColor",void 0),h=Cu(a,"value",0)):wu(n)&&(n=Cu(a=n,"barColor",void 0),h=Cu(a,"value",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(Cu(a,"trackColor",void 0)),this.setBarColor(n),this.setTrackStroke(Cu(a,"trackStrokeThickness",2),Cu(a,"trackStrokeColor",void 0)),this.setSkewX(Cu(a,"skewX",0)),this.setRTL(Cu(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 Pu={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).close();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).close());var a=this.getShape("trackStroke");a.lineStyle(this.trackStrokeThickness,this.trackStrokeColor),a.isStroked&&Su(a,0,0,e,i,t).end()}};Object.assign(Ou.prototype,Pu);var _u=function(t){return null==t||""===t||0===t.length},Tu=function(t,e,i,s){if(void 0===s&&(s="."),"object"==typeof t){if(_u(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(_u(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=cd(i),s=cd(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,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 Gu(t)?(this.stretchMode.edge=Uu(Vu(t,"edge",0)),this.stretchMode.internal=Uu(Vu(t,"internal",0))):(t=Uu(t),this.stretchMode.edge=t,this.stretchMode.internal=t),this},getStretchMode:function(t,e){return Ju.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 qu=Phaser.Utils.Objects.IsPlainObject,Zu=Phaser.Utils.Objects.GetValue,Qu=Phaser.GameObjects;var tp=void 0,ep=function(t,e){if(tp||(tp={},qe(t).events.once("destroy",(function(){for(var t in tp)tp[t].destroy();tp=void 0}))),!tp.hasOwnProperty(e)){var i=qe(t).scene.systemScene;(t=new Qu[e](i)).setOrigin(0),tp[e]=t}return tp[e]};const ip=Phaser.GameObjects.RenderTexture;class sp extends(function(t,e){class i extends t{constructor(t,i,s,r,n,h,a,o,l,d){if(qu(i)?(i=Zu(d=i,"x",0),s=Zu(d,"y",0),r=Zu(d,"width",1),n=Zu(d,"height",1),h=Zu(d,"key",void 0),a=Zu(d,"baseFrame",void 0),o=Zu(d,"columns",void 0),l=Zu(d,"rows",void 0)):qu(r)?(r=Zu(d=r,"width",1),n=Zu(d,"height",1),h=Zu(d,"key",void 0),a=Zu(d,"baseFrame",void 0),o=Zu(d,"columns",void 0),l=Zu(d,"rows",void 0)):qu(h)?(h=Zu(d=h,"key",void 0),a=Zu(d,"baseFrame",void 0),o=Zu(d,"columns",void 0),l=Zu(d,"rows",void 0)):qu(a)?(a=Zu(d=a,"baseFrame",void 0),o=Zu(d,"columns",void 0),l=Zu(d,"rows",void 0)):Array.isArray(a)?(d=l,l=o,o=a,a=Zu(d,"baseFrame",void 0)):qu(o)&&(o=Zu(d=o,"columns",void 0),l=Zu(d,"rows",void 0)),void 0===a&&(a=Zu(d,"frame",void 0)),void 0===o){var c=Zu(d,"leftWidth",void 0),u=Zu(d,"rightWidth",void 0);void 0!==c&&void 0!==u&&(o=[c,void 0,u])}if(void 0===l){var p=Zu(d,"topHeight",void 0),v=Zu(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(Zu(d,"getFrameNameCallback",void 0)),this.setStretchMode(Zu(d,"stretchMode",0)),this.setPreserveRatio(Zu(d,"preserveRatio",!0));var g=Zu(d,"maxFixedPartScale",1),f=Zu(d,"maxFixedPartScaleX",g),m=Zu(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,Ku),i}(ip,"rexNinePatch")){}var rp={_drawImage:function(t,e,i,s,r,n){var h=ep(this,"Image").setTexture(t,e).setDisplaySize(r,n);this.draw(h,i,s)},_drawTileSprite:function(t,e,i,s,r,n){var h=ep(this,"TileSprite").setTexture(t,e).setSize(r,n);this.draw(h,i,s)}};Object.assign(sp.prototype,rp);let np=class extends Qe{constructor(t,e){return super(t),new Proxy(this,this)}get(t,e){if(Mu(t,e))return t[e];var i=t.parent;return Mu(i,e)?i[e]:void 0}set(t,e,i){return Mu(t,e)?t[e]=i:Mu(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 hp=Phaser.Utils.Objects.GetValue;class ap extends sp{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexStatesNinePatch";var i=hp(e,"effects",!0);i&&Au(this,i),this.style=new np(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign(ap.prototype,Dc);const op=["alpha","tint","flipX","flipY"];var lp=function(t,e){if(!e)return t;for(var i=0,s=op.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}},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}},Pe=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 _e=/(\S+)\[(\d+)\]/i,Te=Phaser.Utils.Objects.GetValue;var ke=function(t,e){return void 0===e?t:t[e]},Ee=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=Te(e,"left",0),t.right=Te(e,"right",0),t.top=Te(e,"top",0),t.bottom=Te(e,"bottom",0)),t},Me={getInnerPadding(t){return ke(this.space,t)},setInnerPadding(t,e){return Ee(this.space,t,e),this},getOuterPadding(t){return ke(this.getSizerConfig(this).padding,t)},setOuterPadding(t,e){return Ee(this.getSizerConfig(this).padding,t,e),this},getChildOuterPadding(t,e){return"string"==typeof t&&(t=this.getElement(t)),ke(this.getSizerConfig(t).padding,e)},setChildOuterPadding(t,e,i){return"string"==typeof t&&(t=this.getElement(t)),Ee(this.getSizerConfig(t).padding,e,i),this}},Re=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}},Le=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},De=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},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},Be={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}},We=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?vi:pi,this.repeatCounter=0,this}stop(){return this.state=ui,this}update(t,e){this.state!==ui&&this.state!==fi&&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=gi)):(this.nowTime=this.duration,this.state=fi):this.nowTime>=0&&(this.state=vi))}get t(){var t;switch(this.state){case ui:case pi:case gi:t=0;break;case vi:t=this.nowTime/this.duration;break;case fi:t=1}return di(t,0,1)}set t(t){(t=di(t,-1,1))<0?(this.state=pi,this.nowTime=-this.delay*t):(this.state=vi,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===ui}get isDelay(){return this.state===pi}get isCountDown(){return this.state===vi}get isRunning(){return this.state===pi||this.state===vi}get isDone(){return this.state===fi}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}}const ui=0,pi=1,vi=2,gi=3,fi=-1;class mi extends ai{constructor(t,e){super(t,e),this.timer=new ci}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 yi=Phaser.Utils.Objects.GetValue,bi=Phaser.Utils.Objects.GetAdvancedValue,xi=Phaser.Tweens.Builders.GetEaseFunction;class Si extends mi{resetFromJSON(t){return this.timer.resetFromJSON(yi(t,"timer")),this.setEnable(yi(t,"enable",!0)),this.setTarget(yi(t,"target",this.parent)),this.setDelay(bi(t,"delay",0)),this.setDuration(bi(t,"duration",1e3)),this.setEase(yi(t,"ease","Linear")),this.setRepeat(yi(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 Ci=Phaser.Utils.Objects.GetValue,wi=Phaser.Utils.Objects.GetAdvancedValue,Oi=Phaser.Math.Linear;let Pi=class extends Si{constructor(t,e){super(t,e),this.scaleStart={},this.scaleEnd={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(Ci(t,"mode",0)),this.setScaleRange(wi(t,"start",void 0),wi(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=_i[t]),this.mode=t,this}setScaleRange(t,e){return"number"==typeof t?(this.startX=t,this.startY=t):(this.startX=wi(t,"x",this.parent.scaleX),this.startY=wi(t,"y",this.parent.scaleY)),"number"==typeof e?(this.endX=e,this.endY=e):(this.endX=wi(e,"x",void 0),this.endY=wi(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 _i={stop:0,destroy:1,yoyo:2};var Ti=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 Pi(t,a):r.resetFromJSON(a),r.restart(),r},ki=function(t,e,i,s,r,n){void 0===s&&(s="Linear"),r instanceof Pi&&(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 Pi(t,h):n.resetFromJSON(h),n.restart(),n},Ei=function(t,e){return new Promise((function(i,s){t.once(e,(function(){i()}))}))},Mi=function(t){return Ei(t,"complete")};const Ri=Phaser.Utils.Objects.IsPlainObject;var Li={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(Ri(t)){var s=t;t=s.duration,e=s.orientation,i=s.ease}var r=void 0===this._scaleBehavior;return this._scaleBehavior=Ti(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(Ri(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=ki(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(Ri(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 Pi(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),Mi(this._scaleBehavior)},isRunningScaleYoyo(){return this._scaleBehavior&&(this._scaleBehavior.completeEventName="scaleyoyo.complete")},isRunningEaseScale(){return this.isRunningPopUp()||this.isRunningScaleDown()||this.isRunningScaleYoyo()}},Di={};Object.assign(Di,Li),Di.onInitScale=function(){Li.onInitScale.call(this);var t=this;this._scaleBehavior.on("update",(function(){var e=me.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const zi=Phaser.Utils.Objects.GetValue,Ai=Phaser.Utils.Objects.GetAdvancedValue,Yi=Phaser.Math.Linear;class Bi extends Si{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=Wi[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 Wi={stop:0,destroy:1,yoyo:2},Xi=Phaser.Utils.Objects.IsPlainObject;var ji=function(t,e,i,s){var r,n;Xi(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 Bi(t,h):s.resetFromJSON(h),s.restart(),s},Ii=function(t,e,i,s){i instanceof Bi&&(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 Bi(t,r):s.resetFromJSON(r),s.restart(),s};const Fi=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(Fi(t)){var i=t;t=i.duration,e=i.alpha}var s=void 0===this._fade;return this._fade=ji(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(Fi(t)){var i=t;t=i.duration,e=i.destroy}var s=void 0===this._fade;return this._fade=Ii(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()}},Ni={};Object.assign(Ni,Hi),Ni.onInitFade=function(){Hi.onInitFade.call(this);var t=this;this._fade.on("update",(function(){var e=me.getParentSizer(t);e&&e.resetChildAlphaState(t)}))};const Gi=Phaser.Utils.Objects.GetValue,Vi=Phaser.Utils.Objects.GetAdvancedValue,Ui=Phaser.Math.Linear;class $i extends Si{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){if(super.resetFromJSON(t),this.setMode(Gi(t,"mode",0)),t&&(t.hasOwnProperty("x")||t.hasOwnProperty("y"))){var e=Vi(t,"x",void 0),i=Vi(t,"y",void 0);this.setTargetPosition(e,i)}else this.setTargetPosition(t);return this}setMode(t){return"string"==typeof t&&(t=Ji[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=Vi(i,"startX",void 0),this.startY=Vi(i,"startY",void 0),this.endX=Vi(i,"endX",void 0),this.endY=Vi(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=Ui(this.startX,this.endX,i)),this.hasMoveY&&(t.y=Ui(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Ji={stop:0,destroy:1,yoyo:2};var Ki=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,Zi=Phaser.Math.Distance.Between;var Qi={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*Zi(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 $i&&(h=n,n=void 0),void 0===n&&(n=!1);var a={};return a.mode=n?1:0,void 0!==i&&(a.startX=Ki(i,t.x),a.endX=t.x),void 0!==s&&(a.startY=Ki(s,t.y),a.endY=t.y),a.duration=e,a.ease=void 0===r?"Linear":r,void 0===h?h=new $i(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),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*Zi(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 $i&&(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=Ki(i,t.x)),void 0!==s&&(a.startY=t.y,a.endY=Ki(s,t.y)),a.duration=e,a.ease=void 0===r?"Linear":r,void 0===h?h=new $i(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),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}},ts={};Object.assign(ts,Qi),ts.onInitEaseMove=function(){Qi.onInitEaseMove.call(this);var t=this;this._easeMove.on("update",(function(){var e=me.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const es=Phaser.Utils.Objects.GetValue;class is extends ri{constructor(t,e){super(t,e),this.timer=new ci,this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.timer.resetFromJSON(es(t,"timer")),this.setEnable(es(t,"enable",!0)),this.setMode(es(t,"mode",1)),this.isRunning=es(t,"isRunning",!1),this.setMagnitudeMode(es(t,"magnitudeMode",1)),this.setAxisMode(es(t,"axis",0)),this.setDuration(es(t,"duration",500)),this.setMagnitude(es(t,"magnitude",10)),this.ox=es(t,"ox",void 0),this.oy=es(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=ss[t]),this.mode=t,this}setMagnitudeMode(t){return"string"==typeof t&&(t=ns[t]),this.magnitudeMode=t,this}setAxisMode(t){return"string"==typeof t&&(t=rs[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=es(i,"magnitude",void 0),t=es(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 ss={effect:0,behavior:1},rs={both:0,"h&v":0,"x&y":0,horizontal:1,h:1,x:1,vertical:2,v:2,y:2},ns={constant:0,decay:1},hs=Phaser.Utils.Objects.IsPlainObject;var as={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 is(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 os=Phaser.Utils.Objects.GetValue,ls=Phaser.Math.Linear;class ds extends Si{constructor(t,e){super(t,e),this.resetFromJSON(),this.boot()}start(t){if(this.timer.isRunning)return this;var e=this.target;this.propertyKey=os(t,"key","value");var i=e[this.propertyKey];return this.fromValue=os(t,"from",i),this.toValue=os(t,"to",i),this.setEase(os(t,"ease",this.ease)),this.setDuration(os(t,"duration",this.duration)),this.setRepeat(os(t,"repeat",0)),this.setDelay(os(t,"delay",0)),this.setRepeatDelay(os(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]=ls(this.fromValue,this.toValue,i)}}const cs=Phaser.Utils.Objects.IsPlainObject;class us extends Qe{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 ds(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(cs(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(cs(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 ps={easeDataTo(t,e,i,s){return this._easeData||(this._easeData=new us(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),Ei(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}},vs=Phaser.Utils.Array.Remove,gs={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=$e(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}},zs={setTransitInTime(t){return this.transitInTime=t,this},setTransitOutTime(t){return this.transitOutTime=t,this},setTransitInCallback(t){return t||(t=Yt),this.transitInCallback=t,this},setTransitOutCallback(t){return t||(t=Yt),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}},Ys={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}},Bs={};Object.assign(Bs,Ds,zs,As,Ys);const Ws=Phaser.Utils.Objects.GetValue;class Xs extends Qe{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(Xs.prototype,Bs);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 Qe{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 Fs=Phaser.GameObjects.Rectangle;class Hs extends Fs{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 Qe{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,Ti(t,e)},scaleDown(t,e){ki(t,e,void 0,void 0,!1)},fadeIn(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,ji(t,e)},fadeOut(t,e){Ii(t,e,!1)}},Ks=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,ji(t,e,t.alpha)},qs=function(t,e){Ii(t,e,!1)},Zs=function(t,e,i,s,r){return!(!t||s&&!s(t,e,i)||!rt(t,!0).contains(e,i)||r&&!r(t,e,i))};const Qs=Phaser.Utils.Objects.GetValue;let tr=class extends Xs{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 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}},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 Or.length=0,!0;return Or.length=0,!1},Or=[];const Pr=Phaser.Utils.Objects.GetValue;class _r extends Qe{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=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 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 _r(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 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 Mr=Phaser.Utils.Objects.GetValue;class Rr extends Qe{constructor(t,e){super(t,e),this._enable=void 0,this.cooldown=new Er,this.parent.setInteractive(Mr(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.prevIsInTouch=!1,this.isInTouching=!1,this.setEnable(Mr(t,"enable",!0)),this.setCooldown(Mr(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 Lr={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 Rr(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 Rr(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}},Dr={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}},zr=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=Kr,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=Kr,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&&or(t,s,e,i)}}const Kr=0,qr=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 qe(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=xn},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=xn}onDrag(){this.state===Sn&&(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=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 xn="IDLE",Sn="BEGIN",Cn="RECOGNIZED",wn=Phaser.Utils.Objects.GetValue,On=Phaser.Utils.Array.SpliceOne,Pn=Phaser.Math.Distance.Between,_n=Phaser.Math.Angle.Between;class Tn{constructor(t,e){var i=$e(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,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=Mn,this.onDrag1Start();break;case Mn:this.tracerState=Rn,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],On(this.pointers,e),this.tracerState){case Mn:this.tracerState=En,this.onDrag1End();break;case Rn:this.tracerState=Mn,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 Mn:this.onDrag1();break;case Rn:this.onDrag2()}}}dragCancel(){return this.tracerState===Rn&&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!==Rn)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!==Rn)return 0;var t=this.pointers[0],e=this.pointers[1];return _n(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!==Rn)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.x+e.x)/2}get centerY(){if(this.tracerState!==Rn)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.y+e.y)/2}get prevCenterX(){if(this.tracerState!==Rn)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!==Rn)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=Ln,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,Ge);var kn={};const En=0,Mn=1,Rn=2,Ln="IDLE";Phaser.Utils.Objects.GetValue;const Dn=Phaser.Math.RotateAround;var zn=function(t,e,i,s){return Dn(t,e,i,s),t.rotation+=s,t},An={};const Yn=Phaser.Utils.Objects.GetValue,Bn=Phaser.Math.Angle.WrapDegrees,Wn=Phaser.Math.Angle.ShortestBetween,Xn=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=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=Bn(Xn(this.angleBetween));this.angle=Wn(this.prevAngle,t),this.prevAngle=t,this.state=Nn}break;case Nn:t=Bn(Xn(this.angleBetween)),this.angle=Wn(this.prevAngle,t),this.prevAngle=t,this.emit("rotate",this)}}get isRotated(){return this.state===Nn}get rotation(){return jn(this.angle)}setDragThreshold(t){return this.dragThreshold=t,this}}.prototype,In);const Fn="IDLE",Hn="BEGIN",Nn="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 en(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)}),this)}};const Un=Phaser.Utils.Objects.GetValue;var $n=function(t){var e=Un(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)}),this).on("pressend",(function(t,e,s){Ar(i.eventEmitter,`${i.eventNamePrefix}pressend`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Jn=Phaser.Utils.Objects.GetValue;var Kn=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";Ar(i.eventEmitter,`${i.eventNamePrefix}swipe${r}`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const qn=Phaser.Utils.Objects.GetValue;var Zn=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.")},Br.call(t,e),jr.call(t,e),Hr.call(t,e),Ur.call(t,e),Vn.call(t,e),$n.call(t,e),Kn.call(t,e),t},Qn={getSizerConfig:function(t){return void 0===t&&(t=this),Et(t)},getChildPrevState:function(t){var e=Et(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=ae(e,"color"),s=ae(e,"lineWidth");var o=ae(e,"name",!1);o&&(r=ae(o,"createTextCallback",le),n=ae(o,"createTextCallbackScope",void 0),"string"==typeof(h=ae(o,"align","left-top"))&&(h=At[h]))}if(void 0===i&&(i=16777215),void 0===s&&(s=1),r&&!t.children){t.children=new oe(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)}}for(var d,c,u=this.getAllShownChildren([this]),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){ve.call(this,t);var d=t.isRexSpace,c=typeof e;if(null===e)return this;if("number"===c);else if("string"===c)e=ch[e];else if(oh(e)){var u;e=lh(u=e,"proportion",void 0),i=lh(u,"align",dh),s=lh(u,"padding",0),r=lh(u,"expand",!1),n=lh(u,"key",void 0),h=lh(u,"index",void 0),t.isRexSizer||(a=lh(u,"minWidth",void 0),o=lh(u,"minHeight",void 0)),l=lh(u,"fitRatio",0)}return"string"==typeof i&&(i=At[i]),void 0===e&&(e=d?1:0),void 0===i&&(i=dh),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===a&&(d?a=0:t.isRexSizer||(a=t._minWidth)),void 0===o&&(d?o=0:t.isRexSizer||(o=t._minHeight)),void 0===l||!1===l?l=0:!0===l&&(l=Q(t)/tt(t)),(u=this.getSizerConfig(t)).proportion=e,u.align=i,u.padding=ue(s),u.expand=r,u.fitRatio=0===e?l:0,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=kt.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}},xh={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}},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&&(Ie(t,0,0),e.resolved=!1,this.hasRatioFitChild=!0);return this._childrenProportion=void 0,this.hasProportion0Child=!1,this.proportionLength=void 0,We.call(this),this},layoutChildren:function(){for(var t,e,i,s,r,n,h,a,o,l,d=this.sizerChildren,c=this.innerLeft,u=this.innerTop,p=this.innerWidth,v=this.innerHeight,g=c,f=u,m=this.startChildIndex,y=0,b=d.length;y0?(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)||Le.call(this)},runWidthWrap:function(t){this.wrapResult||(1===this.orientation&&rh.call(this,t,void 0),De.call(this,t))},hasHeightWrap:function(){return!(!this.hasRatioFitChild||0!==this.orientation)||Ae.call(this)},runHeightWrap:function(t){this.wrapResult||(0===this.orientation&&rh.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],h=n&&n.isRexSpace;return"center"===t?h||this.insertSpace(r+1):h&&this.remove(n,!0),this}};Object.assign(Ch,ph,mh,yh,bh,xh,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},Oh={x:0,h:0,horizontal:0,"left-to-right":0,y:1,v:1,vertical:1,"top-to-bottom":1},Ph=function(t){return"string"==typeof t&&(t=Oh[t]),t};const _h=Phaser.Utils.Objects.IsPlainObject,Th=Phaser.Utils.Objects.GetValue;class kh extends eh{constructor(t,e,i,s,r,n,h){_h(e)?(e=Th(h=e,"x",0),i=Th(h,"y",0),s=Th(h,"width",void 0),r=Th(h,"height",void 0),n=Th(h,"orientation",0)):_h(s)?(s=Th(h=s,"width",void 0),r=Th(h,"height",void 0),n=Th(h,"orientation",0)):_h(n)&&(n=Th(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(Th(h,"space.item",0)),this.setStartChildIndex(Th(h,"startChildIndex",0)),this.setRTL(Th(h,"rtl",!1)),this.addChildrenMap("items",this.sizerChildren)}setOrientation(t){return this.orientation=Ph(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(kh.prototype,Ch);var Eh=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=Mh[i])}void 0===s?s={}:!0===s&&(s=Rh);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 Mh={fit:0,FIT:0,envelop:1,ENVELOP:1};var Rh={},Lh={},Dh={};const zh=Phaser.Utils.Objects.IsPlainObject,Ah=Phaser.Utils.Objects.GetValue,Yh=Phaser.Display.Align.CENTER,Bh=Phaser.Utils.String.UUID;var Wh={add:function(t,e,i,s,r,n,h,a,o,l){ve.call(this,t),zh(e)&&(e=Ah(d=e,"key",void 0),i=Ah(d,"align",Yh),s=Ah(d,"padding",0),r=Ah(d,"expand",!0),t.isRexSizer||(n=Ah(d,"minWidth",t._minWidth),h=Ah(d,"minHeight",t._minHeighted)),a=Ah(d,"offsetX",0),o=Ah(d,"offsetY",0),l=Ah(d,"aspectRatio",0));var d,c=void 0!==e;return c||(e=Bh()),"string"==typeof i&&(i=At[i]),void 0===i&&(i=Yh),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===l?l=0:!0===l&&(l=Q(t)/tt(t)),l>0&&(r=!0,void 0===n&&(n=0),void 0===h&&(h=0)),(d=this.getSizerConfig(t)).align=i,d.padding=ue(s),zh(r)?(d.expandWidth=Ah(r,"width",!1),d.expandHeight=Ah(r,"height",!1)):(d.expandWidth=r,d.expandHeight=r),t.isRexSizer||(d.expandWidth&&(t.minWidth=void 0===n?Q(t):n),d.expandHeight&&(t.minHeight=void 0===h?tt(t):h)),d.alignOffsetX=a,d.alignOffsetY=o,d.aspectRatio=l,this.sizerChildren.hasOwnProperty(e)&&this.sizerChildren[e].destroy(),this.sizerChildren[e]=t,c&&this.addChildrenMap(e,t),this}},Xh={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]),Se.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 gh.call(this,t),this}},jh={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=this.innerLeft,c=this.innerTop,u=this.innerWidth,p=this.innerHeight,v=this.sizerChildren;for(var g in v)(t=v[g]).rexSizer.hidden||(i=(e=t.rexSizer).padding,vr.call(this,t),a=this.getExpandedChildWidth(t),o=this.getExpandedChildHeight(t),e.aspectRatio>0&&(Lh.width=e.aspectRatio,Lh.height=1,Dh.width=a,Dh.height=o,a=(l=Eh(Lh,Dh,"FIT",!0)).width,o=l.height),t.isRexSizer?(t.runLayout(this,a,o),ih(t,this)):Ie(t,a,o),s=d+i.left*this.scaleX,n=u-(i.left+i.right)*this.scaleX,r=c+i.top*this.scaleY,h=p-(i.top+i.bottom)*this.scaleY,gr.call(this,t,s,r,n,h,e.align,e.alignOffsetX,e.alignOffsetY))}};Object.assign(jh,Wh,Xh);const Ih=Phaser.Utils.Objects.IsPlainObject,Fh=Phaser.Utils.Objects.GetValue;class Hh extends eh{constructor(t,e,i,s,r,n){Ih(e)?(e=Fh(n=e,"x",0),i=Fh(n,"y",0),s=Fh(n,"width",void 0),r=Fh(n,"height",void 0)):Ih(s)&&(s=Fh(n=s,"width",void 0),r=Fh(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(Hh.prototype,jh);const Nh=kh.prototype.add,Gh=kh.prototype.addSpace;var Vh=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)&&Gh.call(this),Nh.call(this,t,{proportion:i,expand:!0});var s=!this.buttonsExpand&&"center"===this.buttonsAlign;s&&Gh.call(this),this.hasTailSpace=s}else Nh.call(this,t,{proportion:i,expand:!0}),this.hasTailSpace=!1;else if(this.hasTailSpace){var r=this.sizerChildren.length-1;Nh.call(this,t,{index:r,proportion:i,expand:!0})}else Nh.call(this,t,{proportion:i,expand:!0});return e&&this.buttonGroup.add(t),this},Uh={addButton(t){if(lr(t))for(var e=t,i=0,s=e.length;i=0;i--)Kh.call(this,e[i],t);return this}},Zh=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)}},Qh=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,Zh.call(e,t,i,s)}},enumerable:!0,configurable:!0}),t.selected=!1},ta={add(t){return this.buttons.push(t),t._click||(t._click=new br(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`),Qh.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=va(a.left,a.centerY,t,e))&&(r=o,s=n);var o,l=i[n+1];l&&l.y===a.y||r>(o=va(a.right,a.centerY,t,e))&&(r=o,s=n+1)}}return s};const fa=Phaser.Utils.Objects.IsPlainObject,ma=Phaser.Utils.Objects.GetValue,ya=Phaser.Display.Align.CENTER;var ba=function(t,e,i,s){return"\n"===t?(this.addNewLine(),this):(ve.call(this,t),fa(e)&&(e=ma(r=e,"padding",0),i=ma(r,"key",void 0),s=ma(r,"index",void 0)),void 0===e&&(e=0),(r=this.getSizerConfig(t)).align=ya,r.padding=ue(e),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},xa={add(t,e,i){if(lr(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,gh.call(this,t),this}},wa={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&&Ma.addNewLine(this)}else for(n=0,h=t.length;n=0;i--)Aa.call(this,e[i],t);return this}};const Ba=Phaser.Utils.Objects.GetValue;class Wa 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 aa({parent:this,eventEmitter:Ba(e,"eventEmitter",this),groupName:Ba(e,"groupName",void 0),clickConfig:Ba(e,"click",void 0)}).setButtonsType(e);var s=Ba(e,"background",void 0),r=Ba(e,"buttons",void 0);this.buttonsAlign=Ba(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(Wa.prototype,La,Ya,ha,la);var Xa=function(){return Array.prototype.reduce.call(arguments,ja,0)},ja=function(t,e){return t+e};const Ia=Phaser.Utils.Objects.IsPlainObject,Fa=Phaser.Utils.Objects.GetValue,Ha=Phaser.Display.Align.CENTER;var Na=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 Va(this.sizerChildren,null),gh.call(this,t),this}},$a={setColumnSpace(t){if(this.space.column||(this.space.column=[]),this.space.column.length=this.columnCount-1,"number"==typeof t)Va(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},Za={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===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,Va(this.sizerChildren,null),this.columnProportions=[],this.columnProportions.length=t,"number"==typeof i)Va(this.columnProportions,i);else for(var n=0;n0?e+=t:0===t&&(this.hasColumnProportion0Child=!0);return e},to=function(){for(var t,e=0,i=0;i0?e+=t:0===t&&(this.hasRowProportion0Child=!0);return e};const eo=Phaser.Utils.Objects.IsPlainObject,io=Phaser.Utils.Objects.GetValue;class so extends eh{constructor(t,e,i,s,r,n,h,a,o,l){eo(e)?(e=io(l=e,"x",0),i=io(l,"y",0),s=io(l,"width",void 0),r=io(l,"height",void 0),n=io(l,"column",l.col||0),h=io(l,"row",0),a=io(l,"columnProportions",0),o=io(l,"rowProportions",0)):eo(s)?(s=io(l=s,"width",void 0),r=io(l,"height",void 0),n=io(l,"column",l.col||0),h=io(l,"row",0),a=io(l,"columnProportions",0),o=io(l,"rowProportions",0)):eo(n)?(n=io(l=n,"column",l.col||0),h=io(l,"row",0),a=io(l,"columnProportions",0),o=io(l,"rowProportions",0)):eo(a)&&(a=io(l=a,"columnProportions",0),o=io(l,"rowProportions",0)),super(t,e,i,s,r,l),this.type="rexGridSizer",this.sizerChildren=[],this.addChildrenMap("items",this.sizerChildren),this.setCreateCellContainerCallback(io(l,"createCellContainerCallback")),this.setIndentLeft(io(l,"space.indentLeftOdd",0),io(l,"space.indentLeftEven",0)),this.setIndentTop(io(l,"space.indentTopOdd",0),io(l,"space.indentTopEven",0)),this.resetGrid(n,h,a,o,io(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=Qa.call(this)),this._totalColumnProportions}get totalRowProportions(){return void 0===this._totalRowProportions&&(this._totalRowProportions=to.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(so.prototype,Za);const ro=so.prototype.add;var no={addButton(t,e,i){return ro.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--)oo.call(this,e[i],t);return this}};const co=Phaser.Utils.Objects.GetValue;class uo extends so{constructor(t,e){void 0===e&&(e={});var i=co(e,"row",0),s=co(e,"column",e.col||0),r=co(e,"createCellContainerCallback"),n=co(e,"buttons",void 0),h=co(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},jo=0,Io=1,Fo=2,Ho=0,No=1,Go=2,Vo=/(?:\r\n|\r|\n)/;const Uo={none:Ho,word:No,char:Go,character:Go,mix:3},$o=Phaser.Renderer.WebGL.Utils;var Jo={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=$o.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 Ko=Phaser.Display.Color;var qo={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 Ko);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}},Zo=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)},Qo={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,Zo(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 tl=Phaser.Display.Canvas.CanvasPool,el=Phaser.GameObjects.GameObject,il=Phaser.Utils.String.UUID;class sl extends el{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=tl.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(){tl.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 rl=Phaser.GameObjects.Components;Phaser.Class.mixin(sl,[rl.Alpha,rl.BlendMode,rl.Crop,rl.Depth,rl.Flip,rl.GetBounds,rl.Mask,rl.Origin,rl.Pipeline,rl.PostPipeline,rl.ScrollFactor,rl.Tint,rl.Transform,rl.Visible,Jo,qo,Qo]);var nl={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&>(this.data),this}};class hl{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(hl.prototype,nl);var al={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 ol=Phaser.Math.RotateAround;var ll;const dl=Phaser.Geom.Rectangle;var cl,ul=function(t){void 0===cl&&(cl=new dl);var e=t.drawTLX,i=t.drawTLY;return cl.setTo(e,i,t.drawTRX-e,t.drawBLY-i),cl};const pl=Phaser.Math.RotateAround;var vl,gl=function(t,e,i,s){return void 0===s?s={}:!0===s&&(void 0===vl&&(vl={}),s=vl),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 fl=Phaser.GameObjects.Components.TransformMatrix;var ml,yl,bl={},xl=function(t,e,i,s,r){var n=gl(e,i,s,!0),h=function(t,e,i,s){void 0===s?s={}:!0===s&&(s=bl);var r=e-t.width*t.originX,n=i-t.height*t.originY;return void 0===ml&&(ml=new fl,yl=new fl),t.parentContainer?t.getWorldTransformMatrix(ml,yl):ml.applyITRS(t.x,t.y,t.rotation,t.scaleX,t.scaleY),ml.transformPoint(r,n,s),s}(t,n.x,n.y,r);return h},Sl=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 xl(t,e,n,h,r)},Cl={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===ll&&(ll={}),s=ll),s.x=(t-i.drawX)/i.scaleX,s.y=(e-i.drawY)/i.scaleY,0!==i.rotation&&ol(s,0,0,-i.rotation),s}(t,e,this,!0);return ul(this).contains(i.x,i.y)},getWorldPosition:function(t,e,i){return Sl(this.parent,this,t,e,i)}};Object.assign(Cl,al);const wl=Phaser.Math.DegToRad,Ol=Phaser.Math.RadToDeg,Pl=Phaser.Utils.Objects.GetValue;class _l extends hl{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 Ol(this._rotation)}set angle(t){this.rotation=wl(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=Pl(t,"width",void 0),i=Pl(t,"height",void 0),s=Pl(t,"scaleX",void 0),r=Pl(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(_l.prototype,Cl);const Tl=Phaser.Utils.String.Pad;var kl=function(t,e,i){if(null==t)return t;switch(typeof t){case"string":default:return t;case"number":return`#${Tl(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}},El=function(t,e,i){return e.hasOwnProperty(t)?e[t]:i[t]};const Ml=Phaser.Utils.Objects.GetValue;let Rl=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=Ml(t,"x",0),i=Ml(t,"y",0));var s=this.cornerRadius;s.tl=Ll(Ml(t,"tl",void 0),e,i),s.tr=Ll(Ml(t,"tr",void 0),e,i),s.bl=Ll(Ml(t,"bl",void 0),e,i),s.br=Ll(Ml(t,"br",void 0),e,i)}get radiusTL(){var t=this.cornerRadius.tl;return Math.max(t.x,t.y)}set radiusTL(t){Dl(this.cornerRadius.tl,t)}get radiusTR(){var t=this.cornerRadius.tr;return Math.max(t.x,t.y)}set radiusTR(t){Dl(this.cornerRadius.tr,t)}get radiusBL(){var t=this.cornerRadius.bl;return Math.max(t.x,t.y)}set radiusBL(t){Dl(this.cornerRadius.bl,t)}get radiusBR(){var t=this.cornerRadius.br;return Math.max(t.x,t.y)}set radiusBR(t){Dl(this.cornerRadius.br,t)}};var Ll=function(t,e,i){return void 0===t?t={x:e,y:i}:"number"==typeof t&&(t={x:t,y:t}),zl(t),t},Dl=function(t,e){"number"==typeof e?(t.x=e,t.y=e):(t.x=Ml(e,"x",0),t.y=Ml(e,"y",0)),zl(t)},zl=function(t){t.convex=t.x>=0||t.y>=0,t.x=Math.abs(t.x),t.y=Math.abs(t.y)};const Al=Phaser.Math.DegToRad;var Yl=function(t){return!t.hasOwnProperty("convex")||t.convex},Bl=function(t){return t.x>0&&t.y>0},Wl=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,Bl(a)?(o=a.x*g,l=a.y*f,Yl(a)?Wl(t,o,l,o,l,180,270,!1,h):Wl(t,0,0,o,l,90,0,!0,h),d=0,c=l):(t.lineTo(0,0),d=0,c=0),a=m.tr,Bl(a)?(o=a.x*g,l=a.y*f,Yl(a)?Wl(t,s-o,l,o,l,270,360,!1,h):Wl(t,s,0,o,l,180,90,!0,h)):t.lineTo(s,0),a=m.br,Bl(a)?(o=a.x*g,l=a.y*f,Yl(a)?Wl(t,s-o,r-l,o,l,0,90,!1,h):Wl(t,s,r,o,l,270,180,!0,h)):t.lineTo(s,r),a=m.bl,Bl(a)?(o=a.x*g,l=a.y*f,Yl(a)?Wl(t,o,r-l,o,l,90,180,!1,h):Wl(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())},jl=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),Xl(t.canvas,t.context,d,d,o,l,r,e,i,s,n,h,a)}};const Il=Phaser.Utils.Objects.GetValue;class Fl extends _l{constructor(t,e){super(t,"background"),this.setScrollFactor(0),this.setColor(Il(e,"color",null),Il(e,"color2",null),Il(e,"horizontalGradient",!0)),this.setStroke(Il(e,"stroke",null),Il(e,"strokeThickness",2)),this.setCornerRadius(Il(e,"cornerRadius",0),Il(e,"cornerIteration",null))}set color(t){t=kl(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=kl(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=kl(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,El("color2",t,this),El("horizontalGradient",t,this)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,El("strokeThickness",t,this)),t.hasOwnProperty("cornerRadius")&&this.setCornerRadius(t.cornerRadius,El("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(){jl(this.parent,this.color,this.stroke,this.strokeThickness,this.cornerRadius,this.color2,this.horizontalGradient,this.cornerIteration)}}const Hl=Phaser.Utils.Objects.GetValue;class Nl extends _l{constructor(t,e){super(t,"innerbounds"),this.setScrollFactor(0),this.setColor(Hl(e,"color",null),Hl(e,"color2",null),Hl(e,"horizontalGradient",!0)),this.setStroke(Hl(e,"stroke",null),Hl(e,"strokeThickness",2))}set color(t){t=kl(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=kl(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=kl(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,Hl(t,"color2",null),Hl(t,"horizontalGradient",!0)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,Hl(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 Gl=Phaser.Utils.Objects.GetValue;let Vl=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(Gl(t,"bold",!1)),this.setItalic(Gl(t,"italic",!1)),this.setFontSize(Gl(t,"fontSize","16px")),this.setFontFamily(Gl(t,"fontFamily","Courier")),this.setColor(Gl(t,"color","#fff")),this.setStrokeStyle(Gl(t,"stroke",null),Gl(t,"strokeThickness",0)),this.setShadow(Gl(t,"shadowColor",null),Gl(t,"shadowOffsetX",0),Gl(t,"shadowOffsetY",0),Gl(t,"shadowBlur",0)),this.setOffset(Gl(t,"offsetX",0),Gl(t,"offsetY",0)),this.setSpace(Gl(t,"leftSpace",0),Gl(t,"rightSpace",0)),this.setAlign(Gl(t,"align",void 0)),this.setBackgroundColor(Gl(t,"backgroundColor",null)),this.setBackgroundHeight(Gl(t,"backgroundHeight",void 0)),this.setBackgroundBottomY(Gl(t,"backgroundBottomY",void 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(El("stroke",t,this),El("strokeThickness",t,this)),t.hasOwnProperty("shadowColor")&&this.setShadowColor(t.shadowColor),(t.hasOwnProperty("shadowOffsetX")||t.hasOwnProperty("shadowOffsetY"))&&this.setShadowOffset(El("shadowOffsetX",t,this),El("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),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=kl(t),this}get hasFill(){return null!=this.color}setStrokeStyle(t,e){return this.stroke=kl(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=kl(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=kl(t),this}get hasBackgroundColor(){return null!=this.backgroundColor}setBackgroundHeight(t){return this.backgroundHeight=t,this}setBackgroundBottomY(t){return this.backgroundBottomY=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 Ul=Phaser.Utils.Array.Remove,$l=Phaser.Utils.Array.Remove,Jl="text",Kl="image",ql="drawer",Zl="space",Ql="command";var td=function(t){return t.type===Jl&&"\n"===t.text},ed=function(t){return t.type===Jl&&"\f"===t.text},id=function(t){return t.type===Jl};class sd extends _l{constructor(t,e,i){super(t,Jl),this.updateTextFlag=!1,this.style=new Vl(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,s=this.drawTRX-i+1,r=e.backgroundBottomY;null==r&&(r=this.drawBLY);var n=e.backgroundHeight;null==n&&(n=r-this.drawTLY);var h=r-n;t.fillRect(i,h,s,n)}var a=e.hasFill,o=e.hasStroke;(a||o)&&(e.syncFont(t).syncStyle(t),o&&(e.syncShadow(t),t.strokeText(this.text,0,0)),a&&(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 rd=function(t,e){var i=this.createCharChildren(t,e);return this.addChild(i),this};const nd=Phaser.Display.Canvas.CanvasPool;var hd=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=nd.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),nd.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 ad extends _l{constructor(t,e,i){super(t,Kl),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(){hd(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 od extends _l{constructor(t,e,i,s){super(t,ql),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 ld extends _l{constructor(t,e){super(t,Zl),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 dd extends hl{constructor(t,e,i,s,r){super(t,Ql),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 cd(t){if(null===t||"object"!=typeof t)return t;if(Array.isArray(t))return t.map((t=>cd(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]=cd(t[i]));return e}var ud=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 vd=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=yd.call(this)).height,h=l.ascent,i=Math.floor((o-h)/n))}else{var l;n=(l=yd.call(this)).height,h=l.ascent}}else this.fixedHeight>0?void 0===(i=xd(t,"maxLines"))&&(o=this.fixedHeight-s,i=Math.floor(o/n)):i=xd(t,"maxLines",0);void 0===h&&(h=n);var d=0===i,c=xd(t,"wrapMode");void 0===c&&(c=xd(t,"charWrap",!1)?"char":"word"),"string"==typeof c&&(c=pd[c]);var u=xd(t,"wrapWidth",void 0);void 0===u&&(this.fixedWidth>0?u=this.fixedWidth-r:(u=1/0,c=0));for(var p=xd(t,"letterSpacing",0),v=xd(t,"hAlign",0),g=xd(t,"vAlign",0),f=xd(t,"justifyPercentage",.25),m=ud({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=wd(t,"maxLines",void 0))){var h=this.fixedWidth-r;i=Math.floor(h/n)+1}}else i=wd(t,"maxLines",0);var a=0===i,o=wd(t,"fixedCharacterHeight",void 0);if(void 0===o){var l=wd(t,"charPerLine",void 0);if(void 0!==l){var d=this.fixedHeight-s;o=Math.floor(d/l)}}var c=wd(t,"wrapHeight",void 0);void 0===c&&(c=this.fixedHeight>0?this.fixedHeight-s:1/0);for(var u=wd(t,"letterSpacing",0),p=wd(t,"rtl",!0),v=wd(t,"hAlign",p?2:0),g=wd(t,"vAlign",0),f=ud({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 B=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 Ee(i,t,e),this.dirty=this.dirty||s!=i.left||r!=i.right||n!=i.top||h!=i.bottom,this},getPadding:function(t){return ke(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),Ul(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 $l(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(Jl);return null===i?i=new sd(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)),Sl(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 $d=Phaser.Utils.Objects.GetFastValue;var Jd={};class Kd{constructor(t){this.pools=$d(t,"pools",Jd)}free(t){if(!this.pools)return this;var e=t.type;return this.pools.hasOwnProperty(e)||(this.pools[e]=new Ud),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=rc(t,r,e,i,n),a=0;a<=ec&&0!==h;a++){if((r+=h)<0){r=0;break}h=rc(t,r,e,i,n)}return a===ec&&console.warn("FontSizeFit: Test count exceeds 65535"),t.setFontSize(r),nc(t,e,i),t},sc=function(t,e,i){return void 0===i[e]&&(t.setFontSize(e),i[e]={width:t.width,height:t.height}),i[e]},rc=function(t,e,i,s,r){var n,h=sc(t,e,r),a=sc(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)},nc=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,ac=Phaser.Utils.Objects.GetValue;class oc extends Oo{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexLabel";var i,s=ac(e,"background",void 0),r=ac(e,"icon",void 0),n=ac(e,"iconMask",void 0),h=ac(e,"text",void 0),a=ac(e,"action",void 0),o=ac(e,"actionMask",void 0),l=ac(e,"align",void 0);if(s&&this.addBackground(s),r){0===this.orientation?(h||a)&&(i={right:ac(e,"space.icon",0),top:ac(e,"space.iconTop",0),bottom:ac(e,"space.iconBottom",0),left:ac(e,"space.iconLeft",0)}):(h||a)&&(i={bottom:ac(e,"space.icon",0),left:ac(e,"space.iconLeft",0),right:ac(e,"space.iconRight",0),top:ac(e,"space.iconTop",0)});var d=ac(e,"squareFitIcon",!1)?1:0;if(this.add(r,{proportion:0,padding:i,fitRatio:d}),n&&(n=Mo.call(this,r,r,1)),!d){var c=ac(e,"iconSize",void 0);this.setIconSize(ac(e,"iconWidth",c),ac(e,"iconHeight",c))}}if(h){var u=ac(e,"wrapText",!1),p=ac(e,"adjustTextFontSize",!1);u?(!0===u&&(u="word"),function(t,e){switch(Ao(t)){case 0:switch("string"==typeof e&&(e=Uo[e]||0),t.style.wrapMode=e,e){case 2:case 3:t.style.wordWrapCallback=Wo;break;default:t.style.wordWrapCallback=null}break;case 1:"string"==typeof e&&(e=Uo[e]||0),t.style.wrapMode=e}}(h,u),e.expandTextWidth=!0,tc(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 ic(t,e,i),t}):(t.runWidthWrap=function(e){return t.setFixedSize&&t.setFixedSize(0,0),ic(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=ac(e,"space.text",0),m=ac(e,"expandTextWidth",!1),y=ac(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:ac(e,"space.actionTop",0),bottom:ac(e,"space.actionBottom",0),right:ac(e,"space.actionRight",0)}:{left:ac(e,"space.actionLeft",0),right:ac(e,"space.actionRight",0),bottom:ac(e,"space.actionBottom",0)},d=ac(e,"squareFitAction",!1)?1:0,this.add(a,{proportion:0,padding:i,fitRatio:d}),o&&(o=Mo.call(this,a,a,1)),!d)){var b=ac(e,"actionSize");this.setActionSize(ac(e,"actionWidth",b),ac(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 lc=Phaser.Renderer.WebGL.Utils,dc=function(t,e,i,s,r,n){for(var h=lc.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+")"},gc=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 fc=Phaser.Renderer.Canvas.SetTransform;var mc={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&&dc(r,h,e,l,a,o),e.isStroked&&uc(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(fc(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(bc.prototype,mc);var xc=function(t){return t.x>0&&t.y>0},Sc=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 Cc=Phaser.Math.DegToRad;var wc=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 Cu=Phaser.Utils.Objects.GetValue,wu=Phaser.Utils.Objects.IsPlainObject;class Ou extends(Jc(Ic)){constructor(t,e,i,s,r,n,h,a){wu(e)?(e=(a=e).x,i=a.y,s=a.width,r=a.height,n=a.barColor,h=a.value):wu(s)?(s=(a=s).width,r=a.height,n=a.barColor,h=a.value):wu(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(Cu(a,"trackColor",void 0)),this.setBarColor(n),this.setTrackStroke(Cu(a,"trackStrokeThickness",2),Cu(a,"trackStrokeColor",void 0)),this.setSkewX(Cu(a,"skewX",0)),this.setRTL(Cu(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 Pu={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(Ou.prototype,Pu);var _u=function(t){return null==t||""===t||0===t.length},Tu=function(t,e,i,s){if(void 0===s&&(s="."),"object"==typeof t){if(_u(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(_u(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=cd(i),s=cd(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,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 Gu(t)?(this.stretchMode.edge=Uu(Vu(t,"edge",0)),this.stretchMode.internal=Uu(Vu(t,"internal",0))):(t=Uu(t),this.stretchMode.edge=t,this.stretchMode.internal=t),this},getStretchMode:function(t,e){return Ju.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 qu=Phaser.Utils.Objects.IsPlainObject,Zu=Phaser.Utils.Objects.GetValue,Qu=Phaser.GameObjects;var tp=void 0,ep=function(t,e){if(tp||(tp={},qe(t).events.once("destroy",(function(){for(var t in tp)tp[t].destroy();tp=void 0}))),!tp.hasOwnProperty(e)){var i=qe(t).scene.systemScene;(t=new Qu[e](i)).setOrigin(0),tp[e]=t}return tp[e]};const ip=Phaser.GameObjects.RenderTexture;class sp extends(function(t,e){class i extends t{constructor(t,i,s,r,n,h,a,o,l,d){if(qu(i)?(i=Zu(d=i,"x",0),s=Zu(d,"y",0),r=Zu(d,"width",1),n=Zu(d,"height",1),h=Zu(d,"key",void 0),a=Zu(d,"baseFrame",void 0),o=Zu(d,"columns",void 0),l=Zu(d,"rows",void 0)):qu(r)?(r=Zu(d=r,"width",1),n=Zu(d,"height",1),h=Zu(d,"key",void 0),a=Zu(d,"baseFrame",void 0),o=Zu(d,"columns",void 0),l=Zu(d,"rows",void 0)):qu(h)?(h=Zu(d=h,"key",void 0),a=Zu(d,"baseFrame",void 0),o=Zu(d,"columns",void 0),l=Zu(d,"rows",void 0)):qu(a)?(a=Zu(d=a,"baseFrame",void 0),o=Zu(d,"columns",void 0),l=Zu(d,"rows",void 0)):Array.isArray(a)?(d=l,l=o,o=a,a=Zu(d,"baseFrame",void 0)):qu(o)&&(o=Zu(d=o,"columns",void 0),l=Zu(d,"rows",void 0)),void 0===a&&(a=Zu(d,"frame",void 0)),void 0===o){var c=Zu(d,"leftWidth",void 0),u=Zu(d,"rightWidth",void 0);void 0!==c&&void 0!==u&&(o=[c,void 0,u])}if(void 0===l){var p=Zu(d,"topHeight",void 0),v=Zu(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(Zu(d,"getFrameNameCallback",void 0)),this.setStretchMode(Zu(d,"stretchMode",0)),this.setPreserveRatio(Zu(d,"preserveRatio",!0));var g=Zu(d,"maxFixedPartScale",1),f=Zu(d,"maxFixedPartScaleX",g),m=Zu(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,Ku),i}(ip,"rexNinePatch")){}var rp={_drawImage:function(t,e,i,s,r,n){var h=ep(this,"Image").setTexture(t,e).setDisplaySize(r,n);this.draw(h,i,s)},_drawTileSprite:function(t,e,i,s,r,n){var h=ep(this,"TileSprite").setTexture(t,e).setSize(r,n);this.draw(h,i,s)}};Object.assign(sp.prototype,rp);let np=class extends Qe{constructor(t,e){return super(t),new Proxy(this,this)}get(t,e){if(Mu(t,e))return t[e];var i=t.parent;return Mu(i,e)?i[e]:void 0}set(t,e,i){return Mu(t,e)?t[e]=i:Mu(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 hp=Phaser.Utils.Objects.GetValue;class ap extends sp{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexStatesNinePatch";var i=hp(e,"effects",!0);i&&Au(this,i),this.style=new np(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign(ap.prototype,Dc);const op=["alpha","tint","flipX","flipY"];var lp=function(t,e){if(!e)return t;for(var i=0,s=op.length;i * @copyright 2018 Photon Storm Ltd. diff --git a/dist/rexdropdownlist.js b/dist/rexdropdownlist.js index 7b655278c4..b4446fd1b9 100644 --- a/dist/rexdropdownlist.js +++ b/dist/rexdropdownlist.js @@ -21992,6 +21992,10 @@ Render$1 ); + var IsArcCorner = function (radius) { + return ((radius.x > 0) && (radius.y > 0)); + }; + var LineTo = function (x, y, pathData) { var cnt = pathData.length; if (cnt >= 2) { @@ -22073,8 +22077,7 @@ geom.setTo(0, 0, width, height, radius); } - var iteration = GetValue$o(radiusConfig, 'iteration', undefined); - this.setIteration(iteration); + this.setIteration(GetValue$o(radiusConfig, 'iteration', undefined)); this.setPosition(x, y); this.setFillStyle(fillColor, fillAlpha); @@ -22327,10 +22330,6 @@ } - var IsArcCorner = function (radius) { - return ((radius.x > 0) && (radius.y > 0)); - }; - const ShapeTypeMap = { rectangle: 0, circle: 1 @@ -23844,6 +23843,7 @@ var skewX = this.skewX; var width = this.width - Math.abs(skewX); var height = this.height; + var trackFill = this.getShape('trackFill'); trackFill.fillStyle(this.trackColor); if (trackFill.isFilled) { @@ -23852,8 +23852,7 @@ 0, 0, // x0, y0 width, height, // x1, y1 skewX // skewX - ) - .close(); + ); } var bar = this.getShape('bar'); @@ -23873,8 +23872,7 @@ barX0, 0, // x0, y0 barX1, height, // x1, y1 skewX // skew - ) - .close(); + ); } var trackStroke = this.getShape('trackStroke'); @@ -23885,8 +23883,7 @@ 0, 0, // x0, y0 width, height, // x1, y1 skewX // skewX - ) - .end(); + ); } }; @@ -23906,6 +23903,8 @@ .lineTo(x0, y0).lineTo(startX, y0); } + lines.close(); + return lines; }; @@ -23916,24 +23915,33 @@ constructor(scene, x, y, width, height, barColor, value, config) { if (IsPlainObject$4(x)) { config = x; - x = GetValue$l(config, 'x', 0); - y = GetValue$l(config, 'y', 0); - width = GetValue$l(config, 'width', 2); - height = GetValue$l(config, 'height', 2); - barColor = GetValue$l(config, 'barColor', undefined); - value = GetValue$l(config, 'value', 0); + + x = config.x; + y = config.y; + width = config.width; + height = config.height; + barColor = config.barColor; + value = config.value; } else if (IsPlainObject$4(width)) { config = width; - width = GetValue$l(config, 'width', 2); - height = GetValue$l(config, 'height', 2); - barColor = GetValue$l(config, 'barColor', undefined); - value = GetValue$l(config, 'value', 0); + + width = config.width; + height = config.height; + barColor = config.barColor; + value = config.value; } else if (IsPlainObject$4(barColor)) { config = barColor; - barColor = GetValue$l(config, 'barColor', undefined); - value = GetValue$l(config, 'value', 0); + + barColor = config.barColor; + value = config.value; } + if (x === undefined) { x = 0; } + if (y === undefined) { y = 0; } + if (width === undefined) { width = 2; } + if (height === undefined) { height = width; } + if (value === undefined) { value = 0; } + super(scene, x, y, width, height, config); this.type = 'rexLineProgress'; diff --git a/dist/rexdropdownlist.min.js b/dist/rexdropdownlist.min.js index 9470c5d2ac..e77b49e05e 100644 --- a/dist/rexdropdownlist.min.js +++ b/dist/rexdropdownlist.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 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=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 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 _e=/(\S+)\[(\d+)\]/i,Te=Phaser.Utils.Objects.GetValue;var Ee=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=Te(e,"left",0),t.right=Te(e,"right",0),t.top=Te(e,"top",0),t.bottom=Te(e,"bottom",0)),t},De={getInnerPadding(t){return Ee(this.space,t)},setInnerPadding(t,e){return Me(this.space,t,e),this},getOuterPadding(t){return Ee(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)),Ee(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}},Re=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}},Le=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},Ye=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},Ae=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}},Be=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:vi,this.repeatCounter=0,this}stop(){return this.state=pi,this}update(t,e){this.state!==pi&&this.state!==mi&&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=fi)):(this.nowTime=this.duration,this.state=mi):this.nowTime>=0&&(this.state=gi))}get t(){var t;switch(this.state){case pi:case vi:case fi:t=0;break;case gi:t=this.nowTime/this.duration;break;case mi:t=1}return ci(t,0,1)}set t(t){(t=ci(t,-1,1))<0?(this.state=vi,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===pi}get isDelay(){return this.state===vi}get isCountDown(){return this.state===gi}get isRunning(){return this.state===vi||this.state===gi}get isDone(){return this.state===mi}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}}const pi=0,vi=1,gi=2,fi=3,mi=-1;class yi extends oi{constructor(t,e){super(t,e),this.timer=new ui}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 bi=Phaser.Utils.Objects.GetValue,Ci=Phaser.Utils.Objects.GetAdvancedValue,xi=Phaser.Tweens.Builders.GetEaseFunction;class Si extends yi{resetFromJSON(t){return this.timer.resetFromJSON(bi(t,"timer")),this.setEnable(bi(t,"enable",!0)),this.setTarget(bi(t,"target",this.parent)),this.setDelay(Ci(t,"delay",0)),this.setDuration(Ci(t,"duration",1e3)),this.setEase(bi(t,"ease","Linear")),this.setRepeat(bi(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 wi=Phaser.Utils.Objects.GetValue,Pi=Phaser.Utils.Objects.GetAdvancedValue,Oi=Phaser.Math.Linear;let ki=class extends Si{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(Pi(t,"start",void 0),Pi(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=_i[t]),this.mode=t,this}setScaleRange(t,e){return"number"==typeof t?(this.startX=t,this.startY=t):(this.startX=Pi(t,"x",this.parent.scaleX),this.startY=Pi(t,"y",this.parent.scaleY)),"number"==typeof e?(this.endX=e,this.endY=e):(this.endX=Pi(e,"x",void 0),this.endY=Pi(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 _i={stop:0,destroy:1,yoyo:2};var Ti=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},Ei=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},Mi=function(t,e){return new Promise((function(i,s){t.once(e,(function(){i()}))}))},Di=function(t){return Mi(t,"complete")};const Ri=Phaser.Utils.Objects.IsPlainObject;var Li={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(Ri(t)){var s=t;t=s.duration,e=s.orientation,i=s.ease}var r=void 0===this._scaleBehavior;return this._scaleBehavior=Ti(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(Ri(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=Ei(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(Ri(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,Li),Xi.onInitScale=function(){Li.onInitScale.call(this);var t=this;this._scaleBehavior.on("update",(function(){var e=ye.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const Yi=Phaser.Utils.Objects.GetValue,zi=Phaser.Utils.Objects.GetAdvancedValue,Ai=Phaser.Math.Linear;class Wi extends Si{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(Yi(t,"mode",0)),this.setAlphaRange(zi(t,"start",this.parent.alpha),zi(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=Bi[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=Ai(this.alphaStart,this.alphaEnd,i)}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Bi={stop:0,destroy:1,yoyo:2},ji=Phaser.Utils.Objects.IsPlainObject;var Ii=function(t,e,i,s){var r,n;ji(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},Fi=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 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(Hi(t)){var i=t;t=i.duration,e=i.alpha}var s=void 0===this._fade;return this._fade=Ii(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(Hi(t)){var i=t;t=i.duration,e=i.destroy}var s=void 0===this._fade;return this._fade=Fi(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()}},Gi={};Object.assign(Gi,Vi),Gi.onInitFade=function(){Vi.onInitFade.call(this);var t=this;this._fade.on("update",(function(){var e=ye.getParentSizer(t);e&&e.resetChildAlphaState(t)}))};const Ni=Phaser.Utils.Objects.GetValue,Ui=Phaser.Utils.Objects.GetAdvancedValue,$i=Phaser.Math.Linear;class Ji extends Si{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){if(super.resetFromJSON(t),this.setMode(Ni(t,"mode",0)),t&&(t.hasOwnProperty("x")||t.hasOwnProperty("y"))){var e=Ui(t,"x",void 0),i=Ui(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=Ui(i,"startX",void 0),this.startY=Ui(i,"startY",void 0),this.endX=Ui(i,"endX",void 0),this.endY=Ui(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 qi={stop:0,destroy:1,yoyo:2};var Ki=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 Zi=Phaser.Utils.Objects.IsPlainObject,Qi=Phaser.Math.Distance.Between;var ts={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(Zi(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*Qi(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 Ji&&(h=n,n=void 0),void 0===n&&(n=!1);var a={};return a.mode=n?1:0,void 0!==i&&(a.startX=Ki(i,t.x),a.endX=t.x),void 0!==s&&(a.startY=Ki(s,t.y),a.endY=t.y),a.duration=e,a.ease=void 0===r?"Linear":r,void 0===h?h=new Ji(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(Zi(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*Qi(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 Ji&&(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=Ki(i,t.x)),void 0!==s&&(a.startY=t.y,a.endY=Ki(s,t.y)),a.duration=e,a.ease=void 0===r?"Linear":r,void 0===h?h=new Ji(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}},es={};Object.assign(es,ts),es.onInitEaseMove=function(){ts.onInitEaseMove.call(this);var t=this;this._easeMove.on("update",(function(){var e=ye.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const is=Phaser.Utils.Objects.GetValue;class ss extends ni{constructor(t,e){super(t,e),this.timer=new ui,this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.timer.resetFromJSON(is(t,"timer")),this.setEnable(is(t,"enable",!0)),this.setMode(is(t,"mode",1)),this.isRunning=is(t,"isRunning",!1),this.setMagnitudeMode(is(t,"magnitudeMode",1)),this.setAxisMode(is(t,"axis",0)),this.setDuration(is(t,"duration",500)),this.setMagnitude(is(t,"magnitude",10)),this.ox=is(t,"ox",void 0),this.oy=is(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=rs[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=ns[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=is(i,"magnitude",void 0),t=is(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 rs={effect:0,behavior:1},ns={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},as=Phaser.Utils.Objects.IsPlainObject;var os={shake(t,e,i){if(as(t)){var s=t;t=s.duration,e=s.magnitude,i=s.magnitudeMode}return void 0===this._shake&&(this._shake=new ss(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 ls=Phaser.Utils.Objects.GetValue,ds=Phaser.Math.Linear;class cs extends Si{constructor(t,e){super(t,e),this.resetFromJSON(),this.boot()}start(t){if(this.timer.isRunning)return this;var e=this.target;this.propertyKey=ls(t,"key","value");var i=e[this.propertyKey];return this.fromValue=ls(t,"from",i),this.toValue=ls(t,"to",i),this.setEase(ls(t,"ease",this.ease)),this.setDuration(ls(t,"duration",this.duration)),this.setRepeat(ls(t,"repeat",0)),this.setDelay(ls(t,"delay",0)),this.setRepeatDelay(ls(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]=ds(this.fromValue,this.toValue,i)}}const us=Phaser.Utils.Objects.IsPlainObject;class ps extends ti{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(us(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(us(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 vs={easeDataTo(t,e,i,s){return this._easeData||(this._easeData=new ps(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,fs={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=Je(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=At),this.transitInCallback=t,this},setTransitOutCallback(t){return t||(t=At),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}},Ws={};Object.assign(Ws,Xs,Ys,zs,As);const Bs=Phaser.Utils.Objects.GetValue;class js extends ti{constructor(t,e){super(t,e),this.setTransitInTime(Bs(e,"duration.in",200)),this.setTransitOutTime(Bs(e,"duration.out",200)),this.setTransitInCallback(Bs(e,"transitIn")),this.setTransitOutCallback(Bs(e,"transitOut")),this.oneShotMode=Bs(e,"destroy",!1),this.delayCallTimer=void 0,this._state=new Ls(this,{eventEmitter:!1,initState:Bs(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,Ws);var Is=function(t){if(t.parentContainer)return Is(t.parentContainer);var e=function(t){var e=t.displayList;return U(e)?e:null}(t);return e?Is(e):t};class Fs extends ti{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 Hs=Phaser.GameObjects.Rectangle;class Vs extends Hs{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 Gs=Phaser.Utils.Objects.GetValue;class Ns extends ti{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=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 $s=Phaser.Utils.Objects.GetValue;class Js extends Vs{constructor(t,e){super(t,$s(e,"color",0),$s(e,"alpha",.8)),this.touchEventStop=new Ns(this,{hitAreaMode:1})}}var qs={popUp(t,e){void 0!==t._modalScaleSave?(t.scaleX=t._modalScaleSave,t.scaleY=t._modalScaleSave):t._modalScaleSave=t.scaleX,Ti(t,e)},scaleDown(t,e){Ei(t,e,void 0,void 0,!1)},fadeIn(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Ii(t,e)},fadeOut(t,e){Fi(t,e,!1)}},Ks=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Ii(t,e,t.alpha)},Zs=function(t,e){Fi(t,e,!1)},Qs=function(t,e,i,s,r){return!(!t||s&&!s(t,e,i)||!rt(t,!0).contains(e,i)||r&&!r(t,e,i))};const tr=Phaser.Utils.Objects.GetValue;let er=class extends js{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 xr={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 Cr(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)||!Pr(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 Or.length=0,!0;return Or.length=0,!1},Or=[];const kr=Phaser.Utils.Objects.GetValue;class _r extends ti{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=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?wr: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 Tr={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 _r(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 Dr=Phaser.Utils.Objects.GetValue;class Rr extends ti{constructor(t,e){super(t,e),this._enable=void 0,this.cooldown=new Mr,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 Lr={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 Rr(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 Rr(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}},Xr={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}},Yr=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=Kr,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===Zr&&this.onDragEnd(),this.pointer=void 0,this.tracerState=Kr,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&&lr(t,s,e,i)}}const Kr=0,Zr=1,Qr="IDLE",tn=Phaser.Utils.Objects.GetValue,en=Phaser.Math.Distance.Between;class sn 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=rn},eventEmitter:!1};this.setRecongizedStateObject(new Rs(s))}resetFromJSON(t){super.resetFromJSON(t),this.setHoldTime(tn(t,"time",250)),this.setTapInterval(tn(t,"tapInterval",200)),this.setDragThreshold(tn(t,"threshold",9)),this.setTapOffset(tn(t,"tapOffset",10));var e=tn(t,"taps",void 0);return void 0!==e?this.setTaps(e):(this.setMaxTaps(tn(t,"maxTaps",void 0)),this.setMinTaps(tn(t,"minTaps",void 0))),this}onDragStart(){switch(this.state){case rn:this.state=nn;break;case nn:var t=this.lastPointer;en(t.upX,t.upY,t.x,t.y)>this.tapOffset&&(this.state=hn,this.state=nn);break;case hn:this.state=nn}}onDragEnd(){this.state===nn&&(this.tapsCount++,this.emit("tapping",this,this.gameObject,this.lastPointer),void 0!==this.maxTaps&&this.tapsCount===this.maxTaps&&(this.state=hn))}onDrag(){this.state!==rn&&this.pointer.getDistance()>this.dragThreshold&&(this.state=rn)}preUpdate(t,e){if(this.isRunning&&this.enable&&this.state===nn){var i=this.lastPointer;i.isDown?t-i.downTime>this.holdTime&&(this.state=rn):t-i.upTime>this.tapInterval&&(void 0===this.minTaps||this.tapsCount>=this.minTaps?this.state=hn:this.state=rn)}}postUpdate(t,e){this.isRunning&&this.enable&&this.state===hn&&(this.state=rn)}get isTapped(){return this.state===hn}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 rn="IDLE",nn="BEGIN",hn="RECOGNIZED",an=Phaser.Utils.Objects.GetValue;class on 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=ln},eventEmitter:!1};this.setRecongizedStateObject(new Rs(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(an(t,"threshold",9)),this.setHoldTime(an(t,"time",251)),this}onDragStart(){this.state=dn,0===this.holdTime&&(this.state=cn)}onDragEnd(){this.state=ln}onDrag(){this.state!==ln&&this.pointer.getDistance()>this.dragThreshold&&(this.state=ln)}preUpdate(t,e){this.isRunning&&this.enable&&this.state===dn&&t-this.pointer.downTime>=this.holdTime&&(this.state=cn)}get isPressed(){return this.state===cn}setHoldTime(t){return this.holdTime=t,this}setDragThreshold(t){return this.dragThreshold=t,this}}const ln="IDLE",dn="BEGIN",cn="RECOGNIZED";Phaser.Utils.Objects.GetValue;var un=function(t){return Ze(t).loop.delta};const pn=Phaser.Math.Distance.Between,vn=Phaser.Math.Angle.Between;var gn={getDt:function(){return un(this.scene)},getVelocity:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return pn(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 vn(e.x,e.y,t.x,t.y)}},fn={"up&down":0,"left&right":1,"4dir":2,"8dir":3},mn={};const yn=Phaser.Utils.Objects.GetValue,bn=Phaser.Math.RadToDeg;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},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(yn(t,"threshold",10)),this.setVelocityThreshold(yn(t,"velocityThreshold",1e3)),this.setDirectionMode(yn(t,"dir","8dir")),this}onDragStart(){this.state=Sn}onDragEnd(){this.state=xn}onDrag(){this.state===Sn&&(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=xn)}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=fn[t]),this.dirMode=t,this}updateDirectionStates(){return function(t,e,i){switch(void 0===i?i={}:!0===i&&(i=mn),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}}(bn(this.getVelocityAngle()),this.dirMode,this),this}clearDirectionStates(){return this.left=!1,this.right=!1,this.up=!1,this.down=!1,this}}Object.assign(Cn.prototype,gn);const xn="IDLE",Sn="BEGIN",wn="RECOGNIZED",Pn=Phaser.Utils.Objects.GetValue,On=Phaser.Utils.Array.SpliceOne,kn=Phaser.Math.Distance.Between,_n=Phaser.Math.Angle.Between;class Tn{constructor(t,e){var i=Je(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(Pn(e,"inputConfig",void 0)),this.setEventEmitter(Pn(e,"eventEmitter",void 0)),this._enable=void 0,this.pointers=[],this.movedState={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setEnable(Pn(t,"enable",!0)),this.bounds=Pn(t,"bounds",void 0),this.tracerState=Mn,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 Mn:this.tracerState=Dn,this.onDrag1Start();break;case Dn:this.tracerState=Rn,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],On(this.pointers,e),this.tracerState){case Dn:this.tracerState=Mn,this.onDrag1End();break;case Rn: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 Rn:this.onDrag2()}}}dragCancel(){return this.tracerState===Rn&&this.onDrag2End(),this.pointers.length=0,ft(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!==Rn)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!==Rn)return 0;var t=this.pointers[0],e=this.pointers[1];return _n(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!==Rn)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.x+e.x)/2}get centerY(){if(this.tracerState!==Rn)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.y+e.y)/2}get prevCenterX(){if(this.tracerState!==Rn)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!==Rn)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=Ln,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(Tn.prototype,Ne);var En={};const Mn=0,Dn=1,Rn=2,Ln="IDLE";Phaser.Utils.Objects.GetValue;const Xn=Phaser.Math.RotateAround;var Yn=function(t,e,i,s){return Xn(t,e,i,s),t.rotation+=s,t},zn={};const An=Phaser.Utils.Objects.GetValue,Wn=Phaser.Math.Angle.WrapDegrees,Bn=Phaser.Math.Angle.ShortestBetween,jn=Phaser.Math.RadToDeg,In=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=zn),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=Wn(jn(this.angleBetween));this.angle=Bn(this.prevAngle,t),this.prevAngle=t,this.state=Gn}break;case Gn:t=Wn(jn(this.angleBetween)),this.angle=Bn(this.prevAngle,t),this.prevAngle=t,this.emit("rotate",this)}}get isRotated(){return this.state===Gn}get rotation(){return In(this.angle)}setDragThreshold(t){return this.dragThreshold=t,this}}.prototype,Fn);const Hn="IDLE",Vn="BEGIN",Gn="RECOGNIZED",Nn=Phaser.Utils.Objects.GetValue;var Un=function(t){var e=Nn(t,"tap",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._tap=new sn(this,e),this._tap.on("tap",(function(t,e,s){zr(i.eventEmitter,`${i.eventNamePrefix}${t.tapsCount}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const $n=Phaser.Utils.Objects.GetValue;var Jn=function(t){var e=$n(t,"press",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._press=new on(this,e),this._press.on("pressstart",(function(t,e,s){zr(i.eventEmitter,`${i.eventNamePrefix}pressstart`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this).on("pressend",(function(t,e,s){zr(i.eventEmitter,`${i.eventNamePrefix}pressend`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const qn=Phaser.Utils.Objects.GetValue;var Kn=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 Cn(this,e),this._swipe.on("swipe",(function(t,e,s){var r=t.left?"left":t.right?"right":t.up?"up":"down";zr(i.eventEmitter,`${i.eventNamePrefix}swipe${r}`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Zn=Phaser.Utils.Objects.GetValue;var Qn=function(t,e){return t.setInteractive(),Zn(e,"dropZone",!1)&&(t.input.dropZone=!0),t._childrenInteractive={targetSizers:Zn(e,"targets",[t]),targetMode:Zn(e,"targetMode","parent"),eventEmitter:Zn(e,"eventEmitter",t),eventNamePrefix:Zn(e,"inputEventPrefix","child.")},Wr.call(t,e),Ir.call(t,e),Vr.call(t,e),$r.call(t,e),Un.call(t,e),Jn.call(t,e),Kn.call(t,e),t},th={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",de),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)}}for(var d,c,u=this.getAllShownChildren([this]),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 lh=Phaser.Utils.Objects.IsPlainObject,dh=Phaser.Utils.Objects.GetValue,ch=Phaser.Display.Align.CENTER,uh={min:0,full:-1};var ph=function(t,e,i,s,r,n,h,a,o,l){ge.call(this,t);var d=t.isRexSpace,c=typeof e;if(null===e)return this;if("number"===c);else if("string"===c)e=uh[e];else if(lh(e)){var u;e=dh(u=e,"proportion",void 0),i=dh(u,"align",ch),s=dh(u,"padding",0),r=dh(u,"expand",!1),n=dh(u,"key",void 0),h=dh(u,"index",void 0),t.isRexSizer||(a=dh(u,"minWidth",void 0),o=dh(u,"minHeight",void 0)),l=dh(u,"fitRatio",0)}return"string"==typeof i&&(i=zt[i]),void 0===e&&(e=d?1:0),void 0===i&&(i=ch),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===a&&(d?a=0:t.isRexSizer||(a=t._minWidth)),void 0===o&&(d?o=0:t.isRexSizer||(o=t._minHeight)),void 0===l||!1===l?l=0:!0===l&&(l=Q(t)/tt(t)),(u=this.getSizerConfig(t)).proportion=e,u.align=i,u.padding=pe(s),u.expand=r,u.fitRatio=0===e?l:0,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},vh={add:ph,addSpace(t){return this.insertSpace(void 0,t),this},insertSpace(t,e){return void 0===e&&(e=1),ph.call(this,new ah(this.scene),{proportion:e,minWidth:0,minHeight:0,index:t}),this},insert(t,e,i,s,r,n,h,a){return lh(i)&&(i.index=t),ph.call(this,e,i,s,r,n,h,t,a),this},insertAtPosition(t,e,i,s,r,n,h,a,o){var l=oh.call(this,t,e);return-1===l&&(l=void 0),this.insert(l,i,s,r,n,h,a,o),this}};const gh=Et.prototype.clear;var fh=function(t){this.backgroundChildren&&(this.backgroundChildren.length=0);var e,i=!t&&this.sizerEventsEnable;if(i&&(e=this.getChildren([])),gh.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,fh.call(this,t),this}},bh={getChildAlign(t){return this.getSizerConfig(t).align},setChildAlign(t,e){return"string"==typeof e&&(e=zt[e]),this.getSizerConfig(t).align=e,this}},Ch={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}},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}},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&&(Fe(t,0,0),e.resolved=!1,this.hasRatioFitChild=!0);return this._childrenProportion=void 0,this.hasProportion0Child=!1,this.proportionLength=void 0,Be.call(this),this},layoutChildren:function(){for(var t,e,i,s,r,n,h,a,o,l,d=this.sizerChildren,c=this.innerLeft,u=this.innerTop,p=this.innerWidth,v=this.innerHeight,g=c,f=u,m=this.startChildIndex,y=0,b=d.length;y0?(e=t-this.getChildrenWidth(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},resolveHeight:function(t){if(void 0!==(t=Ye.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)||Le.call(this)},runWidthWrap:function(t){this.wrapResult||(1===this.orientation&&nh.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&&nh.call(this,void 0,t),Ae.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,vh,yh,bh,Ch,xh,Sh);var Ph=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},Oh={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=Oh[t]),t};const _h=Phaser.Utils.Objects.IsPlainObject,Th=Phaser.Utils.Objects.GetValue;class Eh extends ih{constructor(t,e,i,s,r,n,h){_h(e)?(e=Th(h=e,"x",0),i=Th(h,"y",0),s=Th(h,"width",void 0),r=Th(h,"height",void 0),n=Th(h,"orientation",0)):_h(s)?(s=Th(h=s,"width",void 0),r=Th(h,"height",void 0),n=Th(h,"orientation",0)):_h(n)&&(n=Th(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(Th(h,"space.item",0)),this.setStartChildIndex(Th(h,"startChildIndex",0)),this.setRTL(Th(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=Ph.call(this)),this._childrenProportion}}Object.assign(Eh.prototype,wh);var Mh=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}},Dh={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 Rh extends Eh{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&&(Mh(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&&(Mh(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&&Mh(t,this.iconWidth,this.iconHeight);var e=this.childrenMap.action;e&&void 0!==this.actionWidth&&void 0!==this.actionHeight&&Mh(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(Rh.prototype,Dh);var Lh=function(t,e,i,s,r){if(this.clear().fillStyle(16777215),1===this.shapeType){i=i.left;var n=Math.min(t,e)/2;this.fillCircle(-t*(s-.5),-e*(r-.5),n+i)}else this.fillRect(-t*s-i.left,-e*r-i.top,t+i.left+i.right,e+i.top+i.bottom)},Xh=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};const Yh=Phaser.GameObjects.Graphics;class zh extends Yh{constructor(t,e,i){void 0===e&&(e=0),"string"==typeof e&&(e=Ah[e]),super(t.scene),this.parent=t,this.shapeType=e,this.padding=pe(i),this.setPosition().resize().setVisible(!1)}destroy(){return this.parent=void 0,super.destroy(),this}setPosition(t,e){var i=this.parent;return void 0===t&&(t=i.x),void 0===e&&(e=i.y),super.setPosition(t,e),this}resize(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=pe(i));var r=this.width!==t||this.height!==e,n=this.padding!==i&&!Xh(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,Lh.call(this,t,e,i,s.originX,s.originY),this):this}setOrigin(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,Lh.call(this,this.width,this.height,this.padding,t,e)),this}}const Ah={rectangle:0,circle:1};var Wh=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 Bh=Phaser.GameObjects.Text;var jh=function(t){return t instanceof Bh};const Ih=Phaser.GameObjects.BitmapText;var Fh=function(t){return t instanceof Ih},Hh=/^[\x00-\x7F]+$/,Vh=function(t){return Hh.test(t)},Gh=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},Uh=2;const $h={none:0,word:1,char:Uh,character:Uh,mix:3};var Jh=function(t,e){var i=function(t){return Fh(t)?2:jh(t)?0:1}(t);switch(i){case 0:switch("string"==typeof e&&(e=$h[e]||0),t.style.wrapMode=e,e){case 2:case 3:t.style.wordWrapCallback=Gh;break;default:t.style.wordWrapCallback=null}break;case 1:"string"==typeof e&&(e=$h[e]||0),t.style.wrapMode=e}};const qh=Phaser.Renderer.WebGL.Utils;var Kh={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=qh.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 Zh=Phaser.Display.Color;var Qh={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 Zh);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}},ta={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 ea=Phaser.Display.Canvas.CanvasPool,ia=Phaser.GameObjects.GameObject,sa=Phaser.Utils.String.UUID;class ra extends ia{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=ea.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=sa(),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(){ea.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 na=Phaser.GameObjects.Components;Phaser.Class.mixin(ra,[na.Alpha,na.BlendMode,na.Crop,na.Depth,na.Flip,na.GetBounds,na.Mask,na.Origin,na.Pipeline,na.PostPipeline,na.ScrollFactor,na.Tint,na.Transform,na.Visible,Kh,Qh,ta]);var ha={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 aa{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(aa.prototype,ha);var oa={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 la=Phaser.Math.RotateAround;var da;const ca=Phaser.Geom.Rectangle;var ua,pa=function(t){void 0===ua&&(ua=new ca);var e=t.drawTLX,i=t.drawTLY;return ua.setTo(e,i,t.drawTRX-e,t.drawBLY-i),ua};const va=Phaser.Math.RotateAround;var ga,fa=function(t,e,i,s){return void 0===s?s={}:!0===s&&(void 0===ga&&(ga={}),s=ga),s.x=e,s.y=i,0!==t.rotation&&va(s,0,0,t.rotation),s.x=s.x*t.scaleX+t.drawX,s.y=s.y*t.scaleY+t.drawY,s};const ma=Phaser.GameObjects.Components.TransformMatrix;var ya,ba,Ca={},xa=function(t,e,i,s,r){var n=fa(e,i,s,!0),h=function(t,e,i,s){void 0===s?s={}:!0===s&&(s=Ca);var r=e-t.width*t.originX,n=i-t.height*t.originY;return void 0===ya&&(ya=new ma,ba=new ma),t.parentContainer?t.getWorldTransformMatrix(ya,ba):ya.applyITRS(t.x,t.y,t.rotation,t.scaleX,t.scaleY),ya.transformPoint(r,n,s),s}(t,n.x,n.y,r);return h},Sa=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 xa(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===da&&(da={}),s=da),s.x=(t-i.drawX)/i.scaleX,s.y=(e-i.drawY)/i.scaleY,0!==i.rotation&&la(s,0,0,-i.rotation),s}(t,e,this,!0);return pa(this).contains(i.x,i.y)},getWorldPosition:function(t,e,i){return Sa(this.parent,this,t,e,i)}};Object.assign(wa,oa);const Pa=Phaser.Math.DegToRad,Oa=Phaser.Math.RadToDeg,ka=Phaser.Utils.Objects.GetValue;class _a extends aa{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 Oa(this._rotation)}set angle(t){this.rotation=Pa(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=ka(t,"width",void 0),i=ka(t,"height",void 0),s=ka(t,"scaleX",void 0),r=ka(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(_a.prototype,wa);const Ta=Phaser.Utils.String.Pad;var Ea=function(t,e,i){if(null==t)return t;switch(typeof t){case"string":default:return t;case"number":return`#${Ta(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}},Ma=function(t,e,i){return e.hasOwnProperty(t)?e[t]:i[t]};const Da=Phaser.Utils.Objects.GetValue;let Ra=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=Da(t,"x",0),i=Da(t,"y",0));var s=this.cornerRadius;s.tl=La(Da(t,"tl",void 0),e,i),s.tr=La(Da(t,"tr",void 0),e,i),s.bl=La(Da(t,"bl",void 0),e,i),s.br=La(Da(t,"br",void 0),e,i)}get radiusTL(){var t=this.cornerRadius.tl;return Math.max(t.x,t.y)}set radiusTL(t){Xa(this.cornerRadius.tl,t)}get radiusTR(){var t=this.cornerRadius.tr;return Math.max(t.x,t.y)}set radiusTR(t){Xa(this.cornerRadius.tr,t)}get radiusBL(){var t=this.cornerRadius.bl;return Math.max(t.x,t.y)}set radiusBL(t){Xa(this.cornerRadius.bl,t)}get radiusBR(){var t=this.cornerRadius.br;return Math.max(t.x,t.y)}set radiusBR(t){Xa(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}),Ya(t),t},Xa=function(t,e){"number"==typeof e?(t.x=e,t.y=e):(t.x=Da(e,"x",0),t.y=Da(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)};const za=Phaser.Math.DegToRad;var Aa=function(t){return!t.hasOwnProperty("convex")||t.convex},Wa=function(t){return t.x>0&&t.y>0},Ba=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,Wa(a)?(o=a.x*g,l=a.y*f,Aa(a)?Ba(t,o,l,o,l,180,270,!1,h):Ba(t,0,0,o,l,90,0,!0,h),d=0,c=l):(t.lineTo(0,0),d=0,c=0),a=m.tr,Wa(a)?(o=a.x*g,l=a.y*f,Aa(a)?Ba(t,s-o,l,o,l,270,360,!1,h):Ba(t,s,0,o,l,180,90,!0,h)):t.lineTo(s,0),a=m.br,Wa(a)?(o=a.x*g,l=a.y*f,Aa(a)?Ba(t,s-o,r-l,o,l,0,90,!1,h):Ba(t,s,r,o,l,270,180,!0,h)):t.lineTo(s,r),a=m.bl,Wa(a)?(o=a.x*g,l=a.y*f,Aa(a)?Ba(t,o,r-l,o,l,90,180,!1,h):Ba(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 Ia=Phaser.Utils.Objects.GetValue;class Fa extends _a{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=Ea(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=Ea(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=Ea(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,Ma("color2",t,this),Ma("horizontalGradient",t,this)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,Ma("strokeThickness",t,this)),t.hasOwnProperty("cornerRadius")&&this.setCornerRadius(t.cornerRadius,Ma("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),ja(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 Ha=Phaser.Utils.Objects.GetValue;class Va extends _a{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=Ea(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=Ea(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=Ea(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 Ga=Phaser.Utils.Objects.GetValue;class Na{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(Ga(t,"bold",!1)),this.setItalic(Ga(t,"italic",!1)),this.setFontSize(Ga(t,"fontSize","16px")),this.setFontFamily(Ga(t,"fontFamily","Courier")),this.setColor(Ga(t,"color","#fff")),this.setStrokeStyle(Ga(t,"stroke",null),Ga(t,"strokeThickness",0)),this.setShadow(Ga(t,"shadowColor",null),Ga(t,"shadowOffsetX",0),Ga(t,"shadowOffsetY",0),Ga(t,"shadowBlur",0)),this.setOffset(Ga(t,"offsetX",0),Ga(t,"offsetY",0)),this.setSpace(Ga(t,"leftSpace",0),Ga(t,"rightSpace",0)),this.setAlign(Ga(t,"align",void 0)),this.setBackgroundColor(Ga(t,"backgroundColor",null)),this.setBackgroundHeight(Ga(t,"backgroundHeight",void 0)),this.setBackgroundBottomY(Ga(t,"backgroundBottomY",void 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(Ma("stroke",t,this),Ma("strokeThickness",t,this)),t.hasOwnProperty("shadowColor")&&this.setShadowColor(t.shadowColor),(t.hasOwnProperty("shadowOffsetX")||t.hasOwnProperty("shadowOffsetY"))&&this.setShadowOffset(Ma("shadowOffsetX",t,this),Ma("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),this}setUpdateTextFlag(){return this.parent&&(this.parent.updateTextFlag=!0),this}clone(){return new Na(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=Ea(t),this}get hasFill(){return null!=this.color}setStrokeStyle(t,e){return this.stroke=Ea(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=Ea(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=Ea(t),this}get hasBackgroundColor(){return null!=this.backgroundColor}setBackgroundHeight(t){return this.backgroundHeight=t,this}setBackgroundBottomY(t){return this.backgroundBottomY=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 _a{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,s=this.drawTRX-i+1,r=e.backgroundBottomY;null==r&&(r=this.drawBLY);var n=e.backgroundHeight;null==n&&(n=r-this.drawTLY);var h=r-n;t.fillRect(i,h,s,n)}var a=e.hasFill,o=e.hasStroke;(a||o)&&(e.syncFont(t).syncStyle(t),o&&(e.syncShadow(t),t.strokeText(this.text,0,0)),a&&(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;Phaser.Display.Canvas.CanvasPool;class ho extends _a{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(){!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)}(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 ao extends _a{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 oo extends _a{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 lo extends aa{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 co(t){if(null===t||"object"!=typeof t)return t;if(Array.isArray(t))return t.map((t=>co(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]=co(t[i]));return e}var uo=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 po={none:0,word:1,char:2,character:2,mix:3};var vo=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=yo.call(this)).height,h=l.ascent,i=Math.floor((o-h)/n))}else{var l;n=(l=yo.call(this)).height,h=l.ascent}}else this.fixedHeight>0?void 0===(i=Co(t,"maxLines"))&&(o=this.fixedHeight-s,i=Math.floor(o/n)):i=Co(t,"maxLines",0);void 0===h&&(h=n);var d=0===i,c=Co(t,"wrapMode");void 0===c&&(c=Co(t,"charWrap",!1)?"char":"word"),"string"==typeof c&&(c=po[c]);var u=Co(t,"wrapWidth",void 0);void 0===u&&(this.fixedWidth>0?u=this.fixedWidth-r:(u=1/0,c=0));for(var p=Co(t,"letterSpacing",0),v=Co(t,"hAlign",0),g=Co(t,"vAlign",0),f=Co(t,"justifyPercentage",.25),m=uo({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+=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=wo(t,"maxLines",void 0))){var h=this.fixedWidth-r;i=Math.floor(h/n)+1}}else i=wo(t,"maxLines",0);var a=0===i,o=wo(t,"fixedCharacterHeight",void 0);if(void 0===o){var l=wo(t,"charPerLine",void 0);if(void 0!==l){var d=this.fixedHeight-s;o=Math.floor(d/l)}}var c=wo(t,"wrapHeight",void 0);void 0===c&&(c=this.fixedHeight>0?this.fixedHeight-s:1/0);for(var u=wo(t,"letterSpacing",0),p=wo(t,"rtl",!0),v=wo(t,"hAlign",p?2:0),g=wo(t,"vAlign",0),f=uo({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}),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 Me(i,t,e),this.dirty=this.dirty||s!=i.left||r!=i.right||n!=i.top||h!=i.bottom,this},getPadding:function(t){return Ee(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)),Sa(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 $o=Phaser.Utils.Objects.GetFastValue;var Jo={};class qo{constructor(t){this.pools=$o(t,"pools",Jo)}free(t){if(!this.pools)return this;var e=t.type;return this.pools.hasOwnProperty(e)||(this.pools[e]=new Uo),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=rl(t,r,e,i,n),a=0;a<=el&&0!==h;a++){if((r+=h)<0){r=0;break}h=rl(t,r,e,i,n)}return a===el&&console.warn("FontSizeFit: Test count exceeds 65535"),t.setFontSize(r),nl(t,e,i),t},sl=function(t,e,i){return void 0===i[e]&&(t.setFontSize(e),i[e]={width:t.width,height:t.height}),i[e]},rl=function(t,e,i,s,r){var n,h=sl(t,e,r),a=sl(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)},nl=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,al=Phaser.Utils.Objects.GetValue;class ol extends Rh{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexLabel";var i,s=al(e,"background",void 0),r=al(e,"icon",void 0),n=al(e,"iconMask",void 0),h=al(e,"text",void 0),a=al(e,"action",void 0),o=al(e,"actionMask",void 0),l=al(e,"align",void 0);if(s&&this.addBackground(s),r){0===this.orientation?(h||a)&&(i={right:al(e,"space.icon",0),top:al(e,"space.iconTop",0),bottom:al(e,"space.iconBottom",0),left:al(e,"space.iconLeft",0)}):(h||a)&&(i={bottom:al(e,"space.icon",0),left:al(e,"space.iconLeft",0),right:al(e,"space.iconRight",0),top:al(e,"space.iconTop",0)});var d=al(e,"squareFitIcon",!1)?1:0;if(this.add(r,{proportion:0,padding:i,fitRatio:d}),n&&(n=Wh.call(this,r,r,1)),!d){var c=al(e,"iconSize",void 0);this.setIconSize(al(e,"iconWidth",c),al(e,"iconHeight",c))}}if(h){var u=al(e,"wrapText",!1),p=al(e,"adjustTextFontSize",!1);u?(!0===u&&(u="word"),Jh(h,u),e.expandTextWidth=!0,tl(h)):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 il(t,e,i),t}):(t.runWidthWrap=function(e){return t.setFixedSize&&t.setFixedSize(0,0),il(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=al(e,"space.text",0),m=al(e,"expandTextWidth",!1),y=al(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:al(e,"space.actionTop",0),bottom:al(e,"space.actionBottom",0),right:al(e,"space.actionRight",0)}:{left:al(e,"space.actionLeft",0),right:al(e,"space.actionRight",0),bottom:al(e,"space.actionBottom",0)},d=al(e,"squareFitAction",!1)?1:0,this.add(a,{proportion:0,padding:i,fitRatio:d}),o&&(o=Wh.call(this,a,a,1)),!d)){var b=al(e,"actionSize");this.setActionSize(al(e,"actionWidth",b),al(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 ll={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=dl[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 dl={down:0,up:1},cl=Eh.prototype.add,ul=Eh.prototype.addSpace;var pl=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)&&ul.call(this),cl.call(this,t,{proportion:i,expand:!0});var s=!this.buttonsExpand&&"center"===this.buttonsAlign;s&&ul.call(this),this.hasTailSpace=s}else cl.call(this,t,{proportion:i,expand:!0}),this.hasTailSpace=!1;else if(this.hasTailSpace){var r=this.sizerChildren.length-1;cl.call(this,t,{index:r,proportion:i,expand:!0})}else cl.call(this,t,{proportion:i,expand:!0});return e&&this.buttonGroup.add(t),this},vl={addButton(t){if(dr(t))for(var e=t,i=0,s=e.length;i=0;i--)ml.call(this,e[i],t);return this}},bl=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)}},Cl=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,bl.call(e,t,i,s)}},enumerable:!0,configurable:!0}),t.selected=!1},xl={add(t){return this.buttons.push(t),t._click||(t._click=new Cr(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`),Cl.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=Yl(a.left,a.centerY,t,e))&&(r=o,s=n);var o,l=i[n+1];l&&l.y===a.y||r>(o=Yl(a.right,a.centerY,t,e))&&(r=o,s=n+1)}}return s};const Al=Phaser.Utils.Objects.IsPlainObject,Wl=Phaser.Utils.Objects.GetValue,Bl=Phaser.Display.Align.CENTER;var jl=function(t,e,i,s){return"\n"===t?(this.addNewLine(),this):(ge.call(this,t),Al(e)&&(e=Wl(r=e,"padding",0),i=Wl(r,"key",void 0),s=Wl(r,"index",void 0)),void 0===e&&(e=0),(r=this.getSizerConfig(t)).align=Bl,r.padding=pe(e),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},Il={add(t,e,i){if(dr(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,fh.call(this,t),this}},Vl={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&&Kl.addNewLine(this)}else for(n=0,h=t.length;n=0;i--)id.call(this,e[i],t);return this}};const rd=Phaser.Utils.Objects.GetValue;class nd extends Jl{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 Tl({parent:this,eventEmitter:rd(e,"eventEmitter",this),groupName:rd(e,"groupName",void 0),clickConfig:rd(e,"click",void 0)}).setButtonsType(e);var s=rd(e,"background",void 0),r=rd(e,"buttons",void 0);this.buttonsAlign=rd(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(nd.prototype,Ql,sd,_l,Ml);var hd={v:0,vertical:0,y:0,h:1,horizontal:1,x:1,xy:2,vh:2},ad=function(t,e){void 0===e&&(e="scrollMode"),t.hasOwnProperty(e)||(t[e]=od(t));var i=t[e];return"string"==typeof i&&(i=hd[i]),i},od=function(t){var e=!!t.sliderY||!!t.scrollerY,i=!!t.sliderX||!!t.scrollerX;return e&&i?2:e?0:i?1:0},ld=function(){return Array.prototype.reduce.call(arguments,dd,0)},dd=function(t,e){return t+e};const cd=Phaser.Utils.Objects.IsPlainObject,ud=Phaser.Utils.Objects.GetValue,pd=Phaser.Display.Align.CENTER;var vd=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 fd(this.sizerChildren,null),fh.call(this,t),this}},yd={setColumnSpace(t){if(this.space.column||(this.space.column=[]),this.space.column.length=this.columnCount-1,"number"==typeof t)fd(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},Sd={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=Ye.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===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,fd(this.sizerChildren,null),this.columnProportions=[],this.columnProportions.length=t,"number"==typeof i)fd(this.columnProportions,i);else for(var n=0;n0?e+=t:0===t&&(this.hasColumnProportion0Child=!0);return e},Pd=function(){for(var t,e=0,i=0;i0?e+=t:0===t&&(this.hasRowProportion0Child=!0);return e};const Od=Phaser.Utils.Objects.IsPlainObject,kd=Phaser.Utils.Objects.GetValue;class _d extends ih{constructor(t,e,i,s,r,n,h,a,o,l){Od(e)?(e=kd(l=e,"x",0),i=kd(l,"y",0),s=kd(l,"width",void 0),r=kd(l,"height",void 0),n=kd(l,"column",l.col||0),h=kd(l,"row",0),a=kd(l,"columnProportions",0),o=kd(l,"rowProportions",0)):Od(s)?(s=kd(l=s,"width",void 0),r=kd(l,"height",void 0),n=kd(l,"column",l.col||0),h=kd(l,"row",0),a=kd(l,"columnProportions",0),o=kd(l,"rowProportions",0)):Od(n)?(n=kd(l=n,"column",l.col||0),h=kd(l,"row",0),a=kd(l,"columnProportions",0),o=kd(l,"rowProportions",0)):Od(a)&&(a=kd(l=a,"columnProportions",0),o=kd(l,"rowProportions",0)),super(t,e,i,s,r,l),this.type="rexGridSizer",this.sizerChildren=[],this.addChildrenMap("items",this.sizerChildren),this.setCreateCellContainerCallback(kd(l,"createCellContainerCallback")),this.setIndentLeft(kd(l,"space.indentLeftOdd",0),kd(l,"space.indentLeftEven",0)),this.setIndentTop(kd(l,"space.indentTopOdd",0),kd(l,"space.indentTopEven",0)),this.resetGrid(n,h,a,o,kd(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=wd.call(this)),this._totalColumnProportions}get totalRowProportions(){return void 0===this._totalRowProportions&&(this._totalRowProportions=Pd.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(_d.prototype,Sd);const Td=Phaser.Utils.Objects.GetValue;var Ed=Phaser.Renderer.WebGL.Utils,Md=function(t,e,i,s,r,n){for(var h=Ed.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+")"},Yd=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 zd=Phaser.Renderer.Canvas.SetTransform;var Ad={renderWebGL:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.pipelines.set(e.pipeline),n=Ld(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&&Md(r,h,e,l,a,o),e.isStroked&&Rd(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(zd(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(Bd.prototype,Ad);var jd=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 Id=Phaser.Math.DegToRad;var Fd=function(t,e,i,s,r,n,h,a,o){h&&n>r?n-=360:!h&&n0&&t.y>0};const $d={rectangle:0,circle:1},Jd=Phaser.Utils.Objects.GetValue;class qd extends ti{constructor(t,e){super(t,e),this.style=Jd(e,"style",this);var i=Jd(e,"propertiesMap");this.activeStyle=Kd(e,"active",i),this.hoverStyle=Kd(e,"hover",i),this.disableStyle=Kd(e,"disable",i),this.onModifyStyle=Jd(e,"onModifyStyle")}getStyle(t){return function(t,e,i){if(void 0===i&&(i={}),Array.isArray(e))for(var s=0,r=e.length;s0,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};const Fc=Phaser.Utils.Objects.GetValue,Hc=Phaser.Utils.Objects.IsPlainObject;class Vc extends(gc(ac)){constructor(t,e,i,s,r,n,h,a){Hc(e)?(e=Fc(a=e,"x",0),i=Fc(a,"y",0),s=Fc(a,"width",2),r=Fc(a,"height",2),n=Fc(a,"barColor",void 0),h=Fc(a,"value",0)):Hc(s)?(s=Fc(a=s,"width",2),r=Fc(a,"height",2),n=Fc(a,"barColor",void 0),h=Fc(a,"value",0)):Hc(n)&&(n=Fc(a=n,"barColor",void 0),h=Fc(a,"value",0)),super(t,e,i,s,r,a),this.type="rexLineProgress",this.bootProgressBase(a),this.addShape((new jc).setName("trackFill")).addShape((new jc).setName("bar")).addShape((new jc).setName("trackStroke")),this.setTrackColor(Fc(a,"trackColor",void 0)),this.setBarColor(n),this.setTrackStroke(Fc(a,"trackStrokeThickness",2),Fc(a,"trackStrokeColor",void 0)),this.setSkewX(Fc(a,"skewX",0)),this.setRTL(Fc(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 Gc={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&&Ic(s,0,0,e,i,t).close();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),Ic(h,r,0,n,i,t).close());var a=this.getShape("trackStroke");a.lineStyle(this.trackStrokeThickness,this.trackStrokeColor),a.isStroked&&Ic(a,0,0,e,i,t).end()}};Object.assign(Vc.prototype,Gc);var Nc=function(t){return null==t||""===t||0===t.length},Uc=function(t,e,i,s){if(void 0===s&&(s="."),"object"==typeof t){if(Nc(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(Nc(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=co(i),s=co(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 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 cu(t)?(this.stretchMode.edge=pu(uu(t,"edge",0)),this.stretchMode.internal=pu(uu(t,"internal",0))):(t=pu(t),this.stretchMode.edge=t,this.stretchMode.internal=t),this},getStretchMode:function(t,e){return gu.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 mu=Phaser.Utils.Objects.IsPlainObject,yu=Phaser.Utils.Objects.GetValue,bu=Phaser.GameObjects;var Cu=void 0,xu=function(t,e){if(Cu||(Cu={},Ze(t).events.once("destroy",(function(){for(var t in Cu)Cu[t].destroy();Cu=void 0}))),!Cu.hasOwnProperty(e)){var i=Ze(t).scene.systemScene;(t=new bu[e](i)).setOrigin(0),Cu[e]=t}return Cu[e]};const Su=Phaser.GameObjects.RenderTexture;class wu extends(function(t,e){class i extends t{constructor(t,i,s,r,n,h,a,o,l,d){if(mu(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)):mu(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)):mu(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)):mu(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)):mu(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,fu),i}(Su,"rexNinePatch")){}var Pu={_drawImage:function(t,e,i,s,r,n){var h=xu(this,"Image").setTexture(t,e).setDisplaySize(r,n);this.draw(h,i,s)},_drawTileSprite:function(t,e,i,s,r,n){var h=xu(this,"TileSprite").setTexture(t,e).setSize(r,n);this.draw(h,i,s)}};Object.assign(wu.prototype,Pu);class Ou extends ti{constructor(t,e){return super(t),new Proxy(this,this)}get(t,e){if(qc(t,e))return t[e];var i=t.parent;return qc(i,e)?i[e]:void 0}set(t,e,i){return qc(t,e)?t[e]=i:qc(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 ku=Phaser.Utils.Objects.GetValue;class _u extends wu{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexStatesNinePatch";var i=ku(e,"effects",!0);i&&eu(this,i),this.style=new Ou(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign(_u.prototype,Qd);const Tu=["alpha","tint","flipX","flipY"];var Eu=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 $c(t,e);break;case"image":s=new lu(t,e);break;case"nineSlice":s=e.hasOwnProperty("stretchMode")?new _u(t,e):new nu(t,e);break;default:s=new tc(t,e)}return function(t,e){if(!e)return t;for(var i=0,s=Tu.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 hp=Phaser.Utils.Objects.GetValue,ap=Phaser.Math.Distance.Between;class op extends ti{constructor(t,e){super(t,e),this._enable=void 0,this.rectBoundsInteractive=hp(e,"rectBoundsInteractive",!1),this.rectBoundsInteractive||t.setInteractive(hp(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(hp(t,"enable",!0)),this.holdThreshold=hp(t,"holdThreshold",50),this.pointerOutReleaseEnable=hp(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 un(this.scene)}get speed(){return this.x===this.preX&&this.y===this.preY?0:ap(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 lp=Phaser.Utils.Objects.GetValue;class dp{constructor(t){this.resetFromJSON(t)}resetFromJSON(t){return this.setValue(lp(t,"value",0)),this.setSpeed(lp(t,"speed",0)),this.setAcceleration(lp(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 cp{constructor(){this.value,this.dir,this.movement=new dp}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 gp={y:0,v:0,vertical:0,x:1,h:1,horizontal:1},fp=Phaser.Utils.Objects.GetValue;class mp extends ti{constructor(t,e){switch(super(t,e),this.parent!==this.scene?this.focusMode=fp(e,"focus",!0):this.focusMode=!1,"boolean"==typeof this.focusMode&&(this.focusMode=this.focusMode?1:0),this.setSpeed(fp(e,"speed",.1)),this.setEnable(fp(e,"enable",!0)),this.focusMode){case 0:case 2:this.scene.input.on("wheel",this.onSceneScroll,this);break;default:t.setInteractive(fp(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 yp=Phaser.Utils.Objects.GetValue;var bp=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)?yp(s,l,void 0):yp(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 rp(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);var p=yp(r,"position",0);"string"==typeof p&&(p=Cp[p]);var v,g,f=yp(s,`space.slider${i}`,void 0);void 0===f&&void 0===(f=yp(s,"space.slider",void 0))&&(a?f=0:v=yp(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:yp(v,"right",v)}):(d=0,c=1,u=void 0===v?g?{right:f}:f:{right:yp(v,"left",v)}):0===p?(d=1,c=2,u=void 0===v?g?{top:f}:f:{top:yp(v,"bottom",v)}):(d=1,c=0,u=void 0===v?g?{bottom:f}:f:{bottom:yp(v,"top",v)}),e.add(n,{column:d,row:c,align:"center",padding:u,expand:!0}),t[`hideUnscrollableSlider${i}`]=yp(r,"hideUnscrollableSlider",!1),t[`adaptThumb${i}SizeMode`]=yp(r,"adaptThumbSize",!1),t[`minThumb${i}Size`]=yp(r,"minThumbSize",void 0)}else t[`hideUnscrollableSlider${i}`]=!1,t[`adaptThumb${i}SizeMode`]=!1,t[`minThumb${i}Size`]=void 0;var m,y,b=yp(s,"scrollDetectionMode");"string"==typeof b&&(b=xp[b]);var C=`scroller${i}`;(m=a||s.hasOwnProperty(C)?yp(s,C,!0):yp(s,"scroller",!0))&&o&&(!0===m&&(m={}),m.orientation=h?0:1,void 0!==b&&(m.rectBoundsInteractive=1===b),y=new vp(o,m),o.isRexContainerLite&&o.sendChildToBack(o));var x,S,w,P,O,k=yp(s,a?`mouseWheelScroller${i}`:"mouseWheelScroller",!1);k&&o&&(void 0!==b&&(k.focus=1===b?2:0),x=new mp(o,k)),t.addChildrenMap(`slider${i}`,n),t.addChildrenMap(`scroller${i}`,y),t.addChildrenMap(`mouseWheelScroller${i}`,x),a&&!h||(t.hideUnscrollableSlider=t[`hideUnscrollableSlider${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",P=`scroll${i}`):(S="t",P="scroll"),n.on("valuechange",(function(e){t[S]=e,t.emit(P,t)}))),y&&(a?(w=`childO${i}`,P=`scroll${i}`):(w="childOY",P="scroll"),y.on("valuechange",(function(e){t[w]=e,t.emit(P,t)}))),x&&(O=a?`addChildO${i}`:"addChildOY",x.on("scroll",(function(e){t[O](-e,!0)})))};const Cp={right:0,left:1,bottom:0,top:1},xp={gameObject:0,rectBounds:1},Sp=Phaser.Utils.Objects.GetValue;var wp=function(t,e){var i=t.scene,s=[0,1,0],r=[0,1,0],n=Sp(e,"width"),h=Sp(e,"height");n||Sp(e,"child.expandWidth",!0)||(s[1]=0),h||Sp(e,"child.expandHeight",!0)||(r[1]=0);var a=new _d(i,{column:3,row:3,columnProportions:s,rowProportions:r});switch(function(t,e,i){var s=Td(i,"child"),r=Td(s,"gameObject",void 0);if(r){var n=Td(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=Td(n,"top",0),h.bottom=Td(n,"bottom",0),a.left=Td(n,"left",0),a.right=Td(n,"right",0);break;case 1:h.top=Td(n,"left",0),h.bottom=Td(n,"right",0),a.top=Td(n,"top",0),a.bottom=Td(n,"bottom",0);break;default:h.top=Td(n,"top",0),h.bottom=Td(n,"bottom",0),h.left=Td(n,"left",0),h.right=Td(n,"right",0)}e.add(r,{column:1,row:1,align:Td(s,"align","center"),padding:a,expand:{width:Td(s,"expandWidth",!0),height:Td(s,"expandHeight",!0)}})}t.addChildrenMap("child",r)}(t,a,e),t.scrollMode){case 0:bp(t,a,"y",e);break;case 1:bp(t,a,"x",e);break;default:bp(t,a,"y",e),bp(t,a,"x",e)}return a},Pp=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}`]}if(s){var n="Y"===t?this.scaleY:this.scaleX;s.setBounds(e,i*n)}r&&r.setEnable(e!==i)},Op=function(t){switch(this.scrollMode){case 0:case 1:(e=this.childrenMap.slider)&&this.hideUnscrollableSlider&&this.setChildVisible(e,this.isOverflow);break;default:t=t.toUpperCase();var e=this.childrenMap[`slider${t}`],i=this[`hideUnscrollableSlider${t}`],s=this[`isOverflow${t}`];e&&i&&this.setChildVisible(e,s)}},kp=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(Up.prototype,Hp);const $p=["top","bottom","centerY","center"],Jp=["left","right","centerX","center"];var qp=function(t,e,i){var s,r="Y"===(e=e.toUpperCase()),n=this.childrenMap.child;if(r){if(i)for(var h=0,a=$p.length;h=0?0:Math.abs(l)<=Math.abs(d)?l:d}}else{if(i)for(h=0,a=Jp.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 Kp=Phaser.Utils.Objects.GetValue;class Zp extends Mp{constructor(t,e){void 0===e&&(e={});var i=ad(e),s=Kp(e,"panel",void 0);void 0===s&&(s={}),s.scrollMode=i,s.clampChildOY=Kp(e,"clampChildOY",!1),s.clampChildOX=Kp(e,"clampChildOX",!1);var r,n,h=new Up(t,s);switch(t.add.existing(h),i){case 0:r=Kp(e,"expand.panel",!0),n=!0;break;case 1:r=!0,n=Kp(e,"expand.panel",!0);break;default:r=!0,n=!0}e.type="rexScrollablePanel",e.child={gameObject:h,expandWidth:r,expandHeight:n,align:Kp(e,"align.panel","center")};var a=Kp(e,"space",void 0);a&&(a.child=Kp(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]),Qn(this.childrenMap.child,t),this}}var Qp={scrollToChild:function(t,e){if(!this.hasChild(t))return this;switch(this.scrollMode){case 0:qp.call(this,t,"y",e);break;case 1:qp.call(this,t,"x",e);break;default:qp.call(this,t,"y",e),qp.call(this,t,"x",e)}return this}};Object.assign(Zp.prototype,Qp);const tv=Phaser.Utils.Objects.GetValue;var ev=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=iv(e,u),this.listMaxHeight>0&&(s.layout(),s.height<=this.listMaxHeight&&(d=s)),!d){0===c&&(c=this.listMaxHeight);var p=sv(e,this.listCreateSliderTrackCallback),v=sv(e,this.listCreateSliderThumbCallback);d=new Zp(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:tv(this.listSpace,"panel",0)}}),e.add.existing(d)}}else u.height=c,s=iv(e,u),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},iv=function(t,e,i){var s;return i?(e.orientation="x",s=new nd(t,e)):(e.orientation="y",s=new Rl(t,e)),t.add.existing(s),s},sv=function(t,e,i){var s;return e&&(s=e.call(i,t),t.add.existing(s)),s},rv=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 av={down:0,up:1},ov=Phaser.Utils.Objects.GetValue;class lv extends js{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=function(t,e){Ti(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 ki(t,n):r.resetFromJSON(n),r.restart()}(t,e,"y","Linear")}),e.manualClose=!0,e.clickOutsideClose=!0,e.destroy=!0,super(t,e),hv(t,e),t.isRexSizer&&t.layout();var i=ov(e,"touchOutsideClose",!1),s=ov(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&&Qs(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 dv={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}},cv={openListPanel:function(){if(this.listPanel)return this;if(0===this.options.length)return this;var t,e=ev.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 lv(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(cv,ll,dv);const uv=Phaser.Utils.Objects.GetValue;class pv extends ol{constructor(t,e){super(t,e),this.type="rexDropDownList",this.timer=void 0,this.listPanel=void 0,this.currentOverIndex=void 0,this.setOptions(uv(e,"options"));var i=uv(e,"list");this.setWrapEnable(uv(i,"wrap",!1)),this.setCreateButtonCallback(uv(i,"createButtonCallback")),this.setCreateListBackgroundCallback(uv(i,"createBackgroundCallback")),this.setCreateListSliderTrackCallback(uv(i,"createTrackCallback")),this.setCreateListSliderThumbCallback(uv(i,"createThumbCallback")),this.setListSliderAdaptThumbSizeEnable(uv(i,"sliderAdaptThumbSize",!1)),this.setListScrollerConfig(uv(i,"scroller")),this.setListMouseWheelScrollerConfig(uv(i,"mouseWheelScroller")),this.setButtonClickCallback(uv(i,"onButtonClick")),this.setButtonOverCallback(uv(i,"onButtonOver")),this.setButtonOutCallback(uv(i,"onButtonOut")),this.setListExpandDirection(uv(i,"expandDirection")),this.setListEaseInDuration(uv(i,"easeIn",500)),this.setListEaseOutDuration(uv(i,"easeOut",100)),this.setListTransitInCallback(uv(i,"transitIn")),this.settListTransitOutCallback(uv(i,"transitOut")),this.setListMaxHeight(uv(i,"maxHeight",0)),this.setListSize(uv(i,"width"),uv(i,"height",0)),this.setListAlignmentMode(uv(i,"alignParent","text")),this.setListAlignmentSide(uv(i,"alignSide","")),this.setListBounds(uv(i,"bounds")),this.setListSpace(uv(i,"space")),this.setListDraggable(uv(i,"draggable",!1)),this.setValueChangeCallback(uv(e,"setValueCallback"),uv(e,"setValueCallbackScope")),this.setValue(uv(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(pv.prototype,cv),pv},"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=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 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 _e=/(\S+)\[(\d+)\]/i,Te=Phaser.Utils.Objects.GetValue;var Ee=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=Te(e,"left",0),t.right=Te(e,"right",0),t.top=Te(e,"top",0),t.bottom=Te(e,"bottom",0)),t},De={getInnerPadding(t){return Ee(this.space,t)},setInnerPadding(t,e){return Me(this.space,t,e),this},getOuterPadding(t){return Ee(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)),Ee(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}},Re=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}},Le=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},Ye=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},Ae=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}},Be=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:vi,this.repeatCounter=0,this}stop(){return this.state=pi,this}update(t,e){this.state!==pi&&this.state!==mi&&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=fi)):(this.nowTime=this.duration,this.state=mi):this.nowTime>=0&&(this.state=gi))}get t(){var t;switch(this.state){case pi:case vi:case fi:t=0;break;case gi:t=this.nowTime/this.duration;break;case mi:t=1}return ci(t,0,1)}set t(t){(t=ci(t,-1,1))<0?(this.state=vi,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===pi}get isDelay(){return this.state===vi}get isCountDown(){return this.state===gi}get isRunning(){return this.state===vi||this.state===gi}get isDone(){return this.state===mi}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}}const pi=0,vi=1,gi=2,fi=3,mi=-1;class yi extends oi{constructor(t,e){super(t,e),this.timer=new ui}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 bi=Phaser.Utils.Objects.GetValue,Ci=Phaser.Utils.Objects.GetAdvancedValue,xi=Phaser.Tweens.Builders.GetEaseFunction;class Si extends yi{resetFromJSON(t){return this.timer.resetFromJSON(bi(t,"timer")),this.setEnable(bi(t,"enable",!0)),this.setTarget(bi(t,"target",this.parent)),this.setDelay(Ci(t,"delay",0)),this.setDuration(Ci(t,"duration",1e3)),this.setEase(bi(t,"ease","Linear")),this.setRepeat(bi(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 wi=Phaser.Utils.Objects.GetValue,Pi=Phaser.Utils.Objects.GetAdvancedValue,Oi=Phaser.Math.Linear;let ki=class extends Si{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(Pi(t,"start",void 0),Pi(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=_i[t]),this.mode=t,this}setScaleRange(t,e){return"number"==typeof t?(this.startX=t,this.startY=t):(this.startX=Pi(t,"x",this.parent.scaleX),this.startY=Pi(t,"y",this.parent.scaleY)),"number"==typeof e?(this.endX=e,this.endY=e):(this.endX=Pi(e,"x",void 0),this.endY=Pi(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 _i={stop:0,destroy:1,yoyo:2};var Ti=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},Ei=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},Mi=function(t,e){return new Promise((function(i,s){t.once(e,(function(){i()}))}))},Di=function(t){return Mi(t,"complete")};const Ri=Phaser.Utils.Objects.IsPlainObject;var Li={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(Ri(t)){var s=t;t=s.duration,e=s.orientation,i=s.ease}var r=void 0===this._scaleBehavior;return this._scaleBehavior=Ti(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(Ri(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=Ei(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(Ri(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,Li),Xi.onInitScale=function(){Li.onInitScale.call(this);var t=this;this._scaleBehavior.on("update",(function(){var e=ye.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const Yi=Phaser.Utils.Objects.GetValue,zi=Phaser.Utils.Objects.GetAdvancedValue,Ai=Phaser.Math.Linear;class Wi extends Si{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(Yi(t,"mode",0)),this.setAlphaRange(zi(t,"start",this.parent.alpha),zi(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=Bi[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=Ai(this.alphaStart,this.alphaEnd,i)}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Bi={stop:0,destroy:1,yoyo:2},ji=Phaser.Utils.Objects.IsPlainObject;var Ii=function(t,e,i,s){var r,n;ji(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},Fi=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 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(Hi(t)){var i=t;t=i.duration,e=i.alpha}var s=void 0===this._fade;return this._fade=Ii(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(Hi(t)){var i=t;t=i.duration,e=i.destroy}var s=void 0===this._fade;return this._fade=Fi(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()}},Gi={};Object.assign(Gi,Vi),Gi.onInitFade=function(){Vi.onInitFade.call(this);var t=this;this._fade.on("update",(function(){var e=ye.getParentSizer(t);e&&e.resetChildAlphaState(t)}))};const Ni=Phaser.Utils.Objects.GetValue,Ui=Phaser.Utils.Objects.GetAdvancedValue,$i=Phaser.Math.Linear;class Ji extends Si{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){if(super.resetFromJSON(t),this.setMode(Ni(t,"mode",0)),t&&(t.hasOwnProperty("x")||t.hasOwnProperty("y"))){var e=Ui(t,"x",void 0),i=Ui(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=Ui(i,"startX",void 0),this.startY=Ui(i,"startY",void 0),this.endX=Ui(i,"endX",void 0),this.endY=Ui(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 qi={stop:0,destroy:1,yoyo:2};var Ki=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 Zi=Phaser.Utils.Objects.IsPlainObject,Qi=Phaser.Math.Distance.Between;var ts={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(Zi(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*Qi(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 Ji&&(h=n,n=void 0),void 0===n&&(n=!1);var a={};return a.mode=n?1:0,void 0!==i&&(a.startX=Ki(i,t.x),a.endX=t.x),void 0!==s&&(a.startY=Ki(s,t.y),a.endY=t.y),a.duration=e,a.ease=void 0===r?"Linear":r,void 0===h?h=new Ji(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(Zi(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*Qi(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 Ji&&(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=Ki(i,t.x)),void 0!==s&&(a.startY=t.y,a.endY=Ki(s,t.y)),a.duration=e,a.ease=void 0===r?"Linear":r,void 0===h?h=new Ji(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}},es={};Object.assign(es,ts),es.onInitEaseMove=function(){ts.onInitEaseMove.call(this);var t=this;this._easeMove.on("update",(function(){var e=ye.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const is=Phaser.Utils.Objects.GetValue;class ss extends ni{constructor(t,e){super(t,e),this.timer=new ui,this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.timer.resetFromJSON(is(t,"timer")),this.setEnable(is(t,"enable",!0)),this.setMode(is(t,"mode",1)),this.isRunning=is(t,"isRunning",!1),this.setMagnitudeMode(is(t,"magnitudeMode",1)),this.setAxisMode(is(t,"axis",0)),this.setDuration(is(t,"duration",500)),this.setMagnitude(is(t,"magnitude",10)),this.ox=is(t,"ox",void 0),this.oy=is(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=rs[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=ns[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=is(i,"magnitude",void 0),t=is(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 rs={effect:0,behavior:1},ns={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},as=Phaser.Utils.Objects.IsPlainObject;var os={shake(t,e,i){if(as(t)){var s=t;t=s.duration,e=s.magnitude,i=s.magnitudeMode}return void 0===this._shake&&(this._shake=new ss(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 ls=Phaser.Utils.Objects.GetValue,ds=Phaser.Math.Linear;class cs extends Si{constructor(t,e){super(t,e),this.resetFromJSON(),this.boot()}start(t){if(this.timer.isRunning)return this;var e=this.target;this.propertyKey=ls(t,"key","value");var i=e[this.propertyKey];return this.fromValue=ls(t,"from",i),this.toValue=ls(t,"to",i),this.setEase(ls(t,"ease",this.ease)),this.setDuration(ls(t,"duration",this.duration)),this.setRepeat(ls(t,"repeat",0)),this.setDelay(ls(t,"delay",0)),this.setRepeatDelay(ls(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]=ds(this.fromValue,this.toValue,i)}}const us=Phaser.Utils.Objects.IsPlainObject;class ps extends ti{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(us(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(us(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 vs={easeDataTo(t,e,i,s){return this._easeData||(this._easeData=new ps(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,fs={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=Je(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=At),this.transitInCallback=t,this},setTransitOutCallback(t){return t||(t=At),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}},Ws={};Object.assign(Ws,Xs,Ys,zs,As);const Bs=Phaser.Utils.Objects.GetValue;class js extends ti{constructor(t,e){super(t,e),this.setTransitInTime(Bs(e,"duration.in",200)),this.setTransitOutTime(Bs(e,"duration.out",200)),this.setTransitInCallback(Bs(e,"transitIn")),this.setTransitOutCallback(Bs(e,"transitOut")),this.oneShotMode=Bs(e,"destroy",!1),this.delayCallTimer=void 0,this._state=new Ls(this,{eventEmitter:!1,initState:Bs(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,Ws);var Is=function(t){if(t.parentContainer)return Is(t.parentContainer);var e=function(t){var e=t.displayList;return U(e)?e:null}(t);return e?Is(e):t};class Fs extends ti{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 Hs=Phaser.GameObjects.Rectangle;class Vs extends Hs{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 Gs=Phaser.Utils.Objects.GetValue;class Ns extends ti{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=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 $s=Phaser.Utils.Objects.GetValue;class Js extends Vs{constructor(t,e){super(t,$s(e,"color",0),$s(e,"alpha",.8)),this.touchEventStop=new Ns(this,{hitAreaMode:1})}}var qs={popUp(t,e){void 0!==t._modalScaleSave?(t.scaleX=t._modalScaleSave,t.scaleY=t._modalScaleSave):t._modalScaleSave=t.scaleX,Ti(t,e)},scaleDown(t,e){Ei(t,e,void 0,void 0,!1)},fadeIn(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Ii(t,e)},fadeOut(t,e){Fi(t,e,!1)}},Ks=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Ii(t,e,t.alpha)},Zs=function(t,e){Fi(t,e,!1)},Qs=function(t,e,i,s,r){return!(!t||s&&!s(t,e,i)||!rt(t,!0).contains(e,i)||r&&!r(t,e,i))};const tr=Phaser.Utils.Objects.GetValue;let er=class extends js{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 xr={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 Cr(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)||!Pr(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 Or.length=0,!0;return Or.length=0,!1},Or=[];const kr=Phaser.Utils.Objects.GetValue;class _r extends ti{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=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?wr: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 Tr={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 _r(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 Dr=Phaser.Utils.Objects.GetValue;class Rr extends ti{constructor(t,e){super(t,e),this._enable=void 0,this.cooldown=new Mr,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 Lr={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 Rr(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 Rr(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}},Xr={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}},Yr=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=Kr,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===Zr&&this.onDragEnd(),this.pointer=void 0,this.tracerState=Kr,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&&lr(t,s,e,i)}}const Kr=0,Zr=1,Qr="IDLE",tn=Phaser.Utils.Objects.GetValue,en=Phaser.Math.Distance.Between;class sn 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=rn},eventEmitter:!1};this.setRecongizedStateObject(new Rs(s))}resetFromJSON(t){super.resetFromJSON(t),this.setHoldTime(tn(t,"time",250)),this.setTapInterval(tn(t,"tapInterval",200)),this.setDragThreshold(tn(t,"threshold",9)),this.setTapOffset(tn(t,"tapOffset",10));var e=tn(t,"taps",void 0);return void 0!==e?this.setTaps(e):(this.setMaxTaps(tn(t,"maxTaps",void 0)),this.setMinTaps(tn(t,"minTaps",void 0))),this}onDragStart(){switch(this.state){case rn:this.state=nn;break;case nn:var t=this.lastPointer;en(t.upX,t.upY,t.x,t.y)>this.tapOffset&&(this.state=hn,this.state=nn);break;case hn:this.state=nn}}onDragEnd(){this.state===nn&&(this.tapsCount++,this.emit("tapping",this,this.gameObject,this.lastPointer),void 0!==this.maxTaps&&this.tapsCount===this.maxTaps&&(this.state=hn))}onDrag(){this.state!==rn&&this.pointer.getDistance()>this.dragThreshold&&(this.state=rn)}preUpdate(t,e){if(this.isRunning&&this.enable&&this.state===nn){var i=this.lastPointer;i.isDown?t-i.downTime>this.holdTime&&(this.state=rn):t-i.upTime>this.tapInterval&&(void 0===this.minTaps||this.tapsCount>=this.minTaps?this.state=hn:this.state=rn)}}postUpdate(t,e){this.isRunning&&this.enable&&this.state===hn&&(this.state=rn)}get isTapped(){return this.state===hn}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 rn="IDLE",nn="BEGIN",hn="RECOGNIZED",an=Phaser.Utils.Objects.GetValue;class on 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=ln},eventEmitter:!1};this.setRecongizedStateObject(new Rs(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(an(t,"threshold",9)),this.setHoldTime(an(t,"time",251)),this}onDragStart(){this.state=dn,0===this.holdTime&&(this.state=cn)}onDragEnd(){this.state=ln}onDrag(){this.state!==ln&&this.pointer.getDistance()>this.dragThreshold&&(this.state=ln)}preUpdate(t,e){this.isRunning&&this.enable&&this.state===dn&&t-this.pointer.downTime>=this.holdTime&&(this.state=cn)}get isPressed(){return this.state===cn}setHoldTime(t){return this.holdTime=t,this}setDragThreshold(t){return this.dragThreshold=t,this}}const ln="IDLE",dn="BEGIN",cn="RECOGNIZED";Phaser.Utils.Objects.GetValue;var un=function(t){return Ze(t).loop.delta};const pn=Phaser.Math.Distance.Between,vn=Phaser.Math.Angle.Between;var gn={getDt:function(){return un(this.scene)},getVelocity:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return pn(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 vn(e.x,e.y,t.x,t.y)}},fn={"up&down":0,"left&right":1,"4dir":2,"8dir":3},mn={};const yn=Phaser.Utils.Objects.GetValue,bn=Phaser.Math.RadToDeg;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},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(yn(t,"threshold",10)),this.setVelocityThreshold(yn(t,"velocityThreshold",1e3)),this.setDirectionMode(yn(t,"dir","8dir")),this}onDragStart(){this.state=Sn}onDragEnd(){this.state=xn}onDrag(){this.state===Sn&&(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=xn)}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=fn[t]),this.dirMode=t,this}updateDirectionStates(){return function(t,e,i){switch(void 0===i?i={}:!0===i&&(i=mn),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}}(bn(this.getVelocityAngle()),this.dirMode,this),this}clearDirectionStates(){return this.left=!1,this.right=!1,this.up=!1,this.down=!1,this}}Object.assign(Cn.prototype,gn);const xn="IDLE",Sn="BEGIN",wn="RECOGNIZED",Pn=Phaser.Utils.Objects.GetValue,On=Phaser.Utils.Array.SpliceOne,kn=Phaser.Math.Distance.Between,_n=Phaser.Math.Angle.Between;class Tn{constructor(t,e){var i=Je(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(Pn(e,"inputConfig",void 0)),this.setEventEmitter(Pn(e,"eventEmitter",void 0)),this._enable=void 0,this.pointers=[],this.movedState={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setEnable(Pn(t,"enable",!0)),this.bounds=Pn(t,"bounds",void 0),this.tracerState=Mn,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 Mn:this.tracerState=Dn,this.onDrag1Start();break;case Dn:this.tracerState=Rn,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],On(this.pointers,e),this.tracerState){case Dn:this.tracerState=Mn,this.onDrag1End();break;case Rn: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 Rn:this.onDrag2()}}}dragCancel(){return this.tracerState===Rn&&this.onDrag2End(),this.pointers.length=0,ft(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!==Rn)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!==Rn)return 0;var t=this.pointers[0],e=this.pointers[1];return _n(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!==Rn)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.x+e.x)/2}get centerY(){if(this.tracerState!==Rn)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.y+e.y)/2}get prevCenterX(){if(this.tracerState!==Rn)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!==Rn)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=Ln,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(Tn.prototype,Ne);var En={};const Mn=0,Dn=1,Rn=2,Ln="IDLE";Phaser.Utils.Objects.GetValue;const Xn=Phaser.Math.RotateAround;var Yn=function(t,e,i,s){return Xn(t,e,i,s),t.rotation+=s,t},zn={};const An=Phaser.Utils.Objects.GetValue,Wn=Phaser.Math.Angle.WrapDegrees,Bn=Phaser.Math.Angle.ShortestBetween,jn=Phaser.Math.RadToDeg,In=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=zn),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=Wn(jn(this.angleBetween));this.angle=Bn(this.prevAngle,t),this.prevAngle=t,this.state=Gn}break;case Gn:t=Wn(jn(this.angleBetween)),this.angle=Bn(this.prevAngle,t),this.prevAngle=t,this.emit("rotate",this)}}get isRotated(){return this.state===Gn}get rotation(){return In(this.angle)}setDragThreshold(t){return this.dragThreshold=t,this}}.prototype,Fn);const Hn="IDLE",Vn="BEGIN",Gn="RECOGNIZED",Nn=Phaser.Utils.Objects.GetValue;var Un=function(t){var e=Nn(t,"tap",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._tap=new sn(this,e),this._tap.on("tap",(function(t,e,s){zr(i.eventEmitter,`${i.eventNamePrefix}${t.tapsCount}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const $n=Phaser.Utils.Objects.GetValue;var Jn=function(t){var e=$n(t,"press",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._press=new on(this,e),this._press.on("pressstart",(function(t,e,s){zr(i.eventEmitter,`${i.eventNamePrefix}pressstart`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this).on("pressend",(function(t,e,s){zr(i.eventEmitter,`${i.eventNamePrefix}pressend`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const qn=Phaser.Utils.Objects.GetValue;var Kn=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 Cn(this,e),this._swipe.on("swipe",(function(t,e,s){var r=t.left?"left":t.right?"right":t.up?"up":"down";zr(i.eventEmitter,`${i.eventNamePrefix}swipe${r}`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Zn=Phaser.Utils.Objects.GetValue;var Qn=function(t,e){return t.setInteractive(),Zn(e,"dropZone",!1)&&(t.input.dropZone=!0),t._childrenInteractive={targetSizers:Zn(e,"targets",[t]),targetMode:Zn(e,"targetMode","parent"),eventEmitter:Zn(e,"eventEmitter",t),eventNamePrefix:Zn(e,"inputEventPrefix","child.")},Wr.call(t,e),Ir.call(t,e),Vr.call(t,e),$r.call(t,e),Un.call(t,e),Jn.call(t,e),Kn.call(t,e),t},th={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",de),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)}}for(var d,c,u=this.getAllShownChildren([this]),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 lh=Phaser.Utils.Objects.IsPlainObject,dh=Phaser.Utils.Objects.GetValue,ch=Phaser.Display.Align.CENTER,uh={min:0,full:-1};var ph=function(t,e,i,s,r,n,h,a,o,l){ge.call(this,t);var d=t.isRexSpace,c=typeof e;if(null===e)return this;if("number"===c);else if("string"===c)e=uh[e];else if(lh(e)){var u;e=dh(u=e,"proportion",void 0),i=dh(u,"align",ch),s=dh(u,"padding",0),r=dh(u,"expand",!1),n=dh(u,"key",void 0),h=dh(u,"index",void 0),t.isRexSizer||(a=dh(u,"minWidth",void 0),o=dh(u,"minHeight",void 0)),l=dh(u,"fitRatio",0)}return"string"==typeof i&&(i=zt[i]),void 0===e&&(e=d?1:0),void 0===i&&(i=ch),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===a&&(d?a=0:t.isRexSizer||(a=t._minWidth)),void 0===o&&(d?o=0:t.isRexSizer||(o=t._minHeight)),void 0===l||!1===l?l=0:!0===l&&(l=Q(t)/tt(t)),(u=this.getSizerConfig(t)).proportion=e,u.align=i,u.padding=pe(s),u.expand=r,u.fitRatio=0===e?l:0,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},vh={add:ph,addSpace(t){return this.insertSpace(void 0,t),this},insertSpace(t,e){return void 0===e&&(e=1),ph.call(this,new ah(this.scene),{proportion:e,minWidth:0,minHeight:0,index:t}),this},insert(t,e,i,s,r,n,h,a){return lh(i)&&(i.index=t),ph.call(this,e,i,s,r,n,h,t,a),this},insertAtPosition(t,e,i,s,r,n,h,a,o){var l=oh.call(this,t,e);return-1===l&&(l=void 0),this.insert(l,i,s,r,n,h,a,o),this}};const gh=Et.prototype.clear;var fh=function(t){this.backgroundChildren&&(this.backgroundChildren.length=0);var e,i=!t&&this.sizerEventsEnable;if(i&&(e=this.getChildren([])),gh.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,fh.call(this,t),this}},bh={getChildAlign(t){return this.getSizerConfig(t).align},setChildAlign(t,e){return"string"==typeof e&&(e=zt[e]),this.getSizerConfig(t).align=e,this}},Ch={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}},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}},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&&(Fe(t,0,0),e.resolved=!1,this.hasRatioFitChild=!0);return this._childrenProportion=void 0,this.hasProportion0Child=!1,this.proportionLength=void 0,Be.call(this),this},layoutChildren:function(){for(var t,e,i,s,r,n,h,a,o,l,d=this.sizerChildren,c=this.innerLeft,u=this.innerTop,p=this.innerWidth,v=this.innerHeight,g=c,f=u,m=this.startChildIndex,y=0,b=d.length;y0?(e=t-this.getChildrenWidth(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},resolveHeight:function(t){if(void 0!==(t=Ye.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)||Le.call(this)},runWidthWrap:function(t){this.wrapResult||(1===this.orientation&&nh.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&&nh.call(this,void 0,t),Ae.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,vh,yh,bh,Ch,xh,Sh);var Ph=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},Oh={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=Oh[t]),t};const _h=Phaser.Utils.Objects.IsPlainObject,Th=Phaser.Utils.Objects.GetValue;class Eh extends ih{constructor(t,e,i,s,r,n,h){_h(e)?(e=Th(h=e,"x",0),i=Th(h,"y",0),s=Th(h,"width",void 0),r=Th(h,"height",void 0),n=Th(h,"orientation",0)):_h(s)?(s=Th(h=s,"width",void 0),r=Th(h,"height",void 0),n=Th(h,"orientation",0)):_h(n)&&(n=Th(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(Th(h,"space.item",0)),this.setStartChildIndex(Th(h,"startChildIndex",0)),this.setRTL(Th(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=Ph.call(this)),this._childrenProportion}}Object.assign(Eh.prototype,wh);var Mh=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}},Dh={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 Rh extends Eh{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&&(Mh(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&&(Mh(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&&Mh(t,this.iconWidth,this.iconHeight);var e=this.childrenMap.action;e&&void 0!==this.actionWidth&&void 0!==this.actionHeight&&Mh(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(Rh.prototype,Dh);var Lh=function(t,e,i,s,r){if(this.clear().fillStyle(16777215),1===this.shapeType){i=i.left;var n=Math.min(t,e)/2;this.fillCircle(-t*(s-.5),-e*(r-.5),n+i)}else this.fillRect(-t*s-i.left,-e*r-i.top,t+i.left+i.right,e+i.top+i.bottom)},Xh=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};const Yh=Phaser.GameObjects.Graphics;class zh extends Yh{constructor(t,e,i){void 0===e&&(e=0),"string"==typeof e&&(e=Ah[e]),super(t.scene),this.parent=t,this.shapeType=e,this.padding=pe(i),this.setPosition().resize().setVisible(!1)}destroy(){return this.parent=void 0,super.destroy(),this}setPosition(t,e){var i=this.parent;return void 0===t&&(t=i.x),void 0===e&&(e=i.y),super.setPosition(t,e),this}resize(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=pe(i));var r=this.width!==t||this.height!==e,n=this.padding!==i&&!Xh(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,Lh.call(this,t,e,i,s.originX,s.originY),this):this}setOrigin(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,Lh.call(this,this.width,this.height,this.padding,t,e)),this}}const Ah={rectangle:0,circle:1};var Wh=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 Bh=Phaser.GameObjects.Text;var jh=function(t){return t instanceof Bh};const Ih=Phaser.GameObjects.BitmapText;var Fh=function(t){return t instanceof Ih},Hh=/^[\x00-\x7F]+$/,Vh=function(t){return Hh.test(t)},Gh=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},Uh=2;const $h={none:0,word:1,char:Uh,character:Uh,mix:3};var Jh=function(t,e){var i=function(t){return Fh(t)?2:jh(t)?0:1}(t);switch(i){case 0:switch("string"==typeof e&&(e=$h[e]||0),t.style.wrapMode=e,e){case 2:case 3:t.style.wordWrapCallback=Gh;break;default:t.style.wordWrapCallback=null}break;case 1:"string"==typeof e&&(e=$h[e]||0),t.style.wrapMode=e}};const qh=Phaser.Renderer.WebGL.Utils;var Kh={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=qh.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 Zh=Phaser.Display.Color;var Qh={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 Zh);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}},ta={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 ea=Phaser.Display.Canvas.CanvasPool,ia=Phaser.GameObjects.GameObject,sa=Phaser.Utils.String.UUID;class ra extends ia{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=ea.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=sa(),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(){ea.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 na=Phaser.GameObjects.Components;Phaser.Class.mixin(ra,[na.Alpha,na.BlendMode,na.Crop,na.Depth,na.Flip,na.GetBounds,na.Mask,na.Origin,na.Pipeline,na.PostPipeline,na.ScrollFactor,na.Tint,na.Transform,na.Visible,Kh,Qh,ta]);var ha={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 aa{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(aa.prototype,ha);var oa={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 la=Phaser.Math.RotateAround;var da;const ca=Phaser.Geom.Rectangle;var ua,pa=function(t){void 0===ua&&(ua=new ca);var e=t.drawTLX,i=t.drawTLY;return ua.setTo(e,i,t.drawTRX-e,t.drawBLY-i),ua};const va=Phaser.Math.RotateAround;var ga,fa=function(t,e,i,s){return void 0===s?s={}:!0===s&&(void 0===ga&&(ga={}),s=ga),s.x=e,s.y=i,0!==t.rotation&&va(s,0,0,t.rotation),s.x=s.x*t.scaleX+t.drawX,s.y=s.y*t.scaleY+t.drawY,s};const ma=Phaser.GameObjects.Components.TransformMatrix;var ya,ba,Ca={},xa=function(t,e,i,s,r){var n=fa(e,i,s,!0),h=function(t,e,i,s){void 0===s?s={}:!0===s&&(s=Ca);var r=e-t.width*t.originX,n=i-t.height*t.originY;return void 0===ya&&(ya=new ma,ba=new ma),t.parentContainer?t.getWorldTransformMatrix(ya,ba):ya.applyITRS(t.x,t.y,t.rotation,t.scaleX,t.scaleY),ya.transformPoint(r,n,s),s}(t,n.x,n.y,r);return h},Sa=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 xa(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===da&&(da={}),s=da),s.x=(t-i.drawX)/i.scaleX,s.y=(e-i.drawY)/i.scaleY,0!==i.rotation&&la(s,0,0,-i.rotation),s}(t,e,this,!0);return pa(this).contains(i.x,i.y)},getWorldPosition:function(t,e,i){return Sa(this.parent,this,t,e,i)}};Object.assign(wa,oa);const Pa=Phaser.Math.DegToRad,Oa=Phaser.Math.RadToDeg,ka=Phaser.Utils.Objects.GetValue;class _a extends aa{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 Oa(this._rotation)}set angle(t){this.rotation=Pa(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=ka(t,"width",void 0),i=ka(t,"height",void 0),s=ka(t,"scaleX",void 0),r=ka(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(_a.prototype,wa);const Ta=Phaser.Utils.String.Pad;var Ea=function(t,e,i){if(null==t)return t;switch(typeof t){case"string":default:return t;case"number":return`#${Ta(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}},Ma=function(t,e,i){return e.hasOwnProperty(t)?e[t]:i[t]};const Da=Phaser.Utils.Objects.GetValue;let Ra=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=Da(t,"x",0),i=Da(t,"y",0));var s=this.cornerRadius;s.tl=La(Da(t,"tl",void 0),e,i),s.tr=La(Da(t,"tr",void 0),e,i),s.bl=La(Da(t,"bl",void 0),e,i),s.br=La(Da(t,"br",void 0),e,i)}get radiusTL(){var t=this.cornerRadius.tl;return Math.max(t.x,t.y)}set radiusTL(t){Xa(this.cornerRadius.tl,t)}get radiusTR(){var t=this.cornerRadius.tr;return Math.max(t.x,t.y)}set radiusTR(t){Xa(this.cornerRadius.tr,t)}get radiusBL(){var t=this.cornerRadius.bl;return Math.max(t.x,t.y)}set radiusBL(t){Xa(this.cornerRadius.bl,t)}get radiusBR(){var t=this.cornerRadius.br;return Math.max(t.x,t.y)}set radiusBR(t){Xa(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}),Ya(t),t},Xa=function(t,e){"number"==typeof e?(t.x=e,t.y=e):(t.x=Da(e,"x",0),t.y=Da(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)};const za=Phaser.Math.DegToRad;var Aa=function(t){return!t.hasOwnProperty("convex")||t.convex},Wa=function(t){return t.x>0&&t.y>0},Ba=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,Wa(a)?(o=a.x*g,l=a.y*f,Aa(a)?Ba(t,o,l,o,l,180,270,!1,h):Ba(t,0,0,o,l,90,0,!0,h),d=0,c=l):(t.lineTo(0,0),d=0,c=0),a=m.tr,Wa(a)?(o=a.x*g,l=a.y*f,Aa(a)?Ba(t,s-o,l,o,l,270,360,!1,h):Ba(t,s,0,o,l,180,90,!0,h)):t.lineTo(s,0),a=m.br,Wa(a)?(o=a.x*g,l=a.y*f,Aa(a)?Ba(t,s-o,r-l,o,l,0,90,!1,h):Ba(t,s,r,o,l,270,180,!0,h)):t.lineTo(s,r),a=m.bl,Wa(a)?(o=a.x*g,l=a.y*f,Aa(a)?Ba(t,o,r-l,o,l,90,180,!1,h):Ba(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 Ia=Phaser.Utils.Objects.GetValue;class Fa extends _a{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=Ea(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=Ea(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=Ea(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,Ma("color2",t,this),Ma("horizontalGradient",t,this)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,Ma("strokeThickness",t,this)),t.hasOwnProperty("cornerRadius")&&this.setCornerRadius(t.cornerRadius,Ma("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),ja(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 Ha=Phaser.Utils.Objects.GetValue;class Va extends _a{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=Ea(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=Ea(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=Ea(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 Ga=Phaser.Utils.Objects.GetValue;class Na{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(Ga(t,"bold",!1)),this.setItalic(Ga(t,"italic",!1)),this.setFontSize(Ga(t,"fontSize","16px")),this.setFontFamily(Ga(t,"fontFamily","Courier")),this.setColor(Ga(t,"color","#fff")),this.setStrokeStyle(Ga(t,"stroke",null),Ga(t,"strokeThickness",0)),this.setShadow(Ga(t,"shadowColor",null),Ga(t,"shadowOffsetX",0),Ga(t,"shadowOffsetY",0),Ga(t,"shadowBlur",0)),this.setOffset(Ga(t,"offsetX",0),Ga(t,"offsetY",0)),this.setSpace(Ga(t,"leftSpace",0),Ga(t,"rightSpace",0)),this.setAlign(Ga(t,"align",void 0)),this.setBackgroundColor(Ga(t,"backgroundColor",null)),this.setBackgroundHeight(Ga(t,"backgroundHeight",void 0)),this.setBackgroundBottomY(Ga(t,"backgroundBottomY",void 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(Ma("stroke",t,this),Ma("strokeThickness",t,this)),t.hasOwnProperty("shadowColor")&&this.setShadowColor(t.shadowColor),(t.hasOwnProperty("shadowOffsetX")||t.hasOwnProperty("shadowOffsetY"))&&this.setShadowOffset(Ma("shadowOffsetX",t,this),Ma("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),this}setUpdateTextFlag(){return this.parent&&(this.parent.updateTextFlag=!0),this}clone(){return new Na(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=Ea(t),this}get hasFill(){return null!=this.color}setStrokeStyle(t,e){return this.stroke=Ea(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=Ea(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=Ea(t),this}get hasBackgroundColor(){return null!=this.backgroundColor}setBackgroundHeight(t){return this.backgroundHeight=t,this}setBackgroundBottomY(t){return this.backgroundBottomY=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 _a{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,s=this.drawTRX-i+1,r=e.backgroundBottomY;null==r&&(r=this.drawBLY);var n=e.backgroundHeight;null==n&&(n=r-this.drawTLY);var h=r-n;t.fillRect(i,h,s,n)}var a=e.hasFill,o=e.hasStroke;(a||o)&&(e.syncFont(t).syncStyle(t),o&&(e.syncShadow(t),t.strokeText(this.text,0,0)),a&&(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;Phaser.Display.Canvas.CanvasPool;class ho extends _a{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(){!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)}(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 ao extends _a{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 oo extends _a{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 lo extends aa{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 co(t){if(null===t||"object"!=typeof t)return t;if(Array.isArray(t))return t.map((t=>co(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]=co(t[i]));return e}var uo=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 po={none:0,word:1,char:2,character:2,mix:3};var vo=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=yo.call(this)).height,h=l.ascent,i=Math.floor((o-h)/n))}else{var l;n=(l=yo.call(this)).height,h=l.ascent}}else this.fixedHeight>0?void 0===(i=Co(t,"maxLines"))&&(o=this.fixedHeight-s,i=Math.floor(o/n)):i=Co(t,"maxLines",0);void 0===h&&(h=n);var d=0===i,c=Co(t,"wrapMode");void 0===c&&(c=Co(t,"charWrap",!1)?"char":"word"),"string"==typeof c&&(c=po[c]);var u=Co(t,"wrapWidth",void 0);void 0===u&&(this.fixedWidth>0?u=this.fixedWidth-r:(u=1/0,c=0));for(var p=Co(t,"letterSpacing",0),v=Co(t,"hAlign",0),g=Co(t,"vAlign",0),f=Co(t,"justifyPercentage",.25),m=uo({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+=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=wo(t,"maxLines",void 0))){var h=this.fixedWidth-r;i=Math.floor(h/n)+1}}else i=wo(t,"maxLines",0);var a=0===i,o=wo(t,"fixedCharacterHeight",void 0);if(void 0===o){var l=wo(t,"charPerLine",void 0);if(void 0!==l){var d=this.fixedHeight-s;o=Math.floor(d/l)}}var c=wo(t,"wrapHeight",void 0);void 0===c&&(c=this.fixedHeight>0?this.fixedHeight-s:1/0);for(var u=wo(t,"letterSpacing",0),p=wo(t,"rtl",!0),v=wo(t,"hAlign",p?2:0),g=wo(t,"vAlign",0),f=uo({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}),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 Me(i,t,e),this.dirty=this.dirty||s!=i.left||r!=i.right||n!=i.top||h!=i.bottom,this},getPadding:function(t){return Ee(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)),Sa(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 $o=Phaser.Utils.Objects.GetFastValue;var Jo={};class qo{constructor(t){this.pools=$o(t,"pools",Jo)}free(t){if(!this.pools)return this;var e=t.type;return this.pools.hasOwnProperty(e)||(this.pools[e]=new Uo),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=rl(t,r,e,i,n),a=0;a<=el&&0!==h;a++){if((r+=h)<0){r=0;break}h=rl(t,r,e,i,n)}return a===el&&console.warn("FontSizeFit: Test count exceeds 65535"),t.setFontSize(r),nl(t,e,i),t},sl=function(t,e,i){return void 0===i[e]&&(t.setFontSize(e),i[e]={width:t.width,height:t.height}),i[e]},rl=function(t,e,i,s,r){var n,h=sl(t,e,r),a=sl(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)},nl=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,al=Phaser.Utils.Objects.GetValue;class ol extends Rh{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexLabel";var i,s=al(e,"background",void 0),r=al(e,"icon",void 0),n=al(e,"iconMask",void 0),h=al(e,"text",void 0),a=al(e,"action",void 0),o=al(e,"actionMask",void 0),l=al(e,"align",void 0);if(s&&this.addBackground(s),r){0===this.orientation?(h||a)&&(i={right:al(e,"space.icon",0),top:al(e,"space.iconTop",0),bottom:al(e,"space.iconBottom",0),left:al(e,"space.iconLeft",0)}):(h||a)&&(i={bottom:al(e,"space.icon",0),left:al(e,"space.iconLeft",0),right:al(e,"space.iconRight",0),top:al(e,"space.iconTop",0)});var d=al(e,"squareFitIcon",!1)?1:0;if(this.add(r,{proportion:0,padding:i,fitRatio:d}),n&&(n=Wh.call(this,r,r,1)),!d){var c=al(e,"iconSize",void 0);this.setIconSize(al(e,"iconWidth",c),al(e,"iconHeight",c))}}if(h){var u=al(e,"wrapText",!1),p=al(e,"adjustTextFontSize",!1);u?(!0===u&&(u="word"),Jh(h,u),e.expandTextWidth=!0,tl(h)):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 il(t,e,i),t}):(t.runWidthWrap=function(e){return t.setFixedSize&&t.setFixedSize(0,0),il(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=al(e,"space.text",0),m=al(e,"expandTextWidth",!1),y=al(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:al(e,"space.actionTop",0),bottom:al(e,"space.actionBottom",0),right:al(e,"space.actionRight",0)}:{left:al(e,"space.actionLeft",0),right:al(e,"space.actionRight",0),bottom:al(e,"space.actionBottom",0)},d=al(e,"squareFitAction",!1)?1:0,this.add(a,{proportion:0,padding:i,fitRatio:d}),o&&(o=Wh.call(this,a,a,1)),!d)){var b=al(e,"actionSize");this.setActionSize(al(e,"actionWidth",b),al(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 ll={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=dl[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 dl={down:0,up:1},cl=Eh.prototype.add,ul=Eh.prototype.addSpace;var pl=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)&&ul.call(this),cl.call(this,t,{proportion:i,expand:!0});var s=!this.buttonsExpand&&"center"===this.buttonsAlign;s&&ul.call(this),this.hasTailSpace=s}else cl.call(this,t,{proportion:i,expand:!0}),this.hasTailSpace=!1;else if(this.hasTailSpace){var r=this.sizerChildren.length-1;cl.call(this,t,{index:r,proportion:i,expand:!0})}else cl.call(this,t,{proportion:i,expand:!0});return e&&this.buttonGroup.add(t),this},vl={addButton(t){if(dr(t))for(var e=t,i=0,s=e.length;i=0;i--)ml.call(this,e[i],t);return this}},bl=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)}},Cl=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,bl.call(e,t,i,s)}},enumerable:!0,configurable:!0}),t.selected=!1},xl={add(t){return this.buttons.push(t),t._click||(t._click=new Cr(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`),Cl.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=Yl(a.left,a.centerY,t,e))&&(r=o,s=n);var o,l=i[n+1];l&&l.y===a.y||r>(o=Yl(a.right,a.centerY,t,e))&&(r=o,s=n+1)}}return s};const Al=Phaser.Utils.Objects.IsPlainObject,Wl=Phaser.Utils.Objects.GetValue,Bl=Phaser.Display.Align.CENTER;var jl=function(t,e,i,s){return"\n"===t?(this.addNewLine(),this):(ge.call(this,t),Al(e)&&(e=Wl(r=e,"padding",0),i=Wl(r,"key",void 0),s=Wl(r,"index",void 0)),void 0===e&&(e=0),(r=this.getSizerConfig(t)).align=Bl,r.padding=pe(e),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},Il={add(t,e,i){if(dr(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,fh.call(this,t),this}},Vl={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&&Kl.addNewLine(this)}else for(n=0,h=t.length;n=0;i--)id.call(this,e[i],t);return this}};const rd=Phaser.Utils.Objects.GetValue;class nd extends Jl{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 Tl({parent:this,eventEmitter:rd(e,"eventEmitter",this),groupName:rd(e,"groupName",void 0),clickConfig:rd(e,"click",void 0)}).setButtonsType(e);var s=rd(e,"background",void 0),r=rd(e,"buttons",void 0);this.buttonsAlign=rd(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(nd.prototype,Ql,sd,_l,Ml);var hd={v:0,vertical:0,y:0,h:1,horizontal:1,x:1,xy:2,vh:2},ad=function(t,e){void 0===e&&(e="scrollMode"),t.hasOwnProperty(e)||(t[e]=od(t));var i=t[e];return"string"==typeof i&&(i=hd[i]),i},od=function(t){var e=!!t.sliderY||!!t.scrollerY,i=!!t.sliderX||!!t.scrollerX;return e&&i?2:e?0:i?1:0},ld=function(){return Array.prototype.reduce.call(arguments,dd,0)},dd=function(t,e){return t+e};const cd=Phaser.Utils.Objects.IsPlainObject,ud=Phaser.Utils.Objects.GetValue,pd=Phaser.Display.Align.CENTER;var vd=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 fd(this.sizerChildren,null),fh.call(this,t),this}},yd={setColumnSpace(t){if(this.space.column||(this.space.column=[]),this.space.column.length=this.columnCount-1,"number"==typeof t)fd(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},Sd={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=Ye.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===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,fd(this.sizerChildren,null),this.columnProportions=[],this.columnProportions.length=t,"number"==typeof i)fd(this.columnProportions,i);else for(var n=0;n0?e+=t:0===t&&(this.hasColumnProportion0Child=!0);return e},Pd=function(){for(var t,e=0,i=0;i0?e+=t:0===t&&(this.hasRowProportion0Child=!0);return e};const Od=Phaser.Utils.Objects.IsPlainObject,kd=Phaser.Utils.Objects.GetValue;class _d extends ih{constructor(t,e,i,s,r,n,h,a,o,l){Od(e)?(e=kd(l=e,"x",0),i=kd(l,"y",0),s=kd(l,"width",void 0),r=kd(l,"height",void 0),n=kd(l,"column",l.col||0),h=kd(l,"row",0),a=kd(l,"columnProportions",0),o=kd(l,"rowProportions",0)):Od(s)?(s=kd(l=s,"width",void 0),r=kd(l,"height",void 0),n=kd(l,"column",l.col||0),h=kd(l,"row",0),a=kd(l,"columnProportions",0),o=kd(l,"rowProportions",0)):Od(n)?(n=kd(l=n,"column",l.col||0),h=kd(l,"row",0),a=kd(l,"columnProportions",0),o=kd(l,"rowProportions",0)):Od(a)&&(a=kd(l=a,"columnProportions",0),o=kd(l,"rowProportions",0)),super(t,e,i,s,r,l),this.type="rexGridSizer",this.sizerChildren=[],this.addChildrenMap("items",this.sizerChildren),this.setCreateCellContainerCallback(kd(l,"createCellContainerCallback")),this.setIndentLeft(kd(l,"space.indentLeftOdd",0),kd(l,"space.indentLeftEven",0)),this.setIndentTop(kd(l,"space.indentTopOdd",0),kd(l,"space.indentTopEven",0)),this.resetGrid(n,h,a,o,kd(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=wd.call(this)),this._totalColumnProportions}get totalRowProportions(){return void 0===this._totalRowProportions&&(this._totalRowProportions=Pd.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(_d.prototype,Sd);const Td=Phaser.Utils.Objects.GetValue;var Ed=Phaser.Renderer.WebGL.Utils,Md=function(t,e,i,s,r,n){for(var h=Ed.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+")"},Yd=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 zd=Phaser.Renderer.Canvas.SetTransform;var Ad={renderWebGL:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.pipelines.set(e.pipeline),n=Ld(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&&Md(r,h,e,l,a,o),e.isStroked&&Rd(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(zd(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(Bd.prototype,Ad);var jd=function(t){return t.x>0&&t.y>0},Id=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 Fd=Phaser.Math.DegToRad;var Hd=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 Fc=Phaser.Utils.Objects.GetValue,Hc=Phaser.Utils.Objects.IsPlainObject;class Vc extends(gc(ac)){constructor(t,e,i,s,r,n,h,a){Hc(e)?(e=(a=e).x,i=a.y,s=a.width,r=a.height,n=a.barColor,h=a.value):Hc(s)?(s=(a=s).width,r=a.height,n=a.barColor,h=a.value):Hc(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 jc).setName("trackFill")).addShape((new jc).setName("bar")).addShape((new jc).setName("trackStroke")),this.setTrackColor(Fc(a,"trackColor",void 0)),this.setBarColor(n),this.setTrackStroke(Fc(a,"trackStrokeThickness",2),Fc(a,"trackStrokeColor",void 0)),this.setSkewX(Fc(a,"skewX",0)),this.setRTL(Fc(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 Gc={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&&Ic(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),Ic(h,r,0,n,i,t));var a=this.getShape("trackStroke");a.lineStyle(this.trackStrokeThickness,this.trackStrokeColor),a.isStroked&&Ic(a,0,0,e,i,t)}};Object.assign(Vc.prototype,Gc);var Nc=function(t){return null==t||""===t||0===t.length},Uc=function(t,e,i,s){if(void 0===s&&(s="."),"object"==typeof t){if(Nc(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(Nc(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=co(i),s=co(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 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 cu(t)?(this.stretchMode.edge=pu(uu(t,"edge",0)),this.stretchMode.internal=pu(uu(t,"internal",0))):(t=pu(t),this.stretchMode.edge=t,this.stretchMode.internal=t),this},getStretchMode:function(t,e){return gu.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 mu=Phaser.Utils.Objects.IsPlainObject,yu=Phaser.Utils.Objects.GetValue,bu=Phaser.GameObjects;var Cu=void 0,xu=function(t,e){if(Cu||(Cu={},Ze(t).events.once("destroy",(function(){for(var t in Cu)Cu[t].destroy();Cu=void 0}))),!Cu.hasOwnProperty(e)){var i=Ze(t).scene.systemScene;(t=new bu[e](i)).setOrigin(0),Cu[e]=t}return Cu[e]};const Su=Phaser.GameObjects.RenderTexture;class wu extends(function(t,e){class i extends t{constructor(t,i,s,r,n,h,a,o,l,d){if(mu(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)):mu(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)):mu(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)):mu(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)):mu(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,fu),i}(Su,"rexNinePatch")){}var Pu={_drawImage:function(t,e,i,s,r,n){var h=xu(this,"Image").setTexture(t,e).setDisplaySize(r,n);this.draw(h,i,s)},_drawTileSprite:function(t,e,i,s,r,n){var h=xu(this,"TileSprite").setTexture(t,e).setSize(r,n);this.draw(h,i,s)}};Object.assign(wu.prototype,Pu);class Ou extends ti{constructor(t,e){return super(t),new Proxy(this,this)}get(t,e){if(qc(t,e))return t[e];var i=t.parent;return qc(i,e)?i[e]:void 0}set(t,e,i){return qc(t,e)?t[e]=i:qc(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 ku=Phaser.Utils.Objects.GetValue;class _u extends wu{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexStatesNinePatch";var i=ku(e,"effects",!0);i&&eu(this,i),this.style=new Ou(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign(_u.prototype,Qd);const Tu=["alpha","tint","flipX","flipY"];var Eu=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 $c(t,e);break;case"image":s=new lu(t,e);break;case"nineSlice":s=e.hasOwnProperty("stretchMode")?new _u(t,e):new nu(t,e);break;default:s=new tc(t,e)}return function(t,e){if(!e)return t;for(var i=0,s=Tu.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 hp=Phaser.Utils.Objects.GetValue,ap=Phaser.Math.Distance.Between;class op extends ti{constructor(t,e){super(t,e),this._enable=void 0,this.rectBoundsInteractive=hp(e,"rectBoundsInteractive",!1),this.rectBoundsInteractive||t.setInteractive(hp(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(hp(t,"enable",!0)),this.holdThreshold=hp(t,"holdThreshold",50),this.pointerOutReleaseEnable=hp(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 un(this.scene)}get speed(){return this.x===this.preX&&this.y===this.preY?0:ap(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 lp=Phaser.Utils.Objects.GetValue;class dp{constructor(t){this.resetFromJSON(t)}resetFromJSON(t){return this.setValue(lp(t,"value",0)),this.setSpeed(lp(t,"speed",0)),this.setAcceleration(lp(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 cp{constructor(){this.value,this.dir,this.movement=new dp}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 gp={y:0,v:0,vertical:0,x:1,h:1,horizontal:1},fp=Phaser.Utils.Objects.GetValue;class mp extends ti{constructor(t,e){switch(super(t,e),this.parent!==this.scene?this.focusMode=fp(e,"focus",!0):this.focusMode=!1,"boolean"==typeof this.focusMode&&(this.focusMode=this.focusMode?1:0),this.setSpeed(fp(e,"speed",.1)),this.setEnable(fp(e,"enable",!0)),this.focusMode){case 0:case 2:this.scene.input.on("wheel",this.onSceneScroll,this);break;default:t.setInteractive(fp(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 yp=Phaser.Utils.Objects.GetValue;var bp=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)?yp(s,l,void 0):yp(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 rp(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);var p=yp(r,"position",0);"string"==typeof p&&(p=Cp[p]);var v,g,f=yp(s,`space.slider${i}`,void 0);void 0===f&&void 0===(f=yp(s,"space.slider",void 0))&&(a?f=0:v=yp(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:yp(v,"right",v)}):(d=0,c=1,u=void 0===v?g?{right:f}:f:{right:yp(v,"left",v)}):0===p?(d=1,c=2,u=void 0===v?g?{top:f}:f:{top:yp(v,"bottom",v)}):(d=1,c=0,u=void 0===v?g?{bottom:f}:f:{bottom:yp(v,"top",v)}),e.add(n,{column:d,row:c,align:"center",padding:u,expand:!0}),t[`hideUnscrollableSlider${i}`]=yp(r,"hideUnscrollableSlider",!1),t[`adaptThumb${i}SizeMode`]=yp(r,"adaptThumbSize",!1),t[`minThumb${i}Size`]=yp(r,"minThumbSize",void 0)}else t[`hideUnscrollableSlider${i}`]=!1,t[`adaptThumb${i}SizeMode`]=!1,t[`minThumb${i}Size`]=void 0;var m,y,b=yp(s,"scrollDetectionMode");"string"==typeof b&&(b=xp[b]);var C=`scroller${i}`;(m=a||s.hasOwnProperty(C)?yp(s,C,!0):yp(s,"scroller",!0))&&o&&(!0===m&&(m={}),m.orientation=h?0:1,void 0!==b&&(m.rectBoundsInteractive=1===b),y=new vp(o,m),o.isRexContainerLite&&o.sendChildToBack(o));var x,S,w,P,O,k=yp(s,a?`mouseWheelScroller${i}`:"mouseWheelScroller",!1);k&&o&&(void 0!==b&&(k.focus=1===b?2:0),x=new mp(o,k)),t.addChildrenMap(`slider${i}`,n),t.addChildrenMap(`scroller${i}`,y),t.addChildrenMap(`mouseWheelScroller${i}`,x),a&&!h||(t.hideUnscrollableSlider=t[`hideUnscrollableSlider${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",P=`scroll${i}`):(S="t",P="scroll"),n.on("valuechange",(function(e){t[S]=e,t.emit(P,t)}))),y&&(a?(w=`childO${i}`,P=`scroll${i}`):(w="childOY",P="scroll"),y.on("valuechange",(function(e){t[w]=e,t.emit(P,t)}))),x&&(O=a?`addChildO${i}`:"addChildOY",x.on("scroll",(function(e){t[O](-e,!0)})))};const Cp={right:0,left:1,bottom:0,top:1},xp={gameObject:0,rectBounds:1},Sp=Phaser.Utils.Objects.GetValue;var wp=function(t,e){var i=t.scene,s=[0,1,0],r=[0,1,0],n=Sp(e,"width"),h=Sp(e,"height");n||Sp(e,"child.expandWidth",!0)||(s[1]=0),h||Sp(e,"child.expandHeight",!0)||(r[1]=0);var a=new _d(i,{column:3,row:3,columnProportions:s,rowProportions:r});switch(function(t,e,i){var s=Td(i,"child"),r=Td(s,"gameObject",void 0);if(r){var n=Td(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=Td(n,"top",0),h.bottom=Td(n,"bottom",0),a.left=Td(n,"left",0),a.right=Td(n,"right",0);break;case 1:h.top=Td(n,"left",0),h.bottom=Td(n,"right",0),a.top=Td(n,"top",0),a.bottom=Td(n,"bottom",0);break;default:h.top=Td(n,"top",0),h.bottom=Td(n,"bottom",0),h.left=Td(n,"left",0),h.right=Td(n,"right",0)}e.add(r,{column:1,row:1,align:Td(s,"align","center"),padding:a,expand:{width:Td(s,"expandWidth",!0),height:Td(s,"expandHeight",!0)}})}t.addChildrenMap("child",r)}(t,a,e),t.scrollMode){case 0:bp(t,a,"y",e);break;case 1:bp(t,a,"x",e);break;default:bp(t,a,"y",e),bp(t,a,"x",e)}return a},Pp=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}`]}if(s){var n="Y"===t?this.scaleY:this.scaleX;s.setBounds(e,i*n)}r&&r.setEnable(e!==i)},Op=function(t){switch(this.scrollMode){case 0:case 1:(e=this.childrenMap.slider)&&this.hideUnscrollableSlider&&this.setChildVisible(e,this.isOverflow);break;default:t=t.toUpperCase();var e=this.childrenMap[`slider${t}`],i=this[`hideUnscrollableSlider${t}`],s=this[`isOverflow${t}`];e&&i&&this.setChildVisible(e,s)}},kp=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(Up.prototype,Hp);const $p=["top","bottom","centerY","center"],Jp=["left","right","centerX","center"];var qp=function(t,e,i){var s,r="Y"===(e=e.toUpperCase()),n=this.childrenMap.child;if(r){if(i)for(var h=0,a=$p.length;h=0?0:Math.abs(l)<=Math.abs(d)?l:d}}else{if(i)for(h=0,a=Jp.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 Kp=Phaser.Utils.Objects.GetValue;class Zp extends Mp{constructor(t,e){void 0===e&&(e={});var i=ad(e),s=Kp(e,"panel",void 0);void 0===s&&(s={}),s.scrollMode=i,s.clampChildOY=Kp(e,"clampChildOY",!1),s.clampChildOX=Kp(e,"clampChildOX",!1);var r,n,h=new Up(t,s);switch(t.add.existing(h),i){case 0:r=Kp(e,"expand.panel",!0),n=!0;break;case 1:r=!0,n=Kp(e,"expand.panel",!0);break;default:r=!0,n=!0}e.type="rexScrollablePanel",e.child={gameObject:h,expandWidth:r,expandHeight:n,align:Kp(e,"align.panel","center")};var a=Kp(e,"space",void 0);a&&(a.child=Kp(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]),Qn(this.childrenMap.child,t),this}}var Qp={scrollToChild:function(t,e){if(!this.hasChild(t))return this;switch(this.scrollMode){case 0:qp.call(this,t,"y",e);break;case 1:qp.call(this,t,"x",e);break;default:qp.call(this,t,"y",e),qp.call(this,t,"x",e)}return this}};Object.assign(Zp.prototype,Qp);const tv=Phaser.Utils.Objects.GetValue;var ev=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=iv(e,u),this.listMaxHeight>0&&(s.layout(),s.height<=this.listMaxHeight&&(d=s)),!d){0===c&&(c=this.listMaxHeight);var p=sv(e,this.listCreateSliderTrackCallback),v=sv(e,this.listCreateSliderThumbCallback);d=new Zp(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:tv(this.listSpace,"panel",0)}}),e.add.existing(d)}}else u.height=c,s=iv(e,u),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},iv=function(t,e,i){var s;return i?(e.orientation="x",s=new nd(t,e)):(e.orientation="y",s=new Rl(t,e)),t.add.existing(s),s},sv=function(t,e,i){var s;return e&&(s=e.call(i,t),t.add.existing(s)),s},rv=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 av={down:0,up:1},ov=Phaser.Utils.Objects.GetValue;class lv extends js{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=function(t,e){Ti(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 ki(t,n):r.resetFromJSON(n),r.restart()}(t,e,"y","Linear")}),e.manualClose=!0,e.clickOutsideClose=!0,e.destroy=!0,super(t,e),hv(t,e),t.isRexSizer&&t.layout();var i=ov(e,"touchOutsideClose",!1),s=ov(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&&Qs(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 dv={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}},cv={openListPanel:function(){if(this.listPanel)return this;if(0===this.options.length)return this;var t,e=ev.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 lv(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(cv,ll,dv);const uv=Phaser.Utils.Objects.GetValue;class pv extends ol{constructor(t,e){super(t,e),this.type="rexDropDownList",this.timer=void 0,this.listPanel=void 0,this.currentOverIndex=void 0,this.setOptions(uv(e,"options"));var i=uv(e,"list");this.setWrapEnable(uv(i,"wrap",!1)),this.setCreateButtonCallback(uv(i,"createButtonCallback")),this.setCreateListBackgroundCallback(uv(i,"createBackgroundCallback")),this.setCreateListSliderTrackCallback(uv(i,"createTrackCallback")),this.setCreateListSliderThumbCallback(uv(i,"createThumbCallback")),this.setListSliderAdaptThumbSizeEnable(uv(i,"sliderAdaptThumbSize",!1)),this.setListScrollerConfig(uv(i,"scroller")),this.setListMouseWheelScrollerConfig(uv(i,"mouseWheelScroller")),this.setButtonClickCallback(uv(i,"onButtonClick")),this.setButtonOverCallback(uv(i,"onButtonOver")),this.setButtonOutCallback(uv(i,"onButtonOut")),this.setListExpandDirection(uv(i,"expandDirection")),this.setListEaseInDuration(uv(i,"easeIn",500)),this.setListEaseOutDuration(uv(i,"easeOut",100)),this.setListTransitInCallback(uv(i,"transitIn")),this.settListTransitOutCallback(uv(i,"transitOut")),this.setListMaxHeight(uv(i,"maxHeight",0)),this.setListSize(uv(i,"width"),uv(i,"height",0)),this.setListAlignmentMode(uv(i,"alignParent","text")),this.setListAlignmentSide(uv(i,"alignSide","")),this.setListBounds(uv(i,"bounds")),this.setListSpace(uv(i,"space")),this.setListDraggable(uv(i,"draggable",!1)),this.setValueChangeCallback(uv(e,"setValueCallback"),uv(e,"setValueCallbackScope")),this.setValue(uv(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(pv.prototype,cv),pv},"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 9405ece443..ce89152eeb 100644 --- a/dist/rexgameobjectshellplugin.js +++ b/dist/rexgameobjectshellplugin.js @@ -25285,6 +25285,10 @@ Render$2 ); + var IsArcCorner = function (radius) { + return ((radius.x > 0) && (radius.y > 0)); + }; + var LineTo = function (x, y, pathData) { var cnt = pathData.length; if (cnt >= 2) { @@ -25366,8 +25370,7 @@ geom.setTo(0, 0, width, height, radius); } - var iteration = GetValue$1u(radiusConfig, 'iteration', undefined); - this.setIteration(iteration); + this.setIteration(GetValue$1u(radiusConfig, 'iteration', undefined)); this.setPosition(x, y); this.setFillStyle(fillColor, fillAlpha); @@ -25620,10 +25623,6 @@ }; - var IsArcCorner = function (radius) { - return ((radius.x > 0) && (radius.y > 0)); - }; - const ShapeTypeMap = { rectangle: 0, circle: 1 @@ -27390,6 +27389,7 @@ var skewX = this.skewX; var width = this.width - Math.abs(skewX); var height = this.height; + var trackFill = this.getShape('trackFill'); trackFill.fillStyle(this.trackColor); if (trackFill.isFilled) { @@ -27398,8 +27398,7 @@ 0, 0, // x0, y0 width, height, // x1, y1 skewX // skewX - ) - .close(); + ); } var bar = this.getShape('bar'); @@ -27419,8 +27418,7 @@ barX0, 0, // x0, y0 barX1, height, // x1, y1 skewX // skew - ) - .close(); + ); } var trackStroke = this.getShape('trackStroke'); @@ -27431,8 +27429,7 @@ 0, 0, // x0, y0 width, height, // x1, y1 skewX // skewX - ) - .end(); + ); } }; @@ -27452,6 +27449,8 @@ .lineTo(x0, y0).lineTo(startX, y0); } + lines.close(); + return lines; }; @@ -27462,24 +27461,33 @@ constructor(scene, x, y, width, height, barColor, value, config) { if (IsPlainObject$i(x)) { config = x; - x = GetValue$1q(config, 'x', 0); - y = GetValue$1q(config, 'y', 0); - width = GetValue$1q(config, 'width', 2); - height = GetValue$1q(config, 'height', 2); - barColor = GetValue$1q(config, 'barColor', undefined); - value = GetValue$1q(config, 'value', 0); + + x = config.x; + y = config.y; + width = config.width; + height = config.height; + barColor = config.barColor; + value = config.value; } else if (IsPlainObject$i(width)) { config = width; - width = GetValue$1q(config, 'width', 2); - height = GetValue$1q(config, 'height', 2); - barColor = GetValue$1q(config, 'barColor', undefined); - value = GetValue$1q(config, 'value', 0); + + width = config.width; + height = config.height; + barColor = config.barColor; + value = config.value; } else if (IsPlainObject$i(barColor)) { config = barColor; - barColor = GetValue$1q(config, 'barColor', undefined); - value = GetValue$1q(config, 'value', 0); + + barColor = config.barColor; + value = config.value; } + if (x === undefined) { x = 0; } + if (y === undefined) { y = 0; } + if (width === undefined) { width = 2; } + if (height === undefined) { height = width; } + if (value === undefined) { value = 0; } + super(scene, x, y, width, height, config); this.type = 'rexLineProgress'; diff --git a/dist/rexgameobjectshellplugin.min.js b/dist/rexgameobjectshellplugin.min.js index 2b6b27d39e..f20977eaaf 100644 --- a/dist/rexgameobjectshellplugin.min.js +++ b/dist/rexgameobjectshellplugin.min.js @@ -1,4 +1,4 @@ -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},v=function(t){return void 0!==t.displayHeight?t.displayHeight:t.height};const g=Phaser.Geom.Rectangle,f=Phaser.Math.Vector2,m=Phaser.Math.RotateAround;var y=function(t,e){if(void 0===e?e=new g:!0===e&&(void 0===b&&(b=new g),e=b),t.getBounds)return t.getBounds(e);var i,s,r,n,a,o,h,l;if(t.parentContainer){var d=t.parentContainer.getBoundsTransformMatrix();x(t,e),d.transformPoint(e.x,e.y,e),i=e.x,s=e.y,C(t,e),d.transformPoint(e.x,e.y,e),r=e.x,n=e.y,w(t,e),d.transformPoint(e.x,e.y,e),a=e.x,o=e.y,S(t,e),d.transformPoint(e.x,e.y,e),h=e.x,l=e.y}else x(t,e),i=e.x,s=e.y,C(t,e),r=e.x,n=e.y,w(t,e),a=e.x,o=e.y,S(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},b=void 0,x=function(t,e,i){return void 0===e?e=new f:!0===e&&(void 0===O&&(O=new f),e=O),t.getTopLeft?t.getTopLeft(e):(e.x=t.x-p(t)*t.originX,e.y=t.y-v(t)*t.originY,P(t,e,i))},C=function(t,e,i){return void 0===e?e=new f:!0===e&&(void 0===O&&(O=new f),e=O),t.getTopRight?t.getTopRight(e):(e.x=t.x-p(t)*t.originX+p(t),e.y=t.y-v(t)*t.originY,P(t,e,i))},w=function(t,e,i){return void 0===e?e=new f:!0===e&&(void 0===O&&(O=new f),e=O),t.getBottomLeft?t.getBottomLeft(e):(e.x=t.x-p(t)*t.originX,e.y=t.y-v(t)*t.originY+v(t),P(t,e,i))},S=function(t,e,i){return void 0===e?e=new f:!0===e&&(void 0===O&&(O=new f),e=O),t.getBottomRight?t.getBottomRight(e):(e.x=t.x-p(t)*t.originX+p(t),e.y=t.y-v(t)*t.originY+v(t),P(t,e,i))},k=function(t,e,i){void 0===e?e=new f:!0===e&&(void 0===O&&(O=new f),e=O);var s=p(t),r=v(t);return e.x=t.x+s*(.5-t.originX),e.y=t.y+r*(.5-t.originY),P(t,e,i)},O=void 0,P=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},T=function(t,e,i,s,r){return!(!t||s&&!s(t,e,i)||!y(t,!0).contains(e,i)||r&&!r(t,e,i))},_=function(t,e,i){var s=t.camera;return s?(void 0===i?i={}:!0===i&&(i=M),s===e?(i.x=t.worldX,i.y=t.worldY):s.getWorldPoint(t.x,t.y,i),i):null},M={},E=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(t,e.x,e.y,i,s):!!(r=_(e,n,!0))&&T(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=D,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===A&&this.onDragEnd(),this.pointer=void 0,this.tracerState=D,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=B,this}isPointerInGameObject(t,e,i){var s=this.lastPointer;return!!s&&E(t,s,e,i)}}const D=0,A=1,B="IDLE";function j(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=J);break;case q:this.state=J}}onDragEnd(){this.state===J&&(this.tapsCount++,this.emit("tapping",this,this.gameObject,this.lastPointer),void 0!==this.maxTaps&&this.tapsCount===this.maxTaps&&(this.state=q))}onDrag(){this.state!==Z&&this.pointer.getDistance()>this.dragThreshold&&(this.state=Z)}preUpdate(t,e){if(this.isRunning&&this.enable&&this.state===J){var i=this.lastPointer;i.isDown?t-i.downTime>this.holdTime&&(this.state=Z):t-i.upTime>this.tapInterval&&(void 0===this.minTaps||this.tapsCount>=this.minTaps?this.state=q:this.state=Z)}}postUpdate(t,e){this.isRunning&&this.enable&&this.state===q&&(this.state=Z)}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 Z="IDLE",J="BEGIN",q="RECOGNIZED",Q=Phaser.Utils.Objects.GetValue;class tt extends L{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=et},eventEmitter:!1};this.setRecongizedStateObject(new U(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(Q(t,"threshold",9)),this.setHoldTime(Q(t,"time",251)),this}onDragStart(){this.state=it,0===this.holdTime&&(this.state=st)}onDragEnd(){this.state=et}onDrag(){this.state!==et&&this.pointer.getDistance()>this.dragThreshold&&(this.state=et)}preUpdate(t,e){this.isRunning&&this.enable&&this.state===it&&t-this.pointer.downTime>=this.holdTime&&(this.state=st)}get isPressed(){return this.state===st}setHoldTime(t){return this.holdTime=t,this}setDragThreshold(t){return this.dragThreshold=t,this}}const et="IDLE",it="BEGIN",st="RECOGNIZED",rt=Phaser.Utils.Objects.GetValue;class nt extends L{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=_(t,i.pointerCamera,!0);i.endWorldX=e.x,i.endWorldY=e.y,i.emit("panend",i,i.gameObject,i.lastPointer)}}},init:function(){this.state=at},eventEmitter:!1};this.setRecongizedStateObject(new U(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(rt(t,"threshold",10)),this}onDragStart(){this.state=ot,0===this.dragThreshold&&(this.state=ht)}onDragEnd(){this.state=at}onDrag(){switch(this.state){case ot:if(this.pointer.getDistance()>=this.dragThreshold){this.state=ht,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 ht: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=_(t,e,!0);this.worldX=r.x,this.worldY=r.y,this.emit("pan",this,this.gameObject,this.lastPointer)}}get isPanned(){return this.state===ht}setDragThreshold(t){return this.dragThreshold=t,this}}const at="IDLE",ot="BEGIN",ht="RECOGNIZED";var lt=function(t){return o(t).loop.delta};const dt=Phaser.Math.Distance.Between,ct=Phaser.Math.Angle.Between;var ut={getDt:function(){return lt(this.scene)},getVelocity:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return dt(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 ct(e.x,e.y,t.x,t.y)}},pt={"up&down":0,"left&right":1,"4dir":2,"8dir":3},vt={};const gt=Phaser.Utils.Objects.GetValue,ft=Phaser.Math.RadToDeg;class mt extends L{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=yt},eventEmitter:!1};this.setRecongizedStateObject(new U(s)),this.clearDirectionStates()}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(gt(t,"threshold",10)),this.setVelocityThreshold(gt(t,"velocityThreshold",1e3)),this.setDirectionMode(gt(t,"dir","8dir")),this}onDragStart(){this.state=bt}onDragEnd(){this.state=yt}onDrag(){this.state===bt&&(this.validDrag||(this.validDrag=0===this.dragThreshold||this.pointer.getDistance()>=this.dragThreshold),this.validDrag&&this.dragVelocity>this.velocityThreshold&&(this.state=xt))}postUpdate(t,e){this.isRunning&&this.enable&&this.state===xt&&(this.state=yt)}get isSwiped(){return this.state===xt}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=pt[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}}(ft(this.getVelocityAngle()),this.dirMode,this),this}clearDirectionStates(){return this.left=!1,this.right=!1,this.up=!1,this.down=!1,this}}Object.assign(mt.prototype,ut);const yt="IDLE",bt="BEGIN",xt="RECOGNIZED";var Ct=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 wt=Phaser.Utils.Objects.GetValue,St=Phaser.Utils.Array.SpliceOne,kt=Phaser.Math.Distance.Between,Ot=Phaser.Math.Angle.Between;class Pt{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(wt(e,"inputConfig",void 0)),this.setEventEmitter(wt(e,"eventEmitter",void 0)),this._enable=void 0,this.pointers=[],this.movedState={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setEnable(wt(t,"enable",!0)),this.bounds=wt(t,"bounds",void 0),this.tracerState=_t,this.pointers.length=0,Ct(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,Ct(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 _t:this.tracerState=Mt,this.onDrag1Start();break;case Mt:this.tracerState=Et,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],St(this.pointers,e),this.tracerState){case Mt:this.tracerState=_t,this.onDrag1End();break;case Et:this.tracerState=Mt,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 Mt:this.onDrag1();break;case Et:this.onDrag2()}}}dragCancel(){return this.tracerState===Et&&this.onDrag2End(),this.pointers.length=0,Ct(this.movedState),this.tracerState=_t,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!==Et)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!==Et)return 0;var t=this.pointers[0],e=this.pointers[1];return Ot(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;Tt.x=e.x-i.x,Tt.y=e.y-i.y}else Tt.x=0,Tt.y=0;return Tt}get centerX(){if(this.tracerState!==Et)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.x+e.x)/2}get centerY(){if(this.tracerState!==Et)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.y+e.y)/2}get prevCenterX(){if(this.tracerState!==Et)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!==Et)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=Rt,this}isPointer0InGameObject(t,e,i){var s=this.pointers[0];return!!s&&E(t,s,e,i)}isPointer1InGameObject(t,e,i){var s=this.pointers[1];return!!s&&E(t,s,e,i)}}Object.assign(Pt.prototype,e);var Tt={};const _t=0,Mt=1,Et=2,Rt="IDLE",Lt=Phaser.Utils.Objects.GetValue;class Dt extends Pt{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=At},eventEmitter:!1};this.setRecongizedStateObject(new U(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(Lt(t,"threshold",0)),this}onDrag2Start(){this.scaleFactor=1,this.prevDistance=this.distanceBetween,this.state=Bt,0===this.dragThreshold&&(this.state=jt)}onDrag2End(){this.state=At}onDrag2(){switch(this.state){case Bt: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=jt}break;case jt:t=this.distanceBetween,this.scaleFactor=t/this.prevDistance,this.emit("pinch",this),this.prevDistance=t}}get isPinched(){return this.state===jt}setDragThreshold(t){return this.dragThreshold=t,this}}const At="IDLE",Bt="BEGIN",jt="RECOGNIZED",zt=Phaser.Math.RotateAround;var Wt=function(t,e,i,s){return zt(t,e,i,s),t.rotation+=s,t},It={};const Yt=Phaser.Utils.Objects.GetValue,Ft=Phaser.Math.Angle.WrapDegrees,Xt=Phaser.Math.Angle.ShortestBetween,Vt=Phaser.Math.RadToDeg,Gt=Phaser.Math.DegToRad;var Ht={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(Vt(this.angleBetween));this.angle=Xt(this.prevAngle,t),this.prevAngle=t,this.state=$t}break;case $t:t=Ft(Vt(this.angleBetween)),this.angle=Xt(this.prevAngle,t),this.prevAngle=t,this.emit("rotate",this)}}get isRotated(){return this.state===$t}get rotation(){return Gt(this.angle)}setDragThreshold(t){return this.dragThreshold=t,this}}.prototype,Ht);const Ut="IDLE",Nt="BEGIN",$t="RECOGNIZED";var Kt=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 Zt=Phaser.Utils.Objects.GetValue;class Jt extends l{constructor(t,e){void 0===e&&(e={}),super(t,e),this.inputTarget=Zt(e,"inputTarget",t),this.pan=new nt(this.inputTarget);var i=Kt(t,Zt(e,"camera"));this.setCamera(i).setEnable(Zt(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 Qt=Phaser.Utils.Objects.GetValue;Phaser.Math.Clamp;class te extends l{constructor(t,e){void 0===e&&(e={}),super(t,e),this.inputTarget=Qt(e,"inputTarget",t),this.pinch=new Dt(this.inputTarget);var i=Kt(t,Qt(e,"camera"));this.setCamera(i).setEnable(Qt(e,"enable",!0)).setMinZoom(Qt(e,"minZoom",void 0)).setMaxZoom(Qt(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 ee=Phaser.Input.Keyboard.Key,ie=Phaser.Input.Keyboard.KeyCodes,se=["up","down","left","right"];class re{constructor(t){this.scene=t,this.keys={},this.cursorKeys={},this.noKeyDown=!0;for(var e=0,i=se.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 ue=Phaser.Utils.Objects.GetValue;class pe extends l{constructor(t,e){void 0===e&&(e={}),super(t,e),this.cursorAtBounds=new ce(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=Kt(t,ue(e,"camera"));this.setCamera(s).setEnable(ue(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 ge extends c{constructor(t,e){super(t,e);var i=this.scene?"update":"step";this.tickEventName=ve(e,"tickEventName",i),this.isSceneTicker=!fe(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 fe=function(t){return"step"===t||"poststep"===t};const me=Phaser.Utils.Objects.GetValue,ye=Phaser.Math.Clamp;class be{constructor(t){this.resetFromJSON(t)}resetFromJSON(t){this.state=me(t,"state",xe),this.timeScale=me(t,"timeScale",1),this.delay=me(t,"delay",0),this.repeat=me(t,"repeat",0),this.repeatCounter=me(t,"repeatCounter",0),this.repeatDelay=me(t,"repeatDelay",0),this.duration=me(t,"duration",0),this.nowTime=me(t,"nowTime",0),this.justRestart=me(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?we:Ce,this.repeatCounter=0,this}stop(){return this.state=xe,this}update(t,e){this.state!==xe&&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=Se)):(this.nowTime=this.duration,this.state=ke):this.nowTime>=0&&(this.state=we))}get t(){var t;switch(this.state){case xe:case Ce:case Se:t=0;break;case we:t=this.nowTime/this.duration;break;case ke:t=1}return ye(t,0,1)}set t(t){(t=ye(t,-1,1))<0?(this.state=Ce,this.nowTime=-this.delay*t):(this.state=we,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===xe}get isDelay(){return this.state===Ce}get isCountDown(){return this.state===we}get isRunning(){return this.state===Ce||this.state===we}get isDone(){return this.state===ke}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}}const xe=0,Ce=1,we=2,Se=3,ke=-1;class Oe extends ge{constructor(t,e){super(t,e),this.timer=new be}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 Pe=Phaser.Utils.Objects.GetValue,Te=Phaser.Utils.Objects.GetAdvancedValue,_e=Phaser.Tweens.Builders.GetEaseFunction;class Me extends Oe{resetFromJSON(t){return this.timer.resetFromJSON(Pe(t,"timer")),this.setEnable(Pe(t,"enable",!0)),this.setTarget(Pe(t,"target",this.parent)),this.setDelay(Te(t,"delay",0)),this.setDuration(Te(t,"duration",1e3)),this.setEase(Pe(t,"ease","Linear")),this.setRepeat(Pe(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 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 Ee=Phaser.Math.Linear;class Re extends Me{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=Ee(this.startZoomValue,this.endZoomValue,e.t);qt(t,s,i.focusLocalX,i.focusLocalY)}}const Le=Phaser.Utils.Objects.GetValue;Phaser.Math.Clamp;class De extends l{constructor(t,e){void 0===e&&(e={}),super(t,e),this.easeZoom=new Re(this);var i=Kt(t,Le(e,"camera"));this.setEnable(Le(e,"enable",!0)).setMinZoom(Le(e,"minZoom")).setMaxZoom(Le(e,"maxZoom")).setZoomStep(Le(e,"zoomStep",.1)).setEaseDuration(Le(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(Ae(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=Be(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 Ae=function(t,e){return t>=1?Math.log(t)/Math.log(1+e):-Math.log(t)/Math.log(1-e)},Be=function(t,e){return t>=0?Math.pow(1+e,t):Math.pow(1-e,-t)};function je(t){if(null===t||"object"!=typeof t)return t;if(Array.isArray(t))return t.map((t=>je(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]=je(t[i]));return e}const ze=Phaser.Utils.Objects.GetValue;class We extends l{constructor(t,e){super(t,e=void 0===e?{}:je(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 Jt(t,{camera:ze(e,"camera"),inputTarget:ze(e,"inputTarget",t),enable:ze(e,"panScrollEnable",!0)})),ze(e,"pinchZoom",!0)&&(this.pinchZoom=new te(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 pe(t,{camera:ze(e,"camera"),enable:ze(e,"boundsScrollEnable",!0)})),ze(e,"mouseWheelZoom",!0)&&(this.mouseWheelZoom=new De(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},Ye=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 Ge(this.children,t,0,(function(t){t.once("destroy",e.onChildDestroy,e)}),this),this}remove(t,e){var i=this;return He(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;iJe(t),resetChildState(t){return this.resetChildPositionState(t).resetChildVisibleState(t).resetChildAlphaState(t).resetChildActiveState(t),this},resetChildrenState(t){for(var e=0,i=t.length;eJe(t).x,getChildLocalY:t=>Je(t).y};const pi=Phaser.Math.DegToRad;var vi={updateChildRotation(t){var e=Je(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=Je(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 Je(t).rotation=e,this.updateChildRotation(t),this},setChildLocalAngle(t,e){return Je(t).rotation=pi(e),this.updateChildRotation(t),this},resetLocalRotationState(){var t=Je(this).parent;return t&&t.resetChildRotationState(this),this},getChildLocalRotation:t=>Je(t).rotation},gi={updateChildScale(t){var e=Je(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=Je(t),i=e.parent;return e.scaleX=ci(t.scaleX,i.scaleX),e.scaleY=ci(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=Je(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=Je(this).parent;return t&&t.resetChildScaleState(this),this},getChildLocalScaleX:t=>Je(t).scaleX,getChildLocalScaleY:t=>Je(t).scaleY},fi={updateChildVisible(t){var e=Je(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=Je(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),Je(t).visible=e,this.updateChildVisible(t),this},setChildMaskVisible(t,e){return void 0===e&&(e=!0),Je(t).maskVisible=e,this.updateChildVisible(t),this},resetLocalVisibleState(){var t=Je(this).parent;return t&&t.resetChildVisibleState(this),this},getChildLocalVisible:t=>Je(t).visible},mi={updateChildAlpha(t){var e=Je(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=Je(t),i=e.parent;return e.alpha=ci(t.alpha,i.alpha),this},setChildAlpha(t,e){return t.alpha=e,this.resetChildAlphaState(t),this},setChildLocalAlpha(t,e){return Je(t).alpha=e,this.updateChildAlpha(t),this},resetLocalAlphaState(){var t=Je(this).parent;return t&&t.resetChildAlphaState(this),this},getChildLocalAlpha:t=>Je(t).alpha},yi={updateChildActive(t){var e=Je(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 Je(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),Je(t).active=e,this.updateChildActive(t),this},resetLocalActiveState(){var t=Je(this).parent;return t&&t.resetChildActiveState(this),this},getChildLocalActive:t=>Je(t).active},bi={updateChildScrollFactor(t){var e=Je(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}},xi={updateCameraFilter(t){var e=Je(t),i=e.parent;return e.syncCameraFilter&&(t.cameraFilter=i.cameraFilter),this},syncCameraFilter(){return this.syncChildrenEnable&&this.children.forEach(this.updateCameraFilter,this),this}},Ci={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}},wi=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}},Oi=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 Ti=Phaser.Utils.Array;var _i={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 As=Phaser.GameObjects.Rectangle;let Bs=class extends As{constructor(t,e,i){super(t,0,0,2,2,e,1),this.fullWindow=new Ds(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 Bs(this.scene,t,e);return this.scene.add.existing(i),i})),Ye(window,"RexPlugins.GameObjectShell.FullWindowRectangle",Bs);var js={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}},Ws={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,js,zs,Ws);var Ys=function(t){for(var e in t)return!1;return!0},Fs=function(t){return t&&"!"!==t.charAt(0)},Xs={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}},Vs=function(t){return t>>16&255},Gs=function(t){return t>>8&255},Hs=function(t){return 255&t};const Us=Phaser.Events.EventEmitter;var Ns=function(t,e,i,s,r,n){return void 0===n?n={}:!0===n&&(n=$s),"number"!=typeof i&&(i=0,s=0),n.x=r.x+r.width*t+i,n.y=r.y+r.height*e+s,n},$s={},Ks=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=Ns),function(t){if(t.events)return t;var e=new Us,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()},Zs=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},Js=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(er(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}},dr={setCamera(t,e){var i=this.get(t);if(!i)return this;var s=Kt(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}},cr={drawGameObjectsBounds:function(t,e){return this.forEachGO((function(i){i.drawBounds?i.drawBounds(t,e):Zi(i,t,e)})),this}};Object.assign(cr,Xs,sr,rr,nr,ar,or,lr,dr);const ur=Phaser.Utils.Objects.GetValue;class pr{constructor(t,e){this.scene=t,this.BobClass=ur(e,"BobClass",Is),this.setCreateGameObjectCallback(ur(e,"createGameObject"),ur(e,"createGameObjectScope")),this.setEventEmitter(ur(e,"eventEmitter",void 0)),this.setGameObjectDepth(ur(e,"depth",void 0));var i=ur(e,"fade",500);"number"==typeof i?(this.setGOFadeMode(),this.setGOFadeTime(i)):(this.setGOFadeMode(ur(i,"mode")),this.setGOFadeTime(ur(i,"time",500)));var s=ur(e,"viewportCoordinate",!1);!1!==s?(this.setViewportCoordinateEnable(ur(e,"enable",!0)),this.setViewport(ur(s,"viewport"))):this.setViewportCoordinateEnable(!1);var r=ur(e,"effectProperties",!1);this.setEffectPropertiesConfig(r),this.setSymbols(ur(e,"symbols")),this.bobs={},this.removedGOs=[],this._timeScale=1,this.name=ur(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=he(this.scene,this.scene.cameras.main)),this.viewport=t,this}setSymbols(t){return this.symbols=t,this}get isEmpty(){return Ys(this.bobs)&&0===this.removedGOs.length}}Object.assign(pr.prototype,e,cr);var vr={getLayer(t){return this.getGO(t)},getLayers(t){return void 0===t&&(t=[]),this.forEachGO((function(e){t.push(e)})),wi(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 xn=Phaser.Utils.Objects.GetValue;var Cn=function(t,e){return void 0===e?t:t[e]},wn=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=xn(e,"left",0),t.right=xn(e,"right",0),t.top=xn(e,"top",0),t.bottom=xn(e,"bottom",0)),t},Sn={getInnerPadding(t){return Cn(this.space,t)},setInnerPadding(t,e){return wn(this.space,t,e),this},getOuterPadding(t){return Cn(this.getSizerConfig(this).padding,t)},setOuterPadding(t,e){return wn(this.getSizerConfig(this).padding,t,e),this},getChildOuterPadding(t,e){return"string"==typeof t&&(t=this.getElement(t)),Cn(this.getSizerConfig(t).padding,e)},setChildOuterPadding(t,e,i){return"string"==typeof t&&(t=this.getElement(t)),wn(this.getSizerConfig(t).padding,e,i),this}},kn=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}},On=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},Pn=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},Tn=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}},_n=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},Mn=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},En={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}},Rn=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 Fa={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}},Xa={setTransitInTime(t){return this.transitInTime=t,this},setTransitOutTime(t){return this.transitOutTime=t,this},setTransitInCallback(t){return t||(t=Er),this.transitInCallback=t,this},setTransitOutCallback(t){return t||(t=Er),this.transitOutCallback=t,this}},Va={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}},Ga={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}},Ha={};Object.assign(Ha,Fa,Xa,Va,Ga);const Ua=Phaser.Utils.Objects.GetValue;class Na extends l{constructor(t,e){super(t,e),this.setTransitInTime(Ua(e,"duration.in",200)),this.setTransitOutTime(Ua(e,"duration.out",200)),this.setTransitInCallback(Ua(e,"transitIn")),this.setTransitOutCallback(Ua(e,"transitOut")),this.oneShotMode=Ua(e,"destroy",!1),this.delayCallTimer=void 0,this._state=new Ya(this,{eventEmitter:!1,initState:Ua(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(Na.prototype,Ha);const $a=Phaser.Utils.Objects.GetValue;class Ka extends l{constructor(t,e){super(t,{eventEmitter:!1}),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setHitAreaMode($a(t,"hitAreaMode",0)),this.setEnable($a(t,"enable",!0)),this.setStopMode($a(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=Za[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 Za={default:0,fullWindow:1};const Ja=Phaser.Utils.Objects.GetValue;class qa extends Bs{constructor(t,e){super(t,Ja(e,"color",0),Ja(e,"alpha",.8)),this.touchEventStop=new Ka(this,{hitAreaMode:1})}}var Qa={popUp(t,e){void 0!==t._modalScaleSave?(t.scaleX=t._modalScaleSave,t.scaleY=t._modalScaleSave):t._modalScaleSave=t.scaleX,Un(t,e)},scaleDown(t,e){Nn(t,e,void 0,void 0,!1)},fadeIn(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,na(t,e)},fadeOut(t,e){aa(t,e,!1)}},to=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,na(t,e,t.alpha)},eo=function(t,e){aa(t,e,!1)};const io=Phaser.Utils.Objects.GetValue;let so=class extends Na{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=ro.popUp),null==e.transitOut&&(e.transitOut=ro.scaleDown),e.destroy=io(e,"destroy",!0),super(t,e);var i=io(e,"cover");this.cover=!1!==i?function(t,e){var i=t.scene,s=new qa(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(io(i,"transitIn",to)),this.setCoverTransitOutCallback(io(i,"transitOut",eo)));var s=io(e,"touchOutsideClose",!1),r=io(e,"duration.hold",-1),n=io(e,"timeOutClose",r>=0),a=io(e,"anyTouchClose",!1);io(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),io(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&&T(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=ro[t]),t){case ro.popUp:t=Qa.popUp;break;case ro.fadeIn:t=Qa.fadeIn}return super.setTransitInCallback(t),this}setTransitOutCallback(t){switch("string"==typeof t&&(t=ro[t]),t){case ro.scaleDown:t=Qa.scaleDown;break;case ro.fadeOut:t=Qa.fadeOut}return super.setTransitOutCallback(t),this}setCoverTransitInCallback(t){return this.coverTransitInCallback=t,this}setCoverTransitOutCallback(t){return this.coverTransitOutCallback=t,this}};const ro={popUp:0,fadeIn:1,scaleDown:0,fadeOut:1};var no={modal(t,e){return Cs(t)&&(e=t,t=void 0),void 0===this._modalBehavior&&(this.onCreateModalBehavior&&this.onCreateModalBehavior(this,t),this._modalBehavior=function(t,e){var i=new so(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}},ao=function(t,e,i,s,r){Cs(e)&&(r=s,s=i,i=e,e=this);var n=this.scene.events;return this.bindEvent(e,n,t,i,s,r),this},oo={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 ao.call(this,"preupdate",t,e,i,s),this},bindSceneUpdateEvent(t,e,i,s){return ao.call(this,"update",t,e,i,s),this},bindScenePostupdateEvent(t,e,i,s){return ao.call(this,"postupdate",t,e,i,s),this},bindSceneRenderEvent(t,e,i,s){return ao.call(this,"render",t,e,i,s),this},bindScenePauseEvent(t,e,i,s){return ao.call(this,"pause",t,e,i,s),this},bindSceneResumeEvent(t,e,i,s){return ao.call(this,"resume",t,e,i,s),this},bindSceneSleepEvent(t,e,i,s){return ao.call(this,"sleep",t,e,i,s),this},bindSceneWakeEvent(t,e,i,s){return ao.call(this,"wake",t,e,i,s),this},bindSceneShutdownEvent(t,e,i,s){return ao.call(this,"shutdown",t,e,i,s),this}},ho=function(t){return"[object Array]"===Object.prototype.toString.call(t)},lo=function(t,e,i,s,r){return T(t,e,i,uo(s),r)},co=function(t){return!(t.rexSizer&&t.rexSizer.hidden)},uo=function(t){return t?function(e,i,s){return!!co(e)&&(t(e,i,s),!0)}:co},po={},vo=function(t){var e,i;this.sizerEventsEnable&&(e=t,void 0===(i=this.getChildPrevState(t))?i={}:!0===i&&(i=po),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))},go=function(t,e,i,s,r,n,a,o){tn(t,e,i,s,r,n),void 0!==a&&(t.x+=a),void 0!==o&&(t.y+=o),this.resetChildPositionState(t),this.sizerEventsEnable&&t.emit("sizer.postlayout",t,this)};const fo=Phaser.Display.Align.CENTER,mo=Phaser.Utils.Objects.IsPlainObject,yo=Phaser.Utils.Objects.GetValue;class bo extends l{constructor(t,e){super(t,e),this._enable=void 0,t.setInteractive(yo(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(yo(t,"enable",!0)),this.setMode(yo(t,"mode",1)),this.setClickInterval(yo(t,"clickInterval",100)),this.setDragThreshold(yo(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=xo[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 xo={press:0,pointerdown:0,release:1,pointerup:1};var Co={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 bo(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}},wo=function(t,e,i,s,r){if(e)return!(i&&!i(t,e)||!So(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 ko.length=0,!0;return ko.length=0,!1},ko=[];const Oo=Phaser.Utils.Objects.GetValue;class Po extends l{constructor(t,e){super(t,e),this._enable=void 0;var i=Oo(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(Oo(t,"enable",!0)),this.setMode(Oo(t,"mode",1)),this.setClickInterval(Oo(t,"clickInterval",100)),this.setDragThreshold(Oo(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=To[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?wo:E)(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 To={press:0,pointerdown:0,release:1,pointerup:1};var _o={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 Po(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 Mo extends U{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 Eo=Phaser.Utils.Objects.GetValue;class Ro extends l{constructor(t,e){super(t,e),this._enable=void 0,this.cooldown=new Mo,this.parent.setInteractive(Eo(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.prevIsInTouch=!1,this.isInTouching=!1,this.setEnable(Eo(t,"enable",!0)),this.setCooldown(Eo(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 Lo={isPointerInBounds(t){return void 0===t?t=this:"string"==typeof t&&(t=this.getElement(t)),!!t&&E(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 Ro(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 Ro(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}},Do={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}},Ao=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 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,a,o,h,l){ln.call(this,t);var d=t.isRexSpace,c=typeof e;if(null===e)return this;if("number"===c);else if("string"===c)e=vh[e];else if(ch(e)){var u;e=uh(u=e,"proportion",void 0),i=uh(u,"align",ph),s=uh(u,"padding",0),r=uh(u,"expand",!1),n=uh(u,"key",void 0),a=uh(u,"index",void 0),t.isRexSizer||(o=uh(u,"minWidth",void 0),h=uh(u,"minHeight",void 0)),l=uh(u,"fitRatio",0)}return"string"==typeof i&&(i=Mr[i]),void 0===e&&(e=d?1:0),void 0===i&&(i=ph),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===o&&(d?o=0:t.isRexSizer||(o=t._minWidth)),void 0===h&&(d?h=0:t.isRexSizer||(h=t._minHeight)),void 0===l||!1===l?l=0:!0===l&&(l=p(t)/v(t)),(u=this.getSizerConfig(t)).proportion=e,u.align=i,u.padding=on(s),u.expand=r,u.fitRatio=0===e?l:0,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?v(t):h),r&&(0===this.orientation?t.minHeight=h:t.minWidth=o)),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,a,o){return ch(i)&&(i.index=t),gh.call(this,e,i,s,r,n,a,t,o),this},insertAtPosition(t,e,i,s,r,n,a,o,h){var l=dh.call(this,t,e);return-1===l&&(l=void 0),this.insert(l,i,s,r,n,a,o,h),this}};const mh=is.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=Mr[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}},Sh={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}},Oh={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&&(An(t,0,0),e.resolved=!1,this.hasRatioFitChild=!0);return this._childrenProportion=void 0,this.hasProportion0Child=!1,this.proportionLength=void 0,Rn.call(this),this},layoutChildren:function(){for(var t,e,i,s,r,n,a,o,h,l,d=this.sizerChildren,c=this.innerLeft,u=this.innerTop,g=this.innerWidth,f=this.innerHeight,m=c,y=u,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=Tn.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)||On.call(this)},runWidthWrap:function(t){this.wrapResult||(1===this.orientation&&oh.call(this,t,void 0),Pn.call(this,t))},hasHeightWrap:function(){return!(!this.hasRatioFitChild||0!==this.orientation)||_n.call(this)},runHeightWrap:function(t){this.wrapResult||(0===this.orientation&&oh.call(this,void 0,t),Mn.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(Oh,fh,xh,Ch,wh,Sh,kh);var Ph=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},_h=function(t){return"string"==typeof t&&(t=Th[t]),t};const Mh=Phaser.Utils.Objects.IsPlainObject,Eh=Phaser.Utils.Objects.GetValue;class Rh extends rh{constructor(t,e,i,s,r,n,a){Mh(e)?(e=Eh(a=e,"x",0),i=Eh(a,"y",0),s=Eh(a,"width",void 0),r=Eh(a,"height",void 0),n=Eh(a,"orientation",0)):Mh(s)?(s=Eh(a=s,"width",void 0),r=Eh(a,"height",void 0),n=Eh(a,"orientation",0)):Mh(n)&&(n=Eh(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(Eh(a,"space.item",0)),this.setStartChildIndex(Eh(a,"startChildIndex",0)),this.setRTL(Eh(a,"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=Ph.call(this)),this._childrenProportion}}Object.assign(Rh.prototype,Oh);var Lh=function(t,e,i,s){return e/t<=i?e/(s-1):0},Dh=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=Ah(o.left,o.centerY,t,e))&&(r=h,s=n);var h,l=i[n+1];l&&l.y===o.y||r>(h=Ah(o.right,o.centerY,t,e))&&(r=h,s=n+1)}}return s};const jh=Phaser.Utils.Objects.IsPlainObject,zh=Phaser.Utils.Objects.GetValue,Wh=Phaser.Display.Align.CENTER;var Ih=function(t,e,i,s){return"\n"===t?(this.addNewLine(),this):(ln.call(this,t),jh(e)&&(e=zh(r=e,"padding",0),i=zh(r,"key",void 0),s=zh(r,"index",void 0)),void 0===e&&(e=0),(r=this.getSizerConfig(t)).align=Wh,r.padding=on(e),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},Yh={add(t,e,i){if(ho(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}},Vh={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},ml=0,yl=1,bl=2,xl=0,Cl=1,wl=2,Sl=/(?:\r\n|\r|\n)/;const kl={none:xl,word:Cl,char:wl,character:wl,mix:3},Ol=Phaser.Renderer.WebGL.Utils;var Pl={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=Ol.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 Tl=Phaser.Display.Color;var _l={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,v=d.cutY+o;return this.context.drawImage(d.source.image,p,v,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 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 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}},Ml=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)},El={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}};Xe();const Rl=Phaser.Display.Canvas.CanvasPool,Ll=Phaser.GameObjects.GameObject,Dl=Phaser.Utils.String.UUID;let Al=class 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 Bl=Phaser.GameObjects.Components;Phaser.Class.mixin(Al,[Bl.Alpha,Bl.BlendMode,Bl.Crop,Bl.Depth,Bl.Flip,Bl.GetBounds,Bl.Mask,Bl.Origin,Bl.Pipeline,Bl.PostPipeline,Bl.ScrollFactor,Bl.Tint,Bl.Transform,Bl.Visible,Pl,_l,El]);var jl={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&&Ct(this.data),this}};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,jl);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 Il=Phaser.Math.RotateAround;var Yl;const Fl=Phaser.Geom.Rectangle;var Xl,Vl=function(t){void 0===Xl&&(Xl=new Fl);var e=t.drawTLX,i=t.drawTLY;return Xl.setTo(e,i,t.drawTRX-e,t.drawBLY-i),Xl};const Gl=Phaser.Math.RotateAround;var Hl,Ul=function(t,e,i,s){return void 0===s?s={}:!0===s&&(void 0===Hl&&(Hl={}),s=Hl),s.x=e,s.y=i,0!==t.rotation&&Gl(s,0,0,t.rotation),s.x=s.x*t.scaleX+t.drawX,s.y=s.y*t.scaleY+t.drawY,s};const Nl=Phaser.GameObjects.Components.TransformMatrix;var $l,Kl,Zl={},Jl=function(t,e,i,s,r){var n=Ul(e,i,s,!0),a=function(t,e,i,s){void 0===s?s={}:!0===s&&(s=Zl);var r=e-t.width*t.originX,n=i-t.height*t.originY;return void 0===$l&&($l=new Nl,Kl=new Nl),t.parentContainer?t.getWorldTransformMatrix($l,Kl):$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},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 Jl(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===Yl&&(Yl={}),s=Yl),s.x=(t-i.drawX)/i.scaleX,s.y=(e-i.drawY)/i.scaleY,0!==i.rotation&&Il(s,0,0,-i.rotation),s}(t,e,this,!0);return Vl(this).contains(i.x,i.y)},getWorldPosition:function(t,e,i){return ql(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 od=Phaser.Utils.Objects.GetValue;let hd=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=od(t,"x",0),i=od(t,"y",0));var s=this.cornerRadius;s.tl=ld(od(t,"tl",void 0),e,i),s.tr=ld(od(t,"tr",void 0),e,i),s.bl=ld(od(t,"bl",void 0),e,i),s.br=ld(od(t,"br",void 0),e,i)}get radiusTL(){var t=this.cornerRadius.tl;return Math.max(t.x,t.y)}set radiusTL(t){dd(this.cornerRadius.tl,t)}get radiusTR(){var t=this.cornerRadius.tr;return Math.max(t.x,t.y)}set radiusTR(t){dd(this.cornerRadius.tr,t)}get radiusBL(){var t=this.cornerRadius.bl;return Math.max(t.x,t.y)}set radiusBL(t){dd(this.cornerRadius.bl,t)}get radiusBR(){var t=this.cornerRadius.br;return Math.max(t.x,t.y)}set radiusBR(t){dd(this.cornerRadius.br,t)}};var ld=function(t,e,i){return void 0===t?t={x:e,y:i}:"number"==typeof t&&(t={x:t,y:t}),cd(t),t},dd=function(t,e){"number"==typeof e?(t.x=e,t.y=e):(t.x=od(e,"x",0),t.y=od(e,"y",0)),cd(t)},cd=function(t){t.convex=t.x>=0||t.y>=0,t.x=Math.abs(t.x),t.y=Math.abs(t.y)};const ud=Phaser.Math.DegToRad;var pd=function(t){return!t.hasOwnProperty("convex")||t.convex},vd=function(t){return t.x>0&&t.y>0},gd=function(t,e,i,s,r,n,a,o,h){if(o&&a>n?a-=360:!o&&a=p?1:s/p,f=r>=v?1:r/v,m=u.cornerRadius;t.save(),t.beginPath(),t.translate(e,i),o=m.tl,vd(o)?(h=o.x*g,l=o.y*f,pd(o)?gd(t,h,l,h,l,180,270,!1,a):gd(t,0,0,h,l,90,0,!0,a),d=0,c=l):(t.lineTo(0,0),d=0,c=0),o=m.tr,vd(o)?(h=o.x*g,l=o.y*f,pd(o)?gd(t,s-h,l,h,l,270,360,!1,a):gd(t,s,0,h,l,180,90,!0,a)):t.lineTo(s,0),o=m.br,vd(o)?(h=o.x*g,l=o.y*f,pd(o)?gd(t,s-h,r-l,h,l,0,90,!1,a):gd(t,s,r,h,l,270,180,!0,a)):t.lineTo(s,r),o=m.bl,vd(o)?(h=o.x*g,l=o.y*f,pd(o)?gd(t,h,r-l,h,l,90,180,!1,a):gd(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())},md=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),fd(t.canvas,t.context,d,d,h,l,r,e,i,s,n,a,o)}};const yd=Phaser.Utils.Objects.GetValue;class bd extends sd{constructor(t,e){super(t,"background"),this.setScrollFactor(0),this.setColor(yd(e,"color",null),yd(e,"color2",null),yd(e,"horizontalGradient",!0)),this.setStroke(yd(e,"stroke",null),yd(e,"strokeThickness",2)),this.setCornerRadius(yd(e,"cornerRadius",0),yd(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(){md(this.parent,this.color,this.stroke,this.strokeThickness,this.cornerRadius,this.color2,this.horizontalGradient,this.cornerIteration)}}const xd=Phaser.Utils.Objects.GetValue;class Cd extends sd{constructor(t,e){super(t,"innerbounds"),this.setScrollFactor(0),this.setColor(xd(e,"color",null),xd(e,"color2",null),xd(e,"horizontalGradient",!0)),this.setStroke(xd(e,"stroke",null),xd(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,xd(t,"color2",null),xd(t,"horizontalGradient",!0)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,xd(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 wd=Phaser.Utils.Objects.GetValue;let Sd=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(wd(t,"bold",!1)),this.setItalic(wd(t,"italic",!1)),this.setFontSize(wd(t,"fontSize","16px")),this.setFontFamily(wd(t,"fontFamily","Courier")),this.setColor(wd(t,"color","#fff")),this.setStrokeStyle(wd(t,"stroke",null),wd(t,"strokeThickness",0)),this.setShadow(wd(t,"shadowColor",null),wd(t,"shadowOffsetX",0),wd(t,"shadowOffsetY",0),wd(t,"shadowBlur",0)),this.setOffset(wd(t,"offsetX",0),wd(t,"offsetY",0)),this.setSpace(wd(t,"leftSpace",0),wd(t,"rightSpace",0)),this.setAlign(wd(t,"align",void 0)),this.setBackgroundColor(wd(t,"backgroundColor",null)),this.setBackgroundHeight(wd(t,"backgroundHeight",void 0)),this.setBackgroundBottomY(wd(t,"backgroundBottomY",void 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),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}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 kd=Phaser.Utils.Array.Remove,Od=Phaser.Utils.Array.Remove,Pd="text",Td="image",_d="drawer",Md="space",Ed="command";var Rd=function(t){return t.type===Pd&&"\n"===t.text},Ld=function(t){return t.type===Pd&&"\f"===t.text},Dd=function(t){return t.type===Pd};class Ad extends sd{constructor(t,e,i){super(t,Pd),this.updateTextFlag=!1,this.style=new Sd(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,s=this.drawTRX-i+1,r=e.backgroundBottomY;null==r&&(r=this.drawBLY);var n=e.backgroundHeight;null==n&&(n=r-this.drawTLY);var a=r-n;t.fillRect(i,a,s,n)}var o=e.hasFill,h=e.hasStroke;(o||h)&&(e.syncFont(t).syncStyle(t),h&&(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 Bd=function(t,e){var i=this.createCharChildren(t,e);return this.addChild(i),this};const jd=Phaser.Display.Canvas.CanvasPool;var zd=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=jd.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),jd.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 Wd extends sd{constructor(t,e,i){super(t,Td),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(){zd(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 Id extends sd{constructor(t,e,i,s){super(t,_d),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,Md),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 Fd extends zl{constructor(t,e,i,s,r){super(t,Ed),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 Vd={none:0,word:1,char:2,character:2,mix:3};var Gd=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=$d.call(this)).height,a=l.ascent,i=Math.floor((h-a)/n))}else{var l;n=(l=$d.call(this)).height,a=l.ascent}}else this.fixedHeight>0?void 0===(i=Zd(t,"maxLines"))&&(h=this.fixedHeight-s,i=Math.floor(h/n)):i=Zd(t,"maxLines",0);void 0===a&&(a=n);var d=0===i,c=Zd(t,"wrapMode");void 0===c&&(c=Zd(t,"charWrap",!1)?"char":"word"),"string"==typeof c&&(c=Vd[c]);var u=Zd(t,"wrapWidth",void 0);void 0===u&&(this.fixedWidth>0?u=this.fixedWidth-r:(u=1/0,c=0));for(var p=Zd(t,"letterSpacing",0),v=Zd(t,"hAlign",0),g=Zd(t,"vAlign",0),f=Zd(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&&(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 Y=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,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=Qd(t,"maxLines",void 0))){var a=this.fixedWidth-r;i=Math.floor(a/n)+1}}else i=Qd(t,"maxLines",0);var o=0===i,h=Qd(t,"fixedCharacterHeight",void 0);if(void 0===h){var l=Qd(t,"charPerLine",void 0);if(void 0!==l){var d=this.fixedHeight-s;h=Math.floor(d/l)}}var c=Qd(t,"wrapHeight",void 0);void 0===c&&(c=this.fixedHeight>0?this.fixedHeight-s:1/0);for(var u=Qd(t,"letterSpacing",0),p=Qd(t,"rtl",!0),v=Qd(t,"hAlign",p?2:0),g=Qd(t,"vAlign",0),f=Xd({callback:"runVerticalWrap",start:e,padding:this.wrapPadding,letterSpacing:u,maxLines:i,hAlign:v,vAlign:g,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 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,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 wn(i,t,e),this.dirty=this.dirty||s!=i.left||r!=i.right||n!=i.top||a!=i.bottom,this},getPadding:function(t){return Cn(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),kd(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 Od(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(Pd);return null===i?i=new Ad(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 kc=Phaser.Utils.Objects.GetFastValue;var Oc={};class Pc{constructor(t){this.pools=kc(t,"pools",Oc)}free(t){if(!this.pools)return this;var e=t.type;return this.pools.hasOwnProperty(e)||(this.pools[e]=new Sc),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=Ac(t,r,e,i,n),o=0;o<=Rc&&0!==a;o++){if((r+=a)<0){r=0;break}a=Ac(t,r,e,i,n)}return o===Rc&&console.warn("FontSizeFit: Test count exceeds 65535"),t.setFontSize(r),Bc(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]},Ac=function(t,e,i,s,r){var n,a=Dc(t,e,r),o=Dc(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)},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 jc=Phaser.Utils.Objects.GetValue,zc=Phaser.Utils.Objects.GetValue;class Wc extends el{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexLabel";var i,s=zc(e,"background",void 0),r=zc(e,"icon",void 0),n=zc(e,"iconMask",void 0),a=zc(e,"text",void 0),o=zc(e,"action",void 0),h=zc(e,"actionMask",void 0),l=zc(e,"align",void 0);if(s&&this.addBackground(s),r){0===this.orientation?(a||o)&&(i={right:zc(e,"space.icon",0),top:zc(e,"space.iconTop",0),bottom:zc(e,"space.iconBottom",0),left:zc(e,"space.iconLeft",0)}):(a||o)&&(i={bottom:zc(e,"space.icon",0),left:zc(e,"space.iconLeft",0),right:zc(e,"space.iconRight",0),top:zc(e,"space.iconTop",0)});var d=zc(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=zc(e,"iconSize",void 0);this.setIconSize(zc(e,"iconWidth",c),zc(e,"iconHeight",c))}}if(a){var u=zc(e,"wrapText",!1),p=zc(e,"adjustTextFontSize",!1);u?(!0===u&&(u="word"),function(t,e){switch(ul(t)){case 0:switch("string"==typeof e&&(e=kl[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=kl[e]||0),t.style.wrapMode=e}}(a,u),e.expandTextWidth=!0,Ec(a)):p&&(e.expandTextWidth=!0,e.expandTextHeight=!0,function(t,e){"number"==typeof e&&(e={minWidth:e});var i=jc(e,"minWidth",0),s=jc(e,"minHeight",0),r=jc(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})}(a,{fitHeight:!0}));var v,g,f=zc(e,"space.text",0),m=zc(e,"expandTextWidth",!1),y=zc(e,"expandTextHeight",!1);0===this.orientation?(v=m?1:0,o&&(i={right:f}),g=y):(v=y?1:0,o&&(i={bottom:f}),g=m),this.add(a,{proportion:v,expand:g,padding:i})}if(o&&(i=0===this.orientation?{top:zc(e,"space.actionTop",0),bottom:zc(e,"space.actionBottom",0),right:zc(e,"space.actionRight",0)}:{left:zc(e,"space.actionLeft",0),right:zc(e,"space.actionRight",0),bottom:zc(e,"space.actionBottom",0)},d=zc(e,"squareFitAction",!1)?1:0,this.add(o,{proportion:0,padding:i,fitRatio:d}),h&&(h=ol.call(this,o,o,1)),!d)){var b=zc(e,"actionSize");this.setActionSize(zc(e,"actionWidth",b),zc(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 Ic=Phaser.Renderer.WebGL.Utils,Yc=function(t,e,i,s,r,n){for(var a=Ic.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+")"},Hc=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 Uc=Phaser.Renderer.Canvas.SetTransform;var Nc={renderWebGL:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.pipelines.set(e.pipeline),n=Vc(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&&Yc(r,a,e,l,o,h),e.isStroked&&Xc(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(Uc(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(Kc.prototype,Nc);var Zc=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 Jc=Phaser.Math.DegToRad;var qc=function(t,e,i,s,r,n,a,o,h){a&&n>r?n-=360:!a&&n0&&t.y>0};const ru={rectangle:0,circle:1};var nu=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},au=function(t,e,i){if(void 0===i&&(i={}),Array.isArray(e))for(var s=0,r=e.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=tp(t,"tl",0),this.radiusTR=tp(t,"tr",0),this.radiusBL=tp(t,"bl",0),this.radiusBR=tp(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?qc(e,e,e,e,180,270,!1,r,t):qc(0,0,e,e,90,0,!0,r,t):Zc(0,0,t),(e=this.radiusTR)>0?this._convexTR?qc(i-e,e,e,e,270,360,!1,r,t):qc(i,0,e,e,180,90,!0,r,t):Zc(i,0,t),(e=this.radiusBR)>0?this._convexBR?qc(i-e,s-e,e,e,0,90,!1,r,t):qc(i,s,e,e,270,180,!0,r,t):Zc(i,s,t),(e=this.radiusBL)>0?this._convexBL?qc(e,s-e,e,e,90,180,!1,r,t):qc(0,s,e,e,360,270,!0,r,t):Zc(0,s,t),t.push(t[0],t[1]),zu(this.x,this.y,t),super.updateData(),this}}Phaser.Renderer.WebGL.Utils.getTintAppendFloatAlpha;var ip=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};const sp=Phaser.Utils.Objects.GetValue,rp=Phaser.Utils.Objects.IsPlainObject;class np extends(Tu(bu)){constructor(t,e,i,s,r,n,a,o){rp(e)?(e=sp(o=e,"x",0),i=sp(o,"y",0),s=sp(o,"width",2),r=sp(o,"height",2),n=sp(o,"barColor",void 0),a=sp(o,"value",0)):rp(s)?(s=sp(o=s,"width",2),r=sp(o,"height",2),n=sp(o,"barColor",void 0),a=sp(o,"value",0)):rp(n)&&(n=sp(o=n,"barColor",void 0),a=sp(o,"value",0)),super(t,e,i,s,r,o),this.type="rexLineProgress",this.bootProgressBase(o),this.addShape((new Qu).setName("trackFill")).addShape((new Qu).setName("bar")).addShape((new Qu).setName("trackStroke")),this.setTrackColor(sp(o,"trackColor",void 0)),this.setBarColor(n),this.setTrackStroke(sp(o,"trackStrokeThickness",2),sp(o,"trackStrokeColor",void 0)),this.setSkewX(sp(o,"skewX",0)),this.setRTL(sp(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 ap={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&&ip(s,0,0,e,i,t).close();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),ip(a,r,0,n,i,t).close());var o=this.getShape("trackStroke");o.lineStyle(this.trackStrokeThickness,this.trackStrokeColor),o.isStroked&&ip(o,0,0,e,i,t).end()}};Object.assign(np.prototype,ap);class op extends np{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"),Ye(e,"easeValue.duration",e.easeDuration),Ye(e,"easeValue.ease",e.ease),super(t,e),this.type="rexStatesBarRectangleShape",this.barState=!1,e.style=this,e.propertiesMap=hp,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 hp={color:"trackColor",strokeColor:"trackStrokeColor",strokeWidth:"trackStrokeThickness"};Object.assign(op.prototype,cu);let lp=class extends l{constructor(t,e){return super(t),new Proxy(this,this)}get(t,e){if(Zs(t,e))return t[e];var i=t.parent;return Zs(i,e)?i[e]:void 0}set(t,e,i){return Zs(t,e)?t[e]=i:Zs(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 dp=Phaser.GameObjects.NineSlice,cp=Phaser.Utils.Objects.GetValue;class up extends dp{constructor(t,e){void 0===e&&(e={}),super(t,cp(e,"x",0),cp(e,"y",0),cp(e,"key",null),cp(e,"frame",null),cp(e,"width",0),cp(e,"height",0),cp(e,"leftWidth",0),cp(e,"rightWidth",0),cp(e,"topHeight",0),cp(e,"bottomHeight",0)),this.type="rexStatesNineSlice";var i=cp(e,"effects",!0);i&&er(this,i),this.style=new lp(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign(up.prototype,cu);let pp=class extends l{constructor(t,e){return super(t),new Proxy(this,this)}get(t,e){if(Zs(t,e))return t[e];var i=t.parent;return Zs(i,e)?i[e]:void 0}set(t,e,i){return Zs(t,e)?t[e]=i:Zs(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 vp=Phaser.GameObjects.Image,gp=Phaser.Utils.Objects.GetValue;class fp extends vp{constructor(t,e){void 0===e&&(e={}),super(t,gp(e,"x",0),gp(e,"y",0),gp(e,"key",""),gp(e,"frame",void 0)),this.type="rexStatesImage";var i=gp(e,"effects",!0);i&&er(this,i),this.style=new pp(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign(fp.prototype,cu);var mp=function(t,e,i){return"__BASE"===i?`${t},${e}`:`${i}:${t},${e}`};const yp=Phaser.Utils.Objects.IsPlainObject,bp=Phaser.Utils.Objects.GetValue;var xp=function(t){return"string"==typeof t&&(t=Cp[t]),t};const Cp={scale:0,repeat:1};var wp=function(t,e){return 0===t||t===this.columns.count-1||0===e||e===this.rows.count-1},Sp={_beginDraw:Er,_drawImage:Er,_drawTileSprite:Er,_endDraw:Er,setGetFrameNameCallback:function(t){return void 0===t&&(t=mp),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=je(i),s=je(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:g,b=0,h=0;for(var S=i.length;h0?0:f),f>=1&&g>=1){var k=typeof(m=this.getFrameNameCallback(h,C,e));"string"!==k&&"number"!==k||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,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 v=Math.min(u,p);if(u>v){var g=(u-v)*h;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&&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 yp(t)?(this.stretchMode.edge=xp(bp(t,"edge",0)),this.stretchMode.internal=xp(bp(t,"internal",0))):(t=xp(t),this.stretchMode.edge=t,this.stretchMode.internal=t),this},getStretchMode:function(t,e){return wp.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 kp=Phaser.Utils.Objects.IsPlainObject,Op=Phaser.Utils.Objects.GetValue,Pp=Phaser.GameObjects;var Tp=void 0,_p=function(t,e){if(Tp||(Tp={},o(t).events.once("destroy",(function(){for(var t in Tp)Tp[t].destroy();Tp=void 0}))),!Tp.hasOwnProperty(e)){var i=o(t).scene.systemScene;(t=new Pp[e](i)).setOrigin(0),Tp[e]=t}return Tp[e]};const Mp=Phaser.GameObjects.RenderTexture;class Ep extends(function(t,e){class i extends t{constructor(t,i,s,r,n,a,o,h,l,d){if(kp(i)?(i=Op(d=i,"x",0),s=Op(d,"y",0),r=Op(d,"width",1),n=Op(d,"height",1),a=Op(d,"key",void 0),o=Op(d,"baseFrame",void 0),h=Op(d,"columns",void 0),l=Op(d,"rows",void 0)):kp(r)?(r=Op(d=r,"width",1),n=Op(d,"height",1),a=Op(d,"key",void 0),o=Op(d,"baseFrame",void 0),h=Op(d,"columns",void 0),l=Op(d,"rows",void 0)):kp(a)?(a=Op(d=a,"key",void 0),o=Op(d,"baseFrame",void 0),h=Op(d,"columns",void 0),l=Op(d,"rows",void 0)):kp(o)?(o=Op(d=o,"baseFrame",void 0),h=Op(d,"columns",void 0),l=Op(d,"rows",void 0)):Array.isArray(o)?(d=l,l=h,h=o,o=Op(d,"baseFrame",void 0)):kp(h)&&(h=Op(d=h,"columns",void 0),l=Op(d,"rows",void 0)),void 0===o&&(o=Op(d,"frame",void 0)),void 0===h){var c=Op(d,"leftWidth",void 0),u=Op(d,"rightWidth",void 0);void 0!==c&&void 0!==u&&(h=[c,void 0,u])}if(void 0===l){var p=Op(d,"topHeight",void 0),v=Op(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(Op(d,"getFrameNameCallback",void 0)),this.setStretchMode(Op(d,"stretchMode",0)),this.setPreserveRatio(Op(d,"preserveRatio",!0));var g=Op(d,"maxFixedPartScale",1),f=Op(d,"maxFixedPartScaleX",g),m=Op(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,Sp),i}(Mp,"rexNinePatch")){}var Rp={_drawImage:function(t,e,i,s,r,n){var a=_p(this,"Image").setTexture(t,e).setDisplaySize(r,n);this.draw(a,i,s)},_drawTileSprite:function(t,e,i,s,r,n){var a=_p(this,"TileSprite").setTexture(t,e).setSize(r,n);this.draw(a,i,s)}};Object.assign(Ep.prototype,Rp);let Lp=class extends l{constructor(t,e){return super(t),new Proxy(this,this)}get(t,e){if(Zs(t,e))return t[e];var i=t.parent;return Zs(i,e)?i[e]:void 0}set(t,e,i){return Zs(t,e)?t[e]=i:Zs(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 Dp=Phaser.Utils.Objects.GetValue;class Ap extends Ep{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexStatesNinePatch";var i=Dp(e,"effects",!0);i&&er(this,i),this.style=new Lp(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign(Ap.prototype,cu);const Bp=["alpha","tint","flipX","flipY"];var jp=function(t,e){if(!e)return t;for(var i=0,s=Bp.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=D,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===A&&this.onDragEnd(),this.pointer=void 0,this.tracerState=D,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=B,this}isPointerInGameObject(t,e,i){var s=this.lastPointer;return!!s&&E(t,s,e,i)}}const D=0,A=1,B="IDLE";function j(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=J);break;case q:this.state=J}}onDragEnd(){this.state===J&&(this.tapsCount++,this.emit("tapping",this,this.gameObject,this.lastPointer),void 0!==this.maxTaps&&this.tapsCount===this.maxTaps&&(this.state=q))}onDrag(){this.state!==Z&&this.pointer.getDistance()>this.dragThreshold&&(this.state=Z)}preUpdate(t,e){if(this.isRunning&&this.enable&&this.state===J){var i=this.lastPointer;i.isDown?t-i.downTime>this.holdTime&&(this.state=Z):t-i.upTime>this.tapInterval&&(void 0===this.minTaps||this.tapsCount>=this.minTaps?this.state=q:this.state=Z)}}postUpdate(t,e){this.isRunning&&this.enable&&this.state===q&&(this.state=Z)}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 Z="IDLE",J="BEGIN",q="RECOGNIZED",Q=Phaser.Utils.Objects.GetValue;class tt extends L{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=et},eventEmitter:!1};this.setRecongizedStateObject(new U(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(Q(t,"threshold",9)),this.setHoldTime(Q(t,"time",251)),this}onDragStart(){this.state=it,0===this.holdTime&&(this.state=st)}onDragEnd(){this.state=et}onDrag(){this.state!==et&&this.pointer.getDistance()>this.dragThreshold&&(this.state=et)}preUpdate(t,e){this.isRunning&&this.enable&&this.state===it&&t-this.pointer.downTime>=this.holdTime&&(this.state=st)}get isPressed(){return this.state===st}setHoldTime(t){return this.holdTime=t,this}setDragThreshold(t){return this.dragThreshold=t,this}}const et="IDLE",it="BEGIN",st="RECOGNIZED",rt=Phaser.Utils.Objects.GetValue;class nt extends L{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=_(t,i.pointerCamera,!0);i.endWorldX=e.x,i.endWorldY=e.y,i.emit("panend",i,i.gameObject,i.lastPointer)}}},init:function(){this.state=at},eventEmitter:!1};this.setRecongizedStateObject(new U(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(rt(t,"threshold",10)),this}onDragStart(){this.state=ot,0===this.dragThreshold&&(this.state=ht)}onDragEnd(){this.state=at}onDrag(){switch(this.state){case ot:if(this.pointer.getDistance()>=this.dragThreshold){this.state=ht,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 ht: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=_(t,e,!0);this.worldX=r.x,this.worldY=r.y,this.emit("pan",this,this.gameObject,this.lastPointer)}}get isPanned(){return this.state===ht}setDragThreshold(t){return this.dragThreshold=t,this}}const at="IDLE",ot="BEGIN",ht="RECOGNIZED";var lt=function(t){return o(t).loop.delta};const dt=Phaser.Math.Distance.Between,ct=Phaser.Math.Angle.Between;var ut={getDt:function(){return lt(this.scene)},getVelocity:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return dt(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 ct(e.x,e.y,t.x,t.y)}},pt={"up&down":0,"left&right":1,"4dir":2,"8dir":3},vt={};const gt=Phaser.Utils.Objects.GetValue,ft=Phaser.Math.RadToDeg;class mt extends L{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=yt},eventEmitter:!1};this.setRecongizedStateObject(new U(s)),this.clearDirectionStates()}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(gt(t,"threshold",10)),this.setVelocityThreshold(gt(t,"velocityThreshold",1e3)),this.setDirectionMode(gt(t,"dir","8dir")),this}onDragStart(){this.state=bt}onDragEnd(){this.state=yt}onDrag(){this.state===bt&&(this.validDrag||(this.validDrag=0===this.dragThreshold||this.pointer.getDistance()>=this.dragThreshold),this.validDrag&&this.dragVelocity>this.velocityThreshold&&(this.state=xt))}postUpdate(t,e){this.isRunning&&this.enable&&this.state===xt&&(this.state=yt)}get isSwiped(){return this.state===xt}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=pt[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}}(ft(this.getVelocityAngle()),this.dirMode,this),this}clearDirectionStates(){return this.left=!1,this.right=!1,this.up=!1,this.down=!1,this}}Object.assign(mt.prototype,ut);const yt="IDLE",bt="BEGIN",xt="RECOGNIZED";var Ct=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 wt=Phaser.Utils.Objects.GetValue,St=Phaser.Utils.Array.SpliceOne,kt=Phaser.Math.Distance.Between,Ot=Phaser.Math.Angle.Between;class Pt{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(wt(e,"inputConfig",void 0)),this.setEventEmitter(wt(e,"eventEmitter",void 0)),this._enable=void 0,this.pointers=[],this.movedState={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setEnable(wt(t,"enable",!0)),this.bounds=wt(t,"bounds",void 0),this.tracerState=_t,this.pointers.length=0,Ct(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,Ct(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 _t:this.tracerState=Mt,this.onDrag1Start();break;case Mt:this.tracerState=Et,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],St(this.pointers,e),this.tracerState){case Mt:this.tracerState=_t,this.onDrag1End();break;case Et:this.tracerState=Mt,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 Mt:this.onDrag1();break;case Et:this.onDrag2()}}}dragCancel(){return this.tracerState===Et&&this.onDrag2End(),this.pointers.length=0,Ct(this.movedState),this.tracerState=_t,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!==Et)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!==Et)return 0;var t=this.pointers[0],e=this.pointers[1];return Ot(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;Tt.x=e.x-i.x,Tt.y=e.y-i.y}else Tt.x=0,Tt.y=0;return Tt}get centerX(){if(this.tracerState!==Et)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.x+e.x)/2}get centerY(){if(this.tracerState!==Et)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.y+e.y)/2}get prevCenterX(){if(this.tracerState!==Et)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!==Et)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=Rt,this}isPointer0InGameObject(t,e,i){var s=this.pointers[0];return!!s&&E(t,s,e,i)}isPointer1InGameObject(t,e,i){var s=this.pointers[1];return!!s&&E(t,s,e,i)}}Object.assign(Pt.prototype,e);var Tt={};const _t=0,Mt=1,Et=2,Rt="IDLE",Lt=Phaser.Utils.Objects.GetValue;class Dt extends Pt{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=At},eventEmitter:!1};this.setRecongizedStateObject(new U(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(Lt(t,"threshold",0)),this}onDrag2Start(){this.scaleFactor=1,this.prevDistance=this.distanceBetween,this.state=Bt,0===this.dragThreshold&&(this.state=jt)}onDrag2End(){this.state=At}onDrag2(){switch(this.state){case Bt: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=jt}break;case jt:t=this.distanceBetween,this.scaleFactor=t/this.prevDistance,this.emit("pinch",this),this.prevDistance=t}}get isPinched(){return this.state===jt}setDragThreshold(t){return this.dragThreshold=t,this}}const At="IDLE",Bt="BEGIN",jt="RECOGNIZED",zt=Phaser.Math.RotateAround;var Wt=function(t,e,i,s){return zt(t,e,i,s),t.rotation+=s,t},It={};const Yt=Phaser.Utils.Objects.GetValue,Ft=Phaser.Math.Angle.WrapDegrees,Xt=Phaser.Math.Angle.ShortestBetween,Vt=Phaser.Math.RadToDeg,Gt=Phaser.Math.DegToRad;var Ht={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(Vt(this.angleBetween));this.angle=Xt(this.prevAngle,t),this.prevAngle=t,this.state=$t}break;case $t:t=Ft(Vt(this.angleBetween)),this.angle=Xt(this.prevAngle,t),this.prevAngle=t,this.emit("rotate",this)}}get isRotated(){return this.state===$t}get rotation(){return Gt(this.angle)}setDragThreshold(t){return this.dragThreshold=t,this}}.prototype,Ht);const Ut="IDLE",Nt="BEGIN",$t="RECOGNIZED";var Kt=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 Zt=Phaser.Utils.Objects.GetValue;class Jt extends l{constructor(t,e){void 0===e&&(e={}),super(t,e),this.inputTarget=Zt(e,"inputTarget",t),this.pan=new nt(this.inputTarget);var i=Kt(t,Zt(e,"camera"));this.setCamera(i).setEnable(Zt(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 Qt=Phaser.Utils.Objects.GetValue;Phaser.Math.Clamp;class te extends l{constructor(t,e){void 0===e&&(e={}),super(t,e),this.inputTarget=Qt(e,"inputTarget",t),this.pinch=new Dt(this.inputTarget);var i=Kt(t,Qt(e,"camera"));this.setCamera(i).setEnable(Qt(e,"enable",!0)).setMinZoom(Qt(e,"minZoom",void 0)).setMaxZoom(Qt(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 ee=Phaser.Input.Keyboard.Key,ie=Phaser.Input.Keyboard.KeyCodes,se=["up","down","left","right"];class re{constructor(t){this.scene=t,this.keys={},this.cursorKeys={},this.noKeyDown=!0;for(var e=0,i=se.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 ue=Phaser.Utils.Objects.GetValue;class pe extends l{constructor(t,e){void 0===e&&(e={}),super(t,e),this.cursorAtBounds=new ce(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=Kt(t,ue(e,"camera"));this.setCamera(s).setEnable(ue(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 ge extends c{constructor(t,e){super(t,e);var i=this.scene?"update":"step";this.tickEventName=ve(e,"tickEventName",i),this.isSceneTicker=!fe(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 fe=function(t){return"step"===t||"poststep"===t};const me=Phaser.Utils.Objects.GetValue,ye=Phaser.Math.Clamp;class be{constructor(t){this.resetFromJSON(t)}resetFromJSON(t){this.state=me(t,"state",xe),this.timeScale=me(t,"timeScale",1),this.delay=me(t,"delay",0),this.repeat=me(t,"repeat",0),this.repeatCounter=me(t,"repeatCounter",0),this.repeatDelay=me(t,"repeatDelay",0),this.duration=me(t,"duration",0),this.nowTime=me(t,"nowTime",0),this.justRestart=me(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?we:Ce,this.repeatCounter=0,this}stop(){return this.state=xe,this}update(t,e){this.state!==xe&&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=Se)):(this.nowTime=this.duration,this.state=ke):this.nowTime>=0&&(this.state=we))}get t(){var t;switch(this.state){case xe:case Ce:case Se:t=0;break;case we:t=this.nowTime/this.duration;break;case ke:t=1}return ye(t,0,1)}set t(t){(t=ye(t,-1,1))<0?(this.state=Ce,this.nowTime=-this.delay*t):(this.state=we,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===xe}get isDelay(){return this.state===Ce}get isCountDown(){return this.state===we}get isRunning(){return this.state===Ce||this.state===we}get isDone(){return this.state===ke}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}}const xe=0,Ce=1,we=2,Se=3,ke=-1;class Oe extends ge{constructor(t,e){super(t,e),this.timer=new be}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 Pe=Phaser.Utils.Objects.GetValue,Te=Phaser.Utils.Objects.GetAdvancedValue,_e=Phaser.Tweens.Builders.GetEaseFunction;class Me extends Oe{resetFromJSON(t){return this.timer.resetFromJSON(Pe(t,"timer")),this.setEnable(Pe(t,"enable",!0)),this.setTarget(Pe(t,"target",this.parent)),this.setDelay(Te(t,"delay",0)),this.setDuration(Te(t,"duration",1e3)),this.setEase(Pe(t,"ease","Linear")),this.setRepeat(Pe(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 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 Ee=Phaser.Math.Linear;class Re extends Me{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=Ee(this.startZoomValue,this.endZoomValue,e.t);qt(t,s,i.focusLocalX,i.focusLocalY)}}const Le=Phaser.Utils.Objects.GetValue;Phaser.Math.Clamp;class De extends l{constructor(t,e){void 0===e&&(e={}),super(t,e),this.easeZoom=new Re(this);var i=Kt(t,Le(e,"camera"));this.setEnable(Le(e,"enable",!0)).setMinZoom(Le(e,"minZoom")).setMaxZoom(Le(e,"maxZoom")).setZoomStep(Le(e,"zoomStep",.1)).setEaseDuration(Le(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(Ae(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=Be(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 Ae=function(t,e){return t>=1?Math.log(t)/Math.log(1+e):-Math.log(t)/Math.log(1-e)},Be=function(t,e){return t>=0?Math.pow(1+e,t):Math.pow(1-e,-t)};function je(t){if(null===t||"object"!=typeof t)return t;if(Array.isArray(t))return t.map((t=>je(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]=je(t[i]));return e}const ze=Phaser.Utils.Objects.GetValue;class We extends l{constructor(t,e){super(t,e=void 0===e?{}:je(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 Jt(t,{camera:ze(e,"camera"),inputTarget:ze(e,"inputTarget",t),enable:ze(e,"panScrollEnable",!0)})),ze(e,"pinchZoom",!0)&&(this.pinchZoom=new te(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 pe(t,{camera:ze(e,"camera"),enable:ze(e,"boundsScrollEnable",!0)})),ze(e,"mouseWheelZoom",!0)&&(this.mouseWheelZoom=new De(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},Ye=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 Ge(this.children,t,0,(function(t){t.once("destroy",e.onChildDestroy,e)}),this),this}remove(t,e){var i=this;return He(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;iJe(t),resetChildState(t){return this.resetChildPositionState(t).resetChildVisibleState(t).resetChildAlphaState(t).resetChildActiveState(t),this},resetChildrenState(t){for(var e=0,i=t.length;eJe(t).x,getChildLocalY:t=>Je(t).y};const pi=Phaser.Math.DegToRad;var vi={updateChildRotation(t){var e=Je(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=Je(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 Je(t).rotation=e,this.updateChildRotation(t),this},setChildLocalAngle(t,e){return Je(t).rotation=pi(e),this.updateChildRotation(t),this},resetLocalRotationState(){var t=Je(this).parent;return t&&t.resetChildRotationState(this),this},getChildLocalRotation:t=>Je(t).rotation},gi={updateChildScale(t){var e=Je(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=Je(t),i=e.parent;return e.scaleX=ci(t.scaleX,i.scaleX),e.scaleY=ci(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=Je(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=Je(this).parent;return t&&t.resetChildScaleState(this),this},getChildLocalScaleX:t=>Je(t).scaleX,getChildLocalScaleY:t=>Je(t).scaleY},fi={updateChildVisible(t){var e=Je(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=Je(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),Je(t).visible=e,this.updateChildVisible(t),this},setChildMaskVisible(t,e){return void 0===e&&(e=!0),Je(t).maskVisible=e,this.updateChildVisible(t),this},resetLocalVisibleState(){var t=Je(this).parent;return t&&t.resetChildVisibleState(this),this},getChildLocalVisible:t=>Je(t).visible},mi={updateChildAlpha(t){var e=Je(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=Je(t),i=e.parent;return e.alpha=ci(t.alpha,i.alpha),this},setChildAlpha(t,e){return t.alpha=e,this.resetChildAlphaState(t),this},setChildLocalAlpha(t,e){return Je(t).alpha=e,this.updateChildAlpha(t),this},resetLocalAlphaState(){var t=Je(this).parent;return t&&t.resetChildAlphaState(this),this},getChildLocalAlpha:t=>Je(t).alpha},yi={updateChildActive(t){var e=Je(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 Je(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),Je(t).active=e,this.updateChildActive(t),this},resetLocalActiveState(){var t=Je(this).parent;return t&&t.resetChildActiveState(this),this},getChildLocalActive:t=>Je(t).active},bi={updateChildScrollFactor(t){var e=Je(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}},xi={updateCameraFilter(t){var e=Je(t),i=e.parent;return e.syncCameraFilter&&(t.cameraFilter=i.cameraFilter),this},syncCameraFilter(){return this.syncChildrenEnable&&this.children.forEach(this.updateCameraFilter,this),this}},Ci={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}},wi=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}},Oi=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 Ti=Phaser.Utils.Array;var _i={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 As=Phaser.GameObjects.Rectangle;let Bs=class extends As{constructor(t,e,i){super(t,0,0,2,2,e,1),this.fullWindow=new Ds(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 Bs(this.scene,t,e);return this.scene.add.existing(i),i})),Ye(window,"RexPlugins.GameObjectShell.FullWindowRectangle",Bs);var js={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}},Ws={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,js,zs,Ws);var Ys=function(t){for(var e in t)return!1;return!0},Fs=function(t){return t&&"!"!==t.charAt(0)},Xs={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}},Vs=function(t){return t>>16&255},Gs=function(t){return t>>8&255},Hs=function(t){return 255&t};const Us=Phaser.Events.EventEmitter;var Ns=function(t,e,i,s,r,n){return void 0===n?n={}:!0===n&&(n=$s),"number"!=typeof i&&(i=0,s=0),n.x=r.x+r.width*t+i,n.y=r.y+r.height*e+s,n},$s={},Ks=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=Ns),function(t){if(t.events)return t;var e=new Us,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()},Zs=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},Js=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(er(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}},dr={setCamera(t,e){var i=this.get(t);if(!i)return this;var s=Kt(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}},cr={drawGameObjectsBounds:function(t,e){return this.forEachGO((function(i){i.drawBounds?i.drawBounds(t,e):Zi(i,t,e)})),this}};Object.assign(cr,Xs,sr,rr,nr,ar,or,lr,dr);const ur=Phaser.Utils.Objects.GetValue;class pr{constructor(t,e){this.scene=t,this.BobClass=ur(e,"BobClass",Is),this.setCreateGameObjectCallback(ur(e,"createGameObject"),ur(e,"createGameObjectScope")),this.setEventEmitter(ur(e,"eventEmitter",void 0)),this.setGameObjectDepth(ur(e,"depth",void 0));var i=ur(e,"fade",500);"number"==typeof i?(this.setGOFadeMode(),this.setGOFadeTime(i)):(this.setGOFadeMode(ur(i,"mode")),this.setGOFadeTime(ur(i,"time",500)));var s=ur(e,"viewportCoordinate",!1);!1!==s?(this.setViewportCoordinateEnable(ur(e,"enable",!0)),this.setViewport(ur(s,"viewport"))):this.setViewportCoordinateEnable(!1);var r=ur(e,"effectProperties",!1);this.setEffectPropertiesConfig(r),this.setSymbols(ur(e,"symbols")),this.bobs={},this.removedGOs=[],this._timeScale=1,this.name=ur(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=he(this.scene,this.scene.cameras.main)),this.viewport=t,this}setSymbols(t){return this.symbols=t,this}get isEmpty(){return Ys(this.bobs)&&0===this.removedGOs.length}}Object.assign(pr.prototype,e,cr);var vr={getLayer(t){return this.getGO(t)},getLayers(t){return void 0===t&&(t=[]),this.forEachGO((function(e){t.push(e)})),wi(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 xn=Phaser.Utils.Objects.GetValue;var Cn=function(t,e){return void 0===e?t:t[e]},wn=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=xn(e,"left",0),t.right=xn(e,"right",0),t.top=xn(e,"top",0),t.bottom=xn(e,"bottom",0)),t},Sn={getInnerPadding(t){return Cn(this.space,t)},setInnerPadding(t,e){return wn(this.space,t,e),this},getOuterPadding(t){return Cn(this.getSizerConfig(this).padding,t)},setOuterPadding(t,e){return wn(this.getSizerConfig(this).padding,t,e),this},getChildOuterPadding(t,e){return"string"==typeof t&&(t=this.getElement(t)),Cn(this.getSizerConfig(t).padding,e)},setChildOuterPadding(t,e,i){return"string"==typeof t&&(t=this.getElement(t)),wn(this.getSizerConfig(t).padding,e,i),this}},kn=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}},On=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},Pn=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},Tn=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}},_n=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},Mn=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},En={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}},Rn=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 Fa={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}},Xa={setTransitInTime(t){return this.transitInTime=t,this},setTransitOutTime(t){return this.transitOutTime=t,this},setTransitInCallback(t){return t||(t=Er),this.transitInCallback=t,this},setTransitOutCallback(t){return t||(t=Er),this.transitOutCallback=t,this}},Va={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}},Ga={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}},Ha={};Object.assign(Ha,Fa,Xa,Va,Ga);const Ua=Phaser.Utils.Objects.GetValue;class Na extends l{constructor(t,e){super(t,e),this.setTransitInTime(Ua(e,"duration.in",200)),this.setTransitOutTime(Ua(e,"duration.out",200)),this.setTransitInCallback(Ua(e,"transitIn")),this.setTransitOutCallback(Ua(e,"transitOut")),this.oneShotMode=Ua(e,"destroy",!1),this.delayCallTimer=void 0,this._state=new Ya(this,{eventEmitter:!1,initState:Ua(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(Na.prototype,Ha);const $a=Phaser.Utils.Objects.GetValue;class Ka extends l{constructor(t,e){super(t,{eventEmitter:!1}),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setHitAreaMode($a(t,"hitAreaMode",0)),this.setEnable($a(t,"enable",!0)),this.setStopMode($a(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=Za[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 Za={default:0,fullWindow:1};const Ja=Phaser.Utils.Objects.GetValue;class qa extends Bs{constructor(t,e){super(t,Ja(e,"color",0),Ja(e,"alpha",.8)),this.touchEventStop=new Ka(this,{hitAreaMode:1})}}var Qa={popUp(t,e){void 0!==t._modalScaleSave?(t.scaleX=t._modalScaleSave,t.scaleY=t._modalScaleSave):t._modalScaleSave=t.scaleX,Un(t,e)},scaleDown(t,e){Nn(t,e,void 0,void 0,!1)},fadeIn(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,na(t,e)},fadeOut(t,e){aa(t,e,!1)}},to=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,na(t,e,t.alpha)},eo=function(t,e){aa(t,e,!1)};const io=Phaser.Utils.Objects.GetValue;let so=class extends Na{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=ro.popUp),null==e.transitOut&&(e.transitOut=ro.scaleDown),e.destroy=io(e,"destroy",!0),super(t,e);var i=io(e,"cover");this.cover=!1!==i?function(t,e){var i=t.scene,s=new qa(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(io(i,"transitIn",to)),this.setCoverTransitOutCallback(io(i,"transitOut",eo)));var s=io(e,"touchOutsideClose",!1),r=io(e,"duration.hold",-1),n=io(e,"timeOutClose",r>=0),a=io(e,"anyTouchClose",!1);io(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),io(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&&T(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=ro[t]),t){case ro.popUp:t=Qa.popUp;break;case ro.fadeIn:t=Qa.fadeIn}return super.setTransitInCallback(t),this}setTransitOutCallback(t){switch("string"==typeof t&&(t=ro[t]),t){case ro.scaleDown:t=Qa.scaleDown;break;case ro.fadeOut:t=Qa.fadeOut}return super.setTransitOutCallback(t),this}setCoverTransitInCallback(t){return this.coverTransitInCallback=t,this}setCoverTransitOutCallback(t){return this.coverTransitOutCallback=t,this}};const ro={popUp:0,fadeIn:1,scaleDown:0,fadeOut:1};var no={modal(t,e){return Cs(t)&&(e=t,t=void 0),void 0===this._modalBehavior&&(this.onCreateModalBehavior&&this.onCreateModalBehavior(this,t),this._modalBehavior=function(t,e){var i=new so(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}},ao=function(t,e,i,s,r){Cs(e)&&(r=s,s=i,i=e,e=this);var n=this.scene.events;return this.bindEvent(e,n,t,i,s,r),this},oo={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 ao.call(this,"preupdate",t,e,i,s),this},bindSceneUpdateEvent(t,e,i,s){return ao.call(this,"update",t,e,i,s),this},bindScenePostupdateEvent(t,e,i,s){return ao.call(this,"postupdate",t,e,i,s),this},bindSceneRenderEvent(t,e,i,s){return ao.call(this,"render",t,e,i,s),this},bindScenePauseEvent(t,e,i,s){return ao.call(this,"pause",t,e,i,s),this},bindSceneResumeEvent(t,e,i,s){return ao.call(this,"resume",t,e,i,s),this},bindSceneSleepEvent(t,e,i,s){return ao.call(this,"sleep",t,e,i,s),this},bindSceneWakeEvent(t,e,i,s){return ao.call(this,"wake",t,e,i,s),this},bindSceneShutdownEvent(t,e,i,s){return ao.call(this,"shutdown",t,e,i,s),this}},ho=function(t){return"[object Array]"===Object.prototype.toString.call(t)},lo=function(t,e,i,s,r){return T(t,e,i,uo(s),r)},co=function(t){return!(t.rexSizer&&t.rexSizer.hidden)},uo=function(t){return t?function(e,i,s){return!!co(e)&&(t(e,i,s),!0)}:co},po={},vo=function(t){var e,i;this.sizerEventsEnable&&(e=t,void 0===(i=this.getChildPrevState(t))?i={}:!0===i&&(i=po),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))},go=function(t,e,i,s,r,n,a,o){tn(t,e,i,s,r,n),void 0!==a&&(t.x+=a),void 0!==o&&(t.y+=o),this.resetChildPositionState(t),this.sizerEventsEnable&&t.emit("sizer.postlayout",t,this)};const fo=Phaser.Display.Align.CENTER,mo=Phaser.Utils.Objects.IsPlainObject,yo=Phaser.Utils.Objects.GetValue;class bo extends l{constructor(t,e){super(t,e),this._enable=void 0,t.setInteractive(yo(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(yo(t,"enable",!0)),this.setMode(yo(t,"mode",1)),this.setClickInterval(yo(t,"clickInterval",100)),this.setDragThreshold(yo(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=xo[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 xo={press:0,pointerdown:0,release:1,pointerup:1};var Co={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 bo(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}},wo=function(t,e,i,s,r){if(e)return!(i&&!i(t,e)||!So(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 ko.length=0,!0;return ko.length=0,!1},ko=[];const Oo=Phaser.Utils.Objects.GetValue;class Po extends l{constructor(t,e){super(t,e),this._enable=void 0;var i=Oo(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(Oo(t,"enable",!0)),this.setMode(Oo(t,"mode",1)),this.setClickInterval(Oo(t,"clickInterval",100)),this.setDragThreshold(Oo(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=To[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?wo:E)(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 To={press:0,pointerdown:0,release:1,pointerup:1};var _o={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 Po(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 Mo extends U{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 Eo=Phaser.Utils.Objects.GetValue;class Ro extends l{constructor(t,e){super(t,e),this._enable=void 0,this.cooldown=new Mo,this.parent.setInteractive(Eo(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.prevIsInTouch=!1,this.isInTouching=!1,this.setEnable(Eo(t,"enable",!0)),this.setCooldown(Eo(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 Lo={isPointerInBounds(t){return void 0===t?t=this:"string"==typeof t&&(t=this.getElement(t)),!!t&&E(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 Ro(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 Ro(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}},Do={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}},Ao=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 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,a,o,h,l){ln.call(this,t);var d=t.isRexSpace,c=typeof e;if(null===e)return this;if("number"===c);else if("string"===c)e=vh[e];else if(ch(e)){var u;e=uh(u=e,"proportion",void 0),i=uh(u,"align",ph),s=uh(u,"padding",0),r=uh(u,"expand",!1),n=uh(u,"key",void 0),a=uh(u,"index",void 0),t.isRexSizer||(o=uh(u,"minWidth",void 0),h=uh(u,"minHeight",void 0)),l=uh(u,"fitRatio",0)}return"string"==typeof i&&(i=Mr[i]),void 0===e&&(e=d?1:0),void 0===i&&(i=ph),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===o&&(d?o=0:t.isRexSizer||(o=t._minWidth)),void 0===h&&(d?h=0:t.isRexSizer||(h=t._minHeight)),void 0===l||!1===l?l=0:!0===l&&(l=p(t)/v(t)),(u=this.getSizerConfig(t)).proportion=e,u.align=i,u.padding=on(s),u.expand=r,u.fitRatio=0===e?l:0,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?v(t):h),r&&(0===this.orientation?t.minHeight=h:t.minWidth=o)),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,a,o){return ch(i)&&(i.index=t),gh.call(this,e,i,s,r,n,a,t,o),this},insertAtPosition(t,e,i,s,r,n,a,o,h){var l=dh.call(this,t,e);return-1===l&&(l=void 0),this.insert(l,i,s,r,n,a,o,h),this}};const mh=is.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=Mr[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}},Sh={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}},Oh={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&&(An(t,0,0),e.resolved=!1,this.hasRatioFitChild=!0);return this._childrenProportion=void 0,this.hasProportion0Child=!1,this.proportionLength=void 0,Rn.call(this),this},layoutChildren:function(){for(var t,e,i,s,r,n,a,o,h,l,d=this.sizerChildren,c=this.innerLeft,u=this.innerTop,g=this.innerWidth,f=this.innerHeight,m=c,y=u,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=Tn.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)||On.call(this)},runWidthWrap:function(t){this.wrapResult||(1===this.orientation&&oh.call(this,t,void 0),Pn.call(this,t))},hasHeightWrap:function(){return!(!this.hasRatioFitChild||0!==this.orientation)||_n.call(this)},runHeightWrap:function(t){this.wrapResult||(0===this.orientation&&oh.call(this,void 0,t),Mn.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(Oh,fh,xh,Ch,wh,Sh,kh);var Ph=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},_h=function(t){return"string"==typeof t&&(t=Th[t]),t};const Mh=Phaser.Utils.Objects.IsPlainObject,Eh=Phaser.Utils.Objects.GetValue;class Rh extends rh{constructor(t,e,i,s,r,n,a){Mh(e)?(e=Eh(a=e,"x",0),i=Eh(a,"y",0),s=Eh(a,"width",void 0),r=Eh(a,"height",void 0),n=Eh(a,"orientation",0)):Mh(s)?(s=Eh(a=s,"width",void 0),r=Eh(a,"height",void 0),n=Eh(a,"orientation",0)):Mh(n)&&(n=Eh(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(Eh(a,"space.item",0)),this.setStartChildIndex(Eh(a,"startChildIndex",0)),this.setRTL(Eh(a,"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=Ph.call(this)),this._childrenProportion}}Object.assign(Rh.prototype,Oh);var Lh=function(t,e,i,s){return e/t<=i?e/(s-1):0},Dh=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=Ah(o.left,o.centerY,t,e))&&(r=h,s=n);var h,l=i[n+1];l&&l.y===o.y||r>(h=Ah(o.right,o.centerY,t,e))&&(r=h,s=n+1)}}return s};const jh=Phaser.Utils.Objects.IsPlainObject,zh=Phaser.Utils.Objects.GetValue,Wh=Phaser.Display.Align.CENTER;var Ih=function(t,e,i,s){return"\n"===t?(this.addNewLine(),this):(ln.call(this,t),jh(e)&&(e=zh(r=e,"padding",0),i=zh(r,"key",void 0),s=zh(r,"index",void 0)),void 0===e&&(e=0),(r=this.getSizerConfig(t)).align=Wh,r.padding=on(e),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},Yh={add(t,e,i){if(ho(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}},Vh={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},ml=0,yl=1,bl=2,xl=0,Cl=1,wl=2,Sl=/(?:\r\n|\r|\n)/;const kl={none:xl,word:Cl,char:wl,character:wl,mix:3},Ol=Phaser.Renderer.WebGL.Utils;var Pl={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=Ol.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 Tl=Phaser.Display.Color;var _l={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,v=d.cutY+o;return this.context.drawImage(d.source.image,p,v,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 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 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}},Ml=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)},El={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}};Xe();const Rl=Phaser.Display.Canvas.CanvasPool,Ll=Phaser.GameObjects.GameObject,Dl=Phaser.Utils.String.UUID;let Al=class 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 Bl=Phaser.GameObjects.Components;Phaser.Class.mixin(Al,[Bl.Alpha,Bl.BlendMode,Bl.Crop,Bl.Depth,Bl.Flip,Bl.GetBounds,Bl.Mask,Bl.Origin,Bl.Pipeline,Bl.PostPipeline,Bl.ScrollFactor,Bl.Tint,Bl.Transform,Bl.Visible,Pl,_l,El]);var jl={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&&Ct(this.data),this}};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,jl);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 Il=Phaser.Math.RotateAround;var Yl;const Fl=Phaser.Geom.Rectangle;var Xl,Vl=function(t){void 0===Xl&&(Xl=new Fl);var e=t.drawTLX,i=t.drawTLY;return Xl.setTo(e,i,t.drawTRX-e,t.drawBLY-i),Xl};const Gl=Phaser.Math.RotateAround;var Hl,Ul=function(t,e,i,s){return void 0===s?s={}:!0===s&&(void 0===Hl&&(Hl={}),s=Hl),s.x=e,s.y=i,0!==t.rotation&&Gl(s,0,0,t.rotation),s.x=s.x*t.scaleX+t.drawX,s.y=s.y*t.scaleY+t.drawY,s};const Nl=Phaser.GameObjects.Components.TransformMatrix;var $l,Kl,Zl={},Jl=function(t,e,i,s,r){var n=Ul(e,i,s,!0),a=function(t,e,i,s){void 0===s?s={}:!0===s&&(s=Zl);var r=e-t.width*t.originX,n=i-t.height*t.originY;return void 0===$l&&($l=new Nl,Kl=new Nl),t.parentContainer?t.getWorldTransformMatrix($l,Kl):$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},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 Jl(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===Yl&&(Yl={}),s=Yl),s.x=(t-i.drawX)/i.scaleX,s.y=(e-i.drawY)/i.scaleY,0!==i.rotation&&Il(s,0,0,-i.rotation),s}(t,e,this,!0);return Vl(this).contains(i.x,i.y)},getWorldPosition:function(t,e,i){return ql(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 od=Phaser.Utils.Objects.GetValue;let hd=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=od(t,"x",0),i=od(t,"y",0));var s=this.cornerRadius;s.tl=ld(od(t,"tl",void 0),e,i),s.tr=ld(od(t,"tr",void 0),e,i),s.bl=ld(od(t,"bl",void 0),e,i),s.br=ld(od(t,"br",void 0),e,i)}get radiusTL(){var t=this.cornerRadius.tl;return Math.max(t.x,t.y)}set radiusTL(t){dd(this.cornerRadius.tl,t)}get radiusTR(){var t=this.cornerRadius.tr;return Math.max(t.x,t.y)}set radiusTR(t){dd(this.cornerRadius.tr,t)}get radiusBL(){var t=this.cornerRadius.bl;return Math.max(t.x,t.y)}set radiusBL(t){dd(this.cornerRadius.bl,t)}get radiusBR(){var t=this.cornerRadius.br;return Math.max(t.x,t.y)}set radiusBR(t){dd(this.cornerRadius.br,t)}};var ld=function(t,e,i){return void 0===t?t={x:e,y:i}:"number"==typeof t&&(t={x:t,y:t}),cd(t),t},dd=function(t,e){"number"==typeof e?(t.x=e,t.y=e):(t.x=od(e,"x",0),t.y=od(e,"y",0)),cd(t)},cd=function(t){t.convex=t.x>=0||t.y>=0,t.x=Math.abs(t.x),t.y=Math.abs(t.y)};const ud=Phaser.Math.DegToRad;var pd=function(t){return!t.hasOwnProperty("convex")||t.convex},vd=function(t){return t.x>0&&t.y>0},gd=function(t,e,i,s,r,n,a,o,h){if(o&&a>n?a-=360:!o&&a=p?1:s/p,f=r>=v?1:r/v,m=u.cornerRadius;t.save(),t.beginPath(),t.translate(e,i),o=m.tl,vd(o)?(h=o.x*g,l=o.y*f,pd(o)?gd(t,h,l,h,l,180,270,!1,a):gd(t,0,0,h,l,90,0,!0,a),d=0,c=l):(t.lineTo(0,0),d=0,c=0),o=m.tr,vd(o)?(h=o.x*g,l=o.y*f,pd(o)?gd(t,s-h,l,h,l,270,360,!1,a):gd(t,s,0,h,l,180,90,!0,a)):t.lineTo(s,0),o=m.br,vd(o)?(h=o.x*g,l=o.y*f,pd(o)?gd(t,s-h,r-l,h,l,0,90,!1,a):gd(t,s,r,h,l,270,180,!0,a)):t.lineTo(s,r),o=m.bl,vd(o)?(h=o.x*g,l=o.y*f,pd(o)?gd(t,h,r-l,h,l,90,180,!1,a):gd(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())},md=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),fd(t.canvas,t.context,d,d,h,l,r,e,i,s,n,a,o)}};const yd=Phaser.Utils.Objects.GetValue;class bd extends sd{constructor(t,e){super(t,"background"),this.setScrollFactor(0),this.setColor(yd(e,"color",null),yd(e,"color2",null),yd(e,"horizontalGradient",!0)),this.setStroke(yd(e,"stroke",null),yd(e,"strokeThickness",2)),this.setCornerRadius(yd(e,"cornerRadius",0),yd(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(){md(this.parent,this.color,this.stroke,this.strokeThickness,this.cornerRadius,this.color2,this.horizontalGradient,this.cornerIteration)}}const xd=Phaser.Utils.Objects.GetValue;class Cd extends sd{constructor(t,e){super(t,"innerbounds"),this.setScrollFactor(0),this.setColor(xd(e,"color",null),xd(e,"color2",null),xd(e,"horizontalGradient",!0)),this.setStroke(xd(e,"stroke",null),xd(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,xd(t,"color2",null),xd(t,"horizontalGradient",!0)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,xd(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 wd=Phaser.Utils.Objects.GetValue;let Sd=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(wd(t,"bold",!1)),this.setItalic(wd(t,"italic",!1)),this.setFontSize(wd(t,"fontSize","16px")),this.setFontFamily(wd(t,"fontFamily","Courier")),this.setColor(wd(t,"color","#fff")),this.setStrokeStyle(wd(t,"stroke",null),wd(t,"strokeThickness",0)),this.setShadow(wd(t,"shadowColor",null),wd(t,"shadowOffsetX",0),wd(t,"shadowOffsetY",0),wd(t,"shadowBlur",0)),this.setOffset(wd(t,"offsetX",0),wd(t,"offsetY",0)),this.setSpace(wd(t,"leftSpace",0),wd(t,"rightSpace",0)),this.setAlign(wd(t,"align",void 0)),this.setBackgroundColor(wd(t,"backgroundColor",null)),this.setBackgroundHeight(wd(t,"backgroundHeight",void 0)),this.setBackgroundBottomY(wd(t,"backgroundBottomY",void 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),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}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 kd=Phaser.Utils.Array.Remove,Od=Phaser.Utils.Array.Remove,Pd="text",Td="image",_d="drawer",Md="space",Ed="command";var Rd=function(t){return t.type===Pd&&"\n"===t.text},Ld=function(t){return t.type===Pd&&"\f"===t.text},Dd=function(t){return t.type===Pd};class Ad extends sd{constructor(t,e,i){super(t,Pd),this.updateTextFlag=!1,this.style=new Sd(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,s=this.drawTRX-i+1,r=e.backgroundBottomY;null==r&&(r=this.drawBLY);var n=e.backgroundHeight;null==n&&(n=r-this.drawTLY);var a=r-n;t.fillRect(i,a,s,n)}var o=e.hasFill,h=e.hasStroke;(o||h)&&(e.syncFont(t).syncStyle(t),h&&(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 Bd=function(t,e){var i=this.createCharChildren(t,e);return this.addChild(i),this};const jd=Phaser.Display.Canvas.CanvasPool;var zd=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=jd.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),jd.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 Wd extends sd{constructor(t,e,i){super(t,Td),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(){zd(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 Id extends sd{constructor(t,e,i,s){super(t,_d),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,Md),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 Fd extends zl{constructor(t,e,i,s,r){super(t,Ed),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 Vd={none:0,word:1,char:2,character:2,mix:3};var Gd=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=$d.call(this)).height,a=l.ascent,i=Math.floor((h-a)/n))}else{var l;n=(l=$d.call(this)).height,a=l.ascent}}else this.fixedHeight>0?void 0===(i=Zd(t,"maxLines"))&&(h=this.fixedHeight-s,i=Math.floor(h/n)):i=Zd(t,"maxLines",0);void 0===a&&(a=n);var d=0===i,c=Zd(t,"wrapMode");void 0===c&&(c=Zd(t,"charWrap",!1)?"char":"word"),"string"==typeof c&&(c=Vd[c]);var u=Zd(t,"wrapWidth",void 0);void 0===u&&(this.fixedWidth>0?u=this.fixedWidth-r:(u=1/0,c=0));for(var p=Zd(t,"letterSpacing",0),v=Zd(t,"hAlign",0),g=Zd(t,"vAlign",0),f=Zd(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&&(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 Y=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,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=Qd(t,"maxLines",void 0))){var a=this.fixedWidth-r;i=Math.floor(a/n)+1}}else i=Qd(t,"maxLines",0);var o=0===i,h=Qd(t,"fixedCharacterHeight",void 0);if(void 0===h){var l=Qd(t,"charPerLine",void 0);if(void 0!==l){var d=this.fixedHeight-s;h=Math.floor(d/l)}}var c=Qd(t,"wrapHeight",void 0);void 0===c&&(c=this.fixedHeight>0?this.fixedHeight-s:1/0);for(var u=Qd(t,"letterSpacing",0),p=Qd(t,"rtl",!0),v=Qd(t,"hAlign",p?2:0),g=Qd(t,"vAlign",0),f=Xd({callback:"runVerticalWrap",start:e,padding:this.wrapPadding,letterSpacing:u,maxLines:i,hAlign:v,vAlign:g,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 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,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 wn(i,t,e),this.dirty=this.dirty||s!=i.left||r!=i.right||n!=i.top||a!=i.bottom,this},getPadding:function(t){return Cn(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),kd(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 Od(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(Pd);return null===i?i=new Ad(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 kc=Phaser.Utils.Objects.GetFastValue;var Oc={};class Pc{constructor(t){this.pools=kc(t,"pools",Oc)}free(t){if(!this.pools)return this;var e=t.type;return this.pools.hasOwnProperty(e)||(this.pools[e]=new Sc),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=Ac(t,r,e,i,n),o=0;o<=Rc&&0!==a;o++){if((r+=a)<0){r=0;break}a=Ac(t,r,e,i,n)}return o===Rc&&console.warn("FontSizeFit: Test count exceeds 65535"),t.setFontSize(r),Bc(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]},Ac=function(t,e,i,s,r){var n,a=Dc(t,e,r),o=Dc(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)},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 jc=Phaser.Utils.Objects.GetValue,zc=Phaser.Utils.Objects.GetValue;class Wc extends el{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexLabel";var i,s=zc(e,"background",void 0),r=zc(e,"icon",void 0),n=zc(e,"iconMask",void 0),a=zc(e,"text",void 0),o=zc(e,"action",void 0),h=zc(e,"actionMask",void 0),l=zc(e,"align",void 0);if(s&&this.addBackground(s),r){0===this.orientation?(a||o)&&(i={right:zc(e,"space.icon",0),top:zc(e,"space.iconTop",0),bottom:zc(e,"space.iconBottom",0),left:zc(e,"space.iconLeft",0)}):(a||o)&&(i={bottom:zc(e,"space.icon",0),left:zc(e,"space.iconLeft",0),right:zc(e,"space.iconRight",0),top:zc(e,"space.iconTop",0)});var d=zc(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=zc(e,"iconSize",void 0);this.setIconSize(zc(e,"iconWidth",c),zc(e,"iconHeight",c))}}if(a){var u=zc(e,"wrapText",!1),p=zc(e,"adjustTextFontSize",!1);u?(!0===u&&(u="word"),function(t,e){switch(ul(t)){case 0:switch("string"==typeof e&&(e=kl[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=kl[e]||0),t.style.wrapMode=e}}(a,u),e.expandTextWidth=!0,Ec(a)):p&&(e.expandTextWidth=!0,e.expandTextHeight=!0,function(t,e){"number"==typeof e&&(e={minWidth:e});var i=jc(e,"minWidth",0),s=jc(e,"minHeight",0),r=jc(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})}(a,{fitHeight:!0}));var v,g,f=zc(e,"space.text",0),m=zc(e,"expandTextWidth",!1),y=zc(e,"expandTextHeight",!1);0===this.orientation?(v=m?1:0,o&&(i={right:f}),g=y):(v=y?1:0,o&&(i={bottom:f}),g=m),this.add(a,{proportion:v,expand:g,padding:i})}if(o&&(i=0===this.orientation?{top:zc(e,"space.actionTop",0),bottom:zc(e,"space.actionBottom",0),right:zc(e,"space.actionRight",0)}:{left:zc(e,"space.actionLeft",0),right:zc(e,"space.actionRight",0),bottom:zc(e,"space.actionBottom",0)},d=zc(e,"squareFitAction",!1)?1:0,this.add(o,{proportion:0,padding:i,fitRatio:d}),h&&(h=ol.call(this,o,o,1)),!d)){var b=zc(e,"actionSize");this.setActionSize(zc(e,"actionWidth",b),zc(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 Ic=Phaser.Renderer.WebGL.Utils,Yc=function(t,e,i,s,r,n){for(var a=Ic.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+")"},Hc=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 Uc=Phaser.Renderer.Canvas.SetTransform;var Nc={renderWebGL:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.pipelines.set(e.pipeline),n=Vc(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&&Yc(r,a,e,l,o,h),e.isStroked&&Xc(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(Uc(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(Kc.prototype,Nc);var Zc=function(t){return t.x>0&&t.y>0},Jc=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 qc=Phaser.Math.DegToRad;var Qc=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=tp(t,"tl",0),this.radiusTR=tp(t,"tr",0),this.radiusBL=tp(t,"bl",0),this.radiusBR=tp(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?Qc(e,e,e,e,180,270,!1,r,t):Qc(0,0,e,e,90,0,!0,r,t):Jc(0,0,t),(e=this.radiusTR)>0?this._convexTR?Qc(i-e,e,e,e,270,360,!1,r,t):Qc(i,0,e,e,180,90,!0,r,t):Jc(i,0,t),(e=this.radiusBR)>0?this._convexBR?Qc(i-e,s-e,e,e,0,90,!1,r,t):Qc(i,s,e,e,270,180,!0,r,t):Jc(i,s,t),(e=this.radiusBL)>0?this._convexBL?Qc(e,s-e,e,e,90,180,!1,r,t):Qc(0,s,e,e,360,270,!0,r,t):Jc(0,s,t),t.push(t[0],t[1]),zu(this.x,this.y,t),super.updateData(),this}}Phaser.Renderer.WebGL.Utils.getTintAppendFloatAlpha;var ip=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 sp=Phaser.Utils.Objects.GetValue,rp=Phaser.Utils.Objects.IsPlainObject;class np extends(Tu(bu)){constructor(t,e,i,s,r,n,a,o){rp(e)?(e=(o=e).x,i=o.y,s=o.width,r=o.height,n=o.barColor,a=o.value):rp(s)?(s=(o=s).width,r=o.height,n=o.barColor,a=o.value):rp(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 Qu).setName("trackFill")).addShape((new Qu).setName("bar")).addShape((new Qu).setName("trackStroke")),this.setTrackColor(sp(o,"trackColor",void 0)),this.setBarColor(n),this.setTrackStroke(sp(o,"trackStrokeThickness",2),sp(o,"trackStrokeColor",void 0)),this.setSkewX(sp(o,"skewX",0)),this.setRTL(sp(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 ap={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&&ip(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),ip(a,r,0,n,i,t));var o=this.getShape("trackStroke");o.lineStyle(this.trackStrokeThickness,this.trackStrokeColor),o.isStroked&&ip(o,0,0,e,i,t)}};Object.assign(np.prototype,ap);class op extends np{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"),Ye(e,"easeValue.duration",e.easeDuration),Ye(e,"easeValue.ease",e.ease),super(t,e),this.type="rexStatesBarRectangleShape",this.barState=!1,e.style=this,e.propertiesMap=hp,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 hp={color:"trackColor",strokeColor:"trackStrokeColor",strokeWidth:"trackStrokeThickness"};Object.assign(op.prototype,cu);let lp=class extends l{constructor(t,e){return super(t),new Proxy(this,this)}get(t,e){if(Zs(t,e))return t[e];var i=t.parent;return Zs(i,e)?i[e]:void 0}set(t,e,i){return Zs(t,e)?t[e]=i:Zs(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 dp=Phaser.GameObjects.NineSlice,cp=Phaser.Utils.Objects.GetValue;class up extends dp{constructor(t,e){void 0===e&&(e={}),super(t,cp(e,"x",0),cp(e,"y",0),cp(e,"key",null),cp(e,"frame",null),cp(e,"width",0),cp(e,"height",0),cp(e,"leftWidth",0),cp(e,"rightWidth",0),cp(e,"topHeight",0),cp(e,"bottomHeight",0)),this.type="rexStatesNineSlice";var i=cp(e,"effects",!0);i&&er(this,i),this.style=new lp(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign(up.prototype,cu);let pp=class extends l{constructor(t,e){return super(t),new Proxy(this,this)}get(t,e){if(Zs(t,e))return t[e];var i=t.parent;return Zs(i,e)?i[e]:void 0}set(t,e,i){return Zs(t,e)?t[e]=i:Zs(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 vp=Phaser.GameObjects.Image,gp=Phaser.Utils.Objects.GetValue;class fp extends vp{constructor(t,e){void 0===e&&(e={}),super(t,gp(e,"x",0),gp(e,"y",0),gp(e,"key",""),gp(e,"frame",void 0)),this.type="rexStatesImage";var i=gp(e,"effects",!0);i&&er(this,i),this.style=new pp(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign(fp.prototype,cu);var mp=function(t,e,i){return"__BASE"===i?`${t},${e}`:`${i}:${t},${e}`};const yp=Phaser.Utils.Objects.IsPlainObject,bp=Phaser.Utils.Objects.GetValue;var xp=function(t){return"string"==typeof t&&(t=Cp[t]),t};const Cp={scale:0,repeat:1};var wp=function(t,e){return 0===t||t===this.columns.count-1||0===e||e===this.rows.count-1},Sp={_beginDraw:Er,_drawImage:Er,_drawTileSprite:Er,_endDraw:Er,setGetFrameNameCallback:function(t){return void 0===t&&(t=mp),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=je(i),s=je(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:g,b=0,h=0;for(var S=i.length;h0?0:f),f>=1&&g>=1){var k=typeof(m=this.getFrameNameCallback(h,C,e));"string"!==k&&"number"!==k||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,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 v=Math.min(u,p);if(u>v){var g=(u-v)*h;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&&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 yp(t)?(this.stretchMode.edge=xp(bp(t,"edge",0)),this.stretchMode.internal=xp(bp(t,"internal",0))):(t=xp(t),this.stretchMode.edge=t,this.stretchMode.internal=t),this},getStretchMode:function(t,e){return wp.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 kp=Phaser.Utils.Objects.IsPlainObject,Op=Phaser.Utils.Objects.GetValue,Pp=Phaser.GameObjects;var Tp=void 0,_p=function(t,e){if(Tp||(Tp={},o(t).events.once("destroy",(function(){for(var t in Tp)Tp[t].destroy();Tp=void 0}))),!Tp.hasOwnProperty(e)){var i=o(t).scene.systemScene;(t=new Pp[e](i)).setOrigin(0),Tp[e]=t}return Tp[e]};const Mp=Phaser.GameObjects.RenderTexture;class Ep extends(function(t,e){class i extends t{constructor(t,i,s,r,n,a,o,h,l,d){if(kp(i)?(i=Op(d=i,"x",0),s=Op(d,"y",0),r=Op(d,"width",1),n=Op(d,"height",1),a=Op(d,"key",void 0),o=Op(d,"baseFrame",void 0),h=Op(d,"columns",void 0),l=Op(d,"rows",void 0)):kp(r)?(r=Op(d=r,"width",1),n=Op(d,"height",1),a=Op(d,"key",void 0),o=Op(d,"baseFrame",void 0),h=Op(d,"columns",void 0),l=Op(d,"rows",void 0)):kp(a)?(a=Op(d=a,"key",void 0),o=Op(d,"baseFrame",void 0),h=Op(d,"columns",void 0),l=Op(d,"rows",void 0)):kp(o)?(o=Op(d=o,"baseFrame",void 0),h=Op(d,"columns",void 0),l=Op(d,"rows",void 0)):Array.isArray(o)?(d=l,l=h,h=o,o=Op(d,"baseFrame",void 0)):kp(h)&&(h=Op(d=h,"columns",void 0),l=Op(d,"rows",void 0)),void 0===o&&(o=Op(d,"frame",void 0)),void 0===h){var c=Op(d,"leftWidth",void 0),u=Op(d,"rightWidth",void 0);void 0!==c&&void 0!==u&&(h=[c,void 0,u])}if(void 0===l){var p=Op(d,"topHeight",void 0),v=Op(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(Op(d,"getFrameNameCallback",void 0)),this.setStretchMode(Op(d,"stretchMode",0)),this.setPreserveRatio(Op(d,"preserveRatio",!0));var g=Op(d,"maxFixedPartScale",1),f=Op(d,"maxFixedPartScaleX",g),m=Op(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,Sp),i}(Mp,"rexNinePatch")){}var Rp={_drawImage:function(t,e,i,s,r,n){var a=_p(this,"Image").setTexture(t,e).setDisplaySize(r,n);this.draw(a,i,s)},_drawTileSprite:function(t,e,i,s,r,n){var a=_p(this,"TileSprite").setTexture(t,e).setSize(r,n);this.draw(a,i,s)}};Object.assign(Ep.prototype,Rp);let Lp=class extends l{constructor(t,e){return super(t),new Proxy(this,this)}get(t,e){if(Zs(t,e))return t[e];var i=t.parent;return Zs(i,e)?i[e]:void 0}set(t,e,i){return Zs(t,e)?t[e]=i:Zs(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 Dp=Phaser.Utils.Objects.GetValue;class Ap extends Ep{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexStatesNinePatch";var i=Dp(e,"effects",!0);i&&er(this,i),this.style=new Lp(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign(Ap.prototype,cu);const Bp=["alpha","tint","flipX","flipY"];var jp=function(t,e){if(!e)return t;for(var i=0,s=Bp.length;i * @copyright 2018 Photon Storm Ltd. @@ -8,4 +8,4 @@ var t,e;t=void 0,e=function(){class t{constructor(t){this.scene=t,this.displayLi * @author Richard Davey * @copyright 2019 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} - */var Am=function(t,e){var i=Vi(t);for(var s in e)i.hasOwnProperty(s)||(i[s]=e[s]);return i},Bm=function(t,e,i){return zp(t,Am(e,i))};class jm extends Na{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 zm={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}},Wm=function(t,e){qn.popUp.call(t,e,this.expandDirection)},Im=function(t,e){qn.scaleDown.call(t,e,this.expandDirection)},Ym={setTransitionDuration(t){return this.transitionDuration=t,this.childTransition.setTransitInTime(t).setTransitOutTime(t),this},setExpandCallback(t){return void 0===t&&(t=Wm.bind(this)),this.childTransition.setTransitInCallback(t),this},setCollapseCallback(t){return void 0===t&&(t=Im.bind(this)),this.childTransition.setTransitOutCallback(t),this}};const Fm=Phaser.Utils.Objects.GetValue;let Xm=class extends Rh{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=Fm(e,"space"),a=1===this.orientation?"left":"top",o=Fm(e,"align.title",a),h=Fm(e,"expand.title",!0);this.add(s,{proportion:0,align:o,expand:h,padding:{left:Fm(n,"titleLeft",0),right:Fm(n,"titleRight",0),top:Fm(n,"titleTop",0),bottom:Fm(n,"titleBottom",0)}});var l=Fm(e,"toggleByTarget",void 0),d=Fm(e,"toggleClickConfig");if(void 0===l&&(l=s),l&&Co.onClick.call(l,(function(){this.toggle()}),this,d),this.childTransition=new jm(r),!Fm(e,"customChildOrigin",!1)){var c=this.rtl?1:0;r.setOrigin(c)}o=Fm(e,"align.child","left");var u=(h=Fm(e,"expand.child",!0))?1:0;this.add(r,{proportion:u,align:o,expand:h,padding:{left:Fm(n,"childLeft",0),right:Fm(n,"childRight",0),top:Fm(n,"childTop",0),bottom:Fm(n,"childBottom",0)}}),this.addChildrenMap("title",s),this.addChildrenMap("child",r),this.addChildrenMap("background",i);var p=e.transition;this.setTransitionDuration(Fm(p,"duration",200)),this.setExpandCallback(Fm(p,"expandCallback",void 0)),this.setCollapseCallback(Fm(p,"collapseCallback",void 0)),this.reLayoutTarget=Fm(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=Fm(e,"expanded",void 0);void 0!==y&&this.setExpandedState(y)}};Object.assign(Xm.prototype,zm,Ym);var Vm={setBindingTarget(t){return this.childrenMap.child.setBindingTarget(t),this}},Gm={getMaxInputRowTitleWidth(){return this.childrenMap.child.getMaxInputRowTitleWidth()+this.getInnerPadding("left")},setInputRowTitleWidth(t){return t-=this.getInnerPadding("left"),this.childrenMap.child.setInputRowTitleWidth(t),this}};class Hm extends Xm{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(Hm.prototype,Vm,Gm);const Um=Phaser.Utils.Objects.GetValue,Nm=Phaser.Utils.Objects.GetValue,$m=Rh.prototype.add,Km=Rh.prototype.addSpace;var Zm=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)&&Km.call(this),$m.call(this,t,{proportion:i,expand:!0});var s=!this.buttonsExpand&&"center"===this.buttonsAlign;s&&Km.call(this),this.hasTailSpace=s}else $m.call(this,t,{proportion:i,expand:!0}),this.hasTailSpace=!1;else if(this.hasTailSpace){var r=this.sizerChildren.length-1;$m.call(this,t,{index:r,proportion:i,expand:!0})}else $m.call(this,t,{proportion:i,expand:!0});return e&&this.buttonGroup.add(t),this},Jm={addButton(t){if(ho(t))for(var e=t,i=0,s=e.length;i=0;i--)ty.call(this,e[i],t);return this}},iy=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)}},sy=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,iy.call(e,t,i,s)}},enumerable:!0,configurable:!0}),t.selected=!1},ry={add(t){return this.buttons.push(t),t._click||(t._click=new bo(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`),sy.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&&fy.addNewLine(this)}else for(n=0,a=t.length;n=0;i--)Cy.call(this,e[i],t);return this}};const Sy=Phaser.Utils.Objects.GetValue;class ky extends $h{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 cy({parent:this,eventEmitter:Sy(e,"eventEmitter",this),groupName:Sy(e,"groupName",void 0),clickConfig:Sy(e,"click",void 0)}).setButtonsType(e);var s=Sy(e,"background",void 0),r=Sy(e,"buttons",void 0);this.buttonsAlign=Sy(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(ky.prototype,yy,wy,dy,py);var Oy=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=Py[i])}void 0===s?s={}:!0===s&&(s=Ty);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 Py={fit:0,FIT:0,envelop:1,ENVELOP:1};var Ty={},_y={},My={};const Ey=Phaser.Utils.Objects.IsPlainObject,Ry=Phaser.Utils.Objects.GetValue,Ly=Phaser.Display.Align.CENTER,Dy=Phaser.Utils.String.UUID;var Ay={add:function(t,e,i,s,r,n,a,o,h,l){ln.call(this,t),Ey(e)&&(e=Ry(d=e,"key",void 0),i=Ry(d,"align",Ly),s=Ry(d,"padding",0),r=Ry(d,"expand",!0),t.isRexSizer||(n=Ry(d,"minWidth",t._minWidth),a=Ry(d,"minHeight",t._minHeighted)),o=Ry(d,"offsetX",0),h=Ry(d,"offsetY",0),l=Ry(d,"aspectRatio",0));var d,c=void 0!==e;return c||(e=Dy()),"string"==typeof i&&(i=Mr[i]),void 0===i&&(i=Ly),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===l?l=0:!0===l&&(l=p(t)/v(t)),l>0&&(r=!0,void 0===n&&(n=0),void 0===a&&(a=0)),(d=this.getSizerConfig(t)).align=i,d.padding=on(s),Ey(r)?(d.expandWidth=Ry(r,"width",!1),d.expandHeight=Ry(r,"height",!1)):(d.expandWidth=r,d.expandHeight=r),t.isRexSizer||(d.expandWidth&&(t.minWidth=void 0===n?p(t):n),d.expandHeight&&(t.minHeight=void 0===a?v(t):a)),d.alignOffsetX=o,d.alignOffsetY=h,d.aspectRatio=l,this.sizerChildren.hasOwnProperty(e)&&this.sizerChildren[e].destroy(),this.sizerChildren[e]=t,c&&this.addChildrenMap(e,t),this}},By={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]),fn.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}},jy={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=this.innerLeft,c=this.innerTop,u=this.innerWidth,p=this.innerHeight,v=this.sizerChildren;for(var g in v)(t=v[g]).rexSizer.hidden||(i=(e=t.rexSizer).padding,vo.call(this,t),o=this.getExpandedChildWidth(t),h=this.getExpandedChildHeight(t),e.aspectRatio>0&&(_y.width=e.aspectRatio,_y.height=1,My.width=o,My.height=h,o=(l=Oy(_y,My,"FIT",!0)).width,h=l.height),t.isRexSizer?(t.runLayout(this,o,h),nh(t,this)):An(t,o,h),s=d+i.left*this.scaleX,n=u-(i.left+i.right)*this.scaleX,r=c+i.top*this.scaleY,a=p-(i.top+i.bottom)*this.scaleY,go.call(this,t,s,r,n,a,e.align,e.alignOffsetX,e.alignOffsetY))}};Object.assign(jy,Ay,By);const zy=Phaser.Utils.Objects.IsPlainObject,Wy=Phaser.Utils.Objects.GetValue;class Iy extends rh{constructor(t,e,i,s,r,n){zy(e)?(e=Wy(n=e,"x",0),i=Wy(n,"y",0),s=Wy(n,"width",void 0),r=Wy(n,"height",void 0)):zy(s)&&(s=Wy(n=s,"width",void 0),r=Wy(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(Iy.prototype,jy);const Yy=Iy.prototype.add;var Fy=function(t,e,i,s,r,n,a,o,h){return t.setVisible(!1),Yy.call(this,t,e,i,s,r,n,a,o,h),this},Xy={add:Fy,addPage:Fy};const Vy=is.prototype.setChildVisible;var Gy={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?(Vy.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&&(Vy.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(Gy,Xy);const Hy=Phaser.Utils.Objects.GetValue;class Uy extends Iy{constructor(t,e){super(t,e),this.type="rexPages",this.childrenMap=this.sizerChildren,this._previousKey=void 0,this._currentKey=void 0,this.setSwapMode(Hy(e,"swapMode",0)),this.setFadeInDuration(Hy(e,"fadeIn",0))}setSwapMode(t){return"string"==typeof t&&(t=Ny[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(Uy.prototype,Gy);const Ny={invisible:0,destroy:1},$y=Phaser.Utils.Objects.IsPlainObject,Ky=Phaser.Utils.Objects.GetValue,Zy=Phaser.Utils.String.UUID;var Jy={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}},qy={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}},Qy={top:1,left:3,right:5,bottom:7},tb={top:"bottom",left:"right",right:"left",bottom:"top"},eb={setTabsPadding(t,e){return this.childrenMap.tabs.setOuterPadding(t,e),this},getTabsPadding(t){return this.childrenMap.tabs.getOuterPadding(t)}},ib={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 xb=Phaser.Utils.Objects.GetValue;class Cb extends Rh{constructor(t,e){void 0===e&&(e={}),e.orientation="y",super(t,e),this.type="rexTweaker.Wrap";var i=xb(e,"background",void 0),s=xb(e,"title",void 0);i&&this.addBackground(i),s&&this.add(s,{expand:!0,space:{bottom:xb(e,"space.title",0)}});var r=xb(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(Cb.prototype,yb,bb);const wb=Phaser.Utils.Objects.GetValue,Sb=Phaser.Utils.Objects.GetValue;var kb=function(t){return t.hasOwnProperty("geometryMask")?t.geometryMask:t.bitmapMask};const Ob=Phaser.Geom.Intersects.RectangleToRectangle,Pb=Phaser.Geom.Rectangle.Overlaps;var Tb=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}},_b=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},Mb=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))},Eb=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))},Rb=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 Lb=Phaser.Utils.Objects.GetValue,Db={update:0,everyTick:1};var Ab={setupChildrenMask(t){return!1===t||(this.setMaskUpdateMode(Lb(t,"updateMode",0)),this.enableChildrenMask(Lb(t,"padding",0)),this.setMaskLayer(Lb(t,"layer",void 0)),this.onMaskGameObjectVisible=Lb(t,"onVisivle"),this.onMaskGameObjectInvisible=Lb(t,"onInvisible"),this.maskGameObjectCallbackScope=Lb(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=Db[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=ol.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=kb(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(Ib.prototype,Bb);const Yb=["top","bottom","centerY","center"],Fb=["left","right","centerX","center"];var Xb=function(t,e,i){var s,r="Y"===(e=e.toUpperCase()),n=this.childrenMap.child;if(r){if(i)for(var a=0,o=Yb.length;a=0?0:Math.abs(l)<=Math.abs(d)?l:d}}else{if(i)for(a=0,o=Fb.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 Vb=Phaser.Utils.Objects.GetValue;class Gb extends Zf{constructor(t,e){void 0===e&&(e={});var i=Tg(e),s=Vb(e,"panel",void 0);void 0===s&&(s={}),s.scrollMode=i,s.clampChildOY=Vb(e,"clampChildOY",!1),s.clampChildOX=Vb(e,"clampChildOX",!1);var r,n,a=new Ib(t,s);switch(t.add.existing(a),i){case 0:r=Vb(e,"expand.panel",!0),n=!0;break;case 1:r=!0,n=Vb(e,"expand.panel",!0);break;default:r=!0,n=!0}e.type="rexScrollablePanel",e.child={gameObject:a,expandWidth:r,expandHeight:n,align:Vb(e,"align.panel","center")};var o=Vb(e,"space",void 0);o&&(o.child=Vb(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]),eh(this.childrenMap.child,t),this}}var Hb={scrollToChild:function(t,e){if(!this.hasChild(t))return this;switch(this.scrollMode){case 0:Xb.call(this,t,"y",e);break;case 1:Xb.call(this,t,"x",e);break;default:Xb.call(this,t,"y",e),Xb.call(this,t,"x",e)}return this}};Object.assign(Gb.prototype,Hb);var Ub={setBindingTarget(t){return this.childrenMap.panel.setBindingTarget(t),this}},Nb={getMaxInputRowTitleWidth(){return this.childrenMap.panel.getMaxInputRowTitleWidth()+this.getInnerPadding("left")},setInputRowTitleWidth(t){return t-=this.getInnerPadding("left"),this.childrenMap.panel.setInputRowTitleWidth(t),this}};class $b extends Gb{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($b.prototype,Ub,Nb);const Kb=Phaser.Utils.Objects.GetValue,Zb=Phaser.Utils.Objects.GetValue,Jb=Phaser.Utils.Objects.GetValue;var qb={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=Jb(t,"onGetValue"),this.onSetValue=Jb(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}},Qb={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)}}},tx={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 ex=Phaser.Utils.Objects.GetValue;class ix extends Rh{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=ex(e,"proportion.title",0),o=ex(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=ex(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(ix.prototype,qb,Qb,tx);var sx=function(t,e,i){var s=new bm(t,i);return t.add.existing(s),s},rx=function(t){return void 0===t&&(t=Rh),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}}},nx=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=cx(this.styles,"inputRow")||{},r=dx(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 zp(t,Am(e,i))}(this.scene,t,ux(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),px(this,je(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)):(Dx(this),Ax(this)),this}setNumberInput(){return this.onUpdateCallback=Lx,this}setSelectAllWhenFocusEnable(t){return void 0===t&&(t=!0),this.selectAllWhenFocus=t,this}setRequestCursorPosition(t){return this.isOpened?(this.requestCursorPosition=t,this):this}}const zx=Phaser.Utils.Objects.GetValue,Wx=["inputType","onOpen","clickOutSideTarget","onFocus","onClose","onBlur","onUpdate","enterClose","readOnly","maxLength","minLength","selectAll"];var Ix=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}Hx.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(Ux(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 Nx=new Hx,$x=/^[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,Kx=/\S/,Zx=new Hx;Zx.equals=function(t,e){return this.options.ignoreCase&&(t=t.toLowerCase(),e=e.toLowerCase()),t===e||this.options.ignoreWhitespace&&!Kx.test(t)&&!Kx.test(e)},Zx.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(tC(t,null,null,i),i," ")},Qx.equals=function(t,e){return Hx.prototype.equals.call(Qx,t.replace(/,([\r\n])/g,"$1"),e.replace(/,([\r\n])/g,"$1"))};const eC=new Hx;eC.tokenize=function(t){return t.slice()},eC.join=eC.removeEmpty=function(t){return t};const iC=Phaser.Utils.Array.Remove;var sC=function(t,e){var i=t.text;if(e!==i){if(null==i&&(i=""),iC(t.children,t.lastInsertCursor),""===e)t.removeChildren();else for(var s=(h=i,l=e,Nx.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},hC={cursorMoveLeft(){if(!this.isOpened)return this;var t=nC(this.cursorPosition-1,0,this.inputText.length);return this.setCursorPosition(t),this},cursorMoveRight(){if(!this.isOpened)return this;var t=nC(this.cursorPosition+1,0,this.inputText.length);return this.setCursorPosition(t),this},cursorMoveUp(){if(!this.isOpened)return this;var t=aC(this.characterCountOfLines,this.cursorPosition);t.lineIndex-=1;var e=nC(oC(this.characterCountOfLines,t),0,this.inputText.length);return this.setCursorPosition(e),this},cursorMoveDown(){if(!this.isOpened)return this;var t=aC(this.characterCountOfLines,this.cursorPosition);t.lineIndex+=1;var e=nC(oC(this.characterCountOfLines,t),0,this.inputText.length);return this.setCursorPosition(e),this}};const lC=Phaser.Utils.Objects.IsPlainObject;class dC extends Mc{constructor(t,e,i,s,r,n){lC(e)?n=e:lC(s)&&(n=s),void 0===n&&(n={}),function(t,e){var i=!e.textArea;if(Ix(e,"wrap.vAlign")||Ye(e,"wrap.vAlign",s=i?"center":"top"),Ix(e,"wrap.wrapMode")||Ye(e,"wrap.wrapMode","char"),Ix(e,"wrap.maxLines")||Ye(e,"wrap.maxLines",s=i?1:void 0),i&&Ye(e,"wrap.wrapWidth",1/0),Ix(e,"wrap.useDefaultTextHeight")||Ye(e,"wrap.useDefaultTextHeight",!0),e.edit||(e.edit={}),!Ix(e.edit,"inputType")){var s=i?"text":"textarea";Ye(e.edit,"inputType",s)}if(!0===e.clickOutSideTarget){var r=new Fx(t);t.add.existing(r),e.clickOutSideTarget=r}}(t,n);var a=n.text;a&&delete n.text;var o=nu(n.background,"focus"),h=nu(n.style,"cursor");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=zx(e,"edit");return void 0===i&&(i={}),bx(e,i,Wx),new jx(t,i)}(this,n),Xx.call(this),n.focusStyle&&Object.assign(o,n.focusStyle),Gx.call(this,o),n.cursorStyle&&Object.assign(h,n.cursorStyle),Vx.call(this,h);var l=n.onAddChar;l&&this.on("addchar",l);var d=n.onCursorOut;d&&this.on("cursorout",d);var c=n.onCursorIn;c&&this.on("cursorin",c);var u,p=n.onMoveCursor;p&&this.on("movecursor",p),this.setParseTextCallback(n.parseTextCallback),this.lastInsertCursor=((u=this.createCharChild("|")).text="",u),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=uC(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))}},vC={setText(t){return this.childrenMap.child.setText(t),this},appendText(t){return this.setText(this.text+t),this}},gC={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 fC=Phaser.Utils.Objects.GetValue;class mC extends Zf{constructor(t,e){void 0===e&&(e={});var i,s=fC(e,"text");Hi(s)?i=s:(void 0===s&&(s={}),s.textArea=!0,i=new dC(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=fC(e,"space",void 0);h&&(h.child=fC(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=fC(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(mC.prototype,vC,gC);var yC={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?je(e):{}:e||(e={});var s=new mC(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()}},bC={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=uC(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 xC=Phaser.Utils.Objects.GetValue,CC=Phaser.Math.Linear,wC=Phaser.Math.Snap.Floor;var SC={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=xC(s,r),a=function(t,e){var i=new xf(t,e);return t.add.existing(i),i}(i,s),o=e.defaultExpandWidth?2:0,h=xC(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=uC(i,d).setNumberInput();o=e.defaultExpandWidth?1:0,h=xC(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=CC(t.minValue,t.maxValue,a.value);t.step&&(e=wC(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))}},kC=function(t,e){var i=new gy(t,e);return t.add.existing(i),i};const OC=Phaser.Utils.Objects.GetValue;var PC={name:"RangeInput",accept:t=>!!t.hasOwnProperty("view")&&"incdec"===t.view,build(t,e){var i=t.scene;t.type="rexTweaker.IncDecInput";var s=OC(e,"incDec")||{},r={text:null,action:null},n=kC(i,{expand:!1}),a=e.defaultExpandWidth?1:0;t.add(n,{proportion:a,expand:!0});var o=e.inputNumber||e.inputText,h=uC(i,o).setNumberInput();h.on("close",(function(){t.setValue(h.value)}));var l=Object.assign(je(r),s.incButton||{}),d=lb(i,l),c=Object.assign(je(r),s.decButton||{}),u=lb(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 bw(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 Cw=Phaser.Utils.Objects.GetValue;var ww=function(t,e){var i=Cw(e,"expandDirection",void 0);"string"==typeof i&&(i=Sw[i]);var s,r,n,a,o,h,l,d=(n="alignTargetX",Ix(s=e,r="alignTarget")?F(s,r):n&&Ix(s,n)?F(s,n):a&&Ix(s,a)?F(s,a):o),c=Cw(e,"alignTargetY",d),u=Cw(e,"alignOffsetX",0),p=Cw(e,"alignOffsetY",0),v=Cw(e,"alignSide","").includes("right"),g=Cw(e,"bounds"),f=0===i,m=!(f||1===i),y=v?1:0,b=f||m?0:1;t.setOrigin(y,b),h=v?d.getTopRight().x:d.getTopLeft().x,l=c.getBottomLeft().y,t.setPosition(h+u,l+p);var x=g;x||(x=he(t.scene)),m&&t.getBottomLeft().y>x.bottom&&(l=c.getTopLeft().y,t.setOrigin(0,1).setPosition(h+u,l+p))};const Sw={down:0,up:1},kw=Phaser.Utils.Objects.GetValue;class Ow extends Na{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=function(t,e){Un(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 Gn(t,n):r.resetFromJSON(n),r.restart()}(t,e,"y","Linear")}),e.manualClose=!0,e.clickOutsideClose=!0,e.destroy=!0,super(t,e),ww(t,e),t.isRexSizer&&t.layout();var i=kw(e,"touchOutsideClose",!1),s=kw(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&&T(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 Pw={openColorPicker:function(){if(!this.colorPicker){var t=xw.call(this).layout(),e=new Ow(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(Pw,YC);const Tw=Phaser.Utils.Objects.GetValue;class _w extends IC{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(Tw(i,"width",160),Tw(i,"height",170));var n=Tw(i,"background");r=n?function(t){return zp(t,n)}:Tw(i,"createBackgroundCallback"),this.setCreateColorPickerBackgroundCallback(r),this.setColorPickerHPalettePosition(Tw(i,"hPalettePosition",0)),this.setColorPickerExpandDirection(Tw(i,"expandDirection")),this.setColorPickerEaseInDuration(Tw(i,"easeIn",200)),this.setColorPickerEaseOutDuration(Tw(i,"easeOut",200)),this.setColorPickerTransitInCallback(Tw(i,"transitIn")),this.setColorPickerTransitOutCallback(Tw(i,"transitOut")),this.setColorPickerBounds(Tw(i,"bounds"));var a=Tw(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(Tw(o,"height",30)),this.setColorComponentsFormatLabelConfig(Tw(o,"formatLabel"));var h=Tw(o,"inputText");h||(h=Tw(e,"inputText")),this.setColorComponentsInputTextConfig(h);var l=Tw(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(_w.prototype,Pw);var Mw={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?je(e):{}:e||(e={});var s=new _w(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)}},Ew={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}},Rw={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}},Lw={buildShapes(){this.addShape((new ep).setName("box")).addShape((new Qu).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,v=1*p,g=2*p,f=3*p;l.startAt(v,g).lineTo(g,f).lineTo(f,v).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)}},Dw={setCheckerAnimationDuration(t){return void 0===t&&(t=0),this.checkerAnimDuration=t,this},playCheckerAnimation(){return void 0===this.checkerAnimProgressTask&&(this.checkerAnimProgressTask=new Ma(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}},Aw={};Object.assign(Aw,Ew,Rw,Lw,Dw);const Bw=23730,jw=Phaser.Utils.Objects.GetValue,zw=Phaser.Utils.Objects.IsPlainObject;class Ww extends bu{constructor(t,e,i,s,r,n,a){zw(e)?(e=jw(a=e,"x",0),i=jw(a,"y",0),s=jw(a,"width",2),r=jw(a,"height",2),n=jw(a,"color",Bw)):zw(n)&&(n=jw(a=n,"color",Bw)),super(t,e,i,s,r),this.type="rexCheckbox",void 0===n&&(n=Bw),this.setBoxShape(jw(a,"circleBox",!1)),this.setBoxFillStyle(n,jw(a,"boxFillAlpha",1)),this.setUncheckedBoxFillStyle(jw(a,"uncheckedColor",null),jw(a,"uncheckedBoxFillAlpha",1)),this.setBoxStrokeStyle(jw(a,"boxLineWidth",4),jw(a,"boxStrokeColor",n),jw(a,"boxStrokeAlpha",1)),this.setUncheckedBoxStrokeStyle(this.boxLineWidth,jw(a,"uncheckedBoxStrokeColor",this.boxStrokeColor),jw(a,"uncheckedBoxStrokeAlpha",this.boxStrokeAlpha)),this.setCheckerStyle(jw(a,"checkerColor",16777215),jw(a,"checkerAlpha",1)),this.setBoxSize(jw(a,"boxSize",1)),this.setCheckerSize(jw(a,"checkerSize",1)),this.setCheckerAnimationDuration(jw(a,"animationDuration",150)),this.buildShapes();var o=jw(a,"checked");void 0===o&&(o=jw(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(Ww.prototype,Aw);const Iw=Phaser.Utils.Objects.GetValue,Yw=Phaser.Utils.Objects.IsPlainObject;class Fw extends Ww{constructor(t,e,i,s,r,n,a){Yw(e)?(e=Iw(a=e,"x",0),i=Iw(a,"y",0),s=Iw(a,"width",2),r=Iw(a,"height",2),n=Iw(a,"color",Bw)):Yw(n)&&(n=Iw(a=n,"color",Bw)),super(t,e,i,s,r,n,a),this._click=new bo(this,Iw(a,"click")),this._click.on("click",(function(){this.toggleValue()}),this),this.setReadOnly(Iw(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 Xw={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 Fw(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)}},Vw={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}},Gw={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}},Hw={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}},Uw=function(t,e,i){return(e-t)*i+t};const Nw=Phaser.Math.Linear;var $w={buildShapes(){this.addShape((new ep).setName("track")).addShape((new ep).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&Uw(Vs(l),Vs(d),c))<<16|(255&Uw(Gs(l),Gs(d),c))<<8|255&Uw(Hs(l),Hs(d),c)),p=Nw(this.falseValueTrackFillAlpha,this.trackFillAlpha,i);s.fillStyle(u,p);var v=this.getShape("thumb");if(this.isSizeChanged){var g=t*this.thumbWidth,f=e*this.thumbHeight,m=e*this.thumbRadius;v.setSize(g,f).setRadius(m)}var y=Nw(this.thumbLeftX,this.thumbRightX,i)*t;this.rtl&&(y=t-y);var b=e/2;v.setCenterPosition(y,b),v.fillStyle(this.thumbColor,this.thumbAlpha)}},Kw={setToggleAnimationDuration(t){return void 0===t&&(t=0),this.toggleAnimDuration=t,this},playToggleAnimation(){return void 0===this.toggleAnimProgressTask&&(this.toggleAnimProgressTask=new Ma(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}},Zw={};Object.assign(Zw,Vw,Gw,Hw,$w,Kw);const Jw=Phaser.Utils.Objects.GetValue,qw=Phaser.Utils.Objects.IsPlainObject,Qw=23730;class tS extends bu{constructor(t,e,i,s,r,n,a){qw(e)?(e=Jw(a=e,"x",0),i=Jw(a,"y",0),s=Jw(a,"width",2),r=Jw(a,"height",2),n=Jw(a,"color",Qw)):qw(n)&&(n=Jw(a=n,"color",Qw)),super(t,e,i,s,r),this.type="rexToggleSwitch",void 0===n&&(n=Qw),this.setTrackFillStyle(n,Jw(a,"trackFillAlpha",1)),this.setFalseValueTrackFillStyle(Jw(a,"falseValueTrackColor",function(t){var e=.3*Vs(t)+.59*Gs(t)+.11*Hs(t);return(255&e)<<16|(255&e)<<8|255&e}(n)),Jw(a,"falseValueTrackFillAlpha",1)),this.setThumbStyle(Jw(a,"thumbColor",16777215),Jw(a,"thumbAlpha",1)),this.setTrackSize(Jw(a,"trackWidth",.9),Jw(a,"trackHeight",.5)),this.setTrackRadius(Jw(a,"trackRadius",.5*this.trackHeight));var o=Jw(a,"thumbHeight",void 0),h=Jw(a,"thumbWidth",o);void 0===h&&(h=.9*this.trackHeight),this.setThumbSize(h,o),this.setThumbRadius(Jw(a,"thumbRadius",.5*this.thumbHeight)),this.setThumbPosition(Jw(a,"thumbLeft",.3),Jw(a,"thumbRight",void 0)),this.setRTL(Jw(a,"rtl",!1)),this.setToggleAnimationDuration(Jw(a,"animationDuration",150)),this.buildShapes(),this.setValue(Jw(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(tS.prototype,Zw);const eS=Phaser.Utils.Objects.GetValue;class iS extends tS{constructor(t,e,i,s,r,n,a){super(t,e,i,s,r,n,a),this._click=new bo(this,eS(a,"click")),this._click.on("click",(function(){this.toggleValue()}),this),this.setReadOnly(eS(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 sS={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 iS(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)}},rS={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=nS[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 nS={down:0,up:1},aS=Phaser.Utils.Objects.GetValue;var oS=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=hS(e,u),this.listMaxHeight>0&&(s.layout(),s.height<=this.listMaxHeight&&(d=s)),!d){0===c&&(c=this.listMaxHeight);var p=lS(e,this.listCreateSliderTrackCallback),v=lS(e,this.listCreateSliderThumbCallback);d=new Gb(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:aS(this.listSpace,"panel",0)}}),e.add.existing(d)}}else u.height=c,s=hS(e,u),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},hS=function(t,e,i){var s;return i?(e.orientation="x",s=new ky(t,e)):(e.orientation="y",s=new gy(t,e)),t.add.existing(s),s},lS=function(t,e,i){var s;return e&&(s=e.call(i,t),t.add.existing(s)),s},dS={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}},cS={openListPanel:function(){if(this.listPanel)return this;if(0===this.options.length)return this;var t,e=oS.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 Ow(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(cS,rS,dS);const uS=Phaser.Utils.Objects.GetValue;class pS 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(uS(e,"options"));var i=uS(e,"list");this.setWrapEnable(uS(i,"wrap",!1)),this.setCreateButtonCallback(uS(i,"createButtonCallback")),this.setCreateListBackgroundCallback(uS(i,"createBackgroundCallback")),this.setCreateListSliderTrackCallback(uS(i,"createTrackCallback")),this.setCreateListSliderThumbCallback(uS(i,"createThumbCallback")),this.setListSliderAdaptThumbSizeEnable(uS(i,"sliderAdaptThumbSize",!1)),this.setListScrollerConfig(uS(i,"scroller")),this.setListMouseWheelScrollerConfig(uS(i,"mouseWheelScroller")),this.setButtonClickCallback(uS(i,"onButtonClick")),this.setButtonOverCallback(uS(i,"onButtonOver")),this.setButtonOutCallback(uS(i,"onButtonOut")),this.setListExpandDirection(uS(i,"expandDirection")),this.setListEaseInDuration(uS(i,"easeIn",500)),this.setListEaseOutDuration(uS(i,"easeOut",100)),this.setListTransitInCallback(uS(i,"transitIn")),this.settListTransitOutCallback(uS(i,"transitOut")),this.setListMaxHeight(uS(i,"maxHeight",0)),this.setListSize(uS(i,"width"),uS(i,"height",0)),this.setListAlignmentMode(uS(i,"alignParent","text")),this.setListAlignmentSide(uS(i,"alignSide","")),this.setListBounds(uS(i,"bounds")),this.setListSpace(uS(i,"space")),this.setListDraggable(uS(i,"draggable",!1)),this.setValueChangeCallback(uS(e,"setValueCallback"),uS(e,"setValueCallbackScope")),this.setValue(uS(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(pS.prototype,cS);var vS=function(t,e){e=function(t,e,i){void 0===i&&(i={});var s=(e=e?je(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=ym(t,s,n);o.list=e.list||{},o.list.createButtonCallback=function(t,e){var i=lb(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 zp(t,h)},delete e.track);var l=e.thumb;return l&&(o.list.createThumbCallback=function(t){return zp(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 pS(t,e);return t.add.existing(i),i},gS=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=vS(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=gS(t,e);if(null!=i)return t[i]}(i.options,e);i.resetDisplayContent(s).setMinSize(i.width,i.height).layout().setMinSize(0,0)}};const mS=Phaser.Utils.Objects.GetValue;var yS={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?je(e.button):{},r=mS(s,"expand",!0);r&&(s.align="center"),delete s.expand;var n=kC(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--)ty.call(this,e[i],t);return this}},iy=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)}},sy=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,iy.call(e,t,i,s)}},enumerable:!0,configurable:!0}),t.selected=!1},ry={add(t){return this.buttons.push(t),t._click||(t._click=new bo(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`),sy.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&&fy.addNewLine(this)}else for(n=0,a=t.length;n=0;i--)Cy.call(this,e[i],t);return this}};const Sy=Phaser.Utils.Objects.GetValue;class ky extends $h{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 cy({parent:this,eventEmitter:Sy(e,"eventEmitter",this),groupName:Sy(e,"groupName",void 0),clickConfig:Sy(e,"click",void 0)}).setButtonsType(e);var s=Sy(e,"background",void 0),r=Sy(e,"buttons",void 0);this.buttonsAlign=Sy(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(ky.prototype,yy,wy,dy,py);var Oy=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=Py[i])}void 0===s?s={}:!0===s&&(s=Ty);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 Py={fit:0,FIT:0,envelop:1,ENVELOP:1};var Ty={},_y={},My={};const Ey=Phaser.Utils.Objects.IsPlainObject,Ry=Phaser.Utils.Objects.GetValue,Ly=Phaser.Display.Align.CENTER,Dy=Phaser.Utils.String.UUID;var Ay={add:function(t,e,i,s,r,n,a,o,h,l){ln.call(this,t),Ey(e)&&(e=Ry(d=e,"key",void 0),i=Ry(d,"align",Ly),s=Ry(d,"padding",0),r=Ry(d,"expand",!0),t.isRexSizer||(n=Ry(d,"minWidth",t._minWidth),a=Ry(d,"minHeight",t._minHeighted)),o=Ry(d,"offsetX",0),h=Ry(d,"offsetY",0),l=Ry(d,"aspectRatio",0));var d,c=void 0!==e;return c||(e=Dy()),"string"==typeof i&&(i=Mr[i]),void 0===i&&(i=Ly),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===l?l=0:!0===l&&(l=p(t)/v(t)),l>0&&(r=!0,void 0===n&&(n=0),void 0===a&&(a=0)),(d=this.getSizerConfig(t)).align=i,d.padding=on(s),Ey(r)?(d.expandWidth=Ry(r,"width",!1),d.expandHeight=Ry(r,"height",!1)):(d.expandWidth=r,d.expandHeight=r),t.isRexSizer||(d.expandWidth&&(t.minWidth=void 0===n?p(t):n),d.expandHeight&&(t.minHeight=void 0===a?v(t):a)),d.alignOffsetX=o,d.alignOffsetY=h,d.aspectRatio=l,this.sizerChildren.hasOwnProperty(e)&&this.sizerChildren[e].destroy(),this.sizerChildren[e]=t,c&&this.addChildrenMap(e,t),this}},By={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]),fn.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}},jy={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=this.innerLeft,c=this.innerTop,u=this.innerWidth,p=this.innerHeight,v=this.sizerChildren;for(var g in v)(t=v[g]).rexSizer.hidden||(i=(e=t.rexSizer).padding,vo.call(this,t),o=this.getExpandedChildWidth(t),h=this.getExpandedChildHeight(t),e.aspectRatio>0&&(_y.width=e.aspectRatio,_y.height=1,My.width=o,My.height=h,o=(l=Oy(_y,My,"FIT",!0)).width,h=l.height),t.isRexSizer?(t.runLayout(this,o,h),nh(t,this)):An(t,o,h),s=d+i.left*this.scaleX,n=u-(i.left+i.right)*this.scaleX,r=c+i.top*this.scaleY,a=p-(i.top+i.bottom)*this.scaleY,go.call(this,t,s,r,n,a,e.align,e.alignOffsetX,e.alignOffsetY))}};Object.assign(jy,Ay,By);const zy=Phaser.Utils.Objects.IsPlainObject,Wy=Phaser.Utils.Objects.GetValue;class Iy extends rh{constructor(t,e,i,s,r,n){zy(e)?(e=Wy(n=e,"x",0),i=Wy(n,"y",0),s=Wy(n,"width",void 0),r=Wy(n,"height",void 0)):zy(s)&&(s=Wy(n=s,"width",void 0),r=Wy(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(Iy.prototype,jy);const Yy=Iy.prototype.add;var Fy=function(t,e,i,s,r,n,a,o,h){return t.setVisible(!1),Yy.call(this,t,e,i,s,r,n,a,o,h),this},Xy={add:Fy,addPage:Fy};const Vy=is.prototype.setChildVisible;var Gy={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?(Vy.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&&(Vy.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(Gy,Xy);const Hy=Phaser.Utils.Objects.GetValue;class Uy extends Iy{constructor(t,e){super(t,e),this.type="rexPages",this.childrenMap=this.sizerChildren,this._previousKey=void 0,this._currentKey=void 0,this.setSwapMode(Hy(e,"swapMode",0)),this.setFadeInDuration(Hy(e,"fadeIn",0))}setSwapMode(t){return"string"==typeof t&&(t=Ny[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(Uy.prototype,Gy);const Ny={invisible:0,destroy:1},$y=Phaser.Utils.Objects.IsPlainObject,Ky=Phaser.Utils.Objects.GetValue,Zy=Phaser.Utils.String.UUID;var Jy={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}},qy={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}},Qy={top:1,left:3,right:5,bottom:7},tb={top:"bottom",left:"right",right:"left",bottom:"top"},eb={setTabsPadding(t,e){return this.childrenMap.tabs.setOuterPadding(t,e),this},getTabsPadding(t){return this.childrenMap.tabs.getOuterPadding(t)}},ib={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 xb=Phaser.Utils.Objects.GetValue;class Cb extends Rh{constructor(t,e){void 0===e&&(e={}),e.orientation="y",super(t,e),this.type="rexTweaker.Wrap";var i=xb(e,"background",void 0),s=xb(e,"title",void 0);i&&this.addBackground(i),s&&this.add(s,{expand:!0,space:{bottom:xb(e,"space.title",0)}});var r=xb(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(Cb.prototype,yb,bb);const wb=Phaser.Utils.Objects.GetValue,Sb=Phaser.Utils.Objects.GetValue;var kb=function(t){return t.hasOwnProperty("geometryMask")?t.geometryMask:t.bitmapMask};const Ob=Phaser.Geom.Intersects.RectangleToRectangle,Pb=Phaser.Geom.Rectangle.Overlaps;var Tb=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}},_b=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},Mb=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))},Eb=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))},Rb=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 Lb=Phaser.Utils.Objects.GetValue,Db={update:0,everyTick:1};var Ab={setupChildrenMask(t){return!1===t||(this.setMaskUpdateMode(Lb(t,"updateMode",0)),this.enableChildrenMask(Lb(t,"padding",0)),this.setMaskLayer(Lb(t,"layer",void 0)),this.onMaskGameObjectVisible=Lb(t,"onVisivle"),this.onMaskGameObjectInvisible=Lb(t,"onInvisible"),this.maskGameObjectCallbackScope=Lb(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=Db[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=ol.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=kb(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(Ib.prototype,Bb);const Yb=["top","bottom","centerY","center"],Fb=["left","right","centerX","center"];var Xb=function(t,e,i){var s,r="Y"===(e=e.toUpperCase()),n=this.childrenMap.child;if(r){if(i)for(var a=0,o=Yb.length;a=0?0:Math.abs(l)<=Math.abs(d)?l:d}}else{if(i)for(a=0,o=Fb.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 Vb=Phaser.Utils.Objects.GetValue;class Gb extends Zf{constructor(t,e){void 0===e&&(e={});var i=Tg(e),s=Vb(e,"panel",void 0);void 0===s&&(s={}),s.scrollMode=i,s.clampChildOY=Vb(e,"clampChildOY",!1),s.clampChildOX=Vb(e,"clampChildOX",!1);var r,n,a=new Ib(t,s);switch(t.add.existing(a),i){case 0:r=Vb(e,"expand.panel",!0),n=!0;break;case 1:r=!0,n=Vb(e,"expand.panel",!0);break;default:r=!0,n=!0}e.type="rexScrollablePanel",e.child={gameObject:a,expandWidth:r,expandHeight:n,align:Vb(e,"align.panel","center")};var o=Vb(e,"space",void 0);o&&(o.child=Vb(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]),eh(this.childrenMap.child,t),this}}var Hb={scrollToChild:function(t,e){if(!this.hasChild(t))return this;switch(this.scrollMode){case 0:Xb.call(this,t,"y",e);break;case 1:Xb.call(this,t,"x",e);break;default:Xb.call(this,t,"y",e),Xb.call(this,t,"x",e)}return this}};Object.assign(Gb.prototype,Hb);var Ub={setBindingTarget(t){return this.childrenMap.panel.setBindingTarget(t),this}},Nb={getMaxInputRowTitleWidth(){return this.childrenMap.panel.getMaxInputRowTitleWidth()+this.getInnerPadding("left")},setInputRowTitleWidth(t){return t-=this.getInnerPadding("left"),this.childrenMap.panel.setInputRowTitleWidth(t),this}};class $b extends Gb{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($b.prototype,Ub,Nb);const Kb=Phaser.Utils.Objects.GetValue,Zb=Phaser.Utils.Objects.GetValue,Jb=Phaser.Utils.Objects.GetValue;var qb={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=Jb(t,"onGetValue"),this.onSetValue=Jb(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}},Qb={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)}}},tx={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 ex=Phaser.Utils.Objects.GetValue;class ix extends Rh{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=ex(e,"proportion.title",0),o=ex(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=ex(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(ix.prototype,qb,Qb,tx);var sx=function(t,e,i){var s=new bm(t,i);return t.add.existing(s),s},rx=function(t){return void 0===t&&(t=Rh),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}}},nx=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=cx(this.styles,"inputRow")||{},r=dx(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 zp(t,Am(e,i))}(this.scene,t,ux(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),px(this,je(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)):(Dx(this),Ax(this)),this}setNumberInput(){return this.onUpdateCallback=Lx,this}setSelectAllWhenFocusEnable(t){return void 0===t&&(t=!0),this.selectAllWhenFocus=t,this}setRequestCursorPosition(t){return this.isOpened?(this.requestCursorPosition=t,this):this}}const zx=Phaser.Utils.Objects.GetValue,Wx=["inputType","onOpen","clickOutSideTarget","onFocus","onClose","onBlur","onUpdate","enterClose","readOnly","maxLength","minLength","selectAll"];var Ix=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}Hx.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(Ux(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 Nx=new Hx,$x=/^[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,Kx=/\S/,Zx=new Hx;Zx.equals=function(t,e){return this.options.ignoreCase&&(t=t.toLowerCase(),e=e.toLowerCase()),t===e||this.options.ignoreWhitespace&&!Kx.test(t)&&!Kx.test(e)},Zx.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(tC(t,null,null,i),i," ")},Qx.equals=function(t,e){return Hx.prototype.equals.call(Qx,t.replace(/,([\r\n])/g,"$1"),e.replace(/,([\r\n])/g,"$1"))};const eC=new Hx;eC.tokenize=function(t){return t.slice()},eC.join=eC.removeEmpty=function(t){return t};const iC=Phaser.Utils.Array.Remove;var sC=function(t,e){var i=t.text;if(e!==i){if(null==i&&(i=""),iC(t.children,t.lastInsertCursor),""===e)t.removeChildren();else for(var s=(h=i,l=e,Nx.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},hC={cursorMoveLeft(){if(!this.isOpened)return this;var t=nC(this.cursorPosition-1,0,this.inputText.length);return this.setCursorPosition(t),this},cursorMoveRight(){if(!this.isOpened)return this;var t=nC(this.cursorPosition+1,0,this.inputText.length);return this.setCursorPosition(t),this},cursorMoveUp(){if(!this.isOpened)return this;var t=aC(this.characterCountOfLines,this.cursorPosition);t.lineIndex-=1;var e=nC(oC(this.characterCountOfLines,t),0,this.inputText.length);return this.setCursorPosition(e),this},cursorMoveDown(){if(!this.isOpened)return this;var t=aC(this.characterCountOfLines,this.cursorPosition);t.lineIndex+=1;var e=nC(oC(this.characterCountOfLines,t),0,this.inputText.length);return this.setCursorPosition(e),this}};const lC=Phaser.Utils.Objects.IsPlainObject;class dC extends Mc{constructor(t,e,i,s,r,n){lC(e)?n=e:lC(s)&&(n=s),void 0===n&&(n={}),function(t,e){var i=!e.textArea;if(Ix(e,"wrap.vAlign")||Ye(e,"wrap.vAlign",s=i?"center":"top"),Ix(e,"wrap.wrapMode")||Ye(e,"wrap.wrapMode","char"),Ix(e,"wrap.maxLines")||Ye(e,"wrap.maxLines",s=i?1:void 0),i&&Ye(e,"wrap.wrapWidth",1/0),Ix(e,"wrap.useDefaultTextHeight")||Ye(e,"wrap.useDefaultTextHeight",!0),e.edit||(e.edit={}),!Ix(e.edit,"inputType")){var s=i?"text":"textarea";Ye(e.edit,"inputType",s)}if(!0===e.clickOutSideTarget){var r=new Fx(t);t.add.existing(r),e.clickOutSideTarget=r}}(t,n);var a=n.text;a&&delete n.text;var o=nu(n.background,"focus"),h=nu(n.style,"cursor");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=zx(e,"edit");return void 0===i&&(i={}),bx(e,i,Wx),new jx(t,i)}(this,n),Xx.call(this),n.focusStyle&&Object.assign(o,n.focusStyle),Gx.call(this,o),n.cursorStyle&&Object.assign(h,n.cursorStyle),Vx.call(this,h);var l=n.onAddChar;l&&this.on("addchar",l);var d=n.onCursorOut;d&&this.on("cursorout",d);var c=n.onCursorIn;c&&this.on("cursorin",c);var u,p=n.onMoveCursor;p&&this.on("movecursor",p),this.setParseTextCallback(n.parseTextCallback),this.lastInsertCursor=((u=this.createCharChild("|")).text="",u),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=uC(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))}},vC={setText(t){return this.childrenMap.child.setText(t),this},appendText(t){return this.setText(this.text+t),this}},gC={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 fC=Phaser.Utils.Objects.GetValue;class mC extends Zf{constructor(t,e){void 0===e&&(e={});var i,s=fC(e,"text");Hi(s)?i=s:(void 0===s&&(s={}),s.textArea=!0,i=new dC(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=fC(e,"space",void 0);h&&(h.child=fC(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=fC(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(mC.prototype,vC,gC);var yC={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?je(e):{}:e||(e={});var s=new mC(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()}},bC={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=uC(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 xC=Phaser.Utils.Objects.GetValue,CC=Phaser.Math.Linear,wC=Phaser.Math.Snap.Floor;var SC={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=xC(s,r),a=function(t,e){var i=new xf(t,e);return t.add.existing(i),i}(i,s),o=e.defaultExpandWidth?2:0,h=xC(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=uC(i,d).setNumberInput();o=e.defaultExpandWidth?1:0,h=xC(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=CC(t.minValue,t.maxValue,a.value);t.step&&(e=wC(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))}},kC=function(t,e){var i=new gy(t,e);return t.add.existing(i),i};const OC=Phaser.Utils.Objects.GetValue;var PC={name:"RangeInput",accept:t=>!!t.hasOwnProperty("view")&&"incdec"===t.view,build(t,e){var i=t.scene;t.type="rexTweaker.IncDecInput";var s=OC(e,"incDec")||{},r={text:null,action:null},n=kC(i,{expand:!1}),a=e.defaultExpandWidth?1:0;t.add(n,{proportion:a,expand:!0});var o=e.inputNumber||e.inputText,h=uC(i,o).setNumberInput();h.on("close",(function(){t.setValue(h.value)}));var l=Object.assign(je(r),s.incButton||{}),d=lb(i,l),c=Object.assign(je(r),s.decButton||{}),u=lb(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 bw(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 Cw=Phaser.Utils.Objects.GetValue;var ww=function(t,e){var i=Cw(e,"expandDirection",void 0);"string"==typeof i&&(i=Sw[i]);var s,r,n,a,o,h,l,d=(n="alignTargetX",Ix(s=e,r="alignTarget")?F(s,r):n&&Ix(s,n)?F(s,n):a&&Ix(s,a)?F(s,a):o),c=Cw(e,"alignTargetY",d),u=Cw(e,"alignOffsetX",0),p=Cw(e,"alignOffsetY",0),v=Cw(e,"alignSide","").includes("right"),g=Cw(e,"bounds"),f=0===i,m=!(f||1===i),y=v?1:0,b=f||m?0:1;t.setOrigin(y,b),h=v?d.getTopRight().x:d.getTopLeft().x,l=c.getBottomLeft().y,t.setPosition(h+u,l+p);var x=g;x||(x=he(t.scene)),m&&t.getBottomLeft().y>x.bottom&&(l=c.getTopLeft().y,t.setOrigin(0,1).setPosition(h+u,l+p))};const Sw={down:0,up:1},kw=Phaser.Utils.Objects.GetValue;class Ow extends Na{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=function(t,e){Un(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 Gn(t,n):r.resetFromJSON(n),r.restart()}(t,e,"y","Linear")}),e.manualClose=!0,e.clickOutsideClose=!0,e.destroy=!0,super(t,e),ww(t,e),t.isRexSizer&&t.layout();var i=kw(e,"touchOutsideClose",!1),s=kw(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&&T(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 Pw={openColorPicker:function(){if(!this.colorPicker){var t=xw.call(this).layout(),e=new Ow(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(Pw,YC);const Tw=Phaser.Utils.Objects.GetValue;class _w extends IC{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(Tw(i,"width",160),Tw(i,"height",170));var n=Tw(i,"background");r=n?function(t){return zp(t,n)}:Tw(i,"createBackgroundCallback"),this.setCreateColorPickerBackgroundCallback(r),this.setColorPickerHPalettePosition(Tw(i,"hPalettePosition",0)),this.setColorPickerExpandDirection(Tw(i,"expandDirection")),this.setColorPickerEaseInDuration(Tw(i,"easeIn",200)),this.setColorPickerEaseOutDuration(Tw(i,"easeOut",200)),this.setColorPickerTransitInCallback(Tw(i,"transitIn")),this.setColorPickerTransitOutCallback(Tw(i,"transitOut")),this.setColorPickerBounds(Tw(i,"bounds"));var a=Tw(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(Tw(o,"height",30)),this.setColorComponentsFormatLabelConfig(Tw(o,"formatLabel"));var h=Tw(o,"inputText");h||(h=Tw(e,"inputText")),this.setColorComponentsInputTextConfig(h);var l=Tw(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(_w.prototype,Pw);var Mw={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?je(e):{}:e||(e={});var s=new _w(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)}},Ew={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}},Rw={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}},Lw={buildShapes(){this.addShape((new ep).setName("box")).addShape((new Qu).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,v=1*p,g=2*p,f=3*p;l.startAt(v,g).lineTo(g,f).lineTo(f,v).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)}},Dw={setCheckerAnimationDuration(t){return void 0===t&&(t=0),this.checkerAnimDuration=t,this},playCheckerAnimation(){return void 0===this.checkerAnimProgressTask&&(this.checkerAnimProgressTask=new Ma(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}},Aw={};Object.assign(Aw,Ew,Rw,Lw,Dw);const Bw=23730,jw=Phaser.Utils.Objects.GetValue,zw=Phaser.Utils.Objects.IsPlainObject;class Ww extends bu{constructor(t,e,i,s,r,n,a){zw(e)?(e=jw(a=e,"x",0),i=jw(a,"y",0),s=jw(a,"width",2),r=jw(a,"height",2),n=jw(a,"color",Bw)):zw(n)&&(n=jw(a=n,"color",Bw)),super(t,e,i,s,r),this.type="rexCheckbox",void 0===n&&(n=Bw),this.setBoxShape(jw(a,"circleBox",!1)),this.setBoxFillStyle(n,jw(a,"boxFillAlpha",1)),this.setUncheckedBoxFillStyle(jw(a,"uncheckedColor",null),jw(a,"uncheckedBoxFillAlpha",1)),this.setBoxStrokeStyle(jw(a,"boxLineWidth",4),jw(a,"boxStrokeColor",n),jw(a,"boxStrokeAlpha",1)),this.setUncheckedBoxStrokeStyle(this.boxLineWidth,jw(a,"uncheckedBoxStrokeColor",this.boxStrokeColor),jw(a,"uncheckedBoxStrokeAlpha",this.boxStrokeAlpha)),this.setCheckerStyle(jw(a,"checkerColor",16777215),jw(a,"checkerAlpha",1)),this.setBoxSize(jw(a,"boxSize",1)),this.setCheckerSize(jw(a,"checkerSize",1)),this.setCheckerAnimationDuration(jw(a,"animationDuration",150)),this.buildShapes();var o=jw(a,"checked");void 0===o&&(o=jw(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(Ww.prototype,Aw);const Iw=Phaser.Utils.Objects.GetValue,Yw=Phaser.Utils.Objects.IsPlainObject;class Fw extends Ww{constructor(t,e,i,s,r,n,a){Yw(e)?(e=Iw(a=e,"x",0),i=Iw(a,"y",0),s=Iw(a,"width",2),r=Iw(a,"height",2),n=Iw(a,"color",Bw)):Yw(n)&&(n=Iw(a=n,"color",Bw)),super(t,e,i,s,r,n,a),this._click=new bo(this,Iw(a,"click")),this._click.on("click",(function(){this.toggleValue()}),this),this.setReadOnly(Iw(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 Xw={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 Fw(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)}},Vw={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}},Gw={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}},Hw={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}},Uw=function(t,e,i){return(e-t)*i+t};const Nw=Phaser.Math.Linear;var $w={buildShapes(){this.addShape((new ep).setName("track")).addShape((new ep).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&Uw(Vs(l),Vs(d),c))<<16|(255&Uw(Gs(l),Gs(d),c))<<8|255&Uw(Hs(l),Hs(d),c)),p=Nw(this.falseValueTrackFillAlpha,this.trackFillAlpha,i);s.fillStyle(u,p);var v=this.getShape("thumb");if(this.isSizeChanged){var g=t*this.thumbWidth,f=e*this.thumbHeight,m=e*this.thumbRadius;v.setSize(g,f).setRadius(m)}var y=Nw(this.thumbLeftX,this.thumbRightX,i)*t;this.rtl&&(y=t-y);var b=e/2;v.setCenterPosition(y,b),v.fillStyle(this.thumbColor,this.thumbAlpha)}},Kw={setToggleAnimationDuration(t){return void 0===t&&(t=0),this.toggleAnimDuration=t,this},playToggleAnimation(){return void 0===this.toggleAnimProgressTask&&(this.toggleAnimProgressTask=new Ma(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}},Zw={};Object.assign(Zw,Vw,Gw,Hw,$w,Kw);const Jw=Phaser.Utils.Objects.GetValue,qw=Phaser.Utils.Objects.IsPlainObject,Qw=23730;class tS extends bu{constructor(t,e,i,s,r,n,a){qw(e)?(e=Jw(a=e,"x",0),i=Jw(a,"y",0),s=Jw(a,"width",2),r=Jw(a,"height",2),n=Jw(a,"color",Qw)):qw(n)&&(n=Jw(a=n,"color",Qw)),super(t,e,i,s,r),this.type="rexToggleSwitch",void 0===n&&(n=Qw),this.setTrackFillStyle(n,Jw(a,"trackFillAlpha",1)),this.setFalseValueTrackFillStyle(Jw(a,"falseValueTrackColor",function(t){var e=.3*Vs(t)+.59*Gs(t)+.11*Hs(t);return(255&e)<<16|(255&e)<<8|255&e}(n)),Jw(a,"falseValueTrackFillAlpha",1)),this.setThumbStyle(Jw(a,"thumbColor",16777215),Jw(a,"thumbAlpha",1)),this.setTrackSize(Jw(a,"trackWidth",.9),Jw(a,"trackHeight",.5)),this.setTrackRadius(Jw(a,"trackRadius",.5*this.trackHeight));var o=Jw(a,"thumbHeight",void 0),h=Jw(a,"thumbWidth",o);void 0===h&&(h=.9*this.trackHeight),this.setThumbSize(h,o),this.setThumbRadius(Jw(a,"thumbRadius",.5*this.thumbHeight)),this.setThumbPosition(Jw(a,"thumbLeft",.3),Jw(a,"thumbRight",void 0)),this.setRTL(Jw(a,"rtl",!1)),this.setToggleAnimationDuration(Jw(a,"animationDuration",150)),this.buildShapes(),this.setValue(Jw(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(tS.prototype,Zw);const eS=Phaser.Utils.Objects.GetValue;class iS extends tS{constructor(t,e,i,s,r,n,a){super(t,e,i,s,r,n,a),this._click=new bo(this,eS(a,"click")),this._click.on("click",(function(){this.toggleValue()}),this),this.setReadOnly(eS(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 sS={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 iS(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)}},rS={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=nS[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 nS={down:0,up:1},aS=Phaser.Utils.Objects.GetValue;var oS=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=hS(e,u),this.listMaxHeight>0&&(s.layout(),s.height<=this.listMaxHeight&&(d=s)),!d){0===c&&(c=this.listMaxHeight);var p=lS(e,this.listCreateSliderTrackCallback),v=lS(e,this.listCreateSliderThumbCallback);d=new Gb(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:aS(this.listSpace,"panel",0)}}),e.add.existing(d)}}else u.height=c,s=hS(e,u),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},hS=function(t,e,i){var s;return i?(e.orientation="x",s=new ky(t,e)):(e.orientation="y",s=new gy(t,e)),t.add.existing(s),s},lS=function(t,e,i){var s;return e&&(s=e.call(i,t),t.add.existing(s)),s},dS={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}},cS={openListPanel:function(){if(this.listPanel)return this;if(0===this.options.length)return this;var t,e=oS.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 Ow(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(cS,rS,dS);const uS=Phaser.Utils.Objects.GetValue;class pS 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(uS(e,"options"));var i=uS(e,"list");this.setWrapEnable(uS(i,"wrap",!1)),this.setCreateButtonCallback(uS(i,"createButtonCallback")),this.setCreateListBackgroundCallback(uS(i,"createBackgroundCallback")),this.setCreateListSliderTrackCallback(uS(i,"createTrackCallback")),this.setCreateListSliderThumbCallback(uS(i,"createThumbCallback")),this.setListSliderAdaptThumbSizeEnable(uS(i,"sliderAdaptThumbSize",!1)),this.setListScrollerConfig(uS(i,"scroller")),this.setListMouseWheelScrollerConfig(uS(i,"mouseWheelScroller")),this.setButtonClickCallback(uS(i,"onButtonClick")),this.setButtonOverCallback(uS(i,"onButtonOver")),this.setButtonOutCallback(uS(i,"onButtonOut")),this.setListExpandDirection(uS(i,"expandDirection")),this.setListEaseInDuration(uS(i,"easeIn",500)),this.setListEaseOutDuration(uS(i,"easeOut",100)),this.setListTransitInCallback(uS(i,"transitIn")),this.settListTransitOutCallback(uS(i,"transitOut")),this.setListMaxHeight(uS(i,"maxHeight",0)),this.setListSize(uS(i,"width"),uS(i,"height",0)),this.setListAlignmentMode(uS(i,"alignParent","text")),this.setListAlignmentSide(uS(i,"alignSide","")),this.setListBounds(uS(i,"bounds")),this.setListSpace(uS(i,"space")),this.setListDraggable(uS(i,"draggable",!1)),this.setValueChangeCallback(uS(e,"setValueCallback"),uS(e,"setValueCallbackScope")),this.setValue(uS(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(pS.prototype,cS);var vS=function(t,e){e=function(t,e,i){void 0===i&&(i={});var s=(e=e?je(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=ym(t,s,n);o.list=e.list||{},o.list.createButtonCallback=function(t,e){var i=lb(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 zp(t,h)},delete e.track);var l=e.thumb;return l&&(o.list.createThumbCallback=function(t){return zp(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 pS(t,e);return t.add.existing(i),i},gS=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=vS(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=gS(t,e);if(null!=i)return t[i]}(i.options,e);i.resetDisplayContent(s).setMinSize(i.width,i.height).layout().setMinSize(0,0)}};const mS=Phaser.Utils.Objects.GetValue;var yS={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?je(e.button):{},r=mS(s,"expand",!0);r&&(s.align="center"),delete s.expand;var n=kC(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) && (radius.y > 0)); + }; + var LineTo = function (x, y, pathData) { var cnt = pathData.length; if (cnt >= 2) { @@ -14566,8 +14570,7 @@ geom.setTo(0, 0, width, height, radius); } - var iteration = GetValue$p(radiusConfig, 'iteration', undefined); - this.setIteration(iteration); + this.setIteration(GetValue$p(radiusConfig, 'iteration', undefined)); this.setPosition(x, y); this.setFillStyle(fillColor, fillAlpha); @@ -14820,10 +14823,6 @@ } - var IsArcCorner = function (radius) { - return ((radius.x > 0) && (radius.y > 0)); - }; - const ShapeTypeMap = { rectangle: 0, circle: 1 @@ -16409,6 +16408,7 @@ var skewX = this.skewX; var width = this.width - Math.abs(skewX); var height = this.height; + var trackFill = this.getShape('trackFill'); trackFill.fillStyle(this.trackColor); if (trackFill.isFilled) { @@ -16417,8 +16417,7 @@ 0, 0, // x0, y0 width, height, // x1, y1 skewX // skewX - ) - .close(); + ); } var bar = this.getShape('bar'); @@ -16438,8 +16437,7 @@ barX0, 0, // x0, y0 barX1, height, // x1, y1 skewX // skew - ) - .close(); + ); } var trackStroke = this.getShape('trackStroke'); @@ -16450,8 +16448,7 @@ 0, 0, // x0, y0 width, height, // x1, y1 skewX // skewX - ) - .end(); + ); } }; @@ -16471,6 +16468,8 @@ .lineTo(x0, y0).lineTo(startX, y0); } + lines.close(); + return lines; }; @@ -16481,24 +16480,33 @@ constructor(scene, x, y, width, height, barColor, value, config) { if (IsPlainObject$3(x)) { config = x; - x = GetValue$m(config, 'x', 0); - y = GetValue$m(config, 'y', 0); - width = GetValue$m(config, 'width', 2); - height = GetValue$m(config, 'height', 2); - barColor = GetValue$m(config, 'barColor', undefined); - value = GetValue$m(config, 'value', 0); + + x = config.x; + y = config.y; + width = config.width; + height = config.height; + barColor = config.barColor; + value = config.value; } else if (IsPlainObject$3(width)) { config = width; - width = GetValue$m(config, 'width', 2); - height = GetValue$m(config, 'height', 2); - barColor = GetValue$m(config, 'barColor', undefined); - value = GetValue$m(config, 'value', 0); + + width = config.width; + height = config.height; + barColor = config.barColor; + value = config.value; } else if (IsPlainObject$3(barColor)) { config = barColor; - barColor = GetValue$m(config, 'barColor', undefined); - value = GetValue$m(config, 'value', 0); + + barColor = config.barColor; + value = config.value; } + if (x === undefined) { x = 0; } + if (y === undefined) { y = 0; } + if (width === undefined) { width = 2; } + if (height === undefined) { height = width; } + if (value === undefined) { value = 0; } + super(scene, x, y, width, height, config); this.type = 'rexLineProgress'; diff --git a/dist/rexgridtable.min.js b/dist/rexgridtable.min.js index b5e22a1762..5d8d9b6049 100644 --- a/dist/rexgridtable.min.js +++ b/dist/rexgridtable.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 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=O(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}},_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 Oe=/(\S+)\[(\d+)\]/i,Te=Phaser.Utils.Objects.GetValue;var Ee=function(t,e){return void 0===e?t:t[e]},ke=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=Te(e,"left",0),t.right=Te(e,"right",0),t.top=Te(e,"top",0),t.bottom=Te(e,"bottom",0)),t},Me={getInnerPadding(t){return Ee(this.space,t)},setInnerPadding(t,e){return ke(this.space,t,e),this},getOuterPadding(t){return Ee(this.getSizerConfig(this).padding,t)},setOuterPadding(t,e){return ke(this.getSizerConfig(this).padding,t,e),this},getChildOuterPadding(t,e){return"string"==typeof t&&(t=this.getElement(t)),Ee(this.getSizerConfig(t).padding,e)},setChildOuterPadding(t,e,i){return"string"==typeof t&&(t=this.getElement(t)),ke(this.getSizerConfig(t).padding,e,i),this}},De=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}},Re=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},Le=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},ze=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},Ae={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?vi:pi,this.repeatCounter=0,this}stop(){return this.state=ui,this}update(t,e){this.state!==ui&&this.state!==fi&&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=gi)):(this.nowTime=this.duration,this.state=fi):this.nowTime>=0&&(this.state=vi))}get t(){var t;switch(this.state){case ui:case pi:case gi:t=0;break;case vi:t=this.nowTime/this.duration;break;case fi:t=1}return di(t,0,1)}set t(t){(t=di(t,-1,1))<0?(this.state=pi,this.nowTime=-this.delay*t):(this.state=vi,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===ui}get isDelay(){return this.state===pi}get isCountDown(){return this.state===vi}get isRunning(){return this.state===pi||this.state===vi}get isDone(){return this.state===fi}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}}const ui=0,pi=1,vi=2,gi=3,fi=-1;class mi extends ai{constructor(t,e){super(t,e),this.timer=new ci}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 bi=Phaser.Utils.Objects.GetValue,yi=Phaser.Utils.Objects.GetAdvancedValue,Ci=Phaser.Tweens.Builders.GetEaseFunction;class Si extends mi{resetFromJSON(t){return this.timer.resetFromJSON(bi(t,"timer")),this.setEnable(bi(t,"enable",!0)),this.setTarget(bi(t,"target",this.parent)),this.setDelay(yi(t,"delay",0)),this.setDuration(yi(t,"duration",1e3)),this.setEase(bi(t,"ease","Linear")),this.setRepeat(bi(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 wi=Phaser.Utils.Objects.GetValue,Pi=Phaser.Utils.Objects.GetAdvancedValue,xi=Phaser.Math.Linear;let _i=class extends Si{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(Pi(t,"start",void 0),Pi(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=Oi[t]),this.mode=t,this}setScaleRange(t,e){return"number"==typeof t?(this.startX=t,this.startY=t):(this.startX=Pi(t,"x",this.parent.scaleX),this.startY=Pi(t,"y",this.parent.scaleY)),"number"==typeof e?(this.endX=e,this.endY=e):(this.endX=Pi(e,"x",void 0),this.endY=Pi(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=xi(this.startX,this.endX,i)),this.hasScaleY&&(t.scaleY=xi(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}};const Oi={stop:0,destroy:1,yoyo:2};var Ti=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},Ei=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},ki=function(t,e){return new Promise((function(i,s){t.once(e,(function(){i()}))}))},Mi=function(t){return ki(t,"complete")};const Di=Phaser.Utils.Objects.IsPlainObject;var Ri={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(Di(t)){var s=t;t=s.duration,e=s.orientation,i=s.ease}var r=void 0===this._scaleBehavior;return this._scaleBehavior=Ti(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(Di(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=Ei(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(Di(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),Mi(this._scaleBehavior)},isRunningScaleYoyo(){return this._scaleBehavior&&(this._scaleBehavior.completeEventName="scaleyoyo.complete")},isRunningEaseScale(){return this.isRunningPopUp()||this.isRunningScaleDown()||this.isRunningScaleYoyo()}},Xi={};Object.assign(Xi,Ri),Xi.onInitScale=function(){Ri.onInitScale.call(this);var t=this;this._scaleBehavior.on("update",(function(){var e=me.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const Li=Phaser.Utils.Objects.GetValue,Yi=Phaser.Utils.Objects.GetAdvancedValue,zi=Phaser.Math.Linear;class Ai extends Si{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(Li(t,"mode",0)),this.setAlphaRange(Yi(t,"start",this.parent.alpha),Yi(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=zi(this.alphaStart,this.alphaEnd,i)}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Ii={stop:0,destroy:1,yoyo:2},ji=Phaser.Utils.Objects.IsPlainObject;var Wi=function(t,e,i,s){var r,n;ji(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 Ai(t,h):s.resetFromJSON(h),s.restart(),s},Vi=function(t,e,i,s){i instanceof Ai&&(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 Ai(t,r):s.resetFromJSON(r),s.restart(),s};const Fi=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(Fi(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(Fi(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),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()}},Bi={};Object.assign(Bi,Hi),Bi.onInitFade=function(){Hi.onInitFade.call(this);var t=this;this._fade.on("update",(function(){var e=me.getParentSizer(t);e&&e.resetChildAlphaState(t)}))};const Ni=Phaser.Utils.Objects.GetValue,Gi=Phaser.Utils.Objects.GetAdvancedValue,Ui=Phaser.Math.Linear;class $i extends Si{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){if(super.resetFromJSON(t),this.setMode(Ni(t,"mode",0)),t&&(t.hasOwnProperty("x")||t.hasOwnProperty("y"))){var e=Gi(t,"x",void 0),i=Gi(t,"y",void 0);this.setTargetPosition(e,i)}else this.setTargetPosition(t);return this}setMode(t){return"string"==typeof t&&(t=Ji[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=Gi(i,"startX",void 0),this.startY=Gi(i,"startY",void 0),this.endX=Gi(i,"endX",void 0),this.endY=Gi(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=Ui(this.startX,this.endX,i)),this.hasMoveY&&(t.y=Ui(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Ji={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 Ki=Phaser.Utils.Objects.IsPlainObject,Zi=Phaser.Math.Distance.Between;var Qi={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(Ki(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*Zi(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 $i&&(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 $i(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),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(Ki(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*Zi(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 $i&&(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 $i(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),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}},ts={};Object.assign(ts,Qi),ts.onInitEaseMove=function(){Qi.onInitEaseMove.call(this);var t=this;this._easeMove.on("update",(function(){var e=me.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const es=Phaser.Utils.Objects.GetValue;class is extends ri{constructor(t,e){super(t,e),this.timer=new ci,this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.timer.resetFromJSON(es(t,"timer")),this.setEnable(es(t,"enable",!0)),this.setMode(es(t,"mode",1)),this.isRunning=es(t,"isRunning",!1),this.setMagnitudeMode(es(t,"magnitudeMode",1)),this.setAxisMode(es(t,"axis",0)),this.setDuration(es(t,"duration",500)),this.setMagnitude(es(t,"magnitude",10)),this.ox=es(t,"ox",void 0),this.oy=es(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=ss[t]),this.mode=t,this}setMagnitudeMode(t){return"string"==typeof t&&(t=ns[t]),this.magnitudeMode=t,this}setAxisMode(t){return"string"==typeof t&&(t=rs[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=es(i,"magnitude",void 0),t=es(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 ss={effect:0,behavior:1},rs={both:0,"h&v":0,"x&y":0,horizontal:1,h:1,x:1,vertical:2,v:2,y:2},ns={constant:0,decay:1},hs=Phaser.Utils.Objects.IsPlainObject;var as={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 is(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 os=Phaser.Utils.Objects.GetValue,ls=Phaser.Math.Linear;class ds extends Si{constructor(t,e){super(t,e),this.resetFromJSON(),this.boot()}start(t){if(this.timer.isRunning)return this;var e=this.target;this.propertyKey=os(t,"key","value");var i=e[this.propertyKey];return this.fromValue=os(t,"from",i),this.toValue=os(t,"to",i),this.setEase(os(t,"ease",this.ease)),this.setDuration(os(t,"duration",this.duration)),this.setRepeat(os(t,"repeat",0)),this.setDelay(os(t,"delay",0)),this.setRepeatDelay(os(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]=ls(this.fromValue,this.toValue,i)}}const cs=Phaser.Utils.Objects.IsPlainObject;class us extends Qe{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 ds(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(cs(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(cs(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 ps={easeDataTo(t,e,i,s){return this._easeData||(this._easeData=new us(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),ki(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}},vs=Phaser.Utils.Array.Remove,gs={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=$e(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}},Ds={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}},Rs={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}},Ls={};Object.assign(Ls,Ms,Ds,Rs,Xs);const Ys=Phaser.Utils.Objects.GetValue;class zs extends Qe{constructor(t,e){super(t,e),this.setTransitInTime(Ys(e,"duration.in",200)),this.setTransitOutTime(Ys(e,"duration.out",200)),this.setTransitInCallback(Ys(e,"transitIn")),this.setTransitOutCallback(Ys(e,"transitOut")),this.oneShotMode=Ys(e,"destroy",!1),this.delayCallTimer=void 0,this._state=new ks(this,{eventEmitter:!1,initState:Ys(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(zs.prototype,Ls);var As=function(t){if(t.parentContainer)return As(t.parentContainer);var e=function(t){var e=t.displayList;return U(e)?e:null}(t);return e?As(e):t};class Is extends Qe{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=As(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 js=Phaser.GameObjects.Rectangle;class Ws extends js{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 Vs=Phaser.Utils.Objects.GetValue;class Fs extends Qe{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=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 Bs=Phaser.Utils.Objects.GetValue;class Ns extends Ws{constructor(t,e){super(t,Bs(e,"color",0),Bs(e,"alpha",.8)),this.touchEventStop=new Fs(this,{hitAreaMode:1})}}var Gs={popUp(t,e){void 0!==t._modalScaleSave?(t.scaleX=t._modalScaleSave,t.scaleY=t._modalScaleSave):t._modalScaleSave=t.scaleX,Ti(t,e)},scaleDown(t,e){Ei(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)}},Us=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Wi(t,e,t.alpha)},$s=function(t,e){Vi(t,e,!1)},Js=function(t,e,i,s,r){return!(!t||s&&!s(t,e,i)||!rt(t,!0).contains(e,i)||r&&!r(t,e,i))};const qs=Phaser.Utils.Objects.GetValue;let Ks=class extends zs{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=Zs.popUp),null==e.transitOut&&(e.transitOut=Zs.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 Ns(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",Us)),this.setCoverTransitOutCallback(qs(i,"transitOut",$s)));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&&Js(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=Zs[t]),t){case Zs.popUp:t=Gs.popUp;break;case Zs.fadeIn:t=Gs.fadeIn}return super.setTransitInCallback(t),this}setTransitOutCallback(t){switch("string"==typeof t&&(t=Zs[t]),t){case Zs.scaleDown:t=Gs.scaleDown;break;case Zs.fadeOut:t=Gs.fadeOut}return super.setTransitOutCallback(t),this}setCoverTransitInCallback(t){return this.coverTransitInCallback=t,this}setCoverTransitOutCallback(t){return this.coverTransitOutCallback=t,this}};const Zs={popUp:0,fadeIn:1,scaleDown:0,fadeOut:1};var Qs=function(t){return t&&"function"==typeof t},tr={modal(t,e){return Qs(t)&&(e=t,t=void 0),void 0===this._modalBehavior&&(this.onCreateModalBehavior&&this.onCreateModalBehavior(this,t),this._modalBehavior=function(t,e){var i=new Ks(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}},er=function(t,e,i,s,r){Qs(e)&&(r=s,s=i,i=e,e=this);var n=this.scene.events;return this.bindEvent(e,n,t,i,s,r),this},ir={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 er.call(this,"preupdate",t,e,i,s),this},bindSceneUpdateEvent(t,e,i,s){return er.call(this,"update",t,e,i,s),this},bindScenePostupdateEvent(t,e,i,s){return er.call(this,"postupdate",t,e,i,s),this},bindSceneRenderEvent(t,e,i,s){return er.call(this,"render",t,e,i,s),this},bindScenePauseEvent(t,e,i,s){return er.call(this,"pause",t,e,i,s),this},bindSceneResumeEvent(t,e,i,s){return er.call(this,"resume",t,e,i,s),this},bindSceneSleepEvent(t,e,i,s){return er.call(this,"sleep",t,e,i,s),this},bindSceneWakeEvent(t,e,i,s){return er.call(this,"wake",t,e,i,s),this},bindSceneShutdownEvent(t,e,i,s){return er.call(this,"shutdown",t,e,i,s),this}},sr=function(t,e,i){var s=t.camera;return s?(void 0===i?i={}:!0===i&&(i=rr),s===e?(i.x=t.worldX,i.y=t.worldY):s.getWorldPoint(t.x,t.y,i),i):null},rr={},nr=function(t,e,i,s){var r,n=t.scene.sys.cameras.main,h=0===t.scrollFactorX&&0===t.scrollFactorY;if(e)return h?Js(t,e.x,e.y,i,s):!!(r=sr(e,n,!0))&&Js(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 fr={press:0,pointerdown:0,release:1,pointerup:1};var mr={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 gr(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}},br=function(t,e,i,s,r){if(e)return!(i&&!i(t,e)||!yr(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 Sr=Phaser.Utils.Objects.GetValue;class wr extends Qe{constructor(t,e){super(t,e),this._enable=void 0;var i=Sr(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(Sr(t,"enable",!0)),this.setMode(Sr(t,"mode",1)),this.setClickInterval(Sr(t,"clickInterval",100)),this.setDragThreshold(Sr(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=Pr[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?br:nr)(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 Pr={press:0,pointerdown:0,release:1,pointerup:1};var xr={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 _r extends Es{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 Or=Phaser.Utils.Objects.GetValue;class Tr extends Qe{constructor(t,e){super(t,e),this._enable=void 0,this.cooldown=new _r,this.parent.setInteractive(Or(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.prevIsInTouch=!1,this.isInTouching=!1,this.setEnable(Or(t,"enable",!0)),this.setCooldown(Or(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 Er={isPointerInBounds(t){return void 0===t?t=this:"string"==typeof t&&(t=this.getElement(t)),!!t&&nr(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 Tr(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 Tr(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}},kr={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,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=Gr,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===Ur&&this.onDragEnd(),this.pointer=void 0,this.tracerState=Gr,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=$r,this}isPointerInGameObject(t,e,i){var s=this.lastPointer;return!!s&&nr(t,s,e,i)}}const Gr=0,Ur=1,$r="IDLE",Jr=Phaser.Utils.Objects.GetValue,qr=Phaser.Math.Distance.Between;class Kr extends Nr{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=Zr},eventEmitter:!1};this.setRecongizedStateObject(new Es(s))}resetFromJSON(t){super.resetFromJSON(t),this.setHoldTime(Jr(t,"time",250)),this.setTapInterval(Jr(t,"tapInterval",200)),this.setDragThreshold(Jr(t,"threshold",9)),this.setTapOffset(Jr(t,"tapOffset",10));var e=Jr(t,"taps",void 0);return void 0!==e?this.setTaps(e):(this.setMaxTaps(Jr(t,"maxTaps",void 0)),this.setMinTaps(Jr(t,"minTaps",void 0))),this}onDragStart(){switch(this.state){case Zr:this.state=Qr;break;case Qr:var t=this.lastPointer;qr(t.upX,t.upY,t.x,t.y)>this.tapOffset&&(this.state=tn,this.state=Qr);break;case tn:this.state=Qr}}onDragEnd(){this.state===Qr&&(this.tapsCount++,this.emit("tapping",this,this.gameObject,this.lastPointer),void 0!==this.maxTaps&&this.tapsCount===this.maxTaps&&(this.state=tn))}onDrag(){this.state!==Zr&&this.pointer.getDistance()>this.dragThreshold&&(this.state=Zr)}preUpdate(t,e){if(this.isRunning&&this.enable&&this.state===Qr){var i=this.lastPointer;i.isDown?t-i.downTime>this.holdTime&&(this.state=Zr):t-i.upTime>this.tapInterval&&(void 0===this.minTaps||this.tapsCount>=this.minTaps?this.state=tn:this.state=Zr)}}postUpdate(t,e){this.isRunning&&this.enable&&this.state===tn&&(this.state=Zr)}get isTapped(){return this.state===tn}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 Zr="IDLE",Qr="BEGIN",tn="RECOGNIZED",en=Phaser.Utils.Objects.GetValue;class sn extends Nr{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=rn},eventEmitter:!1};this.setRecongizedStateObject(new Es(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(en(t,"threshold",9)),this.setHoldTime(en(t,"time",251)),this}onDragStart(){this.state=nn,0===this.holdTime&&(this.state=hn)}onDragEnd(){this.state=rn}onDrag(){this.state!==rn&&this.pointer.getDistance()>this.dragThreshold&&(this.state=rn)}preUpdate(t,e){this.isRunning&&this.enable&&this.state===nn&&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 rn="IDLE",nn="BEGIN",hn="RECOGNIZED";Phaser.Utils.Objects.GetValue;var an=function(t){return Ke(t).loop.delta};const on=Phaser.Math.Distance.Between,ln=Phaser.Math.Angle.Between;var dn={getDt:function(){return an(this.scene)},getVelocity:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return on(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 ln(e.x,e.y,t.x,t.y)}},cn={"up&down":0,"left&right":1,"4dir":2,"8dir":3},un={};const pn=Phaser.Utils.Objects.GetValue,vn=Phaser.Math.RadToDeg;class gn extends Nr{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=fn},eventEmitter:!1};this.setRecongizedStateObject(new Es(s)),this.clearDirectionStates()}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(pn(t,"threshold",10)),this.setVelocityThreshold(pn(t,"velocityThreshold",1e3)),this.setDirectionMode(pn(t,"dir","8dir")),this}onDragStart(){this.state=mn}onDragEnd(){this.state=fn}onDrag(){this.state===mn&&(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=fn)}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=un),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}}(vn(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,dn);const fn="IDLE",mn="BEGIN",bn="RECOGNIZED",yn=Phaser.Utils.Objects.GetValue,Cn=Phaser.Utils.Array.SpliceOne,Sn=Phaser.Math.Distance.Between,wn=Phaser.Math.Angle.Between;class Pn{constructor(t,e){var i=$e(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(yn(e,"inputConfig",void 0)),this.setEventEmitter(yn(e,"eventEmitter",void 0)),this._enable=void 0,this.pointers=[],this.movedState={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setEnable(yn(t,"enable",!0)),this.bounds=yn(t,"bounds",void 0),this.tracerState=_n,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 _n:this.tracerState=On,this.onDrag1Start();break;case On: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],Cn(this.pointers,e),this.tracerState){case On:this.tracerState=_n,this.onDrag1End();break;case Tn:this.tracerState=On,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 On:this.onDrag1();break;case Tn:this.onDrag2()}}}dragCancel(){return this.tracerState===Tn&&this.onDrag2End(),this.pointers.length=0,gt(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!==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 wn(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=En,this}isPointer0InGameObject(t,e,i){var s=this.pointers[0];return!!s&&nr(t,s,e,i)}isPointer1InGameObject(t,e,i){var s=this.pointers[1];return!!s&&nr(t,s,e,i)}}Object.assign(Pn.prototype,Ne);var xn={};const _n=0,On=1,Tn=2,En="IDLE";Phaser.Utils.Objects.GetValue;const kn=Phaser.Math.RotateAround;var Mn=function(t,e,i,s){return kn(t,e,i,s),t.rotation+=s,t},Dn={};const Rn=Phaser.Utils.Objects.GetValue,Xn=Phaser.Math.Angle.WrapDegrees,Ln=Phaser.Math.Angle.ShortestBetween,Yn=Phaser.Math.RadToDeg,zn=Phaser.Math.DegToRad;var An={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=Dn),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(Yn(this.angleBetween));this.angle=Ln(this.prevAngle,t),this.prevAngle=t,this.state=Wn}break;case Wn:t=Xn(Yn(this.angleBetween)),this.angle=Ln(this.prevAngle,t),this.prevAngle=t,this.emit("rotate",this)}}get isRotated(){return this.state===Wn}get rotation(){return zn(this.angle)}setDragThreshold(t){return this.dragThreshold=t,this}}.prototype,An);const In="IDLE",jn="BEGIN",Wn="RECOGNIZED",Vn=Phaser.Utils.Objects.GetValue;var Fn=function(t){var e=Vn(t,"tap",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._tap=new Kr(this,e),this._tap.on("tap",(function(t,e,s){Dr(i.eventEmitter,`${i.eventNamePrefix}${t.tapsCount}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Hn=Phaser.Utils.Objects.GetValue;var Bn=function(t){var e=Hn(t,"press",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._press=new sn(this,e),this._press.on("pressstart",(function(t,e,s){Dr(i.eventEmitter,`${i.eventNamePrefix}pressstart`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this).on("pressend",(function(t,e,s){Dr(i.eventEmitter,`${i.eventNamePrefix}pressend`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Nn=Phaser.Utils.Objects.GetValue;var Gn=function(t){var e=Nn(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";Dr(i.eventEmitter,`${i.eventNamePrefix}swipe${r}`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Un=Phaser.Utils.Objects.GetValue;var $n=function(t,e){return t.setInteractive(),Un(e,"dropZone",!1)&&(t.input.dropZone=!0),t._childrenInteractive={targetSizers:Un(e,"targets",[t]),targetMode:Un(e,"targetMode","parent"),eventEmitter:Un(e,"eventEmitter",t),eventNamePrefix:Un(e,"inputEventPrefix","child.")},Xr.call(t,e),zr.call(t,e),jr.call(t,e),Hr.call(t,e),Fn.call(t,e),Bn.call(t,e),Gn.call(t,e),t},Jn={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,h,a=t.scene;if("number"==typeof e)i=e;else{i=ae(e,"color"),s=ae(e,"lineWidth");var o=ae(e,"name",!1);o&&(r=ae(o,"createTextCallback",le),n=ae(o,"createTextCallbackScope",void 0),"string"==typeof(h=ae(o,"align","left-top"))&&(h=Yt[h]))}if(void 0===i&&(i=16777215),void 0===s&&(s=1),r&&!t.children){t.children=new oe(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)}}for(var d,c,u=this.getAllShownChildren([this]),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 rh=Phaser.Utils.Objects.IsPlainObject,nh=Phaser.Utils.Objects.GetValue,hh=Phaser.Display.Align.CENTER,ah={min:0,full:-1};var oh=function(t,e,i,s,r,n,h,a,o,l){ve.call(this,t);var d=t.isRexSpace,c=typeof e;if(null===e)return this;if("number"===c);else if("string"===c)e=ah[e];else if(rh(e)){var u;e=nh(u=e,"proportion",void 0),i=nh(u,"align",hh),s=nh(u,"padding",0),r=nh(u,"expand",!1),n=nh(u,"key",void 0),h=nh(u,"index",void 0),t.isRexSizer||(a=nh(u,"minWidth",void 0),o=nh(u,"minHeight",void 0)),l=nh(u,"fitRatio",0)}return"string"==typeof i&&(i=Yt[i]),void 0===e&&(e=d?1:0),void 0===i&&(i=hh),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===a&&(d?a=0:t.isRexSizer||(a=t._minWidth)),void 0===o&&(d?o=0:t.isRexSizer||(o=t._minHeight)),void 0===l||!1===l?l=0:!0===l&&(l=Q(t)/tt(t)),(u=this.getSizerConfig(t)).proportion=e,u.align=i,u.padding=ue(s),u.expand=r,u.fitRatio=0===e?l:0,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},lh={add:oh,addSpace(t){return this.insertSpace(void 0,t),this},insertSpace(t,e){return void 0===e&&(e=1),oh.call(this,new ih(this.scene),{proportion:e,minWidth:0,minHeight:0,index:t}),this},insert(t,e,i,s,r,n,h,a){return rh(i)&&(i.index=t),oh.call(this,e,i,s,r,n,h,t,a),this},insertAtPosition(t,e,i,s,r,n,h,a,o){var l=sh.call(this,t,e);return-1===l&&(l=void 0),this.insert(l,i,s,r,n,h,a,o),this}};const dh=Et.prototype.clear;var ch=function(t){this.backgroundChildren&&(this.backgroundChildren.length=0);var e,i=!t&&this.sizerEventsEnable;if(i&&(e=this.getChildren([])),dh.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}},vh={getChildAlign(t){return this.getSizerConfig(t).align},setChildAlign(t,e){return"string"==typeof e&&(e=Yt[e]),this.getSizerConfig(t).align=e,this}},gh={getChildProportion(t){return this.getSizerConfig(t).proportion},setChildProportion(t,e){return this.getSizerConfig(t).proportion=e,this}},fh={getChildExpand(t){return this.getSizerConfig(t).expand},setChildExpand(t,e){return this.getSizerConfig(t).expand=e,this}},mh={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}},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;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,Ie.call(this),this},layoutChildren:function(){for(var t,e,i,s,r,n,h,a,o,l,d=this.sizerChildren,c=this.innerLeft,u=this.innerTop,p=this.innerWidth,v=this.innerHeight,g=c,f=u,m=this.startChildIndex,b=0,y=d.length;b0?(e=t-this.getChildrenWidth(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},resolveHeight:function(t){if(void 0!==(t=Le.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)||Re.call(this)},runWidthWrap:function(t){this.wrapResult||(1===this.orientation&&th.call(this,t,void 0),Xe.call(this,t))},hasHeightWrap:function(){return!(!this.hasRatioFitChild||0!==this.orientation)||Ye.call(this)},runHeightWrap:function(t){this.wrapResult||(0===this.orientation&&th.call(this,void 0,t),ze.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(bh,lh,ph,vh,gh,fh,mh);var yh=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 Sh=Phaser.Utils.Objects.IsPlainObject,wh=Phaser.Utils.Objects.GetValue;class Ph extends Kn{constructor(t,e,i,s,r,n,h){Sh(e)?(e=wh(h=e,"x",0),i=wh(h,"y",0),s=wh(h,"width",void 0),r=wh(h,"height",void 0),n=wh(h,"orientation",0)):Sh(s)?(s=wh(h=s,"width",void 0),r=wh(h,"height",void 0),n=wh(h,"orientation",0)):Sh(n)&&(n=wh(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(wh(h,"space.item",0)),this.setStartChildIndex(wh(h,"startChildIndex",0)),this.setRTL(wh(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=yh.call(this)),this._childrenProportion}}Object.assign(Ph.prototype,bh);var xh={v:0,vertical:0,y:0,h:1,horizontal:1,x:1,xy:2,vh:2},_h=function(t,e){void 0===e&&(e="scrollMode"),t.hasOwnProperty(e)||(t[e]=Oh(t));var i=t[e];return"string"==typeof i&&(i=xh[i]),i},Oh=function(t){var e=!!t.sliderY||!!t.scrollerY,i=!!t.sliderX||!!t.scrollerX;return e&&i?2:e?0:i?1:0},Th=function(){return Array.prototype.reduce.call(arguments,Eh,0)},Eh=function(t,e){return t+e};const kh=Phaser.Utils.Objects.IsPlainObject,Mh=Phaser.Utils.Objects.GetValue,Dh=Phaser.Display.Align.CENTER;var Rh=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 Lh(this.sizerChildren,null),ch.call(this,t),this}},zh={setColumnSpace(t){if(this.space.column||(this.space.column=[]),this.space.column.length=this.columnCount-1,"number"==typeof t)Lh(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},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;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=Le.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===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,Lh(this.sizerChildren,null),this.columnProportions=[],this.columnProportions.length=t,"number"==typeof i)Lh(this.columnProportions,i);else for(var n=0;n0?e+=t:0===t&&(this.hasColumnProportion0Child=!0);return e},Fh=function(){for(var t,e=0,i=0;i0?e+=t:0===t&&(this.hasRowProportion0Child=!0);return e};const Hh=Phaser.Utils.Objects.IsPlainObject,Bh=Phaser.Utils.Objects.GetValue;class Nh extends Kn{constructor(t,e,i,s,r,n,h,a,o,l){Hh(e)?(e=Bh(l=e,"x",0),i=Bh(l,"y",0),s=Bh(l,"width",void 0),r=Bh(l,"height",void 0),n=Bh(l,"column",l.col||0),h=Bh(l,"row",0),a=Bh(l,"columnProportions",0),o=Bh(l,"rowProportions",0)):Hh(s)?(s=Bh(l=s,"width",void 0),r=Bh(l,"height",void 0),n=Bh(l,"column",l.col||0),h=Bh(l,"row",0),a=Bh(l,"columnProportions",0),o=Bh(l,"rowProportions",0)):Hh(n)?(n=Bh(l=n,"column",l.col||0),h=Bh(l,"row",0),a=Bh(l,"columnProportions",0),o=Bh(l,"rowProportions",0)):Hh(a)&&(a=Bh(l=a,"columnProportions",0),o=Bh(l,"rowProportions",0)),super(t,e,i,s,r,l),this.type="rexGridSizer",this.sizerChildren=[],this.addChildrenMap("items",this.sizerChildren),this.setCreateCellContainerCallback(Bh(l,"createCellContainerCallback")),this.setIndentLeft(Bh(l,"space.indentLeftOdd",0),Bh(l,"space.indentLeftEven",0)),this.setIndentTop(Bh(l,"space.indentTopOdd",0),Bh(l,"space.indentTopEven",0)),this.resetGrid(n,h,a,o,Bh(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=Fh.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(Nh.prototype,Wh);const Gh=Phaser.Utils.Objects.GetValue;var Uh=Phaser.Renderer.WebGL.Utils,$h=function(t,e,i,s,r,n){for(var h=Uh.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+")"},Qh=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 ta=Phaser.Renderer.Canvas.SetTransform;var ea={renderWebGL:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.pipelines.set(e.pipeline),n=Kh(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&&$h(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(ta(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(sa.prototype,ea);const ra=Phaser.Utils.Objects.GetValue;let na=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=ra(t,"x",0),i=ra(t,"y",0));var s=this.cornerRadius;s.tl=ha(ra(t,"tl",void 0),e,i),s.tr=ha(ra(t,"tr",void 0),e,i),s.bl=ha(ra(t,"bl",void 0),e,i),s.br=ha(ra(t,"br",void 0),e,i)}get radiusTL(){var t=this.cornerRadius.tl;return Math.max(t.x,t.y)}set radiusTL(t){aa(this.cornerRadius.tl,t)}get radiusTR(){var t=this.cornerRadius.tr;return Math.max(t.x,t.y)}set radiusTR(t){aa(this.cornerRadius.tr,t)}get radiusBL(){var t=this.cornerRadius.bl;return Math.max(t.x,t.y)}set radiusBL(t){aa(this.cornerRadius.bl,t)}get radiusBR(){var t=this.cornerRadius.br;return Math.max(t.x,t.y)}set radiusBR(t){aa(this.cornerRadius.br,t)}};var ha=function(t,e,i){return void 0===t?t={x:e,y:i}:"number"==typeof t&&(t={x:t,y:t}),oa(t),t},aa=function(t,e){"number"==typeof e?(t.x=e,t.y=e):(t.x=ra(e,"x",0),t.y=ra(e,"y",0)),oa(t)},oa=function(t){t.convex=t.x>=0||t.y>=0,t.x=Math.abs(t.x),t.y=Math.abs(t.y)},la=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 da=Phaser.Math.DegToRad;var ca=function(t,e,i,s,r,n,h,a,o){h&&n>r?n-=360:!h&&n0&&t.y>0};const ma={rectangle:0,circle:1};var ba=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};const ya=Phaser.Utils.Objects.GetValue;class Ca extends Qe{constructor(t,e){super(t,e),this.style=ya(e,"style",this);var i=ya(e,"propertiesMap");this.activeStyle=Sa(e,"active",i),this.hoverStyle=Sa(e,"hover",i),this.disableStyle=Sa(e,"disable",i),this.onModifyStyle=ya(e,"onModifyStyle")}getStyle(t){return function(t,e,i){if(void 0===i&&(i={}),Array.isArray(e))for(var s=0,r=e.length;s0,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};const vo=Phaser.Utils.Objects.GetValue,go=Phaser.Utils.Objects.IsPlainObject;class fo extends(ja(Da)){constructor(t,e,i,s,r,n,h,a){go(e)?(e=vo(a=e,"x",0),i=vo(a,"y",0),s=vo(a,"width",2),r=vo(a,"height",2),n=vo(a,"barColor",void 0),h=vo(a,"value",0)):go(s)?(s=vo(a=s,"width",2),r=vo(a,"height",2),n=vo(a,"barColor",void 0),h=vo(a,"value",0)):go(n)&&(n=vo(a=n,"barColor",void 0),h=vo(a,"value",0)),super(t,e,i,s,r,a),this.type="rexLineProgress",this.bootProgressBase(a),this.addShape((new uo).setName("trackFill")).addShape((new uo).setName("bar")).addShape((new uo).setName("trackStroke")),this.setTrackColor(vo(a,"trackColor",void 0)),this.setBarColor(n),this.setTrackStroke(vo(a,"trackStrokeThickness",2),vo(a,"trackStrokeColor",void 0)),this.setSkewX(vo(a,"skewX",0)),this.setRTL(vo(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 mo={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&&po(s,0,0,e,i,t).close();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),po(h,r,0,n,i,t).close());var a=this.getShape("trackStroke");a.lineStyle(this.trackStrokeThickness,this.trackStrokeColor),a.isStroked&&po(a,0,0,e,i,t).end()}};Object.assign(fo.prototype,mo);var bo=function(t){return null==t||""===t||0===t.length},yo=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,jo=Phaser.Utils.Objects.GetValue;var Wo=function(t){return"string"==typeof t&&(t=Vo[t]),t};const Vo={scale:0,repeat:1};var Fo=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=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,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 Io(t)?(this.stretchMode.edge=Wo(jo(t,"edge",0)),this.stretchMode.internal=Wo(jo(t,"internal",0))):(t=Wo(t),this.stretchMode.edge=t,this.stretchMode.internal=t),this},getStretchMode:function(t,e){return Fo.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 Bo=Phaser.Utils.Objects.IsPlainObject,No=Phaser.Utils.Objects.GetValue,Go=Phaser.GameObjects;var Uo=void 0,$o=function(t,e){if(Uo||(Uo={},Ke(t).events.once("destroy",(function(){for(var t in Uo)Uo[t].destroy();Uo=void 0}))),!Uo.hasOwnProperty(e)){var i=Ke(t).scene.systemScene;(t=new Go[e](i)).setOrigin(0),Uo[e]=t}return Uo[e]};const Jo=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(Bo(i)?(i=No(d=i,"x",0),s=No(d,"y",0),r=No(d,"width",1),n=No(d,"height",1),h=No(d,"key",void 0),a=No(d,"baseFrame",void 0),o=No(d,"columns",void 0),l=No(d,"rows",void 0)):Bo(r)?(r=No(d=r,"width",1),n=No(d,"height",1),h=No(d,"key",void 0),a=No(d,"baseFrame",void 0),o=No(d,"columns",void 0),l=No(d,"rows",void 0)):Bo(h)?(h=No(d=h,"key",void 0),a=No(d,"baseFrame",void 0),o=No(d,"columns",void 0),l=No(d,"rows",void 0)):Bo(a)?(a=No(d=a,"baseFrame",void 0),o=No(d,"columns",void 0),l=No(d,"rows",void 0)):Array.isArray(a)?(d=l,l=o,o=a,a=No(d,"baseFrame",void 0)):Bo(o)&&(o=No(d=o,"columns",void 0),l=No(d,"rows",void 0)),void 0===a&&(a=No(d,"frame",void 0)),void 0===o){var c=No(d,"leftWidth",void 0),u=No(d,"rightWidth",void 0);void 0!==c&&void 0!==u&&(o=[c,void 0,u])}if(void 0===l){var p=No(d,"topHeight",void 0),v=No(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(No(d,"getFrameNameCallback",void 0)),this.setStretchMode(No(d,"stretchMode",0)),this.setPreserveRatio(No(d,"preserveRatio",!0));var g=No(d,"maxFixedPartScale",1),f=No(d,"maxFixedPartScaleX",g),m=No(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}(Jo,"rexNinePatch")){}var Ko={_drawImage:function(t,e,i,s,r,n){var h=$o(this,"Image").setTexture(t,e).setDisplaySize(r,n);this.draw(h,i,s)},_drawTileSprite:function(t,e,i,s,r,n){var h=$o(this,"TileSprite").setTexture(t,e).setSize(r,n);this.draw(h,i,s)}};Object.assign(qo.prototype,Ko);class Zo extends Qe{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 Qo=Phaser.Utils.Objects.GetValue;class tl extends qo{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexStatesNinePatch";var i=Qo(e,"effects",!0);i&&To(this,i),this.style=new Zo(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign(tl.prototype,Pa);const el=["alpha","tint","flipX","flipY"];var il=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 Co(t,e);break;case"image":s=new Yo(t,e);break;case"nineSlice":s=e.hasOwnProperty("stretchMode")?new tl(t,e):new Do(t,e);break;default:s=new xa(t,e)}return function(t,e){if(!e)return t;for(var i=0,s=el.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 Xl=Phaser.Utils.Objects.GetValue,Ll=Phaser.Math.Distance.Between;class Yl extends Qe{constructor(t,e){super(t,e),this._enable=void 0,this.rectBoundsInteractive=Xl(e,"rectBoundsInteractive",!1),this.rectBoundsInteractive||t.setInteractive(Xl(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(Xl(t,"enable",!0)),this.holdThreshold=Xl(t,"holdThreshold",50),this.pointerOutReleaseEnable=Xl(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 an(this.scene)}get speed(){return this.x===this.preX&&this.y===this.preY?0:Ll(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&&!nr(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&&!nr(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 Fl={y:0,v:0,vertical:0,x:1,h:1,horizontal:1},Hl=Phaser.Utils.Objects.GetValue;class Bl extends Qe{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||nr(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 Nl=Phaser.Utils.Objects.GetValue;var Gl=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)?Nl(s,l,void 0):Nl(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=ft(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 Dl(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);var p=Nl(r,"position",0);"string"==typeof p&&(p=Ul[p]);var v,g,f=Nl(s,`space.slider${i}`,void 0);void 0===f&&void 0===(f=Nl(s,"space.slider",void 0))&&(a?f=0:v=Nl(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:Nl(v,"right",v)}):(d=0,c=1,u=void 0===v?g?{right:f}:f:{right:Nl(v,"left",v)}):0===p?(d=1,c=2,u=void 0===v?g?{top:f}:f:{top:Nl(v,"bottom",v)}):(d=1,c=0,u=void 0===v?g?{bottom:f}:f:{bottom:Nl(v,"top",v)}),e.add(n,{column:d,row:c,align:"center",padding:u,expand:!0}),t[`hideUnscrollableSlider${i}`]=Nl(r,"hideUnscrollableSlider",!1),t[`adaptThumb${i}SizeMode`]=Nl(r,"adaptThumbSize",!1),t[`minThumb${i}Size`]=Nl(r,"minThumbSize",void 0)}else t[`hideUnscrollableSlider${i}`]=!1,t[`adaptThumb${i}SizeMode`]=!1,t[`minThumb${i}Size`]=void 0;var m,b,y=Nl(s,"scrollDetectionMode");"string"==typeof y&&(y=$l[y]);var C=`scroller${i}`;(m=a||s.hasOwnProperty(C)?Nl(s,C,!0):Nl(s,"scroller",!0))&&o&&(!0===m&&(m={}),m.orientation=h?0:1,void 0!==y&&(m.rectBoundsInteractive=1===y),b=new Vl(o,m),o.isRexContainerLite&&o.sendChildToBack(o));var S,w,P,x,_,O=Nl(s,a?`mouseWheelScroller${i}`:"mouseWheelScroller",!1);O&&o&&(void 0!==y&&(O.focus=1===y?2:0),S=new Bl(o,O)),t.addChildrenMap(`slider${i}`,n),t.addChildrenMap(`scroller${i}`,b),t.addChildrenMap(`mouseWheelScroller${i}`,S),a&&!h||(t.hideUnscrollableSlider=t[`hideUnscrollableSlider${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&&(_=a?`addChildO${i}`:"addChildOY",S.on("scroll",(function(e){t[_](-e,!0)})))};const Ul={right:0,left:1,bottom:0,top:1},$l={gameObject:0,rectBounds:1},Jl=Phaser.Utils.Objects.GetValue;var ql=function(t,e){var i=t.scene,s=[0,1,0],r=[0,1,0],n=Jl(e,"width"),h=Jl(e,"height");n||Jl(e,"child.expandWidth",!0)||(s[1]=0),h||Jl(e,"child.expandHeight",!0)||(r[1]=0);var a=new Nh(i,{column:3,row:3,columnProportions:s,rowProportions:r});switch(function(t,e,i){var s=Gh(i,"child"),r=Gh(s,"gameObject",void 0);if(r){var n=Gh(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=Gh(n,"top",0),h.bottom=Gh(n,"bottom",0),a.left=Gh(n,"left",0),a.right=Gh(n,"right",0);break;case 1:h.top=Gh(n,"left",0),h.bottom=Gh(n,"right",0),a.top=Gh(n,"top",0),a.bottom=Gh(n,"bottom",0);break;default:h.top=Gh(n,"top",0),h.bottom=Gh(n,"bottom",0),h.left=Gh(n,"left",0),h.right=Gh(n,"right",0)}e.add(r,{column:1,row:1,align:Gh(s,"align","center"),padding:a,expand:{width:Gh(s,"expandWidth",!0),height:Gh(s,"expandHeight",!0)}})}t.addChildrenMap("child",r)}(t,a,e),t.scrollMode){case 0:Gl(t,a,"y",e);break;case 1:Gl(t,a,"x",e);break;default:Gl(t,a,"y",e),Gl(t,a,"x",e)}return a},Kl=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}`]}if(s){var n="Y"===t?this.scaleY:this.scaleX;s.setBounds(e,i*n)}r&&r.setEnable(e!==i)},Zl=function(t){switch(this.scrollMode){case 0:case 1:(e=this.childrenMap.slider)&&this.hideUnscrollableSlider&&this.setChildVisible(e,this.isOverflow);break;default:t=t.toUpperCase();var e=this.childrenMap[`slider${t}`],i=this[`hideUnscrollableSlider${t}`],s=this[`isOverflow${t}`];e&&i&&this.setChildVisible(e,s)}},Ql=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 ad=Phaser.Utils.Objects.GetValue,od=Phaser.Utils.Array.SpliceOne;class ld{constructor(t,e){this.parent=t,this.cells=[],this.cellPool=new hd,this.resetFromJSON(e)}resetFromJSON(t){void 0===t&&(t={}),this.colCount=void 0,this.nonZeroDeltaHeightCount=0,this.resetTotalRowsHeight();var e=ad(t,"cellHeight",60),i=ad(t,"cellWidth",60);return this.setDefaultCellHeight(e),this.setDefaultCellWidth(i),this.initCells(ad(t,"cellsCount",0)),this.setColumnCount(ad(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=Md(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 O=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=O(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}},_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 Oe=/(\S+)\[(\d+)\]/i,Te=Phaser.Utils.Objects.GetValue;var Ee=function(t,e){return void 0===e?t:t[e]},ke=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=Te(e,"left",0),t.right=Te(e,"right",0),t.top=Te(e,"top",0),t.bottom=Te(e,"bottom",0)),t},Me={getInnerPadding(t){return Ee(this.space,t)},setInnerPadding(t,e){return ke(this.space,t,e),this},getOuterPadding(t){return Ee(this.getSizerConfig(this).padding,t)},setOuterPadding(t,e){return ke(this.getSizerConfig(this).padding,t,e),this},getChildOuterPadding(t,e){return"string"==typeof t&&(t=this.getElement(t)),Ee(this.getSizerConfig(t).padding,e)},setChildOuterPadding(t,e,i){return"string"==typeof t&&(t=this.getElement(t)),ke(this.getSizerConfig(t).padding,e,i),this}},De=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}},Re=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},Le=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},ze=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},Ae={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?vi:pi,this.repeatCounter=0,this}stop(){return this.state=ui,this}update(t,e){this.state!==ui&&this.state!==fi&&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=gi)):(this.nowTime=this.duration,this.state=fi):this.nowTime>=0&&(this.state=vi))}get t(){var t;switch(this.state){case ui:case pi:case gi:t=0;break;case vi:t=this.nowTime/this.duration;break;case fi:t=1}return di(t,0,1)}set t(t){(t=di(t,-1,1))<0?(this.state=pi,this.nowTime=-this.delay*t):(this.state=vi,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===ui}get isDelay(){return this.state===pi}get isCountDown(){return this.state===vi}get isRunning(){return this.state===pi||this.state===vi}get isDone(){return this.state===fi}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}}const ui=0,pi=1,vi=2,gi=3,fi=-1;class mi extends ai{constructor(t,e){super(t,e),this.timer=new ci}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 bi=Phaser.Utils.Objects.GetValue,yi=Phaser.Utils.Objects.GetAdvancedValue,Ci=Phaser.Tweens.Builders.GetEaseFunction;class Si extends mi{resetFromJSON(t){return this.timer.resetFromJSON(bi(t,"timer")),this.setEnable(bi(t,"enable",!0)),this.setTarget(bi(t,"target",this.parent)),this.setDelay(yi(t,"delay",0)),this.setDuration(yi(t,"duration",1e3)),this.setEase(bi(t,"ease","Linear")),this.setRepeat(bi(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 wi=Phaser.Utils.Objects.GetValue,Pi=Phaser.Utils.Objects.GetAdvancedValue,xi=Phaser.Math.Linear;let _i=class extends Si{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(Pi(t,"start",void 0),Pi(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=Oi[t]),this.mode=t,this}setScaleRange(t,e){return"number"==typeof t?(this.startX=t,this.startY=t):(this.startX=Pi(t,"x",this.parent.scaleX),this.startY=Pi(t,"y",this.parent.scaleY)),"number"==typeof e?(this.endX=e,this.endY=e):(this.endX=Pi(e,"x",void 0),this.endY=Pi(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=xi(this.startX,this.endX,i)),this.hasScaleY&&(t.scaleY=xi(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}};const Oi={stop:0,destroy:1,yoyo:2};var Ti=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},Ei=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},ki=function(t,e){return new Promise((function(i,s){t.once(e,(function(){i()}))}))},Mi=function(t){return ki(t,"complete")};const Di=Phaser.Utils.Objects.IsPlainObject;var Ri={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(Di(t)){var s=t;t=s.duration,e=s.orientation,i=s.ease}var r=void 0===this._scaleBehavior;return this._scaleBehavior=Ti(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(Di(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=Ei(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(Di(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),Mi(this._scaleBehavior)},isRunningScaleYoyo(){return this._scaleBehavior&&(this._scaleBehavior.completeEventName="scaleyoyo.complete")},isRunningEaseScale(){return this.isRunningPopUp()||this.isRunningScaleDown()||this.isRunningScaleYoyo()}},Xi={};Object.assign(Xi,Ri),Xi.onInitScale=function(){Ri.onInitScale.call(this);var t=this;this._scaleBehavior.on("update",(function(){var e=me.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const Li=Phaser.Utils.Objects.GetValue,Yi=Phaser.Utils.Objects.GetAdvancedValue,zi=Phaser.Math.Linear;class Ai extends Si{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(Li(t,"mode",0)),this.setAlphaRange(Yi(t,"start",this.parent.alpha),Yi(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=zi(this.alphaStart,this.alphaEnd,i)}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Ii={stop:0,destroy:1,yoyo:2},ji=Phaser.Utils.Objects.IsPlainObject;var Wi=function(t,e,i,s){var r,n;ji(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 Ai(t,h):s.resetFromJSON(h),s.restart(),s},Vi=function(t,e,i,s){i instanceof Ai&&(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 Ai(t,r):s.resetFromJSON(r),s.restart(),s};const Fi=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(Fi(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(Fi(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),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()}},Bi={};Object.assign(Bi,Hi),Bi.onInitFade=function(){Hi.onInitFade.call(this);var t=this;this._fade.on("update",(function(){var e=me.getParentSizer(t);e&&e.resetChildAlphaState(t)}))};const Ni=Phaser.Utils.Objects.GetValue,Gi=Phaser.Utils.Objects.GetAdvancedValue,Ui=Phaser.Math.Linear;class $i extends Si{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){if(super.resetFromJSON(t),this.setMode(Ni(t,"mode",0)),t&&(t.hasOwnProperty("x")||t.hasOwnProperty("y"))){var e=Gi(t,"x",void 0),i=Gi(t,"y",void 0);this.setTargetPosition(e,i)}else this.setTargetPosition(t);return this}setMode(t){return"string"==typeof t&&(t=Ji[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=Gi(i,"startX",void 0),this.startY=Gi(i,"startY",void 0),this.endX=Gi(i,"endX",void 0),this.endY=Gi(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=Ui(this.startX,this.endX,i)),this.hasMoveY&&(t.y=Ui(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Ji={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 Ki=Phaser.Utils.Objects.IsPlainObject,Zi=Phaser.Math.Distance.Between;var Qi={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(Ki(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*Zi(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 $i&&(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 $i(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),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(Ki(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*Zi(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 $i&&(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 $i(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),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}},ts={};Object.assign(ts,Qi),ts.onInitEaseMove=function(){Qi.onInitEaseMove.call(this);var t=this;this._easeMove.on("update",(function(){var e=me.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const es=Phaser.Utils.Objects.GetValue;class is extends ri{constructor(t,e){super(t,e),this.timer=new ci,this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.timer.resetFromJSON(es(t,"timer")),this.setEnable(es(t,"enable",!0)),this.setMode(es(t,"mode",1)),this.isRunning=es(t,"isRunning",!1),this.setMagnitudeMode(es(t,"magnitudeMode",1)),this.setAxisMode(es(t,"axis",0)),this.setDuration(es(t,"duration",500)),this.setMagnitude(es(t,"magnitude",10)),this.ox=es(t,"ox",void 0),this.oy=es(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=ss[t]),this.mode=t,this}setMagnitudeMode(t){return"string"==typeof t&&(t=ns[t]),this.magnitudeMode=t,this}setAxisMode(t){return"string"==typeof t&&(t=rs[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=es(i,"magnitude",void 0),t=es(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 ss={effect:0,behavior:1},rs={both:0,"h&v":0,"x&y":0,horizontal:1,h:1,x:1,vertical:2,v:2,y:2},ns={constant:0,decay:1},hs=Phaser.Utils.Objects.IsPlainObject;var as={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 is(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 os=Phaser.Utils.Objects.GetValue,ls=Phaser.Math.Linear;class ds extends Si{constructor(t,e){super(t,e),this.resetFromJSON(),this.boot()}start(t){if(this.timer.isRunning)return this;var e=this.target;this.propertyKey=os(t,"key","value");var i=e[this.propertyKey];return this.fromValue=os(t,"from",i),this.toValue=os(t,"to",i),this.setEase(os(t,"ease",this.ease)),this.setDuration(os(t,"duration",this.duration)),this.setRepeat(os(t,"repeat",0)),this.setDelay(os(t,"delay",0)),this.setRepeatDelay(os(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]=ls(this.fromValue,this.toValue,i)}}const cs=Phaser.Utils.Objects.IsPlainObject;class us extends Qe{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 ds(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(cs(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(cs(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 ps={easeDataTo(t,e,i,s){return this._easeData||(this._easeData=new us(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),ki(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}},vs=Phaser.Utils.Array.Remove,gs={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=$e(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}},Ds={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}},Rs={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}},Ls={};Object.assign(Ls,Ms,Ds,Rs,Xs);const Ys=Phaser.Utils.Objects.GetValue;class zs extends Qe{constructor(t,e){super(t,e),this.setTransitInTime(Ys(e,"duration.in",200)),this.setTransitOutTime(Ys(e,"duration.out",200)),this.setTransitInCallback(Ys(e,"transitIn")),this.setTransitOutCallback(Ys(e,"transitOut")),this.oneShotMode=Ys(e,"destroy",!1),this.delayCallTimer=void 0,this._state=new ks(this,{eventEmitter:!1,initState:Ys(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(zs.prototype,Ls);var As=function(t){if(t.parentContainer)return As(t.parentContainer);var e=function(t){var e=t.displayList;return U(e)?e:null}(t);return e?As(e):t};class Is extends Qe{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=As(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 js=Phaser.GameObjects.Rectangle;class Ws extends js{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 Vs=Phaser.Utils.Objects.GetValue;class Fs extends Qe{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=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 Bs=Phaser.Utils.Objects.GetValue;class Ns extends Ws{constructor(t,e){super(t,Bs(e,"color",0),Bs(e,"alpha",.8)),this.touchEventStop=new Fs(this,{hitAreaMode:1})}}var Gs={popUp(t,e){void 0!==t._modalScaleSave?(t.scaleX=t._modalScaleSave,t.scaleY=t._modalScaleSave):t._modalScaleSave=t.scaleX,Ti(t,e)},scaleDown(t,e){Ei(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)}},Us=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Wi(t,e,t.alpha)},$s=function(t,e){Vi(t,e,!1)},Js=function(t,e,i,s,r){return!(!t||s&&!s(t,e,i)||!rt(t,!0).contains(e,i)||r&&!r(t,e,i))};const qs=Phaser.Utils.Objects.GetValue;let Ks=class extends zs{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=Zs.popUp),null==e.transitOut&&(e.transitOut=Zs.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 Ns(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",Us)),this.setCoverTransitOutCallback(qs(i,"transitOut",$s)));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&&Js(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=Zs[t]),t){case Zs.popUp:t=Gs.popUp;break;case Zs.fadeIn:t=Gs.fadeIn}return super.setTransitInCallback(t),this}setTransitOutCallback(t){switch("string"==typeof t&&(t=Zs[t]),t){case Zs.scaleDown:t=Gs.scaleDown;break;case Zs.fadeOut:t=Gs.fadeOut}return super.setTransitOutCallback(t),this}setCoverTransitInCallback(t){return this.coverTransitInCallback=t,this}setCoverTransitOutCallback(t){return this.coverTransitOutCallback=t,this}};const Zs={popUp:0,fadeIn:1,scaleDown:0,fadeOut:1};var Qs=function(t){return t&&"function"==typeof t},tr={modal(t,e){return Qs(t)&&(e=t,t=void 0),void 0===this._modalBehavior&&(this.onCreateModalBehavior&&this.onCreateModalBehavior(this,t),this._modalBehavior=function(t,e){var i=new Ks(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}},er=function(t,e,i,s,r){Qs(e)&&(r=s,s=i,i=e,e=this);var n=this.scene.events;return this.bindEvent(e,n,t,i,s,r),this},ir={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 er.call(this,"preupdate",t,e,i,s),this},bindSceneUpdateEvent(t,e,i,s){return er.call(this,"update",t,e,i,s),this},bindScenePostupdateEvent(t,e,i,s){return er.call(this,"postupdate",t,e,i,s),this},bindSceneRenderEvent(t,e,i,s){return er.call(this,"render",t,e,i,s),this},bindScenePauseEvent(t,e,i,s){return er.call(this,"pause",t,e,i,s),this},bindSceneResumeEvent(t,e,i,s){return er.call(this,"resume",t,e,i,s),this},bindSceneSleepEvent(t,e,i,s){return er.call(this,"sleep",t,e,i,s),this},bindSceneWakeEvent(t,e,i,s){return er.call(this,"wake",t,e,i,s),this},bindSceneShutdownEvent(t,e,i,s){return er.call(this,"shutdown",t,e,i,s),this}},sr=function(t,e,i){var s=t.camera;return s?(void 0===i?i={}:!0===i&&(i=rr),s===e?(i.x=t.worldX,i.y=t.worldY):s.getWorldPoint(t.x,t.y,i),i):null},rr={},nr=function(t,e,i,s){var r,n=t.scene.sys.cameras.main,h=0===t.scrollFactorX&&0===t.scrollFactorY;if(e)return h?Js(t,e.x,e.y,i,s):!!(r=sr(e,n,!0))&&Js(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 fr={press:0,pointerdown:0,release:1,pointerup:1};var mr={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 gr(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}},br=function(t,e,i,s,r){if(e)return!(i&&!i(t,e)||!yr(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 Sr=Phaser.Utils.Objects.GetValue;class wr extends Qe{constructor(t,e){super(t,e),this._enable=void 0;var i=Sr(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(Sr(t,"enable",!0)),this.setMode(Sr(t,"mode",1)),this.setClickInterval(Sr(t,"clickInterval",100)),this.setDragThreshold(Sr(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=Pr[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?br:nr)(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 Pr={press:0,pointerdown:0,release:1,pointerup:1};var xr={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 _r extends Es{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 Or=Phaser.Utils.Objects.GetValue;class Tr extends Qe{constructor(t,e){super(t,e),this._enable=void 0,this.cooldown=new _r,this.parent.setInteractive(Or(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.prevIsInTouch=!1,this.isInTouching=!1,this.setEnable(Or(t,"enable",!0)),this.setCooldown(Or(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 Er={isPointerInBounds(t){return void 0===t?t=this:"string"==typeof t&&(t=this.getElement(t)),!!t&&nr(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 Tr(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 Tr(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}},kr={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,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=Gr,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===Ur&&this.onDragEnd(),this.pointer=void 0,this.tracerState=Gr,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=$r,this}isPointerInGameObject(t,e,i){var s=this.lastPointer;return!!s&&nr(t,s,e,i)}}const Gr=0,Ur=1,$r="IDLE",Jr=Phaser.Utils.Objects.GetValue,qr=Phaser.Math.Distance.Between;class Kr extends Nr{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=Zr},eventEmitter:!1};this.setRecongizedStateObject(new Es(s))}resetFromJSON(t){super.resetFromJSON(t),this.setHoldTime(Jr(t,"time",250)),this.setTapInterval(Jr(t,"tapInterval",200)),this.setDragThreshold(Jr(t,"threshold",9)),this.setTapOffset(Jr(t,"tapOffset",10));var e=Jr(t,"taps",void 0);return void 0!==e?this.setTaps(e):(this.setMaxTaps(Jr(t,"maxTaps",void 0)),this.setMinTaps(Jr(t,"minTaps",void 0))),this}onDragStart(){switch(this.state){case Zr:this.state=Qr;break;case Qr:var t=this.lastPointer;qr(t.upX,t.upY,t.x,t.y)>this.tapOffset&&(this.state=tn,this.state=Qr);break;case tn:this.state=Qr}}onDragEnd(){this.state===Qr&&(this.tapsCount++,this.emit("tapping",this,this.gameObject,this.lastPointer),void 0!==this.maxTaps&&this.tapsCount===this.maxTaps&&(this.state=tn))}onDrag(){this.state!==Zr&&this.pointer.getDistance()>this.dragThreshold&&(this.state=Zr)}preUpdate(t,e){if(this.isRunning&&this.enable&&this.state===Qr){var i=this.lastPointer;i.isDown?t-i.downTime>this.holdTime&&(this.state=Zr):t-i.upTime>this.tapInterval&&(void 0===this.minTaps||this.tapsCount>=this.minTaps?this.state=tn:this.state=Zr)}}postUpdate(t,e){this.isRunning&&this.enable&&this.state===tn&&(this.state=Zr)}get isTapped(){return this.state===tn}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 Zr="IDLE",Qr="BEGIN",tn="RECOGNIZED",en=Phaser.Utils.Objects.GetValue;class sn extends Nr{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=rn},eventEmitter:!1};this.setRecongizedStateObject(new Es(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(en(t,"threshold",9)),this.setHoldTime(en(t,"time",251)),this}onDragStart(){this.state=nn,0===this.holdTime&&(this.state=hn)}onDragEnd(){this.state=rn}onDrag(){this.state!==rn&&this.pointer.getDistance()>this.dragThreshold&&(this.state=rn)}preUpdate(t,e){this.isRunning&&this.enable&&this.state===nn&&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 rn="IDLE",nn="BEGIN",hn="RECOGNIZED";Phaser.Utils.Objects.GetValue;var an=function(t){return Ke(t).loop.delta};const on=Phaser.Math.Distance.Between,ln=Phaser.Math.Angle.Between;var dn={getDt:function(){return an(this.scene)},getVelocity:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return on(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 ln(e.x,e.y,t.x,t.y)}},cn={"up&down":0,"left&right":1,"4dir":2,"8dir":3},un={};const pn=Phaser.Utils.Objects.GetValue,vn=Phaser.Math.RadToDeg;class gn extends Nr{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=fn},eventEmitter:!1};this.setRecongizedStateObject(new Es(s)),this.clearDirectionStates()}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(pn(t,"threshold",10)),this.setVelocityThreshold(pn(t,"velocityThreshold",1e3)),this.setDirectionMode(pn(t,"dir","8dir")),this}onDragStart(){this.state=mn}onDragEnd(){this.state=fn}onDrag(){this.state===mn&&(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=fn)}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=un),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}}(vn(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,dn);const fn="IDLE",mn="BEGIN",bn="RECOGNIZED",yn=Phaser.Utils.Objects.GetValue,Cn=Phaser.Utils.Array.SpliceOne,Sn=Phaser.Math.Distance.Between,wn=Phaser.Math.Angle.Between;class Pn{constructor(t,e){var i=$e(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(yn(e,"inputConfig",void 0)),this.setEventEmitter(yn(e,"eventEmitter",void 0)),this._enable=void 0,this.pointers=[],this.movedState={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setEnable(yn(t,"enable",!0)),this.bounds=yn(t,"bounds",void 0),this.tracerState=_n,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 _n:this.tracerState=On,this.onDrag1Start();break;case On: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],Cn(this.pointers,e),this.tracerState){case On:this.tracerState=_n,this.onDrag1End();break;case Tn:this.tracerState=On,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 On:this.onDrag1();break;case Tn:this.onDrag2()}}}dragCancel(){return this.tracerState===Tn&&this.onDrag2End(),this.pointers.length=0,gt(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!==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 wn(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=En,this}isPointer0InGameObject(t,e,i){var s=this.pointers[0];return!!s&&nr(t,s,e,i)}isPointer1InGameObject(t,e,i){var s=this.pointers[1];return!!s&&nr(t,s,e,i)}}Object.assign(Pn.prototype,Ne);var xn={};const _n=0,On=1,Tn=2,En="IDLE";Phaser.Utils.Objects.GetValue;const kn=Phaser.Math.RotateAround;var Mn=function(t,e,i,s){return kn(t,e,i,s),t.rotation+=s,t},Dn={};const Rn=Phaser.Utils.Objects.GetValue,Xn=Phaser.Math.Angle.WrapDegrees,Ln=Phaser.Math.Angle.ShortestBetween,Yn=Phaser.Math.RadToDeg,zn=Phaser.Math.DegToRad;var An={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=Dn),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(Yn(this.angleBetween));this.angle=Ln(this.prevAngle,t),this.prevAngle=t,this.state=Wn}break;case Wn:t=Xn(Yn(this.angleBetween)),this.angle=Ln(this.prevAngle,t),this.prevAngle=t,this.emit("rotate",this)}}get isRotated(){return this.state===Wn}get rotation(){return zn(this.angle)}setDragThreshold(t){return this.dragThreshold=t,this}}.prototype,An);const In="IDLE",jn="BEGIN",Wn="RECOGNIZED",Vn=Phaser.Utils.Objects.GetValue;var Fn=function(t){var e=Vn(t,"tap",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._tap=new Kr(this,e),this._tap.on("tap",(function(t,e,s){Dr(i.eventEmitter,`${i.eventNamePrefix}${t.tapsCount}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Hn=Phaser.Utils.Objects.GetValue;var Bn=function(t){var e=Hn(t,"press",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._press=new sn(this,e),this._press.on("pressstart",(function(t,e,s){Dr(i.eventEmitter,`${i.eventNamePrefix}pressstart`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this).on("pressend",(function(t,e,s){Dr(i.eventEmitter,`${i.eventNamePrefix}pressend`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Nn=Phaser.Utils.Objects.GetValue;var Gn=function(t){var e=Nn(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";Dr(i.eventEmitter,`${i.eventNamePrefix}swipe${r}`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Un=Phaser.Utils.Objects.GetValue;var $n=function(t,e){return t.setInteractive(),Un(e,"dropZone",!1)&&(t.input.dropZone=!0),t._childrenInteractive={targetSizers:Un(e,"targets",[t]),targetMode:Un(e,"targetMode","parent"),eventEmitter:Un(e,"eventEmitter",t),eventNamePrefix:Un(e,"inputEventPrefix","child.")},Xr.call(t,e),zr.call(t,e),jr.call(t,e),Hr.call(t,e),Fn.call(t,e),Bn.call(t,e),Gn.call(t,e),t},Jn={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,h,a=t.scene;if("number"==typeof e)i=e;else{i=ae(e,"color"),s=ae(e,"lineWidth");var o=ae(e,"name",!1);o&&(r=ae(o,"createTextCallback",le),n=ae(o,"createTextCallbackScope",void 0),"string"==typeof(h=ae(o,"align","left-top"))&&(h=Yt[h]))}if(void 0===i&&(i=16777215),void 0===s&&(s=1),r&&!t.children){t.children=new oe(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)}}for(var d,c,u=this.getAllShownChildren([this]),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 rh=Phaser.Utils.Objects.IsPlainObject,nh=Phaser.Utils.Objects.GetValue,hh=Phaser.Display.Align.CENTER,ah={min:0,full:-1};var oh=function(t,e,i,s,r,n,h,a,o,l){ve.call(this,t);var d=t.isRexSpace,c=typeof e;if(null===e)return this;if("number"===c);else if("string"===c)e=ah[e];else if(rh(e)){var u;e=nh(u=e,"proportion",void 0),i=nh(u,"align",hh),s=nh(u,"padding",0),r=nh(u,"expand",!1),n=nh(u,"key",void 0),h=nh(u,"index",void 0),t.isRexSizer||(a=nh(u,"minWidth",void 0),o=nh(u,"minHeight",void 0)),l=nh(u,"fitRatio",0)}return"string"==typeof i&&(i=Yt[i]),void 0===e&&(e=d?1:0),void 0===i&&(i=hh),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===a&&(d?a=0:t.isRexSizer||(a=t._minWidth)),void 0===o&&(d?o=0:t.isRexSizer||(o=t._minHeight)),void 0===l||!1===l?l=0:!0===l&&(l=Q(t)/tt(t)),(u=this.getSizerConfig(t)).proportion=e,u.align=i,u.padding=ue(s),u.expand=r,u.fitRatio=0===e?l:0,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},lh={add:oh,addSpace(t){return this.insertSpace(void 0,t),this},insertSpace(t,e){return void 0===e&&(e=1),oh.call(this,new ih(this.scene),{proportion:e,minWidth:0,minHeight:0,index:t}),this},insert(t,e,i,s,r,n,h,a){return rh(i)&&(i.index=t),oh.call(this,e,i,s,r,n,h,t,a),this},insertAtPosition(t,e,i,s,r,n,h,a,o){var l=sh.call(this,t,e);return-1===l&&(l=void 0),this.insert(l,i,s,r,n,h,a,o),this}};const dh=Et.prototype.clear;var ch=function(t){this.backgroundChildren&&(this.backgroundChildren.length=0);var e,i=!t&&this.sizerEventsEnable;if(i&&(e=this.getChildren([])),dh.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}},vh={getChildAlign(t){return this.getSizerConfig(t).align},setChildAlign(t,e){return"string"==typeof e&&(e=Yt[e]),this.getSizerConfig(t).align=e,this}},gh={getChildProportion(t){return this.getSizerConfig(t).proportion},setChildProportion(t,e){return this.getSizerConfig(t).proportion=e,this}},fh={getChildExpand(t){return this.getSizerConfig(t).expand},setChildExpand(t,e){return this.getSizerConfig(t).expand=e,this}},mh={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}},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;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,Ie.call(this),this},layoutChildren:function(){for(var t,e,i,s,r,n,h,a,o,l,d=this.sizerChildren,c=this.innerLeft,u=this.innerTop,p=this.innerWidth,v=this.innerHeight,g=c,f=u,m=this.startChildIndex,b=0,y=d.length;b0?(e=t-this.getChildrenWidth(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},resolveHeight:function(t){if(void 0!==(t=Le.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)||Re.call(this)},runWidthWrap:function(t){this.wrapResult||(1===this.orientation&&th.call(this,t,void 0),Xe.call(this,t))},hasHeightWrap:function(){return!(!this.hasRatioFitChild||0!==this.orientation)||Ye.call(this)},runHeightWrap:function(t){this.wrapResult||(0===this.orientation&&th.call(this,void 0,t),ze.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(bh,lh,ph,vh,gh,fh,mh);var yh=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 Sh=Phaser.Utils.Objects.IsPlainObject,wh=Phaser.Utils.Objects.GetValue;class Ph extends Kn{constructor(t,e,i,s,r,n,h){Sh(e)?(e=wh(h=e,"x",0),i=wh(h,"y",0),s=wh(h,"width",void 0),r=wh(h,"height",void 0),n=wh(h,"orientation",0)):Sh(s)?(s=wh(h=s,"width",void 0),r=wh(h,"height",void 0),n=wh(h,"orientation",0)):Sh(n)&&(n=wh(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(wh(h,"space.item",0)),this.setStartChildIndex(wh(h,"startChildIndex",0)),this.setRTL(wh(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=yh.call(this)),this._childrenProportion}}Object.assign(Ph.prototype,bh);var xh={v:0,vertical:0,y:0,h:1,horizontal:1,x:1,xy:2,vh:2},_h=function(t,e){void 0===e&&(e="scrollMode"),t.hasOwnProperty(e)||(t[e]=Oh(t));var i=t[e];return"string"==typeof i&&(i=xh[i]),i},Oh=function(t){var e=!!t.sliderY||!!t.scrollerY,i=!!t.sliderX||!!t.scrollerX;return e&&i?2:e?0:i?1:0},Th=function(){return Array.prototype.reduce.call(arguments,Eh,0)},Eh=function(t,e){return t+e};const kh=Phaser.Utils.Objects.IsPlainObject,Mh=Phaser.Utils.Objects.GetValue,Dh=Phaser.Display.Align.CENTER;var Rh=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 Lh(this.sizerChildren,null),ch.call(this,t),this}},zh={setColumnSpace(t){if(this.space.column||(this.space.column=[]),this.space.column.length=this.columnCount-1,"number"==typeof t)Lh(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},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;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=Le.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===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,Lh(this.sizerChildren,null),this.columnProportions=[],this.columnProportions.length=t,"number"==typeof i)Lh(this.columnProportions,i);else for(var n=0;n0?e+=t:0===t&&(this.hasColumnProportion0Child=!0);return e},Fh=function(){for(var t,e=0,i=0;i0?e+=t:0===t&&(this.hasRowProportion0Child=!0);return e};const Hh=Phaser.Utils.Objects.IsPlainObject,Bh=Phaser.Utils.Objects.GetValue;class Nh extends Kn{constructor(t,e,i,s,r,n,h,a,o,l){Hh(e)?(e=Bh(l=e,"x",0),i=Bh(l,"y",0),s=Bh(l,"width",void 0),r=Bh(l,"height",void 0),n=Bh(l,"column",l.col||0),h=Bh(l,"row",0),a=Bh(l,"columnProportions",0),o=Bh(l,"rowProportions",0)):Hh(s)?(s=Bh(l=s,"width",void 0),r=Bh(l,"height",void 0),n=Bh(l,"column",l.col||0),h=Bh(l,"row",0),a=Bh(l,"columnProportions",0),o=Bh(l,"rowProportions",0)):Hh(n)?(n=Bh(l=n,"column",l.col||0),h=Bh(l,"row",0),a=Bh(l,"columnProportions",0),o=Bh(l,"rowProportions",0)):Hh(a)&&(a=Bh(l=a,"columnProportions",0),o=Bh(l,"rowProportions",0)),super(t,e,i,s,r,l),this.type="rexGridSizer",this.sizerChildren=[],this.addChildrenMap("items",this.sizerChildren),this.setCreateCellContainerCallback(Bh(l,"createCellContainerCallback")),this.setIndentLeft(Bh(l,"space.indentLeftOdd",0),Bh(l,"space.indentLeftEven",0)),this.setIndentTop(Bh(l,"space.indentTopOdd",0),Bh(l,"space.indentTopEven",0)),this.resetGrid(n,h,a,o,Bh(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=Fh.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(Nh.prototype,Wh);const Gh=Phaser.Utils.Objects.GetValue;var Uh=Phaser.Renderer.WebGL.Utils,$h=function(t,e,i,s,r,n){for(var h=Uh.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+")"},Qh=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 ta=Phaser.Renderer.Canvas.SetTransform;var ea={renderWebGL:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.pipelines.set(e.pipeline),n=Kh(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&&$h(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(ta(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(sa.prototype,ea);const ra=Phaser.Utils.Objects.GetValue;let na=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=ra(t,"x",0),i=ra(t,"y",0));var s=this.cornerRadius;s.tl=ha(ra(t,"tl",void 0),e,i),s.tr=ha(ra(t,"tr",void 0),e,i),s.bl=ha(ra(t,"bl",void 0),e,i),s.br=ha(ra(t,"br",void 0),e,i)}get radiusTL(){var t=this.cornerRadius.tl;return Math.max(t.x,t.y)}set radiusTL(t){aa(this.cornerRadius.tl,t)}get radiusTR(){var t=this.cornerRadius.tr;return Math.max(t.x,t.y)}set radiusTR(t){aa(this.cornerRadius.tr,t)}get radiusBL(){var t=this.cornerRadius.bl;return Math.max(t.x,t.y)}set radiusBL(t){aa(this.cornerRadius.bl,t)}get radiusBR(){var t=this.cornerRadius.br;return Math.max(t.x,t.y)}set radiusBR(t){aa(this.cornerRadius.br,t)}};var ha=function(t,e,i){return void 0===t?t={x:e,y:i}:"number"==typeof t&&(t={x:t,y:t}),oa(t),t},aa=function(t,e){"number"==typeof e?(t.x=e,t.y=e):(t.x=ra(e,"x",0),t.y=ra(e,"y",0)),oa(t)},oa=function(t){t.convex=t.x>=0||t.y>=0,t.x=Math.abs(t.x),t.y=Math.abs(t.y)},la=function(t){return t.x>0&&t.y>0},da=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 ca=Phaser.Math.DegToRad;var ua=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 vo=Phaser.Utils.Objects.GetValue,go=Phaser.Utils.Objects.IsPlainObject;class fo extends(ja(Da)){constructor(t,e,i,s,r,n,h,a){go(e)?(e=(a=e).x,i=a.y,s=a.width,r=a.height,n=a.barColor,h=a.value):go(s)?(s=(a=s).width,r=a.height,n=a.barColor,h=a.value):go(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 uo).setName("trackFill")).addShape((new uo).setName("bar")).addShape((new uo).setName("trackStroke")),this.setTrackColor(vo(a,"trackColor",void 0)),this.setBarColor(n),this.setTrackStroke(vo(a,"trackStrokeThickness",2),vo(a,"trackStrokeColor",void 0)),this.setSkewX(vo(a,"skewX",0)),this.setRTL(vo(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 mo={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&&po(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),po(h,r,0,n,i,t));var a=this.getShape("trackStroke");a.lineStyle(this.trackStrokeThickness,this.trackStrokeColor),a.isStroked&&po(a,0,0,e,i,t)}};Object.assign(fo.prototype,mo);var bo=function(t){return null==t||""===t||0===t.length},yo=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,jo=Phaser.Utils.Objects.GetValue;var Wo=function(t){return"string"==typeof t&&(t=Vo[t]),t};const Vo={scale:0,repeat:1};var Fo=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=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,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 Io(t)?(this.stretchMode.edge=Wo(jo(t,"edge",0)),this.stretchMode.internal=Wo(jo(t,"internal",0))):(t=Wo(t),this.stretchMode.edge=t,this.stretchMode.internal=t),this},getStretchMode:function(t,e){return Fo.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 Bo=Phaser.Utils.Objects.IsPlainObject,No=Phaser.Utils.Objects.GetValue,Go=Phaser.GameObjects;var Uo=void 0,$o=function(t,e){if(Uo||(Uo={},Ke(t).events.once("destroy",(function(){for(var t in Uo)Uo[t].destroy();Uo=void 0}))),!Uo.hasOwnProperty(e)){var i=Ke(t).scene.systemScene;(t=new Go[e](i)).setOrigin(0),Uo[e]=t}return Uo[e]};const Jo=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(Bo(i)?(i=No(d=i,"x",0),s=No(d,"y",0),r=No(d,"width",1),n=No(d,"height",1),h=No(d,"key",void 0),a=No(d,"baseFrame",void 0),o=No(d,"columns",void 0),l=No(d,"rows",void 0)):Bo(r)?(r=No(d=r,"width",1),n=No(d,"height",1),h=No(d,"key",void 0),a=No(d,"baseFrame",void 0),o=No(d,"columns",void 0),l=No(d,"rows",void 0)):Bo(h)?(h=No(d=h,"key",void 0),a=No(d,"baseFrame",void 0),o=No(d,"columns",void 0),l=No(d,"rows",void 0)):Bo(a)?(a=No(d=a,"baseFrame",void 0),o=No(d,"columns",void 0),l=No(d,"rows",void 0)):Array.isArray(a)?(d=l,l=o,o=a,a=No(d,"baseFrame",void 0)):Bo(o)&&(o=No(d=o,"columns",void 0),l=No(d,"rows",void 0)),void 0===a&&(a=No(d,"frame",void 0)),void 0===o){var c=No(d,"leftWidth",void 0),u=No(d,"rightWidth",void 0);void 0!==c&&void 0!==u&&(o=[c,void 0,u])}if(void 0===l){var p=No(d,"topHeight",void 0),v=No(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(No(d,"getFrameNameCallback",void 0)),this.setStretchMode(No(d,"stretchMode",0)),this.setPreserveRatio(No(d,"preserveRatio",!0));var g=No(d,"maxFixedPartScale",1),f=No(d,"maxFixedPartScaleX",g),m=No(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}(Jo,"rexNinePatch")){}var Ko={_drawImage:function(t,e,i,s,r,n){var h=$o(this,"Image").setTexture(t,e).setDisplaySize(r,n);this.draw(h,i,s)},_drawTileSprite:function(t,e,i,s,r,n){var h=$o(this,"TileSprite").setTexture(t,e).setSize(r,n);this.draw(h,i,s)}};Object.assign(qo.prototype,Ko);class Zo extends Qe{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 Qo=Phaser.Utils.Objects.GetValue;class tl extends qo{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexStatesNinePatch";var i=Qo(e,"effects",!0);i&&To(this,i),this.style=new Zo(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign(tl.prototype,Pa);const el=["alpha","tint","flipX","flipY"];var il=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 Co(t,e);break;case"image":s=new Yo(t,e);break;case"nineSlice":s=e.hasOwnProperty("stretchMode")?new tl(t,e):new Do(t,e);break;default:s=new xa(t,e)}return function(t,e){if(!e)return t;for(var i=0,s=el.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 Xl=Phaser.Utils.Objects.GetValue,Ll=Phaser.Math.Distance.Between;class Yl extends Qe{constructor(t,e){super(t,e),this._enable=void 0,this.rectBoundsInteractive=Xl(e,"rectBoundsInteractive",!1),this.rectBoundsInteractive||t.setInteractive(Xl(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(Xl(t,"enable",!0)),this.holdThreshold=Xl(t,"holdThreshold",50),this.pointerOutReleaseEnable=Xl(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 an(this.scene)}get speed(){return this.x===this.preX&&this.y===this.preY?0:Ll(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&&!nr(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&&!nr(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 Fl={y:0,v:0,vertical:0,x:1,h:1,horizontal:1},Hl=Phaser.Utils.Objects.GetValue;class Bl extends Qe{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||nr(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 Nl=Phaser.Utils.Objects.GetValue;var Gl=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)?Nl(s,l,void 0):Nl(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=ft(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 Dl(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);var p=Nl(r,"position",0);"string"==typeof p&&(p=Ul[p]);var v,g,f=Nl(s,`space.slider${i}`,void 0);void 0===f&&void 0===(f=Nl(s,"space.slider",void 0))&&(a?f=0:v=Nl(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:Nl(v,"right",v)}):(d=0,c=1,u=void 0===v?g?{right:f}:f:{right:Nl(v,"left",v)}):0===p?(d=1,c=2,u=void 0===v?g?{top:f}:f:{top:Nl(v,"bottom",v)}):(d=1,c=0,u=void 0===v?g?{bottom:f}:f:{bottom:Nl(v,"top",v)}),e.add(n,{column:d,row:c,align:"center",padding:u,expand:!0}),t[`hideUnscrollableSlider${i}`]=Nl(r,"hideUnscrollableSlider",!1),t[`adaptThumb${i}SizeMode`]=Nl(r,"adaptThumbSize",!1),t[`minThumb${i}Size`]=Nl(r,"minThumbSize",void 0)}else t[`hideUnscrollableSlider${i}`]=!1,t[`adaptThumb${i}SizeMode`]=!1,t[`minThumb${i}Size`]=void 0;var m,b,y=Nl(s,"scrollDetectionMode");"string"==typeof y&&(y=$l[y]);var C=`scroller${i}`;(m=a||s.hasOwnProperty(C)?Nl(s,C,!0):Nl(s,"scroller",!0))&&o&&(!0===m&&(m={}),m.orientation=h?0:1,void 0!==y&&(m.rectBoundsInteractive=1===y),b=new Vl(o,m),o.isRexContainerLite&&o.sendChildToBack(o));var S,w,P,x,_,O=Nl(s,a?`mouseWheelScroller${i}`:"mouseWheelScroller",!1);O&&o&&(void 0!==y&&(O.focus=1===y?2:0),S=new Bl(o,O)),t.addChildrenMap(`slider${i}`,n),t.addChildrenMap(`scroller${i}`,b),t.addChildrenMap(`mouseWheelScroller${i}`,S),a&&!h||(t.hideUnscrollableSlider=t[`hideUnscrollableSlider${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&&(_=a?`addChildO${i}`:"addChildOY",S.on("scroll",(function(e){t[_](-e,!0)})))};const Ul={right:0,left:1,bottom:0,top:1},$l={gameObject:0,rectBounds:1},Jl=Phaser.Utils.Objects.GetValue;var ql=function(t,e){var i=t.scene,s=[0,1,0],r=[0,1,0],n=Jl(e,"width"),h=Jl(e,"height");n||Jl(e,"child.expandWidth",!0)||(s[1]=0),h||Jl(e,"child.expandHeight",!0)||(r[1]=0);var a=new Nh(i,{column:3,row:3,columnProportions:s,rowProportions:r});switch(function(t,e,i){var s=Gh(i,"child"),r=Gh(s,"gameObject",void 0);if(r){var n=Gh(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=Gh(n,"top",0),h.bottom=Gh(n,"bottom",0),a.left=Gh(n,"left",0),a.right=Gh(n,"right",0);break;case 1:h.top=Gh(n,"left",0),h.bottom=Gh(n,"right",0),a.top=Gh(n,"top",0),a.bottom=Gh(n,"bottom",0);break;default:h.top=Gh(n,"top",0),h.bottom=Gh(n,"bottom",0),h.left=Gh(n,"left",0),h.right=Gh(n,"right",0)}e.add(r,{column:1,row:1,align:Gh(s,"align","center"),padding:a,expand:{width:Gh(s,"expandWidth",!0),height:Gh(s,"expandHeight",!0)}})}t.addChildrenMap("child",r)}(t,a,e),t.scrollMode){case 0:Gl(t,a,"y",e);break;case 1:Gl(t,a,"x",e);break;default:Gl(t,a,"y",e),Gl(t,a,"x",e)}return a},Kl=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}`]}if(s){var n="Y"===t?this.scaleY:this.scaleX;s.setBounds(e,i*n)}r&&r.setEnable(e!==i)},Zl=function(t){switch(this.scrollMode){case 0:case 1:(e=this.childrenMap.slider)&&this.hideUnscrollableSlider&&this.setChildVisible(e,this.isOverflow);break;default:t=t.toUpperCase();var e=this.childrenMap[`slider${t}`],i=this[`hideUnscrollableSlider${t}`],s=this[`isOverflow${t}`];e&&i&&this.setChildVisible(e,s)}},Ql=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 ad=Phaser.Utils.Objects.GetValue,od=Phaser.Utils.Array.SpliceOne;class ld{constructor(t,e){this.parent=t,this.cells=[],this.cellPool=new hd,this.resetFromJSON(e)}resetFromJSON(t){void 0===t&&(t={}),this.colCount=void 0,this.nonZeroDeltaHeightCount=0,this.resetTotalRowsHeight();var e=ad(t,"cellHeight",60),i=ad(t,"cellWidth",60);return this.setDefaultCellHeight(e),this.setDefaultCellWidth(i),this.initCells(ad(t,"cellsCount",0)),this.setColumnCount(ad(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=Md(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?w:E,this.repeatCounter=0,this}stop(){return this.state=_,this}update(t,e){this.state!==_&&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 _:case E:case A:t=0;break;case w:t=this.nowTime/this.duration;break;case R:t=1}return b(t,0,1)}set t(t){(t=b(t,-1,1))<0?(this.state=E,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===_}get isDelay(){return this.state===E}get isCountDown(){return this.state===w}get isRunning(){return this.state===E||this.state===w}get isDone(){return this.state===R}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}}const _=0,E=1,w=2,A=3,R=-1;class V extends D{constructor(t,e){super(t,e),this.timer=new C}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,L=Phaser.Utils.Objects.GetAdvancedValue,O=Phaser.Tweens.Builders.GetEaseFunction;class F 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(L(t,"delay",0)),this.setDuration(L(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=O(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 Y=Phaser.Utils.Objects.GetValue,z=Phaser.Math.Linear;class j 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=Y(t,"key","value");var i=e[this.propertyKey];return this.fromValue=Y(t,"from",i),this.toValue=Y(t,"to",i),this.setEase(Y(t,"ease",this.ease)),this.setDuration(Y(t,"duration",this.duration)),this.setRepeat(Y(t,"repeat",0)),this.setDelay(Y(t,"delay",0)),this.setRepeatDelay(Y(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]=z(this.fromValue,this.toValue,i)}}const x=Phaser.Math.Percent;var M={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=x(t,e,i)),void 0===this.easeValueTask&&(this.easeValueTask=new j(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 j(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 B=Phaser.Utils.Objects.GetValue,N=Phaser.Math.Clamp;var G={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 Q=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 H=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),Q(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};const Pt=Phaser.Utils.Objects.GetValue,Dt=Phaser.Utils.Objects.IsPlainObject;class St extends(function(t){class e extends t{bootProgressBase(t){this.eventEmitter=B(t,"eventEmitter",this);var e=B(t,"valuechangeCallback",null);if(null!==e){var i=B(t,"valuechangeCallbackScope",void 0);this.eventEmitter.on("valuechange",e,i)}return this.setEaseValuePropName("value").setEaseValueDuration(B(t,"easeValue.duration",0)).setEaseValueFunction(B(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,M),e}(h)){constructor(t,e,i,s,r,a,h,n){Dt(e)?(e=Pt(n=e,"x",0),i=Pt(n,"y",0),s=Pt(n,"width",2),r=Pt(n,"height",2),a=Pt(n,"barColor",void 0),h=Pt(n,"value",0)):Dt(s)?(s=Pt(n=s,"width",2),r=Pt(n,"height",2),a=Pt(n,"barColor",void 0),h=Pt(n,"value",0)):Dt(a)&&(a=Pt(n=a,"barColor",void 0),h=Pt(n,"value",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).close();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).close());var n=this.getShape("trackStroke");n.lineStyle(this.trackStrokeThickness,this.trackStrokeColor),n.isStroked&&kt(n,0,0,e,i,t).end()}};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(); +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?w:E,this.repeatCounter=0,this}stop(){return this.state=_,this}update(t,e){this.state!==_&&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 _:case E:case A:t=0;break;case w:t=this.nowTime/this.duration;break;case R:t=1}return b(t,0,1)}set t(t){(t=b(t,-1,1))<0?(this.state=E,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===_}get isDelay(){return this.state===E}get isCountDown(){return this.state===w}get isRunning(){return this.state===E||this.state===w}get isDone(){return this.state===R}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}}const _=0,E=1,w=2,A=3,R=-1;class V extends D{constructor(t,e){super(t,e),this.timer=new C}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,L=Phaser.Utils.Objects.GetAdvancedValue,O=Phaser.Tweens.Builders.GetEaseFunction;class F 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(L(t,"delay",0)),this.setDuration(L(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=O(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 Y=Phaser.Utils.Objects.GetValue,z=Phaser.Math.Linear;class j 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=Y(t,"key","value");var i=e[this.propertyKey];return this.fromValue=Y(t,"from",i),this.toValue=Y(t,"to",i),this.setEase(Y(t,"ease",this.ease)),this.setDuration(Y(t,"duration",this.duration)),this.setRepeat(Y(t,"repeat",0)),this.setDelay(Y(t,"delay",0)),this.setRepeatDelay(Y(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]=z(this.fromValue,this.toValue,i)}}const x=Phaser.Math.Percent;var M={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=x(t,e,i)),void 0===this.easeValueTask&&(this.easeValueTask=new j(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 j(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 B=Phaser.Utils.Objects.GetValue,N=Phaser.Math.Clamp;var G={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 Q=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 H=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),Q(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=B(t,"eventEmitter",this);var e=B(t,"valuechangeCallback",null);if(null!==e){var i=B(t,"valuechangeCallbackScope",void 0);this.eventEmitter.on("valuechange",e,i)}return this.setEaseValuePropName("value").setEaseValueDuration(B(t,"easeValue.duration",0)).setEaseValueFunction(B(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,M),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 cd46a24b98..9e8a81d6b4 100644 --- a/dist/rexlineprogressplugin.js +++ b/dist/rexlineprogressplugin.js @@ -2357,6 +2357,7 @@ var skewX = this.skewX; var width = this.width - Math.abs(skewX); var height = this.height; + var trackFill = this.getShape('trackFill'); trackFill.fillStyle(this.trackColor); if (trackFill.isFilled) { @@ -2365,8 +2366,7 @@ 0, 0, // x0, y0 width, height, // x1, y1 skewX // skewX - ) - .close(); + ); } var bar = this.getShape('bar'); @@ -2386,8 +2386,7 @@ barX0, 0, // x0, y0 barX1, height, // x1, y1 skewX // skew - ) - .close(); + ); } var trackStroke = this.getShape('trackStroke'); @@ -2398,8 +2397,7 @@ 0, 0, // x0, y0 width, height, // x1, y1 skewX // skewX - ) - .end(); + ); } }; @@ -2419,6 +2417,8 @@ .lineTo(x0, y0).lineTo(startX, y0); } + lines.close(); + return lines; }; @@ -2429,24 +2429,33 @@ constructor(scene, x, y, width, height, barColor, value, config) { if (IsPlainObject(x)) { config = x; - x = GetValue(config, 'x', 0); - y = GetValue(config, 'y', 0); - width = GetValue(config, 'width', 2); - height = GetValue(config, 'height', 2); - barColor = GetValue(config, 'barColor', undefined); - value = GetValue(config, 'value', 0); + + x = config.x; + y = config.y; + width = config.width; + height = config.height; + barColor = config.barColor; + value = config.value; } else if (IsPlainObject(width)) { config = width; - width = GetValue(config, 'width', 2); - height = GetValue(config, 'height', 2); - barColor = GetValue(config, 'barColor', undefined); - value = GetValue(config, 'value', 0); + + width = config.width; + height = config.height; + barColor = config.barColor; + value = config.value; } else if (IsPlainObject(barColor)) { config = barColor; - barColor = GetValue(config, 'barColor', undefined); - value = GetValue(config, 'value', 0); + + barColor = config.barColor; + value = config.value; } + if (x === undefined) { x = 0; } + if (y === undefined) { y = 0; } + if (width === undefined) { width = 2; } + if (height === undefined) { height = width; } + if (value === undefined) { value = 0; } + super(scene, x, y, width, height, config); this.type = 'rexLineProgress'; diff --git a/dist/rexlineprogressplugin.min.js b/dist/rexlineprogressplugin.min.js index d28f27f110..0844f5301d 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 d,p=i.geom,c=0,v=p.length;c0?-this.delay:0,this.state=this.nowTime>=0?w:E,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=R)):(this.nowTime=this.duration,this.state=A):this.nowTime>=0&&(this.state=w))}get t(){var t;switch(this.state){case _:case E: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=E,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===_}get isDelay(){return this.state===E}get isCountDown(){return this.state===w}get isRunning(){return this.state===E||this.state===w}get isDone(){return this.state===A}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}}const _=0,E=1,w=2,R=3,A=-1;class V extends D{constructor(t,e){super(t,e),this.timer=new C}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,O=Phaser.Tweens.Builders.GetEaseFunction;class j 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=O(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 j{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 z=Phaser.Math.Percent;var B={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=z(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 M=Phaser.Utils.Objects.GetValue,G=Phaser.Math.Clamp;var N={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 Q=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 H=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),Q(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};const Pt=Phaser.Utils.Objects.GetValue,Dt=Phaser.Utils.Objects.IsPlainObject;class bt extends(function(t){class e extends t{bootProgressBase(t){this.eventEmitter=M(t,"eventEmitter",this);var e=M(t,"valuechangeCallback",null);if(null!==e){var i=M(t,"valuechangeCallbackScope",void 0);this.eventEmitter.on("valuechange",e,i)}return this.setEaseValuePropName("value").setEaseValueDuration(M(t,"easeValue.duration",0)).setEaseValueFunction(M(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,B),e}(h)){constructor(t,e,i,s,r,a,h,n){Dt(e)?(e=Pt(n=e,"x",0),i=Pt(n,"y",0),s=Pt(n,"width",2),r=Pt(n,"height",2),a=Pt(n,"barColor",void 0),h=Pt(n,"value",0)):Dt(s)?(s=Pt(n=s,"width",2),r=Pt(n,"height",2),a=Pt(n,"barColor",void 0),h=Pt(n,"value",0)):Dt(a)&&(a=Pt(n=a,"barColor",void 0),h=Pt(n,"value",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 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&&kt(s,0,0,e,i,t).close();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).close());var n=this.getShape("trackStroke");n.lineStyle(this.trackStrokeThickness,this.trackStrokeColor),n.isStroked&&kt(n,0,0,e,i,t).end()}};function Tt(t,e,i,s,r,a,h){var n=new bt(this.scene,t,e,i,s,r,a,h);return this.scene.add.existing(n),n}Object.assign(bt.prototype,St);const Ct=Phaser.GameObjects.BuildGameObject;function _t(t,e){void 0===t&&(t={}),void 0!==e&&(t.add=e);var i=new bt(this.scene,t);return Ct(this.scene,i,t),i}var Et=function(t){return null==t||""===t||0===t.length};class wt extends Phaser.Plugins.BasePlugin{constructor(t){super(t),t.registerGameObject("rexLineProgress",Tt,_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:E,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=R)):(this.nowTime=this.duration,this.state=A):this.nowTime>=0&&(this.state=w))}get t(){var t;switch(this.state){case _:case E: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=E,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===_}get isDelay(){return this.state===E}get isCountDown(){return this.state===w}get isRunning(){return this.state===E||this.state===w}get isDone(){return this.state===A}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}}const _=0,E=1,w=2,R=3,A=-1;class V extends D{constructor(t,e){super(t,e),this.timer=new C}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,O=Phaser.Tweens.Builders.GetEaseFunction;class j 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=O(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 j{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 z=Phaser.Math.Percent;var B={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=z(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 M=Phaser.Utils.Objects.GetValue,G=Phaser.Math.Clamp;var N={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 Q=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 H=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),Q(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 bt extends(function(t){class e extends t{bootProgressBase(t){this.eventEmitter=M(t,"eventEmitter",this);var e=M(t,"valuechangeCallback",null);if(null!==e){var i=M(t,"valuechangeCallbackScope",void 0);this.eventEmitter.on("valuechange",e,i)}return this.setEaseValuePropName("value").setEaseValueDuration(M(t,"easeValue.duration",0)).setEaseValueFunction(M(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,B),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 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&&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 bt(this.scene,t,e,i,s,r,a,h);return this.scene.add.existing(n),n}Object.assign(bt.prototype,St);const Ct=Phaser.GameObjects.BuildGameObject;function _t(t,e){void 0===t&&(t={}),void 0!==e&&(t.add=e);var i=new bt(this.scene,t);return Ct(this.scene,i,t),i}var Et=function(t){return null==t||""===t||0===t.length};class wt extends Phaser.Plugins.BasePlugin{constructor(t){super(t),t.registerGameObject("rexLineProgress",Tt,_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;a 0) && (radius.y > 0)); + }; + const IsPlainObject$i = Phaser.Utils.Objects.IsPlainObject; const GetValue$W = Phaser.Utils.Objects.GetValue; const Earcut = Phaser.Geom.Polygon.Earcut; @@ -49067,8 +49071,7 @@ void main () { geom.setTo(0, 0, width, height, radius); } - var iteration = GetValue$W(radiusConfig, 'iteration', undefined); - this.setIteration(iteration); + this.setIteration(GetValue$W(radiusConfig, 'iteration', undefined)); this.setPosition(x, y); this.setFillStyle(fillColor, fillAlpha); @@ -49321,10 +49324,6 @@ void main () { } - var IsArcCorner = function (radius) { - return ((radius.x > 0) && (radius.y > 0)); - }; - const ShapeTypeMap = { rectangle: 0, circle: 1 @@ -49538,6 +49537,7 @@ void main () { var skewX = this.skewX; var width = this.width - Math.abs(skewX); var height = this.height; + var trackFill = this.getShape('trackFill'); trackFill.fillStyle(this.trackColor); if (trackFill.isFilled) { @@ -49546,8 +49546,7 @@ void main () { 0, 0, // x0, y0 width, height, // x1, y1 skewX // skewX - ) - .close(); + ); } var bar = this.getShape('bar'); @@ -49567,8 +49566,7 @@ void main () { barX0, 0, // x0, y0 barX1, height, // x1, y1 skewX // skew - ) - .close(); + ); } var trackStroke = this.getShape('trackStroke'); @@ -49579,8 +49577,7 @@ void main () { 0, 0, // x0, y0 width, height, // x1, y1 skewX // skewX - ) - .end(); + ); } }; @@ -49600,6 +49597,8 @@ void main () { .lineTo(x0, y0).lineTo(startX, y0); } + lines.close(); + return lines; }; @@ -49610,24 +49609,33 @@ void main () { constructor(scene, x, y, width, height, barColor, value, config) { if (IsPlainObject$h(x)) { config = x; - x = GetValue$U(config, 'x', 0); - y = GetValue$U(config, 'y', 0); - width = GetValue$U(config, 'width', 2); - height = GetValue$U(config, 'height', 2); - barColor = GetValue$U(config, 'barColor', undefined); - value = GetValue$U(config, 'value', 0); + + x = config.x; + y = config.y; + width = config.width; + height = config.height; + barColor = config.barColor; + value = config.value; } else if (IsPlainObject$h(width)) { config = width; - width = GetValue$U(config, 'width', 2); - height = GetValue$U(config, 'height', 2); - barColor = GetValue$U(config, 'barColor', undefined); - value = GetValue$U(config, 'value', 0); + + width = config.width; + height = config.height; + barColor = config.barColor; + value = config.value; } else if (IsPlainObject$h(barColor)) { config = barColor; - barColor = GetValue$U(config, 'barColor', undefined); - value = GetValue$U(config, 'value', 0); + + barColor = config.barColor; + value = config.value; } + if (x === undefined) { x = 0; } + if (y === undefined) { y = 0; } + if (width === undefined) { width = 2; } + if (height === undefined) { height = width; } + if (value === undefined) { value = 0; } + super(scene, x, y, width, height, config); this.type = 'rexLineProgress'; diff --git a/dist/rexmdscenario.min.js b/dist/rexmdscenario.min.js index 2b8f30a307..4d29048a10 100644 --- a/dist/rexmdscenario.min.js +++ b/dist/rexmdscenario.min.js @@ -20,7 +20,7 @@ https://github.com/mholt/PapaParse License: MIT */ -!function(t){t.exports=function t(){var e="undefined"!=typeof self?self:"undefined"!=typeof window?window:void 0!==e?e:{},i=!e.document&&!!e.postMessage,s=e.IS_PAPA_WORKER||!1,r={},n=0,a={parse:function(i,s){var o=(s=s||{}).dynamicTyping||!1;if(C(o)&&(s.dynamicTypingFunction=o,o={}),s.dynamicTyping=o,s.transform=!!C(s.transform)&&s.transform,s.worker&&a.WORKERS_SUPPORTED){var h=function(){if(!a.WORKERS_SUPPORTED)return!1;var i,s,o=(i=e.URL||e.webkitURL||null,s=t.toString(),a.BLOB_URL||(a.BLOB_URL=i.createObjectURL(new Blob(["var global = (function() { if (typeof self !== 'undefined') { return self; } if (typeof window !== 'undefined') { return window; } if (typeof global !== 'undefined') { return global; } return {}; })(); global.IS_PAPA_WORKER=true; ","(",s,")();"],{type:"text/javascript"})))),h=new e.Worker(o);return h.onmessage=v,h.id=n++,r[h.id]=h}();return h.userStep=s.step,h.userChunk=s.chunk,h.userComplete=s.complete,h.userError=s.error,s.step=C(s.step),s.chunk=C(s.chunk),s.complete=C(s.complete),s.error=C(s.error),delete s.worker,void h.postMessage({input:i,config:s,workerId:h.id})}var p=null;return a.NODE_STREAM_INPUT,"string"==typeof i?(i=function(t){return 65279===t.charCodeAt(0)?t.slice(1):t}(i),p=s.download?new l(s):new c(s)):!0===i.readable&&C(i.read)&&C(i.on)?p=new d(s):(e.File&&i instanceof File||i instanceof Object)&&(p=new u(s)),p.stream(i)},unparse:function(t,e){var i=!1,s=!0,r=",",n="\r\n",o='"',h=o+o,l=!1,u=null,c=!1;!function(){if("object"==typeof e){if("string"!=typeof e.delimiter||a.BAD_DELIMITERS.filter((function(t){return-1!==e.delimiter.indexOf(t)})).length||(r=e.delimiter),("boolean"==typeof e.quotes||"function"==typeof e.quotes||Array.isArray(e.quotes))&&(i=e.quotes),"boolean"!=typeof e.skipEmptyLines&&"string"!=typeof e.skipEmptyLines||(l=e.skipEmptyLines),"string"==typeof e.newline&&(n=e.newline),"string"==typeof e.quoteChar&&(o=e.quoteChar),"boolean"==typeof e.header&&(s=e.header),Array.isArray(e.columns)){if(0===e.columns.length)throw new Error("Option columns is empty");u=e.columns}void 0!==e.escapeChar&&(h=e.escapeChar+o),("boolean"==typeof e.escapeFormulae||e.escapeFormulae instanceof RegExp)&&(c=e.escapeFormulae instanceof RegExp?e.escapeFormulae:/^[=+\-@\t\r].*$/)}}();var d=new RegExp(g(o),"g");if("string"==typeof t&&(t=JSON.parse(t)),Array.isArray(t)){if(!t.length||Array.isArray(t[0]))return p(null,t,l);if("object"==typeof t[0])return p(u||Object.keys(t[0]),t,l)}else if("object"==typeof t)return"string"==typeof t.data&&(t.data=JSON.parse(t.data)),Array.isArray(t.data)&&(t.fields||(t.fields=t.meta&&t.meta.fields||u),t.fields||(t.fields=Array.isArray(t.data[0])?t.fields:"object"==typeof t.data[0]?Object.keys(t.data[0]):[]),Array.isArray(t.data[0])||"object"==typeof t.data[0]||(t.data=[t.data])),p(t.fields||[],t.data||[],l);throw new Error("Unable to serialize unrecognized input");function p(t,e,i){var a="";"string"==typeof t&&(t=JSON.parse(t)),"string"==typeof e&&(e=JSON.parse(e));var o=Array.isArray(t)&&0=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}),X();if(z===f-1)return X(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 X();function Y(t){x.push(t),w=u}function W(t){var e=0;if(-1!==t){var i=a.substring(z+1,t);i&&""===i.trim()&&(e=i.length)}return e}function X(t){return p||(void 0===t&&(t=a.substring(u)),S.push(t),u=f,Y(S),b&&H()),V()}function $(t){u=t,Y(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(Pr(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;var Yr=function(t,e){if(void 0===e?e=new zr:!0===e&&(void 0===Wr&&(Wr=new zr),e=Wr),t.getBounds)return t.getBounds(e);var i,s,r,n,a,o,h,l;if(t.parentContainer){var u=t.parentContainer.getBoundsTransformMatrix();Xr(t,e),u.transformPoint(e.x,e.y,e),i=e.x,s=e.y,$r(t,e),u.transformPoint(e.x,e.y,e),r=e.x,n=e.y,Vr(t,e),u.transformPoint(e.x,e.y,e),a=e.x,o=e.y,Hr(t,e),u.transformPoint(e.x,e.y,e),h=e.x,l=e.y}else Xr(t,e),i=e.x,s=e.y,$r(t,e),r=e.x,n=e.y,Vr(t,e),a=e.x,o=e.y,Hr(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,Xr=function(t,e,i){return void 0===e?e=new Nr:!0===e&&(void 0===Ur&&(Ur=new Nr),e=Ur),t.getTopLeft?t.getTopLeft(e):(e.x=t.x-Ir(t)*t.originX,e.y=t.y-jr(t)*t.originY,qr(t,e,i))},$r=function(t,e,i){return void 0===e?e=new Nr:!0===e&&(void 0===Ur&&(Ur=new Nr),e=Ur),t.getTopRight?t.getTopRight(e):(e.x=t.x-Ir(t)*t.originX+Ir(t),e.y=t.y-jr(t)*t.originY,qr(t,e,i))},Vr=function(t,e,i){return void 0===e?e=new Nr:!0===e&&(void 0===Ur&&(Ur=new Nr),e=Ur),t.getBottomLeft?t.getBottomLeft(e):(e.x=t.x-Ir(t)*t.originX,e.y=t.y-jr(t)*t.originY+jr(t),qr(t,e,i))},Hr=function(t,e,i){return void 0===e?e=new Nr:!0===e&&(void 0===Ur&&(Ur=new Nr),e=Ur),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),qr(t,e,i))},Ur=void 0,qr=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 Kr=Phaser.Utils.Objects.GetValue;var Jr=function(t,e,i){var s,r,n,a,o;if("number"==typeof i?s=i:(s=Kr(i,"color"),r=Kr(i,"lineWidth"),n=Kr(i,"fillColor"),a=Kr(i,"fillAlpha",1),o=Kr(i,"padding",0)),Array.isArray(t))for(var h=0,l=t.length;h0?-this.delay:0,this.state=this.nowTime>=0?Un:Hn,this.repeatCounter=0,this}stop(){return this.state=Vn,this}update(t,e){this.state!==Vn&&this.state!==Kn&&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=Kn):this.nowTime>=0&&(this.state=Un))}get t(){var t;switch(this.state){case Vn:case Hn:case qn:t=0;break;case Un:t=this.nowTime/this.duration;break;case Kn:t=1}return Xn(t,0,1)}set t(t){(t=Xn(t,-1,1))<0?(this.state=Hn,this.nowTime=-this.delay*t):(this.state=Un,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===Vn}get isDelay(){return this.state===Hn}get isCountDown(){return this.state===Un}get isRunning(){return this.state===Hn||this.state===Un}get isDone(){return this.state===Kn}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}};const Vn=0,Hn=1,Un=2,qn=3,Kn=-1;class Jn extends Gn{constructor(t,e){super(t,e),this.timer=new $n}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 Zn=Phaser.Utils.Objects.GetValue,Qn=Phaser.Utils.Objects.GetAdvancedValue,ta=Phaser.Tweens.Builders.GetEaseFunction;class ea extends Jn{resetFromJSON(t){return this.timer.resetFromJSON(Zn(t,"timer")),this.setEnable(Zn(t,"enable",!0)),this.setTarget(Zn(t,"target",this.parent)),this.setDelay(Qn(t,"delay",0)),this.setDuration(Qn(t,"duration",1e3)),this.setEase(Zn(t,"ease","Linear")),this.setRepeat(Zn(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=ta(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 ia=Phaser.Sound.BaseSound;var sa=function(t){return t instanceof ia};const ra=Phaser.Utils.Objects.GetValue,na=Phaser.Utils.Objects.GetAdvancedValue,aa=Phaser.Math.Linear;let oa=class extends ea{constructor(t,e,i){sa(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(ra(t,"mode",0)),this.setEnable(ra(t,"enable",!0)),this.setVolumeRange(na(t,"volume.start",this.parent.volume),na(t,"volume.end",0)),this}setMode(t){return"string"==typeof t&&(t=ha[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=aa(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 ha={stop:1,destroy:2};var la=function(t,e,i,s,r){sa(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 oa(t,e,a),e._fade=n),n.start(),e.isPlaying||e.setVolume(r).play(),e},ua=function(t,e,i,s){sa(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 oa(t,e,n),e._fade=r),r.start(),e.isPlaying||e.play(),e};const ca=Phaser.Utils.Objects.GetValue;var da={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:ca(e,"loop",this.backgroundMusicLoop),mute:ca(e,"mute",this.backgroundMusicMute),volume:ca(e,"volume",this.backgroundMusicVolume),detune:ca(e,"detune",0),rate:ca(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&&la(this.backgroundMusic,t,this.backgroundMusicVolume,0),this},fadeOutBackgroundMusic(t,e){return this.backgroundMusic&&ua(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 pa=Phaser.Utils.Objects.GetValue;var ga={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:pa(e,"loop",this.backgroundMusicLoop),mute:pa(e,"mute",this.backgroundMusic2Mute),volume:pa(e,"volume",this.backgroundMusic2Volume),detune:pa(e,"detune",0),rate:pa(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&&la(this.backgroundMusic2,t,this.backgroundMusic2Volume,0),this},fadeOutBackgroundMusic2(t,e){return this.backgroundMusic2&&ua(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 fa=Phaser.Utils.Array.Remove,va=Phaser.Utils.Objects.GetValue;var ma={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:va(e,"mute",this.soundEffectsMute),volume:va(e,"volume",this.soundEffectsVolume),detune:va(e,"detune",0),rate:va(e,"rate",1)});return this.soundEffects.push(i),i.once("complete",(function(){i.destroy(),this.sound&&fa(this.soundEffects,i)}),this).once("destroy",(function(){this.sound&&fa(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&&la(e,t,this.soundEffectsVolume,0),this},fadeOutSoundEffect(t,e){var i=this.getLastSoundEffect();return i&&ua(i,t,e),this},fadeOutAllSoundEffects(t,e){for(var i=this.soundEffects.length-1;i>=0;i--)ua(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&&la(e,t,this.soundEffects2Volume,0),this},fadeOutSoundEffect2(t,e){var i=this.getLastSoundEffect2();return i&&ua(i,t,e),this},fadeOutAllSoundEffects2(t,e){for(var i=this.soundEffects2.length-1;i>=0;i--)ua(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 Da=Phaser.Utils.Objects.GetValue,Aa=new class extends Ma{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=Za(this.delimiterLeft),e=Za(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=io),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=no),this.tagExpression=t,this}setValueExpression(t){return t||(t=no),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!==no||this.valueExpression!==no){var s=`${this.tagExpression}(=${this.valueExpression})?`,r=`/${this.tagExpression}`;t=Za(this.delimiterLeft),e=Za(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=so(e[3],this.valueConverter);this.emit(`+${i}`,...r),this.skipEventFlag||this.emit("+",i,...r),this.lastTagStart=i}}}const no="[^=]+";var ao=[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()}))}],oo=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},ho=function(t,e){var i=Array.isArray(t);if(void 0===e?e=i?[]:{}:oo(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}},bo={"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}},xo={"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}},Co={"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}},ko={"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}},So=function(t){return!t.hasOwnProperty("logEnable")||t.logEnable},wo={log({text:t="",logType:e="log",showTitle:i=!0,title:s,titleColor:r="green"}={},n,a){return So(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(!So(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}},_o={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 Xo=class extends Wo{constructor(t){super(t,0,0,2,2),this.fullWindow=new Yo(this)}};const $o="BG",Vo="SPRITE",Ho="TEXTBOX",Uo="TITLE",qo="CHOICE",Ko="NAMEINPUT";var Jo=!1,Zo=function(t){Jo||(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 th(this.children,t,0,(function(t){t.once("destroy",e.onChildDestroy,e)}),this),this}remove(t,e){var i=this;return eh(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;ioh(t),resetChildState(t){return this.resetChildPositionState(t).resetChildVisibleState(t).resetChildAlphaState(t).resetChildActiveState(t),this},resetChildrenState(t){for(var e=0,i=t.length;eoh(t).x,getChildLocalY:t=>oh(t).y};const Sh=Phaser.Math.DegToRad;var wh={updateChildRotation(t){var e=oh(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=oh(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 oh(t).rotation=e,this.updateChildRotation(t),this},setChildLocalAngle(t,e){return oh(t).rotation=Sh(e),this.updateChildRotation(t),this},resetLocalRotationState(){var t=oh(this).parent;return t&&t.resetChildRotationState(this),this},getChildLocalRotation:t=>oh(t).rotation},_h={updateChildScale(t){var e=oh(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=oh(t),i=e.parent;return e.scaleX=Ch(t.scaleX,i.scaleX),e.scaleY=Ch(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=oh(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=oh(this).parent;return t&&t.resetChildScaleState(this),this},getChildLocalScaleX:t=>oh(t).scaleX,getChildLocalScaleY:t=>oh(t).scaleY},Eh={updateChildVisible(t){var e=oh(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=oh(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),oh(t).visible=e,this.updateChildVisible(t),this},setChildMaskVisible(t,e){return void 0===e&&(e=!0),oh(t).maskVisible=e,this.updateChildVisible(t),this},resetLocalVisibleState(){var t=oh(this).parent;return t&&t.resetChildVisibleState(this),this},getChildLocalVisible:t=>oh(t).visible},Th={updateChildAlpha(t){var e=oh(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=oh(t),i=e.parent;return e.alpha=Ch(t.alpha,i.alpha),this},setChildAlpha(t,e){return t.alpha=e,this.resetChildAlphaState(t),this},setChildLocalAlpha(t,e){return oh(t).alpha=e,this.updateChildAlpha(t),this},resetLocalAlphaState(){var t=oh(this).parent;return t&&t.resetChildAlphaState(this),this},getChildLocalAlpha:t=>oh(t).alpha},Ph={updateChildActive(t){var e=oh(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 oh(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),oh(t).active=e,this.updateChildActive(t),this},resetLocalActiveState(){var t=oh(this).parent;return t&&t.resetChildActiveState(this),this},getChildLocalActive:t=>oh(t).active},Oh={updateChildScrollFactor(t){var e=oh(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}},Mh={updateCameraFilter(t){var e=oh(t),i=e.parent;return e.syncCameraFilter&&(t.cameraFilter=i.cameraFilter),this},syncCameraFilter(){return this.syncChildrenEnable&&this.children.forEach(this.updateCameraFilter,this),this}},Dh={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}},Ah=function(t){return t.filter((function(t){return!!t.displayList||(!!t.parentContainer||void 0)}))},Lh={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}},Rh=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 Bh=Phaser.Utils.Array;var Ih={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 P=b+k*_+a*k,O=x+S*w+o*S;E.setOrigin(a,o).setPosition(P,O).setScale(f,v).setRotation(m),Ol(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(zl.prototype,Al);const Gl={fit:1,FIT:1,envelop:2,ENVELOP:2};const Yl=Phaser.GameObjects.GetCalcMatrix;const Wl=Phaser.Renderer.Canvas.SetTransform;var Xl={renderWebGL:function(t,e,i,s){e.updateData(),i.addToRenderList(e);var r=t.pipelines.set(e.pipeline),n=Yl(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+")"},iu=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 su=Phaser.Geom.Polygon.Earcut;class ru extends Kl{constructor(){super(),this.pathData=[],this.pathIndexes=[],this.closePath=!1}updateData(){return this.pathIndexes=su(this.pathData),super.updateData(),this}webglRender(t,e,i,s,r){this.isFilled&&Zl(t,e,this,i,s,r),this.isStroked&&tu(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 au=Phaser.Math.DegToRad;var ou=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=Fu(t,"tl",0),this.radiusTR=Fu(t,"tr",0),this.radiusBL=Fu(t,"bl",0),this.radiusBR=Fu(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?ou(e,e,e,e,180,270,!1,r,t):ou(0,0,e,e,90,0,!0,r,t):nu(0,0,t);(e=this.radiusTR)>0?this._convexTR?ou(i-e,e,e,e,270,360,!1,r,t):ou(i,0,e,e,180,90,!0,r,t):nu(i,0,t);(e=this.radiusBR)>0?this._convexBR?ou(i-e,s-e,e,e,0,90,!1,r,t):ou(i,s,e,e,270,180,!0,r,t):nu(i,s,t);(e=this.radiusBL)>0?this._convexBL?ou(e,s-e,e,e,90,180,!1,r,t):ou(0,s,e,e,360,270,!0,r,t):nu(0,s,t);return t.push(t[0],t[1]),mu(this.x,this.y,t),super.updateData(),this}},triangle:class extends Kl{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=Bu(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&&tu(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&&(eu(t,this),t.fill()),this.isStroked&&(iu(t,this),t.stroke())}}},ju=Phaser.Utils.Objects.GetValue,zu=Phaser.Utils.Objects.IsPlainObject,Nu=function(){for(var t=this.getShapes(),e=0,i=t.length;e=0;s--)(a=r[s])instanceof e&&(a.destroy(),dc(r,s));else{s=0;for(var r,n=(r=t.postPipelines).length;s0}(e,uc),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(pc,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(pc,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(pc,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(pc,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 fc extends zl{constructor(t,e,i,s,r,n){super(t,e,i,s,r,n);for(var a=0,o=gc.length;a0?t.setText(e).getTextBounds().wrappedText.split("\n"):e.split("\n")}return i},zc=function(t){return null==t?t="":Array.isArray(t)?t=t.join("\n"):"number"==typeof t&&(t=t.toString()),t},Nc={clearText(){return this.sections.length=0,this.pageStartIndexes.length=0,this.lines.length=0,this},appendPage(t){var e=this.totalLinesCount;this.sections.push(zc(t));t=this.sections.join("\n");this.lines=jc(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($c,Nc,Yc,Xc);const Vc=Phaser.Utils.Objects.GetValue;Phaser.Math.Clamp;class Hc extends Bn{constructor(t,e){super(t,{eventEmitter:!1}),this.textObjectType=Ic(this.parent),this.pageStartIndexes=[],this.lines=jc(this.parent,""),this.sections=[],this.resetFromJSON(e)}resetFromJSON(t){this.setMaxLines(Vc(t,"maxLines",void 0)),this.setPageBreak(Vc(t,"pageBreak","\f\n")),this.setText(Vc(t,"text","")),this.startLineIndex=Vc(t,"start",-1),this.endLineIndex=Vc(t,"end",void 0);var e=Vc(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(Ic(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(Hc.prototype,$c);var Uc={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?Wc(this.parent,t):this.parent.setText(t)},appendText(t){var e=this.text.concat(zc(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},Kc=function(t,e){for(var i=void 0,s=0;s0)l=Jc(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=Jc(n,t,a,o)}else c="",this.insertIndex=0;r=c+l}return this.insertChar=r.charAt(this.insertIndex-1),r},Qc={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=Kc(a,e)+s}return this.start(t,i,n,r)},stop:function(t){if(this.getTimer()&&this.freeTimer(),t){for(;!this.isLastChar;)Zc.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(Qc,Uc);const td=Phaser.Utils.Objects.GetFastValue,ed=Phaser.Utils.Objects.GetValue;class id extends Bn{constructor(t,e){super(t,e),this.timer=null,this.resetFromJSON(e)}resetFromJSON(t){this.setTextWrapEnable(ed(t,"wrap",!1)),this.setTypeMode(ed(t,"typeMode",0)),this.setTypingSpeed(ed(t,"speed",333)),this.setTextCallback=td(t,"setTextCallback",null),this.setTextCallbackScope=td(t,"setTextCallbackScope",null),this.setTypingContent(td(t,"text","")),this.typingIndex=td(t,"typingIndex",0),this.insertIndex=null,this.insertChar=null;var e=td(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=sd[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=zc(t);this.textWrapEnable&&(e=function(t,e){switch(Ic(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=Zc.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?Wc(this.parent,t):this.parent.setText(t)}}const sd={"left-to-right":0,"right-to-left":1,"middle-to-sides":2,"sides-to-middle":3};Object.assign(id.prototype,Qc);const rd=Phaser.Utils.Objects.GetValue;const nd={page:0,line:1};var ad=function(t){return t.hasOwnProperty("rexSizer")||(t.rexSizer={}),t.rexSizer};const od=Phaser.Display.Align;var hd={center:od.CENTER,left:od.LEFT_CENTER,right:od.RIGHT_CENTER,top:od.TOP_CENTER,bottom:od.BOTTOM_CENTER,"left-top":od.TOP_LEFT,"top-left":od.TOP_LEFT,"left-center":od.LEFT_CENTER,"center-left":od.LEFT_CENTER,"left-bottom":od.BOTTOM_LEFT,"bottom-left":od.BOTTOM_LEFT,"center-top":od.TOP_CENTER,"top-center":od.TOP_CENTER,"center-center":od.CENTER,"center-bottom":od.BOTTOM_CENTER,"bottom-center":od.BOTTOM_CENTER,"right-top":od.TOP_RIGHT,"top-right":od.TOP_RIGHT,"right-center":od.RIGHT_CENTER,"center-right":od.RIGHT_CENTER,"right-bottom":od.BOTTOM_RIGHT,"bottom-right":od.BOTTOM_RIGHT},ld=function(){},ud=new Phaser.GameObjects.Zone({sys:{queueDepthSort:ld,events:{once:ld}}},0,0,1,1);ud.setOrigin(0);var cd=0,dd=1,pd=2,gd=4,fd=6,vd=8,md=10,yd=12,bd=function(t){var e=jr(t);return t.y+e-e*t.originY},xd=function(t){var e=Ir(t);return t.x-e*t.originX+.5*e},Cd=function(t,e){var i=jr(t);return t.y=e-i+i*t.originY,t},kd=function(t,e){var i=Ir(t),s=i*t.originX;return t.x=e+s-.5*i,t},Sd=function(t){var e=Ir(t);return t.x-e*t.originX},wd=function(t,e){var i=Ir(t);return t.x=e+i*t.originX,t},_d=function(t){var e=Ir(t);return t.x+e-e*t.originX},Ed=function(t,e){var i=Ir(t);return t.x=e-i+i*t.originX,t},Td=function(t,e){var i=jr(t),s=i*t.originY;return t.y=e+s-.5*i,t},Pd=function(t){var e=jr(t);return t.y-e*t.originY+.5*e},Od=function(t){var e=jr(t);return t.y-e*t.originY},Md=function(t,e){var i=jr(t);return t.y=e+i*t.originY,t},Dd=[];Dd[11]=function(t,e,i,s){return void 0===i&&(i=0),void 0===s&&(s=0),kd(t,xd(e)+i),Cd(t,bd(e)+s),t},Dd[md]=function(t,e,i,s){return void 0===i&&(i=0),void 0===s&&(s=0),wd(t,Sd(e)-i),Cd(t,bd(e)+s),t},Dd[yd]=function(t,e,i,s){return void 0===i&&(i=0),void 0===s&&(s=0),Ed(t,_d(e)+i),Cd(t,bd(e)+s),t},Dd[fd]=function(t,e,i,s){return void 0===i&&(i=0),void 0===s&&(s=0),function(t,e,i){kd(t,e),Td(t,i)}(t,xd(e)+i,Pd(e)+s),t},Dd[gd]=function(t,e,i,s){return void 0===i&&(i=0),void 0===s&&(s=0),wd(t,Sd(e)-i),Td(t,Pd(e)+s),t},Dd[vd]=function(t,e,i,s){return void 0===i&&(i=0),void 0===s&&(s=0),Ed(t,_d(e)+i),Td(t,Pd(e)+s),t},Dd[dd]=function(t,e,i,s){return void 0===i&&(i=0),void 0===s&&(s=0),kd(t,xd(e)+i),Md(t,Od(e)-s),t},Dd[cd]=function(t,e,i,s){return void 0===i&&(i=0),void 0===s&&(s=0),wd(t,Sd(e)-i),Md(t,Od(e)-s),t},Dd[pd]=function(t,e,i,s){return void 0===i&&(i=0),void 0===s&&(s=0),Ed(t,_d(e)+i),Md(t,Od(e)-s),t};var Ad=function(t,e,i,s,r){return Dd[i](t,e,s,r)},Ld=function(t,e,i,s,r,n){ud.setPosition(e,i).setSize(s,r),Ad(t,ud,n)};const Rd=Phaser.Utils.Objects.GetValue,Fd=Phaser.GameObjects.Group;var Bd=function(t,e,i){return t.add.text(0,0,"")},Id=void 0;const jd=il.prototype.add;var zd=function(t){return jd.call(this,t),this.sizerEventsEnable&&(t.emit("sizer.add",t,this),this.emit("add",t,this)),this},Nd={addBackground(t,e,i){return void 0===this.backgroundChildren&&(this.backgroundChildren=[]),"string"==typeof e&&(i=e,e=void 0),void 0===e&&(e=0),zd.call(this,t),this.backgroundChildren.push(t),this.getSizerConfig(t).padding=xl(e),void 0!==i&&this.addChildrenMap(i,t),this},isBackground(t){return void 0!==this.backgroundChildren&&-1!==this.backgroundChildren.indexOf(t)}},Gd=function(t,e){var i=null;if(void 0===e)t.hasOwnProperty("rexContainer")&&((i=t.rexContainer.parent)?i.isRexSizer||(i=Gd(i)):i=null);else for(i=Gd(t);i&&i.name!==e;)i=Gd(i);return i},Yd={getParentSizer(t,e){return"string"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),Gd(t,e)},getTopmostSizer(t){return void 0===t&&(t=this),function(t){for(var e=Gd(t);e;)t=e,e=Gd(e);return t}(t)},hasParentSizer(t,e){void 0===e&&(e=this);for(var i=Gd(e);i;){if(i===t)return!0;i=Gd(i)}return!1},hasChild(t,e){return void 0===e&&(e=this),this.hasParentSizer(e,t)}};const Wd=Phaser.Utils.Array.Remove,Xd=il.prototype.remove,$d=Yd.getParentSizer;var Vd=function(t,e){for(var i=$d(t);i;)i.removeChildCallback&&i.removeChildCallback(t,e),i=$d(i);return this.isBackground(t)&&Wd(this.backgroundChildren,t),Xd.call(this,t,e),!e&&this.sizerEventsEnable&&(t.emit("sizer.remove",t,this),this.emit("remove",t,this)),this};const Hd=Phaser.Utils.Array.Remove,Ud=Yd.getParentSizer;var qd={removeFromParentSizer(){var t=Ud(gameObject);return t&&t.remove(this),this},removeBackground(t,e){return void 0===this.backgroundChildren||this.getParentSizer(t)!==this||(Hd(this.backgroundChildren,t),Vd.call(this,t,e)),this},removeAllBackgrounds(t){if(void 0===this.backgroundChildren)return this;for(var e=this.backgroundChildren.length-1;e>=0;e--)this.remove(this.backgroundChildren[e],t);return this}},Kd=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 Jd=/(\S+)\[(\d+)\]/i;const Zd=Phaser.Utils.Objects.GetValue;var Qd=function(t,e){return void 0===e?t:t[e]},tp=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=Zd(e,"left",0),t.right=Zd(e,"right",0),t.top=Zd(e,"top",0),t.bottom=Zd(e,"bottom",0)),t},ep={getInnerPadding(t){return Qd(this.space,t)},setInnerPadding(t,e){return tp(this.space,t,e),this},getOuterPadding(t){return Qd(this.getSizerConfig(this).padding,t)},setOuterPadding(t,e){return tp(this.getSizerConfig(this).padding,t,e),this},getChildOuterPadding(t,e){return"string"==typeof t&&(t=this.getElement(t)),Qd(this.getSizerConfig(t).padding,e)},setChildOuterPadding(t,e,i){return"string"==typeof t&&(t=this.getElement(t)),tp(this.getSizerConfig(t).padding,e,i),this}},ip=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}},sp=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},rp=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},np=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}},ap=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},op=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},hp={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}},lp=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 vg={delayCall(t,e,i){return this.delayCallTimer=function(t,e,i,s,r){var n=Dn(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}},mg={setTransitInTime(t){return this.transitInTime=t,this},setTransitOutTime(t){return this.transitOutTime=t,this},setTransitInCallback(t){return t||(t=ld),this.transitInCallback=t,this},setTransitOutCallback(t){return t||(t=ld),this.transitOutCallback=t,this}},yg={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}},bg={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}},xg={};Object.assign(xg,vg,mg,yg,bg);const Cg=Phaser.Utils.Objects.GetValue;class kg extends Bn{constructor(t,e){super(t,e),this.setTransitInTime(Cg(e,"duration.in",200)),this.setTransitOutTime(Cg(e,"duration.out",200)),this.setTransitInCallback(Cg(e,"transitIn")),this.setTransitOutCallback(Cg(e,"transitOut")),this.oneShotMode=Cg(e,"destroy",!1),this.delayCallTimer=void 0,this._state=new fg(this,{eventEmitter:!1,initState:Cg(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(kg.prototype,xg);const Sg=Phaser.GameObjects.Rectangle;class wg extends Sg{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 _g=Phaser.Utils.Objects.GetValue;class Eg extends Bn{constructor(t,e){super(t,{eventEmitter:!1}),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setHitAreaMode(_g(t,"hitAreaMode",0)),this.setEnable(_g(t,"enable",!0)),this.setStopMode(_g(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=Tg[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 Tg={default:0,fullWindow:1};const Pg=Phaser.Utils.Objects.GetValue;class Og extends wg{constructor(t,e){super(t,Pg(e,"color",0),Pg(e,"alpha",.8)),this.touchEventStop=new Eg(this,{hitAreaMode:1})}}var Mg={popUp(t,e){void 0!==t._modalScaleSave?(t.scaleX=t._modalScaleSave,t.scaleY=t._modalScaleSave):t._modalScaleSave=t.scaleX,wp(t,e)},scaleDown(t,e){_p(t,e,void 0,void 0,!1)},fadeIn(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Ip(t,e)},fadeOut(t,e){jp(t,e,!1)}},Dg=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Ip(t,e,t.alpha)},Ag=function(t,e){jp(t,e,!1)},Lg=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 Rg=Phaser.Utils.Objects.GetValue;let Fg=class extends kg{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=Bg.popUp),null==e.transitOut&&(e.transitOut=Bg.scaleDown),e.destroy=Rg(e,"destroy",!0),super(t,e);var i=Rg(e,"cover");this.cover=!1!==i?function(t,e){var i=t.scene,s=new Og(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(Rg(i,"transitIn",Dg)),this.setCoverTransitOutCallback(Rg(i,"transitOut",Ag)));var s=Rg(e,"touchOutsideClose",!1),r=Rg(e,"duration.hold",-1),n=Rg(e,"timeOutClose",r>=0),a=Rg(e,"anyTouchClose",!1);Rg(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),Rg(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&&Lg(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=Bg[t]),t){case Bg.popUp:t=Mg.popUp;break;case Bg.fadeIn:t=Mg.fadeIn}return super.setTransitInCallback(t),this}setTransitOutCallback(t){switch("string"==typeof t&&(t=Bg[t]),t){case Bg.scaleDown:t=Mg.scaleDown;break;case Bg.fadeOut:t=Mg.fadeOut}return super.setTransitOutCallback(t),this}setCoverTransitInCallback(t){return this.coverTransitInCallback=t,this}setCoverTransitOutCallback(t){return this.coverTransitOutCallback=t,this}};const Bg={popUp:0,fadeIn:1,scaleDown:0,fadeOut:1};var Ig=function(t){return t&&"function"==typeof t},jg={modal(t,e){return Ig(t)&&(e=t,t=void 0),void 0===this._modalBehavior&&(this.onCreateModalBehavior&&this.onCreateModalBehavior(this,t),this._modalBehavior=function(t,e){var i=new Fg(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}},zg=function(t,e,i,s,r){Ig(e)&&(r=s,s=i,i=e,e=this);var n=this.scene.events;return this.bindEvent(e,n,t,i,s,r),this},Ng={bindEvent(t,e,i,s,r,n){return"string"==typeof e&&(n=r,r=s,s=i,i=e,e=t,t=this),fo(t,e,i,s,r,n),this},bindScenePreupdateEvent(t,e,i,s){return zg.call(this,"preupdate",t,e,i,s),this},bindSceneUpdateEvent(t,e,i,s){return zg.call(this,"update",t,e,i,s),this},bindScenePostupdateEvent(t,e,i,s){return zg.call(this,"postupdate",t,e,i,s),this},bindSceneRenderEvent(t,e,i,s){return zg.call(this,"render",t,e,i,s),this},bindScenePauseEvent(t,e,i,s){return zg.call(this,"pause",t,e,i,s),this},bindSceneResumeEvent(t,e,i,s){return zg.call(this,"resume",t,e,i,s),this},bindSceneSleepEvent(t,e,i,s){return zg.call(this,"sleep",t,e,i,s),this},bindSceneWakeEvent(t,e,i,s){return zg.call(this,"wake",t,e,i,s),this},bindSceneShutdownEvent(t,e,i,s){return zg.call(this,"shutdown",t,e,i,s),this}},Gg=function(t,e,i){var s=t.camera;return s?(void 0===i?i={}:!0===i&&(i=Yg),s===e?(i.x=t.worldX,i.y=t.worldY):s.getWorldPoint(t.x,t.y,i),i):null},Yg={},Wg=function(t,e,i,s){var r,n=t.scene.sys.cameras.main,a=0===t.scrollFactorX&&0===t.scrollFactorY;if(e)return a?Lg(t,e.x,e.y,i,s):!!(r=Gg(e,n,!0))&&Lg(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 ef={press:0,pointerdown:0,release:1,pointerup:1};var sf={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 tf(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}},rf=function(t,e,i,s,r){if(e)return!(i&&!i(t,e))&&(!!nf(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 af.length=0,!0;return af.length=0,!1},af=[];const of=Phaser.Utils.Objects.GetValue;class hf extends Bn{constructor(t,e){super(t,e),this._enable=void 0;var i=of(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(of(t,"enable",!0)),this.setMode(of(t,"mode",1)),this.setClickInterval(of(t,"clickInterval",100)),this.setDragThreshold(of(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=lf[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?rf:Wg)(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 lf={press:0,pointerdown:0,release:1,pointerup:1};var uf={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 hf(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 gg{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 df=Phaser.Utils.Objects.GetValue;class pf extends Bn{constructor(t,e){super(t,e),this._enable=void 0,this.cooldown=new cf,this.parent.setInteractive(df(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.prevIsInTouch=!1,this.isInTouching=!1,this.setEnable(df(t,"enable",!0)),this.setCooldown(df(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 gf={isPointerInBounds(t){return void 0===t?t=this:"string"==typeof t&&(t=this.getElement(t)),!!t&&Wg(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 pf(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 pf(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}},ff={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}},vf=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=Af,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===Lf&&this.onDragEnd(),this.pointer=void 0,this.tracerState=Af,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=Rf,this}isPointerInGameObject(t,e,i){var s=this.lastPointer;return!!s&&Wg(t,s,e,i)}}const Af=0,Lf=1,Rf="IDLE",Ff=Phaser.Utils.Objects.GetValue,Bf=Phaser.Math.Distance.Between;class If extends Df{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=jf},eventEmitter:!1};this.setRecongizedStateObject(new gg(s))}resetFromJSON(t){super.resetFromJSON(t),this.setHoldTime(Ff(t,"time",250)),this.setTapInterval(Ff(t,"tapInterval",200)),this.setDragThreshold(Ff(t,"threshold",9)),this.setTapOffset(Ff(t,"tapOffset",10));var e=Ff(t,"taps",void 0);return void 0!==e?this.setTaps(e):(this.setMaxTaps(Ff(t,"maxTaps",void 0)),this.setMinTaps(Ff(t,"minTaps",void 0))),this}onDragStart(){switch(this.state){case jf:this.state=zf;break;case zf:var t=this.lastPointer;Bf(t.upX,t.upY,t.x,t.y)>this.tapOffset&&(this.state=Nf,this.state=zf);break;case Nf:this.state=zf}}onDragEnd(){this.state===zf&&(this.tapsCount++,this.emit("tapping",this,this.gameObject,this.lastPointer),void 0!==this.maxTaps&&this.tapsCount===this.maxTaps&&(this.state=Nf))}onDrag(){this.state!==jf&&this.pointer.getDistance()>this.dragThreshold&&(this.state=jf)}preUpdate(t,e){if(this.isRunning&&this.enable&&this.state===zf){var i=this.lastPointer;if(i.isDown)t-i.downTime>this.holdTime&&(this.state=jf);else t-i.upTime>this.tapInterval&&(void 0===this.minTaps||this.tapsCount>=this.minTaps?this.state=Nf:this.state=jf)}}postUpdate(t,e){this.isRunning&&this.enable&&this.state===Nf&&(this.state=jf)}get isTapped(){return this.state===Nf}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 jf="IDLE",zf="BEGIN",Nf="RECOGNIZED",Gf=Phaser.Utils.Objects.GetValue;class Yf extends Df{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=Wf},eventEmitter:!1};this.setRecongizedStateObject(new gg(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(Gf(t,"threshold",9)),this.setHoldTime(Gf(t,"time",251)),this}onDragStart(){this.state=Xf,0===this.holdTime&&(this.state=$f)}onDragEnd(){this.state=Wf}onDrag(){this.state!==Wf&&this.pointer.getDistance()>this.dragThreshold&&(this.state=Wf)}preUpdate(t,e){this.isRunning&&this.enable&&(this.state===Xf&&t-this.pointer.downTime>=this.holdTime&&(this.state=$f))}get isPressed(){return this.state===$f}setHoldTime(t){return this.holdTime=t,this}setDragThreshold(t){return this.dragThreshold=t,this}}const Wf="IDLE",Xf="BEGIN",$f="RECOGNIZED";Phaser.Utils.Objects.GetValue;var Vf=function(t){return Rn(t).loop.delta};const Hf=Phaser.Math.Distance.Between,Uf=Phaser.Math.Angle.Between;var qf={getDt:function(){return Vf(this.scene)},getVelocity:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Hf(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 Uf(e.x,e.y,t.x,t.y)}},Kf={"up&down":0,"left&right":1,"4dir":2,"8dir":3},Jf={};const Zf=Phaser.Utils.Objects.GetValue,Qf=Phaser.Math.RadToDeg;class tv extends Df{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=ev},eventEmitter:!1};this.setRecongizedStateObject(new gg(s)),this.clearDirectionStates()}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(Zf(t,"threshold",10)),this.setVelocityThreshold(Zf(t,"velocityThreshold",1e3)),this.setDirectionMode(Zf(t,"dir","8dir")),this}onDragStart(){this.state=iv}onDragEnd(){this.state=ev}onDrag(){this.state===iv&&(this.validDrag||(this.validDrag=0===this.dragThreshold||this.pointer.getDistance()>=this.dragThreshold),this.validDrag&&this.dragVelocity>this.velocityThreshold&&(this.state=sv))}postUpdate(t,e){this.isRunning&&this.enable&&this.state===sv&&(this.state=ev)}get isSwiped(){return this.state===sv}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=Kf[t]),this.dirMode=t,this}updateDirectionStates(){return function(t,e,i){switch(void 0===i?i={}:!0===i&&(i=Jf),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}}(Qf(this.getVelocityAngle()),this.dirMode,this),this}clearDirectionStates(){return this.left=!1,this.right=!1,this.up=!1,this.down=!1,this}}Object.assign(tv.prototype,qf);const ev="IDLE",iv="BEGIN",sv="RECOGNIZED",rv=Phaser.Utils.Objects.GetValue,nv=Phaser.Utils.Array.SpliceOne,av=Phaser.Math.Distance.Between,ov=Phaser.Math.Angle.Between;class hv{constructor(t,e){var i=Dn(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(rv(e,"inputConfig",void 0)),this.setEventEmitter(rv(e,"eventEmitter",void 0)),this._enable=void 0,this.pointers=[],this.movedState={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setEnable(rv(t,"enable",!0)),this.bounds=rv(t,"bounds",void 0),this.tracerState=uv,this.pointers.length=0,oo(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,oo(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 uv:this.tracerState=cv,this.onDrag1Start();break;case cv:this.tracerState=dv,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],nv(this.pointers,e),this.tracerState){case cv:this.tracerState=uv,this.onDrag1End();break;case dv: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 dv:this.onDrag2()}}}dragCancel(){return this.tracerState===dv&&this.onDrag2End(),this.pointers.length=0,oo(this.movedState),this.tracerState=uv,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!==dv)return 0;var t=this.pointers[0],e=this.pointers[1];return av(t.x,t.y,e.x,e.y)}get angleBetween(){if(this.tracerState!==dv)return 0;var t=this.pointers[0],e=this.pointers[1];return ov(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;lv.x=e.x-i.x,lv.y=e.y-i.y}else lv.x=0,lv.y=0;return lv}get centerX(){if(this.tracerState!==dv)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.x+e.x)/2}get centerY(){if(this.tracerState!==dv)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.y+e.y)/2}get prevCenterX(){if(this.tracerState!==dv)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!==dv)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=pv,this}isPointer0InGameObject(t,e,i){var s=this.pointers[0];return!!s&&Wg(t,s,e,i)}isPointer1InGameObject(t,e,i){var s=this.pointers[1];return!!s&&Wg(t,s,e,i)}}Object.assign(hv.prototype,hr);var lv={};const uv=0,cv=1,dv=2,pv="IDLE";Phaser.Utils.Objects.GetValue;const gv=Phaser.Math.RotateAround;var fv=function(t,e,i,s){return gv(t,e,i,s),t.rotation+=s,t},vv={};const mv=Phaser.Utils.Objects.GetValue,yv=Phaser.Math.Angle.WrapDegrees,bv=Phaser.Math.Angle.ShortestBetween,xv=Phaser.Math.RadToDeg,Cv=Phaser.Math.DegToRad;var kv={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=vv),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=yv(xv(this.angleBetween));this.angle=bv(this.prevAngle,t),this.prevAngle=t,this.state=_v}break;case _v:t=yv(xv(this.angleBetween));this.angle=bv(this.prevAngle,t),this.prevAngle=t,this.emit("rotate",this)}}get isRotated(){return this.state===_v}get rotation(){return Cv(this.angle)}setDragThreshold(t){return this.dragThreshold=t,this}}.prototype,kv);const Sv="IDLE",wv="BEGIN",_v="RECOGNIZED",Ev=Phaser.Utils.Objects.GetValue;var Tv=function(t){var e=Ev(t,"tap",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._tap=new If(this,e),this._tap.on("tap",(function(t,e,s){mf(i.eventEmitter,`${i.eventNamePrefix}${t.tapsCount}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Pv=Phaser.Utils.Objects.GetValue;var Ov=function(t){var e=Pv(t,"press",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._press=new Yf(this,e),this._press.on("pressstart",(function(t,e,s){mf(i.eventEmitter,`${i.eventNamePrefix}pressstart`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this).on("pressend",(function(t,e,s){mf(i.eventEmitter,`${i.eventNamePrefix}pressend`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Mv=Phaser.Utils.Objects.GetValue;var Dv=function(t){var e=Mv(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 tv(this,e),this._swipe.on("swipe",(function(t,e,s){var r=t.left?"left":t.right?"right":t.up?"up":"down";mf(i.eventEmitter,`${i.eventNamePrefix}swipe${r}`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Av=Phaser.Utils.Objects.GetValue;var Lv=function(t,e){return t.setInteractive(),Av(e,"dropZone",!1)&&(t.input.dropZone=!0),t._childrenInteractive={targetSizers:Av(e,"targets",[t]),targetMode:Av(e,"targetMode","parent"),eventEmitter:Av(e,"eventEmitter",t),eventNamePrefix:Av(e,"inputEventPrefix","child.")},bf.call(t,e),kf.call(t,e),_f.call(t,e),Of.call(t,e),Tv.call(t,e),Ov.call(t,e),Dv.call(t,e),t},Rv={getSizerConfig:function(t){return void 0===t&&(t=this),ad(t)},getChildPrevState:function(t){var e=ad(t);return e.hasOwnProperty("prevState")||(e.prevState={}),e.prevState},pushIntoBounds:function(t){return void 0===t&&(t=an(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=Rd(e,"color"),s=Rd(e,"lineWidth");var h=Rd(e,"name",!1);h&&(r=Rd(h,"createTextCallback",Bd),n=Rd(h,"createTextCallbackScope",void 0),"string"==typeof(a=Rd(h,"align","left-top"))&&(a=hd[a]))}if(void 0===i&&(i=16777215),void 0===s&&(s=1),r&&!t.children){t.children=new Fd(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)}}for(var u,c,d=this.getAllShownChildren([this]),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 Wv=Phaser.Utils.Objects.IsPlainObject,Xv=Phaser.Utils.Objects.GetValue,$v=Phaser.Display.Align.CENTER,Vv={min:0,full:-1};var Hv=function(t,e,i,s,r,n,a,o,h,l){zd.call(this,t);var u=t.isRexSpace,c=typeof e;if(null===e)return this;if("number"===c);else if("string"===c)e=Vv[e];else if(Wv(e)){var d;e=Xv(d=e,"proportion",void 0),i=Xv(d,"align",$v),s=Xv(d,"padding",0),r=Xv(d,"expand",!1),n=Xv(d,"key",void 0),a=Xv(d,"index",void 0),t.isRexSizer||(o=Xv(d,"minWidth",void 0),h=Xv(d,"minHeight",void 0)),l=Xv(d,"fitRatio",0)}return"string"==typeof i&&(i=hd[i]),void 0===e&&(e=u?1:0),void 0===i&&(i=$v),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===o&&(u?o=0:t.isRexSizer||(o=t._minWidth)),void 0===h&&(u?h=0:t.isRexSizer||(h=t._minHeight)),void 0===l||!1===l?l=0:!0===l&&(l=Ir(t)/jr(t)),(d=this.getSizerConfig(t)).proportion=e,d.align=i,d.padding=xl(s),d.expand=r,d.fitRatio=0===e?l:0,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},Uv={add:Hv,addSpace(t){return this.insertSpace(void 0,t),this},insertSpace(t,e){return void 0===e&&(e=1),Hv.call(this,new Gv(this.scene),{proportion:e,minWidth:0,minHeight:0,index:t}),this},insert(t,e,i,s,r,n,a,o){return Wv(i)&&(i.index=t),Hv.call(this,e,i,s,r,n,a,t,o),this},insertAtPosition(t,e,i,s,r,n,a,o,h){var l=Yv.call(this,t,e);return-1===l&&(l=void 0),this.insert(l,i,s,r,n,a,o,h),this}};const qv=il.prototype.clear;var Kv=function(t){this.backgroundChildren&&(this.backgroundChildren.length=0);var e,i=!t&&this.sizerEventsEnable;if(i&&(e=this.getChildren([])),qv.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,Kv.call(this,t),this}},Qv={getChildAlign(t){return this.getSizerConfig(t).align},setChildAlign(t,e){return"string"==typeof e&&(e=hd[e]),this.getSizerConfig(t).align=e,this}},tm={getChildProportion(t){return this.getSizerConfig(t).proportion},setChildProportion(t,e){return this.getSizerConfig(t).proportion=e,this}},em={getChildExpand(t){return this.getSizerConfig(t).expand},setChildExpand(t,e){return this.getSizerConfig(t).expand=e,this}},im={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}},sm={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&&(dp(t,0,0),e.resolved=!1,this.hasRatioFitChild=!0);return this._childrenProportion=void 0,this.hasProportion0Child=!1,this.proportionLength=void 0,lp.call(this),this},layoutChildren:function(){for(var t,e,i,s,r,n,a,o,h,l,u=this.sizerChildren,c=this.innerLeft,d=this.innerTop,p=this.innerWidth,g=this.innerHeight,f=c,v=d,m=this.startChildIndex,y=0,b=u.length;y0?(e=t-this.getChildrenWidth(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},resolveHeight:function(t){if(void 0!==(t=np.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)||sp.call(this)},runWidthWrap:function(t){this.wrapResult||(1===this.orientation&&zv.call(this,t,void 0),rp.call(this,t))},hasHeightWrap:function(){return!(!this.hasRatioFitChild||0!==this.orientation)||ap.call(this)},runHeightWrap:function(t){this.wrapResult||(0===this.orientation&&zv.call(this,void 0,t),op.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(sm,Uv,Zv,Qv,tm,em,im);var rm=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},nm={x:0,h:0,horizontal:0,"left-to-right":0,y:1,v:1,vertical:1,"top-to-bottom":1},am=function(t){return"string"==typeof t&&(t=nm[t]),t};const om=Phaser.Utils.Objects.IsPlainObject,hm=Phaser.Utils.Objects.GetValue;class lm extends Bv{constructor(t,e,i,s,r,n,a){om(e)?(e=hm(a=e,"x",0),i=hm(a,"y",0),s=hm(a,"width",void 0),r=hm(a,"height",void 0),n=hm(a,"orientation",0)):om(s)?(s=hm(a=s,"width",void 0),r=hm(a,"height",void 0),n=hm(a,"orientation",0)):om(n)&&(n=hm(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(hm(a,"space.item",0)),this.setStartChildIndex(hm(a,"startChildIndex",0)),this.setRTL(hm(a,"rtl",!1)),this.addChildrenMap("items",this.sizerChildren)}setOrientation(t){return this.orientation=am(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=rm.call(this)),this._childrenProportion}}Object.assign(lm.prototype,sm);var um=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},dm={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 pm extends lm{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&&(um(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&&(um(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&&um(t,this.iconWidth,this.iconHeight);var e=this.childrenMap.action;e&&void 0!==this.actionWidth&&void 0!==this.actionHeight&&um(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(pm.prototype,dm);var gm=function(t,e,i,s){var r=new Sl(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 fm=Phaser.Utils.Objects.GetValue;const vm=Phaser.Utils.Objects.GetValue;var mm=/^[\x00-\x7F]+$/,ym=function(t){return mm.test(t)},bm=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},Cm=0,km=1,Sm=2,wm=0,_m=1,Em=2,Tm=/(?:\r\n|\r|\n)/;const Pm={none:wm,word:_m,char:Em,character:Em,mix:3};var Om=function(t,e){switch(Ic(t)){case 0:switch("string"==typeof e&&(e=Pm[e]||0),t.style.wrapMode=e,e){case 2:case 3:t.style.wordWrapCallback=bm;break;default:t.style.wordWrapCallback=null}break;case 1:"string"==typeof e&&(e=Pm[e]||0),t.style.wrapMode=e}};const Mm=Phaser.Renderer.WebGL.Utils;var Dm={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=Mm.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 Am=Phaser.Display.Color;var Lm={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 Am);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}},Rm=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)},Fm={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,Rm(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}};Zo();const Bm=Phaser.Display.Canvas.CanvasPool,Im=Phaser.GameObjects.GameObject,jm=Phaser.Utils.String.UUID;class zm extends Im{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=Bm.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=jm(),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(){Bm.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 Nm=Phaser.GameObjects.Components;Phaser.Class.mixin(zm,[Nm.Alpha,Nm.BlendMode,Nm.Crop,Nm.Depth,Nm.Flip,Nm.GetBounds,Nm.Mask,Nm.Origin,Nm.Pipeline,Nm.PostPipeline,Nm.ScrollFactor,Nm.Tint,Nm.Transform,Nm.Visible,Dm,Lm,Fm]);let Gm=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(Gm.prototype,ql);var Ym={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 Wm=Phaser.Math.RotateAround;var Xm;const $m=Phaser.Geom.Rectangle;var Vm,Hm=function(t){void 0===Vm&&(Vm=new $m);var e=t.drawTLX,i=t.drawTLY;return Vm.setTo(e,i,t.drawTRX-e,t.drawBLY-i),Vm};const Um=Phaser.Math.RotateAround;var qm,Km=function(t,e,i,s){return void 0===s?s={}:!0===s&&(void 0===qm&&(qm={}),s=qm),s.x=e,s.y=i,0!==t.rotation&&Um(s,0,0,t.rotation),s.x=s.x*t.scaleX+t.drawX,s.y=s.y*t.scaleY+t.drawY,s};const Jm=Phaser.GameObjects.Components.TransformMatrix;var Zm,Qm,ty={},ey=function(t,e,i,s,r){var n=Km(e,i,s,!0),a=function(t,e,i,s){void 0===s?s={}:!0===s&&(s=ty);var r=e-t.width*t.originX,n=i-t.height*t.originY;return void 0===Zm&&(Zm=new Jm,Qm=new Jm),t.parentContainer?t.getWorldTransformMatrix(Zm,Qm):Zm.applyITRS(t.x,t.y,t.rotation,t.scaleX,t.scaleY),Zm.transformPoint(r,n,s),s}(t,n.x,n.y,r);return a},iy=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 ey(t,e,n,a,r)},sy={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===Xm&&(Xm={}),s=Xm),s.x=(t-i.drawX)/i.scaleX,s.y=(e-i.drawY)/i.scaleY,0!==i.rotation&&Wm(s,0,0,-i.rotation),s}(t,e,this,!0);return Hm(this).contains(i.x,i.y)},getWorldPosition:function(t,e,i){return iy(this.parent,this,t,e,i)}};Object.assign(sy,Ym);const ry=Phaser.Math.DegToRad,ny=Phaser.Math.RadToDeg,ay=Phaser.Utils.Objects.GetValue;class oy extends Gm{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 ny(this._rotation)}set angle(t){this.rotation=ry(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=ay(t,"width",void 0),i=ay(t,"height",void 0),s=ay(t,"scaleX",void 0),r=ay(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(oy.prototype,sy);const hy=Phaser.Utils.String.Pad;var ly=function(t,e,i){if(null==t)return t;switch(typeof t){case"string":default:return t;case"number":return`#${hy(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}},uy=function(t,e,i){return e.hasOwnProperty(t)?e[t]:i[t]};const cy=Phaser.Utils.Objects.GetValue;let dy=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=py(cy(t,"tl",void 0),e,i),s.tr=py(cy(t,"tr",void 0),e,i),s.bl=py(cy(t,"bl",void 0),e,i),s.br=py(cy(t,"br",void 0),e,i)}get radiusTL(){var t=this.cornerRadius.tl;return Math.max(t.x,t.y)}set radiusTL(t){gy(this.cornerRadius.tl,t)}get radiusTR(){var t=this.cornerRadius.tr;return Math.max(t.x,t.y)}set radiusTR(t){gy(this.cornerRadius.tr,t)}get radiusBL(){var t=this.cornerRadius.bl;return Math.max(t.x,t.y)}set radiusBL(t){gy(this.cornerRadius.bl,t)}get radiusBR(){var t=this.cornerRadius.br;return Math.max(t.x,t.y)}set radiusBR(t){gy(this.cornerRadius.br,t)}};var py=function(t,e,i){return void 0===t?t={x:e,y:i}:"number"==typeof t&&(t={x:t,y:t}),fy(t),t},gy=function(t,e){"number"==typeof e?(t.x=e,t.y=e):(t.x=cy(e,"x",0),t.y=cy(e,"y",0)),fy(t)},fy=function(t){t.convex=t.x>=0||t.y>=0,t.x=Math.abs(t.x),t.y=Math.abs(t.y)};const vy=Phaser.Math.DegToRad;var my=function(t){return!t.hasOwnProperty("convex")||t.convex},yy=function(t){return t.x>0&&t.y>0},by=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,yy(o)?(h=o.x*f,l=o.y*v,my(o)?by(t,h,l,h,l,180,270,!1,a):by(t,0,0,h,l,90,0,!0,a),u=0,c=l):(t.lineTo(0,0),u=0,c=0),o=m.tr,yy(o)?(h=o.x*f,l=o.y*v,my(o)?by(t,s-h,l,h,l,270,360,!1,a):by(t,s,0,h,l,180,90,!0,a)):t.lineTo(s,0),o=m.br,yy(o)?(h=o.x*f,l=o.y*v,my(o)?by(t,s-h,r-l,h,l,0,90,!1,a):by(t,s,r,h,l,270,180,!0,a)):t.lineTo(s,r),o=m.bl,yy(o)?(h=o.x*f,l=o.y*v,my(o)?by(t,h,r-l,h,l,90,180,!1,a):by(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())},Cy=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),xy(t.canvas,t.context,u,u,h,l,r,e,i,s,n,a,o)}};const ky=Phaser.Utils.Objects.GetValue;class Sy extends oy{constructor(t,e){super(t,"background"),this.setScrollFactor(0),this.setColor(ky(e,"color",null),ky(e,"color2",null),ky(e,"horizontalGradient",!0)),this.setStroke(ky(e,"stroke",null),ky(e,"strokeThickness",2)),this.setCornerRadius(ky(e,"cornerRadius",0),ky(e,"cornerIteration",null))}set color(t){t=ly(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=ly(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=ly(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,uy("color2",t,this),uy("horizontalGradient",t,this)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,uy("strokeThickness",t,this)),t.hasOwnProperty("cornerRadius")&&this.setCornerRadius(t.cornerRadius,uy("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(){Cy(this.parent,this.color,this.stroke,this.strokeThickness,this.cornerRadius,this.color2,this.horizontalGradient,this.cornerIteration)}}const wy=Phaser.Utils.Objects.GetValue;class _y extends oy{constructor(t,e){super(t,"innerbounds"),this.setScrollFactor(0),this.setColor(wy(e,"color",null),wy(e,"color2",null),wy(e,"horizontalGradient",!0)),this.setStroke(wy(e,"stroke",null),wy(e,"strokeThickness",2))}set color(t){t=ly(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=ly(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=ly(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,wy(t,"color2",null),wy(t,"horizontalGradient",!0)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,wy(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 Ey=Phaser.Utils.Objects.GetValue;let Ty=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(Ey(t,"bold",!1)),this.setItalic(Ey(t,"italic",!1)),this.setFontSize(Ey(t,"fontSize","16px")),this.setFontFamily(Ey(t,"fontFamily","Courier")),this.setColor(Ey(t,"color","#fff")),this.setStrokeStyle(Ey(t,"stroke",null),Ey(t,"strokeThickness",0)),this.setShadow(Ey(t,"shadowColor",null),Ey(t,"shadowOffsetX",0),Ey(t,"shadowOffsetY",0),Ey(t,"shadowBlur",0)),this.setOffset(Ey(t,"offsetX",0),Ey(t,"offsetY",0)),this.setSpace(Ey(t,"leftSpace",0),Ey(t,"rightSpace",0)),this.setAlign(Ey(t,"align",void 0)),this.setBackgroundColor(Ey(t,"backgroundColor",null)),this.setBackgroundHeight(Ey(t,"backgroundHeight",void 0)),this.setBackgroundBottomY(Ey(t,"backgroundBottomY",void 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(uy("stroke",t,this),uy("strokeThickness",t,this)),t.hasOwnProperty("shadowColor")&&this.setShadowColor(t.shadowColor),(t.hasOwnProperty("shadowOffsetX")||t.hasOwnProperty("shadowOffsetY"))&&this.setShadowOffset(uy("shadowOffsetX",t,this),uy("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),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=ly(t),this}get hasFill(){return null!=this.color}setStrokeStyle(t,e){return this.stroke=ly(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=ly(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=ly(t),this}get hasBackgroundColor(){return null!=this.backgroundColor}setBackgroundHeight(t){return this.backgroundHeight=t,this}setBackgroundBottomY(t){return this.backgroundBottomY=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 Py=Phaser.Utils.Array.Remove;const Oy=Phaser.Utils.Array.Remove;const My="text",Dy="image",Ay="drawer",Ly="space",Ry="command";var Fy=function(t){return t.type===My&&"\n"===t.text},By=function(t){return t.type===My&&"\f"===t.text},Iy=function(t){return t.type===My};class jy extends oy{constructor(t,e,i){super(t,My),this.updateTextFlag=!1,this.style=new Ty(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,s=this.drawTRX-i+1,r=e.backgroundBottomY;null==r&&(r=this.drawBLY);var n=e.backgroundHeight;null==n&&(n=r-this.drawTLY);var a=r-n;t.fillRect(i,a,s,n)}var o=e.hasFill,h=e.hasStroke;(o||h)&&(e.syncFont(t).syncStyle(t),h&&(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 zy=function(t,e){var i=this.createCharChildren(t,e);return this.addChild(i),this};const Ny=Phaser.Display.Canvas.CanvasPool;var Gy=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=Ny.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),Ny.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 Yy extends oy{constructor(t,e,i){super(t,Dy),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(){Gy(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 Wy extends oy{constructor(t,e,i,s){super(t,Ay),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 Xy extends oy{constructor(t,e){super(t,Ly),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 $y extends Gm{constructor(t,e,i,s,r){super(t,Ry),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 Vy=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 Hy={none:0,word:1,char:2,character:2,mix:3};var Uy=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=Zy.call(this)).height,a=l.ascent,i=Math.floor((h-a)/n)}else{var l;n=(l=Zy.call(this)).height,a=l.ascent}}else if(this.fixedHeight>0){if(void 0===(i=tb(t,"maxLines"))){h=this.fixedHeight-s;i=Math.floor(h/n)}}else i=tb(t,"maxLines",0);void 0===a&&(a=n);var u=0===i,c=tb(t,"wrapMode");void 0===c&&(c=tb(t,"charWrap",!1)?"char":"word");"string"==typeof c&&(c=Hy[c]);var d=tb(t,"wrapWidth",void 0);void 0===d&&(this.fixedWidth>0?d=this.fixedWidth-r:(d=1/0,c=0));for(var p=tb(t,"letterSpacing",0),g=tb(t,"hAlign",0),f=tb(t,"vAlign",0),v=tb(t,"justifyPercentage",.25),m=Vy({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&&(O.push({children:M,width:D}),A=Math.max(A,D)),m.start+=P.length,m.isLastPage=!L&&m.start===T,m.maxLineWidth=A,m.linesHeight=O.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=sb(t,"maxLines",void 0))){var a=this.fixedWidth-r;i=Math.floor(a/n)+1}}else i=sb(t,"maxLines",0);var o=0===i,h=sb(t,"fixedCharacterHeight",void 0);if(void 0===h){var l=sb(t,"charPerLine",void 0);if(void 0!==l){var u=this.fixedHeight-s;h=Math.floor(u/l)}}var c=sb(t,"wrapHeight",void 0);void 0===c&&(c=this.fixedHeight>0?this.fixedHeight-s:1/0);for(var d=sb(t,"letterSpacing",0),p=sb(t,"rtl",!0),g=sb(t,"hAlign",p?2:0),f=sb(t,"vAlign",0),v=Vy({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&&(P.push({children:O,height:M}),D=Math.max(D,M)),v.start+=T.length,v.isLastPage=v.start===E,v.maxLineHeight=D,v.linesWidth=P.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 tp(i,t,e),this.dirty=this.dirty||s!=i.left||r!=i.right||n!=i.top||a!=i.bottom,this},getPadding:function(t){return Qd(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),Py(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 Oy(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(My);return null===i?i=new jy(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)),iy(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=Ib(t,r,e,i,n),o=0;o<=Rb&&0!==a;o++){if((r+=a)<0){r=0;break}a=Ib(t,r,e,i,n)}return o===Rb&&console.warn("FontSizeFit: Test count exceeds 65535"),t.setFontSize(r),jb(t,e,i),t},Bb=function(t,e,i){return void 0===i[e]&&(t.setFontSize(e),i[e]={width:t.width,height:t.height}),i[e]},Ib=function(t,e,i,s,r){var n,a=Bb(t,e,r),o=Bb(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)},jb=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 zb=Phaser.Utils.Objects.GetValue;var Nb=function(t,e){"number"==typeof e&&(e={minWidth:e});var i=zb(e,"minWidth",0),s=zb(e,"minHeight",0),r=zb(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 Fb(t,e,i),t}):(t.runWidthWrap=function(e){return t.setFixedSize&&t.setFixedSize(0,0),Fb(t,e,void 0),t},t.resize=function(e,i){return t.width===e&&t.height===i||t.setFixedSize(e,i),t}),t};const Gb=Phaser.Utils.Objects.GetValue,Yb=[function(t){var e=this.scene,i=fm(t,"orientation",0);this.setOrientation(i);var s=fm(t,"icon",void 0),r=fm(t,"iconMask",void 0),n=fm(t,"innerBackground",void 0),a=fm(t,"title",void 0),o=fm(t,"separator",void 0),h=fm(t,"text",void 0),l=fm(t,"action",void 0),u=fm(t,"actionMask",void 0);if(s){var c=fm(t,"align.icon","center");m=0===this.orientation?{right:fm(t,"space.icon",0),top:fm(t,"space.iconTop",0),bottom:fm(t,"space.iconBottom",0),left:fm(t,"space.iconLeft",0)}:{bottom:fm(t,"space.icon",0),left:fm(t,"space.iconLeft",0),right:fm(t,"space.iconRight",0),top:fm(t,"space.iconTop",0)};var d=fm(t,"squareFitIcon",!1)?1:0;if(this.add(s,{proportion:0,align:c,padding:m,fitRatio:d}),r&&(r=gm.call(this,s,s,1)),!d){var p=fm(t,"iconSize",void 0);this.setIconSize(fm(t,"iconWidth",p),fm(t,"iconHeight",p))}}var g=new lm(e,{orientation:1});n&&g.addBackground(n);var f=fm(t,"space.separator",0);if(a){c=fm(t,"align.title","left");var v=fm(t,"expandTitleWidth",!1);y=fm(t,"expandTitleHeight",!1)?1:0,b=v,m={bottom:!o&&h?fm(t,"space.title",f):0,left:fm(t,"space.titleLeft",0),right:fm(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:fm(t,"space.separatorLeft",0),right:fm(t,"space.separatorRight",0)};g.add(o,{expand:!0,padding:m})}if(h){c=fm(t,"align.text","left");var y,b,x=fm(t,"expandTextWidth",!1);y=fm(t,"expandTextHeight",!1)?1:0,b=x,m={left:fm(t,"space.textLeft",0),right:fm(t,"space.textRight",0)},g.add(h,{proportion:y,expand:b,align:c,padding:m})}m=void 0;if(l&&(m={right:fm(t,"space.text",0)}),this.add(g,{proportion:1,padding:m}),l){c=fm(t,"align.action","center");m=0===this.orientation?{top:fm(t,"space.actionTop",0),bottom:fm(t,"space.actionBottom",0),right:fm(t,"space.actionRight",0)}:{left:fm(t,"space.actionLeft",0),right:fm(t,"space.actionRight",0),bottom:fm(t,"space.actionBottom",0)};d=fm(t,"squareFitAction",!1)?1:0;if(this.add(l,{proportion:0,align:c,padding:m,fitRatio:d}),u&&(u=gm.call(this,l,l,1)),!d){var C=fm(t,"actionSize");this.setActionSize(fm(t,"actionWidth",C),fm(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=vm(t,"title",void 0),s=vm(t,"separator",void 0),r=vm(t,"innerBackground",void 0),n=vm(t,"icon",void 0),a=vm(t,"iconMask",void 0),o=vm(t,"text",void 0),h=vm(t,"action",void 0),l=vm(t,"actionMask",void 0);if(i){var u=vm(t,"align.title","left"),c=vm(t,"expandTitleWidth",!1);y=vm(t,"expandTitleHeight",!1)?1:0,b=c,p={bottom:vm(t,"space.title",0),left:vm(t,"space.titleLeft",0),right:vm(t,"space.titleRight",0)},this.add(i,{proportion:y,expand:b,align:u,padding:p})}if(s){var d=vm(t,"space.separator",0),p={top:i?d:0,bottom:o?d:0,left:vm(t,"space.separatorLeft",0),right:vm(t,"space.separatorRight",0)};this.add(s,{proportion:0,expand:!0,padding:p})}var g=vm(t,"orientation",0),f=new lm(e,{orientation:g,rtl:vm(t,"rtl",!1),space:{left:vm(t,"space.innerLeft",0),right:vm(t,"space.innerRight",0),top:vm(t,"space.innerTop",0),bottom:vm(t,"space.innerBottom",0)}});if(r&&f.addBackground(r),this.add(f,{proportion:1,expand:!0}),n){u=vm(t,"align.icon","center");p=0===f.orientation?{right:vm(t,"space.icon",0),top:vm(t,"space.iconTop",0),bottom:vm(t,"space.iconBottom",0),left:vm(t,"space.iconLeft",0)}:{bottom:vm(t,"space.icon",0),left:vm(t,"space.iconLeft",0),right:vm(t,"space.iconRight",0),top:vm(t,"space.iconTop",0)};var v=vm(t,"squareFitIcon",!1)?1:0;if(f.add(n,{proportion:0,align:u,padding:p,fitRatio:v}),a&&(a=gm.call(this,n,n,1)),!v){var m=vm(t,"iconSize",void 0);this.setIconSize(vm(t,"iconWidth",m),vm(t,"iconHeight",m))}}if(o){u=vm(t,"align.text","left");var y,b,x=vm(t,"space.text",0),C=vm(t,"expandTextWidth",!1),k=vm(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=vm(t,"align.action","center");p=0===f.orientation?{top:vm(t,"space.actionTop",0),bottom:vm(t,"space.actionBottom",0),right:vm(t,"space.actionRight",0)}:{left:vm(t,"space.actionLeft",0),right:vm(t,"space.actionRight",0),bottom:vm(t,"space.actionBottom",0)};v=vm(t,"squareFitAction",!1)?1:0;if(f.add(h,{proportion:0,align:u,padding:p,fitRatio:v}),l&&(l=gm.call(this,h,h,1)),!v){var S=vm(t,"actionSize");this.setActionSize(vm(t,"actionWidth",S),vm(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 Wb extends pm{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexTitleLabel";var i=Gb(e,"background",void 0);i&&this.addBackground(i);var s=Gb(e,"title",void 0),r=Gb(e,"text",void 0);if(s){var n=Gb(e,"wrapTitle",!1),a=Gb(e,"adjustTitleFontSize",!1);n?(!0===n&&(n="word"),Om(s,n),e.expandTitleWidth=!0,Lb(s)):a&&(e.expandTextWidth=!0,e.expandTextHeight=!0,Nb(s,{fitHeight:!0}))}if(r){var o=Gb(e,"wrapText",!1),h=Gb(e,"adjustTextFontSize",!1);o?(!0===o&&(o="word"),Om(r,o),e.expandTextWidth=!0,Lb(r)):h&&(e.expandTextWidth=!0,e.expandTextHeight=!0,Nb(r,{fitHeight:!0}))}var l=Gb(e,"layoutMode",0);(Yb[l]||Yb[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 Xb 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=rd(i,"expandTextWidth",!1),n=rd(i,"expandTextHeight",!1);if(r||n){var a=Ic(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(rd(i,"typingMode","page")),this.page=new Hc(s,rd(i,"page",void 0)),this.typing=new id(s,rd(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=nd[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()}}}(Wb)){constructor(t,e){void 0===e&&(e={}),e.hasOwnProperty("layoutMode")||(e.layoutMode=1),super(t,e)}}const $b=Phaser.GameObjects.GetCalcMatrix;const Vb=Phaser.Renderer.Canvas.SetTransform;var Hb={renderWebGL:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.pipelines.set(e.pipeline),n=$b(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&&Zl(r,a,e,l,o,h),e.isStroked&&tu(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(Vb(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(qb.prototype,Hb);const Kb=Phaser.Utils.Objects.IsPlainObject,Jb=Phaser.Utils.Objects.GetValue,Zb=Phaser.Geom.Polygon.Earcut;class Qb extends qb{constructor(t,e,i,s,r,n,a,o){var h,l,u,c;if(Kb(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 dy;if(super(t,"rexRoundRectangleShape",p),this.setShapeType(c),0===this.shapeType){var g=Jb(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)}var f=Jb(n,"iteration",void 0);this.setIteration(f),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,tx(i))if(i.convex){var o=i.x,h=i.y;ou(o,h,i.x,i.y,180,270,!1,a,e)}else{ou(o=0,h=0,i.x,i.y,90,0,!0,a,e)}else nu(0,0,e);if(i=n.tr,tx(i))if(i.convex){o=s-i.x,h=i.y;ou(o,h,i.x,i.y,270,360,!1,a,e)}else{ou(o=s,h=0,i.x,i.y,180,90,!0,a,e)}else nu(s,0,e);if(i=n.br,tx(i))if(i.convex){o=s-i.x,h=r-i.y;ou(o,h,i.x,i.y,0,90,!1,a,e)}else{ou(o=s,h=r,i.x,i.y,270,180,!0,a,e)}else nu(s,r,e);if(i=n.bl,tx(i))if(i.convex){o=i.x,h=r-i.y;ou(o,h,i.x,i.y,90,180,!1,a,e)}else{ou(o=0,h=r,i.x,i.y,360,270,!0,a,e)}else nu(0,r,e);return e.push(e[0],e[1]),this.pathIndexes=Zb(e),this}setShapeType(t){return"string"==typeof t&&(t=ex[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}}var tx=function(t){return t.x>0&&t.y>0};const ex={rectangle:0,circle:1};var ix=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},sx=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};const dx=Phaser.Utils.Objects.GetValue,px=Phaser.Utils.Objects.IsPlainObject;class gx extends(sc(Hl)){constructor(t,e,i,s,r,n,a,o){px(e)?(e=dx(o=e,"x",0),i=dx(o,"y",0),s=dx(o,"width",2),r=dx(o,"height",2),n=dx(o,"barColor",void 0),a=dx(o,"value",0)):px(s)?(s=dx(o=s,"width",2),r=dx(o,"height",2),n=dx(o,"barColor",void 0),a=dx(o,"value",0)):px(n)&&(n=dx(o=n,"barColor",void 0),a=dx(o,"value",0)),super(t,e,i,s,r,o),this.type="rexLineProgress",this.bootProgressBase(o),this.addShape((new Lu).setName("trackFill")).addShape((new Lu).setName("bar")).addShape((new Lu).setName("trackStroke")),this.setTrackColor(dx(o,"trackColor",void 0)),this.setBarColor(n),this.setTrackStroke(dx(o,"trackStrokeThickness",2),dx(o,"trackStrokeColor",void 0)),this.setSkewX(dx(o,"skewX",0)),this.setRTL(dx(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 fx={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).close();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).close());var o=this.getShape("trackStroke");o.lineStyle(this.trackStrokeThickness,this.trackStrokeColor),o.isStroked&&cx(o,0,0,e,i,t).end()}};Object.assign(gx.prototype,fx);class vx extends gx{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=mx,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 mx={color:"trackColor",strokeColor:"trackStrokeColor",strokeWidth:"trackStrokeThickness"};Object.assign(vx.prototype,hx);let yx=class extends Bn{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 bx=Phaser.GameObjects.NineSlice,xx=Phaser.Utils.Objects.GetValue;class Cx extends bx{constructor(t,e){void 0===e&&(e={}),super(t,xx(e,"x",0),xx(e,"y",0),xx(e,"key",null),xx(e,"frame",null),xx(e,"width",0),xx(e,"height",0),xx(e,"leftWidth",0),xx(e,"rightWidth",0),xx(e,"topHeight",0),xx(e,"bottomHeight",0)),this.type="rexStatesNineSlice";var i=xx(e,"effects",!0);i&&Pr(this,i),this.style=new yx(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign(Cx.prototype,hx);let kx=class extends Bn{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 Sx=Phaser.GameObjects.Image,wx=Phaser.Utils.Objects.GetValue;class _x extends Sx{constructor(t,e){void 0===e&&(e={}),super(t,wx(e,"x",0),wx(e,"y",0),wx(e,"key",""),wx(e,"frame",void 0)),this.type="rexStatesImage";var i=wx(e,"effects",!0);i&&Pr(this,i),this.style=new kx(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign(_x.prototype,hx);var Ex=function(t,e,i){return"__BASE"===i?`${t},${e}`:`${i}:${t},${e}`};const Tx=Phaser.Utils.Objects.IsPlainObject,Px=Phaser.Utils.Objects.GetValue;var Ox=function(t){return"string"==typeof t&&(t=Mx[t]),t};const Mx={scale:0,repeat:1};var Dx=function(t,e){return 0===t||t===this.columns.count-1||0===e||e===this.rows.count-1},Ax={_beginDraw:ld,_drawImage:ld,_drawTileSprite:ld,_endDraw:ld,setGetFrameNameCallback:function(t){return void 0===t&&(t=Ex),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 Tx(t)?(this.stretchMode.edge=Ox(Px(t,"edge",0)),this.stretchMode.internal=Ox(Px(t,"internal",0))):(t=Ox(t),this.stretchMode.edge=t,this.stretchMode.internal=t),this},getStretchMode:function(t,e){return Dx.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 Lx=Phaser.Utils.Objects.IsPlainObject,Rx=Phaser.Utils.Objects.GetValue;const Fx=Phaser.GameObjects;var Bx=void 0,Ix=function(t,e){if(Bx||(Bx={},Rn(t).events.once("destroy",(function(){for(var t in Bx)Bx[t].destroy();Bx=void 0}))),!Bx.hasOwnProperty(e)){var i=Rn(t).scene.systemScene;(t=new Fx[e](i)).setOrigin(0),Bx[e]=t}return Bx[e]};const jx=Phaser.GameObjects.RenderTexture;class zx extends(function(t,e){class i extends t{constructor(t,i,s,r,n,a,o,h,l,u){if(Lx(i)?(i=Rx(u=i,"x",0),s=Rx(u,"y",0),r=Rx(u,"width",1),n=Rx(u,"height",1),a=Rx(u,"key",void 0),o=Rx(u,"baseFrame",void 0),h=Rx(u,"columns",void 0),l=Rx(u,"rows",void 0)):Lx(r)?(r=Rx(u=r,"width",1),n=Rx(u,"height",1),a=Rx(u,"key",void 0),o=Rx(u,"baseFrame",void 0),h=Rx(u,"columns",void 0),l=Rx(u,"rows",void 0)):Lx(a)?(a=Rx(u=a,"key",void 0),o=Rx(u,"baseFrame",void 0),h=Rx(u,"columns",void 0),l=Rx(u,"rows",void 0)):Lx(o)?(o=Rx(u=o,"baseFrame",void 0),h=Rx(u,"columns",void 0),l=Rx(u,"rows",void 0)):Array.isArray(o)?(u=l,l=h,h=o,o=Rx(u,"baseFrame",void 0)):Lx(h)&&(h=Rx(u=h,"columns",void 0),l=Rx(u,"rows",void 0)),void 0===o&&(o=Rx(u,"frame",void 0)),void 0===h){var c=Rx(u,"leftWidth",void 0),d=Rx(u,"rightWidth",void 0);void 0!==c&&void 0!==d&&(h=[c,void 0,d])}if(void 0===l){var p=Rx(u,"topHeight",void 0),g=Rx(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(Rx(u,"getFrameNameCallback",void 0)),this.setStretchMode(Rx(u,"stretchMode",0)),this.setPreserveRatio(Rx(u,"preserveRatio",!0));var f=Rx(u,"maxFixedPartScale",1),v=Rx(u,"maxFixedPartScaleX",f),m=Rx(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,Ax),i}(jx,"rexNinePatch")){}var Nx={_drawImage:function(t,e,i,s,r,n){var a=Ix(this,"Image").setTexture(t,e).setDisplaySize(r,n);this.draw(a,i,s)},_drawTileSprite:function(t,e,i,s,r,n){var a=Ix(this,"TileSprite").setTexture(t,e).setSize(r,n);this.draw(a,i,s)}};Object.assign(zx.prototype,Nx);let Gx=class extends Bn{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 Yx=Phaser.Utils.Objects.GetValue;class Wx extends zx{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexStatesNinePatch";var i=Yx(e,"effects",!0);i&&Pr(this,i),this.style=new Gx(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign(Wx.prototype,hx);const Xx=["alpha","tint","flipX","flipY"];var $x=function(t,e){if(!e)return t;for(var i=0,s=Xx.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}),X();if(z===f-1)return X(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 X();function Y(t){x.push(t),w=u}function W(t){var e=0;if(-1!==t){var i=a.substring(z+1,t);i&&""===i.trim()&&(e=i.length)}return e}function X(t){return p||(void 0===t&&(t=a.substring(u)),S.push(t),u=f,Y(S),b&&H()),V()}function $(t){u=t,Y(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(Pr(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;var Yr=function(t,e){if(void 0===e?e=new zr:!0===e&&(void 0===Wr&&(Wr=new zr),e=Wr),t.getBounds)return t.getBounds(e);var i,s,r,n,a,o,h,l;if(t.parentContainer){var u=t.parentContainer.getBoundsTransformMatrix();Xr(t,e),u.transformPoint(e.x,e.y,e),i=e.x,s=e.y,$r(t,e),u.transformPoint(e.x,e.y,e),r=e.x,n=e.y,Vr(t,e),u.transformPoint(e.x,e.y,e),a=e.x,o=e.y,Hr(t,e),u.transformPoint(e.x,e.y,e),h=e.x,l=e.y}else Xr(t,e),i=e.x,s=e.y,$r(t,e),r=e.x,n=e.y,Vr(t,e),a=e.x,o=e.y,Hr(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,Xr=function(t,e,i){return void 0===e?e=new Nr:!0===e&&(void 0===Ur&&(Ur=new Nr),e=Ur),t.getTopLeft?t.getTopLeft(e):(e.x=t.x-Ir(t)*t.originX,e.y=t.y-jr(t)*t.originY,qr(t,e,i))},$r=function(t,e,i){return void 0===e?e=new Nr:!0===e&&(void 0===Ur&&(Ur=new Nr),e=Ur),t.getTopRight?t.getTopRight(e):(e.x=t.x-Ir(t)*t.originX+Ir(t),e.y=t.y-jr(t)*t.originY,qr(t,e,i))},Vr=function(t,e,i){return void 0===e?e=new Nr:!0===e&&(void 0===Ur&&(Ur=new Nr),e=Ur),t.getBottomLeft?t.getBottomLeft(e):(e.x=t.x-Ir(t)*t.originX,e.y=t.y-jr(t)*t.originY+jr(t),qr(t,e,i))},Hr=function(t,e,i){return void 0===e?e=new Nr:!0===e&&(void 0===Ur&&(Ur=new Nr),e=Ur),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),qr(t,e,i))},Ur=void 0,qr=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 Kr=Phaser.Utils.Objects.GetValue;var Jr=function(t,e,i){var s,r,n,a,o;if("number"==typeof i?s=i:(s=Kr(i,"color"),r=Kr(i,"lineWidth"),n=Kr(i,"fillColor"),a=Kr(i,"fillAlpha",1),o=Kr(i,"padding",0)),Array.isArray(t))for(var h=0,l=t.length;h0?-this.delay:0,this.state=this.nowTime>=0?Un:Hn,this.repeatCounter=0,this}stop(){return this.state=Vn,this}update(t,e){this.state!==Vn&&this.state!==Kn&&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=Kn):this.nowTime>=0&&(this.state=Un))}get t(){var t;switch(this.state){case Vn:case Hn:case qn:t=0;break;case Un:t=this.nowTime/this.duration;break;case Kn:t=1}return Xn(t,0,1)}set t(t){(t=Xn(t,-1,1))<0?(this.state=Hn,this.nowTime=-this.delay*t):(this.state=Un,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===Vn}get isDelay(){return this.state===Hn}get isCountDown(){return this.state===Un}get isRunning(){return this.state===Hn||this.state===Un}get isDone(){return this.state===Kn}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}};const Vn=0,Hn=1,Un=2,qn=3,Kn=-1;class Jn extends Gn{constructor(t,e){super(t,e),this.timer=new $n}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 Zn=Phaser.Utils.Objects.GetValue,Qn=Phaser.Utils.Objects.GetAdvancedValue,ta=Phaser.Tweens.Builders.GetEaseFunction;class ea extends Jn{resetFromJSON(t){return this.timer.resetFromJSON(Zn(t,"timer")),this.setEnable(Zn(t,"enable",!0)),this.setTarget(Zn(t,"target",this.parent)),this.setDelay(Qn(t,"delay",0)),this.setDuration(Qn(t,"duration",1e3)),this.setEase(Zn(t,"ease","Linear")),this.setRepeat(Zn(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=ta(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 ia=Phaser.Sound.BaseSound;var sa=function(t){return t instanceof ia};const ra=Phaser.Utils.Objects.GetValue,na=Phaser.Utils.Objects.GetAdvancedValue,aa=Phaser.Math.Linear;let oa=class extends ea{constructor(t,e,i){sa(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(ra(t,"mode",0)),this.setEnable(ra(t,"enable",!0)),this.setVolumeRange(na(t,"volume.start",this.parent.volume),na(t,"volume.end",0)),this}setMode(t){return"string"==typeof t&&(t=ha[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=aa(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 ha={stop:1,destroy:2};var la=function(t,e,i,s,r){sa(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 oa(t,e,a),e._fade=n),n.start(),e.isPlaying||e.setVolume(r).play(),e},ua=function(t,e,i,s){sa(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 oa(t,e,n),e._fade=r),r.start(),e.isPlaying||e.play(),e};const ca=Phaser.Utils.Objects.GetValue;var da={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:ca(e,"loop",this.backgroundMusicLoop),mute:ca(e,"mute",this.backgroundMusicMute),volume:ca(e,"volume",this.backgroundMusicVolume),detune:ca(e,"detune",0),rate:ca(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&&la(this.backgroundMusic,t,this.backgroundMusicVolume,0),this},fadeOutBackgroundMusic(t,e){return this.backgroundMusic&&ua(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 pa=Phaser.Utils.Objects.GetValue;var ga={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:pa(e,"loop",this.backgroundMusicLoop),mute:pa(e,"mute",this.backgroundMusic2Mute),volume:pa(e,"volume",this.backgroundMusic2Volume),detune:pa(e,"detune",0),rate:pa(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&&la(this.backgroundMusic2,t,this.backgroundMusic2Volume,0),this},fadeOutBackgroundMusic2(t,e){return this.backgroundMusic2&&ua(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 fa=Phaser.Utils.Array.Remove,va=Phaser.Utils.Objects.GetValue;var ma={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:va(e,"mute",this.soundEffectsMute),volume:va(e,"volume",this.soundEffectsVolume),detune:va(e,"detune",0),rate:va(e,"rate",1)});return this.soundEffects.push(i),i.once("complete",(function(){i.destroy(),this.sound&&fa(this.soundEffects,i)}),this).once("destroy",(function(){this.sound&&fa(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&&la(e,t,this.soundEffectsVolume,0),this},fadeOutSoundEffect(t,e){var i=this.getLastSoundEffect();return i&&ua(i,t,e),this},fadeOutAllSoundEffects(t,e){for(var i=this.soundEffects.length-1;i>=0;i--)ua(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&&la(e,t,this.soundEffects2Volume,0),this},fadeOutSoundEffect2(t,e){var i=this.getLastSoundEffect2();return i&&ua(i,t,e),this},fadeOutAllSoundEffects2(t,e){for(var i=this.soundEffects2.length-1;i>=0;i--)ua(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 Da=Phaser.Utils.Objects.GetValue,Aa=new class extends Ma{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=Za(this.delimiterLeft),e=Za(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=io),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=no),this.tagExpression=t,this}setValueExpression(t){return t||(t=no),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!==no||this.valueExpression!==no){var s=`${this.tagExpression}(=${this.valueExpression})?`,r=`/${this.tagExpression}`;t=Za(this.delimiterLeft),e=Za(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=so(e[3],this.valueConverter);this.emit(`+${i}`,...r),this.skipEventFlag||this.emit("+",i,...r),this.lastTagStart=i}}}const no="[^=]+";var ao=[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()}))}],oo=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},ho=function(t,e){var i=Array.isArray(t);if(void 0===e?e=i?[]:{}:oo(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}},bo={"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}},xo={"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}},Co={"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}},ko={"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}},So=function(t){return!t.hasOwnProperty("logEnable")||t.logEnable},wo={log({text:t="",logType:e="log",showTitle:i=!0,title:s,titleColor:r="green"}={},n,a){return So(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(!So(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}},_o={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 Xo=class extends Wo{constructor(t){super(t,0,0,2,2),this.fullWindow=new Yo(this)}};const $o="BG",Vo="SPRITE",Ho="TEXTBOX",Uo="TITLE",qo="CHOICE",Ko="NAMEINPUT";var Jo=!1,Zo=function(t){Jo||(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 th(this.children,t,0,(function(t){t.once("destroy",e.onChildDestroy,e)}),this),this}remove(t,e){var i=this;return eh(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;ioh(t),resetChildState(t){return this.resetChildPositionState(t).resetChildVisibleState(t).resetChildAlphaState(t).resetChildActiveState(t),this},resetChildrenState(t){for(var e=0,i=t.length;eoh(t).x,getChildLocalY:t=>oh(t).y};const Sh=Phaser.Math.DegToRad;var wh={updateChildRotation(t){var e=oh(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=oh(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 oh(t).rotation=e,this.updateChildRotation(t),this},setChildLocalAngle(t,e){return oh(t).rotation=Sh(e),this.updateChildRotation(t),this},resetLocalRotationState(){var t=oh(this).parent;return t&&t.resetChildRotationState(this),this},getChildLocalRotation:t=>oh(t).rotation},_h={updateChildScale(t){var e=oh(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=oh(t),i=e.parent;return e.scaleX=Ch(t.scaleX,i.scaleX),e.scaleY=Ch(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=oh(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=oh(this).parent;return t&&t.resetChildScaleState(this),this},getChildLocalScaleX:t=>oh(t).scaleX,getChildLocalScaleY:t=>oh(t).scaleY},Eh={updateChildVisible(t){var e=oh(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=oh(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),oh(t).visible=e,this.updateChildVisible(t),this},setChildMaskVisible(t,e){return void 0===e&&(e=!0),oh(t).maskVisible=e,this.updateChildVisible(t),this},resetLocalVisibleState(){var t=oh(this).parent;return t&&t.resetChildVisibleState(this),this},getChildLocalVisible:t=>oh(t).visible},Th={updateChildAlpha(t){var e=oh(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=oh(t),i=e.parent;return e.alpha=Ch(t.alpha,i.alpha),this},setChildAlpha(t,e){return t.alpha=e,this.resetChildAlphaState(t),this},setChildLocalAlpha(t,e){return oh(t).alpha=e,this.updateChildAlpha(t),this},resetLocalAlphaState(){var t=oh(this).parent;return t&&t.resetChildAlphaState(this),this},getChildLocalAlpha:t=>oh(t).alpha},Ph={updateChildActive(t){var e=oh(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 oh(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),oh(t).active=e,this.updateChildActive(t),this},resetLocalActiveState(){var t=oh(this).parent;return t&&t.resetChildActiveState(this),this},getChildLocalActive:t=>oh(t).active},Oh={updateChildScrollFactor(t){var e=oh(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}},Mh={updateCameraFilter(t){var e=oh(t),i=e.parent;return e.syncCameraFilter&&(t.cameraFilter=i.cameraFilter),this},syncCameraFilter(){return this.syncChildrenEnable&&this.children.forEach(this.updateCameraFilter,this),this}},Dh={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}},Ah=function(t){return t.filter((function(t){return!!t.displayList||(!!t.parentContainer||void 0)}))},Lh={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}},Rh=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 Bh=Phaser.Utils.Array;var Ih={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 P=b+k*_+a*k,O=x+S*w+o*S;E.setOrigin(a,o).setPosition(P,O).setScale(f,v).setRotation(m),Ol(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(zl.prototype,Al);const Gl={fit:1,FIT:1,envelop:2,ENVELOP:2};const Yl=Phaser.GameObjects.GetCalcMatrix;const Wl=Phaser.Renderer.Canvas.SetTransform;var Xl={renderWebGL:function(t,e,i,s){e.updateData(),i.addToRenderList(e);var r=t.pipelines.set(e.pipeline),n=Yl(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+")"},iu=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 su=Phaser.Geom.Polygon.Earcut;class ru extends Kl{constructor(){super(),this.pathData=[],this.pathIndexes=[],this.closePath=!1}updateData(){return this.pathIndexes=su(this.pathData),super.updateData(),this}webglRender(t,e,i,s,r){this.isFilled&&Zl(t,e,this,i,s,r),this.isStroked&&tu(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 au=Phaser.Math.DegToRad;var ou=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=Fu(t,"tl",0),this.radiusTR=Fu(t,"tr",0),this.radiusBL=Fu(t,"bl",0),this.radiusBR=Fu(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?ou(e,e,e,e,180,270,!1,r,t):ou(0,0,e,e,90,0,!0,r,t):nu(0,0,t);(e=this.radiusTR)>0?this._convexTR?ou(i-e,e,e,e,270,360,!1,r,t):ou(i,0,e,e,180,90,!0,r,t):nu(i,0,t);(e=this.radiusBR)>0?this._convexBR?ou(i-e,s-e,e,e,0,90,!1,r,t):ou(i,s,e,e,270,180,!0,r,t):nu(i,s,t);(e=this.radiusBL)>0?this._convexBL?ou(e,s-e,e,e,90,180,!1,r,t):ou(0,s,e,e,360,270,!0,r,t):nu(0,s,t);return t.push(t[0],t[1]),mu(this.x,this.y,t),super.updateData(),this}},triangle:class extends Kl{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=Bu(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&&tu(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&&(eu(t,this),t.fill()),this.isStroked&&(iu(t,this),t.stroke())}}},ju=Phaser.Utils.Objects.GetValue,zu=Phaser.Utils.Objects.IsPlainObject,Nu=function(){for(var t=this.getShapes(),e=0,i=t.length;e=0;s--)(a=r[s])instanceof e&&(a.destroy(),dc(r,s));else{s=0;for(var r,n=(r=t.postPipelines).length;s0}(e,uc),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(pc,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(pc,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(pc,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(pc,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 fc extends zl{constructor(t,e,i,s,r,n){super(t,e,i,s,r,n);for(var a=0,o=gc.length;a0?t.setText(e).getTextBounds().wrappedText.split("\n"):e.split("\n")}return i},zc=function(t){return null==t?t="":Array.isArray(t)?t=t.join("\n"):"number"==typeof t&&(t=t.toString()),t},Nc={clearText(){return this.sections.length=0,this.pageStartIndexes.length=0,this.lines.length=0,this},appendPage(t){var e=this.totalLinesCount;this.sections.push(zc(t));t=this.sections.join("\n");this.lines=jc(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($c,Nc,Yc,Xc);const Vc=Phaser.Utils.Objects.GetValue;Phaser.Math.Clamp;class Hc extends Bn{constructor(t,e){super(t,{eventEmitter:!1}),this.textObjectType=Ic(this.parent),this.pageStartIndexes=[],this.lines=jc(this.parent,""),this.sections=[],this.resetFromJSON(e)}resetFromJSON(t){this.setMaxLines(Vc(t,"maxLines",void 0)),this.setPageBreak(Vc(t,"pageBreak","\f\n")),this.setText(Vc(t,"text","")),this.startLineIndex=Vc(t,"start",-1),this.endLineIndex=Vc(t,"end",void 0);var e=Vc(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(Ic(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(Hc.prototype,$c);var Uc={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?Wc(this.parent,t):this.parent.setText(t)},appendText(t){var e=this.text.concat(zc(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},Kc=function(t,e){for(var i=void 0,s=0;s0)l=Jc(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=Jc(n,t,a,o)}else c="",this.insertIndex=0;r=c+l}return this.insertChar=r.charAt(this.insertIndex-1),r},Qc={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=Kc(a,e)+s}return this.start(t,i,n,r)},stop:function(t){if(this.getTimer()&&this.freeTimer(),t){for(;!this.isLastChar;)Zc.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(Qc,Uc);const td=Phaser.Utils.Objects.GetFastValue,ed=Phaser.Utils.Objects.GetValue;class id extends Bn{constructor(t,e){super(t,e),this.timer=null,this.resetFromJSON(e)}resetFromJSON(t){this.setTextWrapEnable(ed(t,"wrap",!1)),this.setTypeMode(ed(t,"typeMode",0)),this.setTypingSpeed(ed(t,"speed",333)),this.setTextCallback=td(t,"setTextCallback",null),this.setTextCallbackScope=td(t,"setTextCallbackScope",null),this.setTypingContent(td(t,"text","")),this.typingIndex=td(t,"typingIndex",0),this.insertIndex=null,this.insertChar=null;var e=td(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=sd[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=zc(t);this.textWrapEnable&&(e=function(t,e){switch(Ic(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=Zc.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?Wc(this.parent,t):this.parent.setText(t)}}const sd={"left-to-right":0,"right-to-left":1,"middle-to-sides":2,"sides-to-middle":3};Object.assign(id.prototype,Qc);const rd=Phaser.Utils.Objects.GetValue;const nd={page:0,line:1};var ad=function(t){return t.hasOwnProperty("rexSizer")||(t.rexSizer={}),t.rexSizer};const od=Phaser.Display.Align;var hd={center:od.CENTER,left:od.LEFT_CENTER,right:od.RIGHT_CENTER,top:od.TOP_CENTER,bottom:od.BOTTOM_CENTER,"left-top":od.TOP_LEFT,"top-left":od.TOP_LEFT,"left-center":od.LEFT_CENTER,"center-left":od.LEFT_CENTER,"left-bottom":od.BOTTOM_LEFT,"bottom-left":od.BOTTOM_LEFT,"center-top":od.TOP_CENTER,"top-center":od.TOP_CENTER,"center-center":od.CENTER,"center-bottom":od.BOTTOM_CENTER,"bottom-center":od.BOTTOM_CENTER,"right-top":od.TOP_RIGHT,"top-right":od.TOP_RIGHT,"right-center":od.RIGHT_CENTER,"center-right":od.RIGHT_CENTER,"right-bottom":od.BOTTOM_RIGHT,"bottom-right":od.BOTTOM_RIGHT},ld=function(){},ud=new Phaser.GameObjects.Zone({sys:{queueDepthSort:ld,events:{once:ld}}},0,0,1,1);ud.setOrigin(0);var cd=0,dd=1,pd=2,gd=4,fd=6,vd=8,md=10,yd=12,bd=function(t){var e=jr(t);return t.y+e-e*t.originY},xd=function(t){var e=Ir(t);return t.x-e*t.originX+.5*e},Cd=function(t,e){var i=jr(t);return t.y=e-i+i*t.originY,t},kd=function(t,e){var i=Ir(t),s=i*t.originX;return t.x=e+s-.5*i,t},Sd=function(t){var e=Ir(t);return t.x-e*t.originX},wd=function(t,e){var i=Ir(t);return t.x=e+i*t.originX,t},_d=function(t){var e=Ir(t);return t.x+e-e*t.originX},Ed=function(t,e){var i=Ir(t);return t.x=e-i+i*t.originX,t},Td=function(t,e){var i=jr(t),s=i*t.originY;return t.y=e+s-.5*i,t},Pd=function(t){var e=jr(t);return t.y-e*t.originY+.5*e},Od=function(t){var e=jr(t);return t.y-e*t.originY},Md=function(t,e){var i=jr(t);return t.y=e+i*t.originY,t},Dd=[];Dd[11]=function(t,e,i,s){return void 0===i&&(i=0),void 0===s&&(s=0),kd(t,xd(e)+i),Cd(t,bd(e)+s),t},Dd[md]=function(t,e,i,s){return void 0===i&&(i=0),void 0===s&&(s=0),wd(t,Sd(e)-i),Cd(t,bd(e)+s),t},Dd[yd]=function(t,e,i,s){return void 0===i&&(i=0),void 0===s&&(s=0),Ed(t,_d(e)+i),Cd(t,bd(e)+s),t},Dd[fd]=function(t,e,i,s){return void 0===i&&(i=0),void 0===s&&(s=0),function(t,e,i){kd(t,e),Td(t,i)}(t,xd(e)+i,Pd(e)+s),t},Dd[gd]=function(t,e,i,s){return void 0===i&&(i=0),void 0===s&&(s=0),wd(t,Sd(e)-i),Td(t,Pd(e)+s),t},Dd[vd]=function(t,e,i,s){return void 0===i&&(i=0),void 0===s&&(s=0),Ed(t,_d(e)+i),Td(t,Pd(e)+s),t},Dd[dd]=function(t,e,i,s){return void 0===i&&(i=0),void 0===s&&(s=0),kd(t,xd(e)+i),Md(t,Od(e)-s),t},Dd[cd]=function(t,e,i,s){return void 0===i&&(i=0),void 0===s&&(s=0),wd(t,Sd(e)-i),Md(t,Od(e)-s),t},Dd[pd]=function(t,e,i,s){return void 0===i&&(i=0),void 0===s&&(s=0),Ed(t,_d(e)+i),Md(t,Od(e)-s),t};var Ad=function(t,e,i,s,r){return Dd[i](t,e,s,r)},Ld=function(t,e,i,s,r,n){ud.setPosition(e,i).setSize(s,r),Ad(t,ud,n)};const Rd=Phaser.Utils.Objects.GetValue,Fd=Phaser.GameObjects.Group;var Bd=function(t,e,i){return t.add.text(0,0,"")},Id=void 0;const jd=il.prototype.add;var zd=function(t){return jd.call(this,t),this.sizerEventsEnable&&(t.emit("sizer.add",t,this),this.emit("add",t,this)),this},Nd={addBackground(t,e,i){return void 0===this.backgroundChildren&&(this.backgroundChildren=[]),"string"==typeof e&&(i=e,e=void 0),void 0===e&&(e=0),zd.call(this,t),this.backgroundChildren.push(t),this.getSizerConfig(t).padding=xl(e),void 0!==i&&this.addChildrenMap(i,t),this},isBackground(t){return void 0!==this.backgroundChildren&&-1!==this.backgroundChildren.indexOf(t)}},Gd=function(t,e){var i=null;if(void 0===e)t.hasOwnProperty("rexContainer")&&((i=t.rexContainer.parent)?i.isRexSizer||(i=Gd(i)):i=null);else for(i=Gd(t);i&&i.name!==e;)i=Gd(i);return i},Yd={getParentSizer(t,e){return"string"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),Gd(t,e)},getTopmostSizer(t){return void 0===t&&(t=this),function(t){for(var e=Gd(t);e;)t=e,e=Gd(e);return t}(t)},hasParentSizer(t,e){void 0===e&&(e=this);for(var i=Gd(e);i;){if(i===t)return!0;i=Gd(i)}return!1},hasChild(t,e){return void 0===e&&(e=this),this.hasParentSizer(e,t)}};const Wd=Phaser.Utils.Array.Remove,Xd=il.prototype.remove,$d=Yd.getParentSizer;var Vd=function(t,e){for(var i=$d(t);i;)i.removeChildCallback&&i.removeChildCallback(t,e),i=$d(i);return this.isBackground(t)&&Wd(this.backgroundChildren,t),Xd.call(this,t,e),!e&&this.sizerEventsEnable&&(t.emit("sizer.remove",t,this),this.emit("remove",t,this)),this};const Hd=Phaser.Utils.Array.Remove,Ud=Yd.getParentSizer;var qd={removeFromParentSizer(){var t=Ud(gameObject);return t&&t.remove(this),this},removeBackground(t,e){return void 0===this.backgroundChildren||this.getParentSizer(t)!==this||(Hd(this.backgroundChildren,t),Vd.call(this,t,e)),this},removeAllBackgrounds(t){if(void 0===this.backgroundChildren)return this;for(var e=this.backgroundChildren.length-1;e>=0;e--)this.remove(this.backgroundChildren[e],t);return this}},Kd=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 Jd=/(\S+)\[(\d+)\]/i;const Zd=Phaser.Utils.Objects.GetValue;var Qd=function(t,e){return void 0===e?t:t[e]},tp=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=Zd(e,"left",0),t.right=Zd(e,"right",0),t.top=Zd(e,"top",0),t.bottom=Zd(e,"bottom",0)),t},ep={getInnerPadding(t){return Qd(this.space,t)},setInnerPadding(t,e){return tp(this.space,t,e),this},getOuterPadding(t){return Qd(this.getSizerConfig(this).padding,t)},setOuterPadding(t,e){return tp(this.getSizerConfig(this).padding,t,e),this},getChildOuterPadding(t,e){return"string"==typeof t&&(t=this.getElement(t)),Qd(this.getSizerConfig(t).padding,e)},setChildOuterPadding(t,e,i){return"string"==typeof t&&(t=this.getElement(t)),tp(this.getSizerConfig(t).padding,e,i),this}},ip=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}},sp=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},rp=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},np=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}},ap=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},op=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},hp={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}},lp=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 vg={delayCall(t,e,i){return this.delayCallTimer=function(t,e,i,s,r){var n=Dn(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}},mg={setTransitInTime(t){return this.transitInTime=t,this},setTransitOutTime(t){return this.transitOutTime=t,this},setTransitInCallback(t){return t||(t=ld),this.transitInCallback=t,this},setTransitOutCallback(t){return t||(t=ld),this.transitOutCallback=t,this}},yg={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}},bg={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}},xg={};Object.assign(xg,vg,mg,yg,bg);const Cg=Phaser.Utils.Objects.GetValue;class kg extends Bn{constructor(t,e){super(t,e),this.setTransitInTime(Cg(e,"duration.in",200)),this.setTransitOutTime(Cg(e,"duration.out",200)),this.setTransitInCallback(Cg(e,"transitIn")),this.setTransitOutCallback(Cg(e,"transitOut")),this.oneShotMode=Cg(e,"destroy",!1),this.delayCallTimer=void 0,this._state=new fg(this,{eventEmitter:!1,initState:Cg(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(kg.prototype,xg);const Sg=Phaser.GameObjects.Rectangle;class wg extends Sg{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 _g=Phaser.Utils.Objects.GetValue;class Eg extends Bn{constructor(t,e){super(t,{eventEmitter:!1}),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setHitAreaMode(_g(t,"hitAreaMode",0)),this.setEnable(_g(t,"enable",!0)),this.setStopMode(_g(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=Tg[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 Tg={default:0,fullWindow:1};const Pg=Phaser.Utils.Objects.GetValue;class Og extends wg{constructor(t,e){super(t,Pg(e,"color",0),Pg(e,"alpha",.8)),this.touchEventStop=new Eg(this,{hitAreaMode:1})}}var Mg={popUp(t,e){void 0!==t._modalScaleSave?(t.scaleX=t._modalScaleSave,t.scaleY=t._modalScaleSave):t._modalScaleSave=t.scaleX,wp(t,e)},scaleDown(t,e){_p(t,e,void 0,void 0,!1)},fadeIn(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Ip(t,e)},fadeOut(t,e){jp(t,e,!1)}},Dg=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Ip(t,e,t.alpha)},Ag=function(t,e){jp(t,e,!1)},Lg=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 Rg=Phaser.Utils.Objects.GetValue;let Fg=class extends kg{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=Bg.popUp),null==e.transitOut&&(e.transitOut=Bg.scaleDown),e.destroy=Rg(e,"destroy",!0),super(t,e);var i=Rg(e,"cover");this.cover=!1!==i?function(t,e){var i=t.scene,s=new Og(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(Rg(i,"transitIn",Dg)),this.setCoverTransitOutCallback(Rg(i,"transitOut",Ag)));var s=Rg(e,"touchOutsideClose",!1),r=Rg(e,"duration.hold",-1),n=Rg(e,"timeOutClose",r>=0),a=Rg(e,"anyTouchClose",!1);Rg(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),Rg(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&&Lg(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=Bg[t]),t){case Bg.popUp:t=Mg.popUp;break;case Bg.fadeIn:t=Mg.fadeIn}return super.setTransitInCallback(t),this}setTransitOutCallback(t){switch("string"==typeof t&&(t=Bg[t]),t){case Bg.scaleDown:t=Mg.scaleDown;break;case Bg.fadeOut:t=Mg.fadeOut}return super.setTransitOutCallback(t),this}setCoverTransitInCallback(t){return this.coverTransitInCallback=t,this}setCoverTransitOutCallback(t){return this.coverTransitOutCallback=t,this}};const Bg={popUp:0,fadeIn:1,scaleDown:0,fadeOut:1};var Ig=function(t){return t&&"function"==typeof t},jg={modal(t,e){return Ig(t)&&(e=t,t=void 0),void 0===this._modalBehavior&&(this.onCreateModalBehavior&&this.onCreateModalBehavior(this,t),this._modalBehavior=function(t,e){var i=new Fg(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}},zg=function(t,e,i,s,r){Ig(e)&&(r=s,s=i,i=e,e=this);var n=this.scene.events;return this.bindEvent(e,n,t,i,s,r),this},Ng={bindEvent(t,e,i,s,r,n){return"string"==typeof e&&(n=r,r=s,s=i,i=e,e=t,t=this),fo(t,e,i,s,r,n),this},bindScenePreupdateEvent(t,e,i,s){return zg.call(this,"preupdate",t,e,i,s),this},bindSceneUpdateEvent(t,e,i,s){return zg.call(this,"update",t,e,i,s),this},bindScenePostupdateEvent(t,e,i,s){return zg.call(this,"postupdate",t,e,i,s),this},bindSceneRenderEvent(t,e,i,s){return zg.call(this,"render",t,e,i,s),this},bindScenePauseEvent(t,e,i,s){return zg.call(this,"pause",t,e,i,s),this},bindSceneResumeEvent(t,e,i,s){return zg.call(this,"resume",t,e,i,s),this},bindSceneSleepEvent(t,e,i,s){return zg.call(this,"sleep",t,e,i,s),this},bindSceneWakeEvent(t,e,i,s){return zg.call(this,"wake",t,e,i,s),this},bindSceneShutdownEvent(t,e,i,s){return zg.call(this,"shutdown",t,e,i,s),this}},Gg=function(t,e,i){var s=t.camera;return s?(void 0===i?i={}:!0===i&&(i=Yg),s===e?(i.x=t.worldX,i.y=t.worldY):s.getWorldPoint(t.x,t.y,i),i):null},Yg={},Wg=function(t,e,i,s){var r,n=t.scene.sys.cameras.main,a=0===t.scrollFactorX&&0===t.scrollFactorY;if(e)return a?Lg(t,e.x,e.y,i,s):!!(r=Gg(e,n,!0))&&Lg(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 ef={press:0,pointerdown:0,release:1,pointerup:1};var sf={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 tf(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}},rf=function(t,e,i,s,r){if(e)return!(i&&!i(t,e))&&(!!nf(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 af.length=0,!0;return af.length=0,!1},af=[];const of=Phaser.Utils.Objects.GetValue;class hf extends Bn{constructor(t,e){super(t,e),this._enable=void 0;var i=of(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(of(t,"enable",!0)),this.setMode(of(t,"mode",1)),this.setClickInterval(of(t,"clickInterval",100)),this.setDragThreshold(of(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=lf[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?rf:Wg)(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 lf={press:0,pointerdown:0,release:1,pointerup:1};var uf={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 hf(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 gg{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 df=Phaser.Utils.Objects.GetValue;class pf extends Bn{constructor(t,e){super(t,e),this._enable=void 0,this.cooldown=new cf,this.parent.setInteractive(df(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.prevIsInTouch=!1,this.isInTouching=!1,this.setEnable(df(t,"enable",!0)),this.setCooldown(df(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 gf={isPointerInBounds(t){return void 0===t?t=this:"string"==typeof t&&(t=this.getElement(t)),!!t&&Wg(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 pf(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 pf(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}},ff={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}},vf=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=Af,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===Lf&&this.onDragEnd(),this.pointer=void 0,this.tracerState=Af,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=Rf,this}isPointerInGameObject(t,e,i){var s=this.lastPointer;return!!s&&Wg(t,s,e,i)}}const Af=0,Lf=1,Rf="IDLE",Ff=Phaser.Utils.Objects.GetValue,Bf=Phaser.Math.Distance.Between;class If extends Df{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=jf},eventEmitter:!1};this.setRecongizedStateObject(new gg(s))}resetFromJSON(t){super.resetFromJSON(t),this.setHoldTime(Ff(t,"time",250)),this.setTapInterval(Ff(t,"tapInterval",200)),this.setDragThreshold(Ff(t,"threshold",9)),this.setTapOffset(Ff(t,"tapOffset",10));var e=Ff(t,"taps",void 0);return void 0!==e?this.setTaps(e):(this.setMaxTaps(Ff(t,"maxTaps",void 0)),this.setMinTaps(Ff(t,"minTaps",void 0))),this}onDragStart(){switch(this.state){case jf:this.state=zf;break;case zf:var t=this.lastPointer;Bf(t.upX,t.upY,t.x,t.y)>this.tapOffset&&(this.state=Nf,this.state=zf);break;case Nf:this.state=zf}}onDragEnd(){this.state===zf&&(this.tapsCount++,this.emit("tapping",this,this.gameObject,this.lastPointer),void 0!==this.maxTaps&&this.tapsCount===this.maxTaps&&(this.state=Nf))}onDrag(){this.state!==jf&&this.pointer.getDistance()>this.dragThreshold&&(this.state=jf)}preUpdate(t,e){if(this.isRunning&&this.enable&&this.state===zf){var i=this.lastPointer;if(i.isDown)t-i.downTime>this.holdTime&&(this.state=jf);else t-i.upTime>this.tapInterval&&(void 0===this.minTaps||this.tapsCount>=this.minTaps?this.state=Nf:this.state=jf)}}postUpdate(t,e){this.isRunning&&this.enable&&this.state===Nf&&(this.state=jf)}get isTapped(){return this.state===Nf}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 jf="IDLE",zf="BEGIN",Nf="RECOGNIZED",Gf=Phaser.Utils.Objects.GetValue;class Yf extends Df{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=Wf},eventEmitter:!1};this.setRecongizedStateObject(new gg(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(Gf(t,"threshold",9)),this.setHoldTime(Gf(t,"time",251)),this}onDragStart(){this.state=Xf,0===this.holdTime&&(this.state=$f)}onDragEnd(){this.state=Wf}onDrag(){this.state!==Wf&&this.pointer.getDistance()>this.dragThreshold&&(this.state=Wf)}preUpdate(t,e){this.isRunning&&this.enable&&(this.state===Xf&&t-this.pointer.downTime>=this.holdTime&&(this.state=$f))}get isPressed(){return this.state===$f}setHoldTime(t){return this.holdTime=t,this}setDragThreshold(t){return this.dragThreshold=t,this}}const Wf="IDLE",Xf="BEGIN",$f="RECOGNIZED";Phaser.Utils.Objects.GetValue;var Vf=function(t){return Rn(t).loop.delta};const Hf=Phaser.Math.Distance.Between,Uf=Phaser.Math.Angle.Between;var qf={getDt:function(){return Vf(this.scene)},getVelocity:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Hf(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 Uf(e.x,e.y,t.x,t.y)}},Kf={"up&down":0,"left&right":1,"4dir":2,"8dir":3},Jf={};const Zf=Phaser.Utils.Objects.GetValue,Qf=Phaser.Math.RadToDeg;class tv extends Df{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=ev},eventEmitter:!1};this.setRecongizedStateObject(new gg(s)),this.clearDirectionStates()}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(Zf(t,"threshold",10)),this.setVelocityThreshold(Zf(t,"velocityThreshold",1e3)),this.setDirectionMode(Zf(t,"dir","8dir")),this}onDragStart(){this.state=iv}onDragEnd(){this.state=ev}onDrag(){this.state===iv&&(this.validDrag||(this.validDrag=0===this.dragThreshold||this.pointer.getDistance()>=this.dragThreshold),this.validDrag&&this.dragVelocity>this.velocityThreshold&&(this.state=sv))}postUpdate(t,e){this.isRunning&&this.enable&&this.state===sv&&(this.state=ev)}get isSwiped(){return this.state===sv}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=Kf[t]),this.dirMode=t,this}updateDirectionStates(){return function(t,e,i){switch(void 0===i?i={}:!0===i&&(i=Jf),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}}(Qf(this.getVelocityAngle()),this.dirMode,this),this}clearDirectionStates(){return this.left=!1,this.right=!1,this.up=!1,this.down=!1,this}}Object.assign(tv.prototype,qf);const ev="IDLE",iv="BEGIN",sv="RECOGNIZED",rv=Phaser.Utils.Objects.GetValue,nv=Phaser.Utils.Array.SpliceOne,av=Phaser.Math.Distance.Between,ov=Phaser.Math.Angle.Between;class hv{constructor(t,e){var i=Dn(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(rv(e,"inputConfig",void 0)),this.setEventEmitter(rv(e,"eventEmitter",void 0)),this._enable=void 0,this.pointers=[],this.movedState={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setEnable(rv(t,"enable",!0)),this.bounds=rv(t,"bounds",void 0),this.tracerState=uv,this.pointers.length=0,oo(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,oo(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 uv:this.tracerState=cv,this.onDrag1Start();break;case cv:this.tracerState=dv,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],nv(this.pointers,e),this.tracerState){case cv:this.tracerState=uv,this.onDrag1End();break;case dv: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 dv:this.onDrag2()}}}dragCancel(){return this.tracerState===dv&&this.onDrag2End(),this.pointers.length=0,oo(this.movedState),this.tracerState=uv,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!==dv)return 0;var t=this.pointers[0],e=this.pointers[1];return av(t.x,t.y,e.x,e.y)}get angleBetween(){if(this.tracerState!==dv)return 0;var t=this.pointers[0],e=this.pointers[1];return ov(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;lv.x=e.x-i.x,lv.y=e.y-i.y}else lv.x=0,lv.y=0;return lv}get centerX(){if(this.tracerState!==dv)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.x+e.x)/2}get centerY(){if(this.tracerState!==dv)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.y+e.y)/2}get prevCenterX(){if(this.tracerState!==dv)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!==dv)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=pv,this}isPointer0InGameObject(t,e,i){var s=this.pointers[0];return!!s&&Wg(t,s,e,i)}isPointer1InGameObject(t,e,i){var s=this.pointers[1];return!!s&&Wg(t,s,e,i)}}Object.assign(hv.prototype,hr);var lv={};const uv=0,cv=1,dv=2,pv="IDLE";Phaser.Utils.Objects.GetValue;const gv=Phaser.Math.RotateAround;var fv=function(t,e,i,s){return gv(t,e,i,s),t.rotation+=s,t},vv={};const mv=Phaser.Utils.Objects.GetValue,yv=Phaser.Math.Angle.WrapDegrees,bv=Phaser.Math.Angle.ShortestBetween,xv=Phaser.Math.RadToDeg,Cv=Phaser.Math.DegToRad;var kv={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=vv),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=yv(xv(this.angleBetween));this.angle=bv(this.prevAngle,t),this.prevAngle=t,this.state=_v}break;case _v:t=yv(xv(this.angleBetween));this.angle=bv(this.prevAngle,t),this.prevAngle=t,this.emit("rotate",this)}}get isRotated(){return this.state===_v}get rotation(){return Cv(this.angle)}setDragThreshold(t){return this.dragThreshold=t,this}}.prototype,kv);const Sv="IDLE",wv="BEGIN",_v="RECOGNIZED",Ev=Phaser.Utils.Objects.GetValue;var Tv=function(t){var e=Ev(t,"tap",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._tap=new If(this,e),this._tap.on("tap",(function(t,e,s){mf(i.eventEmitter,`${i.eventNamePrefix}${t.tapsCount}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Pv=Phaser.Utils.Objects.GetValue;var Ov=function(t){var e=Pv(t,"press",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._press=new Yf(this,e),this._press.on("pressstart",(function(t,e,s){mf(i.eventEmitter,`${i.eventNamePrefix}pressstart`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this).on("pressend",(function(t,e,s){mf(i.eventEmitter,`${i.eventNamePrefix}pressend`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Mv=Phaser.Utils.Objects.GetValue;var Dv=function(t){var e=Mv(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 tv(this,e),this._swipe.on("swipe",(function(t,e,s){var r=t.left?"left":t.right?"right":t.up?"up":"down";mf(i.eventEmitter,`${i.eventNamePrefix}swipe${r}`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Av=Phaser.Utils.Objects.GetValue;var Lv=function(t,e){return t.setInteractive(),Av(e,"dropZone",!1)&&(t.input.dropZone=!0),t._childrenInteractive={targetSizers:Av(e,"targets",[t]),targetMode:Av(e,"targetMode","parent"),eventEmitter:Av(e,"eventEmitter",t),eventNamePrefix:Av(e,"inputEventPrefix","child.")},bf.call(t,e),kf.call(t,e),_f.call(t,e),Of.call(t,e),Tv.call(t,e),Ov.call(t,e),Dv.call(t,e),t},Rv={getSizerConfig:function(t){return void 0===t&&(t=this),ad(t)},getChildPrevState:function(t){var e=ad(t);return e.hasOwnProperty("prevState")||(e.prevState={}),e.prevState},pushIntoBounds:function(t){return void 0===t&&(t=an(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=Rd(e,"color"),s=Rd(e,"lineWidth");var h=Rd(e,"name",!1);h&&(r=Rd(h,"createTextCallback",Bd),n=Rd(h,"createTextCallbackScope",void 0),"string"==typeof(a=Rd(h,"align","left-top"))&&(a=hd[a]))}if(void 0===i&&(i=16777215),void 0===s&&(s=1),r&&!t.children){t.children=new Fd(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)}}for(var u,c,d=this.getAllShownChildren([this]),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 Wv=Phaser.Utils.Objects.IsPlainObject,Xv=Phaser.Utils.Objects.GetValue,$v=Phaser.Display.Align.CENTER,Vv={min:0,full:-1};var Hv=function(t,e,i,s,r,n,a,o,h,l){zd.call(this,t);var u=t.isRexSpace,c=typeof e;if(null===e)return this;if("number"===c);else if("string"===c)e=Vv[e];else if(Wv(e)){var d;e=Xv(d=e,"proportion",void 0),i=Xv(d,"align",$v),s=Xv(d,"padding",0),r=Xv(d,"expand",!1),n=Xv(d,"key",void 0),a=Xv(d,"index",void 0),t.isRexSizer||(o=Xv(d,"minWidth",void 0),h=Xv(d,"minHeight",void 0)),l=Xv(d,"fitRatio",0)}return"string"==typeof i&&(i=hd[i]),void 0===e&&(e=u?1:0),void 0===i&&(i=$v),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===o&&(u?o=0:t.isRexSizer||(o=t._minWidth)),void 0===h&&(u?h=0:t.isRexSizer||(h=t._minHeight)),void 0===l||!1===l?l=0:!0===l&&(l=Ir(t)/jr(t)),(d=this.getSizerConfig(t)).proportion=e,d.align=i,d.padding=xl(s),d.expand=r,d.fitRatio=0===e?l:0,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},Uv={add:Hv,addSpace(t){return this.insertSpace(void 0,t),this},insertSpace(t,e){return void 0===e&&(e=1),Hv.call(this,new Gv(this.scene),{proportion:e,minWidth:0,minHeight:0,index:t}),this},insert(t,e,i,s,r,n,a,o){return Wv(i)&&(i.index=t),Hv.call(this,e,i,s,r,n,a,t,o),this},insertAtPosition(t,e,i,s,r,n,a,o,h){var l=Yv.call(this,t,e);return-1===l&&(l=void 0),this.insert(l,i,s,r,n,a,o,h),this}};const qv=il.prototype.clear;var Kv=function(t){this.backgroundChildren&&(this.backgroundChildren.length=0);var e,i=!t&&this.sizerEventsEnable;if(i&&(e=this.getChildren([])),qv.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,Kv.call(this,t),this}},Qv={getChildAlign(t){return this.getSizerConfig(t).align},setChildAlign(t,e){return"string"==typeof e&&(e=hd[e]),this.getSizerConfig(t).align=e,this}},tm={getChildProportion(t){return this.getSizerConfig(t).proportion},setChildProportion(t,e){return this.getSizerConfig(t).proportion=e,this}},em={getChildExpand(t){return this.getSizerConfig(t).expand},setChildExpand(t,e){return this.getSizerConfig(t).expand=e,this}},im={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}},sm={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&&(dp(t,0,0),e.resolved=!1,this.hasRatioFitChild=!0);return this._childrenProportion=void 0,this.hasProportion0Child=!1,this.proportionLength=void 0,lp.call(this),this},layoutChildren:function(){for(var t,e,i,s,r,n,a,o,h,l,u=this.sizerChildren,c=this.innerLeft,d=this.innerTop,p=this.innerWidth,g=this.innerHeight,f=c,v=d,m=this.startChildIndex,y=0,b=u.length;y0?(e=t-this.getChildrenWidth(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},resolveHeight:function(t){if(void 0!==(t=np.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)||sp.call(this)},runWidthWrap:function(t){this.wrapResult||(1===this.orientation&&zv.call(this,t,void 0),rp.call(this,t))},hasHeightWrap:function(){return!(!this.hasRatioFitChild||0!==this.orientation)||ap.call(this)},runHeightWrap:function(t){this.wrapResult||(0===this.orientation&&zv.call(this,void 0,t),op.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(sm,Uv,Zv,Qv,tm,em,im);var rm=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},nm={x:0,h:0,horizontal:0,"left-to-right":0,y:1,v:1,vertical:1,"top-to-bottom":1},am=function(t){return"string"==typeof t&&(t=nm[t]),t};const om=Phaser.Utils.Objects.IsPlainObject,hm=Phaser.Utils.Objects.GetValue;class lm extends Bv{constructor(t,e,i,s,r,n,a){om(e)?(e=hm(a=e,"x",0),i=hm(a,"y",0),s=hm(a,"width",void 0),r=hm(a,"height",void 0),n=hm(a,"orientation",0)):om(s)?(s=hm(a=s,"width",void 0),r=hm(a,"height",void 0),n=hm(a,"orientation",0)):om(n)&&(n=hm(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(hm(a,"space.item",0)),this.setStartChildIndex(hm(a,"startChildIndex",0)),this.setRTL(hm(a,"rtl",!1)),this.addChildrenMap("items",this.sizerChildren)}setOrientation(t){return this.orientation=am(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=rm.call(this)),this._childrenProportion}}Object.assign(lm.prototype,sm);var um=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},dm={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 pm extends lm{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&&(um(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&&(um(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&&um(t,this.iconWidth,this.iconHeight);var e=this.childrenMap.action;e&&void 0!==this.actionWidth&&void 0!==this.actionHeight&&um(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(pm.prototype,dm);var gm=function(t,e,i,s){var r=new Sl(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 fm=Phaser.Utils.Objects.GetValue;const vm=Phaser.Utils.Objects.GetValue;var mm=/^[\x00-\x7F]+$/,ym=function(t){return mm.test(t)},bm=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},Cm=0,km=1,Sm=2,wm=0,_m=1,Em=2,Tm=/(?:\r\n|\r|\n)/;const Pm={none:wm,word:_m,char:Em,character:Em,mix:3};var Om=function(t,e){switch(Ic(t)){case 0:switch("string"==typeof e&&(e=Pm[e]||0),t.style.wrapMode=e,e){case 2:case 3:t.style.wordWrapCallback=bm;break;default:t.style.wordWrapCallback=null}break;case 1:"string"==typeof e&&(e=Pm[e]||0),t.style.wrapMode=e}};const Mm=Phaser.Renderer.WebGL.Utils;var Dm={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=Mm.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 Am=Phaser.Display.Color;var Lm={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 Am);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}},Rm=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)},Fm={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,Rm(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}};Zo();const Bm=Phaser.Display.Canvas.CanvasPool,Im=Phaser.GameObjects.GameObject,jm=Phaser.Utils.String.UUID;class zm extends Im{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=Bm.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=jm(),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(){Bm.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 Nm=Phaser.GameObjects.Components;Phaser.Class.mixin(zm,[Nm.Alpha,Nm.BlendMode,Nm.Crop,Nm.Depth,Nm.Flip,Nm.GetBounds,Nm.Mask,Nm.Origin,Nm.Pipeline,Nm.PostPipeline,Nm.ScrollFactor,Nm.Tint,Nm.Transform,Nm.Visible,Dm,Lm,Fm]);let Gm=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(Gm.prototype,ql);var Ym={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 Wm=Phaser.Math.RotateAround;var Xm;const $m=Phaser.Geom.Rectangle;var Vm,Hm=function(t){void 0===Vm&&(Vm=new $m);var e=t.drawTLX,i=t.drawTLY;return Vm.setTo(e,i,t.drawTRX-e,t.drawBLY-i),Vm};const Um=Phaser.Math.RotateAround;var qm,Km=function(t,e,i,s){return void 0===s?s={}:!0===s&&(void 0===qm&&(qm={}),s=qm),s.x=e,s.y=i,0!==t.rotation&&Um(s,0,0,t.rotation),s.x=s.x*t.scaleX+t.drawX,s.y=s.y*t.scaleY+t.drawY,s};const Jm=Phaser.GameObjects.Components.TransformMatrix;var Zm,Qm,ty={},ey=function(t,e,i,s,r){var n=Km(e,i,s,!0),a=function(t,e,i,s){void 0===s?s={}:!0===s&&(s=ty);var r=e-t.width*t.originX,n=i-t.height*t.originY;return void 0===Zm&&(Zm=new Jm,Qm=new Jm),t.parentContainer?t.getWorldTransformMatrix(Zm,Qm):Zm.applyITRS(t.x,t.y,t.rotation,t.scaleX,t.scaleY),Zm.transformPoint(r,n,s),s}(t,n.x,n.y,r);return a},iy=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 ey(t,e,n,a,r)},sy={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===Xm&&(Xm={}),s=Xm),s.x=(t-i.drawX)/i.scaleX,s.y=(e-i.drawY)/i.scaleY,0!==i.rotation&&Wm(s,0,0,-i.rotation),s}(t,e,this,!0);return Hm(this).contains(i.x,i.y)},getWorldPosition:function(t,e,i){return iy(this.parent,this,t,e,i)}};Object.assign(sy,Ym);const ry=Phaser.Math.DegToRad,ny=Phaser.Math.RadToDeg,ay=Phaser.Utils.Objects.GetValue;class oy extends Gm{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 ny(this._rotation)}set angle(t){this.rotation=ry(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=ay(t,"width",void 0),i=ay(t,"height",void 0),s=ay(t,"scaleX",void 0),r=ay(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(oy.prototype,sy);const hy=Phaser.Utils.String.Pad;var ly=function(t,e,i){if(null==t)return t;switch(typeof t){case"string":default:return t;case"number":return`#${hy(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}},uy=function(t,e,i){return e.hasOwnProperty(t)?e[t]:i[t]};const cy=Phaser.Utils.Objects.GetValue;let dy=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=py(cy(t,"tl",void 0),e,i),s.tr=py(cy(t,"tr",void 0),e,i),s.bl=py(cy(t,"bl",void 0),e,i),s.br=py(cy(t,"br",void 0),e,i)}get radiusTL(){var t=this.cornerRadius.tl;return Math.max(t.x,t.y)}set radiusTL(t){gy(this.cornerRadius.tl,t)}get radiusTR(){var t=this.cornerRadius.tr;return Math.max(t.x,t.y)}set radiusTR(t){gy(this.cornerRadius.tr,t)}get radiusBL(){var t=this.cornerRadius.bl;return Math.max(t.x,t.y)}set radiusBL(t){gy(this.cornerRadius.bl,t)}get radiusBR(){var t=this.cornerRadius.br;return Math.max(t.x,t.y)}set radiusBR(t){gy(this.cornerRadius.br,t)}};var py=function(t,e,i){return void 0===t?t={x:e,y:i}:"number"==typeof t&&(t={x:t,y:t}),fy(t),t},gy=function(t,e){"number"==typeof e?(t.x=e,t.y=e):(t.x=cy(e,"x",0),t.y=cy(e,"y",0)),fy(t)},fy=function(t){t.convex=t.x>=0||t.y>=0,t.x=Math.abs(t.x),t.y=Math.abs(t.y)};const vy=Phaser.Math.DegToRad;var my=function(t){return!t.hasOwnProperty("convex")||t.convex},yy=function(t){return t.x>0&&t.y>0},by=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,yy(o)?(h=o.x*f,l=o.y*v,my(o)?by(t,h,l,h,l,180,270,!1,a):by(t,0,0,h,l,90,0,!0,a),u=0,c=l):(t.lineTo(0,0),u=0,c=0),o=m.tr,yy(o)?(h=o.x*f,l=o.y*v,my(o)?by(t,s-h,l,h,l,270,360,!1,a):by(t,s,0,h,l,180,90,!0,a)):t.lineTo(s,0),o=m.br,yy(o)?(h=o.x*f,l=o.y*v,my(o)?by(t,s-h,r-l,h,l,0,90,!1,a):by(t,s,r,h,l,270,180,!0,a)):t.lineTo(s,r),o=m.bl,yy(o)?(h=o.x*f,l=o.y*v,my(o)?by(t,h,r-l,h,l,90,180,!1,a):by(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())},Cy=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),xy(t.canvas,t.context,u,u,h,l,r,e,i,s,n,a,o)}};const ky=Phaser.Utils.Objects.GetValue;class Sy extends oy{constructor(t,e){super(t,"background"),this.setScrollFactor(0),this.setColor(ky(e,"color",null),ky(e,"color2",null),ky(e,"horizontalGradient",!0)),this.setStroke(ky(e,"stroke",null),ky(e,"strokeThickness",2)),this.setCornerRadius(ky(e,"cornerRadius",0),ky(e,"cornerIteration",null))}set color(t){t=ly(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=ly(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=ly(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,uy("color2",t,this),uy("horizontalGradient",t,this)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,uy("strokeThickness",t,this)),t.hasOwnProperty("cornerRadius")&&this.setCornerRadius(t.cornerRadius,uy("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(){Cy(this.parent,this.color,this.stroke,this.strokeThickness,this.cornerRadius,this.color2,this.horizontalGradient,this.cornerIteration)}}const wy=Phaser.Utils.Objects.GetValue;class _y extends oy{constructor(t,e){super(t,"innerbounds"),this.setScrollFactor(0),this.setColor(wy(e,"color",null),wy(e,"color2",null),wy(e,"horizontalGradient",!0)),this.setStroke(wy(e,"stroke",null),wy(e,"strokeThickness",2))}set color(t){t=ly(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=ly(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=ly(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,wy(t,"color2",null),wy(t,"horizontalGradient",!0)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,wy(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 Ey=Phaser.Utils.Objects.GetValue;let Ty=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(Ey(t,"bold",!1)),this.setItalic(Ey(t,"italic",!1)),this.setFontSize(Ey(t,"fontSize","16px")),this.setFontFamily(Ey(t,"fontFamily","Courier")),this.setColor(Ey(t,"color","#fff")),this.setStrokeStyle(Ey(t,"stroke",null),Ey(t,"strokeThickness",0)),this.setShadow(Ey(t,"shadowColor",null),Ey(t,"shadowOffsetX",0),Ey(t,"shadowOffsetY",0),Ey(t,"shadowBlur",0)),this.setOffset(Ey(t,"offsetX",0),Ey(t,"offsetY",0)),this.setSpace(Ey(t,"leftSpace",0),Ey(t,"rightSpace",0)),this.setAlign(Ey(t,"align",void 0)),this.setBackgroundColor(Ey(t,"backgroundColor",null)),this.setBackgroundHeight(Ey(t,"backgroundHeight",void 0)),this.setBackgroundBottomY(Ey(t,"backgroundBottomY",void 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(uy("stroke",t,this),uy("strokeThickness",t,this)),t.hasOwnProperty("shadowColor")&&this.setShadowColor(t.shadowColor),(t.hasOwnProperty("shadowOffsetX")||t.hasOwnProperty("shadowOffsetY"))&&this.setShadowOffset(uy("shadowOffsetX",t,this),uy("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),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=ly(t),this}get hasFill(){return null!=this.color}setStrokeStyle(t,e){return this.stroke=ly(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=ly(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=ly(t),this}get hasBackgroundColor(){return null!=this.backgroundColor}setBackgroundHeight(t){return this.backgroundHeight=t,this}setBackgroundBottomY(t){return this.backgroundBottomY=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 Py=Phaser.Utils.Array.Remove;const Oy=Phaser.Utils.Array.Remove;const My="text",Dy="image",Ay="drawer",Ly="space",Ry="command";var Fy=function(t){return t.type===My&&"\n"===t.text},By=function(t){return t.type===My&&"\f"===t.text},Iy=function(t){return t.type===My};class jy extends oy{constructor(t,e,i){super(t,My),this.updateTextFlag=!1,this.style=new Ty(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,s=this.drawTRX-i+1,r=e.backgroundBottomY;null==r&&(r=this.drawBLY);var n=e.backgroundHeight;null==n&&(n=r-this.drawTLY);var a=r-n;t.fillRect(i,a,s,n)}var o=e.hasFill,h=e.hasStroke;(o||h)&&(e.syncFont(t).syncStyle(t),h&&(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 zy=function(t,e){var i=this.createCharChildren(t,e);return this.addChild(i),this};const Ny=Phaser.Display.Canvas.CanvasPool;var Gy=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=Ny.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),Ny.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 Yy extends oy{constructor(t,e,i){super(t,Dy),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(){Gy(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 Wy extends oy{constructor(t,e,i,s){super(t,Ay),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 Xy extends oy{constructor(t,e){super(t,Ly),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 $y extends Gm{constructor(t,e,i,s,r){super(t,Ry),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 Vy=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 Hy={none:0,word:1,char:2,character:2,mix:3};var Uy=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=Zy.call(this)).height,a=l.ascent,i=Math.floor((h-a)/n)}else{var l;n=(l=Zy.call(this)).height,a=l.ascent}}else if(this.fixedHeight>0){if(void 0===(i=tb(t,"maxLines"))){h=this.fixedHeight-s;i=Math.floor(h/n)}}else i=tb(t,"maxLines",0);void 0===a&&(a=n);var u=0===i,c=tb(t,"wrapMode");void 0===c&&(c=tb(t,"charWrap",!1)?"char":"word");"string"==typeof c&&(c=Hy[c]);var d=tb(t,"wrapWidth",void 0);void 0===d&&(this.fixedWidth>0?d=this.fixedWidth-r:(d=1/0,c=0));for(var p=tb(t,"letterSpacing",0),g=tb(t,"hAlign",0),f=tb(t,"vAlign",0),v=tb(t,"justifyPercentage",.25),m=Vy({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&&(O.push({children:M,width:D}),A=Math.max(A,D)),m.start+=P.length,m.isLastPage=!L&&m.start===T,m.maxLineWidth=A,m.linesHeight=O.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=sb(t,"maxLines",void 0))){var a=this.fixedWidth-r;i=Math.floor(a/n)+1}}else i=sb(t,"maxLines",0);var o=0===i,h=sb(t,"fixedCharacterHeight",void 0);if(void 0===h){var l=sb(t,"charPerLine",void 0);if(void 0!==l){var u=this.fixedHeight-s;h=Math.floor(u/l)}}var c=sb(t,"wrapHeight",void 0);void 0===c&&(c=this.fixedHeight>0?this.fixedHeight-s:1/0);for(var d=sb(t,"letterSpacing",0),p=sb(t,"rtl",!0),g=sb(t,"hAlign",p?2:0),f=sb(t,"vAlign",0),v=Vy({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&&(P.push({children:O,height:M}),D=Math.max(D,M)),v.start+=T.length,v.isLastPage=v.start===E,v.maxLineHeight=D,v.linesWidth=P.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 tp(i,t,e),this.dirty=this.dirty||s!=i.left||r!=i.right||n!=i.top||a!=i.bottom,this},getPadding:function(t){return Qd(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),Py(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 Oy(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(My);return null===i?i=new jy(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)),iy(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=Ib(t,r,e,i,n),o=0;o<=Rb&&0!==a;o++){if((r+=a)<0){r=0;break}a=Ib(t,r,e,i,n)}return o===Rb&&console.warn("FontSizeFit: Test count exceeds 65535"),t.setFontSize(r),jb(t,e,i),t},Bb=function(t,e,i){return void 0===i[e]&&(t.setFontSize(e),i[e]={width:t.width,height:t.height}),i[e]},Ib=function(t,e,i,s,r){var n,a=Bb(t,e,r),o=Bb(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)},jb=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 zb=Phaser.Utils.Objects.GetValue;var Nb=function(t,e){"number"==typeof e&&(e={minWidth:e});var i=zb(e,"minWidth",0),s=zb(e,"minHeight",0),r=zb(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 Fb(t,e,i),t}):(t.runWidthWrap=function(e){return t.setFixedSize&&t.setFixedSize(0,0),Fb(t,e,void 0),t},t.resize=function(e,i){return t.width===e&&t.height===i||t.setFixedSize(e,i),t}),t};const Gb=Phaser.Utils.Objects.GetValue,Yb=[function(t){var e=this.scene,i=fm(t,"orientation",0);this.setOrientation(i);var s=fm(t,"icon",void 0),r=fm(t,"iconMask",void 0),n=fm(t,"innerBackground",void 0),a=fm(t,"title",void 0),o=fm(t,"separator",void 0),h=fm(t,"text",void 0),l=fm(t,"action",void 0),u=fm(t,"actionMask",void 0);if(s){var c=fm(t,"align.icon","center");m=0===this.orientation?{right:fm(t,"space.icon",0),top:fm(t,"space.iconTop",0),bottom:fm(t,"space.iconBottom",0),left:fm(t,"space.iconLeft",0)}:{bottom:fm(t,"space.icon",0),left:fm(t,"space.iconLeft",0),right:fm(t,"space.iconRight",0),top:fm(t,"space.iconTop",0)};var d=fm(t,"squareFitIcon",!1)?1:0;if(this.add(s,{proportion:0,align:c,padding:m,fitRatio:d}),r&&(r=gm.call(this,s,s,1)),!d){var p=fm(t,"iconSize",void 0);this.setIconSize(fm(t,"iconWidth",p),fm(t,"iconHeight",p))}}var g=new lm(e,{orientation:1});n&&g.addBackground(n);var f=fm(t,"space.separator",0);if(a){c=fm(t,"align.title","left");var v=fm(t,"expandTitleWidth",!1);y=fm(t,"expandTitleHeight",!1)?1:0,b=v,m={bottom:!o&&h?fm(t,"space.title",f):0,left:fm(t,"space.titleLeft",0),right:fm(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:fm(t,"space.separatorLeft",0),right:fm(t,"space.separatorRight",0)};g.add(o,{expand:!0,padding:m})}if(h){c=fm(t,"align.text","left");var y,b,x=fm(t,"expandTextWidth",!1);y=fm(t,"expandTextHeight",!1)?1:0,b=x,m={left:fm(t,"space.textLeft",0),right:fm(t,"space.textRight",0)},g.add(h,{proportion:y,expand:b,align:c,padding:m})}m=void 0;if(l&&(m={right:fm(t,"space.text",0)}),this.add(g,{proportion:1,padding:m}),l){c=fm(t,"align.action","center");m=0===this.orientation?{top:fm(t,"space.actionTop",0),bottom:fm(t,"space.actionBottom",0),right:fm(t,"space.actionRight",0)}:{left:fm(t,"space.actionLeft",0),right:fm(t,"space.actionRight",0),bottom:fm(t,"space.actionBottom",0)};d=fm(t,"squareFitAction",!1)?1:0;if(this.add(l,{proportion:0,align:c,padding:m,fitRatio:d}),u&&(u=gm.call(this,l,l,1)),!d){var C=fm(t,"actionSize");this.setActionSize(fm(t,"actionWidth",C),fm(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=vm(t,"title",void 0),s=vm(t,"separator",void 0),r=vm(t,"innerBackground",void 0),n=vm(t,"icon",void 0),a=vm(t,"iconMask",void 0),o=vm(t,"text",void 0),h=vm(t,"action",void 0),l=vm(t,"actionMask",void 0);if(i){var u=vm(t,"align.title","left"),c=vm(t,"expandTitleWidth",!1);y=vm(t,"expandTitleHeight",!1)?1:0,b=c,p={bottom:vm(t,"space.title",0),left:vm(t,"space.titleLeft",0),right:vm(t,"space.titleRight",0)},this.add(i,{proportion:y,expand:b,align:u,padding:p})}if(s){var d=vm(t,"space.separator",0),p={top:i?d:0,bottom:o?d:0,left:vm(t,"space.separatorLeft",0),right:vm(t,"space.separatorRight",0)};this.add(s,{proportion:0,expand:!0,padding:p})}var g=vm(t,"orientation",0),f=new lm(e,{orientation:g,rtl:vm(t,"rtl",!1),space:{left:vm(t,"space.innerLeft",0),right:vm(t,"space.innerRight",0),top:vm(t,"space.innerTop",0),bottom:vm(t,"space.innerBottom",0)}});if(r&&f.addBackground(r),this.add(f,{proportion:1,expand:!0}),n){u=vm(t,"align.icon","center");p=0===f.orientation?{right:vm(t,"space.icon",0),top:vm(t,"space.iconTop",0),bottom:vm(t,"space.iconBottom",0),left:vm(t,"space.iconLeft",0)}:{bottom:vm(t,"space.icon",0),left:vm(t,"space.iconLeft",0),right:vm(t,"space.iconRight",0),top:vm(t,"space.iconTop",0)};var v=vm(t,"squareFitIcon",!1)?1:0;if(f.add(n,{proportion:0,align:u,padding:p,fitRatio:v}),a&&(a=gm.call(this,n,n,1)),!v){var m=vm(t,"iconSize",void 0);this.setIconSize(vm(t,"iconWidth",m),vm(t,"iconHeight",m))}}if(o){u=vm(t,"align.text","left");var y,b,x=vm(t,"space.text",0),C=vm(t,"expandTextWidth",!1),k=vm(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=vm(t,"align.action","center");p=0===f.orientation?{top:vm(t,"space.actionTop",0),bottom:vm(t,"space.actionBottom",0),right:vm(t,"space.actionRight",0)}:{left:vm(t,"space.actionLeft",0),right:vm(t,"space.actionRight",0),bottom:vm(t,"space.actionBottom",0)};v=vm(t,"squareFitAction",!1)?1:0;if(f.add(h,{proportion:0,align:u,padding:p,fitRatio:v}),l&&(l=gm.call(this,h,h,1)),!v){var S=vm(t,"actionSize");this.setActionSize(vm(t,"actionWidth",S),vm(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 Wb extends pm{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexTitleLabel";var i=Gb(e,"background",void 0);i&&this.addBackground(i);var s=Gb(e,"title",void 0),r=Gb(e,"text",void 0);if(s){var n=Gb(e,"wrapTitle",!1),a=Gb(e,"adjustTitleFontSize",!1);n?(!0===n&&(n="word"),Om(s,n),e.expandTitleWidth=!0,Lb(s)):a&&(e.expandTextWidth=!0,e.expandTextHeight=!0,Nb(s,{fitHeight:!0}))}if(r){var o=Gb(e,"wrapText",!1),h=Gb(e,"adjustTextFontSize",!1);o?(!0===o&&(o="word"),Om(r,o),e.expandTextWidth=!0,Lb(r)):h&&(e.expandTextWidth=!0,e.expandTextHeight=!0,Nb(r,{fitHeight:!0}))}var l=Gb(e,"layoutMode",0);(Yb[l]||Yb[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 Xb 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=rd(i,"expandTextWidth",!1),n=rd(i,"expandTextHeight",!1);if(r||n){var a=Ic(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(rd(i,"typingMode","page")),this.page=new Hc(s,rd(i,"page",void 0)),this.typing=new id(s,rd(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=nd[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()}}}(Wb)){constructor(t,e){void 0===e&&(e={}),e.hasOwnProperty("layoutMode")||(e.layoutMode=1),super(t,e)}}const $b=Phaser.GameObjects.GetCalcMatrix;const Vb=Phaser.Renderer.Canvas.SetTransform;var Hb={renderWebGL:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.pipelines.set(e.pipeline),n=$b(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&&Zl(r,a,e,l,o,h),e.isStroked&&tu(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(Vb(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(qb.prototype,Hb);var Kb=function(t){return t.x>0&&t.y>0};const Jb=Phaser.Utils.Objects.IsPlainObject,Zb=Phaser.Utils.Objects.GetValue,Qb=Phaser.Geom.Polygon.Earcut;class tx extends qb{constructor(t,e,i,s,r,n,a,o){var h,l,u,c;if(Jb(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 dy;if(super(t,"rexRoundRectangleShape",p),this.setShapeType(c),0===this.shapeType){var g=Zb(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(Zb(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,Kb(i))if(i.convex){var o=i.x,h=i.y;ou(o,h,i.x,i.y,180,270,!1,a,e)}else{ou(o=0,h=0,i.x,i.y,90,0,!0,a,e)}else nu(0,0,e);if(i=n.tr,Kb(i))if(i.convex){o=s-i.x,h=i.y;ou(o,h,i.x,i.y,270,360,!1,a,e)}else{ou(o=s,h=0,i.x,i.y,180,90,!0,a,e)}else nu(s,0,e);if(i=n.br,Kb(i))if(i.convex){o=s-i.x,h=r-i.y;ou(o,h,i.x,i.y,0,90,!1,a,e)}else{ou(o=s,h=r,i.x,i.y,270,180,!0,a,e)}else nu(s,r,e);if(i=n.bl,Kb(i))if(i.convex){o=i.x,h=r-i.y;ou(o,h,i.x,i.y,90,180,!1,a,e)}else{ou(o=0,h=r,i.x,i.y,360,270,!0,a,e)}else nu(0,r,e);return e.push(e[0],e[1]),this.pathIndexes=Qb(e),this}setShapeType(t){return"string"==typeof t&&(t=ex[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 ex={rectangle:0,circle:1};var ix=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},sx=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 dx=Phaser.Utils.Objects.GetValue,px=Phaser.Utils.Objects.IsPlainObject;class gx extends(sc(Hl)){constructor(t,e,i,s,r,n,a,o){px(e)?(e=(o=e).x,i=o.y,s=o.width,r=o.height,n=o.barColor,a=o.value):px(s)?(s=(o=s).width,r=o.height,n=o.barColor,a=o.value):px(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 Lu).setName("trackFill")).addShape((new Lu).setName("bar")).addShape((new Lu).setName("trackStroke")),this.setTrackColor(dx(o,"trackColor",void 0)),this.setBarColor(n),this.setTrackStroke(dx(o,"trackStrokeThickness",2),dx(o,"trackStrokeColor",void 0)),this.setSkewX(dx(o,"skewX",0)),this.setRTL(dx(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 fx={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(gx.prototype,fx);class vx extends gx{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=mx,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 mx={color:"trackColor",strokeColor:"trackStrokeColor",strokeWidth:"trackStrokeThickness"};Object.assign(vx.prototype,hx);let yx=class extends Bn{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 bx=Phaser.GameObjects.NineSlice,xx=Phaser.Utils.Objects.GetValue;class Cx extends bx{constructor(t,e){void 0===e&&(e={}),super(t,xx(e,"x",0),xx(e,"y",0),xx(e,"key",null),xx(e,"frame",null),xx(e,"width",0),xx(e,"height",0),xx(e,"leftWidth",0),xx(e,"rightWidth",0),xx(e,"topHeight",0),xx(e,"bottomHeight",0)),this.type="rexStatesNineSlice";var i=xx(e,"effects",!0);i&&Pr(this,i),this.style=new yx(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign(Cx.prototype,hx);let kx=class extends Bn{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 Sx=Phaser.GameObjects.Image,wx=Phaser.Utils.Objects.GetValue;class _x extends Sx{constructor(t,e){void 0===e&&(e={}),super(t,wx(e,"x",0),wx(e,"y",0),wx(e,"key",""),wx(e,"frame",void 0)),this.type="rexStatesImage";var i=wx(e,"effects",!0);i&&Pr(this,i),this.style=new kx(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign(_x.prototype,hx);var Ex=function(t,e,i){return"__BASE"===i?`${t},${e}`:`${i}:${t},${e}`};const Tx=Phaser.Utils.Objects.IsPlainObject,Px=Phaser.Utils.Objects.GetValue;var Ox=function(t){return"string"==typeof t&&(t=Mx[t]),t};const Mx={scale:0,repeat:1};var Dx=function(t,e){return 0===t||t===this.columns.count-1||0===e||e===this.rows.count-1},Ax={_beginDraw:ld,_drawImage:ld,_drawTileSprite:ld,_endDraw:ld,setGetFrameNameCallback:function(t){return void 0===t&&(t=Ex),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 Tx(t)?(this.stretchMode.edge=Ox(Px(t,"edge",0)),this.stretchMode.internal=Ox(Px(t,"internal",0))):(t=Ox(t),this.stretchMode.edge=t,this.stretchMode.internal=t),this},getStretchMode:function(t,e){return Dx.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 Lx=Phaser.Utils.Objects.IsPlainObject,Rx=Phaser.Utils.Objects.GetValue;const Fx=Phaser.GameObjects;var Bx=void 0,Ix=function(t,e){if(Bx||(Bx={},Rn(t).events.once("destroy",(function(){for(var t in Bx)Bx[t].destroy();Bx=void 0}))),!Bx.hasOwnProperty(e)){var i=Rn(t).scene.systemScene;(t=new Fx[e](i)).setOrigin(0),Bx[e]=t}return Bx[e]};const jx=Phaser.GameObjects.RenderTexture;class zx extends(function(t,e){class i extends t{constructor(t,i,s,r,n,a,o,h,l,u){if(Lx(i)?(i=Rx(u=i,"x",0),s=Rx(u,"y",0),r=Rx(u,"width",1),n=Rx(u,"height",1),a=Rx(u,"key",void 0),o=Rx(u,"baseFrame",void 0),h=Rx(u,"columns",void 0),l=Rx(u,"rows",void 0)):Lx(r)?(r=Rx(u=r,"width",1),n=Rx(u,"height",1),a=Rx(u,"key",void 0),o=Rx(u,"baseFrame",void 0),h=Rx(u,"columns",void 0),l=Rx(u,"rows",void 0)):Lx(a)?(a=Rx(u=a,"key",void 0),o=Rx(u,"baseFrame",void 0),h=Rx(u,"columns",void 0),l=Rx(u,"rows",void 0)):Lx(o)?(o=Rx(u=o,"baseFrame",void 0),h=Rx(u,"columns",void 0),l=Rx(u,"rows",void 0)):Array.isArray(o)?(u=l,l=h,h=o,o=Rx(u,"baseFrame",void 0)):Lx(h)&&(h=Rx(u=h,"columns",void 0),l=Rx(u,"rows",void 0)),void 0===o&&(o=Rx(u,"frame",void 0)),void 0===h){var c=Rx(u,"leftWidth",void 0),d=Rx(u,"rightWidth",void 0);void 0!==c&&void 0!==d&&(h=[c,void 0,d])}if(void 0===l){var p=Rx(u,"topHeight",void 0),g=Rx(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(Rx(u,"getFrameNameCallback",void 0)),this.setStretchMode(Rx(u,"stretchMode",0)),this.setPreserveRatio(Rx(u,"preserveRatio",!0));var f=Rx(u,"maxFixedPartScale",1),v=Rx(u,"maxFixedPartScaleX",f),m=Rx(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,Ax),i}(jx,"rexNinePatch")){}var Nx={_drawImage:function(t,e,i,s,r,n){var a=Ix(this,"Image").setTexture(t,e).setDisplaySize(r,n);this.draw(a,i,s)},_drawTileSprite:function(t,e,i,s,r,n){var a=Ix(this,"TileSprite").setTexture(t,e).setSize(r,n);this.draw(a,i,s)}};Object.assign(zx.prototype,Nx);let Gx=class extends Bn{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 Yx=Phaser.Utils.Objects.GetValue;class Wx extends zx{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexStatesNinePatch";var i=Yx(e,"effects",!0);i&&Pr(this,i),this.style=new Gx(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign(Wx.prototype,hx);const Xx=["alpha","tint","flipX","flipY"];var $x=function(t,e){if(!e)return t;for(var i=0,s=Xx.length;i * @copyright 2018 Photon Storm Ltd. diff --git a/dist/rexmdscenarioplugin.js b/dist/rexmdscenarioplugin.js index daff968055..3678d4aa2e 100644 --- a/dist/rexmdscenarioplugin.js +++ b/dist/rexmdscenarioplugin.js @@ -49101,6 +49101,10 @@ void main () { Render$1 ); + var IsArcCorner = function (radius) { + return ((radius.x > 0) && (radius.y > 0)); + }; + const IsPlainObject$p = Phaser.Utils.Objects.IsPlainObject; const GetValue$1D = Phaser.Utils.Objects.GetValue; const Earcut = Phaser.Geom.Polygon.Earcut; @@ -49146,8 +49150,7 @@ void main () { geom.setTo(0, 0, width, height, radius); } - var iteration = GetValue$1D(radiusConfig, 'iteration', undefined); - this.setIteration(iteration); + this.setIteration(GetValue$1D(radiusConfig, 'iteration', undefined)); this.setPosition(x, y); this.setFillStyle(fillColor, fillAlpha); @@ -49400,10 +49403,6 @@ void main () { } - var IsArcCorner = function (radius) { - return ((radius.x > 0) && (radius.y > 0)); - }; - const ShapeTypeMap = { rectangle: 0, circle: 1 @@ -49617,6 +49616,7 @@ void main () { var skewX = this.skewX; var width = this.width - Math.abs(skewX); var height = this.height; + var trackFill = this.getShape('trackFill'); trackFill.fillStyle(this.trackColor); if (trackFill.isFilled) { @@ -49625,8 +49625,7 @@ void main () { 0, 0, // x0, y0 width, height, // x1, y1 skewX // skewX - ) - .close(); + ); } var bar = this.getShape('bar'); @@ -49646,8 +49645,7 @@ void main () { barX0, 0, // x0, y0 barX1, height, // x1, y1 skewX // skew - ) - .close(); + ); } var trackStroke = this.getShape('trackStroke'); @@ -49658,8 +49656,7 @@ void main () { 0, 0, // x0, y0 width, height, // x1, y1 skewX // skewX - ) - .end(); + ); } }; @@ -49679,6 +49676,8 @@ void main () { .lineTo(x0, y0).lineTo(startX, y0); } + lines.close(); + return lines; }; @@ -49689,24 +49688,33 @@ void main () { constructor(scene, x, y, width, height, barColor, value, config) { if (IsPlainObject$o(x)) { config = x; - x = GetValue$1B(config, 'x', 0); - y = GetValue$1B(config, 'y', 0); - width = GetValue$1B(config, 'width', 2); - height = GetValue$1B(config, 'height', 2); - barColor = GetValue$1B(config, 'barColor', undefined); - value = GetValue$1B(config, 'value', 0); + + x = config.x; + y = config.y; + width = config.width; + height = config.height; + barColor = config.barColor; + value = config.value; } else if (IsPlainObject$o(width)) { config = width; - width = GetValue$1B(config, 'width', 2); - height = GetValue$1B(config, 'height', 2); - barColor = GetValue$1B(config, 'barColor', undefined); - value = GetValue$1B(config, 'value', 0); + + width = config.width; + height = config.height; + barColor = config.barColor; + value = config.value; } else if (IsPlainObject$o(barColor)) { config = barColor; - barColor = GetValue$1B(config, 'barColor', undefined); - value = GetValue$1B(config, 'value', 0); + + barColor = config.barColor; + value = config.value; } + if (x === undefined) { x = 0; } + if (y === undefined) { y = 0; } + if (width === undefined) { width = 2; } + if (height === undefined) { height = width; } + if (value === undefined) { value = 0; } + super(scene, x, y, width, height, config); this.type = 'rexLineProgress'; diff --git a/dist/rexmdscenarioplugin.min.js b/dist/rexmdscenarioplugin.min.js index 7267edc6f2..5a24c4250b 100644 --- a/dist/rexmdscenarioplugin.min.js +++ b/dist/rexmdscenarioplugin.min.js @@ -19,9 +19,9 @@ v5.4.1 https://github.com/mholt/PapaParse License: MIT - */!function(t){t.exports=function t(){var e="undefined"!=typeof self?self:"undefined"!=typeof window?window:void 0!==e?e:{},i=!e.document&&!!e.postMessage,s=e.IS_PAPA_WORKER||!1,r={},n=0,a={parse:function(i,s){var o=(s=s||{}).dynamicTyping||!1;if(k(o)&&(s.dynamicTypingFunction=o,o={}),s.dynamicTyping=o,s.transform=!!k(s.transform)&&s.transform,s.worker&&a.WORKERS_SUPPORTED){var h=function(){if(!a.WORKERS_SUPPORTED)return!1;var i,s,o=(i=e.URL||e.webkitURL||null,s=t.toString(),a.BLOB_URL||(a.BLOB_URL=i.createObjectURL(new Blob(["var global = (function() { if (typeof self !== 'undefined') { return self; } if (typeof window !== 'undefined') { return window; } if (typeof global !== 'undefined') { return global; } return {}; })(); global.IS_PAPA_WORKER=true; ","(",s,")();"],{type:"text/javascript"})))),h=new e.Worker(o);return h.onmessage=v,h.id=n++,r[h.id]=h}();return h.userStep=s.step,h.userChunk=s.chunk,h.userComplete=s.complete,h.userError=s.error,s.step=k(s.step),s.chunk=k(s.chunk),s.complete=k(s.complete),s.error=k(s.error),delete s.worker,void h.postMessage({input:i,config:s,workerId:h.id})}var p=null;return a.NODE_STREAM_INPUT,"string"==typeof i?(i=function(t){return 65279===t.charCodeAt(0)?t.slice(1):t}(i),p=s.download?new l(s):new c(s)):!0===i.readable&&k(i.read)&&k(i.on)?p=new d(s):(e.File&&i instanceof File||i instanceof Object)&&(p=new u(s)),p.stream(i)},unparse:function(t,e){var i=!1,s=!0,r=",",n="\r\n",o='"',h=o+o,l=!1,u=null,c=!1;!function(){if("object"==typeof e){if("string"!=typeof e.delimiter||a.BAD_DELIMITERS.filter((function(t){return-1!==e.delimiter.indexOf(t)})).length||(r=e.delimiter),("boolean"==typeof e.quotes||"function"==typeof e.quotes||Array.isArray(e.quotes))&&(i=e.quotes),"boolean"!=typeof e.skipEmptyLines&&"string"!=typeof e.skipEmptyLines||(l=e.skipEmptyLines),"string"==typeof e.newline&&(n=e.newline),"string"==typeof e.quoteChar&&(o=e.quoteChar),"boolean"==typeof e.header&&(s=e.header),Array.isArray(e.columns)){if(0===e.columns.length)throw new Error("Option columns is empty");u=e.columns}void 0!==e.escapeChar&&(h=e.escapeChar+o),("boolean"==typeof e.escapeFormulae||e.escapeFormulae instanceof RegExp)&&(c=e.escapeFormulae instanceof RegExp?e.escapeFormulae:/^[=+\-@\t\r].*$/)}}();var d=new RegExp(g(o),"g");if("string"==typeof t&&(t=JSON.parse(t)),Array.isArray(t)){if(!t.length||Array.isArray(t[0]))return p(null,t,l);if("object"==typeof t[0])return p(u||Object.keys(t[0]),t,l)}else if("object"==typeof t)return"string"==typeof t.data&&(t.data=JSON.parse(t.data)),Array.isArray(t.data)&&(t.fields||(t.fields=t.meta&&t.meta.fields||u),t.fields||(t.fields=Array.isArray(t.data[0])?t.fields:"object"==typeof t.data[0]?Object.keys(t.data[0]):[]),Array.isArray(t.data[0])||"object"==typeof t.data[0]||(t.data=[t.data])),p(t.fields||[],t.data||[],l);throw new Error("Unable to serialize unrecognized input");function p(t,e,i){var a="";"string"==typeof t&&(t=JSON.parse(t)),"string"==typeof e&&(e=JSON.parse(e));var o=Array.isArray(t)&&0=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},_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(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;var Yr=function(t,e){if(void 0===e?e=new Gr:!0===e&&(void 0===Xr&&(Xr=new Gr),e=Xr),t.getBounds)return t.getBounds(e);var i,s,r,n,a,o,h,l;if(t.parentContainer){var u=t.parentContainer.getBoundsTransformMatrix();Hr(t,e),u.transformPoint(e.x,e.y,e),i=e.x,s=e.y,$r(t,e),u.transformPoint(e.x,e.y,e),r=e.x,n=e.y,Ur(t,e),u.transformPoint(e.x,e.y,e),a=e.x,o=e.y,Kr(t,e),u.transformPoint(e.x,e.y,e),h=e.x,l=e.y}else Hr(t,e),i=e.x,s=e.y,$r(t,e),r=e.x,n=e.y,Ur(t,e),a=e.x,o=e.y,Kr(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},Xr=void 0,Hr=function(t,e,i){return void 0===e?e=new Wr:!0===e&&(void 0===Jr&&(Jr=new Wr),e=Jr),t.getTopLeft?t.getTopLeft(e):(e.x=t.x-zr(t)*t.originX,e.y=t.y-Nr(t)*t.originY,Zr(t,e,i))},$r=function(t,e,i){return void 0===e?e=new Wr:!0===e&&(void 0===Jr&&(Jr=new Wr),e=Jr),t.getTopRight?t.getTopRight(e):(e.x=t.x-zr(t)*t.originX+zr(t),e.y=t.y-Nr(t)*t.originY,Zr(t,e,i))},Ur=function(t,e,i){return void 0===e?e=new Wr:!0===e&&(void 0===Jr&&(Jr=new Wr),e=Jr),t.getBottomLeft?t.getBottomLeft(e):(e.x=t.x-zr(t)*t.originX,e.y=t.y-Nr(t)*t.originY+Nr(t),Zr(t,e,i))},Kr=function(t,e,i){return void 0===e?e=new Wr:!0===e&&(void 0===Jr&&(Jr=new Wr),e=Jr),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),Zr(t,e,i))},qr=function(t,e,i){void 0===e?e=new Wr:!0===e&&(void 0===Jr&&(Jr=new Wr),e=Jr);var s=zr(t),r=Nr(t);return e.x=t.x+s*(.5-t.originX),e.y=t.y+r*(.5-t.originY),Zr(t,e,i)},Jr=void 0,Zr=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 Qr=Phaser.Utils.Objects.GetValue;var tn=function(t,e,i){var s,r,n,a,o;if("number"==typeof i?s=i:(s=Qr(i,"color"),r=Qr(i,"lineWidth"),n=Qr(i,"fillColor"),a=Qr(i,"fillAlpha",1),o=Qr(i,"padding",0)),Array.isArray(t))for(var h=0,l=t.length;h0?-this.delay:0,this.state=this.nowTime>=0?Jn:qn,this.repeatCounter=0,this}stop(){return this.state=Kn,this}update(t,e){this.state!==Kn&&this.state!==Qn&&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=Zn)):(this.nowTime=this.duration,this.state=Qn):this.nowTime>=0&&(this.state=Jn))}get t(){var t;switch(this.state){case Kn:case qn:case Zn:t=0;break;case Jn:t=this.nowTime/this.duration;break;case Qn:t=1}return $n(t,0,1)}set t(t){(t=$n(t,-1,1))<0?(this.state=qn,this.nowTime=-this.delay*t):(this.state=Jn,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===Kn}get isDelay(){return this.state===qn}get isCountDown(){return this.state===Jn}get isRunning(){return this.state===qn||this.state===Jn}get isDone(){return this.state===Qn}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}};const Kn=0,qn=1,Jn=2,Zn=3,Qn=-1;class ta extends Yn{constructor(t,e){super(t,e),this.timer=new Un}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 ea=Phaser.Utils.Objects.GetValue,ia=Phaser.Utils.Objects.GetAdvancedValue,sa=Phaser.Tweens.Builders.GetEaseFunction;class ra extends ta{resetFromJSON(t){return this.timer.resetFromJSON(ea(t,"timer")),this.setEnable(ea(t,"enable",!0)),this.setTarget(ea(t,"target",this.parent)),this.setDelay(ia(t,"delay",0)),this.setDuration(ia(t,"duration",1e3)),this.setEase(ea(t,"ease","Linear")),this.setRepeat(ea(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=sa(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 na=Phaser.Sound.BaseSound;var aa=function(t){return t instanceof na};const oa=Phaser.Utils.Objects.GetValue,ha=Phaser.Utils.Objects.GetAdvancedValue,la=Phaser.Math.Linear;let ua=class extends ra{constructor(t,e,i){aa(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(oa(t,"mode",0)),this.setEnable(oa(t,"enable",!0)),this.setVolumeRange(ha(t,"volume.start",this.parent.volume),ha(t,"volume.end",0)),this}setMode(t){return"string"==typeof t&&(t=ca[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=la(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 ca={stop:1,destroy:2};var da=function(t,e,i,s,r){aa(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 ua(t,e,a),e._fade=n),n.start(),e.isPlaying||e.setVolume(r).play(),e},pa=function(t,e,i,s){aa(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 ua(t,e,n),e._fade=r),r.start(),e.isPlaying||e.play(),e};const ga=Phaser.Utils.Objects.GetValue;var fa={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:ga(e,"loop",this.backgroundMusicLoop),mute:ga(e,"mute",this.backgroundMusicMute),volume:ga(e,"volume",this.backgroundMusicVolume),detune:ga(e,"detune",0),rate:ga(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&&da(this.backgroundMusic,t,this.backgroundMusicVolume,0),this},fadeOutBackgroundMusic(t,e){return this.backgroundMusic&&pa(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 va=Phaser.Utils.Objects.GetValue;var ma={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:va(e,"loop",this.backgroundMusicLoop),mute:va(e,"mute",this.backgroundMusic2Mute),volume:va(e,"volume",this.backgroundMusic2Volume),detune:va(e,"detune",0),rate:va(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&&da(this.backgroundMusic2,t,this.backgroundMusic2Volume,0),this},fadeOutBackgroundMusic2(t,e){return this.backgroundMusic2&&pa(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 ya=Phaser.Utils.Array.Remove,ba=Phaser.Utils.Objects.GetValue;var xa={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:ba(e,"mute",this.soundEffectsMute),volume:ba(e,"volume",this.soundEffectsVolume),detune:ba(e,"detune",0),rate:ba(e,"rate",1)});return this.soundEffects.push(i),i.once("complete",(function(){i.destroy(),this.sound&&ya(this.soundEffects,i)}),this).once("destroy",(function(){this.sound&&ya(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&&da(e,t,this.soundEffectsVolume,0),this},fadeOutSoundEffect(t,e){var i=this.getLastSoundEffect();return i&&pa(i,t,e),this},fadeOutAllSoundEffects(t,e){for(var i=this.soundEffects.length-1;i>=0;i--)pa(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&&da(e,t,this.soundEffects2Volume,0),this},fadeOutSoundEffect2(t,e){var i=this.getLastSoundEffect2();return i&&pa(i,t,e),this},fadeOutAllSoundEffects2(t,e){for(var i=this.soundEffects2.length-1;i>=0;i--)pa(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 Ra=Phaser.Utils.Objects.GetValue,Ba=new class extends Aa{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=eo(this.delimiterLeft),e=eo(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=no),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=ho),this.tagExpression=t,this}setValueExpression(t){return t||(t=ho),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!==ho||this.valueExpression!==ho){var s=`${this.tagExpression}(=${this.valueExpression})?`,r=`/${this.tagExpression}`;t=eo(this.delimiterLeft),e=eo(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=ao(e[3],this.valueConverter);this.emit(`+${i}`,...r),this.skipEventFlag||this.emit("+",i,...r),this.lastTagStart=i}}}const ho="[^=]+";var lo=[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()}))}],uo=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},co=function(t,e){var i=Array.isArray(t);if(void 0===e?e=i?[]:{}:uo(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}},Co={"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}},So={"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}},wo={"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}},To={"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}},Po=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 Po(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(!Po(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}},Oo={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 Ho=Phaser.GameObjects.Zone;let $o=class extends Ho{constructor(t){super(t,0,0,2,2),this.fullWindow=new Xo(this)}};const Uo="BG",Ko="SPRITE",qo="TEXTBOX",Jo="TITLE",Zo="CHOICE",Qo="NAMEINPUT";var th=!1,eh=function(t){th||(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 sh(this.children,t,0,(function(t){t.once("destroy",e.onChildDestroy,e)}),this),this}remove(t,e){var i=this;return rh(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;iuh(t),resetChildState(t){return this.resetChildPositionState(t).resetChildVisibleState(t).resetChildAlphaState(t).resetChildActiveState(t),this},resetChildrenState(t){for(var e=0,i=t.length;euh(t).x,getChildLocalY:t=>uh(t).y};const Ph=Phaser.Math.DegToRad;var _h={updateChildRotation(t){var e=uh(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=uh(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 uh(t).rotation=e,this.updateChildRotation(t),this},setChildLocalAngle(t,e){return uh(t).rotation=Ph(e),this.updateChildRotation(t),this},resetLocalRotationState(){var t=uh(this).parent;return t&&t.resetChildRotationState(this),this},getChildLocalRotation:t=>uh(t).rotation},Oh={updateChildScale(t){var e=uh(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=uh(t),i=e.parent;return e.scaleX=wh(t.scaleX,i.scaleX),e.scaleY=wh(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=uh(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=uh(this).parent;return t&&t.resetChildScaleState(this),this},getChildLocalScaleX:t=>uh(t).scaleX,getChildLocalScaleY:t=>uh(t).scaleY},Eh={updateChildVisible(t){var e=uh(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=uh(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),uh(t).visible=e,this.updateChildVisible(t),this},setChildMaskVisible(t,e){return void 0===e&&(e=!0),uh(t).maskVisible=e,this.updateChildVisible(t),this},resetLocalVisibleState(){var t=uh(this).parent;return t&&t.resetChildVisibleState(this),this},getChildLocalVisible:t=>uh(t).visible},Mh={updateChildAlpha(t){var e=uh(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=uh(t),i=e.parent;return e.alpha=wh(t.alpha,i.alpha),this},setChildAlpha(t,e){return t.alpha=e,this.resetChildAlphaState(t),this},setChildLocalAlpha(t,e){return uh(t).alpha=e,this.updateChildAlpha(t),this},resetLocalAlphaState(){var t=uh(this).parent;return t&&t.resetChildAlphaState(this),this},getChildLocalAlpha:t=>uh(t).alpha},Dh={updateChildActive(t){var e=uh(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 uh(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),uh(t).active=e,this.updateChildActive(t),this},resetLocalActiveState(){var t=uh(this).parent;return t&&t.resetChildActiveState(this),this},getChildLocalActive:t=>uh(t).active},Lh={updateChildScrollFactor(t){var e=uh(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}},Ah={updateCameraFilter(t){var e=uh(t),i=e.parent;return e.syncCameraFilter&&(t.cameraFilter=i.cameraFilter),this},syncCameraFilter(){return this.syncChildrenEnable&&this.children.forEach(this.updateCameraFilter,this),this}},Rh={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}},Bh=function(t){return t.filter((function(t){return!!t.displayList||(!!t.parentContainer||void 0)}))},Fh={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}},Ih=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 zh=Phaser.Utils.Array;var Nh={getChildren(t){if(t)for(var e=0,i=this.children.length;e0?u.pop().setTexture(d,_):r(c,d,_),h&&c.add.existing(P),l){var O=b+C*T+a*C,E=x+S*w+o*S;P.setOrigin(a,o).setPosition(O,E).setScale(f,v).setRotation(m),Ll(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(Wl.prototype,Bl);const Yl={fit:1,FIT:1,envelop:2,ENVELOP:2};const Xl=Phaser.GameObjects.GetCalcMatrix;const Hl=Phaser.Renderer.Canvas.SetTransform;var $l={renderWebGL:function(t,e,i,s){e.updateData(),i.addToRenderList(e);var r=t.pipelines.set(e.pipeline),n=Xl(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+")"},nu=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 au=Phaser.Geom.Polygon.Earcut;class ou extends Ql{constructor(){super(),this.pathData=[],this.pathIndexes=[],this.closePath=!1}updateData(){return this.pathIndexes=au(this.pathData),super.updateData(),this}webglRender(t,e,i,s,r){this.isFilled&&eu(t,e,this,i,s,r),this.isStroked&&su(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 lu=Phaser.Math.DegToRad;var uu=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=ju(t,"tl",0),this.radiusTR=ju(t,"tr",0),this.radiusBL=ju(t,"bl",0),this.radiusBR=ju(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?uu(e,e,e,e,180,270,!1,r,t):uu(0,0,e,e,90,0,!0,r,t):hu(0,0,t);(e=this.radiusTR)>0?this._convexTR?uu(i-e,e,e,e,270,360,!1,r,t):uu(i,0,e,e,180,90,!0,r,t):hu(i,0,t);(e=this.radiusBR)>0?this._convexBR?uu(i-e,s-e,e,e,0,90,!1,r,t):uu(i,s,e,e,270,180,!0,r,t):hu(i,s,t);(e=this.radiusBL)>0?this._convexBL?uu(e,s-e,e,e,90,180,!1,r,t):uu(0,s,e,e,360,270,!0,r,t):hu(0,s,t);return t.push(t[0],t[1]),xu(this.x,this.y,t),super.updateData(),this}};const Nu=Phaser.Renderer.WebGL.Utils.getTintAppendFloatAlpha;const Gu={arc:du,circle:pu,curve:class extends ou{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(),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},Vc=function(t){return null==t?t="":Array.isArray(t)?t=t.join("\n"):"number"==typeof t&&(t=t.toString()),t},Yc={clearText(){return this.sections.length=0,this.pageStartIndexes.length=0,this.lines.length=0,this},appendPage(t){var e=this.totalLinesCount;this.sections.push(Vc(t));t=this.sections.join("\n");this.lines=Wc(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,Yc,Hc,Uc);const qc=Phaser.Utils.Objects.GetValue;Phaser.Math.Clamp;class Jc extends zn{constructor(t,e){super(t,{eventEmitter:!1}),this.textObjectType=Gc(this.parent),this.pageStartIndexes=[],this.lines=Wc(this.parent,""),this.sections=[],this.resetFromJSON(e)}resetFromJSON(t){this.setMaxLines(qc(t,"maxLines",void 0)),this.setPageBreak(qc(t,"pageBreak","\f\n")),this.setText(qc(t,"text","")),this.startLineIndex=qc(t,"start",-1),this.endLineIndex=qc(t,"end",void 0);var e=qc(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,Kc);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?$c(this.parent,t):this.parent.setText(t)},appendText(t){var e=this.text.concat(Vc(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 zn{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=Vc(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?$c(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,kd=10,Cd=12,Sd=function(t){var e=Nr(t);return t.y+e-e*t.originY},wd=function(t){var e=zr(t);return t.x-e*t.originX+.5*e},Td=function(t,e){var i=Nr(t);return t.y=e-i+i*t.originY,t},Pd=function(t,e){var i=zr(t),s=i*t.originX;return t.x=e+s-.5*i,t},_d=function(t){var e=zr(t);return t.x-e*t.originX},Od=function(t,e){var i=zr(t);return t.x=e+i*t.originX,t},Ed=function(t){var e=zr(t);return t.x+e-e*t.originX},Md=function(t,e){var i=zr(t);return t.x=e-i+i*t.originX,t},Dd=function(t,e){var i=Nr(t),s=i*t.originY;return t.y=e+s-.5*i,t},Ld=function(t){var e=Nr(t);return t.y-e*t.originY+.5*e},Ad=function(t){var e=Nr(t);return t.y-e*t.originY},Rd=function(t,e){var i=Nr(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),Pd(t,wd(e)+i),Td(t,Sd(e)+s),t},Bd[kd]=function(t,e,i,s){return void 0===i&&(i=0),void 0===s&&(s=0),Od(t,_d(e)-i),Td(t,Sd(e)+s),t},Bd[Cd]=function(t,e,i,s){return void 0===i&&(i=0),void 0===s&&(s=0),Md(t,Ed(e)+i),Td(t,Sd(e)+s),t},Bd[bd]=function(t,e,i,s){return void 0===i&&(i=0),void 0===s&&(s=0),function(t,e,i){Pd(t,e),Dd(t,i)}(t,wd(e)+i,Ld(e)+s),t},Bd[yd]=function(t,e,i,s){return void 0===i&&(i=0),void 0===s&&(s=0),Od(t,_d(e)-i),Dd(t,Ld(e)+s),t},Bd[xd]=function(t,e,i,s){return void 0===i&&(i=0),void 0===s&&(s=0),Md(t,Ed(e)+i),Dd(t,Ld(e)+s),t},Bd[vd]=function(t,e,i,s){return void 0===i&&(i=0),void 0===s&&(s=0),Pd(t,wd(e)+i),Rd(t,Ad(e)-s),t},Bd[fd]=function(t,e,i,s){return void 0===i&&(i=0),void 0===s&&(s=0),Od(t,_d(e)-i),Rd(t,Ad(e)-s),t},Bd[md]=function(t,e,i,s){return void 0===i&&(i=0),void 0===s&&(s=0),Md(t,Ed(e)+i),Rd(t,Ad(e)-s),t};var Fd=function(t,e,i,s,r){return Bd[i](t,e,s,r)},Id=function(t,e,i,s,r,n){gd.setPosition(e,i).setSize(s,r),Fd(t,gd,n)};const jd=Phaser.Utils.Objects.GetValue,zd=Phaser.GameObjects.Group;var Nd=function(t,e,i){return t.add.text(0,0,"")},Gd=void 0;const Wd=nl.prototype.add;var Vd=function(t){return Wd.call(this,t),this.sizerEventsEnable&&(t.emit("sizer.add",t,this),this.emit("add",t,this)),this},Yd={addBackground(t,e,i){return void 0===this.backgroundChildren&&(this.backgroundChildren=[]),"string"==typeof e&&(i=e,e=void 0),void 0===e&&(e=0),Vd.call(this,t),this.backgroundChildren.push(t),this.getSizerConfig(t).padding=Sl(e),void 0!==i&&this.addChildrenMap(i,t),this},isBackground(t){return void 0!==this.backgroundChildren&&-1!==this.backgroundChildren.indexOf(t)}},Xd=function(t,e){var i=null;if(void 0===e)t.hasOwnProperty("rexContainer")&&((i=t.rexContainer.parent)?i.isRexSizer||(i=Xd(i)):i=null);else for(i=Xd(t);i&&i.name!==e;)i=Xd(i);return i},Hd={getParentSizer(t,e){return"string"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),Xd(t,e)},getTopmostSizer(t){return void 0===t&&(t=this),function(t){for(var e=Xd(t);e;)t=e,e=Xd(e);return t}(t)},hasParentSizer(t,e){void 0===e&&(e=this);for(var i=Xd(e);i;){if(i===t)return!0;i=Xd(i)}return!1},hasChild(t,e){return void 0===e&&(e=this),this.hasParentSizer(e,t)}};const $d=Phaser.Utils.Array.Remove,Ud=nl.prototype.remove,Kd=Hd.getParentSizer;var qd=function(t,e){for(var i=Kd(t);i;)i.removeChildCallback&&i.removeChildCallback(t,e),i=Kd(i);return this.isBackground(t)&&$d(this.backgroundChildren,t),Ud.call(this,t,e),!e&&this.sizerEventsEnable&&(t.emit("sizer.remove",t,this),this.emit("remove",t,this)),this};const Jd=Phaser.Utils.Array.Remove,Zd=Hd.getParentSizer;var Qd={removeFromParentSizer(){var t=Zd(gameObject);return t&&t.remove(this),this},removeBackground(t,e){return void 0===this.backgroundChildren||this.getParentSizer(t)!==this||(Jd(this.backgroundChildren,t),qd.call(this,t,e)),this},removeAllBackgrounds(t){if(void 0===this.backgroundChildren)return this;for(var e=this.backgroundChildren.length-1;e>=0;e--)this.remove(this.backgroundChildren[e],t);return this}},tp=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 ep=/(\S+)\[(\d+)\]/i;const ip=Phaser.Utils.Objects.GetValue;var sp=function(t,e){return void 0===e?t:t[e]},rp=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=ip(e,"left",0),t.right=ip(e,"right",0),t.top=ip(e,"top",0),t.bottom=ip(e,"bottom",0)),t},np={getInnerPadding(t){return sp(this.space,t)},setInnerPadding(t,e){return rp(this.space,t,e),this},getOuterPadding(t){return sp(this.getSizerConfig(this).padding,t)},setOuterPadding(t,e){return rp(this.getSizerConfig(this).padding,t,e),this},getChildOuterPadding(t,e){return"string"==typeof t&&(t=this.getElement(t)),sp(this.getSizerConfig(t).padding,e)},setChildOuterPadding(t,e,i){return"string"==typeof t&&(t=this.getElement(t)),rp(this.getSizerConfig(t).padding,e,i),this}},ap=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}},op=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},hp=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},lp=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}},up=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},cp=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},dp={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}},pp=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 xg={delayCall(t,e,i){return this.delayCallTimer=function(t,e,i,s,r){var n=Rn(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}},kg={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}},Cg={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}},Sg={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}},wg={};Object.assign(wg,xg,kg,Cg,Sg);const Tg=Phaser.Utils.Objects.GetValue;class Pg extends zn{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 bg(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(Pg.prototype,wg);const _g=Phaser.GameObjects.Rectangle;class Og extends _g{constructor(t,e,i){super(t,0,0,2,2,e,1),this.fullWindow=new Xo(this),this.setAlpha(i)}get tint(){return this.fillColor}set tint(t){this.setFillStyle(t,this.fillAlpha)}}const Eg=Phaser.Utils.Objects.GetValue;class Mg extends zn{constructor(t,e){super(t,{eventEmitter:!1}),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setHitAreaMode(Eg(t,"hitAreaMode",0)),this.setEnable(Eg(t,"enable",!0)),this.setStopMode(Eg(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=Dg[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 Dg={default:0,fullWindow:1};const Lg=Phaser.Utils.Objects.GetValue;class Ag extends Og{constructor(t,e){super(t,Lg(e,"color",0),Lg(e,"alpha",.8)),this.touchEventStop=new Mg(this,{hitAreaMode:1})}}var Rg={popUp(t,e){void 0!==t._modalScaleSave?(t.scaleX=t._modalScaleSave,t.scaleY=t._modalScaleSave):t._modalScaleSave=t.scaleX,Op(t,e)},scaleDown(t,e){Ep(t,e,void 0,void 0,!1)},fadeIn(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Gp(t,e)},fadeOut(t,e){Wp(t,e,!1)}},Bg=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Gp(t,e,t.alpha)},Fg=function(t,e){Wp(t,e,!1)},Ig=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 jg=Phaser.Utils.Objects.GetValue;let zg=class extends Pg{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=Ng.popUp),null==e.transitOut&&(e.transitOut=Ng.scaleDown),e.destroy=jg(e,"destroy",!0),super(t,e);var i=jg(e,"cover");this.cover=!1!==i?function(t,e){var i=t.scene,s=new Ag(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(jg(i,"transitIn",Bg)),this.setCoverTransitOutCallback(jg(i,"transitOut",Fg)));var s=jg(e,"touchOutsideClose",!1),r=jg(e,"duration.hold",-1),n=jg(e,"timeOutClose",r>=0),a=jg(e,"anyTouchClose",!1);jg(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),jg(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&&Ig(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=Ng[t]),t){case Ng.popUp:t=Rg.popUp;break;case Ng.fadeIn:t=Rg.fadeIn}return super.setTransitInCallback(t),this}setTransitOutCallback(t){switch("string"==typeof t&&(t=Ng[t]),t){case Ng.scaleDown:t=Rg.scaleDown;break;case Ng.fadeOut:t=Rg.fadeOut}return super.setTransitOutCallback(t),this}setCoverTransitInCallback(t){return this.coverTransitInCallback=t,this}setCoverTransitOutCallback(t){return this.coverTransitOutCallback=t,this}};const Ng={popUp:0,fadeIn:1,scaleDown:0,fadeOut:1};var Gg=function(t){return t&&"function"==typeof t},Wg={modal(t,e){return Gg(t)&&(e=t,t=void 0),void 0===this._modalBehavior&&(this.onCreateModalBehavior&&this.onCreateModalBehavior(this,t),this._modalBehavior=function(t,e){var i=new zg(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){Gg(e)&&(r=s,s=i,i=e,e=this);var n=this.scene.events;return this.bindEvent(e,n,t,i,s,r),this},Yg={bindEvent(t,e,i,s,r,n){return"string"==typeof e&&(n=r,r=s,s=i,i=e,e=t,t=this),yo(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}},Xg=function(t,e,i){var s=t.camera;return s?(void 0===i?i={}:!0===i&&(i=Hg),s===e?(i.x=t.worldX,i.y=t.worldY):s.getWorldPoint(t.x,t.y,i),i):null},Hg={},$g=function(t,e,i,s){var r,n=t.scene.sys.cameras.main,a=0===t.scrollFactorX&&0===t.scrollFactorY;if(e)return a?Ig(t,e.x,e.y,i,s):!!(r=Xg(e,n,!0))&&Ig(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 af={press:0,pointerdown:0,release:1,pointerup:1};var of={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 nf(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}},hf=function(t,e,i,s,r){if(e)return!(i&&!i(t,e))&&(!!lf(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 uf.length=0,!0;return uf.length=0,!1},uf=[];const cf=Phaser.Utils.Objects.GetValue;class df extends zn{constructor(t,e){super(t,e),this._enable=void 0;var i=cf(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(cf(t,"enable",!0)),this.setMode(cf(t,"mode",1)),this.setClickInterval(cf(t,"clickInterval",100)),this.setDragThreshold(cf(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=pf[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?hf:$g)(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 pf={press:0,pointerdown:0,release:1,pointerup:1};var gf={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 df(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 ff extends yg{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 vf=Phaser.Utils.Objects.GetValue;class mf extends zn{constructor(t,e){super(t,e),this._enable=void 0,this.cooldown=new ff,this.parent.setInteractive(vf(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.prevIsInTouch=!1,this.isInTouching=!1,this.setEnable(vf(t,"enable",!0)),this.setCooldown(vf(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 yf={isPointerInBounds(t){return void 0===t?t=this:"string"==typeof t&&(t=this.getElement(t)),!!t&&$g(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 mf(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 mf(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}},bf={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}},xf=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=Ff,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===If&&this.onDragEnd(),this.pointer=void 0,this.tracerState=Ff,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=jf,this}isPointerInGameObject(t,e,i){var s=this.lastPointer;return!!s&&$g(t,s,e,i)}}const Ff=0,If=1,jf="IDLE",zf=Phaser.Utils.Objects.GetValue,Nf=Phaser.Math.Distance.Between;class Gf extends Bf{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 yg(s))}resetFromJSON(t){super.resetFromJSON(t),this.setHoldTime(zf(t,"time",250)),this.setTapInterval(zf(t,"tapInterval",200)),this.setDragThreshold(zf(t,"threshold",9)),this.setTapOffset(zf(t,"tapOffset",10));var e=zf(t,"taps",void 0);return void 0!==e?this.setTaps(e):(this.setMaxTaps(zf(t,"maxTaps",void 0)),this.setMinTaps(zf(t,"minTaps",void 0))),this}onDragStart(){switch(this.state){case Wf:this.state=Vf;break;case Vf:var t=this.lastPointer;Nf(t.upX,t.upY,t.x,t.y)>this.tapOffset&&(this.state=Yf,this.state=Vf);break;case Yf: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=Yf))}onDrag(){this.state!==Wf&&this.pointer.getDistance()>this.dragThreshold&&(this.state=Wf)}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=Wf);else t-i.upTime>this.tapInterval&&(void 0===this.minTaps||this.tapsCount>=this.minTaps?this.state=Yf:this.state=Wf)}}postUpdate(t,e){this.isRunning&&this.enable&&this.state===Yf&&(this.state=Wf)}get isTapped(){return this.state===Yf}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",Vf="BEGIN",Yf="RECOGNIZED",Xf=Phaser.Utils.Objects.GetValue;class Hf extends Bf{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=$f},eventEmitter:!1};this.setRecongizedStateObject(new yg(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(Xf(t,"threshold",9)),this.setHoldTime(Xf(t,"time",251)),this}onDragStart(){this.state=Uf,0===this.holdTime&&(this.state=Kf)}onDragEnd(){this.state=$f}onDrag(){this.state!==$f&&this.pointer.getDistance()>this.dragThreshold&&(this.state=$f)}preUpdate(t,e){this.isRunning&&this.enable&&(this.state===Uf&&t-this.pointer.downTime>=this.holdTime&&(this.state=Kf))}get isPressed(){return this.state===Kf}setHoldTime(t){return this.holdTime=t,this}setDragThreshold(t){return this.dragThreshold=t,this}}const $f="IDLE",Uf="BEGIN",Kf="RECOGNIZED";Phaser.Utils.Objects.GetValue;var qf=function(t){return In(t).loop.delta};const Jf=Phaser.Math.Distance.Between,Zf=Phaser.Math.Angle.Between;var Qf={getDt:function(){return qf(this.scene)},getVelocity:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Jf(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 Zf(e.x,e.y,t.x,t.y)}},tv={"up&down":0,"left&right":1,"4dir":2,"8dir":3},ev={};const iv=Phaser.Utils.Objects.GetValue,sv=Phaser.Math.RadToDeg;class rv extends Bf{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=nv},eventEmitter:!1};this.setRecongizedStateObject(new yg(s)),this.clearDirectionStates()}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(iv(t,"threshold",10)),this.setVelocityThreshold(iv(t,"velocityThreshold",1e3)),this.setDirectionMode(iv(t,"dir","8dir")),this}onDragStart(){this.state=av}onDragEnd(){this.state=nv}onDrag(){this.state===av&&(this.validDrag||(this.validDrag=0===this.dragThreshold||this.pointer.getDistance()>=this.dragThreshold),this.validDrag&&this.dragVelocity>this.velocityThreshold&&(this.state=ov))}postUpdate(t,e){this.isRunning&&this.enable&&this.state===ov&&(this.state=nv)}get isSwiped(){return this.state===ov}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=tv[t]),this.dirMode=t,this}updateDirectionStates(){return function(t,e,i){switch(void 0===i?i={}:!0===i&&(i=ev),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}}(sv(this.getVelocityAngle()),this.dirMode,this),this}clearDirectionStates(){return this.left=!1,this.right=!1,this.up=!1,this.down=!1,this}}Object.assign(rv.prototype,Qf);const nv="IDLE",av="BEGIN",ov="RECOGNIZED",hv=Phaser.Utils.Objects.GetValue,lv=Phaser.Utils.Array.SpliceOne,uv=Phaser.Math.Distance.Between,cv=Phaser.Math.Angle.Between;class dv{constructor(t,e){var i=Rn(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(hv(e,"inputConfig",void 0)),this.setEventEmitter(hv(e,"eventEmitter",void 0)),this._enable=void 0,this.pointers=[],this.movedState={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setEnable(hv(t,"enable",!0)),this.bounds=hv(t,"bounds",void 0),this.tracerState=gv,this.pointers.length=0,uo(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,uo(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 gv:this.tracerState=fv,this.onDrag1Start();break;case fv:this.tracerState=vv,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],lv(this.pointers,e),this.tracerState){case fv:this.tracerState=gv,this.onDrag1End();break;case vv:this.tracerState=fv,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 fv:this.onDrag1();break;case vv:this.onDrag2()}}}dragCancel(){return this.tracerState===vv&&this.onDrag2End(),this.pointers.length=0,uo(this.movedState),this.tracerState=gv,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!==vv)return 0;var t=this.pointers[0],e=this.pointers[1];return uv(t.x,t.y,e.x,e.y)}get angleBetween(){if(this.tracerState!==vv)return 0;var t=this.pointers[0],e=this.pointers[1];return cv(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;pv.x=e.x-i.x,pv.y=e.y-i.y}else pv.x=0,pv.y=0;return pv}get centerX(){if(this.tracerState!==vv)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.x+e.x)/2}get centerY(){if(this.tracerState!==vv)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.y+e.y)/2}get prevCenterX(){if(this.tracerState!==vv)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!==vv)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=mv,this}isPointer0InGameObject(t,e,i){var s=this.pointers[0];return!!s&&$g(t,s,e,i)}isPointer1InGameObject(t,e,i){var s=this.pointers[1];return!!s&&$g(t,s,e,i)}}Object.assign(dv.prototype,ur);var pv={};const gv=0,fv=1,vv=2,mv="IDLE";Phaser.Utils.Objects.GetValue;const yv=Phaser.Math.RotateAround;var bv=function(t,e,i,s){return yv(t,e,i,s),t.rotation+=s,t},xv={};const kv=Phaser.Utils.Objects.GetValue,Cv=Phaser.Math.Angle.WrapDegrees,Sv=Phaser.Math.Angle.ShortestBetween,wv=Phaser.Math.RadToDeg,Tv=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=xv),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=Cv(wv(this.angleBetween));this.angle=Sv(this.prevAngle,t),this.prevAngle=t,this.state=Ev}break;case Ev:t=Cv(wv(this.angleBetween));this.angle=Sv(this.prevAngle,t),this.prevAngle=t,this.emit("rotate",this)}}get isRotated(){return this.state===Ev}get rotation(){return Tv(this.angle)}setDragThreshold(t){return this.dragThreshold=t,this}}.prototype,Pv);const _v="IDLE",Ov="BEGIN",Ev="RECOGNIZED",Mv=Phaser.Utils.Objects.GetValue;var Dv=function(t){var e=Mv(t,"tap",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._tap=new Gf(this,e),this._tap.on("tap",(function(t,e,s){kf(i.eventEmitter,`${i.eventNamePrefix}${t.tapsCount}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Lv=Phaser.Utils.Objects.GetValue;var Av=function(t){var e=Lv(t,"press",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._press=new Hf(this,e),this._press.on("pressstart",(function(t,e,s){kf(i.eventEmitter,`${i.eventNamePrefix}pressstart`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this).on("pressend",(function(t,e,s){kf(i.eventEmitter,`${i.eventNamePrefix}pressend`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Rv=Phaser.Utils.Objects.GetValue;var Bv=function(t){var e=Rv(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 rv(this,e),this._swipe.on("swipe",(function(t,e,s){var r=t.left?"left":t.right?"right":t.up?"up":"down";kf(i.eventEmitter,`${i.eventNamePrefix}swipe${r}`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Fv=Phaser.Utils.Objects.GetValue;var Iv=function(t,e){return t.setInteractive(),Fv(e,"dropZone",!1)&&(t.input.dropZone=!0),t._childrenInteractive={targetSizers:Fv(e,"targets",[t]),targetMode:Fv(e,"targetMode","parent"),eventEmitter:Fv(e,"eventEmitter",t),eventNamePrefix:Fv(e,"inputEventPrefix","child.")},Sf.call(t,e),Pf.call(t,e),Ef.call(t,e),Af.call(t,e),Dv.call(t,e),Av.call(t,e),Bv.call(t,e),t},jv={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=ln(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",Nd),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)}}for(var u,c,d=this.getAllShownChildren([this]),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 $v=Phaser.Utils.Objects.IsPlainObject,Uv=Phaser.Utils.Objects.GetValue,Kv=Phaser.Display.Align.CENTER,qv={min:0,full:-1};var Jv=function(t,e,i,s,r,n,a,o,h,l){Vd.call(this,t);var u=t.isRexSpace,c=typeof e;if(null===e)return this;if("number"===c);else if("string"===c)e=qv[e];else if($v(e)){var d;e=Uv(d=e,"proportion",void 0),i=Uv(d,"align",Kv),s=Uv(d,"padding",0),r=Uv(d,"expand",!1),n=Uv(d,"key",void 0),a=Uv(d,"index",void 0),t.isRexSizer||(o=Uv(d,"minWidth",void 0),h=Uv(d,"minHeight",void 0)),l=Uv(d,"fitRatio",0)}return"string"==typeof i&&(i=dd[i]),void 0===e&&(e=u?1:0),void 0===i&&(i=Kv),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===o&&(u?o=0:t.isRexSizer||(o=t._minWidth)),void 0===h&&(u?h=0:t.isRexSizer||(h=t._minHeight)),void 0===l||!1===l?l=0:!0===l&&(l=zr(t)/Nr(t)),(d=this.getSizerConfig(t)).proportion=e,d.align=i,d.padding=Sl(s),d.expand=r,d.fitRatio=0===e?l:0,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},Zv={add:Jv,addSpace(t){return this.insertSpace(void 0,t),this},insertSpace(t,e){return void 0===e&&(e=1),Jv.call(this,new Xv(this.scene),{proportion:e,minWidth:0,minHeight:0,index:t}),this},insert(t,e,i,s,r,n,a,o){return $v(i)&&(i.index=t),Jv.call(this,e,i,s,r,n,a,t,o),this},insertAtPosition(t,e,i,s,r,n,a,o,h){var l=Hv.call(this,t,e);return-1===l&&(l=void 0),this.insert(l,i,s,r,n,a,o,h),this}};const Qv=nl.prototype.clear;var tm=function(t){this.backgroundChildren&&(this.backgroundChildren.length=0);var e,i=!t&&this.sizerEventsEnable;if(i&&(e=this.getChildren([])),Qv.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,tm.call(this,t),this}},sm={getChildAlign(t){return this.getSizerConfig(t).align},setChildAlign(t,e){return"string"==typeof e&&(e=dd[e]),this.getSizerConfig(t).align=e,this}},rm={getChildProportion(t){return this.getSizerConfig(t).proportion},setChildProportion(t,e){return this.getSizerConfig(t).proportion=e,this}},nm={getChildExpand(t){return this.getSizerConfig(t).expand},setChildExpand(t,e){return this.getSizerConfig(t).expand=e,this}},am={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}},om={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&&(vp(t,0,0),e.resolved=!1,this.hasRatioFitChild=!0);return this._childrenProportion=void 0,this.hasProportion0Child=!1,this.proportionLength=void 0,pp.call(this),this},layoutChildren:function(){for(var t,e,i,s,r,n,a,o,h,l,u=this.sizerChildren,c=this.innerLeft,d=this.innerTop,p=this.innerWidth,g=this.innerHeight,f=c,v=d,m=this.startChildIndex,y=0,b=u.length;y0?(e=t-this.getChildrenWidth(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},resolveHeight:function(t){if(void 0!==(t=lp.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)||op.call(this)},runWidthWrap:function(t){this.wrapResult||(1===this.orientation&&Vv.call(this,t,void 0),hp.call(this,t))},hasHeightWrap:function(){return!(!this.hasRatioFitChild||0!==this.orientation)||up.call(this)},runHeightWrap:function(t){this.wrapResult||(0===this.orientation&&Vv.call(this,void 0,t),cp.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(om,Zv,im,sm,rm,nm,am);var hm=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},lm={x:0,h:0,horizontal:0,"left-to-right":0,y:1,v:1,vertical:1,"top-to-bottom":1},um=function(t){return"string"==typeof t&&(t=lm[t]),t};const cm=Phaser.Utils.Objects.IsPlainObject,dm=Phaser.Utils.Objects.GetValue;class pm extends Nv{constructor(t,e,i,s,r,n,a){cm(e)?(e=dm(a=e,"x",0),i=dm(a,"y",0),s=dm(a,"width",void 0),r=dm(a,"height",void 0),n=dm(a,"orientation",0)):cm(s)?(s=dm(a=s,"width",void 0),r=dm(a,"height",void 0),n=dm(a,"orientation",0)):cm(n)&&(n=dm(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(dm(a,"space.item",0)),this.setStartChildIndex(dm(a,"startChildIndex",0)),this.setRTL(dm(a,"rtl",!1)),this.addChildrenMap("items",this.sizerChildren)}setOrientation(t){return this.orientation=um(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=hm.call(this)),this._childrenProportion}}Object.assign(pm.prototype,om);var gm=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}},fm=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},vm={appendText:fm,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 mm extends pm{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&&(gm(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&&(gm(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&&gm(t,this.iconWidth,this.iconHeight);var e=this.childrenMap.action;e&&void 0!==this.actionWidth&&void 0!==this.actionHeight&&gm(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(mm.prototype,vm);var ym=function(t,e,i,s){var r=new Pl(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 bm=Phaser.Utils.Objects.GetValue;const xm=Phaser.Utils.Objects.GetValue;var km=/^[\x00-\x7F]+$/,Cm=function(t){return km.test(t)},Sm=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,Pm=1,_m=2,Om=0,Em=1,Mm=2,Dm=/(?:\r\n|\r|\n)/;const Lm={none:Om,word:Em,char:Mm,character:Mm,mix:3};var Am=function(t,e){switch(Gc(t)){case 0:switch("string"==typeof e&&(e=Lm[e]||0),t.style.wrapMode=e,e){case 2:case 3:t.style.wordWrapCallback=Sm;break;default:t.style.wordWrapCallback=null}break;case 1:"string"==typeof e&&(e=Lm[e]||0),t.style.wrapMode=e}};const Rm=Phaser.Renderer.WebGL.Utils;var Bm={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=Rm.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 Fm=Phaser.Display.Color;var Im={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 Fm);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}},jm=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)},zm={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,jm(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}};eh();const Nm=Phaser.Display.Canvas.CanvasPool,Gm=Phaser.GameObjects.GameObject,Wm=Phaser.Utils.String.UUID;let Vm=class extends Gm{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=Nm.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(){Nm.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 Ym=Phaser.GameObjects.Components;Phaser.Class.mixin(Vm,[Ym.Alpha,Ym.BlendMode,Ym.Crop,Ym.Depth,Ym.Flip,Ym.GetBounds,Ym.Mask,Ym.Origin,Ym.Pipeline,Ym.PostPipeline,Ym.ScrollFactor,Ym.Tint,Ym.Transform,Ym.Visible,Bm,Im,zm]);let Xm=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(Xm.prototype,Zl);var Hm={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 $m=Phaser.Math.RotateAround;var Um;const Km=Phaser.Geom.Rectangle;var qm,Jm=function(t){void 0===qm&&(qm=new Km);var e=t.drawTLX,i=t.drawTLY;return qm.setTo(e,i,t.drawTRX-e,t.drawBLY-i),qm};const Zm=Phaser.Math.RotateAround;var Qm,ty=function(t,e,i,s){return void 0===s?s={}:!0===s&&(void 0===Qm&&(Qm={}),s=Qm),s.x=e,s.y=i,0!==t.rotation&&Zm(s,0,0,t.rotation),s.x=s.x*t.scaleX+t.drawX,s.y=s.y*t.scaleY+t.drawY,s};const ey=Phaser.GameObjects.Components.TransformMatrix;var iy,sy,ry={},ny=function(t,e,i,s,r){var n=ty(e,i,s,!0),a=function(t,e,i,s){void 0===s?s={}:!0===s&&(s=ry);var r=e-t.width*t.originX,n=i-t.height*t.originY;return void 0===iy&&(iy=new ey,sy=new ey),t.parentContainer?t.getWorldTransformMatrix(iy,sy):iy.applyITRS(t.x,t.y,t.rotation,t.scaleX,t.scaleY),iy.transformPoint(r,n,s),s}(t,n.x,n.y,r);return a},ay=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 ny(t,e,n,a,r)},oy={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===Um&&(Um={}),s=Um),s.x=(t-i.drawX)/i.scaleX,s.y=(e-i.drawY)/i.scaleY,0!==i.rotation&&$m(s,0,0,-i.rotation),s}(t,e,this,!0);return Jm(this).contains(i.x,i.y)},getWorldPosition:function(t,e,i){return ay(this.parent,this,t,e,i)}};Object.assign(oy,Hm);const hy=Phaser.Math.DegToRad,ly=Phaser.Math.RadToDeg,uy=Phaser.Utils.Objects.GetValue;class cy extends Xm{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 ly(this._rotation)}set angle(t){this.rotation=hy(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=uy(t,"width",void 0),i=uy(t,"height",void 0),s=uy(t,"scaleX",void 0),r=uy(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(cy.prototype,oy);const dy=Phaser.Utils.String.Pad;var py=function(t,e,i){if(null==t)return t;switch(typeof t){case"string":default:return t;case"number":return`#${dy(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}},gy=function(t,e,i){return e.hasOwnProperty(t)?e[t]:i[t]};const fy=Phaser.Utils.Objects.GetValue;let vy=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=fy(t,"x",0),i=fy(t,"y",0));var s=this.cornerRadius;s.tl=my(fy(t,"tl",void 0),e,i),s.tr=my(fy(t,"tr",void 0),e,i),s.bl=my(fy(t,"bl",void 0),e,i),s.br=my(fy(t,"br",void 0),e,i)}get radiusTL(){var t=this.cornerRadius.tl;return Math.max(t.x,t.y)}set radiusTL(t){yy(this.cornerRadius.tl,t)}get radiusTR(){var t=this.cornerRadius.tr;return Math.max(t.x,t.y)}set radiusTR(t){yy(this.cornerRadius.tr,t)}get radiusBL(){var t=this.cornerRadius.bl;return Math.max(t.x,t.y)}set radiusBL(t){yy(this.cornerRadius.bl,t)}get radiusBR(){var t=this.cornerRadius.br;return Math.max(t.x,t.y)}set radiusBR(t){yy(this.cornerRadius.br,t)}};var my=function(t,e,i){return void 0===t?t={x:e,y:i}:"number"==typeof t&&(t={x:t,y:t}),by(t),t},yy=function(t,e){"number"==typeof e?(t.x=e,t.y=e):(t.x=fy(e,"x",0),t.y=fy(e,"y",0)),by(t)},by=function(t){t.convex=t.x>=0||t.y>=0,t.x=Math.abs(t.x),t.y=Math.abs(t.y)};const xy=Phaser.Math.DegToRad;var ky=function(t){return!t.hasOwnProperty("convex")||t.convex},Cy=function(t){return t.x>0&&t.y>0},Sy=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,Cy(o)?(h=o.x*f,l=o.y*v,ky(o)?Sy(t,h,l,h,l,180,270,!1,a):Sy(t,0,0,h,l,90,0,!0,a),u=0,c=l):(t.lineTo(0,0),u=0,c=0),o=m.tr,Cy(o)?(h=o.x*f,l=o.y*v,ky(o)?Sy(t,s-h,l,h,l,270,360,!1,a):Sy(t,s,0,h,l,180,90,!0,a)):t.lineTo(s,0),o=m.br,Cy(o)?(h=o.x*f,l=o.y*v,ky(o)?Sy(t,s-h,r-l,h,l,0,90,!1,a):Sy(t,s,r,h,l,270,180,!0,a)):t.lineTo(s,r),o=m.bl,Cy(o)?(h=o.x*f,l=o.y*v,ky(o)?Sy(t,h,r-l,h,l,90,180,!1,a):Sy(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),wy(t.canvas,t.context,u,u,h,l,r,e,i,s,n,a,o)}};const Py=Phaser.Utils.Objects.GetValue;class _y extends cy{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=py(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=py(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=py(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,gy("color2",t,this),gy("horizontalGradient",t,this)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,gy("strokeThickness",t,this)),t.hasOwnProperty("cornerRadius")&&this.setCornerRadius(t.cornerRadius,gy("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 Oy=Phaser.Utils.Objects.GetValue;class Ey extends cy{constructor(t,e){super(t,"innerbounds"),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))}set color(t){t=py(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=py(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=py(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,Oy(t,"color2",null),Oy(t,"horizontalGradient",!0)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,Oy(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 My=Phaser.Utils.Objects.GetValue;let Dy=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(My(t,"bold",!1)),this.setItalic(My(t,"italic",!1)),this.setFontSize(My(t,"fontSize","16px")),this.setFontFamily(My(t,"fontFamily","Courier")),this.setColor(My(t,"color","#fff")),this.setStrokeStyle(My(t,"stroke",null),My(t,"strokeThickness",0)),this.setShadow(My(t,"shadowColor",null),My(t,"shadowOffsetX",0),My(t,"shadowOffsetY",0),My(t,"shadowBlur",0)),this.setOffset(My(t,"offsetX",0),My(t,"offsetY",0)),this.setSpace(My(t,"leftSpace",0),My(t,"rightSpace",0)),this.setAlign(My(t,"align",void 0)),this.setBackgroundColor(My(t,"backgroundColor",null)),this.setBackgroundHeight(My(t,"backgroundHeight",void 0)),this.setBackgroundBottomY(My(t,"backgroundBottomY",void 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(gy("stroke",t,this),gy("strokeThickness",t,this)),t.hasOwnProperty("shadowColor")&&this.setShadowColor(t.shadowColor),(t.hasOwnProperty("shadowOffsetX")||t.hasOwnProperty("shadowOffsetY"))&&this.setShadowOffset(gy("shadowOffsetX",t,this),gy("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),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=py(t),this}get hasFill(){return null!=this.color}setStrokeStyle(t,e){return this.stroke=py(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=py(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=py(t),this}get hasBackgroundColor(){return null!=this.backgroundColor}setBackgroundHeight(t){return this.backgroundHeight=t,this}setBackgroundBottomY(t){return this.backgroundBottomY=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 Ly=Phaser.Utils.Array.Remove;const Ay=Phaser.Utils.Array.Remove;const Ry="text",By="image",Fy="drawer",Iy="space",jy="command";var zy=function(t){return t.type===Ry&&"\n"===t.text},Ny=function(t){return t.type===Ry&&"\f"===t.text},Gy=function(t){return t.type===Ry};class Wy extends cy{constructor(t,e,i){super(t,Ry),this.updateTextFlag=!1,this.style=new Dy(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,s=this.drawTRX-i+1,r=e.backgroundBottomY;null==r&&(r=this.drawBLY);var n=e.backgroundHeight;null==n&&(n=r-this.drawTLY);var a=r-n;t.fillRect(i,a,s,n)}var o=e.hasFill,h=e.hasStroke;(o||h)&&(e.syncFont(t).syncStyle(t),h&&(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 Vy=function(t,e){var i=this.createCharChildren(t,e);return this.addChild(i),this};const Yy=Phaser.Display.Canvas.CanvasPool;var Xy=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=Yy.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),Yy.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 Hy extends cy{constructor(t,e,i){super(t,By),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(){Xy(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 $y extends cy{constructor(t,e,i,s){super(t,Fy),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 Uy extends cy{constructor(t,e){super(t,Iy),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 Ky extends Xm{constructor(t,e,i,s,r){super(t,jy),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 Jy={none:0,word:1,char:2,character:2,mix:3};var Zy=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=ib.call(this)).height,a=l.ascent,i=Math.floor((h-a)/n)}else{var l;n=(l=ib.call(this)).height,a=l.ascent}}else if(this.fixedHeight>0){if(void 0===(i=rb(t,"maxLines"))){h=this.fixedHeight-s;i=Math.floor(h/n)}}else i=rb(t,"maxLines",0);void 0===a&&(a=n);var u=0===i,c=rb(t,"wrapMode");void 0===c&&(c=rb(t,"charWrap",!1)?"char":"word");"string"==typeof c&&(c=Jy[c]);var d=rb(t,"wrapWidth",void 0);void 0===d&&(this.fixedWidth>0?d=this.fixedWidth-r:(d=1/0,c=0));for(var p=rb(t,"letterSpacing",0),g=rb(t,"hAlign",0),f=rb(t,"vAlign",0),v=rb(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&&(E.push({children:M,width:D}),L=Math.max(L,D)),m.start+=O.length,m.isLastPage=!A&&m.start===_,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=ob(t,"maxLines",void 0))){var a=this.fixedWidth-r;i=Math.floor(a/n)+1}}else i=ob(t,"maxLines",0);var o=0===i,h=ob(t,"fixedCharacterHeight",void 0);if(void 0===h){var l=ob(t,"charPerLine",void 0);if(void 0!==l){var u=this.fixedHeight-s;h=Math.floor(u/l)}}var c=ob(t,"wrapHeight",void 0);void 0===c&&(c=this.fixedHeight>0?this.fixedHeight-s:1/0);for(var d=ob(t,"letterSpacing",0),p=ob(t,"rtl",!0),g=ob(t,"hAlign",p?2:0),f=ob(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:E,height:M}),D=Math.max(D,M)),v.start+=_.length,v.isLastPage=v.start===P,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 rp(i,t,e),this.dirty=this.dirty||s!=i.left||r!=i.right||n!=i.top||a!=i.bottom,this},getPadding:function(t){return sp(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),Ly(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 Ay(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(Ry);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)),ay(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=Gb(t,r,e,i,n),o=0;o<=jb&&0!==a;o++){if((r+=a)<0){r=0;break}a=Gb(t,r,e,i,n)}return o===jb&&console.warn("FontSizeFit: Test count exceeds 65535"),t.setFontSize(r),Wb(t,e,i),t},Nb=function(t,e,i){return void 0===i[e]&&(t.setFontSize(e),i[e]={width:t.width,height:t.height}),i[e]},Gb=function(t,e,i,s,r){var n,a=Nb(t,e,r),o=Nb(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 Vb=Phaser.Utils.Objects.GetValue;var Yb=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 zb(t,e,i),t}):(t.runWidthWrap=function(e){return t.setFixedSize&&t.setFixedSize(0,0),zb(t,e,void 0),t},t.resize=function(e,i){return t.width===e&&t.height===i||t.setFixedSize(e,i),t}),t};const Xb=Phaser.Utils.Objects.GetValue,Hb=[function(t){var e=this.scene,i=bm(t,"orientation",0);this.setOrientation(i);var s=bm(t,"icon",void 0),r=bm(t,"iconMask",void 0),n=bm(t,"innerBackground",void 0),a=bm(t,"title",void 0),o=bm(t,"separator",void 0),h=bm(t,"text",void 0),l=bm(t,"action",void 0),u=bm(t,"actionMask",void 0);if(s){var c=bm(t,"align.icon","center");m=0===this.orientation?{right:bm(t,"space.icon",0),top:bm(t,"space.iconTop",0),bottom:bm(t,"space.iconBottom",0),left:bm(t,"space.iconLeft",0)}:{bottom:bm(t,"space.icon",0),left:bm(t,"space.iconLeft",0),right:bm(t,"space.iconRight",0),top:bm(t,"space.iconTop",0)};var d=bm(t,"squareFitIcon",!1)?1:0;if(this.add(s,{proportion:0,align:c,padding:m,fitRatio:d}),r&&(r=ym.call(this,s,s,1)),!d){var p=bm(t,"iconSize",void 0);this.setIconSize(bm(t,"iconWidth",p),bm(t,"iconHeight",p))}}var g=new pm(e,{orientation:1});n&&g.addBackground(n);var f=bm(t,"space.separator",0);if(a){c=bm(t,"align.title","left");var v=bm(t,"expandTitleWidth",!1);y=bm(t,"expandTitleHeight",!1)?1:0,b=v,m={bottom:!o&&h?bm(t,"space.title",f):0,left:bm(t,"space.titleLeft",0),right:bm(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:bm(t,"space.separatorLeft",0),right:bm(t,"space.separatorRight",0)};g.add(o,{expand:!0,padding:m})}if(h){c=bm(t,"align.text","left");var y,b,x=bm(t,"expandTextWidth",!1);y=bm(t,"expandTextHeight",!1)?1:0,b=x,m={left:bm(t,"space.textLeft",0),right:bm(t,"space.textRight",0)},g.add(h,{proportion:y,expand:b,align:c,padding:m})}m=void 0;if(l&&(m={right:bm(t,"space.text",0)}),this.add(g,{proportion:1,padding:m}),l){c=bm(t,"align.action","center");m=0===this.orientation?{top:bm(t,"space.actionTop",0),bottom:bm(t,"space.actionBottom",0),right:bm(t,"space.actionRight",0)}:{left:bm(t,"space.actionLeft",0),right:bm(t,"space.actionRight",0),bottom:bm(t,"space.actionBottom",0)};d=bm(t,"squareFitAction",!1)?1:0;if(this.add(l,{proportion:0,align:c,padding:m,fitRatio:d}),u&&(u=ym.call(this,l,l,1)),!d){var k=bm(t,"actionSize");this.setActionSize(bm(t,"actionWidth",k),bm(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=xm(t,"title",void 0),s=xm(t,"separator",void 0),r=xm(t,"innerBackground",void 0),n=xm(t,"icon",void 0),a=xm(t,"iconMask",void 0),o=xm(t,"text",void 0),h=xm(t,"action",void 0),l=xm(t,"actionMask",void 0);if(i){var u=xm(t,"align.title","left"),c=xm(t,"expandTitleWidth",!1);y=xm(t,"expandTitleHeight",!1)?1:0,b=c,p={bottom:xm(t,"space.title",0),left:xm(t,"space.titleLeft",0),right:xm(t,"space.titleRight",0)},this.add(i,{proportion:y,expand:b,align:u,padding:p})}if(s){var d=xm(t,"space.separator",0),p={top:i?d:0,bottom:o?d:0,left:xm(t,"space.separatorLeft",0),right:xm(t,"space.separatorRight",0)};this.add(s,{proportion:0,expand:!0,padding:p})}var g=xm(t,"orientation",0),f=new pm(e,{orientation:g,rtl:xm(t,"rtl",!1),space:{left:xm(t,"space.innerLeft",0),right:xm(t,"space.innerRight",0),top:xm(t,"space.innerTop",0),bottom:xm(t,"space.innerBottom",0)}});if(r&&f.addBackground(r),this.add(f,{proportion:1,expand:!0}),n){u=xm(t,"align.icon","center");p=0===f.orientation?{right:xm(t,"space.icon",0),top:xm(t,"space.iconTop",0),bottom:xm(t,"space.iconBottom",0),left:xm(t,"space.iconLeft",0)}:{bottom:xm(t,"space.icon",0),left:xm(t,"space.iconLeft",0),right:xm(t,"space.iconRight",0),top:xm(t,"space.iconTop",0)};var v=xm(t,"squareFitIcon",!1)?1:0;if(f.add(n,{proportion:0,align:u,padding:p,fitRatio:v}),a&&(a=ym.call(this,n,n,1)),!v){var m=xm(t,"iconSize",void 0);this.setIconSize(xm(t,"iconWidth",m),xm(t,"iconHeight",m))}}if(o){u=xm(t,"align.text","left");var y,b,x=xm(t,"space.text",0),k=xm(t,"expandTextWidth",!1),C=xm(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=xm(t,"align.action","center");p=0===f.orientation?{top:xm(t,"space.actionTop",0),bottom:xm(t,"space.actionBottom",0),right:xm(t,"space.actionRight",0)}:{left:xm(t,"space.actionLeft",0),right:xm(t,"space.actionRight",0),bottom:xm(t,"space.actionBottom",0)};v=xm(t,"squareFitAction",!1)?1:0;if(f.add(h,{proportion:0,align:u,padding:p,fitRatio:v}),l&&(l=ym.call(this,h,h,1)),!v){var S=xm(t,"actionSize");this.setActionSize(xm(t,"actionWidth",S),xm(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 $b extends mm{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexTitleLabel";var i=Xb(e,"background",void 0);i&&this.addBackground(i);var s=Xb(e,"title",void 0),r=Xb(e,"text",void 0);if(s){var n=Xb(e,"wrapTitle",!1),a=Xb(e,"adjustTitleFontSize",!1);n?(!0===n&&(n="word"),Am(s,n),e.expandTitleWidth=!0,Ib(s)):a&&(e.expandTextWidth=!0,e.expandTextHeight=!0,Yb(s,{fitHeight:!0}))}if(r){var o=Xb(e,"wrapText",!1),h=Xb(e,"adjustTextFontSize",!1);o?(!0===o&&(o="word"),Am(r,o),e.expandTextWidth=!0,Ib(r)):h&&(e.expandTextWidth=!0,e.expandTextHeight=!0,Yb(r,{fitHeight:!0}))}var l=Xb(e,"layoutMode",0);(Hb[l]||Hb[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 Ub 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()}}}($b)){constructor(t,e){void 0===e&&(e={}),e.hasOwnProperty("layoutMode")||(e.layoutMode=1),super(t,e)}}const Kb=Phaser.GameObjects.GetCalcMatrix;const qb=Phaser.Renderer.Canvas.SetTransform;var Jb={renderWebGL:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.pipelines.set(e.pipeline),n=Kb(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&&eu(r,a,e,l,o,h),e.isStroked&&su(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(Qb.prototype,Jb);const tx=Phaser.Utils.Objects.IsPlainObject,ex=Phaser.Utils.Objects.GetValue,ix=Phaser.Geom.Polygon.Earcut;class sx extends Qb{constructor(t,e,i,s,r,n,a,o){var h,l,u,c;if(tx(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 vy;if(super(t,"rexRoundRectangleShape",p),this.setShapeType(c),0===this.shapeType){var g=ex(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)}var f=ex(n,"iteration",void 0);this.setIteration(f),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,rx(i))if(i.convex){var o=i.x,h=i.y;uu(o,h,i.x,i.y,180,270,!1,a,e)}else{uu(o=0,h=0,i.x,i.y,90,0,!0,a,e)}else hu(0,0,e);if(i=n.tr,rx(i))if(i.convex){o=s-i.x,h=i.y;uu(o,h,i.x,i.y,270,360,!1,a,e)}else{uu(o=s,h=0,i.x,i.y,180,90,!0,a,e)}else hu(s,0,e);if(i=n.br,rx(i))if(i.convex){o=s-i.x,h=r-i.y;uu(o,h,i.x,i.y,0,90,!1,a,e)}else{uu(o=s,h=r,i.x,i.y,270,180,!0,a,e)}else hu(s,r,e);if(i=n.bl,rx(i))if(i.convex){o=i.x,h=r-i.y;uu(o,h,i.x,i.y,90,180,!1,a,e)}else{uu(o=0,h=r,i.x,i.y,360,270,!0,a,e)}else hu(0,r,e);return e.push(e[0],e[1]),this.pathIndexes=ix(e),this}setShapeType(t){return"string"==typeof t&&(t=nx[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}}var rx=function(t){return t.x>0&&t.y>0};const nx={rectangle:0,circle:1};var ax=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},ox=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};const vx=Phaser.Utils.Objects.GetValue,mx=Phaser.Utils.Objects.IsPlainObject;class yx extends(oc(ql)){constructor(t,e,i,s,r,n,a,o){mx(e)?(e=vx(o=e,"x",0),i=vx(o,"y",0),s=vx(o,"width",2),r=vx(o,"height",2),n=vx(o,"barColor",void 0),a=vx(o,"value",0)):mx(s)?(s=vx(o=s,"width",2),r=vx(o,"height",2),n=vx(o,"barColor",void 0),a=vx(o,"value",0)):mx(n)&&(n=vx(o=n,"barColor",void 0),a=vx(o,"value",0)),super(t,e,i,s,r,o),this.type="rexLineProgress",this.bootProgressBase(o),this.addShape((new Fu).setName("trackFill")).addShape((new Fu).setName("bar")).addShape((new Fu).setName("trackStroke")),this.setTrackColor(vx(o,"trackColor",void 0)),this.setBarColor(n),this.setTrackStroke(vx(o,"trackStrokeThickness",2),vx(o,"trackStrokeColor",void 0)),this.setSkewX(vx(o,"skewX",0)),this.setRTL(vx(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 bx={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&&fx(s,0,0,e,i,t).close();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),fx(a,r,0,n,i,t).close());var o=this.getShape("trackStroke");o.lineStyle(this.trackStrokeThickness,this.trackStrokeColor),o.isStroked&&fx(o,0,0,e,i,t).end()}};Object.assign(yx.prototype,bx);class xx extends yx{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=kx,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 kx={color:"trackColor",strokeColor:"trackStrokeColor",strokeWidth:"trackStrokeThickness"};Object.assign(xx.prototype,dx);let Cx=class extends zn{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 Sx=Phaser.GameObjects.NineSlice,wx=Phaser.Utils.Objects.GetValue;class Tx extends Sx{constructor(t,e){void 0===e&&(e={}),super(t,wx(e,"x",0),wx(e,"y",0),wx(e,"key",null),wx(e,"frame",null),wx(e,"width",0),wx(e,"height",0),wx(e,"leftWidth",0),wx(e,"rightWidth",0),wx(e,"topHeight",0),wx(e,"bottomHeight",0)),this.type="rexStatesNineSlice";var i=wx(e,"effects",!0);i&&Mr(this,i),this.style=new Cx(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign(Tx.prototype,dx);let Px=class extends zn{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 _x=Phaser.GameObjects.Image,Ox=Phaser.Utils.Objects.GetValue;class Ex extends _x{constructor(t,e){void 0===e&&(e={}),super(t,Ox(e,"x",0),Ox(e,"y",0),Ox(e,"key",""),Ox(e,"frame",void 0)),this.type="rexStatesImage";var i=Ox(e,"effects",!0);i&&Mr(this,i),this.style=new Px(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign(Ex.prototype,dx);var Mx=function(t,e,i){return"__BASE"===i?`${t},${e}`:`${i}:${t},${e}`};const Dx=Phaser.Utils.Objects.IsPlainObject,Lx=Phaser.Utils.Objects.GetValue;var Ax=function(t){return"string"==typeof t&&(t=Rx[t]),t};const Rx={scale:0,repeat:1};var Bx=function(t,e){return 0===t||t===this.columns.count-1||0===e||e===this.rows.count-1},Fx={_beginDraw:pd,_drawImage:pd,_drawTileSprite:pd,_endDraw:pd,setGetFrameNameCallback:function(t){return void 0===t&&(t=Mx),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 Dx(t)?(this.stretchMode.edge=Ax(Lx(t,"edge",0)),this.stretchMode.internal=Ax(Lx(t,"internal",0))):(t=Ax(t),this.stretchMode.edge=t,this.stretchMode.internal=t),this},getStretchMode:function(t,e){return Bx.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 Ix=Phaser.Utils.Objects.IsPlainObject,jx=Phaser.Utils.Objects.GetValue;const zx=Phaser.GameObjects;var Nx=void 0,Gx=function(t,e){if(Nx||(Nx={},In(t).events.once("destroy",(function(){for(var t in Nx)Nx[t].destroy();Nx=void 0}))),!Nx.hasOwnProperty(e)){var i=In(t).scene.systemScene;(t=new zx[e](i)).setOrigin(0),Nx[e]=t}return Nx[e]};const Wx=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(Ix(i)?(i=jx(u=i,"x",0),s=jx(u,"y",0),r=jx(u,"width",1),n=jx(u,"height",1),a=jx(u,"key",void 0),o=jx(u,"baseFrame",void 0),h=jx(u,"columns",void 0),l=jx(u,"rows",void 0)):Ix(r)?(r=jx(u=r,"width",1),n=jx(u,"height",1),a=jx(u,"key",void 0),o=jx(u,"baseFrame",void 0),h=jx(u,"columns",void 0),l=jx(u,"rows",void 0)):Ix(a)?(a=jx(u=a,"key",void 0),o=jx(u,"baseFrame",void 0),h=jx(u,"columns",void 0),l=jx(u,"rows",void 0)):Ix(o)?(o=jx(u=o,"baseFrame",void 0),h=jx(u,"columns",void 0),l=jx(u,"rows",void 0)):Array.isArray(o)?(u=l,l=h,h=o,o=jx(u,"baseFrame",void 0)):Ix(h)&&(h=jx(u=h,"columns",void 0),l=jx(u,"rows",void 0)),void 0===o&&(o=jx(u,"frame",void 0)),void 0===h){var c=jx(u,"leftWidth",void 0),d=jx(u,"rightWidth",void 0);void 0!==c&&void 0!==d&&(h=[c,void 0,d])}if(void 0===l){var p=jx(u,"topHeight",void 0),g=jx(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(jx(u,"getFrameNameCallback",void 0)),this.setStretchMode(jx(u,"stretchMode",0)),this.setPreserveRatio(jx(u,"preserveRatio",!0));var f=jx(u,"maxFixedPartScale",1),v=jx(u,"maxFixedPartScaleX",f),m=jx(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,Fx),i}(Wx,"rexNinePatch")){}var Yx={_drawImage:function(t,e,i,s,r,n){var a=Gx(this,"Image").setTexture(t,e).setDisplaySize(r,n);this.draw(a,i,s)},_drawTileSprite:function(t,e,i,s,r,n){var a=Gx(this,"TileSprite").setTexture(t,e).setSize(r,n);this.draw(a,i,s)}};Object.assign(Vx.prototype,Yx);let Xx=class extends zn{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 Hx=Phaser.Utils.Objects.GetValue;class $x extends Vx{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexStatesNinePatch";var i=Hx(e,"effects",!0);i&&Mr(this,i),this.style=new Xx(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign($x.prototype,dx);const Ux=["alpha","tint","flipX","flipY"];var Kx=function(t,e){if(!e)return t;for(var i=0,s=Ux.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},_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(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;var Yr=function(t,e){if(void 0===e?e=new Gr:!0===e&&(void 0===Xr&&(Xr=new Gr),e=Xr),t.getBounds)return t.getBounds(e);var i,s,r,n,a,o,h,l;if(t.parentContainer){var u=t.parentContainer.getBoundsTransformMatrix();Hr(t,e),u.transformPoint(e.x,e.y,e),i=e.x,s=e.y,$r(t,e),u.transformPoint(e.x,e.y,e),r=e.x,n=e.y,Ur(t,e),u.transformPoint(e.x,e.y,e),a=e.x,o=e.y,Kr(t,e),u.transformPoint(e.x,e.y,e),h=e.x,l=e.y}else Hr(t,e),i=e.x,s=e.y,$r(t,e),r=e.x,n=e.y,Ur(t,e),a=e.x,o=e.y,Kr(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},Xr=void 0,Hr=function(t,e,i){return void 0===e?e=new Wr:!0===e&&(void 0===Jr&&(Jr=new Wr),e=Jr),t.getTopLeft?t.getTopLeft(e):(e.x=t.x-zr(t)*t.originX,e.y=t.y-Nr(t)*t.originY,Zr(t,e,i))},$r=function(t,e,i){return void 0===e?e=new Wr:!0===e&&(void 0===Jr&&(Jr=new Wr),e=Jr),t.getTopRight?t.getTopRight(e):(e.x=t.x-zr(t)*t.originX+zr(t),e.y=t.y-Nr(t)*t.originY,Zr(t,e,i))},Ur=function(t,e,i){return void 0===e?e=new Wr:!0===e&&(void 0===Jr&&(Jr=new Wr),e=Jr),t.getBottomLeft?t.getBottomLeft(e):(e.x=t.x-zr(t)*t.originX,e.y=t.y-Nr(t)*t.originY+Nr(t),Zr(t,e,i))},Kr=function(t,e,i){return void 0===e?e=new Wr:!0===e&&(void 0===Jr&&(Jr=new Wr),e=Jr),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),Zr(t,e,i))},qr=function(t,e,i){void 0===e?e=new Wr:!0===e&&(void 0===Jr&&(Jr=new Wr),e=Jr);var s=zr(t),r=Nr(t);return e.x=t.x+s*(.5-t.originX),e.y=t.y+r*(.5-t.originY),Zr(t,e,i)},Jr=void 0,Zr=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 Qr=Phaser.Utils.Objects.GetValue;var tn=function(t,e,i){var s,r,n,a,o;if("number"==typeof i?s=i:(s=Qr(i,"color"),r=Qr(i,"lineWidth"),n=Qr(i,"fillColor"),a=Qr(i,"fillAlpha",1),o=Qr(i,"padding",0)),Array.isArray(t))for(var h=0,l=t.length;h0?-this.delay:0,this.state=this.nowTime>=0?Jn:qn,this.repeatCounter=0,this}stop(){return this.state=Kn,this}update(t,e){this.state!==Kn&&this.state!==Qn&&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=Zn)):(this.nowTime=this.duration,this.state=Qn):this.nowTime>=0&&(this.state=Jn))}get t(){var t;switch(this.state){case Kn:case qn:case Zn:t=0;break;case Jn:t=this.nowTime/this.duration;break;case Qn:t=1}return $n(t,0,1)}set t(t){(t=$n(t,-1,1))<0?(this.state=qn,this.nowTime=-this.delay*t):(this.state=Jn,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===Kn}get isDelay(){return this.state===qn}get isCountDown(){return this.state===Jn}get isRunning(){return this.state===qn||this.state===Jn}get isDone(){return this.state===Qn}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}};const Kn=0,qn=1,Jn=2,Zn=3,Qn=-1;class ta extends Yn{constructor(t,e){super(t,e),this.timer=new Un}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 ea=Phaser.Utils.Objects.GetValue,ia=Phaser.Utils.Objects.GetAdvancedValue,sa=Phaser.Tweens.Builders.GetEaseFunction;class ra extends ta{resetFromJSON(t){return this.timer.resetFromJSON(ea(t,"timer")),this.setEnable(ea(t,"enable",!0)),this.setTarget(ea(t,"target",this.parent)),this.setDelay(ia(t,"delay",0)),this.setDuration(ia(t,"duration",1e3)),this.setEase(ea(t,"ease","Linear")),this.setRepeat(ea(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=sa(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 na=Phaser.Sound.BaseSound;var aa=function(t){return t instanceof na};const oa=Phaser.Utils.Objects.GetValue,ha=Phaser.Utils.Objects.GetAdvancedValue,la=Phaser.Math.Linear;let ua=class extends ra{constructor(t,e,i){aa(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(oa(t,"mode",0)),this.setEnable(oa(t,"enable",!0)),this.setVolumeRange(ha(t,"volume.start",this.parent.volume),ha(t,"volume.end",0)),this}setMode(t){return"string"==typeof t&&(t=ca[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=la(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 ca={stop:1,destroy:2};var da=function(t,e,i,s,r){aa(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 ua(t,e,a),e._fade=n),n.start(),e.isPlaying||e.setVolume(r).play(),e},pa=function(t,e,i,s){aa(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 ua(t,e,n),e._fade=r),r.start(),e.isPlaying||e.play(),e};const ga=Phaser.Utils.Objects.GetValue;var fa={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:ga(e,"loop",this.backgroundMusicLoop),mute:ga(e,"mute",this.backgroundMusicMute),volume:ga(e,"volume",this.backgroundMusicVolume),detune:ga(e,"detune",0),rate:ga(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&&da(this.backgroundMusic,t,this.backgroundMusicVolume,0),this},fadeOutBackgroundMusic(t,e){return this.backgroundMusic&&pa(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 va=Phaser.Utils.Objects.GetValue;var ma={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:va(e,"loop",this.backgroundMusicLoop),mute:va(e,"mute",this.backgroundMusic2Mute),volume:va(e,"volume",this.backgroundMusic2Volume),detune:va(e,"detune",0),rate:va(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&&da(this.backgroundMusic2,t,this.backgroundMusic2Volume,0),this},fadeOutBackgroundMusic2(t,e){return this.backgroundMusic2&&pa(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 ya=Phaser.Utils.Array.Remove,ba=Phaser.Utils.Objects.GetValue;var xa={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:ba(e,"mute",this.soundEffectsMute),volume:ba(e,"volume",this.soundEffectsVolume),detune:ba(e,"detune",0),rate:ba(e,"rate",1)});return this.soundEffects.push(i),i.once("complete",(function(){i.destroy(),this.sound&&ya(this.soundEffects,i)}),this).once("destroy",(function(){this.sound&&ya(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&&da(e,t,this.soundEffectsVolume,0),this},fadeOutSoundEffect(t,e){var i=this.getLastSoundEffect();return i&&pa(i,t,e),this},fadeOutAllSoundEffects(t,e){for(var i=this.soundEffects.length-1;i>=0;i--)pa(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&&da(e,t,this.soundEffects2Volume,0),this},fadeOutSoundEffect2(t,e){var i=this.getLastSoundEffect2();return i&&pa(i,t,e),this},fadeOutAllSoundEffects2(t,e){for(var i=this.soundEffects2.length-1;i>=0;i--)pa(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 Ra=Phaser.Utils.Objects.GetValue,Ba=new class extends Aa{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=eo(this.delimiterLeft),e=eo(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=no),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=ho),this.tagExpression=t,this}setValueExpression(t){return t||(t=ho),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!==ho||this.valueExpression!==ho){var s=`${this.tagExpression}(=${this.valueExpression})?`,r=`/${this.tagExpression}`;t=eo(this.delimiterLeft),e=eo(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=ao(e[3],this.valueConverter);this.emit(`+${i}`,...r),this.skipEventFlag||this.emit("+",i,...r),this.lastTagStart=i}}}const ho="[^=]+";var lo=[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()}))}],uo=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},co=function(t,e){var i=Array.isArray(t);if(void 0===e?e=i?[]:{}:uo(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}},Co={"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}},So={"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}},wo={"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}},To={"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}},Po=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 Po(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(!Po(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}},Oo={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 Ho=Phaser.GameObjects.Zone;let $o=class extends Ho{constructor(t){super(t,0,0,2,2),this.fullWindow=new Xo(this)}};const Uo="BG",Ko="SPRITE",qo="TEXTBOX",Jo="TITLE",Zo="CHOICE",Qo="NAMEINPUT";var th=!1,eh=function(t){th||(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 sh(this.children,t,0,(function(t){t.once("destroy",e.onChildDestroy,e)}),this),this}remove(t,e){var i=this;return rh(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;iuh(t),resetChildState(t){return this.resetChildPositionState(t).resetChildVisibleState(t).resetChildAlphaState(t).resetChildActiveState(t),this},resetChildrenState(t){for(var e=0,i=t.length;euh(t).x,getChildLocalY:t=>uh(t).y};const Ph=Phaser.Math.DegToRad;var _h={updateChildRotation(t){var e=uh(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=uh(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 uh(t).rotation=e,this.updateChildRotation(t),this},setChildLocalAngle(t,e){return uh(t).rotation=Ph(e),this.updateChildRotation(t),this},resetLocalRotationState(){var t=uh(this).parent;return t&&t.resetChildRotationState(this),this},getChildLocalRotation:t=>uh(t).rotation},Oh={updateChildScale(t){var e=uh(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=uh(t),i=e.parent;return e.scaleX=wh(t.scaleX,i.scaleX),e.scaleY=wh(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=uh(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=uh(this).parent;return t&&t.resetChildScaleState(this),this},getChildLocalScaleX:t=>uh(t).scaleX,getChildLocalScaleY:t=>uh(t).scaleY},Eh={updateChildVisible(t){var e=uh(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=uh(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),uh(t).visible=e,this.updateChildVisible(t),this},setChildMaskVisible(t,e){return void 0===e&&(e=!0),uh(t).maskVisible=e,this.updateChildVisible(t),this},resetLocalVisibleState(){var t=uh(this).parent;return t&&t.resetChildVisibleState(this),this},getChildLocalVisible:t=>uh(t).visible},Mh={updateChildAlpha(t){var e=uh(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=uh(t),i=e.parent;return e.alpha=wh(t.alpha,i.alpha),this},setChildAlpha(t,e){return t.alpha=e,this.resetChildAlphaState(t),this},setChildLocalAlpha(t,e){return uh(t).alpha=e,this.updateChildAlpha(t),this},resetLocalAlphaState(){var t=uh(this).parent;return t&&t.resetChildAlphaState(this),this},getChildLocalAlpha:t=>uh(t).alpha},Dh={updateChildActive(t){var e=uh(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 uh(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),uh(t).active=e,this.updateChildActive(t),this},resetLocalActiveState(){var t=uh(this).parent;return t&&t.resetChildActiveState(this),this},getChildLocalActive:t=>uh(t).active},Lh={updateChildScrollFactor(t){var e=uh(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}},Ah={updateCameraFilter(t){var e=uh(t),i=e.parent;return e.syncCameraFilter&&(t.cameraFilter=i.cameraFilter),this},syncCameraFilter(){return this.syncChildrenEnable&&this.children.forEach(this.updateCameraFilter,this),this}},Rh={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}},Bh=function(t){return t.filter((function(t){return!!t.displayList||(!!t.parentContainer||void 0)}))},Fh={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}},Ih=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 zh=Phaser.Utils.Array;var Nh={getChildren(t){if(t)for(var e=0,i=this.children.length;e0?u.pop().setTexture(d,_):r(c,d,_),h&&c.add.existing(P),l){var O=b+C*T+a*C,E=x+S*w+o*S;P.setOrigin(a,o).setPosition(O,E).setScale(f,v).setRotation(m),Ll(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(Wl.prototype,Bl);const Yl={fit:1,FIT:1,envelop:2,ENVELOP:2};const Xl=Phaser.GameObjects.GetCalcMatrix;const Hl=Phaser.Renderer.Canvas.SetTransform;var $l={renderWebGL:function(t,e,i,s){e.updateData(),i.addToRenderList(e);var r=t.pipelines.set(e.pipeline),n=Xl(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+")"},nu=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 au=Phaser.Geom.Polygon.Earcut;class ou extends Ql{constructor(){super(),this.pathData=[],this.pathIndexes=[],this.closePath=!1}updateData(){return this.pathIndexes=au(this.pathData),super.updateData(),this}webglRender(t,e,i,s,r){this.isFilled&&eu(t,e,this,i,s,r),this.isStroked&&su(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 lu=Phaser.Math.DegToRad;var uu=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=ju(t,"tl",0),this.radiusTR=ju(t,"tr",0),this.radiusBL=ju(t,"bl",0),this.radiusBR=ju(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?uu(e,e,e,e,180,270,!1,r,t):uu(0,0,e,e,90,0,!0,r,t):hu(0,0,t);(e=this.radiusTR)>0?this._convexTR?uu(i-e,e,e,e,270,360,!1,r,t):uu(i,0,e,e,180,90,!0,r,t):hu(i,0,t);(e=this.radiusBR)>0?this._convexBR?uu(i-e,s-e,e,e,0,90,!1,r,t):uu(i,s,e,e,270,180,!0,r,t):hu(i,s,t);(e=this.radiusBL)>0?this._convexBL?uu(e,s-e,e,e,90,180,!1,r,t):uu(0,s,e,e,360,270,!0,r,t):hu(0,s,t);return t.push(t[0],t[1]),xu(this.x,this.y,t),super.updateData(),this}};const Nu=Phaser.Renderer.WebGL.Utils.getTintAppendFloatAlpha;const Gu={arc:du,circle:pu,curve:class extends ou{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(),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},Vc=function(t){return null==t?t="":Array.isArray(t)?t=t.join("\n"):"number"==typeof t&&(t=t.toString()),t},Yc={clearText(){return this.sections.length=0,this.pageStartIndexes.length=0,this.lines.length=0,this},appendPage(t){var e=this.totalLinesCount;this.sections.push(Vc(t));t=this.sections.join("\n");this.lines=Wc(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,Yc,Hc,Uc);const qc=Phaser.Utils.Objects.GetValue;Phaser.Math.Clamp;class Jc extends zn{constructor(t,e){super(t,{eventEmitter:!1}),this.textObjectType=Gc(this.parent),this.pageStartIndexes=[],this.lines=Wc(this.parent,""),this.sections=[],this.resetFromJSON(e)}resetFromJSON(t){this.setMaxLines(qc(t,"maxLines",void 0)),this.setPageBreak(qc(t,"pageBreak","\f\n")),this.setText(qc(t,"text","")),this.startLineIndex=qc(t,"start",-1),this.endLineIndex=qc(t,"end",void 0);var e=qc(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,Kc);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?$c(this.parent,t):this.parent.setText(t)},appendText(t){var e=this.text.concat(Vc(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 zn{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=Vc(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?$c(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,kd=10,Cd=12,Sd=function(t){var e=Nr(t);return t.y+e-e*t.originY},wd=function(t){var e=zr(t);return t.x-e*t.originX+.5*e},Td=function(t,e){var i=Nr(t);return t.y=e-i+i*t.originY,t},Pd=function(t,e){var i=zr(t),s=i*t.originX;return t.x=e+s-.5*i,t},_d=function(t){var e=zr(t);return t.x-e*t.originX},Od=function(t,e){var i=zr(t);return t.x=e+i*t.originX,t},Ed=function(t){var e=zr(t);return t.x+e-e*t.originX},Md=function(t,e){var i=zr(t);return t.x=e-i+i*t.originX,t},Dd=function(t,e){var i=Nr(t),s=i*t.originY;return t.y=e+s-.5*i,t},Ld=function(t){var e=Nr(t);return t.y-e*t.originY+.5*e},Ad=function(t){var e=Nr(t);return t.y-e*t.originY},Rd=function(t,e){var i=Nr(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),Pd(t,wd(e)+i),Td(t,Sd(e)+s),t},Bd[kd]=function(t,e,i,s){return void 0===i&&(i=0),void 0===s&&(s=0),Od(t,_d(e)-i),Td(t,Sd(e)+s),t},Bd[Cd]=function(t,e,i,s){return void 0===i&&(i=0),void 0===s&&(s=0),Md(t,Ed(e)+i),Td(t,Sd(e)+s),t},Bd[bd]=function(t,e,i,s){return void 0===i&&(i=0),void 0===s&&(s=0),function(t,e,i){Pd(t,e),Dd(t,i)}(t,wd(e)+i,Ld(e)+s),t},Bd[yd]=function(t,e,i,s){return void 0===i&&(i=0),void 0===s&&(s=0),Od(t,_d(e)-i),Dd(t,Ld(e)+s),t},Bd[xd]=function(t,e,i,s){return void 0===i&&(i=0),void 0===s&&(s=0),Md(t,Ed(e)+i),Dd(t,Ld(e)+s),t},Bd[vd]=function(t,e,i,s){return void 0===i&&(i=0),void 0===s&&(s=0),Pd(t,wd(e)+i),Rd(t,Ad(e)-s),t},Bd[fd]=function(t,e,i,s){return void 0===i&&(i=0),void 0===s&&(s=0),Od(t,_d(e)-i),Rd(t,Ad(e)-s),t},Bd[md]=function(t,e,i,s){return void 0===i&&(i=0),void 0===s&&(s=0),Md(t,Ed(e)+i),Rd(t,Ad(e)-s),t};var Fd=function(t,e,i,s,r){return Bd[i](t,e,s,r)},Id=function(t,e,i,s,r,n){gd.setPosition(e,i).setSize(s,r),Fd(t,gd,n)};const jd=Phaser.Utils.Objects.GetValue,zd=Phaser.GameObjects.Group;var Nd=function(t,e,i){return t.add.text(0,0,"")},Gd=void 0;const Wd=nl.prototype.add;var Vd=function(t){return Wd.call(this,t),this.sizerEventsEnable&&(t.emit("sizer.add",t,this),this.emit("add",t,this)),this},Yd={addBackground(t,e,i){return void 0===this.backgroundChildren&&(this.backgroundChildren=[]),"string"==typeof e&&(i=e,e=void 0),void 0===e&&(e=0),Vd.call(this,t),this.backgroundChildren.push(t),this.getSizerConfig(t).padding=Sl(e),void 0!==i&&this.addChildrenMap(i,t),this},isBackground(t){return void 0!==this.backgroundChildren&&-1!==this.backgroundChildren.indexOf(t)}},Xd=function(t,e){var i=null;if(void 0===e)t.hasOwnProperty("rexContainer")&&((i=t.rexContainer.parent)?i.isRexSizer||(i=Xd(i)):i=null);else for(i=Xd(t);i&&i.name!==e;)i=Xd(i);return i},Hd={getParentSizer(t,e){return"string"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),Xd(t,e)},getTopmostSizer(t){return void 0===t&&(t=this),function(t){for(var e=Xd(t);e;)t=e,e=Xd(e);return t}(t)},hasParentSizer(t,e){void 0===e&&(e=this);for(var i=Xd(e);i;){if(i===t)return!0;i=Xd(i)}return!1},hasChild(t,e){return void 0===e&&(e=this),this.hasParentSizer(e,t)}};const $d=Phaser.Utils.Array.Remove,Ud=nl.prototype.remove,Kd=Hd.getParentSizer;var qd=function(t,e){for(var i=Kd(t);i;)i.removeChildCallback&&i.removeChildCallback(t,e),i=Kd(i);return this.isBackground(t)&&$d(this.backgroundChildren,t),Ud.call(this,t,e),!e&&this.sizerEventsEnable&&(t.emit("sizer.remove",t,this),this.emit("remove",t,this)),this};const Jd=Phaser.Utils.Array.Remove,Zd=Hd.getParentSizer;var Qd={removeFromParentSizer(){var t=Zd(gameObject);return t&&t.remove(this),this},removeBackground(t,e){return void 0===this.backgroundChildren||this.getParentSizer(t)!==this||(Jd(this.backgroundChildren,t),qd.call(this,t,e)),this},removeAllBackgrounds(t){if(void 0===this.backgroundChildren)return this;for(var e=this.backgroundChildren.length-1;e>=0;e--)this.remove(this.backgroundChildren[e],t);return this}},tp=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 ep=/(\S+)\[(\d+)\]/i;const ip=Phaser.Utils.Objects.GetValue;var sp=function(t,e){return void 0===e?t:t[e]},rp=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=ip(e,"left",0),t.right=ip(e,"right",0),t.top=ip(e,"top",0),t.bottom=ip(e,"bottom",0)),t},np={getInnerPadding(t){return sp(this.space,t)},setInnerPadding(t,e){return rp(this.space,t,e),this},getOuterPadding(t){return sp(this.getSizerConfig(this).padding,t)},setOuterPadding(t,e){return rp(this.getSizerConfig(this).padding,t,e),this},getChildOuterPadding(t,e){return"string"==typeof t&&(t=this.getElement(t)),sp(this.getSizerConfig(t).padding,e)},setChildOuterPadding(t,e,i){return"string"==typeof t&&(t=this.getElement(t)),rp(this.getSizerConfig(t).padding,e,i),this}},ap=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}},op=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},hp=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},lp=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}},up=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},cp=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},dp={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}},pp=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 xg={delayCall(t,e,i){return this.delayCallTimer=function(t,e,i,s,r){var n=Rn(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}},kg={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}},Cg={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}},Sg={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}},wg={};Object.assign(wg,xg,kg,Cg,Sg);const Tg=Phaser.Utils.Objects.GetValue;class Pg extends zn{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 bg(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(Pg.prototype,wg);const _g=Phaser.GameObjects.Rectangle;class Og extends _g{constructor(t,e,i){super(t,0,0,2,2,e,1),this.fullWindow=new Xo(this),this.setAlpha(i)}get tint(){return this.fillColor}set tint(t){this.setFillStyle(t,this.fillAlpha)}}const Eg=Phaser.Utils.Objects.GetValue;class Mg extends zn{constructor(t,e){super(t,{eventEmitter:!1}),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setHitAreaMode(Eg(t,"hitAreaMode",0)),this.setEnable(Eg(t,"enable",!0)),this.setStopMode(Eg(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=Dg[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 Dg={default:0,fullWindow:1};const Lg=Phaser.Utils.Objects.GetValue;class Ag extends Og{constructor(t,e){super(t,Lg(e,"color",0),Lg(e,"alpha",.8)),this.touchEventStop=new Mg(this,{hitAreaMode:1})}}var Rg={popUp(t,e){void 0!==t._modalScaleSave?(t.scaleX=t._modalScaleSave,t.scaleY=t._modalScaleSave):t._modalScaleSave=t.scaleX,Op(t,e)},scaleDown(t,e){Ep(t,e,void 0,void 0,!1)},fadeIn(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Gp(t,e)},fadeOut(t,e){Wp(t,e,!1)}},Bg=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Gp(t,e,t.alpha)},Fg=function(t,e){Wp(t,e,!1)},Ig=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 jg=Phaser.Utils.Objects.GetValue;let zg=class extends Pg{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=Ng.popUp),null==e.transitOut&&(e.transitOut=Ng.scaleDown),e.destroy=jg(e,"destroy",!0),super(t,e);var i=jg(e,"cover");this.cover=!1!==i?function(t,e){var i=t.scene,s=new Ag(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(jg(i,"transitIn",Bg)),this.setCoverTransitOutCallback(jg(i,"transitOut",Fg)));var s=jg(e,"touchOutsideClose",!1),r=jg(e,"duration.hold",-1),n=jg(e,"timeOutClose",r>=0),a=jg(e,"anyTouchClose",!1);jg(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),jg(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&&Ig(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=Ng[t]),t){case Ng.popUp:t=Rg.popUp;break;case Ng.fadeIn:t=Rg.fadeIn}return super.setTransitInCallback(t),this}setTransitOutCallback(t){switch("string"==typeof t&&(t=Ng[t]),t){case Ng.scaleDown:t=Rg.scaleDown;break;case Ng.fadeOut:t=Rg.fadeOut}return super.setTransitOutCallback(t),this}setCoverTransitInCallback(t){return this.coverTransitInCallback=t,this}setCoverTransitOutCallback(t){return this.coverTransitOutCallback=t,this}};const Ng={popUp:0,fadeIn:1,scaleDown:0,fadeOut:1};var Gg=function(t){return t&&"function"==typeof t},Wg={modal(t,e){return Gg(t)&&(e=t,t=void 0),void 0===this._modalBehavior&&(this.onCreateModalBehavior&&this.onCreateModalBehavior(this,t),this._modalBehavior=function(t,e){var i=new zg(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){Gg(e)&&(r=s,s=i,i=e,e=this);var n=this.scene.events;return this.bindEvent(e,n,t,i,s,r),this},Yg={bindEvent(t,e,i,s,r,n){return"string"==typeof e&&(n=r,r=s,s=i,i=e,e=t,t=this),yo(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}},Xg=function(t,e,i){var s=t.camera;return s?(void 0===i?i={}:!0===i&&(i=Hg),s===e?(i.x=t.worldX,i.y=t.worldY):s.getWorldPoint(t.x,t.y,i),i):null},Hg={},$g=function(t,e,i,s){var r,n=t.scene.sys.cameras.main,a=0===t.scrollFactorX&&0===t.scrollFactorY;if(e)return a?Ig(t,e.x,e.y,i,s):!!(r=Xg(e,n,!0))&&Ig(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 af={press:0,pointerdown:0,release:1,pointerup:1};var of={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 nf(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}},hf=function(t,e,i,s,r){if(e)return!(i&&!i(t,e))&&(!!lf(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 uf.length=0,!0;return uf.length=0,!1},uf=[];const cf=Phaser.Utils.Objects.GetValue;class df extends zn{constructor(t,e){super(t,e),this._enable=void 0;var i=cf(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(cf(t,"enable",!0)),this.setMode(cf(t,"mode",1)),this.setClickInterval(cf(t,"clickInterval",100)),this.setDragThreshold(cf(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=pf[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?hf:$g)(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 pf={press:0,pointerdown:0,release:1,pointerup:1};var gf={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 df(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 ff extends yg{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 vf=Phaser.Utils.Objects.GetValue;class mf extends zn{constructor(t,e){super(t,e),this._enable=void 0,this.cooldown=new ff,this.parent.setInteractive(vf(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.prevIsInTouch=!1,this.isInTouching=!1,this.setEnable(vf(t,"enable",!0)),this.setCooldown(vf(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 yf={isPointerInBounds(t){return void 0===t?t=this:"string"==typeof t&&(t=this.getElement(t)),!!t&&$g(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 mf(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 mf(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}},bf={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}},xf=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=Ff,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===If&&this.onDragEnd(),this.pointer=void 0,this.tracerState=Ff,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=jf,this}isPointerInGameObject(t,e,i){var s=this.lastPointer;return!!s&&$g(t,s,e,i)}}const Ff=0,If=1,jf="IDLE",zf=Phaser.Utils.Objects.GetValue,Nf=Phaser.Math.Distance.Between;class Gf extends Bf{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 yg(s))}resetFromJSON(t){super.resetFromJSON(t),this.setHoldTime(zf(t,"time",250)),this.setTapInterval(zf(t,"tapInterval",200)),this.setDragThreshold(zf(t,"threshold",9)),this.setTapOffset(zf(t,"tapOffset",10));var e=zf(t,"taps",void 0);return void 0!==e?this.setTaps(e):(this.setMaxTaps(zf(t,"maxTaps",void 0)),this.setMinTaps(zf(t,"minTaps",void 0))),this}onDragStart(){switch(this.state){case Wf:this.state=Vf;break;case Vf:var t=this.lastPointer;Nf(t.upX,t.upY,t.x,t.y)>this.tapOffset&&(this.state=Yf,this.state=Vf);break;case Yf: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=Yf))}onDrag(){this.state!==Wf&&this.pointer.getDistance()>this.dragThreshold&&(this.state=Wf)}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=Wf);else t-i.upTime>this.tapInterval&&(void 0===this.minTaps||this.tapsCount>=this.minTaps?this.state=Yf:this.state=Wf)}}postUpdate(t,e){this.isRunning&&this.enable&&this.state===Yf&&(this.state=Wf)}get isTapped(){return this.state===Yf}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",Vf="BEGIN",Yf="RECOGNIZED",Xf=Phaser.Utils.Objects.GetValue;class Hf extends Bf{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=$f},eventEmitter:!1};this.setRecongizedStateObject(new yg(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(Xf(t,"threshold",9)),this.setHoldTime(Xf(t,"time",251)),this}onDragStart(){this.state=Uf,0===this.holdTime&&(this.state=Kf)}onDragEnd(){this.state=$f}onDrag(){this.state!==$f&&this.pointer.getDistance()>this.dragThreshold&&(this.state=$f)}preUpdate(t,e){this.isRunning&&this.enable&&(this.state===Uf&&t-this.pointer.downTime>=this.holdTime&&(this.state=Kf))}get isPressed(){return this.state===Kf}setHoldTime(t){return this.holdTime=t,this}setDragThreshold(t){return this.dragThreshold=t,this}}const $f="IDLE",Uf="BEGIN",Kf="RECOGNIZED";Phaser.Utils.Objects.GetValue;var qf=function(t){return In(t).loop.delta};const Jf=Phaser.Math.Distance.Between,Zf=Phaser.Math.Angle.Between;var Qf={getDt:function(){return qf(this.scene)},getVelocity:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Jf(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 Zf(e.x,e.y,t.x,t.y)}},tv={"up&down":0,"left&right":1,"4dir":2,"8dir":3},ev={};const iv=Phaser.Utils.Objects.GetValue,sv=Phaser.Math.RadToDeg;class rv extends Bf{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=nv},eventEmitter:!1};this.setRecongizedStateObject(new yg(s)),this.clearDirectionStates()}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(iv(t,"threshold",10)),this.setVelocityThreshold(iv(t,"velocityThreshold",1e3)),this.setDirectionMode(iv(t,"dir","8dir")),this}onDragStart(){this.state=av}onDragEnd(){this.state=nv}onDrag(){this.state===av&&(this.validDrag||(this.validDrag=0===this.dragThreshold||this.pointer.getDistance()>=this.dragThreshold),this.validDrag&&this.dragVelocity>this.velocityThreshold&&(this.state=ov))}postUpdate(t,e){this.isRunning&&this.enable&&this.state===ov&&(this.state=nv)}get isSwiped(){return this.state===ov}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=tv[t]),this.dirMode=t,this}updateDirectionStates(){return function(t,e,i){switch(void 0===i?i={}:!0===i&&(i=ev),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}}(sv(this.getVelocityAngle()),this.dirMode,this),this}clearDirectionStates(){return this.left=!1,this.right=!1,this.up=!1,this.down=!1,this}}Object.assign(rv.prototype,Qf);const nv="IDLE",av="BEGIN",ov="RECOGNIZED",hv=Phaser.Utils.Objects.GetValue,lv=Phaser.Utils.Array.SpliceOne,uv=Phaser.Math.Distance.Between,cv=Phaser.Math.Angle.Between;class dv{constructor(t,e){var i=Rn(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(hv(e,"inputConfig",void 0)),this.setEventEmitter(hv(e,"eventEmitter",void 0)),this._enable=void 0,this.pointers=[],this.movedState={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setEnable(hv(t,"enable",!0)),this.bounds=hv(t,"bounds",void 0),this.tracerState=gv,this.pointers.length=0,uo(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,uo(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 gv:this.tracerState=fv,this.onDrag1Start();break;case fv:this.tracerState=vv,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],lv(this.pointers,e),this.tracerState){case fv:this.tracerState=gv,this.onDrag1End();break;case vv:this.tracerState=fv,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 fv:this.onDrag1();break;case vv:this.onDrag2()}}}dragCancel(){return this.tracerState===vv&&this.onDrag2End(),this.pointers.length=0,uo(this.movedState),this.tracerState=gv,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!==vv)return 0;var t=this.pointers[0],e=this.pointers[1];return uv(t.x,t.y,e.x,e.y)}get angleBetween(){if(this.tracerState!==vv)return 0;var t=this.pointers[0],e=this.pointers[1];return cv(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;pv.x=e.x-i.x,pv.y=e.y-i.y}else pv.x=0,pv.y=0;return pv}get centerX(){if(this.tracerState!==vv)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.x+e.x)/2}get centerY(){if(this.tracerState!==vv)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.y+e.y)/2}get prevCenterX(){if(this.tracerState!==vv)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!==vv)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=mv,this}isPointer0InGameObject(t,e,i){var s=this.pointers[0];return!!s&&$g(t,s,e,i)}isPointer1InGameObject(t,e,i){var s=this.pointers[1];return!!s&&$g(t,s,e,i)}}Object.assign(dv.prototype,ur);var pv={};const gv=0,fv=1,vv=2,mv="IDLE";Phaser.Utils.Objects.GetValue;const yv=Phaser.Math.RotateAround;var bv=function(t,e,i,s){return yv(t,e,i,s),t.rotation+=s,t},xv={};const kv=Phaser.Utils.Objects.GetValue,Cv=Phaser.Math.Angle.WrapDegrees,Sv=Phaser.Math.Angle.ShortestBetween,wv=Phaser.Math.RadToDeg,Tv=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=xv),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=Cv(wv(this.angleBetween));this.angle=Sv(this.prevAngle,t),this.prevAngle=t,this.state=Ev}break;case Ev:t=Cv(wv(this.angleBetween));this.angle=Sv(this.prevAngle,t),this.prevAngle=t,this.emit("rotate",this)}}get isRotated(){return this.state===Ev}get rotation(){return Tv(this.angle)}setDragThreshold(t){return this.dragThreshold=t,this}}.prototype,Pv);const _v="IDLE",Ov="BEGIN",Ev="RECOGNIZED",Mv=Phaser.Utils.Objects.GetValue;var Dv=function(t){var e=Mv(t,"tap",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._tap=new Gf(this,e),this._tap.on("tap",(function(t,e,s){kf(i.eventEmitter,`${i.eventNamePrefix}${t.tapsCount}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Lv=Phaser.Utils.Objects.GetValue;var Av=function(t){var e=Lv(t,"press",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._press=new Hf(this,e),this._press.on("pressstart",(function(t,e,s){kf(i.eventEmitter,`${i.eventNamePrefix}pressstart`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this).on("pressend",(function(t,e,s){kf(i.eventEmitter,`${i.eventNamePrefix}pressend`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Rv=Phaser.Utils.Objects.GetValue;var Bv=function(t){var e=Rv(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 rv(this,e),this._swipe.on("swipe",(function(t,e,s){var r=t.left?"left":t.right?"right":t.up?"up":"down";kf(i.eventEmitter,`${i.eventNamePrefix}swipe${r}`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Fv=Phaser.Utils.Objects.GetValue;var Iv=function(t,e){return t.setInteractive(),Fv(e,"dropZone",!1)&&(t.input.dropZone=!0),t._childrenInteractive={targetSizers:Fv(e,"targets",[t]),targetMode:Fv(e,"targetMode","parent"),eventEmitter:Fv(e,"eventEmitter",t),eventNamePrefix:Fv(e,"inputEventPrefix","child.")},Sf.call(t,e),Pf.call(t,e),Ef.call(t,e),Af.call(t,e),Dv.call(t,e),Av.call(t,e),Bv.call(t,e),t},jv={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=ln(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",Nd),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)}}for(var u,c,d=this.getAllShownChildren([this]),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 $v=Phaser.Utils.Objects.IsPlainObject,Uv=Phaser.Utils.Objects.GetValue,Kv=Phaser.Display.Align.CENTER,qv={min:0,full:-1};var Jv=function(t,e,i,s,r,n,a,o,h,l){Vd.call(this,t);var u=t.isRexSpace,c=typeof e;if(null===e)return this;if("number"===c);else if("string"===c)e=qv[e];else if($v(e)){var d;e=Uv(d=e,"proportion",void 0),i=Uv(d,"align",Kv),s=Uv(d,"padding",0),r=Uv(d,"expand",!1),n=Uv(d,"key",void 0),a=Uv(d,"index",void 0),t.isRexSizer||(o=Uv(d,"minWidth",void 0),h=Uv(d,"minHeight",void 0)),l=Uv(d,"fitRatio",0)}return"string"==typeof i&&(i=dd[i]),void 0===e&&(e=u?1:0),void 0===i&&(i=Kv),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===o&&(u?o=0:t.isRexSizer||(o=t._minWidth)),void 0===h&&(u?h=0:t.isRexSizer||(h=t._minHeight)),void 0===l||!1===l?l=0:!0===l&&(l=zr(t)/Nr(t)),(d=this.getSizerConfig(t)).proportion=e,d.align=i,d.padding=Sl(s),d.expand=r,d.fitRatio=0===e?l:0,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},Zv={add:Jv,addSpace(t){return this.insertSpace(void 0,t),this},insertSpace(t,e){return void 0===e&&(e=1),Jv.call(this,new Xv(this.scene),{proportion:e,minWidth:0,minHeight:0,index:t}),this},insert(t,e,i,s,r,n,a,o){return $v(i)&&(i.index=t),Jv.call(this,e,i,s,r,n,a,t,o),this},insertAtPosition(t,e,i,s,r,n,a,o,h){var l=Hv.call(this,t,e);return-1===l&&(l=void 0),this.insert(l,i,s,r,n,a,o,h),this}};const Qv=nl.prototype.clear;var tm=function(t){this.backgroundChildren&&(this.backgroundChildren.length=0);var e,i=!t&&this.sizerEventsEnable;if(i&&(e=this.getChildren([])),Qv.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,tm.call(this,t),this}},sm={getChildAlign(t){return this.getSizerConfig(t).align},setChildAlign(t,e){return"string"==typeof e&&(e=dd[e]),this.getSizerConfig(t).align=e,this}},rm={getChildProportion(t){return this.getSizerConfig(t).proportion},setChildProportion(t,e){return this.getSizerConfig(t).proportion=e,this}},nm={getChildExpand(t){return this.getSizerConfig(t).expand},setChildExpand(t,e){return this.getSizerConfig(t).expand=e,this}},am={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}},om={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&&(vp(t,0,0),e.resolved=!1,this.hasRatioFitChild=!0);return this._childrenProportion=void 0,this.hasProportion0Child=!1,this.proportionLength=void 0,pp.call(this),this},layoutChildren:function(){for(var t,e,i,s,r,n,a,o,h,l,u=this.sizerChildren,c=this.innerLeft,d=this.innerTop,p=this.innerWidth,g=this.innerHeight,f=c,v=d,m=this.startChildIndex,y=0,b=u.length;y0?(e=t-this.getChildrenWidth(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},resolveHeight:function(t){if(void 0!==(t=lp.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)||op.call(this)},runWidthWrap:function(t){this.wrapResult||(1===this.orientation&&Vv.call(this,t,void 0),hp.call(this,t))},hasHeightWrap:function(){return!(!this.hasRatioFitChild||0!==this.orientation)||up.call(this)},runHeightWrap:function(t){this.wrapResult||(0===this.orientation&&Vv.call(this,void 0,t),cp.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(om,Zv,im,sm,rm,nm,am);var hm=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},lm={x:0,h:0,horizontal:0,"left-to-right":0,y:1,v:1,vertical:1,"top-to-bottom":1},um=function(t){return"string"==typeof t&&(t=lm[t]),t};const cm=Phaser.Utils.Objects.IsPlainObject,dm=Phaser.Utils.Objects.GetValue;class pm extends Nv{constructor(t,e,i,s,r,n,a){cm(e)?(e=dm(a=e,"x",0),i=dm(a,"y",0),s=dm(a,"width",void 0),r=dm(a,"height",void 0),n=dm(a,"orientation",0)):cm(s)?(s=dm(a=s,"width",void 0),r=dm(a,"height",void 0),n=dm(a,"orientation",0)):cm(n)&&(n=dm(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(dm(a,"space.item",0)),this.setStartChildIndex(dm(a,"startChildIndex",0)),this.setRTL(dm(a,"rtl",!1)),this.addChildrenMap("items",this.sizerChildren)}setOrientation(t){return this.orientation=um(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=hm.call(this)),this._childrenProportion}}Object.assign(pm.prototype,om);var gm=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}},fm=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},vm={appendText:fm,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 mm extends pm{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&&(gm(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&&(gm(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&&gm(t,this.iconWidth,this.iconHeight);var e=this.childrenMap.action;e&&void 0!==this.actionWidth&&void 0!==this.actionHeight&&gm(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(mm.prototype,vm);var ym=function(t,e,i,s){var r=new Pl(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 bm=Phaser.Utils.Objects.GetValue;const xm=Phaser.Utils.Objects.GetValue;var km=/^[\x00-\x7F]+$/,Cm=function(t){return km.test(t)},Sm=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,Pm=1,_m=2,Om=0,Em=1,Mm=2,Dm=/(?:\r\n|\r|\n)/;const Lm={none:Om,word:Em,char:Mm,character:Mm,mix:3};var Am=function(t,e){switch(Gc(t)){case 0:switch("string"==typeof e&&(e=Lm[e]||0),t.style.wrapMode=e,e){case 2:case 3:t.style.wordWrapCallback=Sm;break;default:t.style.wordWrapCallback=null}break;case 1:"string"==typeof e&&(e=Lm[e]||0),t.style.wrapMode=e}};const Rm=Phaser.Renderer.WebGL.Utils;var Bm={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=Rm.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 Fm=Phaser.Display.Color;var Im={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 Fm);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}},jm=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)},zm={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,jm(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}};eh();const Nm=Phaser.Display.Canvas.CanvasPool,Gm=Phaser.GameObjects.GameObject,Wm=Phaser.Utils.String.UUID;let Vm=class extends Gm{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=Nm.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(){Nm.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 Ym=Phaser.GameObjects.Components;Phaser.Class.mixin(Vm,[Ym.Alpha,Ym.BlendMode,Ym.Crop,Ym.Depth,Ym.Flip,Ym.GetBounds,Ym.Mask,Ym.Origin,Ym.Pipeline,Ym.PostPipeline,Ym.ScrollFactor,Ym.Tint,Ym.Transform,Ym.Visible,Bm,Im,zm]);let Xm=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(Xm.prototype,Zl);var Hm={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 $m=Phaser.Math.RotateAround;var Um;const Km=Phaser.Geom.Rectangle;var qm,Jm=function(t){void 0===qm&&(qm=new Km);var e=t.drawTLX,i=t.drawTLY;return qm.setTo(e,i,t.drawTRX-e,t.drawBLY-i),qm};const Zm=Phaser.Math.RotateAround;var Qm,ty=function(t,e,i,s){return void 0===s?s={}:!0===s&&(void 0===Qm&&(Qm={}),s=Qm),s.x=e,s.y=i,0!==t.rotation&&Zm(s,0,0,t.rotation),s.x=s.x*t.scaleX+t.drawX,s.y=s.y*t.scaleY+t.drawY,s};const ey=Phaser.GameObjects.Components.TransformMatrix;var iy,sy,ry={},ny=function(t,e,i,s,r){var n=ty(e,i,s,!0),a=function(t,e,i,s){void 0===s?s={}:!0===s&&(s=ry);var r=e-t.width*t.originX,n=i-t.height*t.originY;return void 0===iy&&(iy=new ey,sy=new ey),t.parentContainer?t.getWorldTransformMatrix(iy,sy):iy.applyITRS(t.x,t.y,t.rotation,t.scaleX,t.scaleY),iy.transformPoint(r,n,s),s}(t,n.x,n.y,r);return a},ay=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 ny(t,e,n,a,r)},oy={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===Um&&(Um={}),s=Um),s.x=(t-i.drawX)/i.scaleX,s.y=(e-i.drawY)/i.scaleY,0!==i.rotation&&$m(s,0,0,-i.rotation),s}(t,e,this,!0);return Jm(this).contains(i.x,i.y)},getWorldPosition:function(t,e,i){return ay(this.parent,this,t,e,i)}};Object.assign(oy,Hm);const hy=Phaser.Math.DegToRad,ly=Phaser.Math.RadToDeg,uy=Phaser.Utils.Objects.GetValue;class cy extends Xm{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 ly(this._rotation)}set angle(t){this.rotation=hy(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=uy(t,"width",void 0),i=uy(t,"height",void 0),s=uy(t,"scaleX",void 0),r=uy(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(cy.prototype,oy);const dy=Phaser.Utils.String.Pad;var py=function(t,e,i){if(null==t)return t;switch(typeof t){case"string":default:return t;case"number":return`#${dy(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}},gy=function(t,e,i){return e.hasOwnProperty(t)?e[t]:i[t]};const fy=Phaser.Utils.Objects.GetValue;let vy=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=fy(t,"x",0),i=fy(t,"y",0));var s=this.cornerRadius;s.tl=my(fy(t,"tl",void 0),e,i),s.tr=my(fy(t,"tr",void 0),e,i),s.bl=my(fy(t,"bl",void 0),e,i),s.br=my(fy(t,"br",void 0),e,i)}get radiusTL(){var t=this.cornerRadius.tl;return Math.max(t.x,t.y)}set radiusTL(t){yy(this.cornerRadius.tl,t)}get radiusTR(){var t=this.cornerRadius.tr;return Math.max(t.x,t.y)}set radiusTR(t){yy(this.cornerRadius.tr,t)}get radiusBL(){var t=this.cornerRadius.bl;return Math.max(t.x,t.y)}set radiusBL(t){yy(this.cornerRadius.bl,t)}get radiusBR(){var t=this.cornerRadius.br;return Math.max(t.x,t.y)}set radiusBR(t){yy(this.cornerRadius.br,t)}};var my=function(t,e,i){return void 0===t?t={x:e,y:i}:"number"==typeof t&&(t={x:t,y:t}),by(t),t},yy=function(t,e){"number"==typeof e?(t.x=e,t.y=e):(t.x=fy(e,"x",0),t.y=fy(e,"y",0)),by(t)},by=function(t){t.convex=t.x>=0||t.y>=0,t.x=Math.abs(t.x),t.y=Math.abs(t.y)};const xy=Phaser.Math.DegToRad;var ky=function(t){return!t.hasOwnProperty("convex")||t.convex},Cy=function(t){return t.x>0&&t.y>0},Sy=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,Cy(o)?(h=o.x*f,l=o.y*v,ky(o)?Sy(t,h,l,h,l,180,270,!1,a):Sy(t,0,0,h,l,90,0,!0,a),u=0,c=l):(t.lineTo(0,0),u=0,c=0),o=m.tr,Cy(o)?(h=o.x*f,l=o.y*v,ky(o)?Sy(t,s-h,l,h,l,270,360,!1,a):Sy(t,s,0,h,l,180,90,!0,a)):t.lineTo(s,0),o=m.br,Cy(o)?(h=o.x*f,l=o.y*v,ky(o)?Sy(t,s-h,r-l,h,l,0,90,!1,a):Sy(t,s,r,h,l,270,180,!0,a)):t.lineTo(s,r),o=m.bl,Cy(o)?(h=o.x*f,l=o.y*v,ky(o)?Sy(t,h,r-l,h,l,90,180,!1,a):Sy(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),wy(t.canvas,t.context,u,u,h,l,r,e,i,s,n,a,o)}};const Py=Phaser.Utils.Objects.GetValue;class _y extends cy{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=py(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=py(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=py(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,gy("color2",t,this),gy("horizontalGradient",t,this)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,gy("strokeThickness",t,this)),t.hasOwnProperty("cornerRadius")&&this.setCornerRadius(t.cornerRadius,gy("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 Oy=Phaser.Utils.Objects.GetValue;class Ey extends cy{constructor(t,e){super(t,"innerbounds"),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))}set color(t){t=py(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=py(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=py(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,Oy(t,"color2",null),Oy(t,"horizontalGradient",!0)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,Oy(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 My=Phaser.Utils.Objects.GetValue;let Dy=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(My(t,"bold",!1)),this.setItalic(My(t,"italic",!1)),this.setFontSize(My(t,"fontSize","16px")),this.setFontFamily(My(t,"fontFamily","Courier")),this.setColor(My(t,"color","#fff")),this.setStrokeStyle(My(t,"stroke",null),My(t,"strokeThickness",0)),this.setShadow(My(t,"shadowColor",null),My(t,"shadowOffsetX",0),My(t,"shadowOffsetY",0),My(t,"shadowBlur",0)),this.setOffset(My(t,"offsetX",0),My(t,"offsetY",0)),this.setSpace(My(t,"leftSpace",0),My(t,"rightSpace",0)),this.setAlign(My(t,"align",void 0)),this.setBackgroundColor(My(t,"backgroundColor",null)),this.setBackgroundHeight(My(t,"backgroundHeight",void 0)),this.setBackgroundBottomY(My(t,"backgroundBottomY",void 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(gy("stroke",t,this),gy("strokeThickness",t,this)),t.hasOwnProperty("shadowColor")&&this.setShadowColor(t.shadowColor),(t.hasOwnProperty("shadowOffsetX")||t.hasOwnProperty("shadowOffsetY"))&&this.setShadowOffset(gy("shadowOffsetX",t,this),gy("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),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=py(t),this}get hasFill(){return null!=this.color}setStrokeStyle(t,e){return this.stroke=py(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=py(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=py(t),this}get hasBackgroundColor(){return null!=this.backgroundColor}setBackgroundHeight(t){return this.backgroundHeight=t,this}setBackgroundBottomY(t){return this.backgroundBottomY=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 Ly=Phaser.Utils.Array.Remove;const Ay=Phaser.Utils.Array.Remove;const Ry="text",By="image",Fy="drawer",Iy="space",jy="command";var zy=function(t){return t.type===Ry&&"\n"===t.text},Ny=function(t){return t.type===Ry&&"\f"===t.text},Gy=function(t){return t.type===Ry};class Wy extends cy{constructor(t,e,i){super(t,Ry),this.updateTextFlag=!1,this.style=new Dy(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,s=this.drawTRX-i+1,r=e.backgroundBottomY;null==r&&(r=this.drawBLY);var n=e.backgroundHeight;null==n&&(n=r-this.drawTLY);var a=r-n;t.fillRect(i,a,s,n)}var o=e.hasFill,h=e.hasStroke;(o||h)&&(e.syncFont(t).syncStyle(t),h&&(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 Vy=function(t,e){var i=this.createCharChildren(t,e);return this.addChild(i),this};const Yy=Phaser.Display.Canvas.CanvasPool;var Xy=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=Yy.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),Yy.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 Hy extends cy{constructor(t,e,i){super(t,By),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(){Xy(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 $y extends cy{constructor(t,e,i,s){super(t,Fy),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 Uy extends cy{constructor(t,e){super(t,Iy),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 Ky extends Xm{constructor(t,e,i,s,r){super(t,jy),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 Jy={none:0,word:1,char:2,character:2,mix:3};var Zy=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=ib.call(this)).height,a=l.ascent,i=Math.floor((h-a)/n)}else{var l;n=(l=ib.call(this)).height,a=l.ascent}}else if(this.fixedHeight>0){if(void 0===(i=rb(t,"maxLines"))){h=this.fixedHeight-s;i=Math.floor(h/n)}}else i=rb(t,"maxLines",0);void 0===a&&(a=n);var u=0===i,c=rb(t,"wrapMode");void 0===c&&(c=rb(t,"charWrap",!1)?"char":"word");"string"==typeof c&&(c=Jy[c]);var d=rb(t,"wrapWidth",void 0);void 0===d&&(this.fixedWidth>0?d=this.fixedWidth-r:(d=1/0,c=0));for(var p=rb(t,"letterSpacing",0),g=rb(t,"hAlign",0),f=rb(t,"vAlign",0),v=rb(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&&(E.push({children:M,width:D}),L=Math.max(L,D)),m.start+=O.length,m.isLastPage=!A&&m.start===_,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=ob(t,"maxLines",void 0))){var a=this.fixedWidth-r;i=Math.floor(a/n)+1}}else i=ob(t,"maxLines",0);var o=0===i,h=ob(t,"fixedCharacterHeight",void 0);if(void 0===h){var l=ob(t,"charPerLine",void 0);if(void 0!==l){var u=this.fixedHeight-s;h=Math.floor(u/l)}}var c=ob(t,"wrapHeight",void 0);void 0===c&&(c=this.fixedHeight>0?this.fixedHeight-s:1/0);for(var d=ob(t,"letterSpacing",0),p=ob(t,"rtl",!0),g=ob(t,"hAlign",p?2:0),f=ob(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:E,height:M}),D=Math.max(D,M)),v.start+=_.length,v.isLastPage=v.start===P,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 rp(i,t,e),this.dirty=this.dirty||s!=i.left||r!=i.right||n!=i.top||a!=i.bottom,this},getPadding:function(t){return sp(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),Ly(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 Ay(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(Ry);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)),ay(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=Gb(t,r,e,i,n),o=0;o<=jb&&0!==a;o++){if((r+=a)<0){r=0;break}a=Gb(t,r,e,i,n)}return o===jb&&console.warn("FontSizeFit: Test count exceeds 65535"),t.setFontSize(r),Wb(t,e,i),t},Nb=function(t,e,i){return void 0===i[e]&&(t.setFontSize(e),i[e]={width:t.width,height:t.height}),i[e]},Gb=function(t,e,i,s,r){var n,a=Nb(t,e,r),o=Nb(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 Vb=Phaser.Utils.Objects.GetValue;var Yb=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 zb(t,e,i),t}):(t.runWidthWrap=function(e){return t.setFixedSize&&t.setFixedSize(0,0),zb(t,e,void 0),t},t.resize=function(e,i){return t.width===e&&t.height===i||t.setFixedSize(e,i),t}),t};const Xb=Phaser.Utils.Objects.GetValue,Hb=[function(t){var e=this.scene,i=bm(t,"orientation",0);this.setOrientation(i);var s=bm(t,"icon",void 0),r=bm(t,"iconMask",void 0),n=bm(t,"innerBackground",void 0),a=bm(t,"title",void 0),o=bm(t,"separator",void 0),h=bm(t,"text",void 0),l=bm(t,"action",void 0),u=bm(t,"actionMask",void 0);if(s){var c=bm(t,"align.icon","center");m=0===this.orientation?{right:bm(t,"space.icon",0),top:bm(t,"space.iconTop",0),bottom:bm(t,"space.iconBottom",0),left:bm(t,"space.iconLeft",0)}:{bottom:bm(t,"space.icon",0),left:bm(t,"space.iconLeft",0),right:bm(t,"space.iconRight",0),top:bm(t,"space.iconTop",0)};var d=bm(t,"squareFitIcon",!1)?1:0;if(this.add(s,{proportion:0,align:c,padding:m,fitRatio:d}),r&&(r=ym.call(this,s,s,1)),!d){var p=bm(t,"iconSize",void 0);this.setIconSize(bm(t,"iconWidth",p),bm(t,"iconHeight",p))}}var g=new pm(e,{orientation:1});n&&g.addBackground(n);var f=bm(t,"space.separator",0);if(a){c=bm(t,"align.title","left");var v=bm(t,"expandTitleWidth",!1);y=bm(t,"expandTitleHeight",!1)?1:0,b=v,m={bottom:!o&&h?bm(t,"space.title",f):0,left:bm(t,"space.titleLeft",0),right:bm(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:bm(t,"space.separatorLeft",0),right:bm(t,"space.separatorRight",0)};g.add(o,{expand:!0,padding:m})}if(h){c=bm(t,"align.text","left");var y,b,x=bm(t,"expandTextWidth",!1);y=bm(t,"expandTextHeight",!1)?1:0,b=x,m={left:bm(t,"space.textLeft",0),right:bm(t,"space.textRight",0)},g.add(h,{proportion:y,expand:b,align:c,padding:m})}m=void 0;if(l&&(m={right:bm(t,"space.text",0)}),this.add(g,{proportion:1,padding:m}),l){c=bm(t,"align.action","center");m=0===this.orientation?{top:bm(t,"space.actionTop",0),bottom:bm(t,"space.actionBottom",0),right:bm(t,"space.actionRight",0)}:{left:bm(t,"space.actionLeft",0),right:bm(t,"space.actionRight",0),bottom:bm(t,"space.actionBottom",0)};d=bm(t,"squareFitAction",!1)?1:0;if(this.add(l,{proportion:0,align:c,padding:m,fitRatio:d}),u&&(u=ym.call(this,l,l,1)),!d){var k=bm(t,"actionSize");this.setActionSize(bm(t,"actionWidth",k),bm(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=xm(t,"title",void 0),s=xm(t,"separator",void 0),r=xm(t,"innerBackground",void 0),n=xm(t,"icon",void 0),a=xm(t,"iconMask",void 0),o=xm(t,"text",void 0),h=xm(t,"action",void 0),l=xm(t,"actionMask",void 0);if(i){var u=xm(t,"align.title","left"),c=xm(t,"expandTitleWidth",!1);y=xm(t,"expandTitleHeight",!1)?1:0,b=c,p={bottom:xm(t,"space.title",0),left:xm(t,"space.titleLeft",0),right:xm(t,"space.titleRight",0)},this.add(i,{proportion:y,expand:b,align:u,padding:p})}if(s){var d=xm(t,"space.separator",0),p={top:i?d:0,bottom:o?d:0,left:xm(t,"space.separatorLeft",0),right:xm(t,"space.separatorRight",0)};this.add(s,{proportion:0,expand:!0,padding:p})}var g=xm(t,"orientation",0),f=new pm(e,{orientation:g,rtl:xm(t,"rtl",!1),space:{left:xm(t,"space.innerLeft",0),right:xm(t,"space.innerRight",0),top:xm(t,"space.innerTop",0),bottom:xm(t,"space.innerBottom",0)}});if(r&&f.addBackground(r),this.add(f,{proportion:1,expand:!0}),n){u=xm(t,"align.icon","center");p=0===f.orientation?{right:xm(t,"space.icon",0),top:xm(t,"space.iconTop",0),bottom:xm(t,"space.iconBottom",0),left:xm(t,"space.iconLeft",0)}:{bottom:xm(t,"space.icon",0),left:xm(t,"space.iconLeft",0),right:xm(t,"space.iconRight",0),top:xm(t,"space.iconTop",0)};var v=xm(t,"squareFitIcon",!1)?1:0;if(f.add(n,{proportion:0,align:u,padding:p,fitRatio:v}),a&&(a=ym.call(this,n,n,1)),!v){var m=xm(t,"iconSize",void 0);this.setIconSize(xm(t,"iconWidth",m),xm(t,"iconHeight",m))}}if(o){u=xm(t,"align.text","left");var y,b,x=xm(t,"space.text",0),k=xm(t,"expandTextWidth",!1),C=xm(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=xm(t,"align.action","center");p=0===f.orientation?{top:xm(t,"space.actionTop",0),bottom:xm(t,"space.actionBottom",0),right:xm(t,"space.actionRight",0)}:{left:xm(t,"space.actionLeft",0),right:xm(t,"space.actionRight",0),bottom:xm(t,"space.actionBottom",0)};v=xm(t,"squareFitAction",!1)?1:0;if(f.add(h,{proportion:0,align:u,padding:p,fitRatio:v}),l&&(l=ym.call(this,h,h,1)),!v){var S=xm(t,"actionSize");this.setActionSize(xm(t,"actionWidth",S),xm(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 $b extends mm{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexTitleLabel";var i=Xb(e,"background",void 0);i&&this.addBackground(i);var s=Xb(e,"title",void 0),r=Xb(e,"text",void 0);if(s){var n=Xb(e,"wrapTitle",!1),a=Xb(e,"adjustTitleFontSize",!1);n?(!0===n&&(n="word"),Am(s,n),e.expandTitleWidth=!0,Ib(s)):a&&(e.expandTextWidth=!0,e.expandTextHeight=!0,Yb(s,{fitHeight:!0}))}if(r){var o=Xb(e,"wrapText",!1),h=Xb(e,"adjustTextFontSize",!1);o?(!0===o&&(o="word"),Am(r,o),e.expandTextWidth=!0,Ib(r)):h&&(e.expandTextWidth=!0,e.expandTextHeight=!0,Yb(r,{fitHeight:!0}))}var l=Xb(e,"layoutMode",0);(Hb[l]||Hb[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 Ub 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()}}}($b)){constructor(t,e){void 0===e&&(e={}),e.hasOwnProperty("layoutMode")||(e.layoutMode=1),super(t,e)}}const Kb=Phaser.GameObjects.GetCalcMatrix;const qb=Phaser.Renderer.Canvas.SetTransform;var Jb={renderWebGL:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.pipelines.set(e.pipeline),n=Kb(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&&eu(r,a,e,l,o,h),e.isStroked&&su(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(Qb.prototype,Jb);var tx=function(t){return t.x>0&&t.y>0};const ex=Phaser.Utils.Objects.IsPlainObject,ix=Phaser.Utils.Objects.GetValue,sx=Phaser.Geom.Polygon.Earcut;class rx extends Qb{constructor(t,e,i,s,r,n,a,o){var h,l,u,c;if(ex(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 vy;if(super(t,"rexRoundRectangleShape",p),this.setShapeType(c),0===this.shapeType){var g=ix(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(ix(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,tx(i))if(i.convex){var o=i.x,h=i.y;uu(o,h,i.x,i.y,180,270,!1,a,e)}else{uu(o=0,h=0,i.x,i.y,90,0,!0,a,e)}else hu(0,0,e);if(i=n.tr,tx(i))if(i.convex){o=s-i.x,h=i.y;uu(o,h,i.x,i.y,270,360,!1,a,e)}else{uu(o=s,h=0,i.x,i.y,180,90,!0,a,e)}else hu(s,0,e);if(i=n.br,tx(i))if(i.convex){o=s-i.x,h=r-i.y;uu(o,h,i.x,i.y,0,90,!1,a,e)}else{uu(o=s,h=r,i.x,i.y,270,180,!0,a,e)}else hu(s,r,e);if(i=n.bl,tx(i))if(i.convex){o=i.x,h=r-i.y;uu(o,h,i.x,i.y,90,180,!1,a,e)}else{uu(o=0,h=r,i.x,i.y,360,270,!0,a,e)}else hu(0,r,e);return e.push(e[0],e[1]),this.pathIndexes=sx(e),this}setShapeType(t){return"string"==typeof t&&(t=nx[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 nx={rectangle:0,circle:1};var ax=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},ox=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 vx=Phaser.Utils.Objects.GetValue,mx=Phaser.Utils.Objects.IsPlainObject;class yx extends(oc(ql)){constructor(t,e,i,s,r,n,a,o){mx(e)?(e=(o=e).x,i=o.y,s=o.width,r=o.height,n=o.barColor,a=o.value):mx(s)?(s=(o=s).width,r=o.height,n=o.barColor,a=o.value):mx(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 Fu).setName("trackFill")).addShape((new Fu).setName("bar")).addShape((new Fu).setName("trackStroke")),this.setTrackColor(vx(o,"trackColor",void 0)),this.setBarColor(n),this.setTrackStroke(vx(o,"trackStrokeThickness",2),vx(o,"trackStrokeColor",void 0)),this.setSkewX(vx(o,"skewX",0)),this.setRTL(vx(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 bx={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&&fx(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),fx(a,r,0,n,i,t));var o=this.getShape("trackStroke");o.lineStyle(this.trackStrokeThickness,this.trackStrokeColor),o.isStroked&&fx(o,0,0,e,i,t)}};Object.assign(yx.prototype,bx);class xx extends yx{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=kx,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 kx={color:"trackColor",strokeColor:"trackStrokeColor",strokeWidth:"trackStrokeThickness"};Object.assign(xx.prototype,dx);let Cx=class extends zn{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 Sx=Phaser.GameObjects.NineSlice,wx=Phaser.Utils.Objects.GetValue;class Tx extends Sx{constructor(t,e){void 0===e&&(e={}),super(t,wx(e,"x",0),wx(e,"y",0),wx(e,"key",null),wx(e,"frame",null),wx(e,"width",0),wx(e,"height",0),wx(e,"leftWidth",0),wx(e,"rightWidth",0),wx(e,"topHeight",0),wx(e,"bottomHeight",0)),this.type="rexStatesNineSlice";var i=wx(e,"effects",!0);i&&Mr(this,i),this.style=new Cx(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign(Tx.prototype,dx);let Px=class extends zn{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 _x=Phaser.GameObjects.Image,Ox=Phaser.Utils.Objects.GetValue;class Ex extends _x{constructor(t,e){void 0===e&&(e={}),super(t,Ox(e,"x",0),Ox(e,"y",0),Ox(e,"key",""),Ox(e,"frame",void 0)),this.type="rexStatesImage";var i=Ox(e,"effects",!0);i&&Mr(this,i),this.style=new Px(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign(Ex.prototype,dx);var Mx=function(t,e,i){return"__BASE"===i?`${t},${e}`:`${i}:${t},${e}`};const Dx=Phaser.Utils.Objects.IsPlainObject,Lx=Phaser.Utils.Objects.GetValue;var Ax=function(t){return"string"==typeof t&&(t=Rx[t]),t};const Rx={scale:0,repeat:1};var Bx=function(t,e){return 0===t||t===this.columns.count-1||0===e||e===this.rows.count-1},Fx={_beginDraw:pd,_drawImage:pd,_drawTileSprite:pd,_endDraw:pd,setGetFrameNameCallback:function(t){return void 0===t&&(t=Mx),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 Dx(t)?(this.stretchMode.edge=Ax(Lx(t,"edge",0)),this.stretchMode.internal=Ax(Lx(t,"internal",0))):(t=Ax(t),this.stretchMode.edge=t,this.stretchMode.internal=t),this},getStretchMode:function(t,e){return Bx.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 Ix=Phaser.Utils.Objects.IsPlainObject,jx=Phaser.Utils.Objects.GetValue;const zx=Phaser.GameObjects;var Nx=void 0,Gx=function(t,e){if(Nx||(Nx={},In(t).events.once("destroy",(function(){for(var t in Nx)Nx[t].destroy();Nx=void 0}))),!Nx.hasOwnProperty(e)){var i=In(t).scene.systemScene;(t=new zx[e](i)).setOrigin(0),Nx[e]=t}return Nx[e]};const Wx=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(Ix(i)?(i=jx(u=i,"x",0),s=jx(u,"y",0),r=jx(u,"width",1),n=jx(u,"height",1),a=jx(u,"key",void 0),o=jx(u,"baseFrame",void 0),h=jx(u,"columns",void 0),l=jx(u,"rows",void 0)):Ix(r)?(r=jx(u=r,"width",1),n=jx(u,"height",1),a=jx(u,"key",void 0),o=jx(u,"baseFrame",void 0),h=jx(u,"columns",void 0),l=jx(u,"rows",void 0)):Ix(a)?(a=jx(u=a,"key",void 0),o=jx(u,"baseFrame",void 0),h=jx(u,"columns",void 0),l=jx(u,"rows",void 0)):Ix(o)?(o=jx(u=o,"baseFrame",void 0),h=jx(u,"columns",void 0),l=jx(u,"rows",void 0)):Array.isArray(o)?(u=l,l=h,h=o,o=jx(u,"baseFrame",void 0)):Ix(h)&&(h=jx(u=h,"columns",void 0),l=jx(u,"rows",void 0)),void 0===o&&(o=jx(u,"frame",void 0)),void 0===h){var c=jx(u,"leftWidth",void 0),d=jx(u,"rightWidth",void 0);void 0!==c&&void 0!==d&&(h=[c,void 0,d])}if(void 0===l){var p=jx(u,"topHeight",void 0),g=jx(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(jx(u,"getFrameNameCallback",void 0)),this.setStretchMode(jx(u,"stretchMode",0)),this.setPreserveRatio(jx(u,"preserveRatio",!0));var f=jx(u,"maxFixedPartScale",1),v=jx(u,"maxFixedPartScaleX",f),m=jx(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,Fx),i}(Wx,"rexNinePatch")){}var Yx={_drawImage:function(t,e,i,s,r,n){var a=Gx(this,"Image").setTexture(t,e).setDisplaySize(r,n);this.draw(a,i,s)},_drawTileSprite:function(t,e,i,s,r,n){var a=Gx(this,"TileSprite").setTexture(t,e).setSize(r,n);this.draw(a,i,s)}};Object.assign(Vx.prototype,Yx);let Xx=class extends zn{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 Hx=Phaser.Utils.Objects.GetValue;class $x extends Vx{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexStatesNinePatch";var i=Hx(e,"effects",!0);i&&Mr(this,i),this.style=new Xx(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign($x.prototype,dx);const Ux=["alpha","tint","flipX","flipY"];var Kx=function(t,e){if(!e)return t;for(var i=0,s=Ux.length;i * @copyright 2018 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */const ok=Phaser.Display.Canvas.CanvasPool;var hk=function(t){var e=ok.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 ok.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,ok.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!==Om&&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=Lm[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]=uk(t,l,u);else{var d=lk(t,l,u);c&&(d=c(d)),this[o]=d}}var p=uk(t,"font",null);this._font=null===p?this.fontStyle+" "+this.fontSize+" "+this.fontFamily:p;var g=uk(t,"fill",null);null!==g&&(this.color=py(g));var f=uk(t,"metrics",!1);return f?this.metrics={ascent:uk(f,"ascent",0),descent:uk(f,"descent",0),fontSize:uk(f,"fontSize",0)}:!e&&this.metrics||(this.metrics=hk(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=hk(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=uk(t,"fontFamily","Courier"),this.fontSize=uk(t,"fontSize","16px"),this.fontStyle=uk(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=py(t,this.parent.canvas,this.parent.context),this.backgroundColor2=py(e,this.parent.canvas,this.parent.context),this.backgroundHorizontalGradient=i,this.update(!1)}setBackgroundStrokeColor(t,e){return this.backgroundStrokeColor=py(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=py(t,this.parent.canvas,this.parent.context),this.update(!1)}setColor(t){return this.color=py(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=py(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=py(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=py(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=py(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=py(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=py(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=py(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=Lm[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=uk(e,"fontFamily",this.fontFamily),this.fontSize=uk(e,"fontSize",this.fontSize),this.fontStyle=uk(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 dk={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 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 pk=Phaser.Utils.Objects.GetValue,gk=Tm,fk=Pm;class vk{constructor(t){this.prop={},this.resetFromJSON(t)}resetFromJSON(t){this.text=pk(t,"text",""),this.x=pk(t,"x",0),this.y=pk(t,"y",0),this.width=pk(t,"width",0);var e=pk(t,"prop",null);null===e&&(e={}),this.prop=e,this.newLineMode=pk(t,"newLineMode",0),this.startIndex=pk(t,"startIndex",0)}get plainText(){var t=this.text;return this.newLineMode===fk&&(t+="\n"),t}get wrapText(){var t=this.text;return this.newLineMode!==gk&&(t+="\n"),t}get rawTextLength(){var t=this.text.length;return this.newLineMode===fk&&(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 mk=Phaser.Utils.Objects.GetFastValue,yk=Tm,bk=_m;class xk{constructor(t){this.pens=[],this.lines=[],this.maxLinesWidth=void 0,this.pensPool=t.pensPool,this.linesPool=t.linesPool,this.tagToText=mk(t,"tagToText",pd),this.tagToTextScope=mk(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 kk={};const Ck=Phaser.Geom.Rectangle;var Sk=new Aa;class wk{constructor(){this.hitAreas=[]}destroy(){this.clear()}clear(){for(var t=0,e=this.hitAreas.length;ts&&jk(f)){""!==b?a.push(n.getLine(b,x,Dk)):0===k&&r>0&&a.push(n.getLine("",0,Dk)),a.push(...Fk(f,e,Rk,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,Dk)),b=f,x=v,h=s):(b+=f,x=m),k===C-1&&a.push(n.getLine(b,x,l))}return a},Ik=function(t,e){var i;switch(e){case Ak:i=[];for(var s=0,r=(t=t.split(" ")).length;s0&&e!==Nk&&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 xk({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 UC(this.sizerChildren,null),tm.call(this,t),this}},qC={setColumnSpace(t){if(this.space.column||(this.space.column=[]),this.space.column.length=this.columnCount-1,"number"==typeof t)UC(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},tS={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=lp.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===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,UC(this.sizerChildren,null),this.columnProportions=[],this.columnProportions.length=t,"number"==typeof i)UC(this.columnProportions,i);else for(var n=0;n0?e+=t:0===t&&(this.hasColumnProportion0Child=!0);return e},iS=function(){for(var t,e=0,i=0;i0?e+=t:0===t&&(this.hasRowProportion0Child=!0);return e};const sS=Phaser.Utils.Objects.IsPlainObject,rS=Phaser.Utils.Objects.GetValue;class nS extends Nv{constructor(t,e,i,s,r,n,a,o,h,l){sS(e)?(e=rS(l=e,"x",0),i=rS(l,"y",0),s=rS(l,"width",void 0),r=rS(l,"height",void 0),n=rS(l,"column",l.col||0),a=rS(l,"row",0),o=rS(l,"columnProportions",0),h=rS(l,"rowProportions",0)):sS(s)?(s=rS(l=s,"width",void 0),r=rS(l,"height",void 0),n=rS(l,"column",l.col||0),a=rS(l,"row",0),o=rS(l,"columnProportions",0),h=rS(l,"rowProportions",0)):sS(n)?(n=rS(l=n,"column",l.col||0),a=rS(l,"row",0),o=rS(l,"columnProportions",0),h=rS(l,"rowProportions",0)):sS(o)&&(o=rS(l=o,"columnProportions",0),h=rS(l,"rowProportions",0)),super(t,e,i,s,r,l),this.type="rexGridSizer",this.sizerChildren=[],this.addChildrenMap("items",this.sizerChildren),this.setCreateCellContainerCallback(rS(l,"createCellContainerCallback")),this.setIndentLeft(rS(l,"space.indentLeftOdd",0),rS(l,"space.indentLeftEven",0)),this.setIndentTop(rS(l,"space.indentTopOdd",0),rS(l,"space.indentTopEven",0)),this.resetGrid(n,a,o,h,rS(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=eS.call(this)),this._totalColumnProportions}get totalRowProportions(){return void 0===this._totalRowProportions&&(this._totalRowProportions=iS.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(nS.prototype,tS);const aS=Phaser.Utils.Objects.GetValue;const oS=Phaser.Math.Percent;var hS=function(t,e,i){var s;return t.y===e.y?s=oS(i.x,t.x,e.x):t.x===e.x&&(s=oS(i.y,t.y,e.y)),s},lS=function(t,e,i){var s,r;this.enable&&(uS.x=e,uS.y=i,this.reverseAxis?(s=this.getEndPoint(),r=this.getStartPoint()):(s=this.getStartPoint(),r=this.getEndPoint()),this.value=hS(s,r,uS))},uS={},cS=function(t,e,i){if(this.enable&&t.isDown){var s,r;dS.x=t.worldX,dS.y=t.worldY,this.reverseAxis?(s=this.getEndPoint(),r=this.getStartPoint()):(s=this.getStartPoint(),r=this.getEndPoint());var n=hS(s,r,dS);this.stopEaseValue(),0===this.easeValueDuration||Math.abs(this.value-n)<.1?this.value=n:this.easeValueTo(n)}},dS={},pS=function(t,e){void 0===e&&(e=gS);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},gS={};const fS=Phaser.Display.Align.LEFT_CENTER,vS=Phaser.Display.Align.TOP_CENTER;var mS={};const yS=Phaser.Display.Align.RIGHT_CENTER,bS=Phaser.Display.Align.BOTTOM_CENTER;var xS={};const kS=Phaser.Math.Linear;var CS={};const SS=Phaser.Display.Align.LEFT_CENTER,wS=Phaser.Display.Align.TOP_CENTER,TS=Phaser.Display.Align.RIGHT_CENTER,PS=Phaser.Display.Align.BOTTOM_CENTER;const _S=Phaser.Utils.Objects.GetValue,OS=Phaser.Utils.Objects.IsPlainObject,ES=Phaser.Math.Clamp,MS=Phaser.Math.Snap.To;class DS extends(oc(pm)){constructor(t,e){super(t,e),this.type="rexSlider",this.bootProgressBase(e),this.reverseAxis=_S(e,"reverseAxis",!1);var i=_S(e,"background",void 0),s=_S(e,"track",void 0),r=_S(e,"indicator",void 0),n=_S(e,"thumb",void 0);if(i&&(OS(i)&&(i=qx(t,i)),this.addBackground(i)),s&&(OS(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&&(OS(r)&&(r=qx(t,r)),this.pin(r)),n){OS(n)&&(n=qx(t,n)),this.pin(n);var a=_S(e,"thumbOffsetX",0),o=_S(e,"thumbOffsetY",0);this.setThumbOffset(a,o)}var h=_S(e,"input",0);switch("string"==typeof h&&(h=LS[h]),h){case 0:n&&(n.setInteractive(),this.scene.input.setDraggable(n),n.on("drag",lS,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",cS,this).on("pointermove",cS,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(_S(e,"enable",void 0)),this.setGap(_S(e,"gap",void 0)),this.setValue(_S(e,"value",0),_S(e,"min",void 0),_S(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}setThumbOffset(t,e){return this.thumbOffsetX=t,this.thumbOffsetY=e,this}get value(){return this._value}set value(t){void 0!==this.gap&&(t=MS(t,this.gap));var e=this._value;this._value=ES(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 AS={getStartPoint:function(t){if(void 0===t&&(t=mS),this.childrenMap.thumb){var e=0===this.orientation?fS:vS;pS.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=xS),this.childrenMap.thumb){var e=0===this.orientation?yS:bS;pS.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=CS),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=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;vp(e,i,s),r=n?0===this.orientation?TS:PS:0===this.orientation?SS:wS,Fd(e,this,r),this.resetChildPositionState(e)}};Object.assign(DS.prototype,AS);const RS=Phaser.Utils.Objects.GetValue;class BS extends pm{constructor(t,e){super(t,e),this.type="rexScrollBar";var i,s=RS(e,"background",void 0),r=RS(e,"buttons",void 0),n=RS(r,"top",RS(r,"left",void 0)),a=RS(r,"bottom",RS(r,"right",void 0)),o=RS(e,"slider",void 0);(s&&this.addBackground(s),n)&&(this.add(n),new mf(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===RS(o,"width",void 0)?1:0;else h=void 0===RS(o,"height",void 0)?1:0;i=new DS(t,o),t.add.existing(i),this.add(i,{proportion:h})}a&&(this.add(a),new mf(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=RS(e,"valuechangeCallback",null);if(null!==u){var c=RS(e,"valuechangeCallbackScope",void 0);this.on("valuechange",u,c)}this.setEnable(RS(e,"enable",void 0)),this.setValue(RS(e,"value",0)),this.setScrollStep(RS(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}}class FS extends yg{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 IS=Phaser.Utils.Objects.GetValue,jS=Phaser.Math.Distance.Between;class zS extends zn{constructor(t,e){super(t,e),this._enable=void 0,this.rectBoundsInteractive=IS(e,"rectBoundsInteractive",!1),this.rectBoundsInteractive||t.setInteractive(IS(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(IS(t,"enable",!0)),this.holdThreshold=IS(t,"holdThreshold",50),this.pointerOutReleaseEnable=IS(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:jS(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&&!$g(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&&!$g(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 NS=Phaser.Utils.Objects.GetValue;class GS{constructor(t){this.resetFromJSON(t)}resetFromJSON(t){return this.setValue(NS(t,"value",0)),this.setSpeed(NS(t,"speed",0)),this.setAcceleration(NS(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 GS}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},$S=Phaser.Utils.Objects.GetValue;class US extends zn{constructor(t,e){switch(super(t,e),this.parent!==this.scene?this.focusMode=$S(e,"focus",!0):this.focusMode=!1,"boolean"==typeof this.focusMode&&(this.focusMode=this.focusMode?1:0),this.setSpeed($S(e,"speed",.1)),this.setEnable($S(e,"enable",!0)),this.focusMode){case 0:case 2:this.scene.input.on("wheel",this.onSceneScroll,this);break;default:t.setInteractive($S(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||$g(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 qS=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=co(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);var p=KS(r,"position",0);"string"==typeof p&&(p=JS[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[`adaptThumb${i}SizeMode`]=KS(r,"adaptThumbSize",!1),t[`minThumb${i}Size`]=KS(r,"minThumbSize",void 0)}else t[`hideUnscrollableSlider${i}`]=!1,t[`adaptThumb${i}SizeMode`]=!1,t[`minThumb${i}Size`]=void 0;var m,y,b=KS(s,"scrollDetectionMode");"string"==typeof b&&(b=ZS[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 XS(h,m),h.isRexContainerLite&&h.sendChildToBack(h));var k,C,S,w,T,P=KS(s,o?`mouseWheelScroller${i}`:"mouseWheelScroller",!1);(P&&h&&(void 0!==b&&(P.focus=1===b?2:0),k=new US(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.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 JS={right:0,left:1,bottom:0,top:1},ZS={gameObject:0,rectBounds:1},QS=Phaser.Utils.Objects.GetValue;var tw=function(t,e){var i=t.scene,s=[0,1,0],r=[0,1,0],n=QS(e,"width"),a=QS(e,"height");n||(QS(e,"child.expandWidth",!0)||(s[1]=0));a||(QS(e,"child.expandHeight",!0)||(r[1]=0));var o=new nS(i,{column:3,row:3,columnProportions:s,rowProportions:r});switch(function(t,e,i){var s=aS(i,"child"),r=aS(s,"gameObject",void 0);if(r){var n=aS(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=aS(n,"top",0),a.bottom=aS(n,"bottom",0),o.left=aS(n,"left",0),o.right=aS(n,"right",0);break;case 1:a.top=aS(n,"left",0),a.bottom=aS(n,"right",0),o.top=aS(n,"top",0),o.bottom=aS(n,"bottom",0);break;default:a.top=aS(n,"top",0),a.bottom=aS(n,"bottom",0),a.left=aS(n,"left",0),a.right=aS(n,"right",0)}e.add(r,{column:1,row:1,align:aS(s,"align","center"),padding:o,expand:{width:aS(s,"expandWidth",!0),height:aS(s,"expandHeight",!0)}})}t.addChildrenMap("child",r)}(t,o,e),t.scrollMode){case 0:qS(t,o,"y",e);break;case 1:qS(t,o,"x",e);break;default:qS(t,o,"y",e),qS(t,o,"x",e)}return o},ew=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}`]}if(s){var n="Y"===t?this.scaleY:this.scaleX;s.setBounds(e,i*n)}r&&r.setEnable(e!==i)},iw=function(t){switch(this.scrollMode){case 0:case 1:(e=this.childrenMap.slider)&&this.hideUnscrollableSlider&&this.setChildVisible(e,this.isOverflow);break;default:t=t.toUpperCase();var e=this.childrenMap[`slider${t}`],i=this[`hideUnscrollableSlider${t}`],s=this[`isOverflow${t}`];e&&i&&this.setChildVisible(e,s)}},sw=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 xw=function(t){return t.add.text(0,0,"")};Object.assign(bw.prototype,fw);var kw={setText(t){return this.childrenMap.child.setText(t),this.resizeController(),this},appendText(t){return this.setText(this.text+t),this}},Cw={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 Sw=Phaser.Utils.Objects.GetValue;class ww extends ow{constructor(t,e){void 0===e&&(e={});var i=Sw(e,"text",void 0),s=Sw(e,"textWidth",void 0),r=Sw(e,"textHeight",void 0),n=Sw(e,"textCrop",!!i.setCrop),a=Sw(e,"textMask",!n),o=Sw(e,"content",""),h=new bw(t,{width:s,height:r,text:i,textMask:a,textCrop:n&&!a,content:o,clampTextOY:Sw(e,"clampChildOY",!1),alwaysScrollable:Sw(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=Sw(e,"space",void 0);l&&(l.child=Sw(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(ww.prototype,kw,Cw);const Tw=Phaser.Utils.Objects.GetValue;var Pw=function(t,e,i){e=e?y(e):{};var s=Tw(i,"background",qx),r=Tw(i,"text",_w),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 ww(t,e);return t.add.existing(h),h},_w=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 AC(t,e);break;case"bbcodetext":case"bbcode":s=new EC(t,0,0,"",e);break;case"label":s=new FC(t,e);break;case"textarea":s=Pw(t,e);break;default:s=new Qx(t,e)}return Kx(s,e),t.add.existing(s),s},Ow=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 $x(t,e):new Tx(t,e);break;case"roundRectangle":s=new px(t,e);break;default:s=new Ex(t,e)}return Kx(s,e),t.add.existing(s),s};const Ew=Phaser.Utils.Objects.GetValue;var Mw=function(t,e,i){e=e?y(e):{};var s=Ew(i,"background",qx),r=Ew(i,"text",_w),n=Ew(i,"icon",Ow),a=Ew(i,"action",Ow);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 Dw=Phaser.Utils.Objects.GetValue;var Lw=function(t,e,i){var s,r,n=Dw(i,"innerBackground",qx),a=Dw(i,"separator",qx),o=Dw(i,"title",_w);null!==e.innerBackground&&n&&(s=n(t,e.innerBackground)),null!==e.separator&&a&&(r=a(t,e.separator)),e=Mw(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 Aw extends Ub{constructor(t,e,i){super(t,e=Lw(t,e,i))}}var Rw={start:function(t){return this.easeValueTask||(this.easeValueTask=new ll(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 Fw extends ql{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(Fw.prototype,Rw);const Iw=Phaser.Math.DegToRad,jw=Phaser.Math.Linear,zw=Phaser.Math.Easing.Expo.In,Nw={right:0,down:1,left:2,up:3};var Gw=function(t,e,i,s,r,n,a,o,h,l,u){var c=Vw(e,0,s,r,n,a,o,h,l,u);t.startAt(c.x,c.y);var d=Vw(i,0,s,r,n,a,o,h,l,u);t.lineTo(d.x,d.y);var p=Vw(i,i,s,r,n,a,o,h,l,u);t.lineTo(p.x,p.y);var g=Vw(0,i,s,r,n,a,o,h,l,u);t.lineTo(g.x,g.y);var f=Vw(0,e,s,r,n,a,o,h,l,u);t.lineTo(f.x,f.y);var v=Vw(e,e,s,r,n,a,o,h,l,u);t.lineTo(v.x,v.y),t.close()},Ww={},Vw=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},Yw={setDirection(t){return"string"==typeof t&&(t=Nw[t]),this.direction=t,this},buildShapes(){for(var t=0;t<3;t++)this.addShape(new Fu)},updateShapes(){var t,e,i,s,r,n;switch(this.direction){case 1:t=this.centerX,e=this.centerY-this.radius;var a=Iw(315);i=Math.cos(a),s=Math.sin(a);var o=Iw(45);r=Math.cos(o),n=Math.sin(o);break;case 3:t=this.centerX,e=this.centerY+this.radius;a=Iw(135);i=Math.cos(a),s=Math.sin(a);o=Iw(225);r=Math.cos(o),n=Math.sin(o);break;case 2:t=this.centerX+this.radius,e=this.centerY;a=Iw(225);i=Math.cos(a),s=Math.sin(a);o=Iw(315);r=Math.cos(o),n=Math.sin(o);break;default:t=this.centerX-this.radius,e=this.centerY;a=Iw(45);i=Math.cos(a),s=Math.sin(a);o=Iw(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)),(u=this.getSizerConfig(t)).align=i,u.padding=Sl(s),ZT(r)?(u.expandWidth=QT(r,"width",!1),u.expandHeight=QT(r,"height",!1)):(u.expandWidth=r,u.expandHeight=r),t.isRexSizer||(u.expandWidth&&(t.minWidth=void 0===n?zr(t):n),u.expandHeight&&(t.minHeight=void 0===a?Nr(t):a)),u.alignOffsetX=o,u.alignOffsetY=h,u.aspectRatio=l,this.sizerChildren.hasOwnProperty(e)&&this.sizerChildren[e].destroy(),this.sizerChildren[e]=t,c&&this.addChildrenMap(e,t),this}},sP={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 tm.call(this,t),this}},rP={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=this.innerLeft,c=this.innerTop,d=this.innerWidth,p=this.innerHeight,g=this.sizerChildren;for(var f in g)(t=g[f]).rexSizer.hidden||(i=(e=t.rexSizer).padding,Qg.call(this,t),o=this.getExpandedChildWidth(t),h=this.getExpandedChildHeight(t),e.aspectRatio>0&&(qT.width=e.aspectRatio,qT.height=1,JT.width=o,JT.height=h,o=(l=ul(qT,JT,"FIT",!0)).width,h=l.height),t.isRexSizer?(t.runLayout(this,o,h),Gv(t,this)):vp(t,o,h),s=u+i.left*this.scaleX,n=d-(i.left+i.right)*this.scaleX,r=c+i.top*this.scaleY,a=p-(i.top+i.bottom)*this.scaleY,tf.call(this,t,s,r,n,a,e.align,e.alignOffsetX,e.alignOffsetY))}};Object.assign(rP,iP,sP);const nP=Phaser.Utils.Objects.IsPlainObject,aP=Phaser.Utils.Objects.GetValue;class oP extends Nv{constructor(t,e,i,s,r,n){nP(e)?(e=aP(n=e,"x",0),i=aP(n,"y",0),s=aP(n,"width",void 0),r=aP(n,"height",void 0)):nP(s)&&(s=aP(n=s,"width",void 0),r=aP(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(oP.prototype,rP);const hP=pm.prototype.add,lP=pm.prototype.addSpace;var uP=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)&&lP.call(this),hP.call(this,t,{proportion:i,expand:!0});var s=!this.buttonsExpand&&"center"===this.buttonsAlign;s&&lP.call(this),this.hasTailSpace=s}else hP.call(this,t,{proportion:i,expand:!0}),this.hasTailSpace=!1;else if(this.hasTailSpace){var r=this.sizerChildren.length-1;hP.call(this,t,{index:r,proportion:i,expand:!0})}else hP.call(this,t,{proportion:i,expand:!0});return e&&this.buttonGroup.add(t),this},cP={addButton(t){if(Ug(t))for(var e=t,i=0,s=e.length;i=0;i--)gP.call(this,e[i],t);return this}},vP=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)}},mP=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,vP.call(e,t,i,s)}},enumerable:!0,configurable:!0}),t.selected=!1},yP={add(t){return this.buttons.push(t),t._click||(t._click=new nf(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`),mP.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=LP(o.left,o.centerY,t,e))&&(r=h,s=n);var h,l=i[n+1];if(!l||l.y!==o.y)r>(h=LP(o.right,o.centerY,t,e))&&(r=h,s=n+1)}}return s};const RP=Phaser.Utils.Objects.IsPlainObject,BP=Phaser.Utils.Objects.GetValue,FP=Phaser.Display.Align.CENTER;var IP=function(t,e,i,s){if("\n"===t)return this.addNewLine(),this;var r;(Vd.call(this,t),RP(e))&&(e=BP(r=e,"padding",0),i=BP(r,"key",void 0),s=BP(r,"index",void 0));return void 0===e&&(e=0),(r=this.getSizerConfig(t)).align=FP,r.padding=Sl(e),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},jP={add(t,e,i){if(Ug(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,tm.call(this,t),this}},GP={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&&UP.addNewLine(this)}else for(n=0,a=t.length;n=0;i--)QP.call(this,e[i],t);return this}};const e_=Phaser.Utils.Objects.GetValue;class i_ extends HP{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 TP({parent:this,eventEmitter:e_(e,"eventEmitter",this),groupName:e_(e,"groupName",void 0),clickConfig:e_(e,"click",void 0)}).setButtonsType(e);var s=e_(e,"background",void 0),r=e_(e,"buttons",void 0);this.buttonsAlign=e_(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(i_.prototype,qP,t_,wP,_P);const s_=nS.prototype.add;var r_={addButton(t,e,i){return s_.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--)o_.call(this,e[i],t);return this}};const l_=Phaser.Utils.Objects.GetValue;class u_ extends nS{constructor(t,e){void 0===e&&(e={});var i=l_(e,"row",0),s=l_(e,"column",e.col||0),r=l_(e,"createCellContainerCallback"),n=l_(e,"buttons",void 0),a=l_(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)):(aO(this),oO(this)),this}setNumberInput(){return this.onUpdateCallback=nO,this}setSelectAllWhenFocusEnable(t){return void 0===t&&(t=!0),this.selectAllWhenFocus=t,this}setRequestCursorPosition(t){return this.isOpened?(this.requestCursorPosition=t,this):this}}const uO=Phaser.Utils.Objects.GetValue,cO=["inputType","onOpen","clickOutSideTarget","onFocus","onClose","onBlur","onUpdate","enterClose","readOnly","maxLength","minLength","selectAll"];var dO=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)},pO=function(t){fr(t)||this.setCursorStyle(t).on("cursorin",(function(t){var e=this.cursorStyle,i=ox(t.style,e);wl(e,i)||(t.styleSave=i,t.modifyStyle(e))}),this).on("cursorout",(function(t){t.styleSave&&(t.modifyStyle(t.styleSave),t.styleSave=void 0)}),this)},gO=function(t){fr(t)||this.setFocusStyle(t).on("open",(function(){var t=this.background,e=this.focusStyle,i=ox(t,e);wl(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 fO(){}function vO(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}fO.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(vO(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 mO=new fO;const yO=/^[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,bO=/\S/,xO=new fO;xO.equals=function(t,e){return this.options.ignoreCase&&(t=t.toLowerCase(),e=e.toLowerCase()),t===e||this.options.ignoreWhitespace&&!bO.test(t)&&!bO.test(e)},xO.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(wO(t,null,null,i),i," ")},SO.equals=function(t,e){return fO.prototype.equals.call(SO,t.replace(/,([\r\n])/g,"$1"),e.replace(/,([\r\n])/g,"$1"))};const TO=new fO;TO.tokenize=function(t){return t.slice()},TO.join=TO.removeEmpty=function(t){return t};const PO=Phaser.Utils.Array.Remove;var _O=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,mO.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},LO={cursorMoveLeft(){if(!this.isOpened)return this;var t=EO(this.cursorPosition-1,0,this.inputText.length);return this.setCursorPosition(t),this},cursorMoveRight(){if(!this.isOpened)return this;var t=EO(this.cursorPosition+1,0,this.inputText.length);return this.setCursorPosition(t),this},cursorMoveUp(){if(!this.isOpened)return this;var t=MO(this.characterCountOfLines,this.cursorPosition);t.lineIndex-=1;var e=EO(DO(this.characterCountOfLines,t),0,this.inputText.length);return this.setCursorPosition(e),this},cursorMoveDown(){if(!this.isOpened)return this;var t=MO(this.characterCountOfLines,this.cursorPosition);t.lineIndex+=1;var e=EO(DO(this.characterCountOfLines,t),0,this.inputText.length);return this.setCursorPosition(e),this}};const AO=Phaser.Utils.Objects.IsPlainObject;class RO extends Fb{constructor(t,e,i,s,r,n){AO(e)?n=e:AO(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=ax(n.background,"focus"),h=ax(n.style,"cursor");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=uO(e,"edit");return void 0===i&&(i={}),H_(e,i,cO),new lO(t,i)}(this,n),dO.call(this),n.focusStyle&&Object.assign(o,n.focusStyle),gO.call(this,o),n.cursorStyle&&Object.assign(h,n.cursorStyle),pO.call(this,h);var l=n.onAddChar;l&&this.on("addchar",l);var u=n.onCursorOut;u&&this.on("cursorout",u);var c=n.onCursorIn;c&&this.on("cursorin",c);var d,p=n.onMoveCursor;p&&this.on("movecursor",p),this.setParseTextCallback(n.parseTextCallback),this.lastInsertCursor=((d=this.createCharChild("|")).text="",d),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 Kx(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 BT(t,e);return Kx(i,e),t.add.existing(i),i},y=!0);var b,x,k=new Aw(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)),Tc(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=IT[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=IT[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}}(zT(e,`styles.${qo}`,{}),{viewport:i},r);t.addGameObjectManager({name:qo,createGameObject:s,fade:0,viewportCoordinate:{viewport:i},defaultLayer:Lo,commands:{typing:Ac,shake:Pc}})}},function(t,e){var{viewport:i}=e,s=Oc(e,`creators.${Uo}`,void 0);if(!1!==s){if(Ec(s)&&(s=void 0),void 0===s){Oc(e,`styles.${Uo}`,{});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),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 Tc(s),s}}(0,{viewport:i})}t.addGameObjectManager({name:Uo,createGameObject:s,fade:0,viewportCoordinate:{viewport:i},defaultLayer:Mo,commands:{cross:_c,shake:Pc}})}},function(t,e){var{viewport:i}=e,s=I_(e,`creators.${Zo}`,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=.5,vpy:l=.5}={}){void 0!==r&&(a=e.width*r),void 0!==n&&(o=e.height*n);var u=new B_(s,t,i);return u.setMinSize(a,o).setVisible(!1),s.add.existing(u),wr(u,e),u.vpx=h,u.vpy=l,Tc(u),u}}(I_(e,`styles.${Zo}`,{}),{viewport:i},r);t.addGameObjectManager({name:Zo,createGameObject:s,fade:0,viewportCoordinate:{viewport:i},defaultLayer:Lo,commands:{choice:F_,shake:Pc}})}},function(t,e){var{viewport:i}=e,s=GO(e,`creators.${Qo}`,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 zO(s,t,i);return u.setMinSize(a,o).setVisible(!1),s.add.existing(u),wr(u,e),u.vpx=h,u.vpy=l,Tc(u),u}}(GO(e,`styles.${Qo}`,{}),{viewport:i},r);t.addGameObjectManager({name:Qo,createGameObject:s,fade:0,viewportCoordinate:{viewport:i},defaultLayer:Lo,commands:{input:NO,shake:Pc}})}},function(t,e){var{viewport:i}=e,s=UT(e,`creators.${Jo}`,void 0);if(!1!==s){var r;if(KT(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 Kx(i,e),i.setOrigin(.5,1),t.add.existing(i),i});var b,x,k=new GT(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,Tc(k),k}}(UT(e,`styles.${Jo}`,{}),{viewport:i},r);t.addGameObjectManager({name:Jo,createGameObject:s,fade:0,viewportCoordinate:{viewport:i},defaultLayer:Lo,commands:{setText:VT,popUp:YT,shake:Pc}})}}];var YO=[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))}))}],XO={$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},HO=function(t,e){var i=co(t);for(var s in e)i.hasOwnProperty(s)||(i[s]=e[s]);return i};class $O 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=ln(t,t.cameras.main));for(var a=new Eo(t,{layers:r?Wo:Vo,layerDepth:i,rootLayer:s}),o=0,h=VO.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=sE(r,"x",null);null!==n?(t=n,i=n):(t=sE(r,"left",0),i=sE(r,"right",t));var a=sE(r,"y",null);null!==a?(e=a,s=a):(e=sE(r,"top",0),s=sE(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 aE(this.verticeRotation)}set verticeAngle(t){this.verticeRotation=nE(t)}setVerticeAngle(t){return this.verticeAngle=t,this}}const hE={right:0,down:1,left:2,up:3};var lE=function(t){return"string"==typeof t&&(t=hE[t]),t%=4};Object.assign(oE.prototype,eE,iE);class uE extends qO{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexTweaker.FolderTitle";var i=new oE(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 cE=function(t,e,i){return qx(t,HO(e,i))};class dE extends Pg{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 pE={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}},gE=function(t,e){Rp.popUp.call(t,e,this.expandDirection)},fE=function(t,e){Rp.scaleDown.call(t,e,this.expandDirection)},vE={setTransitionDuration(t){return this.transitionDuration=t,this.childTransition.setTransitInTime(t).setTransitOutTime(t),this},setExpandCallback(t){return void 0===t&&(t=gE.bind(this)),this.childTransition.setTransitInCallback(t),this},setCollapseCallback(t){return void 0===t&&(t=fE.bind(this)),this.childTransition.setTransitOutCallback(t),this}};const mE=Phaser.Utils.Objects.GetValue;let yE=class extends pm{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=mE(e,"space"),a=1===this.orientation?"left":"top",o=mE(e,"align.title",a),h=mE(e,"expand.title",!0);this.add(s,{proportion:0,align:o,expand:h,padding:{left:mE(n,"titleLeft",0),right:mE(n,"titleRight",0),top:mE(n,"titleTop",0),bottom:mE(n,"titleBottom",0)}});var l=mE(e,"toggleByTarget",void 0),u=mE(e,"toggleClickConfig");if(void 0===l&&(l=s),l&&of.onClick.call(l,(function(){this.toggle()}),this,u),this.childTransition=new dE(r),!mE(e,"customChildOrigin",!1)){var c=this.rtl?1:0;r.setOrigin(c)}o=mE(e,"align.child","left");var d=(h=mE(e,"expand.child",!0))?1:0;this.add(r,{proportion:d,align:o,expand:h,padding:{left:mE(n,"childLeft",0),right:mE(n,"childRight",0),top:mE(n,"childTop",0),bottom:mE(n,"childBottom",0)}}),this.addChildrenMap("title",s),this.addChildrenMap("child",r),this.addChildrenMap("background",i);var p=e.transition;this.setTransitionDuration(mE(p,"duration",200)),this.setExpandCallback(mE(p,"expandCallback",void 0)),this.setCollapseCallback(mE(p,"collapseCallback",void 0)),this.reLayoutTarget=mE(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=mE(e,"expanded",void 0);void 0!==y&&this.setExpandedState(y)}};Object.assign(yE.prototype,pE,vE);var bE={setBindingTarget(t){return this.childrenMap.child.setBindingTarget(t),this}},xE={getMaxInputRowTitleWidth(){return this.childrenMap.child.getMaxInputRowTitleWidth()+this.getInnerPadding("left")},setInputRowTitleWidth(t){return t-=this.getInnerPadding("left"),this.childrenMap.child.setInputRowTitleWidth(t),this}};class kE extends yE{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(kE.prototype,bE,xE);const CE=Phaser.Utils.Objects.GetValue;const SE=Phaser.Utils.Objects.GetValue;const wE=oP.prototype.add;var TE=function(t,e,i,s,r,n,a,o,h){return t.setVisible(!1),wE.call(this,t,e,i,s,r,n,a,o,h),this},PE={add:TE,addPage:TE};const _E=nl.prototype.setChildVisible;var OE={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?(_E.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&&(_E.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(OE,PE);const EE=Phaser.Utils.Objects.GetValue;class ME extends oP{constructor(t,e){super(t,e),this.type="rexPages",this.childrenMap=this.sizerChildren,this._previousKey=void 0,this._currentKey=void 0,this.setSwapMode(EE(e,"swapMode",0)),this.setFadeInDuration(EE(e,"fadeIn",0))}setSwapMode(t){return"string"==typeof t&&(t=DE[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(ME.prototype,OE);const DE={invisible:0,destroy:1};const LE=Phaser.Utils.Objects.IsPlainObject,AE=Phaser.Utils.Objects.GetValue,RE=Phaser.Utils.String.UUID;var BE={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}},FE={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}},IE={top:1,left:3,right:5,bottom:7},jE={top:"bottom",left:"right",right:"left",bottom:"top"},zE={setTabsPadding(t,e){return this.childrenMap.tabs.setOuterPadding(t,e),this},getTabsPadding(t){return this.childrenMap.tabs.getOuterPadding(t)}},NE={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 sM=Phaser.Utils.Objects.GetValue;class rM extends pm{constructor(t,e){void 0===e&&(e={}),e.orientation="y",super(t,e),this.type="rexTweaker.Wrap";var i=sM(e,"background",void 0),s=sM(e,"title",void 0);i&&this.addBackground(i),s&&this.add(s,{expand:!0,space:{bottom:sM(e,"space.title",0)}});var r=sM(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(rM.prototype,eM,iM);const nM=Phaser.Utils.Objects.GetValue;const aM=Phaser.Utils.Objects.GetValue;var oM=function(t){return t.hasOwnProperty("geometryMask")?t.geometryMask:t.bitmapMask};const hM=Phaser.Geom.Intersects.RectangleToRectangle,lM=Phaser.Geom.Rectangle.Overlaps;var uM=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}},cM=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},dM=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))},pM=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 fM=Phaser.Utils.Objects.GetValue,vM={update:0,everyTick:1};var mM={setupChildrenMask(t){return!1===t||(this.setMaskUpdateMode(fM(t,"updateMode",0)),this.enableChildrenMask(fM(t,"padding",0)),this.setMaskLayer(fM(t,"layer",void 0)),this.onMaskGameObjectVisible=fM(t,"onVisivle"),this.onMaskGameObjectInvisible=fM(t,"onInvisible"),this.maskGameObjectCallbackScope=fM(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=vM[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=ym.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=oM(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(CM.prototype,yM);const SM=["top","bottom","centerY","center"],wM=["left","right","centerX","center"];var TM=function(t,e,i){var s,r="Y"===(e=e.toUpperCase()),n=this.childrenMap.child;if(r){if(i)for(var a=0,o=SM.length;a=0?0:Math.abs(l)<=Math.abs(u)?l:u}}else{if(i)for(a=0,o=wM.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 PM=Phaser.Utils.Objects.GetValue;class _M extends ow{constructor(t,e){void 0===e&&(e={});var i=zC(e),s=PM(e,"panel",void 0);void 0===s&&(s={}),s.scrollMode=i,s.clampChildOY=PM(e,"clampChildOY",!1),s.clampChildOX=PM(e,"clampChildOX",!1);var r,n,a=new CM(t,s);switch(t.add.existing(a),i){case 0:r=PM(e,"expand.panel",!0),n=!0;break;case 1:r=!0,n=PM(e,"expand.panel",!0);break;default:r=!0,n=!0}e.type="rexScrollablePanel",e.child={gameObject:a,expandWidth:r,expandHeight:n,align:PM(e,"align.panel","center")};var o=PM(e,"space",void 0);o&&(o.child=PM(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]),Iv(this.childrenMap.child,t),this}}var OM={scrollToChild:function(t,e){if(!this.hasChild(t))return this;switch(this.scrollMode){case 0:TM.call(this,t,"y",e);break;case 1:TM.call(this,t,"x",e);break;default:TM.call(this,t,"y",e),TM.call(this,t,"x",e)}return this}};Object.assign(_M.prototype,OM);var EM={setBindingTarget(t){return this.childrenMap.panel.setBindingTarget(t),this}},MM={getMaxInputRowTitleWidth(){return this.childrenMap.panel.getMaxInputRowTitleWidth()+this.getInnerPadding("left")},setInputRowTitleWidth(t){return t-=this.getInnerPadding("left"),this.childrenMap.panel.setInputRowTitleWidth(t),this}};class DM extends _M{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(DM.prototype,EM,MM);const LM=Phaser.Utils.Objects.GetValue;const AM=Phaser.Utils.Objects.GetValue;const RM=Phaser.Utils.Objects.GetValue;var BM={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=RM(t,"onGetValue"),this.onSetValue=RM(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}},FM={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)}}},IM={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 jM=Phaser.Utils.Objects.GetValue;class zM extends pm{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=jM(e,"proportion.title",0),o=jM(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=jM(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(zM.prototype,BM,FM,IM);var NM=function(t,e,i){var s=new qO(t,i);return t.add.existing(s),s},GM=function(t){void 0===t&&(t=pm);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}}},WM=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=UM(this.styles,"inputRow")||{},r=$M(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 qx(t,HO(e,i))}(this.scene,t,KM(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),qM(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=FO(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))}},eD={setText(t){return this.childrenMap.child.setText(t),this},appendText(t){return this.setText(this.text+t),this}},iD={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 sD=Phaser.Utils.Objects.GetValue;class rD extends ow{constructor(t,e){void 0===e&&(e={});var i,s=sD(e,"text");gn(s)?i=s:(void 0===s&&(s={}),s.textArea=!0,i=new RO(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=sD(e,"space",void 0);h&&(h.child=sD(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=sD(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(rD.prototype,eD,iD);var nD={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 rD(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()}},aD={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=FO(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 oD=Phaser.Utils.Objects.GetValue,hD=Phaser.Math.Linear,lD=Phaser.Math.Snap.Floor;var uD={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=oD(s,r),a=function(t,e){var i=new DS(t,e);return t.add.existing(i),i}(i,s),o=e.defaultExpandWidth?2:0,h=oD(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=FO(i,u).setNumberInput();o=e.defaultExpandWidth?1:0,h=oD(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=hD(t.minValue,t.maxValue,a.value);t.step&&(e=lD(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))}},cD=function(t,e){var i=new EP(t,e);return t.add.existing(i),i};const dD=Phaser.Utils.Objects.GetValue;var pD={name:"RangeInput",accept:t=>!!t.hasOwnProperty("view")&&"incdec"===t.view,build(t,e){var i=t.scene;t.type="rexTweaker.IncDecInput";var s=dD(e,"incDec")||{},r={text:null,action:null},n=cD(i,{expand:!1}),a=e.defaultExpandWidth?1:0;t.add(n,{proportion:a,expand:!0});var o=e.inputNumber||e.inputText,h=FO(i,o).setNumberInput();h.on("close",(function(){t.setValue(h.value)}));var l=Object.assign(y(r),s.incButton||{}),u=b_(i,l),c=Object.assign(y(r),s.decButton||{}),d=b_(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 aL(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 hL=Phaser.Utils.Objects.GetValue;var lL=function(t,e){var i=hL(e,"expandDirection",void 0);"string"==typeof i&&(i=uL[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=hL(e,"alignTargetY",u),d=hL(e,"alignOffsetX",0),p=hL(e,"alignOffsetY",0),g=hL(e,"alignSide","").includes("right"),f=hL(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=ln(t.scene)),m&&t.getBottomLeft().y>x.bottom&&(l=c.getTopLeft().y,t.setOrigin(0,1).setPosition(h+d,l+p))};const uL={down:0,up:1},cL=Phaser.Utils.Objects.GetValue;class dL extends Pg{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=function(t,e){Op(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 Pp(t,n):r.resetFromJSON(n),r.restart()}(t,e,"y","Linear")}),e.manualClose=!0,e.clickOutsideClose=!0,e.destroy=!0,super(t,e),lL(t,e),t.isRexSizer&&t.layout();var i=cL(e,"touchOutsideClose",!1),s=cL(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&&Ig(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 pL={openColorPicker:function(){if(!this.colorPicker){var t=oL.call(this).layout(),e=new dL(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(pL,_D);const gL=Phaser.Utils.Objects.GetValue;class fL extends PD{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(gL(i,"width",160),gL(i,"height",170));var n=gL(i,"background");r=n?function(t){return qx(t,n)}:gL(i,"createBackgroundCallback"),this.setCreateColorPickerBackgroundCallback(r),this.setColorPickerHPalettePosition(gL(i,"hPalettePosition",0)),this.setColorPickerExpandDirection(gL(i,"expandDirection")),this.setColorPickerEaseInDuration(gL(i,"easeIn",200)),this.setColorPickerEaseOutDuration(gL(i,"easeOut",200)),this.setColorPickerTransitInCallback(gL(i,"transitIn")),this.setColorPickerTransitOutCallback(gL(i,"transitOut")),this.setColorPickerBounds(gL(i,"bounds"));var a=gL(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(gL(o,"height",30)),this.setColorComponentsFormatLabelConfig(gL(o,"formatLabel"));var h=gL(o,"inputText");h||(h=gL(e,"inputText")),this.setColorComponentsInputTextConfig(h);var l=gL(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(fL.prototype,pL);var vL={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 fL(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)}},mL={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}},yL={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}},bL={buildShapes(){this.addShape((new zu).setName("box")).addShape((new Fu).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)}},xL={setCheckerAnimationDuration(t){return void 0===t&&(t=0),this.checkerAnimDuration=t,this},playCheckerAnimation(){return void 0===this.checkerAnimProgressTask&&(this.checkerAnimProgressTask=new ll(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}},kL={};Object.assign(kL,mL,yL,bL,xL);const CL=23730,SL=Phaser.Utils.Objects.GetValue,wL=Phaser.Utils.Objects.IsPlainObject;class TL extends ql{constructor(t,e,i,s,r,n,a){wL(e)?(e=SL(a=e,"x",0),i=SL(a,"y",0),s=SL(a,"width",2),r=SL(a,"height",2),n=SL(a,"color",CL)):wL(n)&&(n=SL(a=n,"color",CL)),super(t,e,i,s,r),this.type="rexCheckbox",void 0===n&&(n=CL),this.setBoxShape(SL(a,"circleBox",!1)),this.setBoxFillStyle(n,SL(a,"boxFillAlpha",1)),this.setUncheckedBoxFillStyle(SL(a,"uncheckedColor",null),SL(a,"uncheckedBoxFillAlpha",1)),this.setBoxStrokeStyle(SL(a,"boxLineWidth",4),SL(a,"boxStrokeColor",n),SL(a,"boxStrokeAlpha",1)),this.setUncheckedBoxStrokeStyle(this.boxLineWidth,SL(a,"uncheckedBoxStrokeColor",this.boxStrokeColor),SL(a,"uncheckedBoxStrokeAlpha",this.boxStrokeAlpha)),this.setCheckerStyle(SL(a,"checkerColor",16777215),SL(a,"checkerAlpha",1)),this.setBoxSize(SL(a,"boxSize",1)),this.setCheckerSize(SL(a,"checkerSize",1)),this.setCheckerAnimationDuration(SL(a,"animationDuration",150)),this.buildShapes();var o=SL(a,"checked");void 0===o&&(o=SL(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(TL.prototype,kL);const PL=Phaser.Utils.Objects.GetValue,_L=Phaser.Utils.Objects.IsPlainObject;class OL extends TL{constructor(t,e,i,s,r,n,a){_L(e)?(e=PL(a=e,"x",0),i=PL(a,"y",0),s=PL(a,"width",2),r=PL(a,"height",2),n=PL(a,"color",CL)):_L(n)&&(n=PL(a=n,"color",CL)),super(t,e,i,s,r,n,a),this._click=new nf(this,PL(a,"click")),this._click.on("click",(function(){this.toggleValue()}),this),this.setReadOnly(PL(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 EL={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 OL(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)}},ML={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}},DL={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}},LL={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}},AL=function(t,e,i){return(e-t)*i+t};const RL=Phaser.Math.Linear;var BL={buildShapes(){this.addShape((new zu).setName("track")).addShape((new zu).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&AL(yr(l),yr(u),c))<<16|(255&AL(br(l),br(u),c))<<8|255&AL(xr(l),xr(u),c)),p=RL(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=RL(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)}},FL={setToggleAnimationDuration(t){return void 0===t&&(t=0),this.toggleAnimDuration=t,this},playToggleAnimation(){return void 0===this.toggleAnimProgressTask&&(this.toggleAnimProgressTask=new ll(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}},IL={};Object.assign(IL,ML,DL,LL,BL,FL);const jL=Phaser.Utils.Objects.GetValue,zL=Phaser.Utils.Objects.IsPlainObject,NL=23730;class GL extends ql{constructor(t,e,i,s,r,n,a){zL(e)?(e=jL(a=e,"x",0),i=jL(a,"y",0),s=jL(a,"width",2),r=jL(a,"height",2),n=jL(a,"color",NL)):zL(n)&&(n=jL(a=n,"color",NL)),super(t,e,i,s,r),this.type="rexToggleSwitch",void 0===n&&(n=NL),this.setTrackFillStyle(n,jL(a,"trackFillAlpha",1)),this.setFalseValueTrackFillStyle(jL(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)),jL(a,"falseValueTrackFillAlpha",1)),this.setThumbStyle(jL(a,"thumbColor",16777215),jL(a,"thumbAlpha",1)),this.setTrackSize(jL(a,"trackWidth",.9),jL(a,"trackHeight",.5)),this.setTrackRadius(jL(a,"trackRadius",.5*this.trackHeight));var o=jL(a,"thumbHeight",void 0),h=jL(a,"thumbWidth",o);void 0===h&&(h=.9*this.trackHeight),this.setThumbSize(h,o),this.setThumbRadius(jL(a,"thumbRadius",.5*this.thumbHeight)),this.setThumbPosition(jL(a,"thumbLeft",.3),jL(a,"thumbRight",void 0)),this.setRTL(jL(a,"rtl",!1)),this.setToggleAnimationDuration(jL(a,"animationDuration",150)),this.buildShapes(),this.setValue(jL(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(GL.prototype,IL);const WL=Phaser.Utils.Objects.GetValue;class VL extends GL{constructor(t,e,i,s,r,n,a){super(t,e,i,s,r,n,a),this._click=new nf(this,WL(a,"click")),this._click.on("click",(function(){this.toggleValue()}),this),this.setReadOnly(WL(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 YL={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 VL(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)}},XL={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=HL[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 HL={down:0,up:1},$L=Phaser.Utils.Objects.GetValue;var UL=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=KL(e,d);if(this.listMaxHeight>0&&(s.layout(),s.height<=this.listMaxHeight&&(u=s)),!u){0===c&&(c=this.listMaxHeight);var p=qL(e,this.listCreateSliderTrackCallback),g=qL(e,this.listCreateSliderThumbCallback);u=new _M(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:$L(this.listSpace,"panel",0)}}),e.add.existing(u)}}else d.height=c,s=KL(e,d),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},KL=function(t,e,i){var s;return i?(e.orientation="x",s=new i_(t,e)):(e.orientation="y",s=new EP(t,e)),t.add.existing(s),s},qL=function(t,e,i){var s;return e&&(s=e.call(i,t),t.add.existing(s)),s},JL={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}},ZL={openListPanel:function(){if(this.listPanel)return this;if(0===this.options.length)return this;var t,e=UL.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 dL(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(ZL,XL,JL);const QL=Phaser.Utils.Objects.GetValue;class tA extends BC{constructor(t,e){super(t,e),this.type="rexDropDownList",this.timer=void 0,this.listPanel=void 0,this.currentOverIndex=void 0,this.setOptions(QL(e,"options"));var i=QL(e,"list");this.setWrapEnable(QL(i,"wrap",!1)),this.setCreateButtonCallback(QL(i,"createButtonCallback")),this.setCreateListBackgroundCallback(QL(i,"createBackgroundCallback")),this.setCreateListSliderTrackCallback(QL(i,"createTrackCallback")),this.setCreateListSliderThumbCallback(QL(i,"createThumbCallback")),this.setListSliderAdaptThumbSizeEnable(QL(i,"sliderAdaptThumbSize",!1)),this.setListScrollerConfig(QL(i,"scroller")),this.setListMouseWheelScrollerConfig(QL(i,"mouseWheelScroller")),this.setButtonClickCallback(QL(i,"onButtonClick")),this.setButtonOverCallback(QL(i,"onButtonOver")),this.setButtonOutCallback(QL(i,"onButtonOut")),this.setListExpandDirection(QL(i,"expandDirection")),this.setListEaseInDuration(QL(i,"easeIn",500)),this.setListEaseOutDuration(QL(i,"easeOut",100)),this.setListTransitInCallback(QL(i,"transitIn")),this.settListTransitOutCallback(QL(i,"transitOut")),this.setListMaxHeight(QL(i,"maxHeight",0)),this.setListSize(QL(i,"width"),QL(i,"height",0)),this.setListAlignmentMode(QL(i,"alignParent","text")),this.setListAlignmentSide(QL(i,"alignSide","")),this.setListBounds(QL(i,"bounds")),this.setListSpace(QL(i,"space")),this.setListDraggable(QL(i,"draggable",!1)),this.setValueChangeCallback(QL(e,"setValueCallback"),QL(e,"setValueCallbackScope")),this.setValue(QL(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(tA.prototype,ZL);var eA=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=Mw(t,s,n);o.list=e.list||{},o.list.createButtonCallback=function(t,e){var i=b_(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 qx(t,h)},delete e.track);var l=e.thumb;return l&&(o.list.createThumbCallback=function(t){return qx(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 tA(t,e);return t.add.existing(i),i},iA=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=eA(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=iA(t,e);if(null!=i)return t[i]}(i.options,e);i.resetDisplayContent(s).setMinSize(i.width,i.height).layout().setMinSize(0,0)}};const rA=Phaser.Utils.Objects.GetValue;var nA={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=rA(s,"expand",!0);r&&(s.align="center"),delete s.expand;var n=cD(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 lA={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!==Om&&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=Lm[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]=uk(t,l,u);else{var d=lk(t,l,u);c&&(d=c(d)),this[o]=d}}var p=uk(t,"font",null);this._font=null===p?this.fontStyle+" "+this.fontSize+" "+this.fontFamily:p;var g=uk(t,"fill",null);null!==g&&(this.color=py(g));var f=uk(t,"metrics",!1);return f?this.metrics={ascent:uk(f,"ascent",0),descent:uk(f,"descent",0),fontSize:uk(f,"fontSize",0)}:!e&&this.metrics||(this.metrics=hk(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=hk(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=uk(t,"fontFamily","Courier"),this.fontSize=uk(t,"fontSize","16px"),this.fontStyle=uk(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=py(t,this.parent.canvas,this.parent.context),this.backgroundColor2=py(e,this.parent.canvas,this.parent.context),this.backgroundHorizontalGradient=i,this.update(!1)}setBackgroundStrokeColor(t,e){return this.backgroundStrokeColor=py(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=py(t,this.parent.canvas,this.parent.context),this.update(!1)}setColor(t){return this.color=py(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=py(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=py(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=py(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=py(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=py(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=py(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=py(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=Lm[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=uk(e,"fontFamily",this.fontFamily),this.fontSize=uk(e,"fontSize",this.fontSize),this.fontStyle=uk(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 dk={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 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 pk=Phaser.Utils.Objects.GetValue,gk=Tm,fk=Pm;class vk{constructor(t){this.prop={},this.resetFromJSON(t)}resetFromJSON(t){this.text=pk(t,"text",""),this.x=pk(t,"x",0),this.y=pk(t,"y",0),this.width=pk(t,"width",0);var e=pk(t,"prop",null);null===e&&(e={}),this.prop=e,this.newLineMode=pk(t,"newLineMode",0),this.startIndex=pk(t,"startIndex",0)}get plainText(){var t=this.text;return this.newLineMode===fk&&(t+="\n"),t}get wrapText(){var t=this.text;return this.newLineMode!==gk&&(t+="\n"),t}get rawTextLength(){var t=this.text.length;return this.newLineMode===fk&&(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 mk=Phaser.Utils.Objects.GetFastValue,yk=Tm,bk=_m;class xk{constructor(t){this.pens=[],this.lines=[],this.maxLinesWidth=void 0,this.pensPool=t.pensPool,this.linesPool=t.linesPool,this.tagToText=mk(t,"tagToText",pd),this.tagToTextScope=mk(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 kk={};const Ck=Phaser.Geom.Rectangle;var Sk=new Aa;class wk{constructor(){this.hitAreas=[]}destroy(){this.clear()}clear(){for(var t=0,e=this.hitAreas.length;ts&&jk(f)){""!==b?a.push(n.getLine(b,x,Dk)):0===k&&r>0&&a.push(n.getLine("",0,Dk)),a.push(...Fk(f,e,Rk,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,Dk)),b=f,x=v,h=s):(b+=f,x=m),k===C-1&&a.push(n.getLine(b,x,l))}return a},Ik=function(t,e){var i;switch(e){case Ak:i=[];for(var s=0,r=(t=t.split(" ")).length;s0&&e!==Nk&&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 xk({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 UC(this.sizerChildren,null),tm.call(this,t),this}},qC={setColumnSpace(t){if(this.space.column||(this.space.column=[]),this.space.column.length=this.columnCount-1,"number"==typeof t)UC(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},tS={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=lp.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===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,UC(this.sizerChildren,null),this.columnProportions=[],this.columnProportions.length=t,"number"==typeof i)UC(this.columnProportions,i);else for(var n=0;n0?e+=t:0===t&&(this.hasColumnProportion0Child=!0);return e},iS=function(){for(var t,e=0,i=0;i0?e+=t:0===t&&(this.hasRowProportion0Child=!0);return e};const sS=Phaser.Utils.Objects.IsPlainObject,rS=Phaser.Utils.Objects.GetValue;class nS extends Nv{constructor(t,e,i,s,r,n,a,o,h,l){sS(e)?(e=rS(l=e,"x",0),i=rS(l,"y",0),s=rS(l,"width",void 0),r=rS(l,"height",void 0),n=rS(l,"column",l.col||0),a=rS(l,"row",0),o=rS(l,"columnProportions",0),h=rS(l,"rowProportions",0)):sS(s)?(s=rS(l=s,"width",void 0),r=rS(l,"height",void 0),n=rS(l,"column",l.col||0),a=rS(l,"row",0),o=rS(l,"columnProportions",0),h=rS(l,"rowProportions",0)):sS(n)?(n=rS(l=n,"column",l.col||0),a=rS(l,"row",0),o=rS(l,"columnProportions",0),h=rS(l,"rowProportions",0)):sS(o)&&(o=rS(l=o,"columnProportions",0),h=rS(l,"rowProportions",0)),super(t,e,i,s,r,l),this.type="rexGridSizer",this.sizerChildren=[],this.addChildrenMap("items",this.sizerChildren),this.setCreateCellContainerCallback(rS(l,"createCellContainerCallback")),this.setIndentLeft(rS(l,"space.indentLeftOdd",0),rS(l,"space.indentLeftEven",0)),this.setIndentTop(rS(l,"space.indentTopOdd",0),rS(l,"space.indentTopEven",0)),this.resetGrid(n,a,o,h,rS(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=eS.call(this)),this._totalColumnProportions}get totalRowProportions(){return void 0===this._totalRowProportions&&(this._totalRowProportions=iS.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(nS.prototype,tS);const aS=Phaser.Utils.Objects.GetValue;const oS=Phaser.Math.Percent;var hS=function(t,e,i){var s;return t.y===e.y?s=oS(i.x,t.x,e.x):t.x===e.x&&(s=oS(i.y,t.y,e.y)),s},lS=function(t,e,i){var s,r;this.enable&&(uS.x=e,uS.y=i,this.reverseAxis?(s=this.getEndPoint(),r=this.getStartPoint()):(s=this.getStartPoint(),r=this.getEndPoint()),this.value=hS(s,r,uS))},uS={},cS=function(t,e,i){if(this.enable&&t.isDown){var s,r;dS.x=t.worldX,dS.y=t.worldY,this.reverseAxis?(s=this.getEndPoint(),r=this.getStartPoint()):(s=this.getStartPoint(),r=this.getEndPoint());var n=hS(s,r,dS);this.stopEaseValue(),0===this.easeValueDuration||Math.abs(this.value-n)<.1?this.value=n:this.easeValueTo(n)}},dS={},pS=function(t,e){void 0===e&&(e=gS);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},gS={};const fS=Phaser.Display.Align.LEFT_CENTER,vS=Phaser.Display.Align.TOP_CENTER;var mS={};const yS=Phaser.Display.Align.RIGHT_CENTER,bS=Phaser.Display.Align.BOTTOM_CENTER;var xS={};const kS=Phaser.Math.Linear;var CS={};const SS=Phaser.Display.Align.LEFT_CENTER,wS=Phaser.Display.Align.TOP_CENTER,TS=Phaser.Display.Align.RIGHT_CENTER,PS=Phaser.Display.Align.BOTTOM_CENTER;const _S=Phaser.Utils.Objects.GetValue,OS=Phaser.Utils.Objects.IsPlainObject,ES=Phaser.Math.Clamp,MS=Phaser.Math.Snap.To;class DS extends(oc(pm)){constructor(t,e){super(t,e),this.type="rexSlider",this.bootProgressBase(e),this.reverseAxis=_S(e,"reverseAxis",!1);var i=_S(e,"background",void 0),s=_S(e,"track",void 0),r=_S(e,"indicator",void 0),n=_S(e,"thumb",void 0);if(i&&(OS(i)&&(i=qx(t,i)),this.addBackground(i)),s&&(OS(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&&(OS(r)&&(r=qx(t,r)),this.pin(r)),n){OS(n)&&(n=qx(t,n)),this.pin(n);var a=_S(e,"thumbOffsetX",0),o=_S(e,"thumbOffsetY",0);this.setThumbOffset(a,o)}var h=_S(e,"input",0);switch("string"==typeof h&&(h=LS[h]),h){case 0:n&&(n.setInteractive(),this.scene.input.setDraggable(n),n.on("drag",lS,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",cS,this).on("pointermove",cS,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(_S(e,"enable",void 0)),this.setGap(_S(e,"gap",void 0)),this.setValue(_S(e,"value",0),_S(e,"min",void 0),_S(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}setThumbOffset(t,e){return this.thumbOffsetX=t,this.thumbOffsetY=e,this}get value(){return this._value}set value(t){void 0!==this.gap&&(t=MS(t,this.gap));var e=this._value;this._value=ES(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 AS={getStartPoint:function(t){if(void 0===t&&(t=mS),this.childrenMap.thumb){var e=0===this.orientation?fS:vS;pS.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=xS),this.childrenMap.thumb){var e=0===this.orientation?yS:bS;pS.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=CS),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=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;vp(e,i,s),r=n?0===this.orientation?TS:PS:0===this.orientation?SS:wS,Fd(e,this,r),this.resetChildPositionState(e)}};Object.assign(DS.prototype,AS);const RS=Phaser.Utils.Objects.GetValue;class BS extends pm{constructor(t,e){super(t,e),this.type="rexScrollBar";var i,s=RS(e,"background",void 0),r=RS(e,"buttons",void 0),n=RS(r,"top",RS(r,"left",void 0)),a=RS(r,"bottom",RS(r,"right",void 0)),o=RS(e,"slider",void 0);(s&&this.addBackground(s),n)&&(this.add(n),new mf(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===RS(o,"width",void 0)?1:0;else h=void 0===RS(o,"height",void 0)?1:0;i=new DS(t,o),t.add.existing(i),this.add(i,{proportion:h})}a&&(this.add(a),new mf(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=RS(e,"valuechangeCallback",null);if(null!==u){var c=RS(e,"valuechangeCallbackScope",void 0);this.on("valuechange",u,c)}this.setEnable(RS(e,"enable",void 0)),this.setValue(RS(e,"value",0)),this.setScrollStep(RS(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}}class FS extends yg{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 IS=Phaser.Utils.Objects.GetValue,jS=Phaser.Math.Distance.Between;class zS extends zn{constructor(t,e){super(t,e),this._enable=void 0,this.rectBoundsInteractive=IS(e,"rectBoundsInteractive",!1),this.rectBoundsInteractive||t.setInteractive(IS(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(IS(t,"enable",!0)),this.holdThreshold=IS(t,"holdThreshold",50),this.pointerOutReleaseEnable=IS(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:jS(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&&!$g(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&&!$g(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 NS=Phaser.Utils.Objects.GetValue;class GS{constructor(t){this.resetFromJSON(t)}resetFromJSON(t){return this.setValue(NS(t,"value",0)),this.setSpeed(NS(t,"speed",0)),this.setAcceleration(NS(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 GS}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},$S=Phaser.Utils.Objects.GetValue;class US extends zn{constructor(t,e){switch(super(t,e),this.parent!==this.scene?this.focusMode=$S(e,"focus",!0):this.focusMode=!1,"boolean"==typeof this.focusMode&&(this.focusMode=this.focusMode?1:0),this.setSpeed($S(e,"speed",.1)),this.setEnable($S(e,"enable",!0)),this.focusMode){case 0:case 2:this.scene.input.on("wheel",this.onSceneScroll,this);break;default:t.setInteractive($S(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||$g(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 qS=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=co(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);var p=KS(r,"position",0);"string"==typeof p&&(p=JS[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[`adaptThumb${i}SizeMode`]=KS(r,"adaptThumbSize",!1),t[`minThumb${i}Size`]=KS(r,"minThumbSize",void 0)}else t[`hideUnscrollableSlider${i}`]=!1,t[`adaptThumb${i}SizeMode`]=!1,t[`minThumb${i}Size`]=void 0;var m,y,b=KS(s,"scrollDetectionMode");"string"==typeof b&&(b=ZS[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 XS(h,m),h.isRexContainerLite&&h.sendChildToBack(h));var k,C,S,w,T,P=KS(s,o?`mouseWheelScroller${i}`:"mouseWheelScroller",!1);(P&&h&&(void 0!==b&&(P.focus=1===b?2:0),k=new US(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.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 JS={right:0,left:1,bottom:0,top:1},ZS={gameObject:0,rectBounds:1},QS=Phaser.Utils.Objects.GetValue;var tw=function(t,e){var i=t.scene,s=[0,1,0],r=[0,1,0],n=QS(e,"width"),a=QS(e,"height");n||(QS(e,"child.expandWidth",!0)||(s[1]=0));a||(QS(e,"child.expandHeight",!0)||(r[1]=0));var o=new nS(i,{column:3,row:3,columnProportions:s,rowProportions:r});switch(function(t,e,i){var s=aS(i,"child"),r=aS(s,"gameObject",void 0);if(r){var n=aS(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=aS(n,"top",0),a.bottom=aS(n,"bottom",0),o.left=aS(n,"left",0),o.right=aS(n,"right",0);break;case 1:a.top=aS(n,"left",0),a.bottom=aS(n,"right",0),o.top=aS(n,"top",0),o.bottom=aS(n,"bottom",0);break;default:a.top=aS(n,"top",0),a.bottom=aS(n,"bottom",0),a.left=aS(n,"left",0),a.right=aS(n,"right",0)}e.add(r,{column:1,row:1,align:aS(s,"align","center"),padding:o,expand:{width:aS(s,"expandWidth",!0),height:aS(s,"expandHeight",!0)}})}t.addChildrenMap("child",r)}(t,o,e),t.scrollMode){case 0:qS(t,o,"y",e);break;case 1:qS(t,o,"x",e);break;default:qS(t,o,"y",e),qS(t,o,"x",e)}return o},ew=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}`]}if(s){var n="Y"===t?this.scaleY:this.scaleX;s.setBounds(e,i*n)}r&&r.setEnable(e!==i)},iw=function(t){switch(this.scrollMode){case 0:case 1:(e=this.childrenMap.slider)&&this.hideUnscrollableSlider&&this.setChildVisible(e,this.isOverflow);break;default:t=t.toUpperCase();var e=this.childrenMap[`slider${t}`],i=this[`hideUnscrollableSlider${t}`],s=this[`isOverflow${t}`];e&&i&&this.setChildVisible(e,s)}},sw=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 xw=function(t){return t.add.text(0,0,"")};Object.assign(bw.prototype,fw);var kw={setText(t){return this.childrenMap.child.setText(t),this.resizeController(),this},appendText(t){return this.setText(this.text+t),this}},Cw={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 Sw=Phaser.Utils.Objects.GetValue;class ww extends ow{constructor(t,e){void 0===e&&(e={});var i=Sw(e,"text",void 0),s=Sw(e,"textWidth",void 0),r=Sw(e,"textHeight",void 0),n=Sw(e,"textCrop",!!i.setCrop),a=Sw(e,"textMask",!n),o=Sw(e,"content",""),h=new bw(t,{width:s,height:r,text:i,textMask:a,textCrop:n&&!a,content:o,clampTextOY:Sw(e,"clampChildOY",!1),alwaysScrollable:Sw(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=Sw(e,"space",void 0);l&&(l.child=Sw(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(ww.prototype,kw,Cw);const Tw=Phaser.Utils.Objects.GetValue;var Pw=function(t,e,i){e=e?y(e):{};var s=Tw(i,"background",qx),r=Tw(i,"text",_w),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 ww(t,e);return t.add.existing(h),h},_w=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 AC(t,e);break;case"bbcodetext":case"bbcode":s=new EC(t,0,0,"",e);break;case"label":s=new FC(t,e);break;case"textarea":s=Pw(t,e);break;default:s=new Qx(t,e)}return Kx(s,e),t.add.existing(s),s},Ow=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 $x(t,e):new Tx(t,e);break;case"roundRectangle":s=new px(t,e);break;default:s=new Ex(t,e)}return Kx(s,e),t.add.existing(s),s};const Ew=Phaser.Utils.Objects.GetValue;var Mw=function(t,e,i){e=e?y(e):{};var s=Ew(i,"background",qx),r=Ew(i,"text",_w),n=Ew(i,"icon",Ow),a=Ew(i,"action",Ow);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 Dw=Phaser.Utils.Objects.GetValue;var Lw=function(t,e,i){var s,r,n=Dw(i,"innerBackground",qx),a=Dw(i,"separator",qx),o=Dw(i,"title",_w);null!==e.innerBackground&&n&&(s=n(t,e.innerBackground)),null!==e.separator&&a&&(r=a(t,e.separator)),e=Mw(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 Aw extends Ub{constructor(t,e,i){super(t,e=Lw(t,e,i))}}var Rw={start:function(t){return this.easeValueTask||(this.easeValueTask=new ll(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 Fw extends ql{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(Fw.prototype,Rw);const Iw=Phaser.Math.DegToRad,jw=Phaser.Math.Linear,zw=Phaser.Math.Easing.Expo.In,Nw={right:0,down:1,left:2,up:3};var Gw=function(t,e,i,s,r,n,a,o,h,l,u){var c=Vw(e,0,s,r,n,a,o,h,l,u);t.startAt(c.x,c.y);var d=Vw(i,0,s,r,n,a,o,h,l,u);t.lineTo(d.x,d.y);var p=Vw(i,i,s,r,n,a,o,h,l,u);t.lineTo(p.x,p.y);var g=Vw(0,i,s,r,n,a,o,h,l,u);t.lineTo(g.x,g.y);var f=Vw(0,e,s,r,n,a,o,h,l,u);t.lineTo(f.x,f.y);var v=Vw(e,e,s,r,n,a,o,h,l,u);t.lineTo(v.x,v.y),t.close()},Ww={},Vw=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},Yw={setDirection(t){return"string"==typeof t&&(t=Nw[t]),this.direction=t,this},buildShapes(){for(var t=0;t<3;t++)this.addShape(new Fu)},updateShapes(){var t,e,i,s,r,n;switch(this.direction){case 1:t=this.centerX,e=this.centerY-this.radius;var a=Iw(315);i=Math.cos(a),s=Math.sin(a);var o=Iw(45);r=Math.cos(o),n=Math.sin(o);break;case 3:t=this.centerX,e=this.centerY+this.radius;a=Iw(135);i=Math.cos(a),s=Math.sin(a);o=Iw(225);r=Math.cos(o),n=Math.sin(o);break;case 2:t=this.centerX+this.radius,e=this.centerY;a=Iw(225);i=Math.cos(a),s=Math.sin(a);o=Iw(315);r=Math.cos(o),n=Math.sin(o);break;default:t=this.centerX-this.radius,e=this.centerY;a=Iw(45);i=Math.cos(a),s=Math.sin(a);o=Iw(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)),(u=this.getSizerConfig(t)).align=i,u.padding=Sl(s),ZT(r)?(u.expandWidth=QT(r,"width",!1),u.expandHeight=QT(r,"height",!1)):(u.expandWidth=r,u.expandHeight=r),t.isRexSizer||(u.expandWidth&&(t.minWidth=void 0===n?zr(t):n),u.expandHeight&&(t.minHeight=void 0===a?Nr(t):a)),u.alignOffsetX=o,u.alignOffsetY=h,u.aspectRatio=l,this.sizerChildren.hasOwnProperty(e)&&this.sizerChildren[e].destroy(),this.sizerChildren[e]=t,c&&this.addChildrenMap(e,t),this}},sP={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 tm.call(this,t),this}},rP={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=this.innerLeft,c=this.innerTop,d=this.innerWidth,p=this.innerHeight,g=this.sizerChildren;for(var f in g)(t=g[f]).rexSizer.hidden||(i=(e=t.rexSizer).padding,Qg.call(this,t),o=this.getExpandedChildWidth(t),h=this.getExpandedChildHeight(t),e.aspectRatio>0&&(qT.width=e.aspectRatio,qT.height=1,JT.width=o,JT.height=h,o=(l=ul(qT,JT,"FIT",!0)).width,h=l.height),t.isRexSizer?(t.runLayout(this,o,h),Gv(t,this)):vp(t,o,h),s=u+i.left*this.scaleX,n=d-(i.left+i.right)*this.scaleX,r=c+i.top*this.scaleY,a=p-(i.top+i.bottom)*this.scaleY,tf.call(this,t,s,r,n,a,e.align,e.alignOffsetX,e.alignOffsetY))}};Object.assign(rP,iP,sP);const nP=Phaser.Utils.Objects.IsPlainObject,aP=Phaser.Utils.Objects.GetValue;class oP extends Nv{constructor(t,e,i,s,r,n){nP(e)?(e=aP(n=e,"x",0),i=aP(n,"y",0),s=aP(n,"width",void 0),r=aP(n,"height",void 0)):nP(s)&&(s=aP(n=s,"width",void 0),r=aP(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(oP.prototype,rP);const hP=pm.prototype.add,lP=pm.prototype.addSpace;var uP=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)&&lP.call(this),hP.call(this,t,{proportion:i,expand:!0});var s=!this.buttonsExpand&&"center"===this.buttonsAlign;s&&lP.call(this),this.hasTailSpace=s}else hP.call(this,t,{proportion:i,expand:!0}),this.hasTailSpace=!1;else if(this.hasTailSpace){var r=this.sizerChildren.length-1;hP.call(this,t,{index:r,proportion:i,expand:!0})}else hP.call(this,t,{proportion:i,expand:!0});return e&&this.buttonGroup.add(t),this},cP={addButton(t){if(Ug(t))for(var e=t,i=0,s=e.length;i=0;i--)gP.call(this,e[i],t);return this}},vP=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)}},mP=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,vP.call(e,t,i,s)}},enumerable:!0,configurable:!0}),t.selected=!1},yP={add(t){return this.buttons.push(t),t._click||(t._click=new nf(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`),mP.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=LP(o.left,o.centerY,t,e))&&(r=h,s=n);var h,l=i[n+1];if(!l||l.y!==o.y)r>(h=LP(o.right,o.centerY,t,e))&&(r=h,s=n+1)}}return s};const RP=Phaser.Utils.Objects.IsPlainObject,BP=Phaser.Utils.Objects.GetValue,FP=Phaser.Display.Align.CENTER;var IP=function(t,e,i,s){if("\n"===t)return this.addNewLine(),this;var r;(Vd.call(this,t),RP(e))&&(e=BP(r=e,"padding",0),i=BP(r,"key",void 0),s=BP(r,"index",void 0));return void 0===e&&(e=0),(r=this.getSizerConfig(t)).align=FP,r.padding=Sl(e),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},jP={add(t,e,i){if(Ug(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,tm.call(this,t),this}},GP={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&&UP.addNewLine(this)}else for(n=0,a=t.length;n=0;i--)QP.call(this,e[i],t);return this}};const e_=Phaser.Utils.Objects.GetValue;class i_ extends HP{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 TP({parent:this,eventEmitter:e_(e,"eventEmitter",this),groupName:e_(e,"groupName",void 0),clickConfig:e_(e,"click",void 0)}).setButtonsType(e);var s=e_(e,"background",void 0),r=e_(e,"buttons",void 0);this.buttonsAlign=e_(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(i_.prototype,qP,t_,wP,_P);const s_=nS.prototype.add;var r_={addButton(t,e,i){return s_.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--)o_.call(this,e[i],t);return this}};const l_=Phaser.Utils.Objects.GetValue;class u_ extends nS{constructor(t,e){void 0===e&&(e={});var i=l_(e,"row",0),s=l_(e,"column",e.col||0),r=l_(e,"createCellContainerCallback"),n=l_(e,"buttons",void 0),a=l_(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)):(aO(this),oO(this)),this}setNumberInput(){return this.onUpdateCallback=nO,this}setSelectAllWhenFocusEnable(t){return void 0===t&&(t=!0),this.selectAllWhenFocus=t,this}setRequestCursorPosition(t){return this.isOpened?(this.requestCursorPosition=t,this):this}}const uO=Phaser.Utils.Objects.GetValue,cO=["inputType","onOpen","clickOutSideTarget","onFocus","onClose","onBlur","onUpdate","enterClose","readOnly","maxLength","minLength","selectAll"];var dO=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)},pO=function(t){fr(t)||this.setCursorStyle(t).on("cursorin",(function(t){var e=this.cursorStyle,i=ox(t.style,e);wl(e,i)||(t.styleSave=i,t.modifyStyle(e))}),this).on("cursorout",(function(t){t.styleSave&&(t.modifyStyle(t.styleSave),t.styleSave=void 0)}),this)},gO=function(t){fr(t)||this.setFocusStyle(t).on("open",(function(){var t=this.background,e=this.focusStyle,i=ox(t,e);wl(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 fO(){}function vO(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}fO.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(vO(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 mO=new fO;const yO=/^[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,bO=/\S/,xO=new fO;xO.equals=function(t,e){return this.options.ignoreCase&&(t=t.toLowerCase(),e=e.toLowerCase()),t===e||this.options.ignoreWhitespace&&!bO.test(t)&&!bO.test(e)},xO.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(wO(t,null,null,i),i," ")},SO.equals=function(t,e){return fO.prototype.equals.call(SO,t.replace(/,([\r\n])/g,"$1"),e.replace(/,([\r\n])/g,"$1"))};const TO=new fO;TO.tokenize=function(t){return t.slice()},TO.join=TO.removeEmpty=function(t){return t};const PO=Phaser.Utils.Array.Remove;var _O=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,mO.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},LO={cursorMoveLeft(){if(!this.isOpened)return this;var t=EO(this.cursorPosition-1,0,this.inputText.length);return this.setCursorPosition(t),this},cursorMoveRight(){if(!this.isOpened)return this;var t=EO(this.cursorPosition+1,0,this.inputText.length);return this.setCursorPosition(t),this},cursorMoveUp(){if(!this.isOpened)return this;var t=MO(this.characterCountOfLines,this.cursorPosition);t.lineIndex-=1;var e=EO(DO(this.characterCountOfLines,t),0,this.inputText.length);return this.setCursorPosition(e),this},cursorMoveDown(){if(!this.isOpened)return this;var t=MO(this.characterCountOfLines,this.cursorPosition);t.lineIndex+=1;var e=EO(DO(this.characterCountOfLines,t),0,this.inputText.length);return this.setCursorPosition(e),this}};const AO=Phaser.Utils.Objects.IsPlainObject;class RO extends Fb{constructor(t,e,i,s,r,n){AO(e)?n=e:AO(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=ax(n.background,"focus"),h=ax(n.style,"cursor");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=uO(e,"edit");return void 0===i&&(i={}),H_(e,i,cO),new lO(t,i)}(this,n),dO.call(this),n.focusStyle&&Object.assign(o,n.focusStyle),gO.call(this,o),n.cursorStyle&&Object.assign(h,n.cursorStyle),pO.call(this,h);var l=n.onAddChar;l&&this.on("addchar",l);var u=n.onCursorOut;u&&this.on("cursorout",u);var c=n.onCursorIn;c&&this.on("cursorin",c);var d,p=n.onMoveCursor;p&&this.on("movecursor",p),this.setParseTextCallback(n.parseTextCallback),this.lastInsertCursor=((d=this.createCharChild("|")).text="",d),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 Kx(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 BT(t,e);return Kx(i,e),t.add.existing(i),i},y=!0);var b,x,k=new Aw(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)),Tc(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=IT[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=IT[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}}(zT(e,`styles.${qo}`,{}),{viewport:i},r);t.addGameObjectManager({name:qo,createGameObject:s,fade:0,viewportCoordinate:{viewport:i},defaultLayer:Lo,commands:{typing:Ac,shake:Pc}})}},function(t,e){var{viewport:i}=e,s=Oc(e,`creators.${Uo}`,void 0);if(!1!==s){if(Ec(s)&&(s=void 0),void 0===s){Oc(e,`styles.${Uo}`,{});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),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 Tc(s),s}}(0,{viewport:i})}t.addGameObjectManager({name:Uo,createGameObject:s,fade:0,viewportCoordinate:{viewport:i},defaultLayer:Mo,commands:{cross:_c,shake:Pc}})}},function(t,e){var{viewport:i}=e,s=I_(e,`creators.${Zo}`,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=.5,vpy:l=.5}={}){void 0!==r&&(a=e.width*r),void 0!==n&&(o=e.height*n);var u=new B_(s,t,i);return u.setMinSize(a,o).setVisible(!1),s.add.existing(u),wr(u,e),u.vpx=h,u.vpy=l,Tc(u),u}}(I_(e,`styles.${Zo}`,{}),{viewport:i},r);t.addGameObjectManager({name:Zo,createGameObject:s,fade:0,viewportCoordinate:{viewport:i},defaultLayer:Lo,commands:{choice:F_,shake:Pc}})}},function(t,e){var{viewport:i}=e,s=GO(e,`creators.${Qo}`,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 zO(s,t,i);return u.setMinSize(a,o).setVisible(!1),s.add.existing(u),wr(u,e),u.vpx=h,u.vpy=l,Tc(u),u}}(GO(e,`styles.${Qo}`,{}),{viewport:i},r);t.addGameObjectManager({name:Qo,createGameObject:s,fade:0,viewportCoordinate:{viewport:i},defaultLayer:Lo,commands:{input:NO,shake:Pc}})}},function(t,e){var{viewport:i}=e,s=UT(e,`creators.${Jo}`,void 0);if(!1!==s){var r;if(KT(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 Kx(i,e),i.setOrigin(.5,1),t.add.existing(i),i});var b,x,k=new GT(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,Tc(k),k}}(UT(e,`styles.${Jo}`,{}),{viewport:i},r);t.addGameObjectManager({name:Jo,createGameObject:s,fade:0,viewportCoordinate:{viewport:i},defaultLayer:Lo,commands:{setText:VT,popUp:YT,shake:Pc}})}}];var YO=[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))}))}],XO={$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},HO=function(t,e){var i=co(t);for(var s in e)i.hasOwnProperty(s)||(i[s]=e[s]);return i};class $O 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=ln(t,t.cameras.main));for(var a=new Eo(t,{layers:r?Wo:Vo,layerDepth:i,rootLayer:s}),o=0,h=VO.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=sE(r,"x",null);null!==n?(t=n,i=n):(t=sE(r,"left",0),i=sE(r,"right",t));var a=sE(r,"y",null);null!==a?(e=a,s=a):(e=sE(r,"top",0),s=sE(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 aE(this.verticeRotation)}set verticeAngle(t){this.verticeRotation=nE(t)}setVerticeAngle(t){return this.verticeAngle=t,this}}const hE={right:0,down:1,left:2,up:3};var lE=function(t){return"string"==typeof t&&(t=hE[t]),t%=4};Object.assign(oE.prototype,eE,iE);class uE extends qO{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexTweaker.FolderTitle";var i=new oE(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 cE=function(t,e,i){return qx(t,HO(e,i))};class dE extends Pg{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 pE={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}},gE=function(t,e){Rp.popUp.call(t,e,this.expandDirection)},fE=function(t,e){Rp.scaleDown.call(t,e,this.expandDirection)},vE={setTransitionDuration(t){return this.transitionDuration=t,this.childTransition.setTransitInTime(t).setTransitOutTime(t),this},setExpandCallback(t){return void 0===t&&(t=gE.bind(this)),this.childTransition.setTransitInCallback(t),this},setCollapseCallback(t){return void 0===t&&(t=fE.bind(this)),this.childTransition.setTransitOutCallback(t),this}};const mE=Phaser.Utils.Objects.GetValue;let yE=class extends pm{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=mE(e,"space"),a=1===this.orientation?"left":"top",o=mE(e,"align.title",a),h=mE(e,"expand.title",!0);this.add(s,{proportion:0,align:o,expand:h,padding:{left:mE(n,"titleLeft",0),right:mE(n,"titleRight",0),top:mE(n,"titleTop",0),bottom:mE(n,"titleBottom",0)}});var l=mE(e,"toggleByTarget",void 0),u=mE(e,"toggleClickConfig");if(void 0===l&&(l=s),l&&of.onClick.call(l,(function(){this.toggle()}),this,u),this.childTransition=new dE(r),!mE(e,"customChildOrigin",!1)){var c=this.rtl?1:0;r.setOrigin(c)}o=mE(e,"align.child","left");var d=(h=mE(e,"expand.child",!0))?1:0;this.add(r,{proportion:d,align:o,expand:h,padding:{left:mE(n,"childLeft",0),right:mE(n,"childRight",0),top:mE(n,"childTop",0),bottom:mE(n,"childBottom",0)}}),this.addChildrenMap("title",s),this.addChildrenMap("child",r),this.addChildrenMap("background",i);var p=e.transition;this.setTransitionDuration(mE(p,"duration",200)),this.setExpandCallback(mE(p,"expandCallback",void 0)),this.setCollapseCallback(mE(p,"collapseCallback",void 0)),this.reLayoutTarget=mE(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=mE(e,"expanded",void 0);void 0!==y&&this.setExpandedState(y)}};Object.assign(yE.prototype,pE,vE);var bE={setBindingTarget(t){return this.childrenMap.child.setBindingTarget(t),this}},xE={getMaxInputRowTitleWidth(){return this.childrenMap.child.getMaxInputRowTitleWidth()+this.getInnerPadding("left")},setInputRowTitleWidth(t){return t-=this.getInnerPadding("left"),this.childrenMap.child.setInputRowTitleWidth(t),this}};class kE extends yE{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(kE.prototype,bE,xE);const CE=Phaser.Utils.Objects.GetValue;const SE=Phaser.Utils.Objects.GetValue;const wE=oP.prototype.add;var TE=function(t,e,i,s,r,n,a,o,h){return t.setVisible(!1),wE.call(this,t,e,i,s,r,n,a,o,h),this},PE={add:TE,addPage:TE};const _E=nl.prototype.setChildVisible;var OE={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?(_E.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&&(_E.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(OE,PE);const EE=Phaser.Utils.Objects.GetValue;class ME extends oP{constructor(t,e){super(t,e),this.type="rexPages",this.childrenMap=this.sizerChildren,this._previousKey=void 0,this._currentKey=void 0,this.setSwapMode(EE(e,"swapMode",0)),this.setFadeInDuration(EE(e,"fadeIn",0))}setSwapMode(t){return"string"==typeof t&&(t=DE[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(ME.prototype,OE);const DE={invisible:0,destroy:1};const LE=Phaser.Utils.Objects.IsPlainObject,AE=Phaser.Utils.Objects.GetValue,RE=Phaser.Utils.String.UUID;var BE={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}},FE={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}},IE={top:1,left:3,right:5,bottom:7},jE={top:"bottom",left:"right",right:"left",bottom:"top"},zE={setTabsPadding(t,e){return this.childrenMap.tabs.setOuterPadding(t,e),this},getTabsPadding(t){return this.childrenMap.tabs.getOuterPadding(t)}},NE={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 sM=Phaser.Utils.Objects.GetValue;class rM extends pm{constructor(t,e){void 0===e&&(e={}),e.orientation="y",super(t,e),this.type="rexTweaker.Wrap";var i=sM(e,"background",void 0),s=sM(e,"title",void 0);i&&this.addBackground(i),s&&this.add(s,{expand:!0,space:{bottom:sM(e,"space.title",0)}});var r=sM(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(rM.prototype,eM,iM);const nM=Phaser.Utils.Objects.GetValue;const aM=Phaser.Utils.Objects.GetValue;var oM=function(t){return t.hasOwnProperty("geometryMask")?t.geometryMask:t.bitmapMask};const hM=Phaser.Geom.Intersects.RectangleToRectangle,lM=Phaser.Geom.Rectangle.Overlaps;var uM=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}},cM=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},dM=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))},pM=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 fM=Phaser.Utils.Objects.GetValue,vM={update:0,everyTick:1};var mM={setupChildrenMask(t){return!1===t||(this.setMaskUpdateMode(fM(t,"updateMode",0)),this.enableChildrenMask(fM(t,"padding",0)),this.setMaskLayer(fM(t,"layer",void 0)),this.onMaskGameObjectVisible=fM(t,"onVisivle"),this.onMaskGameObjectInvisible=fM(t,"onInvisible"),this.maskGameObjectCallbackScope=fM(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=vM[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=ym.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=oM(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(CM.prototype,yM);const SM=["top","bottom","centerY","center"],wM=["left","right","centerX","center"];var TM=function(t,e,i){var s,r="Y"===(e=e.toUpperCase()),n=this.childrenMap.child;if(r){if(i)for(var a=0,o=SM.length;a=0?0:Math.abs(l)<=Math.abs(u)?l:u}}else{if(i)for(a=0,o=wM.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 PM=Phaser.Utils.Objects.GetValue;class _M extends ow{constructor(t,e){void 0===e&&(e={});var i=zC(e),s=PM(e,"panel",void 0);void 0===s&&(s={}),s.scrollMode=i,s.clampChildOY=PM(e,"clampChildOY",!1),s.clampChildOX=PM(e,"clampChildOX",!1);var r,n,a=new CM(t,s);switch(t.add.existing(a),i){case 0:r=PM(e,"expand.panel",!0),n=!0;break;case 1:r=!0,n=PM(e,"expand.panel",!0);break;default:r=!0,n=!0}e.type="rexScrollablePanel",e.child={gameObject:a,expandWidth:r,expandHeight:n,align:PM(e,"align.panel","center")};var o=PM(e,"space",void 0);o&&(o.child=PM(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]),Iv(this.childrenMap.child,t),this}}var OM={scrollToChild:function(t,e){if(!this.hasChild(t))return this;switch(this.scrollMode){case 0:TM.call(this,t,"y",e);break;case 1:TM.call(this,t,"x",e);break;default:TM.call(this,t,"y",e),TM.call(this,t,"x",e)}return this}};Object.assign(_M.prototype,OM);var EM={setBindingTarget(t){return this.childrenMap.panel.setBindingTarget(t),this}},MM={getMaxInputRowTitleWidth(){return this.childrenMap.panel.getMaxInputRowTitleWidth()+this.getInnerPadding("left")},setInputRowTitleWidth(t){return t-=this.getInnerPadding("left"),this.childrenMap.panel.setInputRowTitleWidth(t),this}};class DM extends _M{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(DM.prototype,EM,MM);const LM=Phaser.Utils.Objects.GetValue;const AM=Phaser.Utils.Objects.GetValue;const RM=Phaser.Utils.Objects.GetValue;var BM={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=RM(t,"onGetValue"),this.onSetValue=RM(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}},FM={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)}}},IM={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 jM=Phaser.Utils.Objects.GetValue;class zM extends pm{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=jM(e,"proportion.title",0),o=jM(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=jM(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(zM.prototype,BM,FM,IM);var NM=function(t,e,i){var s=new qO(t,i);return t.add.existing(s),s},GM=function(t){void 0===t&&(t=pm);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}}},WM=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=UM(this.styles,"inputRow")||{},r=$M(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 qx(t,HO(e,i))}(this.scene,t,KM(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),qM(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=FO(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))}},eD={setText(t){return this.childrenMap.child.setText(t),this},appendText(t){return this.setText(this.text+t),this}},iD={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 sD=Phaser.Utils.Objects.GetValue;class rD extends ow{constructor(t,e){void 0===e&&(e={});var i,s=sD(e,"text");gn(s)?i=s:(void 0===s&&(s={}),s.textArea=!0,i=new RO(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=sD(e,"space",void 0);h&&(h.child=sD(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=sD(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(rD.prototype,eD,iD);var nD={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 rD(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()}},aD={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=FO(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 oD=Phaser.Utils.Objects.GetValue,hD=Phaser.Math.Linear,lD=Phaser.Math.Snap.Floor;var uD={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=oD(s,r),a=function(t,e){var i=new DS(t,e);return t.add.existing(i),i}(i,s),o=e.defaultExpandWidth?2:0,h=oD(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=FO(i,u).setNumberInput();o=e.defaultExpandWidth?1:0,h=oD(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=hD(t.minValue,t.maxValue,a.value);t.step&&(e=lD(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))}},cD=function(t,e){var i=new EP(t,e);return t.add.existing(i),i};const dD=Phaser.Utils.Objects.GetValue;var pD={name:"RangeInput",accept:t=>!!t.hasOwnProperty("view")&&"incdec"===t.view,build(t,e){var i=t.scene;t.type="rexTweaker.IncDecInput";var s=dD(e,"incDec")||{},r={text:null,action:null},n=cD(i,{expand:!1}),a=e.defaultExpandWidth?1:0;t.add(n,{proportion:a,expand:!0});var o=e.inputNumber||e.inputText,h=FO(i,o).setNumberInput();h.on("close",(function(){t.setValue(h.value)}));var l=Object.assign(y(r),s.incButton||{}),u=b_(i,l),c=Object.assign(y(r),s.decButton||{}),d=b_(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 aL(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 hL=Phaser.Utils.Objects.GetValue;var lL=function(t,e){var i=hL(e,"expandDirection",void 0);"string"==typeof i&&(i=uL[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=hL(e,"alignTargetY",u),d=hL(e,"alignOffsetX",0),p=hL(e,"alignOffsetY",0),g=hL(e,"alignSide","").includes("right"),f=hL(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=ln(t.scene)),m&&t.getBottomLeft().y>x.bottom&&(l=c.getTopLeft().y,t.setOrigin(0,1).setPosition(h+d,l+p))};const uL={down:0,up:1},cL=Phaser.Utils.Objects.GetValue;class dL extends Pg{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=function(t,e){Op(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 Pp(t,n):r.resetFromJSON(n),r.restart()}(t,e,"y","Linear")}),e.manualClose=!0,e.clickOutsideClose=!0,e.destroy=!0,super(t,e),lL(t,e),t.isRexSizer&&t.layout();var i=cL(e,"touchOutsideClose",!1),s=cL(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&&Ig(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 pL={openColorPicker:function(){if(!this.colorPicker){var t=oL.call(this).layout(),e=new dL(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(pL,_D);const gL=Phaser.Utils.Objects.GetValue;class fL extends PD{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(gL(i,"width",160),gL(i,"height",170));var n=gL(i,"background");r=n?function(t){return qx(t,n)}:gL(i,"createBackgroundCallback"),this.setCreateColorPickerBackgroundCallback(r),this.setColorPickerHPalettePosition(gL(i,"hPalettePosition",0)),this.setColorPickerExpandDirection(gL(i,"expandDirection")),this.setColorPickerEaseInDuration(gL(i,"easeIn",200)),this.setColorPickerEaseOutDuration(gL(i,"easeOut",200)),this.setColorPickerTransitInCallback(gL(i,"transitIn")),this.setColorPickerTransitOutCallback(gL(i,"transitOut")),this.setColorPickerBounds(gL(i,"bounds"));var a=gL(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(gL(o,"height",30)),this.setColorComponentsFormatLabelConfig(gL(o,"formatLabel"));var h=gL(o,"inputText");h||(h=gL(e,"inputText")),this.setColorComponentsInputTextConfig(h);var l=gL(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(fL.prototype,pL);var vL={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 fL(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)}},mL={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}},yL={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}},bL={buildShapes(){this.addShape((new zu).setName("box")).addShape((new Fu).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)}},xL={setCheckerAnimationDuration(t){return void 0===t&&(t=0),this.checkerAnimDuration=t,this},playCheckerAnimation(){return void 0===this.checkerAnimProgressTask&&(this.checkerAnimProgressTask=new ll(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}},kL={};Object.assign(kL,mL,yL,bL,xL);const CL=23730,SL=Phaser.Utils.Objects.GetValue,wL=Phaser.Utils.Objects.IsPlainObject;class TL extends ql{constructor(t,e,i,s,r,n,a){wL(e)?(e=SL(a=e,"x",0),i=SL(a,"y",0),s=SL(a,"width",2),r=SL(a,"height",2),n=SL(a,"color",CL)):wL(n)&&(n=SL(a=n,"color",CL)),super(t,e,i,s,r),this.type="rexCheckbox",void 0===n&&(n=CL),this.setBoxShape(SL(a,"circleBox",!1)),this.setBoxFillStyle(n,SL(a,"boxFillAlpha",1)),this.setUncheckedBoxFillStyle(SL(a,"uncheckedColor",null),SL(a,"uncheckedBoxFillAlpha",1)),this.setBoxStrokeStyle(SL(a,"boxLineWidth",4),SL(a,"boxStrokeColor",n),SL(a,"boxStrokeAlpha",1)),this.setUncheckedBoxStrokeStyle(this.boxLineWidth,SL(a,"uncheckedBoxStrokeColor",this.boxStrokeColor),SL(a,"uncheckedBoxStrokeAlpha",this.boxStrokeAlpha)),this.setCheckerStyle(SL(a,"checkerColor",16777215),SL(a,"checkerAlpha",1)),this.setBoxSize(SL(a,"boxSize",1)),this.setCheckerSize(SL(a,"checkerSize",1)),this.setCheckerAnimationDuration(SL(a,"animationDuration",150)),this.buildShapes();var o=SL(a,"checked");void 0===o&&(o=SL(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(TL.prototype,kL);const PL=Phaser.Utils.Objects.GetValue,_L=Phaser.Utils.Objects.IsPlainObject;class OL extends TL{constructor(t,e,i,s,r,n,a){_L(e)?(e=PL(a=e,"x",0),i=PL(a,"y",0),s=PL(a,"width",2),r=PL(a,"height",2),n=PL(a,"color",CL)):_L(n)&&(n=PL(a=n,"color",CL)),super(t,e,i,s,r,n,a),this._click=new nf(this,PL(a,"click")),this._click.on("click",(function(){this.toggleValue()}),this),this.setReadOnly(PL(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 EL={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 OL(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)}},ML={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}},DL={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}},LL={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}},AL=function(t,e,i){return(e-t)*i+t};const RL=Phaser.Math.Linear;var BL={buildShapes(){this.addShape((new zu).setName("track")).addShape((new zu).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&AL(yr(l),yr(u),c))<<16|(255&AL(br(l),br(u),c))<<8|255&AL(xr(l),xr(u),c)),p=RL(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=RL(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)}},FL={setToggleAnimationDuration(t){return void 0===t&&(t=0),this.toggleAnimDuration=t,this},playToggleAnimation(){return void 0===this.toggleAnimProgressTask&&(this.toggleAnimProgressTask=new ll(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}},IL={};Object.assign(IL,ML,DL,LL,BL,FL);const jL=Phaser.Utils.Objects.GetValue,zL=Phaser.Utils.Objects.IsPlainObject,NL=23730;class GL extends ql{constructor(t,e,i,s,r,n,a){zL(e)?(e=jL(a=e,"x",0),i=jL(a,"y",0),s=jL(a,"width",2),r=jL(a,"height",2),n=jL(a,"color",NL)):zL(n)&&(n=jL(a=n,"color",NL)),super(t,e,i,s,r),this.type="rexToggleSwitch",void 0===n&&(n=NL),this.setTrackFillStyle(n,jL(a,"trackFillAlpha",1)),this.setFalseValueTrackFillStyle(jL(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)),jL(a,"falseValueTrackFillAlpha",1)),this.setThumbStyle(jL(a,"thumbColor",16777215),jL(a,"thumbAlpha",1)),this.setTrackSize(jL(a,"trackWidth",.9),jL(a,"trackHeight",.5)),this.setTrackRadius(jL(a,"trackRadius",.5*this.trackHeight));var o=jL(a,"thumbHeight",void 0),h=jL(a,"thumbWidth",o);void 0===h&&(h=.9*this.trackHeight),this.setThumbSize(h,o),this.setThumbRadius(jL(a,"thumbRadius",.5*this.thumbHeight)),this.setThumbPosition(jL(a,"thumbLeft",.3),jL(a,"thumbRight",void 0)),this.setRTL(jL(a,"rtl",!1)),this.setToggleAnimationDuration(jL(a,"animationDuration",150)),this.buildShapes(),this.setValue(jL(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(GL.prototype,IL);const WL=Phaser.Utils.Objects.GetValue;class VL extends GL{constructor(t,e,i,s,r,n,a){super(t,e,i,s,r,n,a),this._click=new nf(this,WL(a,"click")),this._click.on("click",(function(){this.toggleValue()}),this),this.setReadOnly(WL(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 YL={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 VL(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)}},XL={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=HL[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 HL={down:0,up:1},$L=Phaser.Utils.Objects.GetValue;var UL=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=KL(e,d);if(this.listMaxHeight>0&&(s.layout(),s.height<=this.listMaxHeight&&(u=s)),!u){0===c&&(c=this.listMaxHeight);var p=qL(e,this.listCreateSliderTrackCallback),g=qL(e,this.listCreateSliderThumbCallback);u=new _M(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:$L(this.listSpace,"panel",0)}}),e.add.existing(u)}}else d.height=c,s=KL(e,d),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},KL=function(t,e,i){var s;return i?(e.orientation="x",s=new i_(t,e)):(e.orientation="y",s=new EP(t,e)),t.add.existing(s),s},qL=function(t,e,i){var s;return e&&(s=e.call(i,t),t.add.existing(s)),s},JL={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}},ZL={openListPanel:function(){if(this.listPanel)return this;if(0===this.options.length)return this;var t,e=UL.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 dL(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(ZL,XL,JL);const QL=Phaser.Utils.Objects.GetValue;class tA extends BC{constructor(t,e){super(t,e),this.type="rexDropDownList",this.timer=void 0,this.listPanel=void 0,this.currentOverIndex=void 0,this.setOptions(QL(e,"options"));var i=QL(e,"list");this.setWrapEnable(QL(i,"wrap",!1)),this.setCreateButtonCallback(QL(i,"createButtonCallback")),this.setCreateListBackgroundCallback(QL(i,"createBackgroundCallback")),this.setCreateListSliderTrackCallback(QL(i,"createTrackCallback")),this.setCreateListSliderThumbCallback(QL(i,"createThumbCallback")),this.setListSliderAdaptThumbSizeEnable(QL(i,"sliderAdaptThumbSize",!1)),this.setListScrollerConfig(QL(i,"scroller")),this.setListMouseWheelScrollerConfig(QL(i,"mouseWheelScroller")),this.setButtonClickCallback(QL(i,"onButtonClick")),this.setButtonOverCallback(QL(i,"onButtonOver")),this.setButtonOutCallback(QL(i,"onButtonOut")),this.setListExpandDirection(QL(i,"expandDirection")),this.setListEaseInDuration(QL(i,"easeIn",500)),this.setListEaseOutDuration(QL(i,"easeOut",100)),this.setListTransitInCallback(QL(i,"transitIn")),this.settListTransitOutCallback(QL(i,"transitOut")),this.setListMaxHeight(QL(i,"maxHeight",0)),this.setListSize(QL(i,"width"),QL(i,"height",0)),this.setListAlignmentMode(QL(i,"alignParent","text")),this.setListAlignmentSide(QL(i,"alignSide","")),this.setListBounds(QL(i,"bounds")),this.setListSpace(QL(i,"space")),this.setListDraggable(QL(i,"draggable",!1)),this.setValueChangeCallback(QL(e,"setValueCallback"),QL(e,"setValueCallbackScope")),this.setValue(QL(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(tA.prototype,ZL);var eA=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=Mw(t,s,n);o.list=e.list||{},o.list.createButtonCallback=function(t,e){var i=b_(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 qx(t,h)},delete e.track);var l=e.thumb;return l&&(o.list.createThumbCallback=function(t){return qx(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 tA(t,e);return t.add.existing(i),i},iA=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=eA(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=iA(t,e);if(null!=i)return t[i]}(i.options,e);i.resetDisplayContent(s).setMinSize(i.width,i.height).layout().setMinSize(0,0)}};const rA=Phaser.Utils.Objects.GetValue;var nA={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=rA(s,"expand",!0);r&&(s.align="center"),delete s.expand;var n=cD(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 lA={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) && (radius.y > 0)); + }; + var LineTo = function (x, y, pathData) { var cnt = pathData.length; if (cnt >= 2) { @@ -23245,8 +23249,7 @@ geom.setTo(0, 0, width, height, radius); } - var iteration = GetValue$B(radiusConfig, 'iteration', undefined); - this.setIteration(iteration); + this.setIteration(GetValue$B(radiusConfig, 'iteration', undefined)); this.setPosition(x, y); this.setFillStyle(fillColor, fillAlpha); @@ -23499,10 +23502,6 @@ } - var IsArcCorner = function (radius) { - return ((radius.x > 0) && (radius.y > 0)); - }; - const ShapeTypeMap = { rectangle: 0, circle: 1 @@ -25016,6 +25015,7 @@ var skewX = this.skewX; var width = this.width - Math.abs(skewX); var height = this.height; + var trackFill = this.getShape('trackFill'); trackFill.fillStyle(this.trackColor); if (trackFill.isFilled) { @@ -25024,8 +25024,7 @@ 0, 0, // x0, y0 width, height, // x1, y1 skewX // skewX - ) - .close(); + ); } var bar = this.getShape('bar'); @@ -25045,8 +25044,7 @@ barX0, 0, // x0, y0 barX1, height, // x1, y1 skewX // skew - ) - .close(); + ); } var trackStroke = this.getShape('trackStroke'); @@ -25057,8 +25055,7 @@ 0, 0, // x0, y0 width, height, // x1, y1 skewX // skewX - ) - .end(); + ); } }; @@ -25078,6 +25075,8 @@ .lineTo(x0, y0).lineTo(startX, y0); } + lines.close(); + return lines; }; @@ -25088,24 +25087,33 @@ constructor(scene, x, y, width, height, barColor, value, config) { if (IsPlainObject$7(x)) { config = x; - x = GetValue$y(config, 'x', 0); - y = GetValue$y(config, 'y', 0); - width = GetValue$y(config, 'width', 2); - height = GetValue$y(config, 'height', 2); - barColor = GetValue$y(config, 'barColor', undefined); - value = GetValue$y(config, 'value', 0); + + x = config.x; + y = config.y; + width = config.width; + height = config.height; + barColor = config.barColor; + value = config.value; } else if (IsPlainObject$7(width)) { config = width; - width = GetValue$y(config, 'width', 2); - height = GetValue$y(config, 'height', 2); - barColor = GetValue$y(config, 'barColor', undefined); - value = GetValue$y(config, 'value', 0); + + width = config.width; + height = config.height; + barColor = config.barColor; + value = config.value; } else if (IsPlainObject$7(barColor)) { config = barColor; - barColor = GetValue$y(config, 'barColor', undefined); - value = GetValue$y(config, 'value', 0); + + barColor = config.barColor; + value = config.value; } + if (x === undefined) { x = 0; } + if (y === undefined) { y = 0; } + if (width === undefined) { width = 2; } + if (height === undefined) { height = width; } + if (value === undefined) { value = 0; } + super(scene, x, y, width, height, config); this.type = 'rexLineProgress'; diff --git a/dist/rexnameinputdialog.min.js b/dist/rexnameinputdialog.min.js index c33fa7bca5..43ca0ac16a 100644 --- a/dist/rexnameinputdialog.min.js +++ b/dist/rexnameinputdialog.min.js @@ -1,4 +1,4 @@ -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 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}},z={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}},D={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}},Pe=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 _e=function(t,e){return void 0===e?t:t[e]},Ee=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 _e(this.space,t)},setInnerPadding(t,e){return Ee(this.space,t,e),this},getOuterPadding(t){return _e(this.getSizerConfig(this).padding,t)},setOuterPadding(t,e){return Ee(this.getSizerConfig(this).padding,t,e),this},getChildOuterPadding(t,e){return"string"==typeof t&&(t=this.getElement(t)),_e(this.getSizerConfig(t).padding,e)},setChildOuterPadding(t,e,i){return"string"==typeof t&&(t=this.getElement(t)),Ee(this.getSizerConfig(t).padding,e,i),this}},Re=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}},Le=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},De=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},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},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}},Be=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?vi:pi,this.repeatCounter=0,this}stop(){return this.state=ui,this}update(t,e){this.state!==ui&&this.state!==fi&&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=gi)):(this.nowTime=this.duration,this.state=fi):this.nowTime>=0&&(this.state=vi))}get t(){var t;switch(this.state){case ui:case pi:case gi:t=0;break;case vi:t=this.nowTime/this.duration;break;case fi:t=1}return di(t,0,1)}set t(t){(t=di(t,-1,1))<0?(this.state=pi,this.nowTime=-this.delay*t):(this.state=vi,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===ui}get isDelay(){return this.state===pi}get isCountDown(){return this.state===vi}get isRunning(){return this.state===pi||this.state===vi}get isDone(){return this.state===fi}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}}const ui=0,pi=1,vi=2,gi=3,fi=-1;class mi extends ai{constructor(t,e){super(t,e),this.timer=new ci}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 yi=Phaser.Utils.Objects.GetValue,bi=Phaser.Utils.Objects.GetAdvancedValue,xi=Phaser.Tweens.Builders.GetEaseFunction;class Ci extends mi{resetFromJSON(t){return this.timer.resetFromJSON(yi(t,"timer")),this.setEnable(yi(t,"enable",!0)),this.setTarget(yi(t,"target",this.parent)),this.setDelay(bi(t,"delay",0)),this.setDuration(bi(t,"duration",1e3)),this.setEase(yi(t,"ease","Linear")),this.setRepeat(yi(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 Si=Phaser.Utils.Objects.GetValue,wi=Phaser.Utils.Objects.GetAdvancedValue,Oi=Phaser.Math.Linear;let Pi=class extends Ci{constructor(t,e){super(t,e),this.scaleStart={},this.scaleEnd={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(Si(t,"mode",0)),this.setScaleRange(wi(t,"start",void 0),wi(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=wi(t,"x",this.parent.scaleX),this.startY=wi(t,"y",this.parent.scaleY)),"number"==typeof e?(this.endX=e,this.endY=e):(this.endX=wi(e,"x",void 0),this.endY=wi(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,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 Pi(t,a):r.resetFromJSON(a),r.restart(),r},_i=function(t,e,i,s,r,n){void 0===s&&(s="Linear"),r instanceof Pi&&(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 Pi(t,h):n.resetFromJSON(h),n.restart(),n},Ei=function(t,e){return new Promise((function(i,s){t.once(e,(function(){i()}))}))},Mi=function(t){return Ei(t,"complete")};const Ri=Phaser.Utils.Objects.IsPlainObject;var Li={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(Ri(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(Ri(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=_i(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(Ri(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 Pi(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),Mi(this._scaleBehavior)},isRunningScaleYoyo(){return this._scaleBehavior&&(this._scaleBehavior.completeEventName="scaleyoyo.complete")},isRunningEaseScale(){return this.isRunningPopUp()||this.isRunningScaleDown()||this.isRunningScaleYoyo()}},zi={};Object.assign(zi,Li),zi.onInitScale=function(){Li.onInitScale.call(this);var t=this;this._scaleBehavior.on("update",(function(){var e=me.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const Di=Phaser.Utils.Objects.GetValue,Ai=Phaser.Utils.Objects.GetAdvancedValue,Yi=Phaser.Math.Linear;class Wi extends Ci{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(Di(t,"mode",0)),this.setAlphaRange(Ai(t,"start",this.parent.alpha),Ai(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=Bi[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 Bi={stop:0,destroy:1,yoyo:2},Xi=Phaser.Utils.Objects.IsPlainObject;var ji=function(t,e,i,s){var r,n;Xi(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},Ii=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 Fi=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(Fi(t)){var i=t;t=i.duration,e=i.alpha}var s=void 0===this._fade;return this._fade=ji(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(Fi(t)){var i=t;t=i.duration,e=i.destroy}var s=void 0===this._fade;return this._fade=Ii(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()}},Hi={};Object.assign(Hi,Ni),Hi.onInitFade=function(){Ni.onInitFade.call(this);var t=this;this._fade.on("update",(function(){var e=me.getParentSizer(t);e&&e.resetChildAlphaState(t)}))};const Gi=Phaser.Utils.Objects.GetValue,Vi=Phaser.Utils.Objects.GetAdvancedValue,Ui=Phaser.Math.Linear;class $i extends Ci{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){if(super.resetFromJSON(t),this.setMode(Gi(t,"mode",0)),t&&(t.hasOwnProperty("x")||t.hasOwnProperty("y"))){var e=Vi(t,"x",void 0),i=Vi(t,"y",void 0);this.setTargetPosition(e,i)}else this.setTargetPosition(t);return this}setMode(t){return"string"==typeof t&&(t=Ji[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=Vi(i,"startX",void 0),this.startY=Vi(i,"startY",void 0),this.endX=Vi(i,"endX",void 0),this.endY=Vi(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=Ui(this.startX,this.endX,i)),this.hasMoveY&&(t.y=Ui(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Ji={stop:0,destroy:1,yoyo:2};var Ki=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,Zi=Phaser.Math.Distance.Between;var Qi={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*Zi(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 $i&&(h=n,n=void 0),void 0===n&&(n=!1);var a={};return a.mode=n?1:0,void 0!==i&&(a.startX=Ki(i,t.x),a.endX=t.x),void 0!==s&&(a.startY=Ki(s,t.y),a.endY=t.y),a.duration=e,a.ease=void 0===r?"Linear":r,void 0===h?h=new $i(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),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*Zi(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 $i&&(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=Ki(i,t.x)),void 0!==s&&(a.startY=t.y,a.endY=Ki(s,t.y)),a.duration=e,a.ease=void 0===r?"Linear":r,void 0===h?h=new $i(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),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}},ts={};Object.assign(ts,Qi),ts.onInitEaseMove=function(){Qi.onInitEaseMove.call(this);var t=this;this._easeMove.on("update",(function(){var e=me.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const es=Phaser.Utils.Objects.GetValue;class is extends ri{constructor(t,e){super(t,e),this.timer=new ci,this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.timer.resetFromJSON(es(t,"timer")),this.setEnable(es(t,"enable",!0)),this.setMode(es(t,"mode",1)),this.isRunning=es(t,"isRunning",!1),this.setMagnitudeMode(es(t,"magnitudeMode",1)),this.setAxisMode(es(t,"axis",0)),this.setDuration(es(t,"duration",500)),this.setMagnitude(es(t,"magnitude",10)),this.ox=es(t,"ox",void 0),this.oy=es(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=ss[t]),this.mode=t,this}setMagnitudeMode(t){return"string"==typeof t&&(t=ns[t]),this.magnitudeMode=t,this}setAxisMode(t){return"string"==typeof t&&(t=rs[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=es(i,"magnitude",void 0),t=es(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 ss={effect:0,behavior:1},rs={both:0,"h&v":0,"x&y":0,horizontal:1,h:1,x:1,vertical:2,v:2,y:2},ns={constant:0,decay:1},hs=Phaser.Utils.Objects.IsPlainObject;var as={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 is(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 os=Phaser.Utils.Objects.GetValue,ls=Phaser.Math.Linear;class ds extends Ci{constructor(t,e){super(t,e),this.resetFromJSON(),this.boot()}start(t){if(this.timer.isRunning)return this;var e=this.target;this.propertyKey=os(t,"key","value");var i=e[this.propertyKey];return this.fromValue=os(t,"from",i),this.toValue=os(t,"to",i),this.setEase(os(t,"ease",this.ease)),this.setDuration(os(t,"duration",this.duration)),this.setRepeat(os(t,"repeat",0)),this.setDelay(os(t,"delay",0)),this.setRepeatDelay(os(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]=ls(this.fromValue,this.toValue,i)}}const cs=Phaser.Utils.Objects.IsPlainObject;class us extends Qe{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 ds(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(cs(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(cs(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 ps={easeDataTo(t,e,i,s){return this._easeData||(this._easeData=new us(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),Ei(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}},vs=Phaser.Utils.Array.Remove,gs={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=$e(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}},Ds={setTransitInTime(t){return this.transitInTime=t,this},setTransitOutTime(t){return this.transitOutTime=t,this},setTransitInCallback(t){return t||(t=Yt),this.transitInCallback=t,this},setTransitOutCallback(t){return t||(t=Yt),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}},Ys={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,zs,Ds,As,Ys);const Bs=Phaser.Utils.Objects.GetValue;class Xs extends Qe{constructor(t,e){super(t,e),this.setTransitInTime(Bs(e,"duration.in",200)),this.setTransitOutTime(Bs(e,"duration.out",200)),this.setTransitInCallback(Bs(e,"transitIn")),this.setTransitOutCallback(Bs(e,"transitOut")),this.oneShotMode=Bs(e,"destroy",!1),this.delayCallTimer=void 0,this._state=new Ls(this,{eventEmitter:!1,initState:Bs(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(Xs.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 Qe{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 Fs=Phaser.GameObjects.Rectangle;let Ns=class extends Fs{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 Hs=Phaser.Utils.Objects.GetValue;class Gs extends Qe{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=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 Ns{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,ki(t,e)},scaleDown(t,e){_i(t,e,void 0,void 0,!1)},fadeIn(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,ji(t,e)},fadeOut(t,e){Ii(t,e,!1)}},Ks=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,ji(t,e,t.alpha)},qs=function(t,e){Ii(t,e,!1)},Zs=function(t,e,i,s,r){return!(!t||s&&!s(t,e,i)||!rt(t,!0).contains(e,i)||r&&!r(t,e,i))};const Qs=Phaser.Utils.Objects.GetValue;let tr=class extends Xs{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 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 Or.length=0,!0;return Or.length=0,!1},Or=[];const Pr=Phaser.Utils.Objects.GetValue;class Tr extends Qe{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=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?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 kr={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 Tr(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 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 Mr=Phaser.Utils.Objects.GetValue;class Rr extends Qe{constructor(t,e){super(t,e),this._enable=void 0,this.cooldown=new Er,this.parent.setInteractive(Mr(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.prevIsInTouch=!1,this.isInTouching=!1,this.setEnable(Mr(t,"enable",!0)),this.setCooldown(Mr(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 Lr={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 Rr(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 Rr(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}},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=Kr,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=Kr,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&&or(t,s,e,i)}}const Kr=0,qr=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 qe(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=xn},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=Cn}onDragEnd(){this.state=xn}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=xn)}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=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 xn="IDLE",Cn="BEGIN",Sn="RECOGNIZED",wn=Phaser.Utils.Objects.GetValue,On=Phaser.Utils.Array.SpliceOne,Pn=Phaser.Math.Distance.Between,Tn=Phaser.Math.Angle.Between;class kn{constructor(t,e){var i=$e(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,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=Mn,this.onDrag1Start();break;case Mn:this.tracerState=Rn,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],On(this.pointers,e),this.tracerState){case Mn:this.tracerState=En,this.onDrag1End();break;case Rn:this.tracerState=Mn,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 Mn:this.onDrag1();break;case Rn:this.onDrag2()}}}dragCancel(){return this.tracerState===Rn&&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!==Rn)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!==Rn)return 0;var t=this.pointers[0],e=this.pointers[1];return Tn(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!==Rn)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.x+e.x)/2}get centerY(){if(this.tracerState!==Rn)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.y+e.y)/2}get prevCenterX(){if(this.tracerState!==Rn)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!==Rn)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=Ln,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,Ge);var _n={};const En=0,Mn=1,Rn=2,Ln="IDLE";Phaser.Utils.Objects.GetValue;const zn=Phaser.Math.RotateAround;var Dn=function(t,e,i,s){return zn(t,e,i,s),t.rotation+=s,t},An={};const Yn=Phaser.Utils.Objects.GetValue,Wn=Phaser.Math.Angle.WrapDegrees,Bn=Phaser.Math.Angle.ShortestBetween,Xn=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=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=Wn(Xn(this.angleBetween));this.angle=Bn(this.prevAngle,t),this.prevAngle=t,this.state=Hn}break;case Hn:t=Wn(Xn(this.angleBetween)),this.angle=Bn(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,In);const Fn="IDLE",Nn="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 en(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)}),this)}};const Un=Phaser.Utils.Objects.GetValue;var $n=function(t){var e=Un(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)}),this).on("pressend",(function(t,e,s){Ar(i.eventEmitter,`${i.eventNamePrefix}pressend`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Jn=Phaser.Utils.Objects.GetValue;var Kn=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";Ar(i.eventEmitter,`${i.eventNamePrefix}swipe${r}`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const qn=Phaser.Utils.Objects.GetValue;var Zn=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.")},Wr.call(t,e),jr.call(t,e),Nr.call(t,e),Ur.call(t,e),Vn.call(t,e),$n.call(t,e),Kn.call(t,e),t},Qn={getSizerConfig:function(t){return void 0===t&&(t=this),Et(t)},getChildPrevState:function(t){var e=Et(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=ae(e,"color"),s=ae(e,"lineWidth");var o=ae(e,"name",!1);o&&(r=ae(o,"createTextCallback",le),n=ae(o,"createTextCallbackScope",void 0),"string"==typeof(h=ae(o,"align","left-top"))&&(h=At[h]))}if(void 0===i&&(i=16777215),void 0===s&&(s=1),r&&!t.children){t.children=new oe(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)}}for(var d,c,u=this.getAllShownChildren([this]),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){ve.call(this,t);var d=t.isRexSpace,c=typeof e;if(null===e)return this;if("number"===c);else if("string"===c)e=ch[e];else if(oh(e)){var u;e=lh(u=e,"proportion",void 0),i=lh(u,"align",dh),s=lh(u,"padding",0),r=lh(u,"expand",!1),n=lh(u,"key",void 0),h=lh(u,"index",void 0),t.isRexSizer||(a=lh(u,"minWidth",void 0),o=lh(u,"minHeight",void 0)),l=lh(u,"fitRatio",0)}return"string"==typeof i&&(i=At[i]),void 0===e&&(e=d?1:0),void 0===i&&(i=dh),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===a&&(d?a=0:t.isRexSizer||(a=t._minWidth)),void 0===o&&(d?o=0:t.isRexSizer||(o=t._minHeight)),void 0===l||!1===l?l=0:!0===l&&(l=Q(t)/tt(t)),(u=this.getSizerConfig(t)).proportion=e,u.align=i,u.padding=ue(s),u.expand=r,u.fitRatio=0===e?l:0,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=_t.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}},xh={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&&(Ie(t,0,0),e.resolved=!1,this.hasRatioFitChild=!0);return this._childrenProportion=void 0,this.hasProportion0Child=!1,this.proportionLength=void 0,Be.call(this),this},layoutChildren:function(){for(var t,e,i,s,r,n,h,a,o,l,d=this.sizerChildren,c=this.innerLeft,u=this.innerTop,p=this.innerWidth,v=this.innerHeight,g=c,f=u,m=this.startChildIndex,y=0,b=d.length;y0?(e=t-this.getChildrenWidth(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},resolveHeight:function(t){if(void 0!==(t=De.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)||Le.call(this)},runWidthWrap:function(t){this.wrapResult||(1===this.orientation&&rh.call(this,t,void 0),ze.call(this,t))},hasHeightWrap:function(){return!(!this.hasRatioFitChild||0!==this.orientation)||Ae.call(this)},runHeightWrap:function(t){this.wrapResult||(0===this.orientation&&rh.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],h=n&&n.isRexSpace;return"center"===t?h||this.insertSpace(r+1):h&&this.remove(n,!0),this}};Object.assign(Sh,ph,mh,yh,bh,xh,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},Oh={x:0,h:0,horizontal:0,"left-to-right":0,y:1,v:1,vertical:1,"top-to-bottom":1},Ph=function(t){return"string"==typeof t&&(t=Oh[t]),t};const Th=Phaser.Utils.Objects.IsPlainObject,kh=Phaser.Utils.Objects.GetValue;class _h extends eh{constructor(t,e,i,s,r,n,h){Th(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)):Th(s)?(s=kh(h=s,"width",void 0),r=kh(h,"height",void 0),n=kh(h,"orientation",0)):Th(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=Ph(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 Eh=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=Mh[i])}void 0===s?s={}:!0===s&&(s=Rh);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 Mh={fit:0,FIT:0,envelop:1,ENVELOP:1};var Rh={},Lh={},zh={};const Dh=Phaser.Utils.Objects.IsPlainObject,Ah=Phaser.Utils.Objects.GetValue,Yh=Phaser.Display.Align.CENTER,Wh=Phaser.Utils.String.UUID;var Bh={add:function(t,e,i,s,r,n,h,a,o,l){ve.call(this,t),Dh(e)&&(e=Ah(d=e,"key",void 0),i=Ah(d,"align",Yh),s=Ah(d,"padding",0),r=Ah(d,"expand",!0),t.isRexSizer||(n=Ah(d,"minWidth",t._minWidth),h=Ah(d,"minHeight",t._minHeighted)),a=Ah(d,"offsetX",0),o=Ah(d,"offsetY",0),l=Ah(d,"aspectRatio",0));var d,c=void 0!==e;return c||(e=Wh()),"string"==typeof i&&(i=At[i]),void 0===i&&(i=Yh),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===l?l=0:!0===l&&(l=Q(t)/tt(t)),l>0&&(r=!0,void 0===n&&(n=0),void 0===h&&(h=0)),(d=this.getSizerConfig(t)).align=i,d.padding=ue(s),Dh(r)?(d.expandWidth=Ah(r,"width",!1),d.expandHeight=Ah(r,"height",!1)):(d.expandWidth=r,d.expandHeight=r),t.isRexSizer||(d.expandWidth&&(t.minWidth=void 0===n?Q(t):n),d.expandHeight&&(t.minHeight=void 0===h?tt(t):h)),d.alignOffsetX=a,d.alignOffsetY=o,d.aspectRatio=l,this.sizerChildren.hasOwnProperty(e)&&this.sizerChildren[e].destroy(),this.sizerChildren[e]=t,c&&this.addChildrenMap(e,t),this}},Xh={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]),Ce.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 gh.call(this,t),this}},jh={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=this.innerLeft,c=this.innerTop,u=this.innerWidth,p=this.innerHeight,v=this.sizerChildren;for(var g in v)(t=v[g]).rexSizer.hidden||(i=(e=t.rexSizer).padding,vr.call(this,t),a=this.getExpandedChildWidth(t),o=this.getExpandedChildHeight(t),e.aspectRatio>0&&(Lh.width=e.aspectRatio,Lh.height=1,zh.width=a,zh.height=o,a=(l=Eh(Lh,zh,"FIT",!0)).width,o=l.height),t.isRexSizer?(t.runLayout(this,a,o),ih(t,this)):Ie(t,a,o),s=d+i.left*this.scaleX,n=u-(i.left+i.right)*this.scaleX,r=c+i.top*this.scaleY,h=p-(i.top+i.bottom)*this.scaleY,gr.call(this,t,s,r,n,h,e.align,e.alignOffsetX,e.alignOffsetY))}};Object.assign(jh,Bh,Xh);const Ih=Phaser.Utils.Objects.IsPlainObject,Fh=Phaser.Utils.Objects.GetValue;class Nh extends eh{constructor(t,e,i,s,r,n){Ih(e)?(e=Fh(n=e,"x",0),i=Fh(n,"y",0),s=Fh(n,"width",void 0),r=Fh(n,"height",void 0)):Ih(s)&&(s=Fh(n=s,"width",void 0),r=Fh(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(Nh.prototype,jh);const Hh=_h.prototype.add,Gh=_h.prototype.addSpace;var Vh=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)&&Gh.call(this),Hh.call(this,t,{proportion:i,expand:!0});var s=!this.buttonsExpand&&"center"===this.buttonsAlign;s&&Gh.call(this),this.hasTailSpace=s}else Hh.call(this,t,{proportion:i,expand:!0}),this.hasTailSpace=!1;else if(this.hasTailSpace){var r=this.sizerChildren.length-1;Hh.call(this,t,{index:r,proportion:i,expand:!0})}else Hh.call(this,t,{proportion:i,expand:!0});return e&&this.buttonGroup.add(t),this},Uh={addButton(t){if(lr(t))for(var e=t,i=0,s=e.length;i=0;i--)Kh.call(this,e[i],t);return this}},Zh=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)}},Qh=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,Zh.call(e,t,i,s)}},enumerable:!0,configurable:!0}),t.selected=!1},ta={add(t){return this.buttons.push(t),t._click||(t._click=new br(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`),Qh.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=va(a.left,a.centerY,t,e))&&(r=o,s=n);var o,l=i[n+1];l&&l.y===a.y||r>(o=va(a.right,a.centerY,t,e))&&(r=o,s=n+1)}}return s};const fa=Phaser.Utils.Objects.IsPlainObject,ma=Phaser.Utils.Objects.GetValue,ya=Phaser.Display.Align.CENTER;var ba=function(t,e,i,s){return"\n"===t?(this.addNewLine(),this):(ve.call(this,t),fa(e)&&(e=ma(r=e,"padding",0),i=ma(r,"key",void 0),s=ma(r,"index",void 0)),void 0===e&&(e=0),(r=this.getSizerConfig(t)).align=ya,r.padding=ue(e),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},xa={add(t,e,i){if(lr(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,gh.call(this,t),this}},wa={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&&Ma.addNewLine(this)}else for(n=0,h=t.length;n=0;i--)Aa.call(this,e[i],t);return this}};const Wa=Phaser.Utils.Objects.GetValue;class Ba extends _a{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 aa({parent:this,eventEmitter:Wa(e,"eventEmitter",this),groupName:Wa(e,"groupName",void 0),clickConfig:Wa(e,"click",void 0)}).setButtonsType(e);var s=Wa(e,"background",void 0),r=Wa(e,"buttons",void 0);this.buttonsAlign=Wa(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(Ba.prototype,La,Ya,ha,la);var Xa=function(){return Array.prototype.reduce.call(arguments,ja,0)},ja=function(t,e){return t+e};const Ia=Phaser.Utils.Objects.IsPlainObject,Fa=Phaser.Utils.Objects.GetValue,Na=Phaser.Display.Align.CENTER;var Ha=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 Va(this.sizerChildren,null),gh.call(this,t),this}},$a={setColumnSpace(t){if(this.space.column||(this.space.column=[]),this.space.column.length=this.columnCount-1,"number"==typeof t)Va(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},Za={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=De.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===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,Va(this.sizerChildren,null),this.columnProportions=[],this.columnProportions.length=t,"number"==typeof i)Va(this.columnProportions,i);else for(var n=0;n0?e+=t:0===t&&(this.hasColumnProportion0Child=!0);return e},to=function(){for(var t,e=0,i=0;i0?e+=t:0===t&&(this.hasRowProportion0Child=!0);return e};const eo=Phaser.Utils.Objects.IsPlainObject,io=Phaser.Utils.Objects.GetValue;class so extends eh{constructor(t,e,i,s,r,n,h,a,o,l){eo(e)?(e=io(l=e,"x",0),i=io(l,"y",0),s=io(l,"width",void 0),r=io(l,"height",void 0),n=io(l,"column",l.col||0),h=io(l,"row",0),a=io(l,"columnProportions",0),o=io(l,"rowProportions",0)):eo(s)?(s=io(l=s,"width",void 0),r=io(l,"height",void 0),n=io(l,"column",l.col||0),h=io(l,"row",0),a=io(l,"columnProportions",0),o=io(l,"rowProportions",0)):eo(n)?(n=io(l=n,"column",l.col||0),h=io(l,"row",0),a=io(l,"columnProportions",0),o=io(l,"rowProportions",0)):eo(a)&&(a=io(l=a,"columnProportions",0),o=io(l,"rowProportions",0)),super(t,e,i,s,r,l),this.type="rexGridSizer",this.sizerChildren=[],this.addChildrenMap("items",this.sizerChildren),this.setCreateCellContainerCallback(io(l,"createCellContainerCallback")),this.setIndentLeft(io(l,"space.indentLeftOdd",0),io(l,"space.indentLeftEven",0)),this.setIndentTop(io(l,"space.indentTopOdd",0),io(l,"space.indentTopEven",0)),this.resetGrid(n,h,a,o,io(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=Qa.call(this)),this._totalColumnProportions}get totalRowProportions(){return void 0===this._totalRowProportions&&(this._totalRowProportions=to.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(so.prototype,Za);const ro=so.prototype.add;var no={addButton(t,e,i){return ro.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--)oo.call(this,e[i],t);return this}};const co=Phaser.Utils.Objects.GetValue;class uo extends so{constructor(t,e){void 0===e&&(e={});var i=co(e,"row",0),s=co(e,"column",e.col||0),r=co(e,"createCellContainerCallback"),n=co(e,"buttons",void 0),h=co(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},Go=0,Vo=1,Uo=2,$o=0,Jo=1,Ko=2,qo=/(?:\r\n|\r|\n)/;const Zo={none:$o,word:Jo,char:Ko,character:Ko,mix:3},Qo=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,h=r.height,a=Qo.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 el=Phaser.Display.Color;var il={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 el);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}},sl=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)},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,sl(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 nl=Phaser.Display.Canvas.CanvasPool,hl=Phaser.GameObjects.GameObject,al=Phaser.Utils.String.UUID;class ol extends hl{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=nl.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(){nl.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 ll=Phaser.GameObjects.Components;Phaser.Class.mixin(ol,[ll.Alpha,ll.BlendMode,ll.Crop,ll.Depth,ll.Flip,ll.GetBounds,ll.Mask,ll.Origin,ll.Pipeline,ll.PostPipeline,ll.ScrollFactor,ll.Tint,ll.Transform,ll.Visible,tl,il,rl]);var dl={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&>(this.data),this}};class cl{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(cl.prototype,dl);var ul={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 pl=Phaser.Math.RotateAround;var vl;const gl=Phaser.Geom.Rectangle;var fl,ml=function(t){void 0===fl&&(fl=new gl);var e=t.drawTLX,i=t.drawTLY;return fl.setTo(e,i,t.drawTRX-e,t.drawBLY-i),fl};const yl=Phaser.Math.RotateAround;var bl,xl=function(t,e,i,s){return void 0===s?s={}:!0===s&&(void 0===bl&&(bl={}),s=bl),s.x=e,s.y=i,0!==t.rotation&&yl(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 Sl,wl,Ol={},Pl=function(t,e,i,s,r){var n=xl(e,i,s,!0),h=function(t,e,i,s){void 0===s?s={}:!0===s&&(s=Ol);var r=e-t.width*t.originX,n=i-t.height*t.originY;return void 0===Sl&&(Sl=new Cl,wl=new Cl),t.parentContainer?t.getWorldTransformMatrix(Sl,wl):Sl.applyITRS(t.x,t.y,t.rotation,t.scaleX,t.scaleY),Sl.transformPoint(r,n,s),s}(t,n.x,n.y,r);return h},Tl=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 Pl(t,e,n,h,r)},kl={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===vl&&(vl={}),s=vl),s.x=(t-i.drawX)/i.scaleX,s.y=(e-i.drawY)/i.scaleY,0!==i.rotation&&pl(s,0,0,-i.rotation),s}(t,e,this,!0);return ml(this).contains(i.x,i.y)},getWorldPosition:function(t,e,i){return Tl(this.parent,this,t,e,i)}};Object.assign(kl,ul);const _l=Phaser.Math.DegToRad,El=Phaser.Math.RadToDeg,Ml=Phaser.Utils.Objects.GetValue;class Rl extends cl{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 El(this._rotation)}set angle(t){this.rotation=_l(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=Ml(t,"width",void 0),i=Ml(t,"height",void 0),s=Ml(t,"scaleX",void 0),r=Ml(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(Rl.prototype,kl);const Ll=Phaser.Utils.String.Pad;var zl=function(t,e,i){if(null==t)return t;switch(typeof t){case"string":default:return t;case"number":return`#${Ll(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}},Dl=function(t,e,i){return e.hasOwnProperty(t)?e[t]:i[t]};const Al=Phaser.Utils.Objects.GetValue;let Yl=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=Al(t,"x",0),i=Al(t,"y",0));var s=this.cornerRadius;s.tl=Wl(Al(t,"tl",void 0),e,i),s.tr=Wl(Al(t,"tr",void 0),e,i),s.bl=Wl(Al(t,"bl",void 0),e,i),s.br=Wl(Al(t,"br",void 0),e,i)}get radiusTL(){var t=this.cornerRadius.tl;return Math.max(t.x,t.y)}set radiusTL(t){Bl(this.cornerRadius.tl,t)}get radiusTR(){var t=this.cornerRadius.tr;return Math.max(t.x,t.y)}set radiusTR(t){Bl(this.cornerRadius.tr,t)}get radiusBL(){var t=this.cornerRadius.bl;return Math.max(t.x,t.y)}set radiusBL(t){Bl(this.cornerRadius.bl,t)}get radiusBR(){var t=this.cornerRadius.br;return Math.max(t.x,t.y)}set radiusBR(t){Bl(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}),Xl(t),t},Bl=function(t,e){"number"==typeof e?(t.x=e,t.y=e):(t.x=Al(e,"x",0),t.y=Al(e,"y",0)),Xl(t)},Xl=function(t){t.convex=t.x>=0||t.y>=0,t.x=Math.abs(t.x),t.y=Math.abs(t.y)};const jl=Phaser.Math.DegToRad;var Il=function(t){return!t.hasOwnProperty("convex")||t.convex},Fl=function(t){return t.x>0&&t.y>0},Nl=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,Fl(a)?(o=a.x*g,l=a.y*f,Il(a)?Nl(t,o,l,o,l,180,270,!1,h):Nl(t,0,0,o,l,90,0,!0,h),d=0,c=l):(t.lineTo(0,0),d=0,c=0),a=m.tr,Fl(a)?(o=a.x*g,l=a.y*f,Il(a)?Nl(t,s-o,l,o,l,270,360,!1,h):Nl(t,s,0,o,l,180,90,!0,h)):t.lineTo(s,0),a=m.br,Fl(a)?(o=a.x*g,l=a.y*f,Il(a)?Nl(t,s-o,r-l,o,l,0,90,!1,h):Nl(t,s,r,o,l,270,180,!0,h)):t.lineTo(s,r),a=m.bl,Fl(a)?(o=a.x*g,l=a.y*f,Il(a)?Nl(t,o,r-l,o,l,90,180,!1,h):Nl(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())},Gl=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),Hl(t.canvas,t.context,d,d,o,l,r,e,i,s,n,h,a)}};const Vl=Phaser.Utils.Objects.GetValue;class Ul extends Rl{constructor(t,e){super(t,"background"),this.setScrollFactor(0),this.setColor(Vl(e,"color",null),Vl(e,"color2",null),Vl(e,"horizontalGradient",!0)),this.setStroke(Vl(e,"stroke",null),Vl(e,"strokeThickness",2)),this.setCornerRadius(Vl(e,"cornerRadius",0),Vl(e,"cornerIteration",null))}set color(t){t=zl(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=zl(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=zl(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,Dl("color2",t,this),Dl("horizontalGradient",t,this)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,Dl("strokeThickness",t,this)),t.hasOwnProperty("cornerRadius")&&this.setCornerRadius(t.cornerRadius,Dl("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(){Gl(this.parent,this.color,this.stroke,this.strokeThickness,this.cornerRadius,this.color2,this.horizontalGradient,this.cornerIteration)}}const $l=Phaser.Utils.Objects.GetValue;class Jl extends Rl{constructor(t,e){super(t,"innerbounds"),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))}set color(t){t=zl(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=zl(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=zl(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,$l(t,"color2",null),$l(t,"horizontalGradient",!0)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,$l(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 Kl=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(Kl(t,"bold",!1)),this.setItalic(Kl(t,"italic",!1)),this.setFontSize(Kl(t,"fontSize","16px")),this.setFontFamily(Kl(t,"fontFamily","Courier")),this.setColor(Kl(t,"color","#fff")),this.setStrokeStyle(Kl(t,"stroke",null),Kl(t,"strokeThickness",0)),this.setShadow(Kl(t,"shadowColor",null),Kl(t,"shadowOffsetX",0),Kl(t,"shadowOffsetY",0),Kl(t,"shadowBlur",0)),this.setOffset(Kl(t,"offsetX",0),Kl(t,"offsetY",0)),this.setSpace(Kl(t,"leftSpace",0),Kl(t,"rightSpace",0)),this.setAlign(Kl(t,"align",void 0)),this.setBackgroundColor(Kl(t,"backgroundColor",null)),this.setBackgroundHeight(Kl(t,"backgroundHeight",void 0)),this.setBackgroundBottomY(Kl(t,"backgroundBottomY",void 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(Dl("stroke",t,this),Dl("strokeThickness",t,this)),t.hasOwnProperty("shadowColor")&&this.setShadowColor(t.shadowColor),(t.hasOwnProperty("shadowOffsetX")||t.hasOwnProperty("shadowOffsetY"))&&this.setShadowOffset(Dl("shadowOffsetX",t,this),Dl("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),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=zl(t),this}get hasFill(){return null!=this.color}setStrokeStyle(t,e){return this.stroke=zl(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=zl(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=zl(t),this}get hasBackgroundColor(){return null!=this.backgroundColor}setBackgroundHeight(t){return this.backgroundHeight=t,this}setBackgroundBottomY(t){return this.backgroundBottomY=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 Zl=Phaser.Utils.Array.Remove,Ql=Phaser.Utils.Array.Remove,td="text",ed="image",id="drawer",sd="space",rd="command";var nd=function(t){return t.type===td&&"\n"===t.text},hd=function(t){return t.type===td&&"\f"===t.text},ad=function(t){return t.type===td};class od extends Rl{constructor(t,e,i){super(t,td),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,s=this.drawTRX-i+1,r=e.backgroundBottomY;null==r&&(r=this.drawBLY);var n=e.backgroundHeight;null==n&&(n=r-this.drawTLY);var h=r-n;t.fillRect(i,h,s,n)}var a=e.hasFill,o=e.hasStroke;(a||o)&&(e.syncFont(t).syncStyle(t),o&&(e.syncShadow(t),t.strokeText(this.text,0,0)),a&&(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 ld=function(t,e){var i=this.createCharChildren(t,e);return this.addChild(i),this};const dd=Phaser.Display.Canvas.CanvasPool;var cd=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=dd.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),dd.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 ud extends Rl{constructor(t,e,i){super(t,ed),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(){cd(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 pd extends Rl{constructor(t,e,i,s){super(t,id),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 vd extends Rl{constructor(t,e){super(t,sd),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 gd extends cl{constructor(t,e,i,s,r){super(t,rd),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 fd(t){if(null===t||"object"!=typeof t)return t;if(Array.isArray(t))return t.map((t=>fd(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]=fd(t[i]));return e}var md=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 yd={none:0,word:1,char:2,character:2,mix:3};var bd=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=wd.call(this)).height,h=l.ascent,i=Math.floor((o-h)/n))}else{var l;n=(l=wd.call(this)).height,h=l.ascent}}else this.fixedHeight>0?void 0===(i=Pd(t,"maxLines"))&&(o=this.fixedHeight-s,i=Math.floor(o/n)):i=Pd(t,"maxLines",0);void 0===h&&(h=n);var d=0===i,c=Pd(t,"wrapMode");void 0===c&&(c=Pd(t,"charWrap",!1)?"char":"word"),"string"==typeof c&&(c=yd[c]);var u=Pd(t,"wrapWidth",void 0);void 0===u&&(this.fixedWidth>0?u=this.fixedWidth-r:(u=1/0,c=0));for(var p=Pd(t,"letterSpacing",0),v=Pd(t,"hAlign",0),g=Pd(t,"vAlign",0),f=Pd(t,"justifyPercentage",.25),m=md({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=!z&&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=_d(t,"maxLines",void 0))){var h=this.fixedWidth-r;i=Math.floor(h/n)+1}}else i=_d(t,"maxLines",0);var a=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=md({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 W=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 Ee(i,t,e),this.dirty=this.dirty||s!=i.left||r!=i.right||n!=i.top||h!=i.bottom,this},getPadding:function(t){return _e(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),Zl(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 Ql(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(td);return null===i?i=new od(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)),Tl(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 Qd=Phaser.Utils.Objects.GetFastValue;var tc={};class ec{constructor(t){this.pools=Qd(t,"pools",tc)}free(t){if(!this.pools)return this;var e=t.type;return this.pools.hasOwnProperty(e)||(this.pools[e]=new Zd),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=lc(t,r,e,i,n),a=0;a<=hc&&0!==h;a++){if((r+=h)<0){r=0;break}h=lc(t,r,e,i,n)}return a===hc&&console.warn("FontSizeFit: Test count exceeds 65535"),t.setFontSize(r),dc(t,e,i),t},oc=function(t,e,i){return void 0===i[e]&&(t.setFontSize(e),i[e]={width:t.width,height:t.height}),i[e]},lc=function(t,e,i,s,r){var n,h=oc(t,e,r),a=oc(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)},dc=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 cc=Phaser.Utils.Objects.GetValue,uc=Phaser.Utils.Objects.GetValue;class pc extends Eo{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexLabel";var i,s=uc(e,"background",void 0),r=uc(e,"icon",void 0),n=uc(e,"iconMask",void 0),h=uc(e,"text",void 0),a=uc(e,"action",void 0),o=uc(e,"actionMask",void 0),l=uc(e,"align",void 0);if(s&&this.addBackground(s),r){0===this.orientation?(h||a)&&(i={right:uc(e,"space.icon",0),top:uc(e,"space.iconTop",0),bottom:uc(e,"space.iconBottom",0),left:uc(e,"space.iconLeft",0)}):(h||a)&&(i={bottom:uc(e,"space.icon",0),left:uc(e,"space.iconLeft",0),right:uc(e,"space.iconRight",0),top:uc(e,"space.iconTop",0)});var d=uc(e,"squareFitIcon",!1)?1:0;if(this.add(r,{proportion:0,padding:i,fitRatio:d}),n&&(n=Ao.call(this,r,r,1)),!d){var c=uc(e,"iconSize",void 0);this.setIconSize(uc(e,"iconWidth",c),uc(e,"iconHeight",c))}}if(h){var u=uc(e,"wrapText",!1),p=uc(e,"adjustTextFontSize",!1);u?(!0===u&&(u="word"),function(t,e){switch(jo(t)){case 0:switch("string"==typeof e&&(e=Zo[e]||0),t.style.wrapMode=e,e){case 2:case 3:t.style.wordWrapCallback=No;break;default:t.style.wordWrapCallback=null}break;case 1:"string"==typeof e&&(e=Zo[e]||0),t.style.wrapMode=e}}(h,u),e.expandTextWidth=!0,nc(h)):p&&(e.expandTextWidth=!0,e.expandTextHeight=!0,function(t,e){"number"==typeof e&&(e={minWidth:e});var i=cc(e,"minWidth",0),s=cc(e,"minHeight",0),r=cc(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 ac(t,e,i),t}):(t.runWidthWrap=function(e){return t.setFixedSize&&t.setFixedSize(0,0),ac(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=uc(e,"space.text",0),m=uc(e,"expandTextWidth",!1),y=uc(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:uc(e,"space.actionTop",0),bottom:uc(e,"space.actionBottom",0),right:uc(e,"space.actionRight",0)}:{left:uc(e,"space.actionLeft",0),right:uc(e,"space.actionRight",0),bottom:uc(e,"space.actionBottom",0)},d=uc(e,"squareFitAction",!1)?1:0,this.add(a,{proportion:0,padding:i,fitRatio:d}),o&&(o=Ao.call(this,a,a,1)),!d)){var b=uc(e,"actionSize");this.setActionSize(uc(e,"actionWidth",b),uc(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 vc=Phaser.Renderer.WebGL.Utils,gc=function(t,e,i,s,r,n){for(var h=vc.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+")"},xc=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 Sc={renderWebGL:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.pipelines.set(e.pipeline),n=yc(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&&gc(r,h,e,l,a,o),e.isStroked&&mc(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(Oc.prototype,Sc);var Pc=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 Tc=Phaser.Math.DegToRad;var kc=function(t,e,i,s,r,n,h,a,o){h&&n>r?n-=360:!h&&n0&&t.y>0};const zc={rectangle:0,circle:1};var Dc=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},Ac=function(t,e,i){if(void 0===i&&(i={}),Array.isArray(e))for(var s=0,r=e.length;s0,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};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=Eu(a=e,"x",0),i=Eu(a,"y",0),s=Eu(a,"width",2),r=Eu(a,"height",2),n=Eu(a,"barColor",void 0),h=Eu(a,"value",0)):Mu(s)?(s=Eu(a=s,"width",2),r=Eu(a,"height",2),n=Eu(a,"barColor",void 0),h=Eu(a,"value",0)):Mu(n)&&(n=Eu(a=n,"barColor",void 0),h=Eu(a,"value",0)),super(t,e,i,s,r,a),this.type="rexLineProgress",this.bootProgressBase(a),this.addShape((new ku).setName("trackFill")).addShape((new ku).setName("bar")).addShape((new ku).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&&_u(s,0,0,e,i,t).close();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),_u(h,r,0,n,i,t).close());var a=this.getShape("trackStroke");a.lineStyle(this.trackStrokeThickness,this.trackStrokeColor),a.isStroked&&_u(a,0,0,e,i,t).end()}};Object.assign(Ru.prototype,Lu);var zu=function(t){return null==t||""===t||0===t.length},Du=function(t,e,i,s){if(void 0===s&&(s="."),"object"==typeof t){if(zu(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(zu(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=fd(i),s=fd(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 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={},qe(t).events.once("destroy",(function(){for(var t in ap)ap[t].destroy();ap=void 0}))),!ap.hasOwnProperty(e)){var i=qe(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 Qe{constructor(t,e){return super(t),new Proxy(this,this)}get(t,e){if(Wu(t,e))return t[e];var i=t.parent;return Wu(i,e)?i[e]:void 0}set(t,e,i){return Wu(t,e)?t[e]=i:Wu(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=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}},z={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}},D={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}},Pe=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 _e=function(t,e){return void 0===e?t:t[e]},Ee=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 _e(this.space,t)},setInnerPadding(t,e){return Ee(this.space,t,e),this},getOuterPadding(t){return _e(this.getSizerConfig(this).padding,t)},setOuterPadding(t,e){return Ee(this.getSizerConfig(this).padding,t,e),this},getChildOuterPadding(t,e){return"string"==typeof t&&(t=this.getElement(t)),_e(this.getSizerConfig(t).padding,e)},setChildOuterPadding(t,e,i){return"string"==typeof t&&(t=this.getElement(t)),Ee(this.getSizerConfig(t).padding,e,i),this}},Re=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}},Le=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},De=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},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},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}},Be=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?vi:pi,this.repeatCounter=0,this}stop(){return this.state=ui,this}update(t,e){this.state!==ui&&this.state!==fi&&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=gi)):(this.nowTime=this.duration,this.state=fi):this.nowTime>=0&&(this.state=vi))}get t(){var t;switch(this.state){case ui:case pi:case gi:t=0;break;case vi:t=this.nowTime/this.duration;break;case fi:t=1}return di(t,0,1)}set t(t){(t=di(t,-1,1))<0?(this.state=pi,this.nowTime=-this.delay*t):(this.state=vi,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===ui}get isDelay(){return this.state===pi}get isCountDown(){return this.state===vi}get isRunning(){return this.state===pi||this.state===vi}get isDone(){return this.state===fi}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}}const ui=0,pi=1,vi=2,gi=3,fi=-1;class mi extends ai{constructor(t,e){super(t,e),this.timer=new ci}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 yi=Phaser.Utils.Objects.GetValue,bi=Phaser.Utils.Objects.GetAdvancedValue,xi=Phaser.Tweens.Builders.GetEaseFunction;class Ci extends mi{resetFromJSON(t){return this.timer.resetFromJSON(yi(t,"timer")),this.setEnable(yi(t,"enable",!0)),this.setTarget(yi(t,"target",this.parent)),this.setDelay(bi(t,"delay",0)),this.setDuration(bi(t,"duration",1e3)),this.setEase(yi(t,"ease","Linear")),this.setRepeat(yi(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 Si=Phaser.Utils.Objects.GetValue,wi=Phaser.Utils.Objects.GetAdvancedValue,Oi=Phaser.Math.Linear;let Pi=class extends Ci{constructor(t,e){super(t,e),this.scaleStart={},this.scaleEnd={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(Si(t,"mode",0)),this.setScaleRange(wi(t,"start",void 0),wi(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=wi(t,"x",this.parent.scaleX),this.startY=wi(t,"y",this.parent.scaleY)),"number"==typeof e?(this.endX=e,this.endY=e):(this.endX=wi(e,"x",void 0),this.endY=wi(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,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 Pi(t,a):r.resetFromJSON(a),r.restart(),r},_i=function(t,e,i,s,r,n){void 0===s&&(s="Linear"),r instanceof Pi&&(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 Pi(t,h):n.resetFromJSON(h),n.restart(),n},Ei=function(t,e){return new Promise((function(i,s){t.once(e,(function(){i()}))}))},Mi=function(t){return Ei(t,"complete")};const Ri=Phaser.Utils.Objects.IsPlainObject;var Li={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(Ri(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(Ri(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=_i(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(Ri(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 Pi(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),Mi(this._scaleBehavior)},isRunningScaleYoyo(){return this._scaleBehavior&&(this._scaleBehavior.completeEventName="scaleyoyo.complete")},isRunningEaseScale(){return this.isRunningPopUp()||this.isRunningScaleDown()||this.isRunningScaleYoyo()}},zi={};Object.assign(zi,Li),zi.onInitScale=function(){Li.onInitScale.call(this);var t=this;this._scaleBehavior.on("update",(function(){var e=me.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const Di=Phaser.Utils.Objects.GetValue,Ai=Phaser.Utils.Objects.GetAdvancedValue,Yi=Phaser.Math.Linear;class Wi extends Ci{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(Di(t,"mode",0)),this.setAlphaRange(Ai(t,"start",this.parent.alpha),Ai(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=Bi[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 Bi={stop:0,destroy:1,yoyo:2},Xi=Phaser.Utils.Objects.IsPlainObject;var ji=function(t,e,i,s){var r,n;Xi(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},Ii=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 Fi=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(Fi(t)){var i=t;t=i.duration,e=i.alpha}var s=void 0===this._fade;return this._fade=ji(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(Fi(t)){var i=t;t=i.duration,e=i.destroy}var s=void 0===this._fade;return this._fade=Ii(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()}},Hi={};Object.assign(Hi,Ni),Hi.onInitFade=function(){Ni.onInitFade.call(this);var t=this;this._fade.on("update",(function(){var e=me.getParentSizer(t);e&&e.resetChildAlphaState(t)}))};const Gi=Phaser.Utils.Objects.GetValue,Vi=Phaser.Utils.Objects.GetAdvancedValue,Ui=Phaser.Math.Linear;class $i extends Ci{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){if(super.resetFromJSON(t),this.setMode(Gi(t,"mode",0)),t&&(t.hasOwnProperty("x")||t.hasOwnProperty("y"))){var e=Vi(t,"x",void 0),i=Vi(t,"y",void 0);this.setTargetPosition(e,i)}else this.setTargetPosition(t);return this}setMode(t){return"string"==typeof t&&(t=Ji[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=Vi(i,"startX",void 0),this.startY=Vi(i,"startY",void 0),this.endX=Vi(i,"endX",void 0),this.endY=Vi(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=Ui(this.startX,this.endX,i)),this.hasMoveY&&(t.y=Ui(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Ji={stop:0,destroy:1,yoyo:2};var Ki=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,Zi=Phaser.Math.Distance.Between;var Qi={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*Zi(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 $i&&(h=n,n=void 0),void 0===n&&(n=!1);var a={};return a.mode=n?1:0,void 0!==i&&(a.startX=Ki(i,t.x),a.endX=t.x),void 0!==s&&(a.startY=Ki(s,t.y),a.endY=t.y),a.duration=e,a.ease=void 0===r?"Linear":r,void 0===h?h=new $i(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),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*Zi(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 $i&&(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=Ki(i,t.x)),void 0!==s&&(a.startY=t.y,a.endY=Ki(s,t.y)),a.duration=e,a.ease=void 0===r?"Linear":r,void 0===h?h=new $i(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),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}},ts={};Object.assign(ts,Qi),ts.onInitEaseMove=function(){Qi.onInitEaseMove.call(this);var t=this;this._easeMove.on("update",(function(){var e=me.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const es=Phaser.Utils.Objects.GetValue;class is extends ri{constructor(t,e){super(t,e),this.timer=new ci,this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.timer.resetFromJSON(es(t,"timer")),this.setEnable(es(t,"enable",!0)),this.setMode(es(t,"mode",1)),this.isRunning=es(t,"isRunning",!1),this.setMagnitudeMode(es(t,"magnitudeMode",1)),this.setAxisMode(es(t,"axis",0)),this.setDuration(es(t,"duration",500)),this.setMagnitude(es(t,"magnitude",10)),this.ox=es(t,"ox",void 0),this.oy=es(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=ss[t]),this.mode=t,this}setMagnitudeMode(t){return"string"==typeof t&&(t=ns[t]),this.magnitudeMode=t,this}setAxisMode(t){return"string"==typeof t&&(t=rs[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=es(i,"magnitude",void 0),t=es(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 ss={effect:0,behavior:1},rs={both:0,"h&v":0,"x&y":0,horizontal:1,h:1,x:1,vertical:2,v:2,y:2},ns={constant:0,decay:1},hs=Phaser.Utils.Objects.IsPlainObject;var as={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 is(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 os=Phaser.Utils.Objects.GetValue,ls=Phaser.Math.Linear;class ds extends Ci{constructor(t,e){super(t,e),this.resetFromJSON(),this.boot()}start(t){if(this.timer.isRunning)return this;var e=this.target;this.propertyKey=os(t,"key","value");var i=e[this.propertyKey];return this.fromValue=os(t,"from",i),this.toValue=os(t,"to",i),this.setEase(os(t,"ease",this.ease)),this.setDuration(os(t,"duration",this.duration)),this.setRepeat(os(t,"repeat",0)),this.setDelay(os(t,"delay",0)),this.setRepeatDelay(os(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]=ls(this.fromValue,this.toValue,i)}}const cs=Phaser.Utils.Objects.IsPlainObject;class us extends Qe{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 ds(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(cs(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(cs(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 ps={easeDataTo(t,e,i,s){return this._easeData||(this._easeData=new us(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),Ei(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}},vs=Phaser.Utils.Array.Remove,gs={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=$e(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}},Ds={setTransitInTime(t){return this.transitInTime=t,this},setTransitOutTime(t){return this.transitOutTime=t,this},setTransitInCallback(t){return t||(t=Yt),this.transitInCallback=t,this},setTransitOutCallback(t){return t||(t=Yt),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}},Ys={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,zs,Ds,As,Ys);const Bs=Phaser.Utils.Objects.GetValue;class Xs extends Qe{constructor(t,e){super(t,e),this.setTransitInTime(Bs(e,"duration.in",200)),this.setTransitOutTime(Bs(e,"duration.out",200)),this.setTransitInCallback(Bs(e,"transitIn")),this.setTransitOutCallback(Bs(e,"transitOut")),this.oneShotMode=Bs(e,"destroy",!1),this.delayCallTimer=void 0,this._state=new Ls(this,{eventEmitter:!1,initState:Bs(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(Xs.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 Qe{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 Fs=Phaser.GameObjects.Rectangle;let Ns=class extends Fs{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 Hs=Phaser.Utils.Objects.GetValue;class Gs extends Qe{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=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 Ns{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,ki(t,e)},scaleDown(t,e){_i(t,e,void 0,void 0,!1)},fadeIn(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,ji(t,e)},fadeOut(t,e){Ii(t,e,!1)}},Ks=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,ji(t,e,t.alpha)},qs=function(t,e){Ii(t,e,!1)},Zs=function(t,e,i,s,r){return!(!t||s&&!s(t,e,i)||!rt(t,!0).contains(e,i)||r&&!r(t,e,i))};const Qs=Phaser.Utils.Objects.GetValue;let tr=class extends Xs{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 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 Or.length=0,!0;return Or.length=0,!1},Or=[];const Pr=Phaser.Utils.Objects.GetValue;class Tr extends Qe{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=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?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 kr={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 Tr(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 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 Mr=Phaser.Utils.Objects.GetValue;class Rr extends Qe{constructor(t,e){super(t,e),this._enable=void 0,this.cooldown=new Er,this.parent.setInteractive(Mr(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.prevIsInTouch=!1,this.isInTouching=!1,this.setEnable(Mr(t,"enable",!0)),this.setCooldown(Mr(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 Lr={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 Rr(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 Rr(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}},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=Kr,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=Kr,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&&or(t,s,e,i)}}const Kr=0,qr=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 qe(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=xn},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=Cn}onDragEnd(){this.state=xn}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=xn)}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=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 xn="IDLE",Cn="BEGIN",Sn="RECOGNIZED",wn=Phaser.Utils.Objects.GetValue,On=Phaser.Utils.Array.SpliceOne,Pn=Phaser.Math.Distance.Between,Tn=Phaser.Math.Angle.Between;class kn{constructor(t,e){var i=$e(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,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=Mn,this.onDrag1Start();break;case Mn:this.tracerState=Rn,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],On(this.pointers,e),this.tracerState){case Mn:this.tracerState=En,this.onDrag1End();break;case Rn:this.tracerState=Mn,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 Mn:this.onDrag1();break;case Rn:this.onDrag2()}}}dragCancel(){return this.tracerState===Rn&&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!==Rn)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!==Rn)return 0;var t=this.pointers[0],e=this.pointers[1];return Tn(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!==Rn)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.x+e.x)/2}get centerY(){if(this.tracerState!==Rn)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.y+e.y)/2}get prevCenterX(){if(this.tracerState!==Rn)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!==Rn)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=Ln,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,Ge);var _n={};const En=0,Mn=1,Rn=2,Ln="IDLE";Phaser.Utils.Objects.GetValue;const zn=Phaser.Math.RotateAround;var Dn=function(t,e,i,s){return zn(t,e,i,s),t.rotation+=s,t},An={};const Yn=Phaser.Utils.Objects.GetValue,Wn=Phaser.Math.Angle.WrapDegrees,Bn=Phaser.Math.Angle.ShortestBetween,Xn=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=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=Wn(Xn(this.angleBetween));this.angle=Bn(this.prevAngle,t),this.prevAngle=t,this.state=Hn}break;case Hn:t=Wn(Xn(this.angleBetween)),this.angle=Bn(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,In);const Fn="IDLE",Nn="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 en(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)}),this)}};const Un=Phaser.Utils.Objects.GetValue;var $n=function(t){var e=Un(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)}),this).on("pressend",(function(t,e,s){Ar(i.eventEmitter,`${i.eventNamePrefix}pressend`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Jn=Phaser.Utils.Objects.GetValue;var Kn=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";Ar(i.eventEmitter,`${i.eventNamePrefix}swipe${r}`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const qn=Phaser.Utils.Objects.GetValue;var Zn=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.")},Wr.call(t,e),jr.call(t,e),Nr.call(t,e),Ur.call(t,e),Vn.call(t,e),$n.call(t,e),Kn.call(t,e),t},Qn={getSizerConfig:function(t){return void 0===t&&(t=this),Et(t)},getChildPrevState:function(t){var e=Et(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=ae(e,"color"),s=ae(e,"lineWidth");var o=ae(e,"name",!1);o&&(r=ae(o,"createTextCallback",le),n=ae(o,"createTextCallbackScope",void 0),"string"==typeof(h=ae(o,"align","left-top"))&&(h=At[h]))}if(void 0===i&&(i=16777215),void 0===s&&(s=1),r&&!t.children){t.children=new oe(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)}}for(var d,c,u=this.getAllShownChildren([this]),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){ve.call(this,t);var d=t.isRexSpace,c=typeof e;if(null===e)return this;if("number"===c);else if("string"===c)e=ch[e];else if(oh(e)){var u;e=lh(u=e,"proportion",void 0),i=lh(u,"align",dh),s=lh(u,"padding",0),r=lh(u,"expand",!1),n=lh(u,"key",void 0),h=lh(u,"index",void 0),t.isRexSizer||(a=lh(u,"minWidth",void 0),o=lh(u,"minHeight",void 0)),l=lh(u,"fitRatio",0)}return"string"==typeof i&&(i=At[i]),void 0===e&&(e=d?1:0),void 0===i&&(i=dh),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===a&&(d?a=0:t.isRexSizer||(a=t._minWidth)),void 0===o&&(d?o=0:t.isRexSizer||(o=t._minHeight)),void 0===l||!1===l?l=0:!0===l&&(l=Q(t)/tt(t)),(u=this.getSizerConfig(t)).proportion=e,u.align=i,u.padding=ue(s),u.expand=r,u.fitRatio=0===e?l:0,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=_t.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}},xh={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&&(Ie(t,0,0),e.resolved=!1,this.hasRatioFitChild=!0);return this._childrenProportion=void 0,this.hasProportion0Child=!1,this.proportionLength=void 0,Be.call(this),this},layoutChildren:function(){for(var t,e,i,s,r,n,h,a,o,l,d=this.sizerChildren,c=this.innerLeft,u=this.innerTop,p=this.innerWidth,v=this.innerHeight,g=c,f=u,m=this.startChildIndex,y=0,b=d.length;y0?(e=t-this.getChildrenWidth(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},resolveHeight:function(t){if(void 0!==(t=De.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)||Le.call(this)},runWidthWrap:function(t){this.wrapResult||(1===this.orientation&&rh.call(this,t,void 0),ze.call(this,t))},hasHeightWrap:function(){return!(!this.hasRatioFitChild||0!==this.orientation)||Ae.call(this)},runHeightWrap:function(t){this.wrapResult||(0===this.orientation&&rh.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],h=n&&n.isRexSpace;return"center"===t?h||this.insertSpace(r+1):h&&this.remove(n,!0),this}};Object.assign(Sh,ph,mh,yh,bh,xh,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},Oh={x:0,h:0,horizontal:0,"left-to-right":0,y:1,v:1,vertical:1,"top-to-bottom":1},Ph=function(t){return"string"==typeof t&&(t=Oh[t]),t};const Th=Phaser.Utils.Objects.IsPlainObject,kh=Phaser.Utils.Objects.GetValue;class _h extends eh{constructor(t,e,i,s,r,n,h){Th(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)):Th(s)?(s=kh(h=s,"width",void 0),r=kh(h,"height",void 0),n=kh(h,"orientation",0)):Th(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=Ph(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 Eh=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=Mh[i])}void 0===s?s={}:!0===s&&(s=Rh);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 Mh={fit:0,FIT:0,envelop:1,ENVELOP:1};var Rh={},Lh={},zh={};const Dh=Phaser.Utils.Objects.IsPlainObject,Ah=Phaser.Utils.Objects.GetValue,Yh=Phaser.Display.Align.CENTER,Wh=Phaser.Utils.String.UUID;var Bh={add:function(t,e,i,s,r,n,h,a,o,l){ve.call(this,t),Dh(e)&&(e=Ah(d=e,"key",void 0),i=Ah(d,"align",Yh),s=Ah(d,"padding",0),r=Ah(d,"expand",!0),t.isRexSizer||(n=Ah(d,"minWidth",t._minWidth),h=Ah(d,"minHeight",t._minHeighted)),a=Ah(d,"offsetX",0),o=Ah(d,"offsetY",0),l=Ah(d,"aspectRatio",0));var d,c=void 0!==e;return c||(e=Wh()),"string"==typeof i&&(i=At[i]),void 0===i&&(i=Yh),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===l?l=0:!0===l&&(l=Q(t)/tt(t)),l>0&&(r=!0,void 0===n&&(n=0),void 0===h&&(h=0)),(d=this.getSizerConfig(t)).align=i,d.padding=ue(s),Dh(r)?(d.expandWidth=Ah(r,"width",!1),d.expandHeight=Ah(r,"height",!1)):(d.expandWidth=r,d.expandHeight=r),t.isRexSizer||(d.expandWidth&&(t.minWidth=void 0===n?Q(t):n),d.expandHeight&&(t.minHeight=void 0===h?tt(t):h)),d.alignOffsetX=a,d.alignOffsetY=o,d.aspectRatio=l,this.sizerChildren.hasOwnProperty(e)&&this.sizerChildren[e].destroy(),this.sizerChildren[e]=t,c&&this.addChildrenMap(e,t),this}},Xh={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]),Ce.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 gh.call(this,t),this}},jh={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=this.innerLeft,c=this.innerTop,u=this.innerWidth,p=this.innerHeight,v=this.sizerChildren;for(var g in v)(t=v[g]).rexSizer.hidden||(i=(e=t.rexSizer).padding,vr.call(this,t),a=this.getExpandedChildWidth(t),o=this.getExpandedChildHeight(t),e.aspectRatio>0&&(Lh.width=e.aspectRatio,Lh.height=1,zh.width=a,zh.height=o,a=(l=Eh(Lh,zh,"FIT",!0)).width,o=l.height),t.isRexSizer?(t.runLayout(this,a,o),ih(t,this)):Ie(t,a,o),s=d+i.left*this.scaleX,n=u-(i.left+i.right)*this.scaleX,r=c+i.top*this.scaleY,h=p-(i.top+i.bottom)*this.scaleY,gr.call(this,t,s,r,n,h,e.align,e.alignOffsetX,e.alignOffsetY))}};Object.assign(jh,Bh,Xh);const Ih=Phaser.Utils.Objects.IsPlainObject,Fh=Phaser.Utils.Objects.GetValue;class Nh extends eh{constructor(t,e,i,s,r,n){Ih(e)?(e=Fh(n=e,"x",0),i=Fh(n,"y",0),s=Fh(n,"width",void 0),r=Fh(n,"height",void 0)):Ih(s)&&(s=Fh(n=s,"width",void 0),r=Fh(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(Nh.prototype,jh);const Hh=_h.prototype.add,Gh=_h.prototype.addSpace;var Vh=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)&&Gh.call(this),Hh.call(this,t,{proportion:i,expand:!0});var s=!this.buttonsExpand&&"center"===this.buttonsAlign;s&&Gh.call(this),this.hasTailSpace=s}else Hh.call(this,t,{proportion:i,expand:!0}),this.hasTailSpace=!1;else if(this.hasTailSpace){var r=this.sizerChildren.length-1;Hh.call(this,t,{index:r,proportion:i,expand:!0})}else Hh.call(this,t,{proportion:i,expand:!0});return e&&this.buttonGroup.add(t),this},Uh={addButton(t){if(lr(t))for(var e=t,i=0,s=e.length;i=0;i--)Kh.call(this,e[i],t);return this}},Zh=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)}},Qh=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,Zh.call(e,t,i,s)}},enumerable:!0,configurable:!0}),t.selected=!1},ta={add(t){return this.buttons.push(t),t._click||(t._click=new br(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`),Qh.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=va(a.left,a.centerY,t,e))&&(r=o,s=n);var o,l=i[n+1];l&&l.y===a.y||r>(o=va(a.right,a.centerY,t,e))&&(r=o,s=n+1)}}return s};const fa=Phaser.Utils.Objects.IsPlainObject,ma=Phaser.Utils.Objects.GetValue,ya=Phaser.Display.Align.CENTER;var ba=function(t,e,i,s){return"\n"===t?(this.addNewLine(),this):(ve.call(this,t),fa(e)&&(e=ma(r=e,"padding",0),i=ma(r,"key",void 0),s=ma(r,"index",void 0)),void 0===e&&(e=0),(r=this.getSizerConfig(t)).align=ya,r.padding=ue(e),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},xa={add(t,e,i){if(lr(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,gh.call(this,t),this}},wa={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&&Ma.addNewLine(this)}else for(n=0,h=t.length;n=0;i--)Aa.call(this,e[i],t);return this}};const Wa=Phaser.Utils.Objects.GetValue;class Ba extends _a{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 aa({parent:this,eventEmitter:Wa(e,"eventEmitter",this),groupName:Wa(e,"groupName",void 0),clickConfig:Wa(e,"click",void 0)}).setButtonsType(e);var s=Wa(e,"background",void 0),r=Wa(e,"buttons",void 0);this.buttonsAlign=Wa(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(Ba.prototype,La,Ya,ha,la);var Xa=function(){return Array.prototype.reduce.call(arguments,ja,0)},ja=function(t,e){return t+e};const Ia=Phaser.Utils.Objects.IsPlainObject,Fa=Phaser.Utils.Objects.GetValue,Na=Phaser.Display.Align.CENTER;var Ha=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 Va(this.sizerChildren,null),gh.call(this,t),this}},$a={setColumnSpace(t){if(this.space.column||(this.space.column=[]),this.space.column.length=this.columnCount-1,"number"==typeof t)Va(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},Za={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=De.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===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,Va(this.sizerChildren,null),this.columnProportions=[],this.columnProportions.length=t,"number"==typeof i)Va(this.columnProportions,i);else for(var n=0;n0?e+=t:0===t&&(this.hasColumnProportion0Child=!0);return e},to=function(){for(var t,e=0,i=0;i0?e+=t:0===t&&(this.hasRowProportion0Child=!0);return e};const eo=Phaser.Utils.Objects.IsPlainObject,io=Phaser.Utils.Objects.GetValue;class so extends eh{constructor(t,e,i,s,r,n,h,a,o,l){eo(e)?(e=io(l=e,"x",0),i=io(l,"y",0),s=io(l,"width",void 0),r=io(l,"height",void 0),n=io(l,"column",l.col||0),h=io(l,"row",0),a=io(l,"columnProportions",0),o=io(l,"rowProportions",0)):eo(s)?(s=io(l=s,"width",void 0),r=io(l,"height",void 0),n=io(l,"column",l.col||0),h=io(l,"row",0),a=io(l,"columnProportions",0),o=io(l,"rowProportions",0)):eo(n)?(n=io(l=n,"column",l.col||0),h=io(l,"row",0),a=io(l,"columnProportions",0),o=io(l,"rowProportions",0)):eo(a)&&(a=io(l=a,"columnProportions",0),o=io(l,"rowProportions",0)),super(t,e,i,s,r,l),this.type="rexGridSizer",this.sizerChildren=[],this.addChildrenMap("items",this.sizerChildren),this.setCreateCellContainerCallback(io(l,"createCellContainerCallback")),this.setIndentLeft(io(l,"space.indentLeftOdd",0),io(l,"space.indentLeftEven",0)),this.setIndentTop(io(l,"space.indentTopOdd",0),io(l,"space.indentTopEven",0)),this.resetGrid(n,h,a,o,io(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=Qa.call(this)),this._totalColumnProportions}get totalRowProportions(){return void 0===this._totalRowProportions&&(this._totalRowProportions=to.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(so.prototype,Za);const ro=so.prototype.add;var no={addButton(t,e,i){return ro.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--)oo.call(this,e[i],t);return this}};const co=Phaser.Utils.Objects.GetValue;class uo extends so{constructor(t,e){void 0===e&&(e={});var i=co(e,"row",0),s=co(e,"column",e.col||0),r=co(e,"createCellContainerCallback"),n=co(e,"buttons",void 0),h=co(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},Go=0,Vo=1,Uo=2,$o=0,Jo=1,Ko=2,qo=/(?:\r\n|\r|\n)/;const Zo={none:$o,word:Jo,char:Ko,character:Ko,mix:3},Qo=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,h=r.height,a=Qo.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 el=Phaser.Display.Color;var il={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 el);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}},sl=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)},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,sl(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 nl=Phaser.Display.Canvas.CanvasPool,hl=Phaser.GameObjects.GameObject,al=Phaser.Utils.String.UUID;class ol extends hl{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=nl.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(){nl.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 ll=Phaser.GameObjects.Components;Phaser.Class.mixin(ol,[ll.Alpha,ll.BlendMode,ll.Crop,ll.Depth,ll.Flip,ll.GetBounds,ll.Mask,ll.Origin,ll.Pipeline,ll.PostPipeline,ll.ScrollFactor,ll.Tint,ll.Transform,ll.Visible,tl,il,rl]);var dl={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&>(this.data),this}};class cl{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(cl.prototype,dl);var ul={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 pl=Phaser.Math.RotateAround;var vl;const gl=Phaser.Geom.Rectangle;var fl,ml=function(t){void 0===fl&&(fl=new gl);var e=t.drawTLX,i=t.drawTLY;return fl.setTo(e,i,t.drawTRX-e,t.drawBLY-i),fl};const yl=Phaser.Math.RotateAround;var bl,xl=function(t,e,i,s){return void 0===s?s={}:!0===s&&(void 0===bl&&(bl={}),s=bl),s.x=e,s.y=i,0!==t.rotation&&yl(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 Sl,wl,Ol={},Pl=function(t,e,i,s,r){var n=xl(e,i,s,!0),h=function(t,e,i,s){void 0===s?s={}:!0===s&&(s=Ol);var r=e-t.width*t.originX,n=i-t.height*t.originY;return void 0===Sl&&(Sl=new Cl,wl=new Cl),t.parentContainer?t.getWorldTransformMatrix(Sl,wl):Sl.applyITRS(t.x,t.y,t.rotation,t.scaleX,t.scaleY),Sl.transformPoint(r,n,s),s}(t,n.x,n.y,r);return h},Tl=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 Pl(t,e,n,h,r)},kl={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===vl&&(vl={}),s=vl),s.x=(t-i.drawX)/i.scaleX,s.y=(e-i.drawY)/i.scaleY,0!==i.rotation&&pl(s,0,0,-i.rotation),s}(t,e,this,!0);return ml(this).contains(i.x,i.y)},getWorldPosition:function(t,e,i){return Tl(this.parent,this,t,e,i)}};Object.assign(kl,ul);const _l=Phaser.Math.DegToRad,El=Phaser.Math.RadToDeg,Ml=Phaser.Utils.Objects.GetValue;class Rl extends cl{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 El(this._rotation)}set angle(t){this.rotation=_l(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=Ml(t,"width",void 0),i=Ml(t,"height",void 0),s=Ml(t,"scaleX",void 0),r=Ml(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(Rl.prototype,kl);const Ll=Phaser.Utils.String.Pad;var zl=function(t,e,i){if(null==t)return t;switch(typeof t){case"string":default:return t;case"number":return`#${Ll(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}},Dl=function(t,e,i){return e.hasOwnProperty(t)?e[t]:i[t]};const Al=Phaser.Utils.Objects.GetValue;let Yl=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=Al(t,"x",0),i=Al(t,"y",0));var s=this.cornerRadius;s.tl=Wl(Al(t,"tl",void 0),e,i),s.tr=Wl(Al(t,"tr",void 0),e,i),s.bl=Wl(Al(t,"bl",void 0),e,i),s.br=Wl(Al(t,"br",void 0),e,i)}get radiusTL(){var t=this.cornerRadius.tl;return Math.max(t.x,t.y)}set radiusTL(t){Bl(this.cornerRadius.tl,t)}get radiusTR(){var t=this.cornerRadius.tr;return Math.max(t.x,t.y)}set radiusTR(t){Bl(this.cornerRadius.tr,t)}get radiusBL(){var t=this.cornerRadius.bl;return Math.max(t.x,t.y)}set radiusBL(t){Bl(this.cornerRadius.bl,t)}get radiusBR(){var t=this.cornerRadius.br;return Math.max(t.x,t.y)}set radiusBR(t){Bl(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}),Xl(t),t},Bl=function(t,e){"number"==typeof e?(t.x=e,t.y=e):(t.x=Al(e,"x",0),t.y=Al(e,"y",0)),Xl(t)},Xl=function(t){t.convex=t.x>=0||t.y>=0,t.x=Math.abs(t.x),t.y=Math.abs(t.y)};const jl=Phaser.Math.DegToRad;var Il=function(t){return!t.hasOwnProperty("convex")||t.convex},Fl=function(t){return t.x>0&&t.y>0},Nl=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,Fl(a)?(o=a.x*g,l=a.y*f,Il(a)?Nl(t,o,l,o,l,180,270,!1,h):Nl(t,0,0,o,l,90,0,!0,h),d=0,c=l):(t.lineTo(0,0),d=0,c=0),a=m.tr,Fl(a)?(o=a.x*g,l=a.y*f,Il(a)?Nl(t,s-o,l,o,l,270,360,!1,h):Nl(t,s,0,o,l,180,90,!0,h)):t.lineTo(s,0),a=m.br,Fl(a)?(o=a.x*g,l=a.y*f,Il(a)?Nl(t,s-o,r-l,o,l,0,90,!1,h):Nl(t,s,r,o,l,270,180,!0,h)):t.lineTo(s,r),a=m.bl,Fl(a)?(o=a.x*g,l=a.y*f,Il(a)?Nl(t,o,r-l,o,l,90,180,!1,h):Nl(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())},Gl=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),Hl(t.canvas,t.context,d,d,o,l,r,e,i,s,n,h,a)}};const Vl=Phaser.Utils.Objects.GetValue;class Ul extends Rl{constructor(t,e){super(t,"background"),this.setScrollFactor(0),this.setColor(Vl(e,"color",null),Vl(e,"color2",null),Vl(e,"horizontalGradient",!0)),this.setStroke(Vl(e,"stroke",null),Vl(e,"strokeThickness",2)),this.setCornerRadius(Vl(e,"cornerRadius",0),Vl(e,"cornerIteration",null))}set color(t){t=zl(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=zl(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=zl(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,Dl("color2",t,this),Dl("horizontalGradient",t,this)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,Dl("strokeThickness",t,this)),t.hasOwnProperty("cornerRadius")&&this.setCornerRadius(t.cornerRadius,Dl("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(){Gl(this.parent,this.color,this.stroke,this.strokeThickness,this.cornerRadius,this.color2,this.horizontalGradient,this.cornerIteration)}}const $l=Phaser.Utils.Objects.GetValue;class Jl extends Rl{constructor(t,e){super(t,"innerbounds"),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))}set color(t){t=zl(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=zl(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=zl(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,$l(t,"color2",null),$l(t,"horizontalGradient",!0)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,$l(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 Kl=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(Kl(t,"bold",!1)),this.setItalic(Kl(t,"italic",!1)),this.setFontSize(Kl(t,"fontSize","16px")),this.setFontFamily(Kl(t,"fontFamily","Courier")),this.setColor(Kl(t,"color","#fff")),this.setStrokeStyle(Kl(t,"stroke",null),Kl(t,"strokeThickness",0)),this.setShadow(Kl(t,"shadowColor",null),Kl(t,"shadowOffsetX",0),Kl(t,"shadowOffsetY",0),Kl(t,"shadowBlur",0)),this.setOffset(Kl(t,"offsetX",0),Kl(t,"offsetY",0)),this.setSpace(Kl(t,"leftSpace",0),Kl(t,"rightSpace",0)),this.setAlign(Kl(t,"align",void 0)),this.setBackgroundColor(Kl(t,"backgroundColor",null)),this.setBackgroundHeight(Kl(t,"backgroundHeight",void 0)),this.setBackgroundBottomY(Kl(t,"backgroundBottomY",void 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(Dl("stroke",t,this),Dl("strokeThickness",t,this)),t.hasOwnProperty("shadowColor")&&this.setShadowColor(t.shadowColor),(t.hasOwnProperty("shadowOffsetX")||t.hasOwnProperty("shadowOffsetY"))&&this.setShadowOffset(Dl("shadowOffsetX",t,this),Dl("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),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=zl(t),this}get hasFill(){return null!=this.color}setStrokeStyle(t,e){return this.stroke=zl(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=zl(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=zl(t),this}get hasBackgroundColor(){return null!=this.backgroundColor}setBackgroundHeight(t){return this.backgroundHeight=t,this}setBackgroundBottomY(t){return this.backgroundBottomY=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 Zl=Phaser.Utils.Array.Remove,Ql=Phaser.Utils.Array.Remove,td="text",ed="image",id="drawer",sd="space",rd="command";var nd=function(t){return t.type===td&&"\n"===t.text},hd=function(t){return t.type===td&&"\f"===t.text},ad=function(t){return t.type===td};class od extends Rl{constructor(t,e,i){super(t,td),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,s=this.drawTRX-i+1,r=e.backgroundBottomY;null==r&&(r=this.drawBLY);var n=e.backgroundHeight;null==n&&(n=r-this.drawTLY);var h=r-n;t.fillRect(i,h,s,n)}var a=e.hasFill,o=e.hasStroke;(a||o)&&(e.syncFont(t).syncStyle(t),o&&(e.syncShadow(t),t.strokeText(this.text,0,0)),a&&(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 ld=function(t,e){var i=this.createCharChildren(t,e);return this.addChild(i),this};const dd=Phaser.Display.Canvas.CanvasPool;var cd=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=dd.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),dd.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 ud extends Rl{constructor(t,e,i){super(t,ed),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(){cd(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 pd extends Rl{constructor(t,e,i,s){super(t,id),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 vd extends Rl{constructor(t,e){super(t,sd),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 gd extends cl{constructor(t,e,i,s,r){super(t,rd),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 fd(t){if(null===t||"object"!=typeof t)return t;if(Array.isArray(t))return t.map((t=>fd(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]=fd(t[i]));return e}var md=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 yd={none:0,word:1,char:2,character:2,mix:3};var bd=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=wd.call(this)).height,h=l.ascent,i=Math.floor((o-h)/n))}else{var l;n=(l=wd.call(this)).height,h=l.ascent}}else this.fixedHeight>0?void 0===(i=Pd(t,"maxLines"))&&(o=this.fixedHeight-s,i=Math.floor(o/n)):i=Pd(t,"maxLines",0);void 0===h&&(h=n);var d=0===i,c=Pd(t,"wrapMode");void 0===c&&(c=Pd(t,"charWrap",!1)?"char":"word"),"string"==typeof c&&(c=yd[c]);var u=Pd(t,"wrapWidth",void 0);void 0===u&&(this.fixedWidth>0?u=this.fixedWidth-r:(u=1/0,c=0));for(var p=Pd(t,"letterSpacing",0),v=Pd(t,"hAlign",0),g=Pd(t,"vAlign",0),f=Pd(t,"justifyPercentage",.25),m=md({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=!z&&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=_d(t,"maxLines",void 0))){var h=this.fixedWidth-r;i=Math.floor(h/n)+1}}else i=_d(t,"maxLines",0);var a=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=md({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 W=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 Ee(i,t,e),this.dirty=this.dirty||s!=i.left||r!=i.right||n!=i.top||h!=i.bottom,this},getPadding:function(t){return _e(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),Zl(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 Ql(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(td);return null===i?i=new od(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)),Tl(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 Qd=Phaser.Utils.Objects.GetFastValue;var tc={};class ec{constructor(t){this.pools=Qd(t,"pools",tc)}free(t){if(!this.pools)return this;var e=t.type;return this.pools.hasOwnProperty(e)||(this.pools[e]=new Zd),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=lc(t,r,e,i,n),a=0;a<=hc&&0!==h;a++){if((r+=h)<0){r=0;break}h=lc(t,r,e,i,n)}return a===hc&&console.warn("FontSizeFit: Test count exceeds 65535"),t.setFontSize(r),dc(t,e,i),t},oc=function(t,e,i){return void 0===i[e]&&(t.setFontSize(e),i[e]={width:t.width,height:t.height}),i[e]},lc=function(t,e,i,s,r){var n,h=oc(t,e,r),a=oc(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)},dc=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 cc=Phaser.Utils.Objects.GetValue,uc=Phaser.Utils.Objects.GetValue;class pc extends Eo{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexLabel";var i,s=uc(e,"background",void 0),r=uc(e,"icon",void 0),n=uc(e,"iconMask",void 0),h=uc(e,"text",void 0),a=uc(e,"action",void 0),o=uc(e,"actionMask",void 0),l=uc(e,"align",void 0);if(s&&this.addBackground(s),r){0===this.orientation?(h||a)&&(i={right:uc(e,"space.icon",0),top:uc(e,"space.iconTop",0),bottom:uc(e,"space.iconBottom",0),left:uc(e,"space.iconLeft",0)}):(h||a)&&(i={bottom:uc(e,"space.icon",0),left:uc(e,"space.iconLeft",0),right:uc(e,"space.iconRight",0),top:uc(e,"space.iconTop",0)});var d=uc(e,"squareFitIcon",!1)?1:0;if(this.add(r,{proportion:0,padding:i,fitRatio:d}),n&&(n=Ao.call(this,r,r,1)),!d){var c=uc(e,"iconSize",void 0);this.setIconSize(uc(e,"iconWidth",c),uc(e,"iconHeight",c))}}if(h){var u=uc(e,"wrapText",!1),p=uc(e,"adjustTextFontSize",!1);u?(!0===u&&(u="word"),function(t,e){switch(jo(t)){case 0:switch("string"==typeof e&&(e=Zo[e]||0),t.style.wrapMode=e,e){case 2:case 3:t.style.wordWrapCallback=No;break;default:t.style.wordWrapCallback=null}break;case 1:"string"==typeof e&&(e=Zo[e]||0),t.style.wrapMode=e}}(h,u),e.expandTextWidth=!0,nc(h)):p&&(e.expandTextWidth=!0,e.expandTextHeight=!0,function(t,e){"number"==typeof e&&(e={minWidth:e});var i=cc(e,"minWidth",0),s=cc(e,"minHeight",0),r=cc(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 ac(t,e,i),t}):(t.runWidthWrap=function(e){return t.setFixedSize&&t.setFixedSize(0,0),ac(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=uc(e,"space.text",0),m=uc(e,"expandTextWidth",!1),y=uc(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:uc(e,"space.actionTop",0),bottom:uc(e,"space.actionBottom",0),right:uc(e,"space.actionRight",0)}:{left:uc(e,"space.actionLeft",0),right:uc(e,"space.actionRight",0),bottom:uc(e,"space.actionBottom",0)},d=uc(e,"squareFitAction",!1)?1:0,this.add(a,{proportion:0,padding:i,fitRatio:d}),o&&(o=Ao.call(this,a,a,1)),!d)){var b=uc(e,"actionSize");this.setActionSize(uc(e,"actionWidth",b),uc(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 vc=Phaser.Renderer.WebGL.Utils,gc=function(t,e,i,s,r,n){for(var h=vc.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+")"},xc=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 Sc={renderWebGL:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.pipelines.set(e.pipeline),n=yc(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&&gc(r,h,e,l,a,o),e.isStroked&&mc(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(Oc.prototype,Sc);var Pc=function(t){return t.x>0&&t.y>0},Tc=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 kc=Phaser.Math.DegToRad;var _c=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 ku).setName("trackFill")).addShape((new ku).setName("bar")).addShape((new ku).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&&_u(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),_u(h,r,0,n,i,t));var a=this.getShape("trackStroke");a.lineStyle(this.trackStrokeThickness,this.trackStrokeColor),a.isStroked&&_u(a,0,0,e,i,t)}};Object.assign(Ru.prototype,Lu);var zu=function(t){return null==t||""===t||0===t.length},Du=function(t,e,i,s){if(void 0===s&&(s="."),"object"==typeof t){if(zu(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(zu(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=fd(i),s=fd(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 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={},qe(t).events.once("destroy",(function(){for(var t in ap)ap[t].destroy();ap=void 0}))),!ap.hasOwnProperty(e)){var i=qe(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 Qe{constructor(t,e){return super(t),new Proxy(this,this)}get(t,e){if(Wu(t,e))return t[e];var i=t.parent;return Wu(i,e)?i[e]:void 0}set(t,e,i){return Wu(t,e)?t[e]=i:Wu(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. diff --git a/dist/rexnumberbar.js b/dist/rexnumberbar.js index 99f3014579..f6cb4da8c7 100644 --- a/dist/rexnumberbar.js +++ b/dist/rexnumberbar.js @@ -13598,6 +13598,10 @@ radius.y = Math.abs(radius.y); }; + var IsArcCorner = function (radius) { + return ((radius.x > 0) && (radius.y > 0)); + }; + var LineTo = function (x, y, pathData) { var cnt = pathData.length; if (cnt >= 2) { @@ -13679,8 +13683,7 @@ geom.setTo(0, 0, width, height, radius); } - var iteration = GetValue$a(radiusConfig, 'iteration', undefined); - this.setIteration(iteration); + this.setIteration(GetValue$a(radiusConfig, 'iteration', undefined)); this.setPosition(x, y); this.setFillStyle(fillColor, fillAlpha); @@ -13933,10 +13936,6 @@ } - var IsArcCorner = function (radius) { - return ((radius.x > 0) && (radius.y > 0)); - }; - const ShapeTypeMap = { rectangle: 0, circle: 1 @@ -15502,6 +15501,7 @@ var skewX = this.skewX; var width = this.width - Math.abs(skewX); var height = this.height; + var trackFill = this.getShape('trackFill'); trackFill.fillStyle(this.trackColor); if (trackFill.isFilled) { @@ -15510,8 +15510,7 @@ 0, 0, // x0, y0 width, height, // x1, y1 skewX // skewX - ) - .close(); + ); } var bar = this.getShape('bar'); @@ -15531,8 +15530,7 @@ barX0, 0, // x0, y0 barX1, height, // x1, y1 skewX // skew - ) - .close(); + ); } var trackStroke = this.getShape('trackStroke'); @@ -15543,8 +15541,7 @@ 0, 0, // x0, y0 width, height, // x1, y1 skewX // skewX - ) - .end(); + ); } }; @@ -15564,6 +15561,8 @@ .lineTo(x0, y0).lineTo(startX, y0); } + lines.close(); + return lines; }; @@ -15574,24 +15573,33 @@ constructor(scene, x, y, width, height, barColor, value, config) { if (IsPlainObject$3(x)) { config = x; - x = GetValue$7(config, 'x', 0); - y = GetValue$7(config, 'y', 0); - width = GetValue$7(config, 'width', 2); - height = GetValue$7(config, 'height', 2); - barColor = GetValue$7(config, 'barColor', undefined); - value = GetValue$7(config, 'value', 0); + + x = config.x; + y = config.y; + width = config.width; + height = config.height; + barColor = config.barColor; + value = config.value; } else if (IsPlainObject$3(width)) { config = width; - width = GetValue$7(config, 'width', 2); - height = GetValue$7(config, 'height', 2); - barColor = GetValue$7(config, 'barColor', undefined); - value = GetValue$7(config, 'value', 0); + + width = config.width; + height = config.height; + barColor = config.barColor; + value = config.value; } else if (IsPlainObject$3(barColor)) { config = barColor; - barColor = GetValue$7(config, 'barColor', undefined); - value = GetValue$7(config, 'value', 0); + + barColor = config.barColor; + value = config.value; } + if (x === undefined) { x = 0; } + if (y === undefined) { y = 0; } + if (width === undefined) { width = 2; } + if (height === undefined) { height = width; } + if (value === undefined) { value = 0; } + super(scene, x, y, width, height, config); this.type = 'rexLineProgress'; diff --git a/dist/rexnumberbar.min.js b/dist/rexnumberbar.min.js index 852225071e..670f16518f 100644 --- a/dist/rexnumberbar.min.js +++ b/dist/rexnumberbar.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=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}},we=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 Oe=/(\S+)\[(\d+)\]/i,Ee=Phaser.Utils.Objects.GetValue;var Te=function(t,e){return void 0===e?t:t[e]},ke=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=Ee(e,"left",0),t.right=Ee(e,"right",0),t.top=Ee(e,"top",0),t.bottom=Ee(e,"bottom",0)),t},De={getInnerPadding(t){return Te(this.space,t)},setInnerPadding(t,e){return ke(this.space,t,e),this},getOuterPadding(t){return Te(this.getSizerConfig(this).padding,t)},setOuterPadding(t,e){return ke(this.getSizerConfig(this).padding,t,e),this},getChildOuterPadding(t,e){return"string"==typeof t&&(t=this.getElement(t)),Te(this.getSizerConfig(t).padding,e)},setChildOuterPadding(t,e,i){return"string"==typeof t&&(t=this.getElement(t)),ke(this.getSizerConfig(t).padding,e,i),this}},Me=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}},Re=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},Le=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}},je=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},ze=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?vi:pi,this.repeatCounter=0,this}stop(){return this.state=ci,this}update(t,e){this.state!==ci&&this.state!==gi&&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=fi)):(this.nowTime=this.duration,this.state=gi):this.nowTime>=0&&(this.state=vi))}get t(){var t;switch(this.state){case ci:case pi:case fi:t=0;break;case vi:t=this.nowTime/this.duration;break;case gi:t=1}return di(t,0,1)}set t(t){(t=di(t,-1,1))<0?(this.state=pi,this.nowTime=-this.delay*t):(this.state=vi,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===ci}get isDelay(){return this.state===pi}get isCountDown(){return this.state===vi}get isRunning(){return this.state===pi||this.state===vi}get isDone(){return this.state===gi}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}}const ci=0,pi=1,vi=2,fi=3,gi=-1;class mi extends hi{constructor(t,e){super(t,e),this.timer=new ui}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 yi=Phaser.Utils.Objects.GetValue,bi=Phaser.Utils.Objects.GetAdvancedValue,Ci=Phaser.Tweens.Builders.GetEaseFunction;class _i extends mi{resetFromJSON(t){return this.timer.resetFromJSON(yi(t,"timer")),this.setEnable(yi(t,"enable",!0)),this.setTarget(yi(t,"target",this.parent)),this.setDelay(bi(t,"delay",0)),this.setDuration(bi(t,"duration",1e3)),this.setEase(yi(t,"ease","Linear")),this.setRepeat(yi(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 Si=Phaser.Utils.Objects.GetValue,Pi=Phaser.Utils.Objects.GetAdvancedValue,xi=Phaser.Math.Linear;let wi=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(Si(t,"mode",0)),this.setScaleRange(Pi(t,"start",void 0),Pi(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=Oi[t]),this.mode=t,this}setScaleRange(t,e){return"number"==typeof t?(this.startX=t,this.startY=t):(this.startX=Pi(t,"x",this.parent.scaleX),this.startY=Pi(t,"y",this.parent.scaleY)),"number"==typeof e?(this.endX=e,this.endY=e):(this.endX=Pi(e,"x",void 0),this.endY=Pi(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=xi(this.startX,this.endX,i)),this.hasScaleY&&(t.scaleY=xi(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}};const Oi={stop:0,destroy:1,yoyo:2};var Ei=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 wi(t,h):r.resetFromJSON(h),r.restart(),r},Ti=function(t,e,i,s,r,n){void 0===s&&(s="Linear"),r instanceof wi&&(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 wi(t,a):n.resetFromJSON(a),n.restart(),n},ki=function(t,e){return new Promise((function(i,s){t.once(e,(function(){i()}))}))},Di=function(t){return ki(t,"complete")};const Mi=Phaser.Utils.Objects.IsPlainObject;var Ri={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(Mi(t)){var s=t;t=s.duration,e=s.orientation,i=s.ease}var r=void 0===this._scaleBehavior;return this._scaleBehavior=Ei(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(Mi(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=Ti(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(Mi(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 wi(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()}},Li={};Object.assign(Li,Ri),Li.onInitScale=function(){Ri.onInitScale.call(this);var t=this;this._scaleBehavior.on("update",(function(){var e=me.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const Ai=Phaser.Utils.Objects.GetValue,ji=Phaser.Utils.Objects.GetAdvancedValue,zi=Phaser.Math.Linear;class Xi extends _i{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(ji(t,"start",this.parent.alpha),ji(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=zi(this.alphaStart,this.alphaEnd,i)}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Fi={stop:0,destroy:1,yoyo:2},Yi=Phaser.Utils.Objects.IsPlainObject;var Ii=function(t,e,i,s){var r,n;Yi(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},Ni=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 Wi=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(Wi(t)){var i=t;t=i.duration,e=i.alpha}var s=void 0===this._fade;return this._fade=Ii(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(Wi(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()}},Bi={};Object.assign(Bi,Vi),Bi.onInitFade=function(){Vi.onInitFade.call(this);var t=this;this._fade.on("update",(function(){var e=me.getParentSizer(t);e&&e.resetChildAlphaState(t)}))};const Gi=Phaser.Utils.Objects.GetValue,Ui=Phaser.Utils.Objects.GetAdvancedValue,Hi=Phaser.Math.Linear;class Ji extends _i{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){if(super.resetFromJSON(t),this.setMode(Gi(t,"mode",0)),t&&(t.hasOwnProperty("x")||t.hasOwnProperty("y"))){var e=Ui(t,"x",void 0),i=Ui(t,"y",void 0);this.setTargetPosition(e,i)}else this.setTargetPosition(t);return this}setMode(t){return"string"==typeof t&&(t=$i[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=Ui(i,"startX",void 0),this.startY=Ui(i,"startY",void 0),this.endX=Ui(i,"endX",void 0),this.endY=Ui(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=Hi(this.startX,this.endX,i)),this.hasMoveY&&(t.y=Hi(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const $i={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 Ki=Phaser.Utils.Objects.IsPlainObject,Zi=Phaser.Math.Distance.Between;var Qi={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(Ki(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*Zi(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 Ji&&(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 Ji(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(Ki(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*Zi(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 Ji&&(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 Ji(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}},ts={};Object.assign(ts,Qi),ts.onInitEaseMove=function(){Qi.onInitEaseMove.call(this);var t=this;this._easeMove.on("update",(function(){var e=me.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const es=Phaser.Utils.Objects.GetValue;class is extends ri{constructor(t,e){super(t,e),this.timer=new ui,this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.timer.resetFromJSON(es(t,"timer")),this.setEnable(es(t,"enable",!0)),this.setMode(es(t,"mode",1)),this.isRunning=es(t,"isRunning",!1),this.setMagnitudeMode(es(t,"magnitudeMode",1)),this.setAxisMode(es(t,"axis",0)),this.setDuration(es(t,"duration",500)),this.setMagnitude(es(t,"magnitude",10)),this.ox=es(t,"ox",void 0),this.oy=es(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=ss[t]),this.mode=t,this}setMagnitudeMode(t){return"string"==typeof t&&(t=ns[t]),this.magnitudeMode=t,this}setAxisMode(t){return"string"==typeof t&&(t=rs[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=es(i,"magnitude",void 0),t=es(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 ss={effect:0,behavior:1},rs={both:0,"h&v":0,"x&y":0,horizontal:1,h:1,x:1,vertical:2,v:2,y:2},ns={constant:0,decay:1},as=Phaser.Utils.Objects.IsPlainObject;var hs={shake(t,e,i){if(as(t)){var s=t;t=s.duration,e=s.magnitude,i=s.magnitudeMode}return void 0===this._shake&&(this._shake=new is(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 os=Phaser.Utils.Objects.GetValue,ls=Phaser.Math.Linear;class ds 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=os(t,"key","value");var i=e[this.propertyKey];return this.fromValue=os(t,"from",i),this.toValue=os(t,"to",i),this.setEase(os(t,"ease",this.ease)),this.setDuration(os(t,"duration",this.duration)),this.setRepeat(os(t,"repeat",0)),this.setDelay(os(t,"delay",0)),this.setRepeatDelay(os(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]=ls(this.fromValue,this.toValue,i)}}const us=Phaser.Utils.Objects.IsPlainObject;class cs extends Qe{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 ds(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(us(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(us(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 ps={easeDataTo(t,e,i,s){return this._easeData||(this._easeData=new cs(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),ki(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}},vs=Phaser.Utils.Array.Remove,fs={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=Je(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}},Ms={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}},Rs={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}},Ls={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,Ds,Ms,Rs,Ls);const js=Phaser.Utils.Objects.GetValue;class zs extends Qe{constructor(t,e){super(t,e),this.setTransitInTime(js(e,"duration.in",200)),this.setTransitOutTime(js(e,"duration.out",200)),this.setTransitInCallback(js(e,"transitIn")),this.setTransitOutCallback(js(e,"transitOut")),this.oneShotMode=js(e,"destroy",!1),this.delayCallTimer=void 0,this._state=new ks(this,{eventEmitter:!1,initState:js(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(zs.prototype,As);var Xs=function(t){if(t.parentContainer)return Xs(t.parentContainer);var e=function(t){var e=t.displayList;return H(e)?e:null}(t);return e?Xs(e):t};class Fs extends Qe{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=Xs(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 Ys=Phaser.GameObjects.Rectangle;class Is extends Ys{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 Ws extends Qe{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 Bs=Phaser.Utils.Objects.GetValue;class Gs extends Is{constructor(t,e){super(t,Bs(e,"color",0),Bs(e,"alpha",.8)),this.touchEventStop=new Ws(this,{hitAreaMode:1})}}var Us={popUp(t,e){void 0!==t._modalScaleSave?(t.scaleX=t._modalScaleSave,t.scaleY=t._modalScaleSave):t._modalScaleSave=t.scaleX,Ei(t,e)},scaleDown(t,e){Ti(t,e,void 0,void 0,!1)},fadeIn(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Ii(t,e)},fadeOut(t,e){Ni(t,e,!1)}},Hs=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Ii(t,e,t.alpha)},Js=function(t,e){Ni(t,e,!1)},$s=function(t,e,i,s,r){return!(!t||s&&!s(t,e,i)||!rt(t,!0).contains(e,i)||r&&!r(t,e,i))};const qs=Phaser.Utils.Objects.GetValue;let Ks=class extends zs{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=Zs.popUp),null==e.transitOut&&(e.transitOut=Zs.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 Gs(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",Hs)),this.setCoverTransitOutCallback(qs(i,"transitOut",Js)));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&&$s(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=Zs[t]),t){case Zs.popUp:t=Us.popUp;break;case Zs.fadeIn:t=Us.fadeIn}return super.setTransitInCallback(t),this}setTransitOutCallback(t){switch("string"==typeof t&&(t=Zs[t]),t){case Zs.scaleDown:t=Us.scaleDown;break;case Zs.fadeOut:t=Us.fadeOut}return super.setTransitOutCallback(t),this}setCoverTransitInCallback(t){return this.coverTransitInCallback=t,this}setCoverTransitOutCallback(t){return this.coverTransitOutCallback=t,this}};const Zs={popUp:0,fadeIn:1,scaleDown:0,fadeOut:1};var Qs=function(t){return t&&"function"==typeof t},tr={modal(t,e){return Qs(t)&&(e=t,t=void 0),void 0===this._modalBehavior&&(this.onCreateModalBehavior&&this.onCreateModalBehavior(this,t),this._modalBehavior=function(t,e){var i=new Ks(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}},er=function(t,e,i,s,r){Qs(e)&&(r=s,s=i,i=e,e=this);var n=this.scene.events;return this.bindEvent(e,n,t,i,s,r),this},ir={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 er.call(this,"preupdate",t,e,i,s),this},bindSceneUpdateEvent(t,e,i,s){return er.call(this,"update",t,e,i,s),this},bindScenePostupdateEvent(t,e,i,s){return er.call(this,"postupdate",t,e,i,s),this},bindSceneRenderEvent(t,e,i,s){return er.call(this,"render",t,e,i,s),this},bindScenePauseEvent(t,e,i,s){return er.call(this,"pause",t,e,i,s),this},bindSceneResumeEvent(t,e,i,s){return er.call(this,"resume",t,e,i,s),this},bindSceneSleepEvent(t,e,i,s){return er.call(this,"sleep",t,e,i,s),this},bindSceneWakeEvent(t,e,i,s){return er.call(this,"wake",t,e,i,s),this},bindSceneShutdownEvent(t,e,i,s){return er.call(this,"shutdown",t,e,i,s),this}},sr=function(t,e,i){var s=t.camera;return s?(void 0===i?i={}:!0===i&&(i=rr),s===e?(i.x=t.worldX,i.y=t.worldY):s.getWorldPoint(t.x,t.y,i),i):null},rr={},nr=function(t,e,i,s){var r,n=t.scene.sys.cameras.main,a=0===t.scrollFactorX&&0===t.scrollFactorY;if(e)return a?$s(t,e.x,e.y,i,s):!!(r=sr(e,n,!0))&&$s(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 gr={press:0,pointerdown:0,release:1,pointerup:1};var mr={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 fr(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}},yr=function(t,e,i,s,r){if(e)return!(i&&!i(t,e)||!br(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 _r=Phaser.Utils.Objects.GetValue;class Sr extends Qe{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=Pr[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?yr:nr)(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 Pr={press:0,pointerdown:0,release:1,pointerup:1};var xr={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 Sr(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 wr extends Ts{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 Or=Phaser.Utils.Objects.GetValue;class Er extends Qe{constructor(t,e){super(t,e),this._enable=void 0,this.cooldown=new wr,this.parent.setInteractive(Or(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.prevIsInTouch=!1,this.isInTouching=!1,this.setEnable(Or(t,"enable",!0)),this.setCooldown(Or(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 Tr={isPointerInBounds(t){return void 0===t?t=this:"string"==typeof t&&(t=this.getElement(t)),!!t&&nr(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 Er(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 Er(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}},kr={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=Ur,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===Hr&&this.onDragEnd(),this.pointer=void 0,this.tracerState=Ur,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=Jr,this}isPointerInGameObject(t,e,i){var s=this.lastPointer;return!!s&&nr(t,s,e,i)}}const Ur=0,Hr=1,Jr="IDLE",$r=Phaser.Utils.Objects.GetValue,qr=Phaser.Math.Distance.Between;class Kr extends Gr{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=Zr},eventEmitter:!1};this.setRecongizedStateObject(new Ts(s))}resetFromJSON(t){super.resetFromJSON(t),this.setHoldTime($r(t,"time",250)),this.setTapInterval($r(t,"tapInterval",200)),this.setDragThreshold($r(t,"threshold",9)),this.setTapOffset($r(t,"tapOffset",10));var e=$r(t,"taps",void 0);return void 0!==e?this.setTaps(e):(this.setMaxTaps($r(t,"maxTaps",void 0)),this.setMinTaps($r(t,"minTaps",void 0))),this}onDragStart(){switch(this.state){case Zr:this.state=Qr;break;case Qr:var t=this.lastPointer;qr(t.upX,t.upY,t.x,t.y)>this.tapOffset&&(this.state=tn,this.state=Qr);break;case tn:this.state=Qr}}onDragEnd(){this.state===Qr&&(this.tapsCount++,this.emit("tapping",this,this.gameObject,this.lastPointer),void 0!==this.maxTaps&&this.tapsCount===this.maxTaps&&(this.state=tn))}onDrag(){this.state!==Zr&&this.pointer.getDistance()>this.dragThreshold&&(this.state=Zr)}preUpdate(t,e){if(this.isRunning&&this.enable&&this.state===Qr){var i=this.lastPointer;i.isDown?t-i.downTime>this.holdTime&&(this.state=Zr):t-i.upTime>this.tapInterval&&(void 0===this.minTaps||this.tapsCount>=this.minTaps?this.state=tn:this.state=Zr)}}postUpdate(t,e){this.isRunning&&this.enable&&this.state===tn&&(this.state=Zr)}get isTapped(){return this.state===tn}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 Zr="IDLE",Qr="BEGIN",tn="RECOGNIZED",en=Phaser.Utils.Objects.GetValue;class sn extends Gr{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=rn},eventEmitter:!1};this.setRecongizedStateObject(new Ts(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(en(t,"threshold",9)),this.setHoldTime(en(t,"time",251)),this}onDragStart(){this.state=nn,0===this.holdTime&&(this.state=an)}onDragEnd(){this.state=rn}onDrag(){this.state!==rn&&this.pointer.getDistance()>this.dragThreshold&&(this.state=rn)}preUpdate(t,e){this.isRunning&&this.enable&&this.state===nn&&t-this.pointer.downTime>=this.holdTime&&(this.state=an)}get isPressed(){return this.state===an}setHoldTime(t){return this.holdTime=t,this}setDragThreshold(t){return this.dragThreshold=t,this}}const rn="IDLE",nn="BEGIN",an="RECOGNIZED";Phaser.Utils.Objects.GetValue;const hn=Phaser.Math.Distance.Between,on=Phaser.Math.Angle.Between;var ln={getDt:function(){var t;return t=this.scene,Ke(t).loop.delta},getVelocity:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return hn(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 on(e.x,e.y,t.x,t.y)}},dn={"up&down":0,"left&right":1,"4dir":2,"8dir":3},un={};const cn=Phaser.Utils.Objects.GetValue,pn=Phaser.Math.RadToDeg;class vn extends Gr{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=fn},eventEmitter:!1};this.setRecongizedStateObject(new Ts(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=gn}onDragEnd(){this.state=fn}onDrag(){this.state===gn&&(this.validDrag||(this.validDrag=0===this.dragThreshold||this.pointer.getDistance()>=this.dragThreshold),this.validDrag&&this.dragVelocity>this.velocityThreshold&&(this.state=mn))}postUpdate(t,e){this.isRunning&&this.enable&&this.state===mn&&(this.state=fn)}get isSwiped(){return this.state===mn}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=dn[t]),this.dirMode=t,this}updateDirectionStates(){return function(t,e,i){switch(void 0===i?i={}:!0===i&&(i=un),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}}(pn(this.getVelocityAngle()),this.dirMode,this),this}clearDirectionStates(){return this.left=!1,this.right=!1,this.up=!1,this.down=!1,this}}Object.assign(vn.prototype,ln);const fn="IDLE",gn="BEGIN",mn="RECOGNIZED",yn=Phaser.Utils.Objects.GetValue,bn=Phaser.Utils.Array.SpliceOne,Cn=Phaser.Math.Distance.Between,_n=Phaser.Math.Angle.Between;class Sn{constructor(t,e){var i=Je(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(yn(e,"inputConfig",void 0)),this.setEventEmitter(yn(e,"eventEmitter",void 0)),this._enable=void 0,this.pointers=[],this.movedState={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setEnable(yn(t,"enable",!0)),this.bounds=yn(t,"bounds",void 0),this.tracerState=xn,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 xn:this.tracerState=wn,this.onDrag1Start();break;case wn:this.tracerState=On,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],bn(this.pointers,e),this.tracerState){case wn:this.tracerState=xn,this.onDrag1End();break;case On:this.tracerState=wn,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 wn:this.onDrag1();break;case On:this.onDrag2()}}}dragCancel(){return this.tracerState===On&&this.onDrag2End(),this.pointers.length=0,ft(this.movedState),this.tracerState=xn,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!==On)return 0;var t=this.pointers[0],e=this.pointers[1];return Cn(t.x,t.y,e.x,e.y)}get angleBetween(){if(this.tracerState!==On)return 0;var t=this.pointers[0],e=this.pointers[1];return _n(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;Pn.x=e.x-i.x,Pn.y=e.y-i.y}else Pn.x=0,Pn.y=0;return Pn}get centerX(){if(this.tracerState!==On)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.x+e.x)/2}get centerY(){if(this.tracerState!==On)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.y+e.y)/2}get prevCenterX(){if(this.tracerState!==On)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!==On)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=En,this}isPointer0InGameObject(t,e,i){var s=this.pointers[0];return!!s&&nr(t,s,e,i)}isPointer1InGameObject(t,e,i){var s=this.pointers[1];return!!s&&nr(t,s,e,i)}}Object.assign(Sn.prototype,Ge);var Pn={};const xn=0,wn=1,On=2,En="IDLE";Phaser.Utils.Objects.GetValue;const Tn=Phaser.Math.RotateAround;var kn=function(t,e,i,s){return Tn(t,e,i,s),t.rotation+=s,t},Dn={};const Mn=Phaser.Utils.Objects.GetValue,Rn=Phaser.Math.Angle.WrapDegrees,Ln=Phaser.Math.Angle.ShortestBetween,An=Phaser.Math.RadToDeg,jn=Phaser.Math.DegToRad;var zn={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=Dn),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=Rn(An(this.angleBetween));this.angle=Ln(this.prevAngle,t),this.prevAngle=t,this.state=Yn}break;case Yn:t=Rn(An(this.angleBetween)),this.angle=Ln(this.prevAngle,t),this.prevAngle=t,this.emit("rotate",this)}}get isRotated(){return this.state===Yn}get rotation(){return jn(this.angle)}setDragThreshold(t){return this.dragThreshold=t,this}}.prototype,zn);const Xn="IDLE",Fn="BEGIN",Yn="RECOGNIZED",In=Phaser.Utils.Objects.GetValue;var Nn=function(t){var e=In(t,"tap",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._tap=new Kr(this,e),this._tap.on("tap",(function(t,e,s){Mr(i.eventEmitter,`${i.eventNamePrefix}${t.tapsCount}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Wn=Phaser.Utils.Objects.GetValue;var Vn=function(t){var e=Wn(t,"press",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._press=new sn(this,e),this._press.on("pressstart",(function(t,e,s){Mr(i.eventEmitter,`${i.eventNamePrefix}pressstart`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this).on("pressend",(function(t,e,s){Mr(i.eventEmitter,`${i.eventNamePrefix}pressend`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Bn=Phaser.Utils.Objects.GetValue;var Gn=function(t){var e=Bn(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 vn(this,e),this._swipe.on("swipe",(function(t,e,s){var r=t.left?"left":t.right?"right":t.up?"up":"down";Mr(i.eventEmitter,`${i.eventNamePrefix}swipe${r}`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Un=Phaser.Utils.Objects.GetValue;var Hn=function(t,e){return t.setInteractive(),Un(e,"dropZone",!1)&&(t.input.dropZone=!0),t._childrenInteractive={targetSizers:Un(e,"targets",[t]),targetMode:Un(e,"targetMode","parent"),eventEmitter:Un(e,"eventEmitter",t),eventNamePrefix:Un(e,"inputEventPrefix","child.")},Lr.call(t,e),zr.call(t,e),Yr.call(t,e),Vr.call(t,e),Nn.call(t,e),Vn.call(t,e),Gn.call(t,e),t},Jn={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",le),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)}}for(var d,u,c=this.getAllShownChildren([this]),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 sa=Phaser.Utils.Objects.IsPlainObject,ra=Phaser.Utils.Objects.GetValue,na=Phaser.Display.Align.CENTER,aa={min:0,full:-1};var ha=function(t,e,i,s,r,n,a,h,o,l){ve.call(this,t);var d=t.isRexSpace,u=typeof e;if(null===e)return this;if("number"===u);else if("string"===u)e=aa[e];else if(sa(e)){var c;e=ra(c=e,"proportion",void 0),i=ra(c,"align",na),s=ra(c,"padding",0),r=ra(c,"expand",!1),n=ra(c,"key",void 0),a=ra(c,"index",void 0),t.isRexSizer||(h=ra(c,"minWidth",void 0),o=ra(c,"minHeight",void 0)),l=ra(c,"fitRatio",0)}return"string"==typeof i&&(i=jt[i]),void 0===e&&(e=d?1:0),void 0===i&&(i=na),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===h&&(d?h=0:t.isRexSizer||(h=t._minWidth)),void 0===o&&(d?o=0:t.isRexSizer||(o=t._minHeight)),void 0===l||!1===l?l=0:!0===l&&(l=Q(t)/tt(t)),(c=this.getSizerConfig(t)).proportion=e,c.align=i,c.padding=ce(s),c.expand=r,c.fitRatio=0===e?l:0,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},oa={add:ha,addSpace(t){return this.insertSpace(void 0,t),this},insertSpace(t,e){return void 0===e&&(e=1),ha.call(this,new ea(this.scene),{proportion:e,minWidth:0,minHeight:0,index:t}),this},insert(t,e,i,s,r,n,a,h){return sa(i)&&(i.index=t),ha.call(this,e,i,s,r,n,a,t,h),this},insertAtPosition(t,e,i,s,r,n,a,h,o){var l=ia.call(this,t,e);return-1===l&&(l=void 0),this.insert(l,i,s,r,n,a,h,o),this}};const la=Tt.prototype.clear;var da=function(t){this.backgroundChildren&&(this.backgroundChildren.length=0);var e,i=!t&&this.sizerEventsEnable;if(i&&(e=this.getChildren([])),la.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,da.call(this,t),this}},pa={getChildAlign(t){return this.getSizerConfig(t).align},setChildAlign(t,e){return"string"==typeof e&&(e=jt[e]),this.getSizerConfig(t).align=e,this}},va={getChildProportion(t){return this.getSizerConfig(t).proportion},setChildProportion(t,e){return this.getSizerConfig(t).proportion=e,this}},fa={getChildExpand(t){return this.getSizerConfig(t).expand},setChildExpand(t,e){return this.getSizerConfig(t).expand=e,this}},ga={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}},ma={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&&(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,a,h,o,l,d=this.sizerChildren,u=this.innerLeft,c=this.innerTop,p=this.innerWidth,v=this.innerHeight,f=u,g=c,m=this.startChildIndex,y=0,b=d.length;y0?(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)||Re.call(this)},runWidthWrap:function(t){this.wrapResult||(1===this.orientation&&Qn.call(this,t,void 0),Le.call(this,t))},hasHeightWrap:function(){return!(!this.hasRatioFitChild||0!==this.orientation)||je.call(this)},runHeightWrap:function(t){this.wrapResult||(0===this.orientation&&Qn.call(this,void 0,t),ze.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(ma,oa,ca,pa,va,fa,ga);var ya=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},ba={x:0,h:0,horizontal:0,"left-to-right":0,y:1,v:1,vertical:1,"top-to-bottom":1};const Ca=Phaser.Utils.Objects.IsPlainObject,_a=Phaser.Utils.Objects.GetValue;class Sa extends qn{constructor(t,e,i,s,r,n,a){Ca(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)):Ca(s)?(s=_a(a=s,"width",void 0),r=_a(a,"height",void 0),n=_a(a,"orientation",0)):Ca(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=function(t){return"string"==typeof t&&(t=ba[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=ya.call(this)),this._childrenProportion}}Object.assign(Sa.prototype,ma);var Pa=function(t,e,i,s,r){if(this.clear().fillStyle(16777215),1===this.shapeType){i=i.left;var n=Math.min(t,e)/2;this.fillCircle(-t*(s-.5),-e*(r-.5),n+i)}else this.fillRect(-t*s-i.left,-e*r-i.top,t+i.left+i.right,e+i.top+i.bottom)},xa=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};const wa=Phaser.GameObjects.Graphics;class Oa extends wa{constructor(t,e,i){void 0===e&&(e=0),"string"==typeof e&&(e=Ea[e]),super(t.scene),this.parent=t,this.shapeType=e,this.padding=ce(i),this.setPosition().resize().setVisible(!1)}destroy(){return this.parent=void 0,super.destroy(),this}setPosition(t,e){var i=this.parent;return void 0===t&&(t=i.x),void 0===e&&(e=i.y),super.setPosition(t,e),this}resize(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=ce(i));var r=this.width!==t||this.height!==e,n=this.padding!==i&&!xa(this.padding,i);return r||n?(this.width=t,this.height=e,n&>(i,this.padding),this.originX=s.originX,this.originY=s.originY,Pa.call(this,t,e,i,s.originX,s.originY),this):this}setOrigin(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,Pa.call(this,this.width,this.height,this.padding,t,e)),this}}const Ea={rectangle:0,circle:1};var Ta=function(t,e,i,s){var r=new Oa(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},ka=Phaser.Renderer.WebGL.Utils,Da=function(t,e,i,s,r,n){for(var a=ka.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+")"},ja=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 za=Phaser.Renderer.Canvas.SetTransform;var Xa={renderWebGL:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.pipelines.set(e.pipeline),n=La(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&&Da(r,a,e,l,h,o),e.isStroked&&Ra(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(za(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(Ya.prototype,Xa);const Ia=Phaser.Utils.Objects.GetValue;let Na=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=Ia(t,"x",0),i=Ia(t,"y",0));var s=this.cornerRadius;s.tl=Wa(Ia(t,"tl",void 0),e,i),s.tr=Wa(Ia(t,"tr",void 0),e,i),s.bl=Wa(Ia(t,"bl",void 0),e,i),s.br=Wa(Ia(t,"br",void 0),e,i)}get radiusTL(){var t=this.cornerRadius.tl;return Math.max(t.x,t.y)}set radiusTL(t){Va(this.cornerRadius.tl,t)}get radiusTR(){var t=this.cornerRadius.tr;return Math.max(t.x,t.y)}set radiusTR(t){Va(this.cornerRadius.tr,t)}get radiusBL(){var t=this.cornerRadius.bl;return Math.max(t.x,t.y)}set radiusBL(t){Va(this.cornerRadius.bl,t)}get radiusBR(){var t=this.cornerRadius.br;return Math.max(t.x,t.y)}set radiusBR(t){Va(this.cornerRadius.br,t)}};var Wa=function(t,e,i){return void 0===t?t={x:e,y:i}:"number"==typeof t&&(t={x:t,y:t}),Ba(t),t},Va=function(t,e){"number"==typeof e?(t.x=e,t.y=e):(t.x=Ia(e,"x",0),t.y=Ia(e,"y",0)),Ba(t)},Ba=function(t){t.convex=t.x>=0||t.y>=0,t.x=Math.abs(t.x),t.y=Math.abs(t.y)},Ga=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 Ua=Phaser.Math.DegToRad;var Ha=function(t,e,i,s,r,n,a,h,o){a&&n>r?n-=360:!a&&n0&&t.y>0};const Qa={rectangle:0,circle:1},th=Phaser.Utils.Objects.GetValue;class eh extends Qe{constructor(t,e){super(t,e),this.style=th(e,"style",this);var i=th(e,"propertiesMap");this.activeStyle=ih(e,"active",i),this.hoverStyle=ih(e,"hover",i),this.disableStyle=ih(e,"disable",i),this.onModifyStyle=th(e,"onModifyStyle")}getStyle(t){return function(t,e,i){if(void 0===i&&(i={}),Array.isArray(e))for(var s=0,r=e.length;s0,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};const Jh=Phaser.Utils.Objects.GetValue,$h=Phaser.Utils.Objects.IsPlainObject;class qh extends(Ch(ch)){constructor(t,e,i,s,r,n,a,h){$h(e)?(e=Jh(h=e,"x",0),i=Jh(h,"y",0),s=Jh(h,"width",2),r=Jh(h,"height",2),n=Jh(h,"barColor",void 0),a=Jh(h,"value",0)):$h(s)?(s=Jh(h=s,"width",2),r=Jh(h,"height",2),n=Jh(h,"barColor",void 0),a=Jh(h,"value",0)):$h(n)&&(n=Jh(h=n,"barColor",void 0),a=Jh(h,"value",0)),super(t,e,i,s,r,h),this.type="rexLineProgress",this.bootProgressBase(h),this.addShape((new Uh).setName("trackFill")).addShape((new Uh).setName("bar")).addShape((new Uh).setName("trackStroke")),this.setTrackColor(Jh(h,"trackColor",void 0)),this.setBarColor(n),this.setTrackStroke(Jh(h,"trackStrokeThickness",2),Jh(h,"trackStrokeColor",void 0)),this.setSkewX(Jh(h,"skewX",0)),this.setRTL(Jh(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 Kh={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&&Hh(s,0,0,e,i,t).close();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),Hh(a,r,0,n,i,t).close());var h=this.getShape("trackStroke");h.lineStyle(this.trackStrokeThickness,this.trackStrokeColor),h.isStroked&&Hh(h,0,0,e,i,t).end()}};Object.assign(qh.prototype,Kh);var Zh=function(t){return null==t||""===t||0===t.length},Qh=function(t,e,i,s){if(void 0===s&&(s="."),"object"==typeof t){if(Zh(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(Zh(e));else{var r;"string"==typeof e&&(e=e.split("."));for(var n=0,a=e.length;nyo(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]=yo(t[i]));return e}const bo=Phaser.Utils.Objects.IsPlainObject,Co=Phaser.Utils.Objects.GetValue;var _o=function(t){return"string"==typeof t&&(t=So[t]),t};const So={scale:0,repeat:1};var Po=function(t,e){return 0===t||t===this.columns.count-1||0===e||e===this.rows.count-1},xo={_beginDraw:zt,_drawImage:zt,_drawTileSprite:zt,_endDraw:zt,setGetFrameNameCallback:function(t){return void 0===t&&(t=mo),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=yo(i),s=yo(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 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,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 bo(t)?(this.stretchMode.edge=_o(Co(t,"edge",0)),this.stretchMode.internal=_o(Co(t,"internal",0))):(t=_o(t),this.stretchMode.edge=t,this.stretchMode.internal=t),this},getStretchMode:function(t,e){return Po.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 wo=Phaser.Utils.Objects.IsPlainObject,Oo=Phaser.Utils.Objects.GetValue,Eo=Phaser.GameObjects;var To=void 0,ko=function(t,e){if(To||(To={},Ke(t).events.once("destroy",(function(){for(var t in To)To[t].destroy();To=void 0}))),!To.hasOwnProperty(e)){var i=Ke(t).scene.systemScene;(t=new Eo[e](i)).setOrigin(0),To[e]=t}return To[e]};const Do=Phaser.GameObjects.RenderTexture;class Mo extends(function(t,e){class i extends t{constructor(t,i,s,r,n,a,h,o,l,d){if(wo(i)?(i=Oo(d=i,"x",0),s=Oo(d,"y",0),r=Oo(d,"width",1),n=Oo(d,"height",1),a=Oo(d,"key",void 0),h=Oo(d,"baseFrame",void 0),o=Oo(d,"columns",void 0),l=Oo(d,"rows",void 0)):wo(r)?(r=Oo(d=r,"width",1),n=Oo(d,"height",1),a=Oo(d,"key",void 0),h=Oo(d,"baseFrame",void 0),o=Oo(d,"columns",void 0),l=Oo(d,"rows",void 0)):wo(a)?(a=Oo(d=a,"key",void 0),h=Oo(d,"baseFrame",void 0),o=Oo(d,"columns",void 0),l=Oo(d,"rows",void 0)):wo(h)?(h=Oo(d=h,"baseFrame",void 0),o=Oo(d,"columns",void 0),l=Oo(d,"rows",void 0)):Array.isArray(h)?(d=l,l=o,o=h,h=Oo(d,"baseFrame",void 0)):wo(o)&&(o=Oo(d=o,"columns",void 0),l=Oo(d,"rows",void 0)),void 0===h&&(h=Oo(d,"frame",void 0)),void 0===o){var u=Oo(d,"leftWidth",void 0),c=Oo(d,"rightWidth",void 0);void 0!==u&&void 0!==c&&(o=[u,void 0,c])}if(void 0===l){var p=Oo(d,"topHeight",void 0),v=Oo(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(Oo(d,"getFrameNameCallback",void 0)),this.setStretchMode(Oo(d,"stretchMode",0)),this.setPreserveRatio(Oo(d,"preserveRatio",!0));var f=Oo(d,"maxFixedPartScale",1),g=Oo(d,"maxFixedPartScaleX",f),m=Oo(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,xo),i}(Do,"rexNinePatch")){}var Ro={_drawImage:function(t,e,i,s,r,n){var a=ko(this,"Image").setTexture(t,e).setDisplaySize(r,n);this.draw(a,i,s)},_drawTileSprite:function(t,e,i,s,r,n){var a=ko(this,"TileSprite").setTexture(t,e).setSize(r,n);this.draw(a,i,s)}};Object.assign(Mo.prototype,Ro);class Lo extends Qe{constructor(t,e){return super(t),new Proxy(this,this)}get(t,e){if(io(t,e))return t[e];var i=t.parent;return io(i,e)?i[e]:void 0}set(t,e,i){return io(t,e)?t[e]=i:io(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 Ao=Phaser.Utils.Objects.GetValue;class jo extends Mo{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexStatesNinePatch";var i=Ao(e,"effects",!0);i&&ho(this,i),this.style=new Lo(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign(jo.prototype,rh);const zo=["alpha","tint","flipX","flipY"];var Xo=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 to(t,e);break;case"image":s=new go(t,e);break;case"nineSlice":s=e.hasOwnProperty("stretchMode")?new jo(t,e):new co(t,e);break;default:s=new nh(t,e)}return function(t,e){if(!e)return t;for(var i=0,s=zo.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},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}},we=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 Oe=/(\S+)\[(\d+)\]/i,Ee=Phaser.Utils.Objects.GetValue;var Te=function(t,e){return void 0===e?t:t[e]},ke=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=Ee(e,"left",0),t.right=Ee(e,"right",0),t.top=Ee(e,"top",0),t.bottom=Ee(e,"bottom",0)),t},De={getInnerPadding(t){return Te(this.space,t)},setInnerPadding(t,e){return ke(this.space,t,e),this},getOuterPadding(t){return Te(this.getSizerConfig(this).padding,t)},setOuterPadding(t,e){return ke(this.getSizerConfig(this).padding,t,e),this},getChildOuterPadding(t,e){return"string"==typeof t&&(t=this.getElement(t)),Te(this.getSizerConfig(t).padding,e)},setChildOuterPadding(t,e,i){return"string"==typeof t&&(t=this.getElement(t)),ke(this.getSizerConfig(t).padding,e,i),this}},Me=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}},Re=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},Le=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}},je=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},ze=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?vi:pi,this.repeatCounter=0,this}stop(){return this.state=ci,this}update(t,e){this.state!==ci&&this.state!==gi&&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=fi)):(this.nowTime=this.duration,this.state=gi):this.nowTime>=0&&(this.state=vi))}get t(){var t;switch(this.state){case ci:case pi:case fi:t=0;break;case vi:t=this.nowTime/this.duration;break;case gi:t=1}return di(t,0,1)}set t(t){(t=di(t,-1,1))<0?(this.state=pi,this.nowTime=-this.delay*t):(this.state=vi,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===ci}get isDelay(){return this.state===pi}get isCountDown(){return this.state===vi}get isRunning(){return this.state===pi||this.state===vi}get isDone(){return this.state===gi}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}}const ci=0,pi=1,vi=2,fi=3,gi=-1;class mi extends hi{constructor(t,e){super(t,e),this.timer=new ui}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 yi=Phaser.Utils.Objects.GetValue,bi=Phaser.Utils.Objects.GetAdvancedValue,Ci=Phaser.Tweens.Builders.GetEaseFunction;class _i extends mi{resetFromJSON(t){return this.timer.resetFromJSON(yi(t,"timer")),this.setEnable(yi(t,"enable",!0)),this.setTarget(yi(t,"target",this.parent)),this.setDelay(bi(t,"delay",0)),this.setDuration(bi(t,"duration",1e3)),this.setEase(yi(t,"ease","Linear")),this.setRepeat(yi(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 Si=Phaser.Utils.Objects.GetValue,Pi=Phaser.Utils.Objects.GetAdvancedValue,xi=Phaser.Math.Linear;let wi=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(Si(t,"mode",0)),this.setScaleRange(Pi(t,"start",void 0),Pi(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=Oi[t]),this.mode=t,this}setScaleRange(t,e){return"number"==typeof t?(this.startX=t,this.startY=t):(this.startX=Pi(t,"x",this.parent.scaleX),this.startY=Pi(t,"y",this.parent.scaleY)),"number"==typeof e?(this.endX=e,this.endY=e):(this.endX=Pi(e,"x",void 0),this.endY=Pi(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=xi(this.startX,this.endX,i)),this.hasScaleY&&(t.scaleY=xi(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}};const Oi={stop:0,destroy:1,yoyo:2};var Ei=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 wi(t,h):r.resetFromJSON(h),r.restart(),r},Ti=function(t,e,i,s,r,n){void 0===s&&(s="Linear"),r instanceof wi&&(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 wi(t,a):n.resetFromJSON(a),n.restart(),n},ki=function(t,e){return new Promise((function(i,s){t.once(e,(function(){i()}))}))},Di=function(t){return ki(t,"complete")};const Mi=Phaser.Utils.Objects.IsPlainObject;var Ri={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(Mi(t)){var s=t;t=s.duration,e=s.orientation,i=s.ease}var r=void 0===this._scaleBehavior;return this._scaleBehavior=Ei(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(Mi(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=Ti(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(Mi(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 wi(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()}},Li={};Object.assign(Li,Ri),Li.onInitScale=function(){Ri.onInitScale.call(this);var t=this;this._scaleBehavior.on("update",(function(){var e=me.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const Ai=Phaser.Utils.Objects.GetValue,ji=Phaser.Utils.Objects.GetAdvancedValue,zi=Phaser.Math.Linear;class Xi extends _i{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(ji(t,"start",this.parent.alpha),ji(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=zi(this.alphaStart,this.alphaEnd,i)}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Fi={stop:0,destroy:1,yoyo:2},Yi=Phaser.Utils.Objects.IsPlainObject;var Ii=function(t,e,i,s){var r,n;Yi(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},Ni=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 Wi=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(Wi(t)){var i=t;t=i.duration,e=i.alpha}var s=void 0===this._fade;return this._fade=Ii(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(Wi(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()}},Bi={};Object.assign(Bi,Vi),Bi.onInitFade=function(){Vi.onInitFade.call(this);var t=this;this._fade.on("update",(function(){var e=me.getParentSizer(t);e&&e.resetChildAlphaState(t)}))};const Gi=Phaser.Utils.Objects.GetValue,Ui=Phaser.Utils.Objects.GetAdvancedValue,Hi=Phaser.Math.Linear;class Ji extends _i{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){if(super.resetFromJSON(t),this.setMode(Gi(t,"mode",0)),t&&(t.hasOwnProperty("x")||t.hasOwnProperty("y"))){var e=Ui(t,"x",void 0),i=Ui(t,"y",void 0);this.setTargetPosition(e,i)}else this.setTargetPosition(t);return this}setMode(t){return"string"==typeof t&&(t=$i[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=Ui(i,"startX",void 0),this.startY=Ui(i,"startY",void 0),this.endX=Ui(i,"endX",void 0),this.endY=Ui(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=Hi(this.startX,this.endX,i)),this.hasMoveY&&(t.y=Hi(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const $i={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 Ki=Phaser.Utils.Objects.IsPlainObject,Zi=Phaser.Math.Distance.Between;var Qi={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(Ki(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*Zi(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 Ji&&(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 Ji(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(Ki(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*Zi(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 Ji&&(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 Ji(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}},ts={};Object.assign(ts,Qi),ts.onInitEaseMove=function(){Qi.onInitEaseMove.call(this);var t=this;this._easeMove.on("update",(function(){var e=me.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const es=Phaser.Utils.Objects.GetValue;class is extends ri{constructor(t,e){super(t,e),this.timer=new ui,this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.timer.resetFromJSON(es(t,"timer")),this.setEnable(es(t,"enable",!0)),this.setMode(es(t,"mode",1)),this.isRunning=es(t,"isRunning",!1),this.setMagnitudeMode(es(t,"magnitudeMode",1)),this.setAxisMode(es(t,"axis",0)),this.setDuration(es(t,"duration",500)),this.setMagnitude(es(t,"magnitude",10)),this.ox=es(t,"ox",void 0),this.oy=es(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=ss[t]),this.mode=t,this}setMagnitudeMode(t){return"string"==typeof t&&(t=ns[t]),this.magnitudeMode=t,this}setAxisMode(t){return"string"==typeof t&&(t=rs[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=es(i,"magnitude",void 0),t=es(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 ss={effect:0,behavior:1},rs={both:0,"h&v":0,"x&y":0,horizontal:1,h:1,x:1,vertical:2,v:2,y:2},ns={constant:0,decay:1},as=Phaser.Utils.Objects.IsPlainObject;var hs={shake(t,e,i){if(as(t)){var s=t;t=s.duration,e=s.magnitude,i=s.magnitudeMode}return void 0===this._shake&&(this._shake=new is(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 os=Phaser.Utils.Objects.GetValue,ls=Phaser.Math.Linear;class ds 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=os(t,"key","value");var i=e[this.propertyKey];return this.fromValue=os(t,"from",i),this.toValue=os(t,"to",i),this.setEase(os(t,"ease",this.ease)),this.setDuration(os(t,"duration",this.duration)),this.setRepeat(os(t,"repeat",0)),this.setDelay(os(t,"delay",0)),this.setRepeatDelay(os(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]=ls(this.fromValue,this.toValue,i)}}const us=Phaser.Utils.Objects.IsPlainObject;class cs extends Qe{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 ds(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(us(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(us(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 ps={easeDataTo(t,e,i,s){return this._easeData||(this._easeData=new cs(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),ki(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}},vs=Phaser.Utils.Array.Remove,fs={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=Je(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}},Ms={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}},Rs={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}},Ls={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,Ds,Ms,Rs,Ls);const js=Phaser.Utils.Objects.GetValue;class zs extends Qe{constructor(t,e){super(t,e),this.setTransitInTime(js(e,"duration.in",200)),this.setTransitOutTime(js(e,"duration.out",200)),this.setTransitInCallback(js(e,"transitIn")),this.setTransitOutCallback(js(e,"transitOut")),this.oneShotMode=js(e,"destroy",!1),this.delayCallTimer=void 0,this._state=new ks(this,{eventEmitter:!1,initState:js(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(zs.prototype,As);var Xs=function(t){if(t.parentContainer)return Xs(t.parentContainer);var e=function(t){var e=t.displayList;return H(e)?e:null}(t);return e?Xs(e):t};class Fs extends Qe{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=Xs(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 Ys=Phaser.GameObjects.Rectangle;class Is extends Ys{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 Ws extends Qe{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 Bs=Phaser.Utils.Objects.GetValue;class Gs extends Is{constructor(t,e){super(t,Bs(e,"color",0),Bs(e,"alpha",.8)),this.touchEventStop=new Ws(this,{hitAreaMode:1})}}var Us={popUp(t,e){void 0!==t._modalScaleSave?(t.scaleX=t._modalScaleSave,t.scaleY=t._modalScaleSave):t._modalScaleSave=t.scaleX,Ei(t,e)},scaleDown(t,e){Ti(t,e,void 0,void 0,!1)},fadeIn(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Ii(t,e)},fadeOut(t,e){Ni(t,e,!1)}},Hs=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Ii(t,e,t.alpha)},Js=function(t,e){Ni(t,e,!1)},$s=function(t,e,i,s,r){return!(!t||s&&!s(t,e,i)||!rt(t,!0).contains(e,i)||r&&!r(t,e,i))};const qs=Phaser.Utils.Objects.GetValue;let Ks=class extends zs{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=Zs.popUp),null==e.transitOut&&(e.transitOut=Zs.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 Gs(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",Hs)),this.setCoverTransitOutCallback(qs(i,"transitOut",Js)));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&&$s(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=Zs[t]),t){case Zs.popUp:t=Us.popUp;break;case Zs.fadeIn:t=Us.fadeIn}return super.setTransitInCallback(t),this}setTransitOutCallback(t){switch("string"==typeof t&&(t=Zs[t]),t){case Zs.scaleDown:t=Us.scaleDown;break;case Zs.fadeOut:t=Us.fadeOut}return super.setTransitOutCallback(t),this}setCoverTransitInCallback(t){return this.coverTransitInCallback=t,this}setCoverTransitOutCallback(t){return this.coverTransitOutCallback=t,this}};const Zs={popUp:0,fadeIn:1,scaleDown:0,fadeOut:1};var Qs=function(t){return t&&"function"==typeof t},tr={modal(t,e){return Qs(t)&&(e=t,t=void 0),void 0===this._modalBehavior&&(this.onCreateModalBehavior&&this.onCreateModalBehavior(this,t),this._modalBehavior=function(t,e){var i=new Ks(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}},er=function(t,e,i,s,r){Qs(e)&&(r=s,s=i,i=e,e=this);var n=this.scene.events;return this.bindEvent(e,n,t,i,s,r),this},ir={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 er.call(this,"preupdate",t,e,i,s),this},bindSceneUpdateEvent(t,e,i,s){return er.call(this,"update",t,e,i,s),this},bindScenePostupdateEvent(t,e,i,s){return er.call(this,"postupdate",t,e,i,s),this},bindSceneRenderEvent(t,e,i,s){return er.call(this,"render",t,e,i,s),this},bindScenePauseEvent(t,e,i,s){return er.call(this,"pause",t,e,i,s),this},bindSceneResumeEvent(t,e,i,s){return er.call(this,"resume",t,e,i,s),this},bindSceneSleepEvent(t,e,i,s){return er.call(this,"sleep",t,e,i,s),this},bindSceneWakeEvent(t,e,i,s){return er.call(this,"wake",t,e,i,s),this},bindSceneShutdownEvent(t,e,i,s){return er.call(this,"shutdown",t,e,i,s),this}},sr=function(t,e,i){var s=t.camera;return s?(void 0===i?i={}:!0===i&&(i=rr),s===e?(i.x=t.worldX,i.y=t.worldY):s.getWorldPoint(t.x,t.y,i),i):null},rr={},nr=function(t,e,i,s){var r,n=t.scene.sys.cameras.main,a=0===t.scrollFactorX&&0===t.scrollFactorY;if(e)return a?$s(t,e.x,e.y,i,s):!!(r=sr(e,n,!0))&&$s(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 gr={press:0,pointerdown:0,release:1,pointerup:1};var mr={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 fr(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}},yr=function(t,e,i,s,r){if(e)return!(i&&!i(t,e)||!br(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 _r=Phaser.Utils.Objects.GetValue;class Sr extends Qe{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=Pr[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?yr:nr)(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 Pr={press:0,pointerdown:0,release:1,pointerup:1};var xr={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 Sr(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 wr extends Ts{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 Or=Phaser.Utils.Objects.GetValue;class Er extends Qe{constructor(t,e){super(t,e),this._enable=void 0,this.cooldown=new wr,this.parent.setInteractive(Or(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.prevIsInTouch=!1,this.isInTouching=!1,this.setEnable(Or(t,"enable",!0)),this.setCooldown(Or(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 Tr={isPointerInBounds(t){return void 0===t?t=this:"string"==typeof t&&(t=this.getElement(t)),!!t&&nr(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 Er(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 Er(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}},kr={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=Ur,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===Hr&&this.onDragEnd(),this.pointer=void 0,this.tracerState=Ur,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=Jr,this}isPointerInGameObject(t,e,i){var s=this.lastPointer;return!!s&&nr(t,s,e,i)}}const Ur=0,Hr=1,Jr="IDLE",$r=Phaser.Utils.Objects.GetValue,qr=Phaser.Math.Distance.Between;class Kr extends Gr{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=Zr},eventEmitter:!1};this.setRecongizedStateObject(new Ts(s))}resetFromJSON(t){super.resetFromJSON(t),this.setHoldTime($r(t,"time",250)),this.setTapInterval($r(t,"tapInterval",200)),this.setDragThreshold($r(t,"threshold",9)),this.setTapOffset($r(t,"tapOffset",10));var e=$r(t,"taps",void 0);return void 0!==e?this.setTaps(e):(this.setMaxTaps($r(t,"maxTaps",void 0)),this.setMinTaps($r(t,"minTaps",void 0))),this}onDragStart(){switch(this.state){case Zr:this.state=Qr;break;case Qr:var t=this.lastPointer;qr(t.upX,t.upY,t.x,t.y)>this.tapOffset&&(this.state=tn,this.state=Qr);break;case tn:this.state=Qr}}onDragEnd(){this.state===Qr&&(this.tapsCount++,this.emit("tapping",this,this.gameObject,this.lastPointer),void 0!==this.maxTaps&&this.tapsCount===this.maxTaps&&(this.state=tn))}onDrag(){this.state!==Zr&&this.pointer.getDistance()>this.dragThreshold&&(this.state=Zr)}preUpdate(t,e){if(this.isRunning&&this.enable&&this.state===Qr){var i=this.lastPointer;i.isDown?t-i.downTime>this.holdTime&&(this.state=Zr):t-i.upTime>this.tapInterval&&(void 0===this.minTaps||this.tapsCount>=this.minTaps?this.state=tn:this.state=Zr)}}postUpdate(t,e){this.isRunning&&this.enable&&this.state===tn&&(this.state=Zr)}get isTapped(){return this.state===tn}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 Zr="IDLE",Qr="BEGIN",tn="RECOGNIZED",en=Phaser.Utils.Objects.GetValue;class sn extends Gr{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=rn},eventEmitter:!1};this.setRecongizedStateObject(new Ts(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(en(t,"threshold",9)),this.setHoldTime(en(t,"time",251)),this}onDragStart(){this.state=nn,0===this.holdTime&&(this.state=an)}onDragEnd(){this.state=rn}onDrag(){this.state!==rn&&this.pointer.getDistance()>this.dragThreshold&&(this.state=rn)}preUpdate(t,e){this.isRunning&&this.enable&&this.state===nn&&t-this.pointer.downTime>=this.holdTime&&(this.state=an)}get isPressed(){return this.state===an}setHoldTime(t){return this.holdTime=t,this}setDragThreshold(t){return this.dragThreshold=t,this}}const rn="IDLE",nn="BEGIN",an="RECOGNIZED";Phaser.Utils.Objects.GetValue;const hn=Phaser.Math.Distance.Between,on=Phaser.Math.Angle.Between;var ln={getDt:function(){var t;return t=this.scene,Ke(t).loop.delta},getVelocity:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return hn(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 on(e.x,e.y,t.x,t.y)}},dn={"up&down":0,"left&right":1,"4dir":2,"8dir":3},un={};const cn=Phaser.Utils.Objects.GetValue,pn=Phaser.Math.RadToDeg;class vn extends Gr{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=fn},eventEmitter:!1};this.setRecongizedStateObject(new Ts(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=gn}onDragEnd(){this.state=fn}onDrag(){this.state===gn&&(this.validDrag||(this.validDrag=0===this.dragThreshold||this.pointer.getDistance()>=this.dragThreshold),this.validDrag&&this.dragVelocity>this.velocityThreshold&&(this.state=mn))}postUpdate(t,e){this.isRunning&&this.enable&&this.state===mn&&(this.state=fn)}get isSwiped(){return this.state===mn}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=dn[t]),this.dirMode=t,this}updateDirectionStates(){return function(t,e,i){switch(void 0===i?i={}:!0===i&&(i=un),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}}(pn(this.getVelocityAngle()),this.dirMode,this),this}clearDirectionStates(){return this.left=!1,this.right=!1,this.up=!1,this.down=!1,this}}Object.assign(vn.prototype,ln);const fn="IDLE",gn="BEGIN",mn="RECOGNIZED",yn=Phaser.Utils.Objects.GetValue,bn=Phaser.Utils.Array.SpliceOne,Cn=Phaser.Math.Distance.Between,_n=Phaser.Math.Angle.Between;class Sn{constructor(t,e){var i=Je(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(yn(e,"inputConfig",void 0)),this.setEventEmitter(yn(e,"eventEmitter",void 0)),this._enable=void 0,this.pointers=[],this.movedState={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setEnable(yn(t,"enable",!0)),this.bounds=yn(t,"bounds",void 0),this.tracerState=xn,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 xn:this.tracerState=wn,this.onDrag1Start();break;case wn:this.tracerState=On,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],bn(this.pointers,e),this.tracerState){case wn:this.tracerState=xn,this.onDrag1End();break;case On:this.tracerState=wn,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 wn:this.onDrag1();break;case On:this.onDrag2()}}}dragCancel(){return this.tracerState===On&&this.onDrag2End(),this.pointers.length=0,ft(this.movedState),this.tracerState=xn,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!==On)return 0;var t=this.pointers[0],e=this.pointers[1];return Cn(t.x,t.y,e.x,e.y)}get angleBetween(){if(this.tracerState!==On)return 0;var t=this.pointers[0],e=this.pointers[1];return _n(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;Pn.x=e.x-i.x,Pn.y=e.y-i.y}else Pn.x=0,Pn.y=0;return Pn}get centerX(){if(this.tracerState!==On)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.x+e.x)/2}get centerY(){if(this.tracerState!==On)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.y+e.y)/2}get prevCenterX(){if(this.tracerState!==On)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!==On)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=En,this}isPointer0InGameObject(t,e,i){var s=this.pointers[0];return!!s&&nr(t,s,e,i)}isPointer1InGameObject(t,e,i){var s=this.pointers[1];return!!s&&nr(t,s,e,i)}}Object.assign(Sn.prototype,Ge);var Pn={};const xn=0,wn=1,On=2,En="IDLE";Phaser.Utils.Objects.GetValue;const Tn=Phaser.Math.RotateAround;var kn=function(t,e,i,s){return Tn(t,e,i,s),t.rotation+=s,t},Dn={};const Mn=Phaser.Utils.Objects.GetValue,Rn=Phaser.Math.Angle.WrapDegrees,Ln=Phaser.Math.Angle.ShortestBetween,An=Phaser.Math.RadToDeg,jn=Phaser.Math.DegToRad;var zn={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=Dn),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=Rn(An(this.angleBetween));this.angle=Ln(this.prevAngle,t),this.prevAngle=t,this.state=Yn}break;case Yn:t=Rn(An(this.angleBetween)),this.angle=Ln(this.prevAngle,t),this.prevAngle=t,this.emit("rotate",this)}}get isRotated(){return this.state===Yn}get rotation(){return jn(this.angle)}setDragThreshold(t){return this.dragThreshold=t,this}}.prototype,zn);const Xn="IDLE",Fn="BEGIN",Yn="RECOGNIZED",In=Phaser.Utils.Objects.GetValue;var Nn=function(t){var e=In(t,"tap",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._tap=new Kr(this,e),this._tap.on("tap",(function(t,e,s){Mr(i.eventEmitter,`${i.eventNamePrefix}${t.tapsCount}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Wn=Phaser.Utils.Objects.GetValue;var Vn=function(t){var e=Wn(t,"press",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._press=new sn(this,e),this._press.on("pressstart",(function(t,e,s){Mr(i.eventEmitter,`${i.eventNamePrefix}pressstart`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this).on("pressend",(function(t,e,s){Mr(i.eventEmitter,`${i.eventNamePrefix}pressend`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Bn=Phaser.Utils.Objects.GetValue;var Gn=function(t){var e=Bn(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 vn(this,e),this._swipe.on("swipe",(function(t,e,s){var r=t.left?"left":t.right?"right":t.up?"up":"down";Mr(i.eventEmitter,`${i.eventNamePrefix}swipe${r}`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Un=Phaser.Utils.Objects.GetValue;var Hn=function(t,e){return t.setInteractive(),Un(e,"dropZone",!1)&&(t.input.dropZone=!0),t._childrenInteractive={targetSizers:Un(e,"targets",[t]),targetMode:Un(e,"targetMode","parent"),eventEmitter:Un(e,"eventEmitter",t),eventNamePrefix:Un(e,"inputEventPrefix","child.")},Lr.call(t,e),zr.call(t,e),Yr.call(t,e),Vr.call(t,e),Nn.call(t,e),Vn.call(t,e),Gn.call(t,e),t},Jn={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",le),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)}}for(var d,u,c=this.getAllShownChildren([this]),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 sa=Phaser.Utils.Objects.IsPlainObject,ra=Phaser.Utils.Objects.GetValue,na=Phaser.Display.Align.CENTER,aa={min:0,full:-1};var ha=function(t,e,i,s,r,n,a,h,o,l){ve.call(this,t);var d=t.isRexSpace,u=typeof e;if(null===e)return this;if("number"===u);else if("string"===u)e=aa[e];else if(sa(e)){var c;e=ra(c=e,"proportion",void 0),i=ra(c,"align",na),s=ra(c,"padding",0),r=ra(c,"expand",!1),n=ra(c,"key",void 0),a=ra(c,"index",void 0),t.isRexSizer||(h=ra(c,"minWidth",void 0),o=ra(c,"minHeight",void 0)),l=ra(c,"fitRatio",0)}return"string"==typeof i&&(i=jt[i]),void 0===e&&(e=d?1:0),void 0===i&&(i=na),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===h&&(d?h=0:t.isRexSizer||(h=t._minWidth)),void 0===o&&(d?o=0:t.isRexSizer||(o=t._minHeight)),void 0===l||!1===l?l=0:!0===l&&(l=Q(t)/tt(t)),(c=this.getSizerConfig(t)).proportion=e,c.align=i,c.padding=ce(s),c.expand=r,c.fitRatio=0===e?l:0,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},oa={add:ha,addSpace(t){return this.insertSpace(void 0,t),this},insertSpace(t,e){return void 0===e&&(e=1),ha.call(this,new ea(this.scene),{proportion:e,minWidth:0,minHeight:0,index:t}),this},insert(t,e,i,s,r,n,a,h){return sa(i)&&(i.index=t),ha.call(this,e,i,s,r,n,a,t,h),this},insertAtPosition(t,e,i,s,r,n,a,h,o){var l=ia.call(this,t,e);return-1===l&&(l=void 0),this.insert(l,i,s,r,n,a,h,o),this}};const la=Tt.prototype.clear;var da=function(t){this.backgroundChildren&&(this.backgroundChildren.length=0);var e,i=!t&&this.sizerEventsEnable;if(i&&(e=this.getChildren([])),la.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,da.call(this,t),this}},pa={getChildAlign(t){return this.getSizerConfig(t).align},setChildAlign(t,e){return"string"==typeof e&&(e=jt[e]),this.getSizerConfig(t).align=e,this}},va={getChildProportion(t){return this.getSizerConfig(t).proportion},setChildProportion(t,e){return this.getSizerConfig(t).proportion=e,this}},fa={getChildExpand(t){return this.getSizerConfig(t).expand},setChildExpand(t,e){return this.getSizerConfig(t).expand=e,this}},ga={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}},ma={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&&(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,a,h,o,l,d=this.sizerChildren,u=this.innerLeft,c=this.innerTop,p=this.innerWidth,v=this.innerHeight,f=u,g=c,m=this.startChildIndex,y=0,b=d.length;y0?(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)||Re.call(this)},runWidthWrap:function(t){this.wrapResult||(1===this.orientation&&Qn.call(this,t,void 0),Le.call(this,t))},hasHeightWrap:function(){return!(!this.hasRatioFitChild||0!==this.orientation)||je.call(this)},runHeightWrap:function(t){this.wrapResult||(0===this.orientation&&Qn.call(this,void 0,t),ze.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(ma,oa,ca,pa,va,fa,ga);var ya=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},ba={x:0,h:0,horizontal:0,"left-to-right":0,y:1,v:1,vertical:1,"top-to-bottom":1};const Ca=Phaser.Utils.Objects.IsPlainObject,_a=Phaser.Utils.Objects.GetValue;class Sa extends qn{constructor(t,e,i,s,r,n,a){Ca(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)):Ca(s)?(s=_a(a=s,"width",void 0),r=_a(a,"height",void 0),n=_a(a,"orientation",0)):Ca(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=function(t){return"string"==typeof t&&(t=ba[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=ya.call(this)),this._childrenProportion}}Object.assign(Sa.prototype,ma);var Pa=function(t,e,i,s,r){if(this.clear().fillStyle(16777215),1===this.shapeType){i=i.left;var n=Math.min(t,e)/2;this.fillCircle(-t*(s-.5),-e*(r-.5),n+i)}else this.fillRect(-t*s-i.left,-e*r-i.top,t+i.left+i.right,e+i.top+i.bottom)},xa=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};const wa=Phaser.GameObjects.Graphics;class Oa extends wa{constructor(t,e,i){void 0===e&&(e=0),"string"==typeof e&&(e=Ea[e]),super(t.scene),this.parent=t,this.shapeType=e,this.padding=ce(i),this.setPosition().resize().setVisible(!1)}destroy(){return this.parent=void 0,super.destroy(),this}setPosition(t,e){var i=this.parent;return void 0===t&&(t=i.x),void 0===e&&(e=i.y),super.setPosition(t,e),this}resize(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=ce(i));var r=this.width!==t||this.height!==e,n=this.padding!==i&&!xa(this.padding,i);return r||n?(this.width=t,this.height=e,n&>(i,this.padding),this.originX=s.originX,this.originY=s.originY,Pa.call(this,t,e,i,s.originX,s.originY),this):this}setOrigin(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,Pa.call(this,this.width,this.height,this.padding,t,e)),this}}const Ea={rectangle:0,circle:1};var Ta=function(t,e,i,s){var r=new Oa(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},ka=Phaser.Renderer.WebGL.Utils,Da=function(t,e,i,s,r,n){for(var a=ka.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+")"},ja=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 za=Phaser.Renderer.Canvas.SetTransform;var Xa={renderWebGL:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.pipelines.set(e.pipeline),n=La(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&&Da(r,a,e,l,h,o),e.isStroked&&Ra(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(za(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(Ya.prototype,Xa);const Ia=Phaser.Utils.Objects.GetValue;let Na=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=Ia(t,"x",0),i=Ia(t,"y",0));var s=this.cornerRadius;s.tl=Wa(Ia(t,"tl",void 0),e,i),s.tr=Wa(Ia(t,"tr",void 0),e,i),s.bl=Wa(Ia(t,"bl",void 0),e,i),s.br=Wa(Ia(t,"br",void 0),e,i)}get radiusTL(){var t=this.cornerRadius.tl;return Math.max(t.x,t.y)}set radiusTL(t){Va(this.cornerRadius.tl,t)}get radiusTR(){var t=this.cornerRadius.tr;return Math.max(t.x,t.y)}set radiusTR(t){Va(this.cornerRadius.tr,t)}get radiusBL(){var t=this.cornerRadius.bl;return Math.max(t.x,t.y)}set radiusBL(t){Va(this.cornerRadius.bl,t)}get radiusBR(){var t=this.cornerRadius.br;return Math.max(t.x,t.y)}set radiusBR(t){Va(this.cornerRadius.br,t)}};var Wa=function(t,e,i){return void 0===t?t={x:e,y:i}:"number"==typeof t&&(t={x:t,y:t}),Ba(t),t},Va=function(t,e){"number"==typeof e?(t.x=e,t.y=e):(t.x=Ia(e,"x",0),t.y=Ia(e,"y",0)),Ba(t)},Ba=function(t){t.convex=t.x>=0||t.y>=0,t.x=Math.abs(t.x),t.y=Math.abs(t.y)},Ga=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 Ha=Phaser.Math.DegToRad;var Ja=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 Jh=Phaser.Utils.Objects.GetValue,$h=Phaser.Utils.Objects.IsPlainObject;class qh extends(Ch(ch)){constructor(t,e,i,s,r,n,a,h){$h(e)?(e=(h=e).x,i=h.y,s=h.width,r=h.height,n=h.barColor,a=h.value):$h(s)?(s=(h=s).width,r=h.height,n=h.barColor,a=h.value):$h(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 Uh).setName("trackFill")).addShape((new Uh).setName("bar")).addShape((new Uh).setName("trackStroke")),this.setTrackColor(Jh(h,"trackColor",void 0)),this.setBarColor(n),this.setTrackStroke(Jh(h,"trackStrokeThickness",2),Jh(h,"trackStrokeColor",void 0)),this.setSkewX(Jh(h,"skewX",0)),this.setRTL(Jh(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 Kh={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&&Hh(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),Hh(a,r,0,n,i,t));var h=this.getShape("trackStroke");h.lineStyle(this.trackStrokeThickness,this.trackStrokeColor),h.isStroked&&Hh(h,0,0,e,i,t)}};Object.assign(qh.prototype,Kh);var Zh=function(t){return null==t||""===t||0===t.length},Qh=function(t,e,i,s){if(void 0===s&&(s="."),"object"==typeof t){if(Zh(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(Zh(e));else{var r;"string"==typeof e&&(e=e.split("."));for(var n=0,a=e.length;nyo(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]=yo(t[i]));return e}const bo=Phaser.Utils.Objects.IsPlainObject,Co=Phaser.Utils.Objects.GetValue;var _o=function(t){return"string"==typeof t&&(t=So[t]),t};const So={scale:0,repeat:1};var Po=function(t,e){return 0===t||t===this.columns.count-1||0===e||e===this.rows.count-1},xo={_beginDraw:zt,_drawImage:zt,_drawTileSprite:zt,_endDraw:zt,setGetFrameNameCallback:function(t){return void 0===t&&(t=mo),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=yo(i),s=yo(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 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,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 bo(t)?(this.stretchMode.edge=_o(Co(t,"edge",0)),this.stretchMode.internal=_o(Co(t,"internal",0))):(t=_o(t),this.stretchMode.edge=t,this.stretchMode.internal=t),this},getStretchMode:function(t,e){return Po.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 wo=Phaser.Utils.Objects.IsPlainObject,Oo=Phaser.Utils.Objects.GetValue,Eo=Phaser.GameObjects;var To=void 0,ko=function(t,e){if(To||(To={},Ke(t).events.once("destroy",(function(){for(var t in To)To[t].destroy();To=void 0}))),!To.hasOwnProperty(e)){var i=Ke(t).scene.systemScene;(t=new Eo[e](i)).setOrigin(0),To[e]=t}return To[e]};const Do=Phaser.GameObjects.RenderTexture;class Mo extends(function(t,e){class i extends t{constructor(t,i,s,r,n,a,h,o,l,d){if(wo(i)?(i=Oo(d=i,"x",0),s=Oo(d,"y",0),r=Oo(d,"width",1),n=Oo(d,"height",1),a=Oo(d,"key",void 0),h=Oo(d,"baseFrame",void 0),o=Oo(d,"columns",void 0),l=Oo(d,"rows",void 0)):wo(r)?(r=Oo(d=r,"width",1),n=Oo(d,"height",1),a=Oo(d,"key",void 0),h=Oo(d,"baseFrame",void 0),o=Oo(d,"columns",void 0),l=Oo(d,"rows",void 0)):wo(a)?(a=Oo(d=a,"key",void 0),h=Oo(d,"baseFrame",void 0),o=Oo(d,"columns",void 0),l=Oo(d,"rows",void 0)):wo(h)?(h=Oo(d=h,"baseFrame",void 0),o=Oo(d,"columns",void 0),l=Oo(d,"rows",void 0)):Array.isArray(h)?(d=l,l=o,o=h,h=Oo(d,"baseFrame",void 0)):wo(o)&&(o=Oo(d=o,"columns",void 0),l=Oo(d,"rows",void 0)),void 0===h&&(h=Oo(d,"frame",void 0)),void 0===o){var u=Oo(d,"leftWidth",void 0),c=Oo(d,"rightWidth",void 0);void 0!==u&&void 0!==c&&(o=[u,void 0,c])}if(void 0===l){var p=Oo(d,"topHeight",void 0),v=Oo(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(Oo(d,"getFrameNameCallback",void 0)),this.setStretchMode(Oo(d,"stretchMode",0)),this.setPreserveRatio(Oo(d,"preserveRatio",!0));var f=Oo(d,"maxFixedPartScale",1),g=Oo(d,"maxFixedPartScaleX",f),m=Oo(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,xo),i}(Do,"rexNinePatch")){}var Ro={_drawImage:function(t,e,i,s,r,n){var a=ko(this,"Image").setTexture(t,e).setDisplaySize(r,n);this.draw(a,i,s)},_drawTileSprite:function(t,e,i,s,r,n){var a=ko(this,"TileSprite").setTexture(t,e).setSize(r,n);this.draw(a,i,s)}};Object.assign(Mo.prototype,Ro);class Lo extends Qe{constructor(t,e){return super(t),new Proxy(this,this)}get(t,e){if(io(t,e))return t[e];var i=t.parent;return io(i,e)?i[e]:void 0}set(t,e,i){return io(t,e)?t[e]=i:io(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 Ao=Phaser.Utils.Objects.GetValue;class jo extends Mo{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexStatesNinePatch";var i=Ao(e,"effects",!0);i&&ho(this,i),this.style=new Lo(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign(jo.prototype,rh);const zo=["alpha","tint","flipX","flipY"];var Xo=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 to(t,e);break;case"image":s=new go(t,e);break;case"nineSlice":s=e.hasOwnProperty("stretchMode")?new jo(t,e):new co(t,e);break;default:s=new nh(t,e)}return function(t,e){if(!e)return t;for(var i=0,s=zo.length;i 0) && (radius.y > 0)); + }; + var LineTo = function (x, y, pathData) { var cnt = pathData.length; if (cnt >= 2) { @@ -592,8 +596,7 @@ geom.setTo(0, 0, width, height, radius); } - var iteration = GetValue(radiusConfig, 'iteration', undefined); - this.setIteration(iteration); + this.setIteration(GetValue(radiusConfig, 'iteration', undefined)); this.setPosition(x, y); this.setFillStyle(fillColor, fillAlpha); @@ -846,10 +849,6 @@ } - var IsArcCorner = function (radius) { - return ((radius.x > 0) && (radius.y > 0)); - }; - const ShapeTypeMap = { rectangle: 0, circle: 1 diff --git a/dist/rexroundrectangle.min.js b/dist/rexroundrectangle.min.js index f97aded95b..5af8b40798 100644 --- a/dist/rexroundrectangle.min.js +++ b/dist/rexroundrectangle.min.js @@ -1 +1 @@ -var t,i;t=void 0,i=function(){var t=Phaser.Renderer.WebGL.Utils,i=Phaser.Renderer.WebGL.Utils;const e=Phaser.GameObjects.GetCalcMatrix,s=Phaser.Renderer.Canvas.SetTransform;var r={renderWebGL:function(s,r,h,a){r.dirty&&(r.updateData(),r.dirty=!1),h.addToRenderList(r);var o=s.pipelines.set(r.pipeline),n=e(r,h,a),l=o.calcMatrix.copyFrom(n.calc),d=r._displayOriginX,u=r._displayOriginY,g=h.alpha*r.alpha;s.pipelines.preBatch(r),r.isFilled&&function(i,e,s,r,h,a){for(var o=t.getTintAppendFloatAlpha(s.fillColor,s.fillAlpha*r),n=s.pathData,l=s.pathIndexes,d=0;d>>16,o=(65280&r)>>>8,n=255&r;t.fillStyle="rgba("+a+","+o+","+n+","+h+")"}(h,i),h.fill()),i.isStroked&&(function(t,i,e,s){var r=e||i.strokeColor,h=s||i.strokeAlpha,a=(16711680&r)>>>16,o=(65280&r)>>>8,n=255&r;t.strokeStyle="rgba("+a+","+o+","+n+","+h+")",t.lineWidth=i.lineWidth}(h,i),h.stroke()),h.restore()}}};const h=Phaser.GameObjects.Shape;class a extends h{get fillColor(){return this._fillColor}set fillColor(t){this._fillColor=t,this.isFilled=null!=t&&this._fillAlpha>0}get fillAlpha(){return this._fillAlpha}set fillAlpha(t){this._fillAlpha=t,this.isFilled=t>0&&null!=this._fillColor}setFillStyle(t,i){return void 0===i&&(i=1),this.fillColor=t,this.fillAlpha=i,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,i,e){return void 0===e&&(e=1),this.lineWidth=t,this.strokeColor=i,this.strokeAlpha=e,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,i){var e=this.input;return e&&!e.customHitArea&&(e.hitArea.width=t,e.hitArea.height=i),this}resize(t,i){return this.setSize(t,i),this}}Object.assign(a.prototype,r);const o=Phaser.Utils.Objects.GetValue;let n=class{constructor(t,i,e,s,r){void 0===t&&(t=0),void 0===i&&(i=t),void 0===e&&(e=0),void 0===s&&(s=0),void 0===r&&(r=0),this.cornerRadius={},this._width=0,this._height=0,this.setTo(t,i,e,s,r)}setTo(t,i,e,s,r){return this.setPosition(t,i),this.setRadius(r),this.setSize(e,s),this}setPosition(t,i){return this.x=t,this.y=i,this}setRadius(t){return void 0===t&&(t=0),this.radius=t,this}setSize(t,i){return this.width=t,this.height=i,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 i,e;"number"==typeof t?(i=t,e=t):(i=o(t,"x",0),e=o(t,"y",0));var s=this.cornerRadius;s.tl=l(o(t,"tl",void 0),i,e),s.tr=l(o(t,"tr",void 0),i,e),s.bl=l(o(t,"bl",void 0),i,e),s.br=l(o(t,"br",void 0),i,e)}get radiusTL(){var t=this.cornerRadius.tl;return Math.max(t.x,t.y)}set radiusTL(t){d(this.cornerRadius.tl,t)}get radiusTR(){var t=this.cornerRadius.tr;return Math.max(t.x,t.y)}set radiusTR(t){d(this.cornerRadius.tr,t)}get radiusBL(){var t=this.cornerRadius.bl;return Math.max(t.x,t.y)}set radiusBL(t){d(this.cornerRadius.bl,t)}get radiusBR(){var t=this.cornerRadius.br;return Math.max(t.x,t.y)}set radiusBR(t){d(this.cornerRadius.br,t)}};var l=function(t,i,e){return void 0===t?t={x:i,y:e}:"number"==typeof t&&(t={x:t,y:t}),u(t),t},d=function(t,i){"number"==typeof i?(t.x=i,t.y=i):(t.x=o(i,"x",0),t.y=o(i,"y",0)),u(t)},u=function(t){t.convex=t.x>=0||t.y>=0,t.x=Math.abs(t.x),t.y=Math.abs(t.y)},g=function(t,i,e){var s=e.length;if(s>=2){var r=e[s-2],h=e[s-1];if(t===r&&i===h)return e}return e.push(t,i),e};const p=Phaser.Math.DegToRad;var c=function(t,i,e,s,r,h,a,o,n){a&&h>r?h-=360:!a&&h0&&t.y>0};const R={rectangle:0,circle:1};return class extends a{constructor(t,i,e,s,r,h,a,o){var l,d,u,g;if(v(i)){var p=i;i=p.x,e=p.y,s=p.width,r=p.height,h=p.radius,a=p.color,o=p.alpha,l=p.strokeColor,d=p.strokeAlpha,u=p.strokeWidth,g=p.shape}void 0===i&&(i=0),void 0===e&&(e=0),void 0===s&&(s=1),void 0===r&&(r=s),void 0===h&&(h=0),void 0===g&&(g=0);var c=new n;if(super(t,"rexRoundRectangleShape",c),this.setShapeType(g),0===this.shapeType){var x=y(h,"radius",h);c.setTo(0,0,s,r,x)}else x={x:s/2,y:r/2},c.setTo(0,0,s,r,x);var f=y(h,"iteration",void 0);this.setIteration(f),this.setPosition(i,e),this.setFillStyle(a,o),void 0===u&&(u=2),this.setStrokeStyle(u,l,d),this.updateDisplayOrigin(),this.dirty=!0}updateData(){var t=this.geom,i=this.pathData;i.length=0;var e,s=t.width,r=t.height,h=t.cornerRadius,a=this.iteration+1;if(e=h.tl,f(e))if(e.convex){var o=e.x,n=e.y;c(o,n,e.x,e.y,180,270,!1,a,i)}else c(o=0,n=0,e.x,e.y,90,0,!0,a,i);else g(0,0,i);return e=h.tr,f(e)?e.convex?(o=s-e.x,n=e.y,c(o,n,e.x,e.y,270,360,!1,a,i)):c(o=s,n=0,e.x,e.y,180,90,!0,a,i):g(s,0,i),e=h.br,f(e)?e.convex?(o=s-e.x,n=r-e.y,c(o,n,e.x,e.y,0,90,!1,a,i)):c(o=s,n=r,e.x,e.y,270,180,!0,a,i):g(s,r,i),e=h.bl,f(e)?e.convex?(o=e.x,n=r-e.y,c(o,n,e.x,e.y,90,180,!1,a,i)):c(o=0,n=r,e.x,e.y,360,270,!0,a,i):g(0,r,i),i.push(i[0],i[1]),this.pathIndexes=x(i),this}setShapeType(t){return"string"==typeof t&&(t=R[t]),this.shapeType=t,this}setSize(t,i){return void 0===i&&(i=t),this.geom.width===t&&this.geom.height===i||(this.geom.setSize(t,i),1===this.shapeType&&this.setRadius({x:t/2,y:i/2}),this.updateDisplayOrigin(),this.dirty=!0,super.setSize(t,i)),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}}},"object"==typeof exports&&"undefined"!=typeof module?module.exports=i():"function"==typeof define&&define.amd?define(i):(t="undefined"!=typeof globalThis?globalThis:t||self).rexroundrectangle=i(); +var t,i;t=void 0,i=function(){var t=Phaser.Renderer.WebGL.Utils,i=Phaser.Renderer.WebGL.Utils;const e=Phaser.GameObjects.GetCalcMatrix,s=Phaser.Renderer.Canvas.SetTransform;var r={renderWebGL:function(s,r,h,a){r.dirty&&(r.updateData(),r.dirty=!1),h.addToRenderList(r);var o=s.pipelines.set(r.pipeline),n=e(r,h,a),l=o.calcMatrix.copyFrom(n.calc),d=r._displayOriginX,u=r._displayOriginY,g=h.alpha*r.alpha;s.pipelines.preBatch(r),r.isFilled&&function(i,e,s,r,h,a){for(var o=t.getTintAppendFloatAlpha(s.fillColor,s.fillAlpha*r),n=s.pathData,l=s.pathIndexes,d=0;d>>16,o=(65280&r)>>>8,n=255&r;t.fillStyle="rgba("+a+","+o+","+n+","+h+")"}(h,i),h.fill()),i.isStroked&&(function(t,i,e,s){var r=e||i.strokeColor,h=s||i.strokeAlpha,a=(16711680&r)>>>16,o=(65280&r)>>>8,n=255&r;t.strokeStyle="rgba("+a+","+o+","+n+","+h+")",t.lineWidth=i.lineWidth}(h,i),h.stroke()),h.restore()}}};const h=Phaser.GameObjects.Shape;class a extends h{get fillColor(){return this._fillColor}set fillColor(t){this._fillColor=t,this.isFilled=null!=t&&this._fillAlpha>0}get fillAlpha(){return this._fillAlpha}set fillAlpha(t){this._fillAlpha=t,this.isFilled=t>0&&null!=this._fillColor}setFillStyle(t,i){return void 0===i&&(i=1),this.fillColor=t,this.fillAlpha=i,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,i,e){return void 0===e&&(e=1),this.lineWidth=t,this.strokeColor=i,this.strokeAlpha=e,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,i){var e=this.input;return e&&!e.customHitArea&&(e.hitArea.width=t,e.hitArea.height=i),this}resize(t,i){return this.setSize(t,i),this}}Object.assign(a.prototype,r);const o=Phaser.Utils.Objects.GetValue;let n=class{constructor(t,i,e,s,r){void 0===t&&(t=0),void 0===i&&(i=t),void 0===e&&(e=0),void 0===s&&(s=0),void 0===r&&(r=0),this.cornerRadius={},this._width=0,this._height=0,this.setTo(t,i,e,s,r)}setTo(t,i,e,s,r){return this.setPosition(t,i),this.setRadius(r),this.setSize(e,s),this}setPosition(t,i){return this.x=t,this.y=i,this}setRadius(t){return void 0===t&&(t=0),this.radius=t,this}setSize(t,i){return this.width=t,this.height=i,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 i,e;"number"==typeof t?(i=t,e=t):(i=o(t,"x",0),e=o(t,"y",0));var s=this.cornerRadius;s.tl=l(o(t,"tl",void 0),i,e),s.tr=l(o(t,"tr",void 0),i,e),s.bl=l(o(t,"bl",void 0),i,e),s.br=l(o(t,"br",void 0),i,e)}get radiusTL(){var t=this.cornerRadius.tl;return Math.max(t.x,t.y)}set radiusTL(t){d(this.cornerRadius.tl,t)}get radiusTR(){var t=this.cornerRadius.tr;return Math.max(t.x,t.y)}set radiusTR(t){d(this.cornerRadius.tr,t)}get radiusBL(){var t=this.cornerRadius.bl;return Math.max(t.x,t.y)}set radiusBL(t){d(this.cornerRadius.bl,t)}get radiusBR(){var t=this.cornerRadius.br;return Math.max(t.x,t.y)}set radiusBR(t){d(this.cornerRadius.br,t)}};var l=function(t,i,e){return void 0===t?t={x:i,y:e}:"number"==typeof t&&(t={x:t,y:t}),u(t),t},d=function(t,i){"number"==typeof i?(t.x=i,t.y=i):(t.x=o(i,"x",0),t.y=o(i,"y",0)),u(t)},u=function(t){t.convex=t.x>=0||t.y>=0,t.x=Math.abs(t.x),t.y=Math.abs(t.y)},g=function(t){return t.x>0&&t.y>0},p=function(t,i,e){var s=e.length;if(s>=2){var r=e[s-2],h=e[s-1];if(t===r&&i===h)return e}return e.push(t,i),e};const c=Phaser.Math.DegToRad;var y=function(t,i,e,s,r,h,a,o,n){a&&h>r?h-=360:!a&&h 0) && (radius.y > 0)); + }; + var LineTo = function (x, y, pathData) { var cnt = pathData.length; if (cnt >= 2) { @@ -592,8 +596,7 @@ geom.setTo(0, 0, width, height, radius); } - var iteration = GetValue$1(radiusConfig, 'iteration', undefined); - this.setIteration(iteration); + this.setIteration(GetValue$1(radiusConfig, 'iteration', undefined)); this.setPosition(x, y); this.setFillStyle(fillColor, fillAlpha); @@ -846,10 +849,6 @@ } - var IsArcCorner = function (radius) { - return ((radius.x > 0) && (radius.y > 0)); - }; - const ShapeTypeMap = { rectangle: 0, circle: 1 diff --git a/dist/rexroundrectangleplugin.min.js b/dist/rexroundrectangleplugin.min.js index 63b5e594a1..a2795609ca 100644 --- a/dist/rexroundrectangleplugin.min.js +++ b/dist/rexroundrectangleplugin.min.js @@ -1 +1 @@ -var t,i;t=void 0,i=function(){var t=Phaser.Renderer.WebGL.Utils,i=Phaser.Renderer.WebGL.Utils;const e=Phaser.GameObjects.GetCalcMatrix,s=Phaser.Renderer.Canvas.SetTransform;var r={renderWebGL:function(s,r,a,h){r.dirty&&(r.updateData(),r.dirty=!1),a.addToRenderList(r);var o=s.pipelines.set(r.pipeline),n=e(r,a,h),l=o.calcMatrix.copyFrom(n.calc),d=r._displayOriginX,u=r._displayOriginY,c=a.alpha*r.alpha;s.pipelines.preBatch(r),r.isFilled&&function(i,e,s,r,a,h){for(var o=t.getTintAppendFloatAlpha(s.fillColor,s.fillAlpha*r),n=s.pathData,l=s.pathIndexes,d=0;d>>16,o=(65280&r)>>>8,n=255&r;t.fillStyle="rgba("+h+","+o+","+n+","+a+")"}(a,i),a.fill()),i.isStroked&&(function(t,i,e,s){var r=e||i.strokeColor,a=s||i.strokeAlpha,h=(16711680&r)>>>16,o=(65280&r)>>>8,n=255&r;t.strokeStyle="rgba("+h+","+o+","+n+","+a+")",t.lineWidth=i.lineWidth}(a,i),a.stroke()),a.restore()}}};const a=Phaser.GameObjects.Shape;class h extends a{get fillColor(){return this._fillColor}set fillColor(t){this._fillColor=t,this.isFilled=null!=t&&this._fillAlpha>0}get fillAlpha(){return this._fillAlpha}set fillAlpha(t){this._fillAlpha=t,this.isFilled=t>0&&null!=this._fillColor}setFillStyle(t,i){return void 0===i&&(i=1),this.fillColor=t,this.fillAlpha=i,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,i,e){return void 0===e&&(e=1),this.lineWidth=t,this.strokeColor=i,this.strokeAlpha=e,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,i){var e=this.input;return e&&!e.customHitArea&&(e.hitArea.width=t,e.hitArea.height=i),this}resize(t,i){return this.setSize(t,i),this}}Object.assign(h.prototype,r);const o=Phaser.Utils.Objects.GetValue;let n=class{constructor(t,i,e,s,r){void 0===t&&(t=0),void 0===i&&(i=t),void 0===e&&(e=0),void 0===s&&(s=0),void 0===r&&(r=0),this.cornerRadius={},this._width=0,this._height=0,this.setTo(t,i,e,s,r)}setTo(t,i,e,s,r){return this.setPosition(t,i),this.setRadius(r),this.setSize(e,s),this}setPosition(t,i){return this.x=t,this.y=i,this}setRadius(t){return void 0===t&&(t=0),this.radius=t,this}setSize(t,i){return this.width=t,this.height=i,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 i,e;"number"==typeof t?(i=t,e=t):(i=o(t,"x",0),e=o(t,"y",0));var s=this.cornerRadius;s.tl=l(o(t,"tl",void 0),i,e),s.tr=l(o(t,"tr",void 0),i,e),s.bl=l(o(t,"bl",void 0),i,e),s.br=l(o(t,"br",void 0),i,e)}get radiusTL(){var t=this.cornerRadius.tl;return Math.max(t.x,t.y)}set radiusTL(t){d(this.cornerRadius.tl,t)}get radiusTR(){var t=this.cornerRadius.tr;return Math.max(t.x,t.y)}set radiusTR(t){d(this.cornerRadius.tr,t)}get radiusBL(){var t=this.cornerRadius.bl;return Math.max(t.x,t.y)}set radiusBL(t){d(this.cornerRadius.bl,t)}get radiusBR(){var t=this.cornerRadius.br;return Math.max(t.x,t.y)}set radiusBR(t){d(this.cornerRadius.br,t)}};var l=function(t,i,e){return void 0===t?t={x:i,y:e}:"number"==typeof t&&(t={x:t,y:t}),u(t),t},d=function(t,i){"number"==typeof i?(t.x=i,t.y=i):(t.x=o(i,"x",0),t.y=o(i,"y",0)),u(t)},u=function(t){t.convex=t.x>=0||t.y>=0,t.x=Math.abs(t.x),t.y=Math.abs(t.y)},c=function(t,i,e){var s=e.length;if(s>=2){var r=e[s-2],a=e[s-1];if(t===r&&i===a)return e}return e.push(t,i),e};const g=Phaser.Math.DegToRad;var p=function(t,i,e,s,r,a,h,o,n){h&&a>r?a-=360:!h&&a0&&t.y>0};const b={rectangle:0,circle:1};function m(t,i,e,s,r,a,h){var o=new x(this.scene,t,i,e,s,r,a,h);return this.scene.add.existing(o),o}const T=Phaser.Utils.Objects.GetAdvancedValue,_=Phaser.Utils.Objects.GetValue,k=Phaser.GameObjects.BuildGameObject;function P(t,i){void 0===t&&(t={}),void 0!==i&&(t.add=i);var e=T(t,"width",void 0),s=T(t,"height",e),r=_(t,"radius",void 0),a=T(t,"fillColor",void 0),h=T(t,"fillAlpha",void 0),o=new x(this.scene,0,0,e,s,r,a,h);return k(this.scene,o,t),o}var A=function(t){return null==t||""===t||0===t.length};class S extends Phaser.Plugins.BasePlugin{constructor(t){super(t),t.registerGameObject("rexRoundRectangle",m,P)}start(){this.game.events.on("destroy",this.destroy,this)}}return function(t,i,e,s){if(void 0===s&&(s="."),"object"==typeof t)if(A(i)){if(null==e)return;"object"==typeof e&&(t=e)}else{"string"==typeof i&&(i=i.split(s));var r=i.pop(),a=function(t,i,e){var s=t;if(A(i));else{var r;"string"==typeof i&&(i=i.split("."));for(var a=0,h=i.length;a>>16,o=(65280&r)>>>8,n=255&r;t.fillStyle="rgba("+h+","+o+","+n+","+a+")"}(a,i),a.fill()),i.isStroked&&(function(t,i,e,s){var r=e||i.strokeColor,a=s||i.strokeAlpha,h=(16711680&r)>>>16,o=(65280&r)>>>8,n=255&r;t.strokeStyle="rgba("+h+","+o+","+n+","+a+")",t.lineWidth=i.lineWidth}(a,i),a.stroke()),a.restore()}}};const a=Phaser.GameObjects.Shape;class h extends a{get fillColor(){return this._fillColor}set fillColor(t){this._fillColor=t,this.isFilled=null!=t&&this._fillAlpha>0}get fillAlpha(){return this._fillAlpha}set fillAlpha(t){this._fillAlpha=t,this.isFilled=t>0&&null!=this._fillColor}setFillStyle(t,i){return void 0===i&&(i=1),this.fillColor=t,this.fillAlpha=i,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,i,e){return void 0===e&&(e=1),this.lineWidth=t,this.strokeColor=i,this.strokeAlpha=e,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,i){var e=this.input;return e&&!e.customHitArea&&(e.hitArea.width=t,e.hitArea.height=i),this}resize(t,i){return this.setSize(t,i),this}}Object.assign(h.prototype,r);const o=Phaser.Utils.Objects.GetValue;let n=class{constructor(t,i,e,s,r){void 0===t&&(t=0),void 0===i&&(i=t),void 0===e&&(e=0),void 0===s&&(s=0),void 0===r&&(r=0),this.cornerRadius={},this._width=0,this._height=0,this.setTo(t,i,e,s,r)}setTo(t,i,e,s,r){return this.setPosition(t,i),this.setRadius(r),this.setSize(e,s),this}setPosition(t,i){return this.x=t,this.y=i,this}setRadius(t){return void 0===t&&(t=0),this.radius=t,this}setSize(t,i){return this.width=t,this.height=i,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 i,e;"number"==typeof t?(i=t,e=t):(i=o(t,"x",0),e=o(t,"y",0));var s=this.cornerRadius;s.tl=l(o(t,"tl",void 0),i,e),s.tr=l(o(t,"tr",void 0),i,e),s.bl=l(o(t,"bl",void 0),i,e),s.br=l(o(t,"br",void 0),i,e)}get radiusTL(){var t=this.cornerRadius.tl;return Math.max(t.x,t.y)}set radiusTL(t){d(this.cornerRadius.tl,t)}get radiusTR(){var t=this.cornerRadius.tr;return Math.max(t.x,t.y)}set radiusTR(t){d(this.cornerRadius.tr,t)}get radiusBL(){var t=this.cornerRadius.bl;return Math.max(t.x,t.y)}set radiusBL(t){d(this.cornerRadius.bl,t)}get radiusBR(){var t=this.cornerRadius.br;return Math.max(t.x,t.y)}set radiusBR(t){d(this.cornerRadius.br,t)}};var l=function(t,i,e){return void 0===t?t={x:i,y:e}:"number"==typeof t&&(t={x:t,y:t}),u(t),t},d=function(t,i){"number"==typeof i?(t.x=i,t.y=i):(t.x=o(i,"x",0),t.y=o(i,"y",0)),u(t)},u=function(t){t.convex=t.x>=0||t.y>=0,t.x=Math.abs(t.x),t.y=Math.abs(t.y)},c=function(t){return t.x>0&&t.y>0},g=function(t,i,e){var s=e.length;if(s>=2){var r=e[s-2],a=e[s-1];if(t===r&&i===a)return e}return e.push(t,i),e};const p=Phaser.Math.DegToRad;var v=function(t,i,e,s,r,a,h,o,n){h&&a>r?a-=360:!h&&a 0) ? -this.delay : 0; + this.state = (this.nowTime >= 0) ? COUNTDOWN : DELAY; + this.repeatCounter = 0; + return this; + } + + stop() { + this.state = IDLE; + return this; + } + + update(time, delta) { + if (this.state === IDLE || this.state === DONE || + delta === 0 || this.timeScale === 0 + ) { + return; + } + + this.nowTime += (delta * this.timeScale); + this.justRestart = false; + if (this.nowTime >= this.duration) { + if ((this.repeat === -1) || (this.repeatCounter < this.repeat)) { + this.repeatCounter++; + this.justRestart = true; + this.nowTime -= this.duration; + if (this.repeatDelay > 0) { + this.nowTime -= this.repeatDelay; + this.state = REPEATDELAY; + } + } else { + this.nowTime = this.duration; + this.state = DONE; + } + } else if (this.nowTime >= 0) { + this.state = COUNTDOWN; + } + } + + get t() { + var t; + switch (this.state) { + case IDLE: + case DELAY: + case REPEATDELAY: + t = 0; + break; + + case COUNTDOWN: + t = this.nowTime / this.duration; + break; + + case DONE: + t = 1; + break; + } + return Clamp$1(t, 0, 1); + } + + set t(value) { + value = Clamp$1(value, -1, 1); + if (value < 0) { + this.state = DELAY; + this.nowTime = -this.delay * value; + } else { + this.state = COUNTDOWN; + this.nowTime = this.duration * value; + + if ((value === 1) && (this.repeat !== 0)) { + this.repeatCounter++; + } + } + } + + setT(t) { + this.t = t; + return this; + } + + get isIdle() { + return this.state === IDLE; + } + + get isDelay() { + return this.state === DELAY; + } + + get isCountDown() { + return this.state === COUNTDOWN; + } + + get isRunning() { + return this.state === DELAY || this.state === COUNTDOWN; + } + + get isDone() { + return this.state === DONE; + } + + get isOddIteration() { + return (this.repeatCounter & 1) === 1; + } + + get isEvenIteration() { + return (this.repeatCounter & 1) === 0; + } + + } + + const IDLE = 0; + const DELAY = 1; + const COUNTDOWN = 2; + const REPEATDELAY = 3; + const DONE = -1; + + class TimerTickTask extends SceneUpdateTickTask { + constructor(parent, config) { + super(parent, config); + this.timer = new Timer(); + // boot() later + } + + // override + shutdown(fromScene) { + // Already shutdown + if (this.isShutdown) { + return; + } + + super.shutdown(fromScene); + this.timer.destroy(); + this.timer = undefined; + } + + start() { + this.timer.start(); + super.start(); + return this; + } + + stop() { + this.timer.stop(); + super.stop(); + return this; + } + + complete() { + this.timer.stop(); + super.complete(); + return this; + } + + } + + const GetValue$5 = Phaser.Utils.Objects.GetValue; + const GetAdvancedValue = Phaser.Utils.Objects.GetAdvancedValue; + const GetEaseFunction = Phaser.Tweens.Builders.GetEaseFunction; + + class EaseValueTaskBase extends TimerTickTask { + resetFromJSON(o) { + this.timer.resetFromJSON(GetValue$5(o, 'timer')); + this.setEnable(GetValue$5(o, 'enable', true)); + this.setTarget(GetValue$5(o, 'target', this.parent)); + this.setDelay(GetAdvancedValue(o, 'delay', 0)); + this.setDuration(GetAdvancedValue(o, 'duration', 1000)); + this.setEase(GetValue$5(o, 'ease', 'Linear')); + this.setRepeat(GetValue$5(o, 'repeat', 0)); + + return this; + } + + setEnable(e) { + if (e == undefined) { + e = true; + } + this.enable = e; + return this; + } + + setTarget(target) { + if (target === undefined) { + target = this.parent; + } + this.target = target; + return this; + } + + setDelay(time) { + this.delay = time; + // Assign `this.timer.setRepeat(repeat)` manually + return this; + } + + setDuration(time) { + this.duration = time; + return this; + } + + setRepeat(repeat) { + this.repeat = repeat; + // Assign `this.timer.setRepeat(repeat)` manually + return this; + } + + setRepeatDelay(repeatDelay) { + this.repeatDelay = repeatDelay; + // Assign `this.timer.setRepeatDelay(repeatDelay)` manually + return this; + } + + setEase(ease) { + if (ease === undefined) { + ease = 'Linear'; + } + this.ease = ease; + this.easeFn = GetEaseFunction(ease); + return this; + } + + // Override + start() { + // Ignore start if timer is running, i.e. in DELAY, o RUN state + if (this.timer.isRunning) { + return this; + } + + super.start(); + return this; + } + + restart() { + this.timer.stop(); + this.start.apply(this, arguments); + return this; + } + + stop(toEnd) { + if (toEnd === undefined) { + toEnd = false; + } + + super.stop(); + + if (toEnd) { + this.timer.setT(1); + this.updateTarget(this.target, this.timer); + this.complete(); + } + + return this; + } + + update(time, delta) { + if ( + (!this.isRunning) || + (!this.enable) || + (this.parent.hasOwnProperty('active') && !this.parent.active) + ) { + return this; + } + + var target = this.target, + timer = this.timer; + + timer.update(time, delta); + + // isDelay, isCountDown, isDone + if (!timer.isDelay) { + this.updateTarget(target, timer); + } + + this.emit('update', target, this); + + if (timer.isDone) { + this.complete(); + } + + return this; + } + + // Override + updateTarget(target, timer) { + + } + } + + const GetValue$4 = Phaser.Utils.Objects.GetValue; + const Linear$1 = Phaser.Math.Linear; + + class EaseValueTask extends EaseValueTaskBase { + constructor(gameObject, config) { + super(gameObject, config); + // this.parent = gameObject; + // this.timer + + this.resetFromJSON(); + this.boot(); + } + + start(config) { + if (this.timer.isRunning) { + return this; + } + + var target = this.target; + this.propertyKey = GetValue$4(config, 'key', 'value'); + var currentValue = target[this.propertyKey]; + this.fromValue = GetValue$4(config, 'from', currentValue); + this.toValue = GetValue$4(config, 'to', currentValue); + + this.setEase(GetValue$4(config, 'ease', this.ease)); + this.setDuration(GetValue$4(config, 'duration', this.duration)); + this.setRepeat(GetValue$4(config, 'repeat', 0)); + this.setDelay(GetValue$4(config, 'delay', 0)); + this.setRepeatDelay(GetValue$4(config, 'repeatDelay', 0)); + + this.timer + .setDuration(this.duration) + .setRepeat(this.repeat) + .setDelay(this.delay) + .setRepeatDelay(this.repeatDelay); + + target[this.propertyKey] = this.fromValue; + + super.start(); + return this; + } + + updateTarget(target, timer) { + var t = timer.t; + t = this.easeFn(t); + + target[this.propertyKey] = Linear$1(this.fromValue, this.toValue, t); + } + } + + const Percent = Phaser.Math.Percent; + + var SetEaseValuePropName = function (name) { + this.easeValuePropName = name; + return this; + }; + + var SetEaseValueDuration = function (duration) { + this.easeValueDuration = duration; + return this; + }; + + var SetEaseValueFunction = function (ease) { + this.easeFunction = ease; + return this; + }; + + var StopEaseValue = function () { + if (this.easeValueTask) { + this.easeValueTask.stop(); + } + return this; + }; + + var EaseValueTo = function (value, min, max) { + if ((value === undefined) || (value === null)) { + return this; + } + + if (min !== undefined) { + value = Percent(value, min, max); + } + + if (this.easeValueTask === undefined) { + this.easeValueTask = new EaseValueTask(this, { eventEmitter: null }); + } + + this.easeValueTask.restart({ + key: this.easeValuePropName, + to: value, + duration: this.easeValueDuration, + ease: this.easeFunction, + }); + + return this; + }; + + var EaseValueRepeat = function (from, to, repeat, repeatDelay) { + if (repeat === undefined) { + repeat = -1; + } + if (repeatDelay === undefined) { + repeatDelay = 0; + } + + if (this.easeValueTask === undefined) { + this.easeValueTask = new EaseValueTask(this, { eventEmitter: null }); + } + + this.easeValueTask.restart({ + key: this.easeValuePropName, + from: from, to: to, + duration: this.easeValueDuration, + ease: this.easeFunction, + repeat: repeat, repeatDelay: repeatDelay, + }); + + return this; + }; + + var EaseValueMethods = { + setEaseValuePropName: SetEaseValuePropName, + setEaseValueDuration: SetEaseValueDuration, + setEaseValueFunction: SetEaseValueFunction, + stopEaseValue: StopEaseValue, + easeValueTo: EaseValueTo, + easeValueRepeat: EaseValueRepeat + }; + + const GetValue$3 = Phaser.Utils.Objects.GetValue; + const Clamp = Phaser.Math.Clamp; + + function ProgressBase (BaseClass) { + class ProgressBase extends BaseClass { + bootProgressBase(config) { + this.eventEmitter = GetValue$3(config, 'eventEmitter', this); + + var callback = GetValue$3(config, 'valuechangeCallback', null); + if (callback !== null) { + var scope = GetValue$3(config, 'valuechangeCallbackScope', undefined); + this.eventEmitter.on('valuechange', callback, scope); + } + + this + .setEaseValuePropName('value') + .setEaseValueDuration(GetValue$3(config, 'easeValue.duration', 0)) + .setEaseValueFunction(GetValue$3(config, 'easeValue.ease', 'Linear')); + + return this; + } + + get value() { + return this._value; + } + + set value(value) { + value = Clamp(value, 0, 1); + + var oldValue = this._value; + var valueChanged = (oldValue != value); + this.dirty = this.dirty || valueChanged; + this._value = value; + + if (valueChanged) { + this.eventEmitter.emit('valuechange', this._value, oldValue, this.eventEmitter); + } + } + } + + Object.assign( + ProgressBase.prototype, + ProgressValueMethods, + EaseValueMethods + ); + + return ProgressBase; + } + + var FillStyle = function (color, alpha) { + if (color == null) { + this.isFilled = false; + } else { + if (alpha === undefined) { + alpha = 1; + } + this.isFilled = true; + this.fillColor = color; + this.fillAlpha = alpha; + } + return this; + }; + + var LineStyle = function (lineWidth, color, alpha) { + if ((lineWidth == null) || (color == null)) { + this.isStroked = false; + } else { + if (alpha === undefined) { + alpha = 1; + } + this.isStroked = true; + this.lineWidth = lineWidth; + this.strokeColor = color; + this.strokeAlpha = alpha; + } + return this; + }; + + var StyleMethods = { + fillStyle: FillStyle, + lineStyle: LineStyle + }; + + var GetValue$2 = function (source, key, defaultValue) { + if (!source || typeof source === 'number') { + return defaultValue; + } + + if (typeof (key) === 'string') { + if (source.hasOwnProperty(key)) { + return source[key]; + } + if (key.indexOf('.') !== -1) { + key = key.split('.'); + } else { + return defaultValue; + } + } + + var keys = key; + var parent = source; + var value = defaultValue; + + // Use for loop here so we can break early + for (var i = 0; i < keys.length; i++) { + key = keys[i]; + if (parent.hasOwnProperty(key)) { + // Yes it has a key property, let's carry on down + value = parent[key]; + + parent = value; + } + else { + // Can't go any further, so reset to default + value = defaultValue; + break; + } + } + + return value; + }; + + var DataMethods = { + enableData() { + if (this.data === undefined) { + this.data = {}; + } + return this; + }, + + setData(key, value) { + this.enableData(); + if (arguments.length === 1) { + var data = key; + for (key in data) { + this.data[key] = data[key]; + } + } else { + this.data[key] = value; + } + return this; + }, + + getData(key, defaultValue) { + this.enableData(); + return (key === undefined) ? this.data : GetValue$2(this.data, key, defaultValue); + }, + + incData(key, inc, defaultValue) { + if (defaultValue === undefined) { + defaultValue = 0; + } + this.enableData(); + this.setData(key, this.getData(key, defaultValue) + inc); + return this; + }, + + mulData(key, mul, defaultValue) { + if (defaultValue === undefined) { + defaultValue = 0; + } + this.enableData(); + this.setData(key, this.getData(key, defaultValue) * mul); + return this; + }, + + clearData() { + if (this.data) { + Clear(this.data); + } + return this; + }, + }; + + class BaseGeom { + constructor() { + this.name = undefined; + this.dirty = true; + this.visible = true; + this.data = undefined; + + this.isFilled = false; + this.fillColor = undefined; + this.fillAlpha = 1; + + this.isStroked = false; + this.lineWidth = 1; + this.strokeColor = undefined; + this.strokeAlpha = 1; + } + + setName(name) { + this.name = name; + return this; + } + + setVisible(visible) { + if (visible === undefined) { + visible = true; + } + this.visible = visible; + return this; + } + + reset() { + this + .setVisible() + .fillStyle() + .lineStyle(); + + return this; + } + + webglRender(pipeline, calcMatrix, alpha, dx, dy) { + + } + + canvasRender(ctx, dx, dy) { + + } + + updateData() { + this.dirty = false; + } + } + + Object.assign( + BaseGeom.prototype, + StyleMethods, + DataMethods + ); + + /* + src: { + fillColor, + fillAlpha, + pathData, + pathIndexes // Earcut(pathData) + } + */ + + var Utils$1 = Phaser.Renderer.WebGL.Utils; + + var FillPathWebGL = function (pipeline, calcMatrix, src, alpha, dx, dy) + { + var fillTintColor = Utils$1.getTintAppendFloatAlpha(src.fillColor, src.fillAlpha * alpha); + + var path = src.pathData; + var pathIndexes = src.pathIndexes; + + for (var i = 0; i < pathIndexes.length; i += 3) + { + var p0 = pathIndexes[i] * 2; + var p1 = pathIndexes[i + 1] * 2; + var p2 = pathIndexes[i + 2] * 2; + + var x0 = path[p0 + 0] - dx; + var y0 = path[p0 + 1] - dy; + var x1 = path[p1 + 0] - dx; + var y1 = path[p1 + 1] - dy; + var x2 = path[p2 + 0] - dx; + var y2 = path[p2 + 1] - dy; + + var tx0 = calcMatrix.getX(x0, y0); + var ty0 = calcMatrix.getY(x0, y0); + var tx1 = calcMatrix.getX(x1, y1); + var ty1 = calcMatrix.getY(x1, y1); + var tx2 = calcMatrix.getX(x2, y2); + var ty2 = calcMatrix.getY(x2, y2); + + pipeline.batchTri(src, tx0, ty0, tx1, ty1, tx2, ty2, 0, 0, 1, 1, fillTintColor, fillTintColor, fillTintColor, 2); + } + }; + + /* + src: { + strokeColor, + strokeAlpha, + pathData, + lineWidth, + closePath + } + */ + var Utils = Phaser.Renderer.WebGL.Utils; + + var StrokePathWebGL = function (pipeline, src, alpha, dx, dy) + { + var strokeTint = pipeline.strokeTint; + var strokeTintColor = Utils.getTintAppendFloatAlpha(src.strokeColor, src.strokeAlpha * alpha); + + strokeTint.TL = strokeTintColor; + strokeTint.TR = strokeTintColor; + strokeTint.BL = strokeTintColor; + strokeTint.BR = strokeTintColor; + + var path = src.pathData; + var pathLength = path.length - 1; + var lineWidth = src.lineWidth; + var halfLineWidth = lineWidth / 2; + + var px1 = path[0] - dx; + var py1 = path[1] - dy; + + if (!src.closePath) + { + pathLength -= 2; + } + + for (var i = 2; i < pathLength; i += 2) + { + var px2 = path[i] - dx; + var py2 = path[i + 1] - dy; + + pipeline.batchLine( + px1, + py1, + px2, + py2, + halfLineWidth, + halfLineWidth, + lineWidth, + i - 2, + (src.closePath) ? (i === pathLength - 1) : false + ); + + px1 = px2; + py1 = py2; + } + }; + + var FillStyleCanvas = function (ctx, src, altColor, altAlpha) + { + var fillColor = (altColor) ? altColor : src.fillColor; + var fillAlpha = (altAlpha) ? altAlpha : src.fillAlpha; + + var red = ((fillColor & 0xFF0000) >>> 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; + }; + + 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; + this.lastCX = cx; + this.lastCY = cy; + return this; + }, + + smoothQuadraticBezierTo(x, y) { + var cx = this.lastPointX * 2 - this.lastCX; + var cy = this.lastPointY * 2 - this.lastCY; + this.quadraticBezierTo(cx, cy, x, y); + return this; + }, + + cubicBezierCurveTo(cx0, cy0, cx1, cy1, x, y) { + CubicBezierCurveTo( + cx0, cy0, cx1, cy1, x, y, + this.iterations, + this.pathData + ); + + this.lastPointX = x; + this.lastPointY = y; + this.lastCX = cx1; + this.lastCY = cy1; + return this; + }, + + smoothCubicBezierCurveTo(cx1, cy1, x, y) { + var cx0 = this.lastPointX * 2 - this.lastCX; + var cy0 = this.lastPointY * 2 - this.lastCY; + this.cubicBezierCurveTo(cx0, cy0, cx1, cy1, x, y); + 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$1 = 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$1(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; + const PointRotateAround = 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]; + if (this.lastCX !== undefined) { + var point = { + x: this.lastCX, + y: this.lastCY + }; + PointRotateAround(point, centerX, centerY, angle); + this.lastCX = point.x; + this.lastCY = point.y; + } + 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]; + if (this.lastCX !== undefined) { + var x = this.lastCX - centerX; + var y = this.lastCY - centerY; + x *= scaleX; + y *= scaleY; + this.lastCX = x + centerX; + this.lastCY = y + centerY; + } + 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; + } + + smoothQuadraticBezierTo(x, y) { + this.builder.smoothQuadraticBezierTo(x, y); + + this.dirty = true; + return this; + } + + cubicBezierCurveTo(cx0, cy0, cx1, cy1, x, y) { + this.builder.cubicBezierCurveTo(cx0, cy0, cx1, cy1, x, y); + + this.dirty = true; + return this; + } + + smoothCubicBezierCurveTo(cx1, cy1, x, y) { + this.builder.smoothCubicBezierCurveTo(cx1, cy1, x, y); + + 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; + + var IsArcCorner = function (radius) { + return ((radius.x > 0) && (radius.y > 0)); + }; + + var BuildRoundRectangle = function ( + lines, + width, height, cornerRadius, + iteration + ) { + + lines + .setIterations(iteration) + .start(); + + // Top-left + var radius = cornerRadius.tl; + if (IsArcCorner(radius)) { + if (radius.convex) { + var centerX = radius.x; + var centerY = radius.y; + lines.ellipticalArc(centerX, centerY, radius.x, radius.y, 180, 270, false); + } else { + var centerX = 0; + var centerY = 0; + lines.ellipticalArc(centerX, centerY, radius.x, radius.y, 90, 0, true); + } + } else { + lines.lineTo(0, 0); + } + + // Top-right + var radius = cornerRadius.tr; + if (IsArcCorner(radius)) { + if (radius.convex) { + var centerX = width - radius.x; + var centerY = radius.y; + lines.ellipticalArc(centerX, centerY, radius.x, radius.y, 270, 360, false); + } else { + var centerX = width; + var centerY = 0; + lines.ellipticalArc(centerX, centerY, radius.x, radius.y, 180, 90, true); + } + } else { + lines.lineTo(width, 0); + } + + // Bottom-right + var radius = cornerRadius.br; + if (IsArcCorner(radius)) { + if (radius.convex) { + var centerX = width - radius.x; + var centerY = height - radius.y; + lines.ellipticalArc(centerX, centerY, radius.x, radius.y, 0, 90, false); + } else { + var centerX = width; + var centerY = height; + lines.ellipticalArc(centerX, centerY, radius.x, radius.y, 270, 180, true); + } + } else { + lines.lineTo(width, height); + } + + // Bottom-left + var radius = cornerRadius.bl; + if (IsArcCorner(radius)) { + if (radius.convex) { + var centerX = radius.x; + var centerY = height - radius.y; + lines.ellipticalArc(centerX, centerY, radius.x, radius.y, 90, 180, false); + } else { + var centerX = 0; + var centerY = height; + lines.ellipticalArc(centerX, centerY, radius.x, radius.y, 360, 270, true); + } + } else { + lines.lineTo(0, height); + } + + lines.close(); + + return lines; + }; + + var RadToDeg$3 = Phaser.Math.RadToDeg; + + var BuildRoundRectangleBarDirection0 = function ( + lines, + width, height, cornerRadius, + value, + ) { + var barWidth = width * value; + + // Top-left + var radius = cornerRadius.tl; + if (IsArcCorner(radius)) { + var theta; + if (barWidth > radius.x) { + theta = 90; + } else { + theta = RadToDeg$3(Math.acos((radius.x - barWidth) / radius.x)); + } + var centerX = radius.x; + var centerY = radius.y; + lines.ellipticalArc(centerX, centerY, radius.x, radius.y, 180, 180 + theta, false); + } else { + lines.lineTo(0, 0); + } + + // Top-right + var radius = cornerRadius.tr; + if (IsArcCorner(radius) && (barWidth > (width - radius.x))) { + var theta = 90 - RadToDeg$3(Math.acos((barWidth - (width - radius.x)) / radius.x)); + var centerX = width - radius.x; + var centerY = radius.y; + lines.ellipticalArc(centerX, centerY, radius.x, radius.y, 270, 270 + theta, false); + } else { + lines.lineTo(barWidth, 0); + } + + // Bottom-right + var radius = cornerRadius.br; + if (IsArcCorner(radius) && (barWidth > (width - radius.x))) { + var theta = 90 - RadToDeg$3(Math.acos((barWidth - (width - radius.x)) / radius.x)); + var centerX = width - radius.x; + var centerY = height - radius.y; + lines.ellipticalArc(centerX, centerY, radius.x, radius.y, 90 - theta, 90, false); + } else { + lines.lineTo(barWidth, height); + } + + // Bottom-left + var radius = cornerRadius.bl; + if (IsArcCorner(radius)) { + var theta; + if (barWidth > radius.x) { + theta = 90; + } else { + theta = RadToDeg$3(Math.acos((radius.x - barWidth) / radius.x)); + } + var centerX = radius.x; + var centerY = height - radius.y; + lines.ellipticalArc(centerX, centerY, radius.x, radius.y, 180 - theta, 180, false); + } else { + lines.lineTo(0, height); + } + }; + + var RadToDeg$2 = Phaser.Math.RadToDeg; + + var BuildRoundRectangleBarDirection1 = function ( + lines, + width, height, cornerRadius, + value, + ) { + var barHeight = height * value; + + // Top-left + var radius = cornerRadius.tl; + if (IsArcCorner(radius)) { + var theta; + if (barHeight > radius.y) { + theta = 90; + } else { + theta = RadToDeg$2(Math.acos((radius.y - barHeight) / radius.y)); + } + var centerX = radius.x; + var centerY = radius.y; + lines.ellipticalArc(centerX, centerY, radius.x, radius.y, 270 - theta, 270, false); + } else { + lines.lineTo(0, 0); + } + + // Top-right + var radius = cornerRadius.tr; + if (IsArcCorner(radius)) { + var theta; + if (barHeight > radius.y) { + theta = 90; + } else { + theta = RadToDeg$2(Math.acos((radius.y - barHeight) / radius.y)); + } + var centerX = width - radius.x; + var centerY = radius.y; + lines.ellipticalArc(centerX, centerY, radius.x, radius.y, 270, 270 + theta, false); + } else { + lines.lineTo(width, 0); + } + + // Bottom-right + var radius = cornerRadius.br; + if (IsArcCorner(radius) && (barHeight > (height - radius.y))) { + var theta = 90 - RadToDeg$2(Math.acos((barHeight - (height - radius.y)) / radius.y)); + var centerX = width - radius.x; + var centerY = height - radius.y; + lines.ellipticalArc(centerX, centerY, radius.x, radius.y, 0, 0 + theta, false); + } else { + lines.lineTo(width, barHeight); + } + + // Bottom-left + var radius = cornerRadius.bl; + if (IsArcCorner(radius) && (barHeight > (height - radius.y))) { + var theta = 90 - RadToDeg$2(Math.acos((barHeight - (height - radius.y)) / radius.y)); + var centerX = radius.x; + var centerY = height - radius.y; + lines.ellipticalArc(centerX, centerY, radius.x, radius.y, 180 - theta, 180, false); + } else { + lines.lineTo(0, barHeight); + } + }; + + var RadToDeg$1 = Phaser.Math.RadToDeg; + + var BuildRoundRectangleBarDirection2 = function ( + lines, + width, height, cornerRadius, + value, + ) { + var barWidth = width * value; + + // Top-right + var radius = cornerRadius.tr; + if (IsArcCorner(radius)) { + var theta; + if (barWidth > radius.x) { + theta = 90; + } else { + theta = RadToDeg$1(Math.acos((radius.x - barWidth) / radius.x)); + } + var centerX = width - radius.x; + var centerY = radius.y; + lines.ellipticalArc(centerX, centerY, radius.x, radius.y, 360 - theta, 360, false); + } else { + lines.lineTo(width, 0); + } + + // Bottom-right + var radius = cornerRadius.br; + if (IsArcCorner(radius)) { + var theta; + if (barWidth > radius.x) { + theta = 90; + } else { + theta = RadToDeg$1(Math.acos((radius.x - barWidth) / radius.x)); + } + var centerX = width - radius.x; + var centerY = height - radius.y; + lines.ellipticalArc(centerX, centerY, radius.x, radius.y, 0, 0 + theta, false); + } else { + lines.lineTo(width, height); + } + + // Bottom-left + var radius = cornerRadius.bl; + if (IsArcCorner(radius) && (barWidth > (width - radius.x))) { + var theta = 90 - RadToDeg$1(Math.acos((barWidth - (width - radius.x)) / radius.x)); + var centerX = radius.x; + var centerY = height - radius.y; + lines.ellipticalArc(centerX, centerY, radius.x, radius.y, 90, 90 + theta, false); + } else { + lines.lineTo(width - barWidth, height); + } + + // Top-left + var radius = cornerRadius.tl; + if (IsArcCorner(radius) && (barWidth > (width - radius.x))) { + var theta = 90 - RadToDeg$1(Math.acos((barWidth - (width - radius.x)) / radius.x)); + var centerX = radius.x; + var centerY = radius.y; + lines.ellipticalArc(centerX, centerY, radius.x, radius.y, 270 - theta, 270, false); + } else { + lines.lineTo(width - barWidth, 0); + } + + }; + + var RadToDeg = Phaser.Math.RadToDeg; + + var BuildRoundRectangleBarDirection3 = function ( + lines, + width, height, cornerRadius, + value, + ) { + var barHeight = height * value; + + // Bottom-right + var radius = cornerRadius.br; + if (IsArcCorner(radius)) { + if (barHeight > radius.y) { + theta = 90; + } else { + theta = RadToDeg(Math.acos((radius.y - barHeight) / radius.y)); + } + var centerX = width - radius.x; + var centerY = height - radius.y; + lines.ellipticalArc(centerX, centerY, radius.x, radius.y, 90 - theta, 90, false); + } else { + lines.lineTo(width, height); + } + + // Bottom-left + var radius = cornerRadius.bl; + if (IsArcCorner(radius)) { + if (barHeight > radius.y) { + theta = 90; + } else { + theta = RadToDeg(Math.acos((radius.y - barHeight) / radius.y)); + } + var centerX = radius.x; + var centerY = height - radius.y; + lines.ellipticalArc(centerX, centerY, radius.x, radius.y, 90, 90 + theta, false); + } else { + lines.lineTo(0, height); + } + + // Top-left + var radius = cornerRadius.tl; + if (IsArcCorner(radius) && (barHeight > (height - radius.y))) { + var theta = 90 - RadToDeg(Math.acos((barHeight - (height - radius.y)) / radius.y)); + var centerX = radius.x; + var centerY = radius.y; + lines.ellipticalArc(centerX, centerY, radius.x, radius.y, 180, 180 + theta, false); + } else { + lines.lineTo(0, height - barHeight); + } + + // Top-right + var radius = cornerRadius.tr; + if (IsArcCorner(radius) && (barHeight > (height - radius.y))) { + var theta = 90 - RadToDeg(Math.acos((barHeight - (height - radius.y)) / radius.y)); + var centerX = width - radius.x; + var centerY = radius.y; + lines.ellipticalArc(centerX, centerY, radius.x, radius.y, 360 - theta, 360, false); + } else { + lines.lineTo(width, height - barHeight); + } + + }; + + var BuildRoundRectangleBar = function ( + lines, + width, height, cornerRadius, + value, orientation, rtl, + iteration + ) { + + lines + .setIterations(iteration) + .start(); + + if (value === 0) { + return lines; + } else if (value === 1) { + return BuildRoundRectangle(lines, width, height, cornerRadius, iteration); + } + + var callback; + if (orientation === 0) { + callback = (rtl) ? BuildRoundRectangleBarDirection2 : BuildRoundRectangleBarDirection0; + } else { + callback = (rtl) ? BuildRoundRectangleBarDirection3 : BuildRoundRectangleBarDirection1; + } + + callback(lines, width, height, cornerRadius, value); + + lines.close(); + + return lines; + }; + + var UpdateShapes = function () { + var width = this.width; + var height = this.height; + var cornerRadius = this.rrGeom.cornerRadius; + var value = this.value; + var orientation = this.orientation; + var rtl = this.rtl; + var iteration = this.iteration + 1; + + var trackFill = this.getShape('trackFill'); + trackFill.fillStyle(this.trackColor); + if (trackFill.isFilled) { + BuildRoundRectangle( + trackFill, + width, height, cornerRadius, + iteration + ); + } + + var bar = this.getShape('bar'); + bar.fillStyle(this.barColor); + if (bar.isFilled) { + BuildRoundRectangleBar( + bar, + width, height, cornerRadius, + value, orientation, rtl, + iteration + ); + } + + var trackStroke = this.getShape('trackStroke'); + trackStroke.lineStyle(this.trackStrokeThickness, this.trackStrokeColor); + if (trackStroke.isStroked) { + BuildRoundRectangle( + trackStroke, // lines + width, height, cornerRadius, + iteration + ); + } + }; + + const GetValue$1 = Phaser.Utils.Objects.GetValue; + + class RoundRectangle { + constructor(x, y, width, height, radiusConfig) { + if (x === undefined) { x = 0; } + if (y === undefined) { y = x; } + if (width === undefined) { width = 0; } + if (height === undefined) { height = 0; } + if (radiusConfig === undefined) { radiusConfig = 0; } + + this.cornerRadius = {}; + this._width = 0; + this._height = 0; + this.setTo(x, y, width, height, radiusConfig); + } + + setTo(x, y, width, height, radiusConfig) { + this.setPosition(x, y); + this.setRadius(radiusConfig); + this.setSize(width, height); + return this; + } + + setPosition(x, y) { + this.x = x; + this.y = y; + return this; + } + + setRadius(value) { + if (value === undefined) { + value = 0; + } + this.radius = value; + return this; + } + + setSize(width, height) { + this.width = width; + this.height = height; + return this; + } + + get minWidth() { + var radius = this.cornerRadius; + return Math.max(radius.tl.x + radius.tr.x, radius.bl.x + radius.br.x); + } + + get minHeight() { + var radius = this.cornerRadius; + return Math.max(radius.tl.y + radius.bl.y, radius.tr.y + radius.br.y); + } + + get width() { + return this._width; + } + + set width(value) { + if (value == null) { + value = 0; + } + this._width = Math.max(value, this.minWidth); + } + + get height() { + return this._height; + } + + set height(value) { + if (value == null) { + value = 0; + } + this._height = Math.max(value, this.minHeight); + } + + get radius() { + var radius = this.cornerRadius; + return Math.max( + radius.tl.x, radius.tl.y, + radius.tr.x, radius.tr.y, + radius.bl.x, radius.bl.y, + radius.br.x, radius.br.y + ); + } + + set radius(value) { + var defaultRadiusX, defaultRadiusY; + if (typeof (value) === 'number') { + defaultRadiusX = value; + defaultRadiusY = value; + } else { + defaultRadiusX = GetValue$1(value, 'x', 0); + defaultRadiusY = GetValue$1(value, 'y', 0); + } + + var radius = this.cornerRadius; + radius.tl = GetRadius(GetValue$1(value, 'tl', undefined), defaultRadiusX, defaultRadiusY); + radius.tr = GetRadius(GetValue$1(value, 'tr', undefined), defaultRadiusX, defaultRadiusY); + radius.bl = GetRadius(GetValue$1(value, 'bl', undefined), defaultRadiusX, defaultRadiusY); + radius.br = GetRadius(GetValue$1(value, 'br', undefined), defaultRadiusX, defaultRadiusY); + } + + get radiusTL() { + var radius = this.cornerRadius.tl; + return Math.max(radius.x, radius.y); + } + + set radiusTL(value) { + SetRadius(this.cornerRadius.tl, value); + } + + get radiusTR() { + var radius = this.cornerRadius.tr; + return Math.max(radius.x, radius.y); + } + + set radiusTR(value) { + SetRadius(this.cornerRadius.tr, value); + } + + get radiusBL() { + var radius = this.cornerRadius.bl; + return Math.max(radius.x, radius.y); + } + + set radiusBL(value) { + SetRadius(this.cornerRadius.bl, value); + } + + get radiusBR() { + var radius = this.cornerRadius.br; + return Math.max(radius.x, radius.y); + } + + set radiusBR(value) { + SetRadius(this.cornerRadius.br, value); + } + } + + var GetRadius = function (radius, defaultRadiusX, defaultRadiusY) { + if (radius === undefined) { + radius = { + x: defaultRadiusX, + y: defaultRadiusY + }; + } else if (typeof (radius) === 'number') { + radius = { + x: radius, + y: radius + }; + } + + SetConvex(radius); + return radius; + + }; + + var SetRadius = function (radius, value) { + if (typeof (value) === 'number') { + radius.x = value; + radius.y = value; + } else { + radius.x = GetValue$1(value, 'x', 0); + radius.y = GetValue$1(value, 'y', 0); + } + + SetConvex(radius); + }; + + var SetConvex = function (radius) { + radius.convex = (radius.x >= 0) || (radius.y >= 0); + + radius.x = Math.abs(radius.x); + radius.y = Math.abs(radius.y); + }; + + var OrientationMode = { + x: 0, + h: 0, + horizontal: 0, + 'left-to-right': 0, + + y: 1, + v: 1, + vertical: 1, + 'top-to-bottom': 1 + }; + + var GetOrientationMode = function (orientation) { + if (typeof (orientation) === 'string') { + orientation = OrientationMode[orientation]; + } + return orientation; + }; + + const GetValue = Phaser.Utils.Objects.GetValue; + const IsPlainObject = Phaser.Utils.Objects.IsPlainObject; + + class RoundRectangleProgress extends ProgressBase(BaseShapes) { + constructor(scene, x, y, width, height, radiusConfig, barColor, value, config) { + if (IsPlainObject(x)) { + config = x; + + x = config.x; + y = config.y; + width = config.width; + height = config.height; + radiusConfig = config.radius; + barColor = config.barColor; + value = config.value; + } else if (IsPlainObject(width)) { + config = width; + + width = config.width; + height = config.height; + radiusConfig = config.radius; + barColor = config.barColor; + value = config.value; + } else if (IsPlainObject(radiusConfig)) { + config = radiusConfig; + + radiusConfig = config.radius; + barColor = config.barColor; + value = config.value; + } + + if (x === undefined) { x = 0; } + if (y === undefined) { y = 0; } + if (width === undefined) { width = 1; } + if (height === undefined) { height = width; } + if (radiusConfig === undefined) { radiusConfig = 0; } + if (value === undefined) { value = 0; } + + super(scene, x, y, width, height, config); + this.type = 'rexRoundRectangleProgress'; + + this.bootProgressBase(config); + + this + .addShape((new Lines()).setName('trackFill')) + .addShape((new Lines()).setName('bar')) + .addShape((new Lines()).setName('trackStroke')); + + this.setTrackColor(GetValue(config, 'trackColor', undefined)); + this.setBarColor(barColor); + this.setTrackStroke(GetValue(config, 'trackStrokeThickness', 2), GetValue(config, 'trackStrokeColor', undefined)); + + this.setOrientation(GetValue(config, 'orientation', 0)); + this.setRTL(GetValue(config, 'rtl', false)); + + this.rrGeom = new RoundRectangle(); // For radiusConfig only + this.setRadius(radiusConfig); + + this.setIteration(GetValue(radiusConfig, 'iteration', undefined)); + + this.setValue(value); + } + + get trackColor() { + return this._trackColor; + } + + set trackColor(value) { + this.dirty = this.dirty || (this._trackColor != value); + this._trackColor = value; + } + + setTrackColor(color) { + this.trackColor = color; + return this; + } + + get trackStrokeColor() { + return this._trackStrokeColor; + } + + set trackStrokeColor(value) { + this.dirty = this.dirty || (this._trackStrokeColor != value); + this._trackStrokeColor = value; + } + + get trackStrokeThickness() { + return this._trackStrokeThickness; + } + + set trackStrokeThickness(value) { + this.dirty = this.dirty || (this._trackStrokeThickness != value); + this._trackStrokeThickness = value; + } + + setTrackStroke(lineWidth, color) { + this.trackStrokeThickness = lineWidth; + this.trackStrokeColor = color; + return this; + } + + get barColor() { + return this._barColor; + } + + set barColor(value) { + this.dirty = this.dirty || (this._barColor != value); + this._barColor = value; + } + + setBarColor(color) { + this.barColor = color; + return this; + } + + get orientation() { + return this._orientation; + } + + set orientation(value) { + value = GetOrientationMode(value); + this.dirty = this.dirty || (this._orientation != value); + this._orientation = value; + } + + setOrientation(value) { + this.orientation = value; + return this; + } + + get rtl() { + return this._rtl; + } + + set rtl(value) { + value = !!value; + this.dirty = this.dirty || (this._rtl != value); + this._rtl = value; + } + + setRTL(enable) { + if (enable === undefined) { + enable = true; + } + this.rtl = enable; + return this; + } + + get radius() { + return this.rrGeom.radius; + } + + set radius(value) { + this.rrGeom.setRadius(value); + this.dirty = true; + } + + get radiusTL() { + return this.rrGeom.radiusTL; + } + + set radiusTL(value) { + this.rrGeom.radiusTL = value; + this.dirty = true; + } + + get radiusTR() { + return this.rrGeom.radiusTR; + } + + set radiusTR(value) { + this.rrGeom.radiusTR = value; + this.dirty = true; + } + + get radiusBL() { + return this.rrGeom.radiusBL; + } + + set radiusBL(value) { + this.rrGeom.radiusBL = value; + this.dirty = true; + } + + get radiusBR() { + return this.rrGeom.radiusBR; + } + + set radiusBR(value) { + this.rrGeom.radiusBR = value; + this.dirty = true; + } + + setRadius(value) { + if (value === undefined) { + value = 0; + } + this.radius = value; + return this; + } + + setRadiusTL(value) { + if (value === undefined) { + value = 0; + } + this.radiusTL = value; + return this; + } + + setRadiusTR(value) { + if (value === undefined) { + value = 0; + } + this.radiusTR = value; + return this; + } + + setRadiusBL(value) { + if (value === undefined) { + value = 0; + } + this.radiusBL = value; + return this; + } + + setRadiusBR(value) { + if (value === undefined) { + value = 0; + } + this.radiusBR = value; + return this; + } + + get cornerRadius() { + return this.rrGeom.cornerRadius; + } + + set cornerRadius(value) { + this.radius = value; + } + + setCornerRadius(value) { + return this.setRadius(value); + } + + get iteration() { + return this._iteration; + } + + set iteration(value) { + // Set iteration first time + if (this._iteration === undefined) { + this._iteration = value; + return; + } + + // Change iteration value + if (this._iteration === value) { + return; + } + + this._iteration = value; + this.dirty = true; + } + + setIteration(iteration) { + if (iteration === undefined) { + iteration = 6; + } + this.iteration = iteration; + return this; + } + } + + var Methods = { + updateShapes: UpdateShapes, + }; + + Object.assign( + RoundRectangleProgress.prototype, + Methods, + ); + + function Factory (x, y, width, height, barColor, value, config) { + var gameObject = new RoundRectangleProgress(this.scene, x, y, width, height, barColor, value, config); + this.scene.add.existing(gameObject); + return gameObject; + } + + const BuildGameObject = Phaser.GameObjects.BuildGameObject; + + function Creator (config, addToScene) { + if (config === undefined) { config = {}; } + if (addToScene !== undefined) { + config.add = addToScene; + } + var gameObject = new RoundRectangleProgress(this.scene, config); + 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 RoundRectangleProgressPlugin extends Phaser.Plugins.BasePlugin { + + constructor(pluginManager) { + super(pluginManager); + + // Register our new Game Object type + pluginManager.registerGameObject('rexRoundRectangleProgress', Factory, Creator); + } + + start() { + var eventEmitter = this.game.events; + eventEmitter.on('destroy', this.destroy, this); + } + } + + SetValue(window, 'RexPlugins.GameObjects.RoundRectangleProgress', RoundRectangleProgress); + + return RoundRectangleProgressPlugin; + +})); diff --git a/dist/rexroundrectangleprogressplugin.min.js b/dist/rexroundrectangleprogressplugin.min.js new file mode 100644 index 0000000000..9493abebab --- /dev/null +++ b/dist/rexroundrectangleprogressplugin.min.js @@ -0,0 +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?_:C,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=E)):(this.nowTime=this.duration,this.state=A):this.nowTime>=0&&(this.state=_))}get t(){var t;switch(this.state){case R:case C:case E:t=0;break;case _: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=C,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===R}get isDelay(){return this.state===C}get isCountDown(){return this.state===_}get isRunning(){return this.state===C||this.state===_}get isDone(){return this.state===A}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}}const R=0,C=1,_=2,E=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 B 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 O=Phaser.Utils.Objects.GetValue,G=Phaser.Math.Linear;class j extends B{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 i=e[this.propertyKey];return this.fromValue=O(t,"from",i),this.toValue=O(t,"to",i),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 i=e.t;i=this.easeFn(i),t[this.propertyKey]=G(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 j(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 j(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 X=Phaser.Utils.Objects.GetValue,Y=Phaser.Math.Clamp;var N={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 Q=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 H=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),Q(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},Tt=Phaser.Math.RadToDeg,kt=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)},Ct=Phaser.Math.RadToDeg,_t=function(t,e,i,s,r){var a=i*r,h=s.br;if(Pt(h)){l=a>h.y?90:Ct(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:Ct(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-Ct(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-Ct(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 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=Et(t,"x",0),i=Et(t,"y",0));var s=this.cornerRadius;s.tl=wt(Et(t,"tl",void 0),e,i),s.tr=wt(Et(t,"tr",void 0),e,i),s.bl=wt(Et(t,"bl",void 0),e,i),s.br=wt(Et(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=Et(e,"x",0),t.y=Et(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 Bt=Phaser.Utils.Objects.GetValue,Ot=Phaser.Utils.Objects.IsPlainObject;class Gt extends(function(t){class e extends t{bootProgressBase(t){this.eventEmitter=X(t,"eventEmitter",this);var e=X(t,"valuechangeCallback",null);if(null!==e){var i=X(t,"valuechangeCallbackScope",void 0);this.eventEmitter.on("valuechange",e,i)}return this.setEaseValuePropName("value").setEaseValueDuration(X(t,"easeValue.duration",0)).setEaseValueFunction(X(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,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.bootProgressBase(o),this.addShape((new ft).setName("trackFill")).addShape((new ft).setName("bar")).addShape((new ft).setName("trackStroke")),this.setTrackColor(Bt(o,"trackColor",void 0)),this.setBarColor(h),this.setTrackStroke(Bt(o,"trackStrokeThickness",2),Bt(o,"trackStrokeColor",void 0)),this.setOrientation(Bt(o,"orientation",0)),this.setRTL(Bt(o,"rtl",!1)),this.rrGeom=new At,this.setRadius(a),this.setIteration(Bt(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 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&&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:kt:h?_t: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 Gt(this.scene,t,e,i,s,r,a,h);return this.scene.add.existing(n),n}Object.assign(Gt.prototype,jt);const zt=Phaser.GameObjects.BuildGameObject;function Xt(t,e){void 0===t&&(t={}),void 0!==e&&(t.add=e);var i=new Gt(this.scene,t);return zt(this.scene,i,t),i}var Yt=function(t){return null==t||""===t||0===t.length};class Nt extends Phaser.Plugins.BasePlugin{constructor(t){super(t),t.registerGameObject("rexRoundRectangleProgress",Ft,Xt)}start(){this.game.events.on("destroy",this.destroy,this)}}return function(t,e,i,s){if(void 0===s&&(s="."),"object"==typeof t)if(Yt(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(Yt(e));else{var r;"string"==typeof e&&(e=e.split("."));for(var a=0,h=e.length;a 0) && (radius.y > 0)); + }; + var LineTo = function (x, y, pathData) { var cnt = pathData.length; if (cnt >= 2) { @@ -14584,8 +14588,7 @@ geom.setTo(0, 0, width, height, radius); } - var iteration = GetValue$k(radiusConfig, 'iteration', undefined); - this.setIteration(iteration); + this.setIteration(GetValue$k(radiusConfig, 'iteration', undefined)); this.setPosition(x, y); this.setFillStyle(fillColor, fillAlpha); @@ -14838,10 +14841,6 @@ } - var IsArcCorner = function (radius) { - return ((radius.x > 0) && (radius.y > 0)); - }; - const ShapeTypeMap = { rectangle: 0, circle: 1 @@ -16427,6 +16426,7 @@ var skewX = this.skewX; var width = this.width - Math.abs(skewX); var height = this.height; + var trackFill = this.getShape('trackFill'); trackFill.fillStyle(this.trackColor); if (trackFill.isFilled) { @@ -16435,8 +16435,7 @@ 0, 0, // x0, y0 width, height, // x1, y1 skewX // skewX - ) - .close(); + ); } var bar = this.getShape('bar'); @@ -16456,8 +16455,7 @@ barX0, 0, // x0, y0 barX1, height, // x1, y1 skewX // skew - ) - .close(); + ); } var trackStroke = this.getShape('trackStroke'); @@ -16468,8 +16466,7 @@ 0, 0, // x0, y0 width, height, // x1, y1 skewX // skewX - ) - .end(); + ); } }; @@ -16489,6 +16486,8 @@ .lineTo(x0, y0).lineTo(startX, y0); } + lines.close(); + return lines; }; @@ -16499,24 +16498,33 @@ constructor(scene, x, y, width, height, barColor, value, config) { if (IsPlainObject$4(x)) { config = x; - x = GetValue$h(config, 'x', 0); - y = GetValue$h(config, 'y', 0); - width = GetValue$h(config, 'width', 2); - height = GetValue$h(config, 'height', 2); - barColor = GetValue$h(config, 'barColor', undefined); - value = GetValue$h(config, 'value', 0); + + x = config.x; + y = config.y; + width = config.width; + height = config.height; + barColor = config.barColor; + value = config.value; } else if (IsPlainObject$4(width)) { config = width; - width = GetValue$h(config, 'width', 2); - height = GetValue$h(config, 'height', 2); - barColor = GetValue$h(config, 'barColor', undefined); - value = GetValue$h(config, 'value', 0); + + width = config.width; + height = config.height; + barColor = config.barColor; + value = config.value; } else if (IsPlainObject$4(barColor)) { config = barColor; - barColor = GetValue$h(config, 'barColor', undefined); - value = GetValue$h(config, 'value', 0); + + barColor = config.barColor; + value = config.value; } + if (x === undefined) { x = 0; } + if (y === undefined) { y = 0; } + if (width === undefined) { width = 2; } + if (height === undefined) { height = width; } + if (value === undefined) { value = 0; } + super(scene, x, y, width, height, config); this.type = 'rexLineProgress'; diff --git a/dist/rexscrollablepanel.min.js b/dist/rexscrollablepanel.min.js index 41788d809f..0b7787905e 100644 --- a/dist/rexscrollablepanel.min.js +++ b/dist/rexscrollablepanel.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},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},T={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}},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}},Oe=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,ke=Phaser.Utils.Objects.GetValue;var Te=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},De={getInnerPadding(t){return Te(this.space,t)},setInnerPadding(t,e){return Me(this.space,t,e),this},getOuterPadding(t){return Te(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)),Te(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}},Re=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}},Le=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},Ye=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},Ae=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?gi:vi,this.repeatCounter=0,this}stop(){return this.state=pi,this}update(t,e){this.state!==pi&&this.state!==mi&&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=fi)):(this.nowTime=this.duration,this.state=mi):this.nowTime>=0&&(this.state=gi))}get t(){var t;switch(this.state){case pi:case vi:case fi:t=0;break;case gi:t=this.nowTime/this.duration;break;case mi:t=1}return ci(t,0,1)}set t(t){(t=ci(t,-1,1))<0?(this.state=vi,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===pi}get isDelay(){return this.state===vi}get isCountDown(){return this.state===gi}get isRunning(){return this.state===vi||this.state===gi}get isDone(){return this.state===mi}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}}const pi=0,vi=1,gi=2,fi=3,mi=-1;class yi extends oi{constructor(t,e){super(t,e),this.timer=new ui}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 bi=Phaser.Utils.Objects.GetValue,Ci=Phaser.Utils.Objects.GetAdvancedValue,Si=Phaser.Tweens.Builders.GetEaseFunction;class Pi extends yi{resetFromJSON(t){return this.timer.resetFromJSON(bi(t,"timer")),this.setEnable(bi(t,"enable",!0)),this.setTarget(bi(t,"target",this.parent)),this.setDelay(Ci(t,"delay",0)),this.setDuration(Ci(t,"duration",1e3)),this.setEase(bi(t,"ease","Linear")),this.setRepeat(bi(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,_i=Phaser.Math.Linear;let Oi=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=Ei[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=_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 ki=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 Oi(t,a):r.resetFromJSON(a),r.restart(),r},Ti=function(t,e,i,s,r,n){void 0===s&&(s="Linear"),r instanceof Oi&&(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 Oi(t,h):n.resetFromJSON(h),n.restart(),n},Mi=function(t,e){return new Promise((function(i,s){t.once(e,(function(){i()}))}))},Di=function(t){return Mi(t,"complete")};const Ri=Phaser.Utils.Objects.IsPlainObject;var Li={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(Ri(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),Di(this._scaleBehavior)},isRunningPopUp(){return this._scaleBehavior&&"popup.complete"===this._scaleBehavior.completeEventName},scaleDownDestroy(t,e,i,s){if(Ri(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=Ti(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(Ri(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 Oi(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,Li),Xi.onInitScale=function(){Li.onInitScale.call(this);var t=this;this._scaleBehavior.on("update",(function(){var e=ye.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const Yi=Phaser.Utils.Objects.GetValue,zi=Phaser.Utils.Objects.GetAdvancedValue,Ai=Phaser.Math.Linear;class ji extends Pi{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(Yi(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=Ai(this.alphaStart,this.alphaEnd,i)}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Ii={stop:0,destroy:1,yoyo:2},Wi=Phaser.Utils.Objects.IsPlainObject;var Fi=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 h={mode:0,start:r,end:n,duration:e};return void 0===s?s=new ji(t,h):s.resetFromJSON(h),s.restart(),s},Vi=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 Bi=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(Bi(t)){var i=t;t=i.duration,e=i.alpha}var s=void 0===this._fade;return this._fade=Fi(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(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),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()}},Gi={};Object.assign(Gi,Ni),Gi.onInitFade=function(){Ni.onInitFade.call(this);var t=this;this._fade.on("update",(function(){var e=ye.getParentSizer(t);e&&e.resetChildAlphaState(t)}))};const Ui=Phaser.Utils.Objects.GetValue,Hi=Phaser.Utils.Objects.GetAdvancedValue,$i=Phaser.Math.Linear;class Ji extends Pi{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){if(super.resetFromJSON(t),this.setMode(Ui(t,"mode",0)),t&&(t.hasOwnProperty("x")||t.hasOwnProperty("y"))){var e=Hi(t,"x",void 0),i=Hi(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=Hi(i,"startX",void 0),this.startY=Hi(i,"startY",void 0),this.endX=Hi(i,"endX",void 0),this.endY=Hi(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 qi={stop:0,destroy:1,yoyo:2};var Ki=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 Zi=Phaser.Utils.Objects.IsPlainObject,Qi=Phaser.Math.Distance.Between;var ts={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(Zi(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*Qi(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 Ji&&(h=n,n=void 0),void 0===n&&(n=!1);var a={};return a.mode=n?1:0,void 0!==i&&(a.startX=Ki(i,t.x),a.endX=t.x),void 0!==s&&(a.startY=Ki(s,t.y),a.endY=t.y),a.duration=e,a.ease=void 0===r?"Linear":r,void 0===h?h=new Ji(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(Zi(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*Qi(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 Ji&&(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=Ki(i,t.x)),void 0!==s&&(a.startY=t.y,a.endY=Ki(s,t.y)),a.duration=e,a.ease=void 0===r?"Linear":r,void 0===h?h=new Ji(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}},es={};Object.assign(es,ts),es.onInitEaseMove=function(){ts.onInitEaseMove.call(this);var t=this;this._easeMove.on("update",(function(){var e=ye.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const is=Phaser.Utils.Objects.GetValue;class ss extends ni{constructor(t,e){super(t,e),this.timer=new ui,this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.timer.resetFromJSON(is(t,"timer")),this.setEnable(is(t,"enable",!0)),this.setMode(is(t,"mode",1)),this.isRunning=is(t,"isRunning",!1),this.setMagnitudeMode(is(t,"magnitudeMode",1)),this.setAxisMode(is(t,"axis",0)),this.setDuration(is(t,"duration",500)),this.setMagnitude(is(t,"magnitude",10)),this.ox=is(t,"ox",void 0),this.oy=is(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=rs[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=ns[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=is(i,"magnitude",void 0),t=is(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 rs={effect:0,behavior:1},ns={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},as=Phaser.Utils.Objects.IsPlainObject;var os={shake(t,e,i){if(as(t)){var s=t;t=s.duration,e=s.magnitude,i=s.magnitudeMode}return void 0===this._shake&&(this._shake=new ss(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 ls=Phaser.Utils.Objects.GetValue,ds=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=ls(t,"key","value");var i=e[this.propertyKey];return this.fromValue=ls(t,"from",i),this.toValue=ls(t,"to",i),this.setEase(ls(t,"ease",this.ease)),this.setDuration(ls(t,"duration",this.duration)),this.setRepeat(ls(t,"repeat",0)),this.setDelay(ls(t,"delay",0)),this.setRepeatDelay(ls(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]=ds(this.fromValue,this.toValue,i)}}const us=Phaser.Utils.Objects.IsPlainObject;class ps extends ti{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(us(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(us(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 vs={easeDataTo(t,e,i,s){return this._easeData||(this._easeData=new ps(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,fs={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=Je(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}},Rs={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}},Ls={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}},Ys={};Object.assign(Ys,Ds,Rs,Ls,Xs);const zs=Phaser.Utils.Objects.GetValue;class As extends ti{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 Ms(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(As.prototype,Ys);var js=function(t){if(t.parentContainer)return js(t.parentContainer);var e=function(t){var e=t.displayList;return H(e)?e:null}(t);return e?js(e):t};class Is extends ti{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 Ws=Phaser.GameObjects.Rectangle;class Fs extends Ws{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 Vs=Phaser.Utils.Objects.GetValue;class Bs extends ti{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=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 Gs=Phaser.Utils.Objects.GetValue;class Us extends Fs{constructor(t,e){super(t,Gs(e,"color",0),Gs(e,"alpha",.8)),this.touchEventStop=new Bs(this,{hitAreaMode:1})}}var Hs={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){Ti(t,e,void 0,void 0,!1)},fadeIn(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Fi(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,Fi(t,e,t.alpha)},Js=function(t,e){Vi(t,e,!1)},qs=function(t,e,i,s,r){return!(!t||s&&!s(t,e,i)||!rt(t,!0).contains(e,i)||r&&!r(t,e,i))};const Ks=Phaser.Utils.Objects.GetValue;let Zs=class extends As{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=Qs.popUp),null==e.transitOut&&(e.transitOut=Qs.scaleDown),e.destroy=Ks(e,"destroy",!0),super(t,e);var i=Ks(e,"cover");this.cover=!1!==i?function(t,e){var i=t.scene,s=new Us(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(Ks(i,"transitIn",$s)),this.setCoverTransitOutCallback(Ks(i,"transitOut",Js)));var s=Ks(e,"touchOutsideClose",!1),r=Ks(e,"duration.hold",-1),n=Ks(e,"timeOutClose",r>=0),h=Ks(e,"anyTouchClose",!1);Ks(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),Ks(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=Qs[t]),t){case Qs.popUp:t=Hs.popUp;break;case Qs.fadeIn:t=Hs.fadeIn}return super.setTransitInCallback(t),this}setTransitOutCallback(t){switch("string"==typeof t&&(t=Qs[t]),t){case Qs.scaleDown:t=Hs.scaleDown;break;case Qs.fadeOut:t=Hs.fadeOut}return super.setTransitOutCallback(t),this}setCoverTransitInCallback(t){return this.coverTransitInCallback=t,this}setCoverTransitOutCallback(t){return this.coverTransitOutCallback=t,this}};const Qs={popUp:0,fadeIn:1,scaleDown:0,fadeOut:1};var tr=function(t){return t&&"function"==typeof t},er={modal(t,e){return tr(t)&&(e=t,t=void 0),void 0===this._modalBehavior&&(this.onCreateModalBehavior&&this.onCreateModalBehavior(this,t),this._modalBehavior=function(t,e){var i=new Zs(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}},ir=function(t,e,i,s,r){tr(e)&&(r=s,s=i,i=e,e=this);var n=this.scene.events;return this.bindEvent(e,n,t,i,s,r),this},sr={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 ir.call(this,"preupdate",t,e,i,s),this},bindSceneUpdateEvent(t,e,i,s){return ir.call(this,"update",t,e,i,s),this},bindScenePostupdateEvent(t,e,i,s){return ir.call(this,"postupdate",t,e,i,s),this},bindSceneRenderEvent(t,e,i,s){return ir.call(this,"render",t,e,i,s),this},bindScenePauseEvent(t,e,i,s){return ir.call(this,"pause",t,e,i,s),this},bindSceneResumeEvent(t,e,i,s){return ir.call(this,"resume",t,e,i,s),this},bindSceneSleepEvent(t,e,i,s){return ir.call(this,"sleep",t,e,i,s),this},bindSceneWakeEvent(t,e,i,s){return ir.call(this,"wake",t,e,i,s),this},bindSceneShutdownEvent(t,e,i,s){return ir.call(this,"shutdown",t,e,i,s),this}},rr=function(t,e,i){var s=t.camera;return s?(void 0===i?i={}:!0===i&&(i=nr),s===e?(i.x=t.worldX,i.y=t.worldY):s.getWorldPoint(t.x,t.y,i),i):null},nr={},hr=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=rr(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 mr={press:0,pointerdown:0,release:1,pointerup:1};var yr={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 fr(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}},br=function(t,e,i,s,r){if(e)return!(i&&!i(t,e)||!Cr(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 wr extends ti{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?br: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 _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 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 Or extends Ts{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 kr extends ti{constructor(t,e){super(t,e),this._enable=void 0,this.cooldown=new Or,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 Tr={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}},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=Hr,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=Hr,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=Jr,this}isPointerInGameObject(t,e,i){var s=this.lastPointer;return!!s&&hr(t,s,e,i)}}const Hr=0,$r=1,Jr="IDLE",qr=Phaser.Utils.Objects.GetValue,Kr=Phaser.Math.Distance.Between;class Zr extends Ur{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=Qr},eventEmitter:!1};this.setRecongizedStateObject(new Ts(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 Qr:this.state=tn;break;case tn:var t=this.lastPointer;Kr(t.upX,t.upY,t.x,t.y)>this.tapOffset&&(this.state=en,this.state=tn);break;case en:this.state=tn}}onDragEnd(){this.state===tn&&(this.tapsCount++,this.emit("tapping",this,this.gameObject,this.lastPointer),void 0!==this.maxTaps&&this.tapsCount===this.maxTaps&&(this.state=en))}onDrag(){this.state!==Qr&&this.pointer.getDistance()>this.dragThreshold&&(this.state=Qr)}preUpdate(t,e){if(this.isRunning&&this.enable&&this.state===tn){var i=this.lastPointer;i.isDown?t-i.downTime>this.holdTime&&(this.state=Qr):t-i.upTime>this.tapInterval&&(void 0===this.minTaps||this.tapsCount>=this.minTaps?this.state=en:this.state=Qr)}}postUpdate(t,e){this.isRunning&&this.enable&&this.state===en&&(this.state=Qr)}get isTapped(){return this.state===en}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 Qr="IDLE",tn="BEGIN",en="RECOGNIZED",sn=Phaser.Utils.Objects.GetValue;class rn extends Ur{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=nn},eventEmitter:!1};this.setRecongizedStateObject(new Ts(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(sn(t,"threshold",9)),this.setHoldTime(sn(t,"time",251)),this}onDragStart(){this.state=hn,0===this.holdTime&&(this.state=an)}onDragEnd(){this.state=nn}onDrag(){this.state!==nn&&this.pointer.getDistance()>this.dragThreshold&&(this.state=nn)}preUpdate(t,e){this.isRunning&&this.enable&&this.state===hn&&t-this.pointer.downTime>=this.holdTime&&(this.state=an)}get isPressed(){return this.state===an}setHoldTime(t){return this.holdTime=t,this}setDragThreshold(t){return this.dragThreshold=t,this}}const nn="IDLE",hn="BEGIN",an="RECOGNIZED";Phaser.Utils.Objects.GetValue;var on=function(t){return Ze(t).loop.delta};const ln=Phaser.Math.Distance.Between,dn=Phaser.Math.Angle.Between;var cn={getDt:function(){return on(this.scene)},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,gn=Phaser.Math.RadToDeg;class fn extends Ur{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 Ts(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}}(gn(this.getVelocityAngle()),this.dirMode,this),this}clearDirectionStates(){return this.left=!1,this.right=!1,this.up=!1,this.down=!1,this}}Object.assign(fn.prototype,cn);const mn="IDLE",yn="BEGIN",bn="RECOGNIZED",Cn=Phaser.Utils.Objects.GetValue,Sn=Phaser.Utils.Array.SpliceOne,Pn=Phaser.Math.Distance.Between,wn=Phaser.Math.Angle.Between;class xn{constructor(t,e){var i=Je(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,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 On:this.tracerState=En,this.onDrag1Start();break;case En: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 En:this.tracerState=On,this.onDrag1End();break;case kn: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 kn:this.onDrag2()}}}dragCancel(){return this.tracerState===kn&&this.onDrag2End(),this.pointers.length=0,ft(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!==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 wn(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!==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=Tn,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(xn.prototype,Ue);var _n={};const On=0,En=1,kn=2,Tn="IDLE";Phaser.Utils.Objects.GetValue;const Mn=Phaser.Math.RotateAround;var Dn=function(t,e,i,s){return Mn(t,e,i,s),t.rotation+=s,t},Rn={};const Ln=Phaser.Utils.Objects.GetValue,Xn=Phaser.Math.Angle.WrapDegrees,Yn=Phaser.Math.Angle.ShortestBetween,zn=Phaser.Math.RadToDeg,An=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=Rn),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=Yn(this.prevAngle,t),this.prevAngle=t,this.state=Fn}break;case Fn:t=Xn(zn(this.angleBetween)),this.angle=Yn(this.prevAngle,t),this.prevAngle=t,this.emit("rotate",this)}}get isRotated(){return this.state===Fn}get rotation(){return An(this.angle)}setDragThreshold(t){return this.dragThreshold=t,this}}.prototype,jn);const In="IDLE",Wn="BEGIN",Fn="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 Zr(this,e),this._tap.on("tap",(function(t,e,s){Rr(i.eventEmitter,`${i.eventNamePrefix}${t.tapsCount}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Nn=Phaser.Utils.Objects.GetValue;var Gn=function(t){var e=Nn(t,"press",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._press=new rn(this,e),this._press.on("pressstart",(function(t,e,s){Rr(i.eventEmitter,`${i.eventNamePrefix}pressstart`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this).on("pressend",(function(t,e,s){Rr(i.eventEmitter,`${i.eventNamePrefix}pressend`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),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 fn(this,e),this._swipe.on("swipe",(function(t,e,s){var r=t.left?"left":t.right?"right":t.up?"up":"down";Rr(i.eventEmitter,`${i.eventNamePrefix}swipe${r}`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const $n=Phaser.Utils.Objects.GetValue;var Jn=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.")},Xr.call(t,e),Ar.call(t,e),Wr.call(t,e),Nr.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),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",de),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)}}for(var d,c,u=this.getAllShownChildren([this]),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 nh=Phaser.Utils.Objects.IsPlainObject,hh=Phaser.Utils.Objects.GetValue,ah=Phaser.Display.Align.CENTER,oh={min:0,full:-1};var lh=function(t,e,i,s,r,n,h,a,o,l){ge.call(this,t);var d=t.isRexSpace,c=typeof e;if(null===e)return this;if("number"===c);else if("string"===c)e=oh[e];else if(nh(e)){var u;e=hh(u=e,"proportion",void 0),i=hh(u,"align",ah),s=hh(u,"padding",0),r=hh(u,"expand",!1),n=hh(u,"key",void 0),h=hh(u,"index",void 0),t.isRexSizer||(a=hh(u,"minWidth",void 0),o=hh(u,"minHeight",void 0)),l=hh(u,"fitRatio",0)}return"string"==typeof i&&(i=zt[i]),void 0===e&&(e=d?1:0),void 0===i&&(i=ah),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===a&&(d?a=0:t.isRexSizer||(a=t._minWidth)),void 0===o&&(d?o=0:t.isRexSizer||(o=t._minHeight)),void 0===l||!1===l?l=0:!0===l&&(l=Q(t)/tt(t)),(u=this.getSizerConfig(t)).proportion=e,u.align=i,u.padding=pe(s),u.expand=r,u.fitRatio=0===e?l:0,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},dh={add:lh,addSpace(t){return this.insertSpace(void 0,t),this},insertSpace(t,e){return void 0===e&&(e=1),lh.call(this,new sh(this.scene),{proportion:e,minWidth:0,minHeight:0,index:t}),this},insert(t,e,i,s,r,n,h,a){return nh(i)&&(i.index=t),lh.call(this,e,i,s,r,n,h,t,a),this},insertAtPosition(t,e,i,s,r,n,h,a,o){var l=rh.call(this,t,e);return-1===l&&(l=void 0),this.insert(l,i,s,r,n,h,a,o),this}};const ch=Tt.prototype.clear;var uh=function(t){this.backgroundChildren&&(this.backgroundChildren.length=0);var e,i=!t&&this.sizerEventsEnable;if(i&&(e=this.getChildren([])),ch.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,uh.call(this,t),this}},gh={getChildAlign(t){return this.getSizerConfig(t).align},setChildAlign(t,e){return"string"==typeof e&&(e=zt[e]),this.getSizerConfig(t).align=e,this}},fh={getChildProportion(t){return this.getSizerConfig(t).proportion},setChildProportion(t,e){return this.getSizerConfig(t).proportion=e,this}},mh={getChildExpand(t){return this.getSizerConfig(t).expand},setChildExpand(t,e){return this.getSizerConfig(t).expand=e,this}},yh={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}},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;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,Ie.call(this),this},layoutChildren:function(){for(var t,e,i,s,r,n,h,a,o,l,d=this.sizerChildren,c=this.innerLeft,u=this.innerTop,p=this.innerWidth,v=this.innerHeight,g=c,f=u,m=this.startChildIndex,y=0,b=d.length;y0?(e=t-this.getChildrenWidth(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},resolveHeight:function(t){if(void 0!==(t=Ye.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)||Le.call(this)},runWidthWrap:function(t){this.wrapResult||(1===this.orientation&&eh.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&&eh.call(this,void 0,t),Ae.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(bh,dh,vh,gh,fh,mh,yh);var Ch=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,wh=Phaser.Utils.Objects.GetValue;class xh extends Zn{constructor(t,e,i,s,r,n,h){Ph(e)?(e=wh(h=e,"x",0),i=wh(h,"y",0),s=wh(h,"width",void 0),r=wh(h,"height",void 0),n=wh(h,"orientation",0)):Ph(s)?(s=wh(h=s,"width",void 0),r=wh(h,"height",void 0),n=wh(h,"orientation",0)):Ph(n)&&(n=wh(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(wh(h,"space.item",0)),this.setStartChildIndex(wh(h,"startChildIndex",0)),this.setRTL(wh(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=Ch.call(this)),this._childrenProportion}}Object.assign(xh.prototype,bh);var _h={v:0,vertical:0,y:0,h:1,horizontal:1,x:1,xy:2,vh:2},Oh=function(t,e){void 0===e&&(e="scrollMode"),t.hasOwnProperty(e)||(t[e]=Eh(t));var i=t[e];return"string"==typeof i&&(i=_h[i]),i},Eh=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,Th,0)},Th=function(t,e){return t+e};const Mh=Phaser.Utils.Objects.IsPlainObject,Dh=Phaser.Utils.Objects.GetValue,Rh=Phaser.Display.Align.CENTER;var Lh=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 Yh(this.sizerChildren,null),uh.call(this,t),this}},Ah={setColumnSpace(t){if(this.space.column||(this.space.column=[]),this.space.column.length=this.columnCount-1,"number"==typeof t)Yh(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},Fh={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=Ye.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===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,Yh(this.sizerChildren,null),this.columnProportions=[],this.columnProportions.length=t,"number"==typeof i)Yh(this.columnProportions,i);else for(var n=0;n0?e+=t:0===t&&(this.hasColumnProportion0Child=!0);return e},Bh=function(){for(var t,e=0,i=0;i0?e+=t:0===t&&(this.hasRowProportion0Child=!0);return e};const Nh=Phaser.Utils.Objects.IsPlainObject,Gh=Phaser.Utils.Objects.GetValue;class Uh extends Zn{constructor(t,e,i,s,r,n,h,a,o,l){Nh(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)):Nh(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)):Nh(n)?(n=Gh(l=n,"column",l.col||0),h=Gh(l,"row",0),a=Gh(l,"columnProportions",0),o=Gh(l,"rowProportions",0)):Nh(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=Vh.call(this)),this._totalColumnProportions}get totalRowProportions(){return void 0===this._totalRowProportions&&(this._totalRowProportions=Bh.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,Fh);const Hh=Phaser.Utils.Objects.GetValue;var $h=Phaser.Renderer.WebGL.Utils,Jh=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+")"},ta=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 ea=Phaser.Renderer.Canvas.SetTransform;var ia={renderWebGL:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.pipelines.set(e.pipeline),n=Zh(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&&Jh(r,h,e,l,a,o),e.isStroked&&Kh(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(ea(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(ra.prototype,ia);const na=Phaser.Utils.Objects.GetValue;let ha=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=na(t,"x",0),i=na(t,"y",0));var s=this.cornerRadius;s.tl=aa(na(t,"tl",void 0),e,i),s.tr=aa(na(t,"tr",void 0),e,i),s.bl=aa(na(t,"bl",void 0),e,i),s.br=aa(na(t,"br",void 0),e,i)}get radiusTL(){var t=this.cornerRadius.tl;return Math.max(t.x,t.y)}set radiusTL(t){oa(this.cornerRadius.tl,t)}get radiusTR(){var t=this.cornerRadius.tr;return Math.max(t.x,t.y)}set radiusTR(t){oa(this.cornerRadius.tr,t)}get radiusBL(){var t=this.cornerRadius.bl;return Math.max(t.x,t.y)}set radiusBL(t){oa(this.cornerRadius.bl,t)}get radiusBR(){var t=this.cornerRadius.br;return Math.max(t.x,t.y)}set radiusBR(t){oa(this.cornerRadius.br,t)}};var aa=function(t,e,i){return void 0===t?t={x:e,y:i}:"number"==typeof t&&(t={x:t,y:t}),la(t),t},oa=function(t,e){"number"==typeof e?(t.x=e,t.y=e):(t.x=na(e,"x",0),t.y=na(e,"y",0)),la(t)},la=function(t){t.convex=t.x>=0||t.y>=0,t.x=Math.abs(t.x),t.y=Math.abs(t.y)},da=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 ca=Phaser.Math.DegToRad;var ua=function(t,e,i,s,r,n,h,a,o){h&&n>r?n-=360:!h&&n0&&t.y>0};const ya={rectangle:0,circle:1};var ba=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};const Ca=Phaser.Utils.Objects.GetValue;class Sa extends ti{constructor(t,e){super(t,e),this.style=Ca(e,"style",this);var i=Ca(e,"propertiesMap");this.activeStyle=Pa(e,"active",i),this.hoverStyle=Pa(e,"hover",i),this.disableStyle=Pa(e,"disable",i),this.onModifyStyle=Ca(e,"onModifyStyle")}getStyle(t){return function(t,e,i){if(void 0===i&&(i={}),Array.isArray(e))for(var s=0,r=e.length;s0,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};const go=Phaser.Utils.Objects.GetValue,fo=Phaser.Utils.Objects.IsPlainObject;class mo extends(Wa(Ra)){constructor(t,e,i,s,r,n,h,a){fo(e)?(e=go(a=e,"x",0),i=go(a,"y",0),s=go(a,"width",2),r=go(a,"height",2),n=go(a,"barColor",void 0),h=go(a,"value",0)):fo(s)?(s=go(a=s,"width",2),r=go(a,"height",2),n=go(a,"barColor",void 0),h=go(a,"value",0)):fo(n)&&(n=go(a=n,"barColor",void 0),h=go(a,"value",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).close();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).close());var a=this.getShape("trackStroke");a.lineStyle(this.trackStrokeThickness,this.trackStrokeColor),a.isStroked&&vo(a,0,0,e,i,t).end()}};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;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 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:At,_drawImage:At,_drawTileSprite:At,_endDraw:At,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=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,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 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 Go=Phaser.Utils.Objects.IsPlainObject,Uo=Phaser.Utils.Objects.GetValue,Ho=Phaser.GameObjects;var $o=void 0,Jo=function(t,e){if($o||($o={},Ze(t).events.once("destroy",(function(){for(var t in $o)$o[t].destroy();$o=void 0}))),!$o.hasOwnProperty(e)){var i=Ze(t).scene.systemScene;(t=new Ho[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(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}(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 ti{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&&ko(this,i),this.style=new Qo(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign(el.prototype,xa);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 So(t,e);break;case"image":s=new zo(t,e);break;case"nineSlice":s=e.hasOwnProperty("stretchMode")?new el(t,e):new Ro(t,e);break;default:s=new _a(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 Xl=Phaser.Utils.Objects.GetValue,Yl=Phaser.Math.Distance.Between;class zl extends ti{constructor(t,e){super(t,e),this._enable=void 0,this.rectBoundsInteractive=Xl(e,"rectBoundsInteractive",!1),this.rectBoundsInteractive||t.setInteractive(Xl(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(Xl(t,"enable",!0)),this.holdThreshold=Xl(t,"holdThreshold",50),this.pointerOutReleaseEnable=Xl(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 on(this.scene)}get speed(){return this.x===this.preX&&this.y===this.preY?0:Yl(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&&!hr(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&&!hr(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 jl{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 Il{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 ti{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||hr(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 Hl=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 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);var p=Ul(r,"position",0);"string"==typeof p&&(p=$l[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[`adaptThumb${i}SizeMode`]=Ul(r,"adaptThumbSize",!1),t[`minThumb${i}Size`]=Ul(r,"minThumbSize",void 0)}else t[`hideUnscrollableSlider${i}`]=!1,t[`adaptThumb${i}SizeMode`]=!1,t[`minThumb${i}Size`]=void 0;var m,y,b=Ul(s,"scrollDetectionMode");"string"==typeof b&&(b=Jl[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 Vl(o,m),o.isRexContainerLite&&o.sendChildToBack(o));var S,P,w,x,_,O=Ul(s,a?`mouseWheelScroller${i}`:"mouseWheelScroller",!1);O&&o&&(void 0!==b&&(O.focus=1===b?2:0),S=new Gl(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.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 $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=Hh(i,"child"),r=Hh(s,"gameObject",void 0);if(r){var n=Hh(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=Hh(n,"top",0),h.bottom=Hh(n,"bottom",0),a.left=Hh(n,"left",0),a.right=Hh(n,"right",0);break;case 1:h.top=Hh(n,"left",0),h.bottom=Hh(n,"right",0),a.top=Hh(n,"top",0),a.bottom=Hh(n,"bottom",0);break;default:h.top=Hh(n,"top",0),h.bottom=Hh(n,"bottom",0),h.left=Hh(n,"left",0),h.right=Hh(n,"right",0)}e.add(r,{column:1,row:1,align:Hh(s,"align","center"),padding:a,expand:{width:Hh(s,"expandWidth",!0),height:Hh(s,"expandHeight",!0)}})}t.addChildrenMap("child",r)}(t,a,e),t.scrollMode){case 0:Hl(t,a,"y",e);break;case 1:Hl(t,a,"x",e);break;default:Hl(t,a,"y",e),Hl(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}`]}if(s){var n="Y"===t?this.scaleY:this.scaleX;s.setBounds(e,i*n)}r&&r.setEnable(e!==i)},Ql=function(t){switch(this.scrollMode){case 0:case 1:(e=this.childrenMap.slider)&&this.hideUnscrollableSlider&&this.setChildVisible(e,this.isOverflow);break;default:t=t.toUpperCase();var e=this.childrenMap[`slider${t}`],i=this[`hideUnscrollableSlider${t}`],s=this[`isOverflow${t}`];e&&i&&this.setChildVisible(e,s)}},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&&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(Od.prototype,Pd);const Ed=["top","bottom","centerY","center"],kd=["left","right","centerX","center"];var Td=function(t,e,i){var s,r="Y"===(e=e.toUpperCase()),n=this.childrenMap.child;if(r){if(i)for(var h=0,a=Ed.length;h=0?0:Math.abs(l)<=Math.abs(d)?l:d}}else{if(i)for(h=0,a=kd.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 Md=Phaser.Utils.Objects.GetValue;class Dd extends rd{constructor(t,e){void 0===e&&(e={});var i=Oh(e),s=Md(e,"panel",void 0);void 0===s&&(s={}),s.scrollMode=i,s.clampChildOY=Md(e,"clampChildOY",!1),s.clampChildOX=Md(e,"clampChildOX",!1);var r,n,h=new Od(t,s);switch(t.add.existing(h),i){case 0:r=Md(e,"expand.panel",!0),n=!0;break;case 1:r=!0,n=Md(e,"expand.panel",!0);break;default:r=!0,n=!0}e.type="rexScrollablePanel",e.child={gameObject:h,expandWidth:r,expandHeight:n,align:Md(e,"align.panel","center")};var a=Md(e,"space",void 0);a&&(a.child=Md(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]),Jn(this.childrenMap.child,t),this}}var Rd={scrollToChild:function(t,e){if(!this.hasChild(t))return this;switch(this.scrollMode){case 0:Td.call(this,t,"y",e);break;case 1:Td.call(this,t,"x",e);break;default:Td.call(this,t,"y",e),Td.call(this,t,"x",e)}return this}};return Object.assign(Dd.prototype,Rd),Dd},"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},T={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}},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}},Oe=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,ke=Phaser.Utils.Objects.GetValue;var Te=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},De={getInnerPadding(t){return Te(this.space,t)},setInnerPadding(t,e){return Me(this.space,t,e),this},getOuterPadding(t){return Te(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)),Te(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}},Re=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}},Le=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},Ye=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},Ae=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?gi:vi,this.repeatCounter=0,this}stop(){return this.state=pi,this}update(t,e){this.state!==pi&&this.state!==mi&&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=fi)):(this.nowTime=this.duration,this.state=mi):this.nowTime>=0&&(this.state=gi))}get t(){var t;switch(this.state){case pi:case vi:case fi:t=0;break;case gi:t=this.nowTime/this.duration;break;case mi:t=1}return ci(t,0,1)}set t(t){(t=ci(t,-1,1))<0?(this.state=vi,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===pi}get isDelay(){return this.state===vi}get isCountDown(){return this.state===gi}get isRunning(){return this.state===vi||this.state===gi}get isDone(){return this.state===mi}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}}const pi=0,vi=1,gi=2,fi=3,mi=-1;class yi extends oi{constructor(t,e){super(t,e),this.timer=new ui}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 bi=Phaser.Utils.Objects.GetValue,Ci=Phaser.Utils.Objects.GetAdvancedValue,Si=Phaser.Tweens.Builders.GetEaseFunction;class Pi extends yi{resetFromJSON(t){return this.timer.resetFromJSON(bi(t,"timer")),this.setEnable(bi(t,"enable",!0)),this.setTarget(bi(t,"target",this.parent)),this.setDelay(Ci(t,"delay",0)),this.setDuration(Ci(t,"duration",1e3)),this.setEase(bi(t,"ease","Linear")),this.setRepeat(bi(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,_i=Phaser.Math.Linear;let Oi=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=Ei[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=_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 ki=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 Oi(t,a):r.resetFromJSON(a),r.restart(),r},Ti=function(t,e,i,s,r,n){void 0===s&&(s="Linear"),r instanceof Oi&&(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 Oi(t,h):n.resetFromJSON(h),n.restart(),n},Mi=function(t,e){return new Promise((function(i,s){t.once(e,(function(){i()}))}))},Di=function(t){return Mi(t,"complete")};const Ri=Phaser.Utils.Objects.IsPlainObject;var Li={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(Ri(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),Di(this._scaleBehavior)},isRunningPopUp(){return this._scaleBehavior&&"popup.complete"===this._scaleBehavior.completeEventName},scaleDownDestroy(t,e,i,s){if(Ri(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=Ti(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(Ri(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 Oi(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,Li),Xi.onInitScale=function(){Li.onInitScale.call(this);var t=this;this._scaleBehavior.on("update",(function(){var e=ye.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const Yi=Phaser.Utils.Objects.GetValue,zi=Phaser.Utils.Objects.GetAdvancedValue,Ai=Phaser.Math.Linear;class ji extends Pi{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(Yi(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=Ai(this.alphaStart,this.alphaEnd,i)}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Ii={stop:0,destroy:1,yoyo:2},Wi=Phaser.Utils.Objects.IsPlainObject;var Fi=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 h={mode:0,start:r,end:n,duration:e};return void 0===s?s=new ji(t,h):s.resetFromJSON(h),s.restart(),s},Vi=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 Bi=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(Bi(t)){var i=t;t=i.duration,e=i.alpha}var s=void 0===this._fade;return this._fade=Fi(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(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),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()}},Gi={};Object.assign(Gi,Ni),Gi.onInitFade=function(){Ni.onInitFade.call(this);var t=this;this._fade.on("update",(function(){var e=ye.getParentSizer(t);e&&e.resetChildAlphaState(t)}))};const Ui=Phaser.Utils.Objects.GetValue,Hi=Phaser.Utils.Objects.GetAdvancedValue,$i=Phaser.Math.Linear;class Ji extends Pi{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){if(super.resetFromJSON(t),this.setMode(Ui(t,"mode",0)),t&&(t.hasOwnProperty("x")||t.hasOwnProperty("y"))){var e=Hi(t,"x",void 0),i=Hi(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=Hi(i,"startX",void 0),this.startY=Hi(i,"startY",void 0),this.endX=Hi(i,"endX",void 0),this.endY=Hi(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 qi={stop:0,destroy:1,yoyo:2};var Ki=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 Zi=Phaser.Utils.Objects.IsPlainObject,Qi=Phaser.Math.Distance.Between;var ts={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(Zi(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*Qi(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 Ji&&(h=n,n=void 0),void 0===n&&(n=!1);var a={};return a.mode=n?1:0,void 0!==i&&(a.startX=Ki(i,t.x),a.endX=t.x),void 0!==s&&(a.startY=Ki(s,t.y),a.endY=t.y),a.duration=e,a.ease=void 0===r?"Linear":r,void 0===h?h=new Ji(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(Zi(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*Qi(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 Ji&&(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=Ki(i,t.x)),void 0!==s&&(a.startY=t.y,a.endY=Ki(s,t.y)),a.duration=e,a.ease=void 0===r?"Linear":r,void 0===h?h=new Ji(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}},es={};Object.assign(es,ts),es.onInitEaseMove=function(){ts.onInitEaseMove.call(this);var t=this;this._easeMove.on("update",(function(){var e=ye.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const is=Phaser.Utils.Objects.GetValue;class ss extends ni{constructor(t,e){super(t,e),this.timer=new ui,this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.timer.resetFromJSON(is(t,"timer")),this.setEnable(is(t,"enable",!0)),this.setMode(is(t,"mode",1)),this.isRunning=is(t,"isRunning",!1),this.setMagnitudeMode(is(t,"magnitudeMode",1)),this.setAxisMode(is(t,"axis",0)),this.setDuration(is(t,"duration",500)),this.setMagnitude(is(t,"magnitude",10)),this.ox=is(t,"ox",void 0),this.oy=is(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=rs[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=ns[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=is(i,"magnitude",void 0),t=is(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 rs={effect:0,behavior:1},ns={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},as=Phaser.Utils.Objects.IsPlainObject;var os={shake(t,e,i){if(as(t)){var s=t;t=s.duration,e=s.magnitude,i=s.magnitudeMode}return void 0===this._shake&&(this._shake=new ss(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 ls=Phaser.Utils.Objects.GetValue,ds=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=ls(t,"key","value");var i=e[this.propertyKey];return this.fromValue=ls(t,"from",i),this.toValue=ls(t,"to",i),this.setEase(ls(t,"ease",this.ease)),this.setDuration(ls(t,"duration",this.duration)),this.setRepeat(ls(t,"repeat",0)),this.setDelay(ls(t,"delay",0)),this.setRepeatDelay(ls(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]=ds(this.fromValue,this.toValue,i)}}const us=Phaser.Utils.Objects.IsPlainObject;class ps extends ti{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(us(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(us(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 vs={easeDataTo(t,e,i,s){return this._easeData||(this._easeData=new ps(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,fs={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=Je(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}},Rs={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}},Ls={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}},Ys={};Object.assign(Ys,Ds,Rs,Ls,Xs);const zs=Phaser.Utils.Objects.GetValue;class As extends ti{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 Ms(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(As.prototype,Ys);var js=function(t){if(t.parentContainer)return js(t.parentContainer);var e=function(t){var e=t.displayList;return H(e)?e:null}(t);return e?js(e):t};class Is extends ti{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 Ws=Phaser.GameObjects.Rectangle;class Fs extends Ws{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 Vs=Phaser.Utils.Objects.GetValue;class Bs extends ti{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=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 Gs=Phaser.Utils.Objects.GetValue;class Us extends Fs{constructor(t,e){super(t,Gs(e,"color",0),Gs(e,"alpha",.8)),this.touchEventStop=new Bs(this,{hitAreaMode:1})}}var Hs={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){Ti(t,e,void 0,void 0,!1)},fadeIn(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Fi(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,Fi(t,e,t.alpha)},Js=function(t,e){Vi(t,e,!1)},qs=function(t,e,i,s,r){return!(!t||s&&!s(t,e,i)||!rt(t,!0).contains(e,i)||r&&!r(t,e,i))};const Ks=Phaser.Utils.Objects.GetValue;let Zs=class extends As{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=Qs.popUp),null==e.transitOut&&(e.transitOut=Qs.scaleDown),e.destroy=Ks(e,"destroy",!0),super(t,e);var i=Ks(e,"cover");this.cover=!1!==i?function(t,e){var i=t.scene,s=new Us(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(Ks(i,"transitIn",$s)),this.setCoverTransitOutCallback(Ks(i,"transitOut",Js)));var s=Ks(e,"touchOutsideClose",!1),r=Ks(e,"duration.hold",-1),n=Ks(e,"timeOutClose",r>=0),h=Ks(e,"anyTouchClose",!1);Ks(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),Ks(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=Qs[t]),t){case Qs.popUp:t=Hs.popUp;break;case Qs.fadeIn:t=Hs.fadeIn}return super.setTransitInCallback(t),this}setTransitOutCallback(t){switch("string"==typeof t&&(t=Qs[t]),t){case Qs.scaleDown:t=Hs.scaleDown;break;case Qs.fadeOut:t=Hs.fadeOut}return super.setTransitOutCallback(t),this}setCoverTransitInCallback(t){return this.coverTransitInCallback=t,this}setCoverTransitOutCallback(t){return this.coverTransitOutCallback=t,this}};const Qs={popUp:0,fadeIn:1,scaleDown:0,fadeOut:1};var tr=function(t){return t&&"function"==typeof t},er={modal(t,e){return tr(t)&&(e=t,t=void 0),void 0===this._modalBehavior&&(this.onCreateModalBehavior&&this.onCreateModalBehavior(this,t),this._modalBehavior=function(t,e){var i=new Zs(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}},ir=function(t,e,i,s,r){tr(e)&&(r=s,s=i,i=e,e=this);var n=this.scene.events;return this.bindEvent(e,n,t,i,s,r),this},sr={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 ir.call(this,"preupdate",t,e,i,s),this},bindSceneUpdateEvent(t,e,i,s){return ir.call(this,"update",t,e,i,s),this},bindScenePostupdateEvent(t,e,i,s){return ir.call(this,"postupdate",t,e,i,s),this},bindSceneRenderEvent(t,e,i,s){return ir.call(this,"render",t,e,i,s),this},bindScenePauseEvent(t,e,i,s){return ir.call(this,"pause",t,e,i,s),this},bindSceneResumeEvent(t,e,i,s){return ir.call(this,"resume",t,e,i,s),this},bindSceneSleepEvent(t,e,i,s){return ir.call(this,"sleep",t,e,i,s),this},bindSceneWakeEvent(t,e,i,s){return ir.call(this,"wake",t,e,i,s),this},bindSceneShutdownEvent(t,e,i,s){return ir.call(this,"shutdown",t,e,i,s),this}},rr=function(t,e,i){var s=t.camera;return s?(void 0===i?i={}:!0===i&&(i=nr),s===e?(i.x=t.worldX,i.y=t.worldY):s.getWorldPoint(t.x,t.y,i),i):null},nr={},hr=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=rr(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 mr={press:0,pointerdown:0,release:1,pointerup:1};var yr={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 fr(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}},br=function(t,e,i,s,r){if(e)return!(i&&!i(t,e)||!Cr(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 wr extends ti{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?br: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 _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 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 Or extends Ts{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 kr extends ti{constructor(t,e){super(t,e),this._enable=void 0,this.cooldown=new Or,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 Tr={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}},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=Hr,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=Hr,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=Jr,this}isPointerInGameObject(t,e,i){var s=this.lastPointer;return!!s&&hr(t,s,e,i)}}const Hr=0,$r=1,Jr="IDLE",qr=Phaser.Utils.Objects.GetValue,Kr=Phaser.Math.Distance.Between;class Zr extends Ur{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=Qr},eventEmitter:!1};this.setRecongizedStateObject(new Ts(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 Qr:this.state=tn;break;case tn:var t=this.lastPointer;Kr(t.upX,t.upY,t.x,t.y)>this.tapOffset&&(this.state=en,this.state=tn);break;case en:this.state=tn}}onDragEnd(){this.state===tn&&(this.tapsCount++,this.emit("tapping",this,this.gameObject,this.lastPointer),void 0!==this.maxTaps&&this.tapsCount===this.maxTaps&&(this.state=en))}onDrag(){this.state!==Qr&&this.pointer.getDistance()>this.dragThreshold&&(this.state=Qr)}preUpdate(t,e){if(this.isRunning&&this.enable&&this.state===tn){var i=this.lastPointer;i.isDown?t-i.downTime>this.holdTime&&(this.state=Qr):t-i.upTime>this.tapInterval&&(void 0===this.minTaps||this.tapsCount>=this.minTaps?this.state=en:this.state=Qr)}}postUpdate(t,e){this.isRunning&&this.enable&&this.state===en&&(this.state=Qr)}get isTapped(){return this.state===en}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 Qr="IDLE",tn="BEGIN",en="RECOGNIZED",sn=Phaser.Utils.Objects.GetValue;class rn extends Ur{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=nn},eventEmitter:!1};this.setRecongizedStateObject(new Ts(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(sn(t,"threshold",9)),this.setHoldTime(sn(t,"time",251)),this}onDragStart(){this.state=hn,0===this.holdTime&&(this.state=an)}onDragEnd(){this.state=nn}onDrag(){this.state!==nn&&this.pointer.getDistance()>this.dragThreshold&&(this.state=nn)}preUpdate(t,e){this.isRunning&&this.enable&&this.state===hn&&t-this.pointer.downTime>=this.holdTime&&(this.state=an)}get isPressed(){return this.state===an}setHoldTime(t){return this.holdTime=t,this}setDragThreshold(t){return this.dragThreshold=t,this}}const nn="IDLE",hn="BEGIN",an="RECOGNIZED";Phaser.Utils.Objects.GetValue;var on=function(t){return Ze(t).loop.delta};const ln=Phaser.Math.Distance.Between,dn=Phaser.Math.Angle.Between;var cn={getDt:function(){return on(this.scene)},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,gn=Phaser.Math.RadToDeg;class fn extends Ur{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 Ts(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}}(gn(this.getVelocityAngle()),this.dirMode,this),this}clearDirectionStates(){return this.left=!1,this.right=!1,this.up=!1,this.down=!1,this}}Object.assign(fn.prototype,cn);const mn="IDLE",yn="BEGIN",bn="RECOGNIZED",Cn=Phaser.Utils.Objects.GetValue,Sn=Phaser.Utils.Array.SpliceOne,Pn=Phaser.Math.Distance.Between,wn=Phaser.Math.Angle.Between;class xn{constructor(t,e){var i=Je(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,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 On:this.tracerState=En,this.onDrag1Start();break;case En: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 En:this.tracerState=On,this.onDrag1End();break;case kn: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 kn:this.onDrag2()}}}dragCancel(){return this.tracerState===kn&&this.onDrag2End(),this.pointers.length=0,ft(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!==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 wn(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!==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=Tn,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(xn.prototype,Ue);var _n={};const On=0,En=1,kn=2,Tn="IDLE";Phaser.Utils.Objects.GetValue;const Mn=Phaser.Math.RotateAround;var Dn=function(t,e,i,s){return Mn(t,e,i,s),t.rotation+=s,t},Rn={};const Ln=Phaser.Utils.Objects.GetValue,Xn=Phaser.Math.Angle.WrapDegrees,Yn=Phaser.Math.Angle.ShortestBetween,zn=Phaser.Math.RadToDeg,An=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=Rn),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=Yn(this.prevAngle,t),this.prevAngle=t,this.state=Fn}break;case Fn:t=Xn(zn(this.angleBetween)),this.angle=Yn(this.prevAngle,t),this.prevAngle=t,this.emit("rotate",this)}}get isRotated(){return this.state===Fn}get rotation(){return An(this.angle)}setDragThreshold(t){return this.dragThreshold=t,this}}.prototype,jn);const In="IDLE",Wn="BEGIN",Fn="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 Zr(this,e),this._tap.on("tap",(function(t,e,s){Rr(i.eventEmitter,`${i.eventNamePrefix}${t.tapsCount}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Nn=Phaser.Utils.Objects.GetValue;var Gn=function(t){var e=Nn(t,"press",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._press=new rn(this,e),this._press.on("pressstart",(function(t,e,s){Rr(i.eventEmitter,`${i.eventNamePrefix}pressstart`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this).on("pressend",(function(t,e,s){Rr(i.eventEmitter,`${i.eventNamePrefix}pressend`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),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 fn(this,e),this._swipe.on("swipe",(function(t,e,s){var r=t.left?"left":t.right?"right":t.up?"up":"down";Rr(i.eventEmitter,`${i.eventNamePrefix}swipe${r}`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const $n=Phaser.Utils.Objects.GetValue;var Jn=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.")},Xr.call(t,e),Ar.call(t,e),Wr.call(t,e),Nr.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),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",de),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)}}for(var d,c,u=this.getAllShownChildren([this]),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 nh=Phaser.Utils.Objects.IsPlainObject,hh=Phaser.Utils.Objects.GetValue,ah=Phaser.Display.Align.CENTER,oh={min:0,full:-1};var lh=function(t,e,i,s,r,n,h,a,o,l){ge.call(this,t);var d=t.isRexSpace,c=typeof e;if(null===e)return this;if("number"===c);else if("string"===c)e=oh[e];else if(nh(e)){var u;e=hh(u=e,"proportion",void 0),i=hh(u,"align",ah),s=hh(u,"padding",0),r=hh(u,"expand",!1),n=hh(u,"key",void 0),h=hh(u,"index",void 0),t.isRexSizer||(a=hh(u,"minWidth",void 0),o=hh(u,"minHeight",void 0)),l=hh(u,"fitRatio",0)}return"string"==typeof i&&(i=zt[i]),void 0===e&&(e=d?1:0),void 0===i&&(i=ah),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===a&&(d?a=0:t.isRexSizer||(a=t._minWidth)),void 0===o&&(d?o=0:t.isRexSizer||(o=t._minHeight)),void 0===l||!1===l?l=0:!0===l&&(l=Q(t)/tt(t)),(u=this.getSizerConfig(t)).proportion=e,u.align=i,u.padding=pe(s),u.expand=r,u.fitRatio=0===e?l:0,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},dh={add:lh,addSpace(t){return this.insertSpace(void 0,t),this},insertSpace(t,e){return void 0===e&&(e=1),lh.call(this,new sh(this.scene),{proportion:e,minWidth:0,minHeight:0,index:t}),this},insert(t,e,i,s,r,n,h,a){return nh(i)&&(i.index=t),lh.call(this,e,i,s,r,n,h,t,a),this},insertAtPosition(t,e,i,s,r,n,h,a,o){var l=rh.call(this,t,e);return-1===l&&(l=void 0),this.insert(l,i,s,r,n,h,a,o),this}};const ch=Tt.prototype.clear;var uh=function(t){this.backgroundChildren&&(this.backgroundChildren.length=0);var e,i=!t&&this.sizerEventsEnable;if(i&&(e=this.getChildren([])),ch.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,uh.call(this,t),this}},gh={getChildAlign(t){return this.getSizerConfig(t).align},setChildAlign(t,e){return"string"==typeof e&&(e=zt[e]),this.getSizerConfig(t).align=e,this}},fh={getChildProportion(t){return this.getSizerConfig(t).proportion},setChildProportion(t,e){return this.getSizerConfig(t).proportion=e,this}},mh={getChildExpand(t){return this.getSizerConfig(t).expand},setChildExpand(t,e){return this.getSizerConfig(t).expand=e,this}},yh={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}},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;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,Ie.call(this),this},layoutChildren:function(){for(var t,e,i,s,r,n,h,a,o,l,d=this.sizerChildren,c=this.innerLeft,u=this.innerTop,p=this.innerWidth,v=this.innerHeight,g=c,f=u,m=this.startChildIndex,y=0,b=d.length;y0?(e=t-this.getChildrenWidth(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},resolveHeight:function(t){if(void 0!==(t=Ye.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)||Le.call(this)},runWidthWrap:function(t){this.wrapResult||(1===this.orientation&&eh.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&&eh.call(this,void 0,t),Ae.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(bh,dh,vh,gh,fh,mh,yh);var Ch=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,wh=Phaser.Utils.Objects.GetValue;class xh extends Zn{constructor(t,e,i,s,r,n,h){Ph(e)?(e=wh(h=e,"x",0),i=wh(h,"y",0),s=wh(h,"width",void 0),r=wh(h,"height",void 0),n=wh(h,"orientation",0)):Ph(s)?(s=wh(h=s,"width",void 0),r=wh(h,"height",void 0),n=wh(h,"orientation",0)):Ph(n)&&(n=wh(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(wh(h,"space.item",0)),this.setStartChildIndex(wh(h,"startChildIndex",0)),this.setRTL(wh(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=Ch.call(this)),this._childrenProportion}}Object.assign(xh.prototype,bh);var _h={v:0,vertical:0,y:0,h:1,horizontal:1,x:1,xy:2,vh:2},Oh=function(t,e){void 0===e&&(e="scrollMode"),t.hasOwnProperty(e)||(t[e]=Eh(t));var i=t[e];return"string"==typeof i&&(i=_h[i]),i},Eh=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,Th,0)},Th=function(t,e){return t+e};const Mh=Phaser.Utils.Objects.IsPlainObject,Dh=Phaser.Utils.Objects.GetValue,Rh=Phaser.Display.Align.CENTER;var Lh=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 Yh(this.sizerChildren,null),uh.call(this,t),this}},Ah={setColumnSpace(t){if(this.space.column||(this.space.column=[]),this.space.column.length=this.columnCount-1,"number"==typeof t)Yh(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},Fh={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=Ye.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===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,Yh(this.sizerChildren,null),this.columnProportions=[],this.columnProportions.length=t,"number"==typeof i)Yh(this.columnProportions,i);else for(var n=0;n0?e+=t:0===t&&(this.hasColumnProportion0Child=!0);return e},Bh=function(){for(var t,e=0,i=0;i0?e+=t:0===t&&(this.hasRowProportion0Child=!0);return e};const Nh=Phaser.Utils.Objects.IsPlainObject,Gh=Phaser.Utils.Objects.GetValue;class Uh extends Zn{constructor(t,e,i,s,r,n,h,a,o,l){Nh(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)):Nh(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)):Nh(n)?(n=Gh(l=n,"column",l.col||0),h=Gh(l,"row",0),a=Gh(l,"columnProportions",0),o=Gh(l,"rowProportions",0)):Nh(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=Vh.call(this)),this._totalColumnProportions}get totalRowProportions(){return void 0===this._totalRowProportions&&(this._totalRowProportions=Bh.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,Fh);const Hh=Phaser.Utils.Objects.GetValue;var $h=Phaser.Renderer.WebGL.Utils,Jh=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+")"},ta=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 ea=Phaser.Renderer.Canvas.SetTransform;var ia={renderWebGL:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.pipelines.set(e.pipeline),n=Zh(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&&Jh(r,h,e,l,a,o),e.isStroked&&Kh(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(ea(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(ra.prototype,ia);const na=Phaser.Utils.Objects.GetValue;let ha=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=na(t,"x",0),i=na(t,"y",0));var s=this.cornerRadius;s.tl=aa(na(t,"tl",void 0),e,i),s.tr=aa(na(t,"tr",void 0),e,i),s.bl=aa(na(t,"bl",void 0),e,i),s.br=aa(na(t,"br",void 0),e,i)}get radiusTL(){var t=this.cornerRadius.tl;return Math.max(t.x,t.y)}set radiusTL(t){oa(this.cornerRadius.tl,t)}get radiusTR(){var t=this.cornerRadius.tr;return Math.max(t.x,t.y)}set radiusTR(t){oa(this.cornerRadius.tr,t)}get radiusBL(){var t=this.cornerRadius.bl;return Math.max(t.x,t.y)}set radiusBL(t){oa(this.cornerRadius.bl,t)}get radiusBR(){var t=this.cornerRadius.br;return Math.max(t.x,t.y)}set radiusBR(t){oa(this.cornerRadius.br,t)}};var aa=function(t,e,i){return void 0===t?t={x:e,y:i}:"number"==typeof t&&(t={x:t,y:t}),la(t),t},oa=function(t,e){"number"==typeof e?(t.x=e,t.y=e):(t.x=na(e,"x",0),t.y=na(e,"y",0)),la(t)},la=function(t){t.convex=t.x>=0||t.y>=0,t.x=Math.abs(t.x),t.y=Math.abs(t.y)},da=function(t){return t.x>0&&t.y>0},ca=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 ua=Phaser.Math.DegToRad;var pa=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(Wa(Ra)){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;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 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:At,_drawImage:At,_drawTileSprite:At,_endDraw:At,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=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,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 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 Go=Phaser.Utils.Objects.IsPlainObject,Uo=Phaser.Utils.Objects.GetValue,Ho=Phaser.GameObjects;var $o=void 0,Jo=function(t,e){if($o||($o={},Ze(t).events.once("destroy",(function(){for(var t in $o)$o[t].destroy();$o=void 0}))),!$o.hasOwnProperty(e)){var i=Ze(t).scene.systemScene;(t=new Ho[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(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}(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 ti{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&&ko(this,i),this.style=new Qo(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign(el.prototype,xa);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 So(t,e);break;case"image":s=new zo(t,e);break;case"nineSlice":s=e.hasOwnProperty("stretchMode")?new el(t,e):new Ro(t,e);break;default:s=new _a(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 Xl=Phaser.Utils.Objects.GetValue,Yl=Phaser.Math.Distance.Between;class zl extends ti{constructor(t,e){super(t,e),this._enable=void 0,this.rectBoundsInteractive=Xl(e,"rectBoundsInteractive",!1),this.rectBoundsInteractive||t.setInteractive(Xl(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(Xl(t,"enable",!0)),this.holdThreshold=Xl(t,"holdThreshold",50),this.pointerOutReleaseEnable=Xl(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 on(this.scene)}get speed(){return this.x===this.preX&&this.y===this.preY?0:Yl(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&&!hr(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&&!hr(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 jl{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 Il{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 ti{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||hr(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 Hl=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 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);var p=Ul(r,"position",0);"string"==typeof p&&(p=$l[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[`adaptThumb${i}SizeMode`]=Ul(r,"adaptThumbSize",!1),t[`minThumb${i}Size`]=Ul(r,"minThumbSize",void 0)}else t[`hideUnscrollableSlider${i}`]=!1,t[`adaptThumb${i}SizeMode`]=!1,t[`minThumb${i}Size`]=void 0;var m,y,b=Ul(s,"scrollDetectionMode");"string"==typeof b&&(b=Jl[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 Vl(o,m),o.isRexContainerLite&&o.sendChildToBack(o));var S,P,w,x,_,O=Ul(s,a?`mouseWheelScroller${i}`:"mouseWheelScroller",!1);O&&o&&(void 0!==b&&(O.focus=1===b?2:0),S=new Gl(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.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 $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=Hh(i,"child"),r=Hh(s,"gameObject",void 0);if(r){var n=Hh(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=Hh(n,"top",0),h.bottom=Hh(n,"bottom",0),a.left=Hh(n,"left",0),a.right=Hh(n,"right",0);break;case 1:h.top=Hh(n,"left",0),h.bottom=Hh(n,"right",0),a.top=Hh(n,"top",0),a.bottom=Hh(n,"bottom",0);break;default:h.top=Hh(n,"top",0),h.bottom=Hh(n,"bottom",0),h.left=Hh(n,"left",0),h.right=Hh(n,"right",0)}e.add(r,{column:1,row:1,align:Hh(s,"align","center"),padding:a,expand:{width:Hh(s,"expandWidth",!0),height:Hh(s,"expandHeight",!0)}})}t.addChildrenMap("child",r)}(t,a,e),t.scrollMode){case 0:Hl(t,a,"y",e);break;case 1:Hl(t,a,"x",e);break;default:Hl(t,a,"y",e),Hl(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}`]}if(s){var n="Y"===t?this.scaleY:this.scaleX;s.setBounds(e,i*n)}r&&r.setEnable(e!==i)},Ql=function(t){switch(this.scrollMode){case 0:case 1:(e=this.childrenMap.slider)&&this.hideUnscrollableSlider&&this.setChildVisible(e,this.isOverflow);break;default:t=t.toUpperCase();var e=this.childrenMap[`slider${t}`],i=this[`hideUnscrollableSlider${t}`],s=this[`isOverflow${t}`];e&&i&&this.setChildVisible(e,s)}},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&&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(Od.prototype,Pd);const Ed=["top","bottom","centerY","center"],kd=["left","right","centerX","center"];var Td=function(t,e,i){var s,r="Y"===(e=e.toUpperCase()),n=this.childrenMap.child;if(r){if(i)for(var h=0,a=Ed.length;h=0?0:Math.abs(l)<=Math.abs(d)?l:d}}else{if(i)for(h=0,a=kd.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 Md=Phaser.Utils.Objects.GetValue;class Dd extends rd{constructor(t,e){void 0===e&&(e={});var i=Oh(e),s=Md(e,"panel",void 0);void 0===s&&(s={}),s.scrollMode=i,s.clampChildOY=Md(e,"clampChildOY",!1),s.clampChildOX=Md(e,"clampChildOX",!1);var r,n,h=new Od(t,s);switch(t.add.existing(h),i){case 0:r=Md(e,"expand.panel",!0),n=!0;break;case 1:r=!0,n=Md(e,"expand.panel",!0);break;default:r=!0,n=!0}e.type="rexScrollablePanel",e.child={gameObject:h,expandWidth:r,expandHeight:n,align:Md(e,"align.panel","center")};var a=Md(e,"space",void 0);a&&(a.child=Md(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]),Jn(this.childrenMap.child,t),this}}var Rd={scrollToChild:function(t,e){if(!this.hasChild(t))return this;switch(this.scrollMode){case 0:Td.call(this,t,"y",e);break;case 1:Td.call(this,t,"x",e);break;default:Td.call(this,t,"y",e),Td.call(this,t,"x",e)}return this}};return Object.assign(Dd.prototype,Rd),Dd},"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 bbe1c956ef..b194b33250 100644 --- a/dist/rexscrollbar.js +++ b/dist/rexscrollbar.js @@ -13430,6 +13430,10 @@ radius.y = Math.abs(radius.y); }; + var IsArcCorner = function (radius) { + return ((radius.x > 0) && (radius.y > 0)); + }; + var LineTo = function (x, y, pathData) { var cnt = pathData.length; if (cnt >= 2) { @@ -13511,8 +13515,7 @@ geom.setTo(0, 0, width, height, radius); } - var iteration = GetValue$a(radiusConfig, 'iteration', undefined); - this.setIteration(iteration); + this.setIteration(GetValue$a(radiusConfig, 'iteration', undefined)); this.setPosition(x, y); this.setFillStyle(fillColor, fillAlpha); @@ -13765,10 +13768,6 @@ } - var IsArcCorner = function (radius) { - return ((radius.x > 0) && (radius.y > 0)); - }; - const ShapeTypeMap = { rectangle: 0, circle: 1 @@ -15354,6 +15353,7 @@ var skewX = this.skewX; var width = this.width - Math.abs(skewX); var height = this.height; + var trackFill = this.getShape('trackFill'); trackFill.fillStyle(this.trackColor); if (trackFill.isFilled) { @@ -15362,8 +15362,7 @@ 0, 0, // x0, y0 width, height, // x1, y1 skewX // skewX - ) - .close(); + ); } var bar = this.getShape('bar'); @@ -15383,8 +15382,7 @@ barX0, 0, // x0, y0 barX1, height, // x1, y1 skewX // skew - ) - .close(); + ); } var trackStroke = this.getShape('trackStroke'); @@ -15395,8 +15393,7 @@ 0, 0, // x0, y0 width, height, // x1, y1 skewX // skewX - ) - .end(); + ); } }; @@ -15416,6 +15413,8 @@ .lineTo(x0, y0).lineTo(startX, y0); } + lines.close(); + return lines; }; @@ -15426,24 +15425,33 @@ constructor(scene, x, y, width, height, barColor, value, config) { if (IsPlainObject$3(x)) { config = x; - x = GetValue$7(config, 'x', 0); - y = GetValue$7(config, 'y', 0); - width = GetValue$7(config, 'width', 2); - height = GetValue$7(config, 'height', 2); - barColor = GetValue$7(config, 'barColor', undefined); - value = GetValue$7(config, 'value', 0); + + x = config.x; + y = config.y; + width = config.width; + height = config.height; + barColor = config.barColor; + value = config.value; } else if (IsPlainObject$3(width)) { config = width; - width = GetValue$7(config, 'width', 2); - height = GetValue$7(config, 'height', 2); - barColor = GetValue$7(config, 'barColor', undefined); - value = GetValue$7(config, 'value', 0); + + width = config.width; + height = config.height; + barColor = config.barColor; + value = config.value; } else if (IsPlainObject$3(barColor)) { config = barColor; - barColor = GetValue$7(config, 'barColor', undefined); - value = GetValue$7(config, 'value', 0); + + barColor = config.barColor; + value = config.value; } + if (x === undefined) { x = 0; } + if (y === undefined) { y = 0; } + if (width === undefined) { width = 2; } + if (height === undefined) { height = width; } + if (value === undefined) { value = 0; } + super(scene, x, y, width, height, config); this.type = 'rexLineProgress'; diff --git a/dist/rexscrollbar.min.js b/dist/rexscrollbar.min.js index c8e33ed34b..235494fa58 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},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}},we=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 xe=/(\S+)\[(\d+)\]/i,Oe=Phaser.Utils.Objects.GetValue;var Ee=function(t,e){return void 0===e?t:t[e]},Te=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=Oe(e,"left",0),t.right=Oe(e,"right",0),t.top=Oe(e,"top",0),t.bottom=Oe(e,"bottom",0)),t},ke={getInnerPadding(t){return Ee(this.space,t)},setInnerPadding(t,e){return Te(this.space,t,e),this},getOuterPadding(t){return Ee(this.getSizerConfig(this).padding,t)},setOuterPadding(t,e){return Te(this.getSizerConfig(this).padding,t,e),this},getChildOuterPadding(t,e){return"string"==typeof t&&(t=this.getElement(t)),Ee(this.getSizerConfig(t).padding,e)},setChildOuterPadding(t,e,i){return"string"==typeof t&&(t=this.getElement(t)),Te(this.getSizerConfig(t).padding,e,i),this}},De=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}},Re=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},Me=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},Le=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},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},ze={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}},Xe=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?pi:ci,this.repeatCounter=0,this}stop(){return this.state=ui,this}update(t,e){this.state!==ui&&this.state!==fi&&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=vi)):(this.nowTime=this.duration,this.state=fi):this.nowTime>=0&&(this.state=pi))}get t(){var t;switch(this.state){case ui:case ci:case vi:t=0;break;case pi:t=this.nowTime/this.duration;break;case fi:t=1}return li(t,0,1)}set t(t){(t=li(t,-1,1))<0?(this.state=ci,this.nowTime=-this.delay*t):(this.state=pi,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===ui}get isDelay(){return this.state===ci}get isCountDown(){return this.state===pi}get isRunning(){return this.state===ci||this.state===pi}get isDone(){return this.state===fi}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}}const ui=0,ci=1,pi=2,vi=3,fi=-1;class gi extends ai{constructor(t,e){super(t,e),this.timer=new di}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 mi=Phaser.Utils.Objects.GetValue,yi=Phaser.Utils.Objects.GetAdvancedValue,bi=Phaser.Tweens.Builders.GetEaseFunction;class Ci extends gi{resetFromJSON(t){return this.timer.resetFromJSON(mi(t,"timer")),this.setEnable(mi(t,"enable",!0)),this.setTarget(mi(t,"target",this.parent)),this.setDelay(yi(t,"delay",0)),this.setDuration(yi(t,"duration",1e3)),this.setEase(mi(t,"ease","Linear")),this.setRepeat(mi(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=bi(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 _i=Phaser.Utils.Objects.GetValue,Si=Phaser.Utils.Objects.GetAdvancedValue,Pi=Phaser.Math.Linear;let wi=class extends Ci{constructor(t,e){super(t,e),this.scaleStart={},this.scaleEnd={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(_i(t,"mode",0)),this.setScaleRange(Si(t,"start",void 0),Si(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=xi[t]),this.mode=t,this}setScaleRange(t,e){return"number"==typeof t?(this.startX=t,this.startY=t):(this.startX=Si(t,"x",this.parent.scaleX),this.startY=Si(t,"y",this.parent.scaleY)),"number"==typeof e?(this.endX=e,this.endY=e):(this.endX=Si(e,"x",void 0),this.endY=Si(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=Pi(this.startX,this.endX,i)),this.hasScaleY&&(t.scaleY=Pi(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}};const xi={stop:0,destroy:1,yoyo:2};var Oi=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 wi(t,h):r.resetFromJSON(h),r.restart(),r},Ei=function(t,e,i,s,r,n){void 0===s&&(s="Linear"),r instanceof wi&&(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 wi(t,a):n.resetFromJSON(a),n.restart(),n},Ti=function(t,e){return new Promise((function(i,s){t.once(e,(function(){i()}))}))},ki=function(t){return Ti(t,"complete")};const Di=Phaser.Utils.Objects.IsPlainObject;var Ri={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(Di(t)){var s=t;t=s.duration,e=s.orientation,i=s.ease}var r=void 0===this._scaleBehavior;return this._scaleBehavior=Oi(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),ki(this._scaleBehavior)},isRunningPopUp(){return this._scaleBehavior&&"popup.complete"===this._scaleBehavior.completeEventName},scaleDownDestroy(t,e,i,s){if(Di(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=Ei(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),ki(this._scaleBehavior)},scaleDown(t,e,i){return this.scaleDownDestroy(t,e,i,!1),this},scaleDownPromise(t,e,i){return this.scaleDown(t,e,i),ki(this._scaleBehavior)},isRunningScaleDown(){return this._scaleBehavior&&"scaledown.complete"===this._scaleBehavior.completeEventName},scaleYoyo(t,e,i,s,r){if(Di(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 wi(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),ki(this._scaleBehavior)},isRunningScaleYoyo(){return this._scaleBehavior&&(this._scaleBehavior.completeEventName="scaleyoyo.complete")},isRunningEaseScale(){return this.isRunningPopUp()||this.isRunningScaleDown()||this.isRunningScaleYoyo()}},Mi={};Object.assign(Mi,Ri),Mi.onInitScale=function(){Ri.onInitScale.call(this);var t=this;this._scaleBehavior.on("update",(function(){var e=ge.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const Li=Phaser.Utils.Objects.GetValue,Ai=Phaser.Utils.Objects.GetAdvancedValue,ji=Phaser.Math.Linear;class zi extends Ci{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(Li(t,"mode",0)),this.setAlphaRange(Ai(t,"start",this.parent.alpha),Ai(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=Xi[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 Xi={stop:0,destroy:1,yoyo:2},Fi=Phaser.Utils.Objects.IsPlainObject;var Yi=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 a={mode:0,start:r,end:n,duration:e};return void 0===s?s=new zi(t,a):s.resetFromJSON(a),s.restart(),s},Ii=function(t,e,i,s){i instanceof zi&&(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 zi(t,r):s.resetFromJSON(r),s.restart(),s};const Ni=Phaser.Utils.Objects.IsPlainObject;var Wi={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=Yi(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadein.complete",this},fadeInPromise(t,e){return this.fadeIn(t,e),ki(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=Ii(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadeout.complete",this},fadeOutDestroyPromise(t,e){return this.fadeOutDestroy(t,e),ki(this._fade)},fadeOut(t){return this.fadeOutDestroy(t,!1),this},fadeOutPromise(t){return this.fadeOut(t),ki(this._fade)},isRunningFadeOut(){return this._fade&&"fadeout.complete"===this._fade.completeEventName},isRunningEaseFade(){return this.isRunningFadeIn()||this.isRunningFadeOut()}},Vi={};Object.assign(Vi,Wi),Vi.onInitFade=function(){Wi.onInitFade.call(this);var t=this;this._fade.on("update",(function(){var e=ge.getParentSizer(t);e&&e.resetChildAlphaState(t)}))};const Bi=Phaser.Utils.Objects.GetValue,Gi=Phaser.Utils.Objects.GetAdvancedValue,Ui=Phaser.Math.Linear;class Hi extends Ci{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){if(super.resetFromJSON(t),this.setMode(Bi(t,"mode",0)),t&&(t.hasOwnProperty("x")||t.hasOwnProperty("y"))){var e=Gi(t,"x",void 0),i=Gi(t,"y",void 0);this.setTargetPosition(e,i)}else this.setTargetPosition(t);return this}setMode(t){return"string"==typeof t&&(t=Ji[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=Gi(i,"startX",void 0),this.startY=Gi(i,"startY",void 0),this.endX=Gi(i,"endX",void 0),this.endY=Gi(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=Ui(this.startX,this.endX,i)),this.hasMoveY&&(t.y=Ui(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Ji={stop:0,destroy:1,yoyo:2};var $i=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,Ki=Phaser.Math.Distance.Between;var Zi={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*Ki(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 Hi&&(a=n,n=void 0),void 0===n&&(n=!1);var h={};return h.mode=n?1:0,void 0!==i&&(h.startX=$i(i,t.x),h.endX=t.x),void 0!==s&&(h.startY=$i(s,t.y),h.endY=t.y),h.duration=e,h.ease=void 0===r?"Linear":r,void 0===a?a=new Hi(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),ki(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),ki(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*Ki(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 Hi&&(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=$i(i,t.x)),void 0!==s&&(h.startY=t.y,h.endY=$i(s,t.y)),h.duration=e,h.ease=void 0===r?"Linear":r,void 0===a?a=new Hi(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),ki(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),ki(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}},Qi={};Object.assign(Qi,Zi),Qi.onInitEaseMove=function(){Zi.onInitEaseMove.call(this);var t=this;this._easeMove.on("update",(function(){var e=ge.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const ts=Phaser.Utils.Objects.GetValue;class es extends si{constructor(t,e){super(t,e),this.timer=new di,this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.timer.resetFromJSON(ts(t,"timer")),this.setEnable(ts(t,"enable",!0)),this.setMode(ts(t,"mode",1)),this.isRunning=ts(t,"isRunning",!1),this.setMagnitudeMode(ts(t,"magnitudeMode",1)),this.setAxisMode(ts(t,"axis",0)),this.setDuration(ts(t,"duration",500)),this.setMagnitude(ts(t,"magnitude",10)),this.ox=ts(t,"ox",void 0),this.oy=ts(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=is[t]),this.mode=t,this}setMagnitudeMode(t){return"string"==typeof t&&(t=rs[t]),this.magnitudeMode=t,this}setAxisMode(t){return"string"==typeof t&&(t=ss[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=ts(i,"magnitude",void 0),t=ts(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 is={effect:0,behavior:1},ss={both:0,"h&v":0,"x&y":0,horizontal:1,h:1,x:1,vertical:2,v:2,y:2},rs={constant:0,decay:1},ns=Phaser.Utils.Objects.IsPlainObject;var as={shake(t,e,i){if(ns(t)){var s=t;t=s.duration,e=s.magnitude,i=s.magnitudeMode}return void 0===this._shake&&(this._shake=new es(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),ki(this._shake)}};const hs=Phaser.Utils.Objects.GetValue,os=Phaser.Math.Linear;class ls extends Ci{constructor(t,e){super(t,e),this.resetFromJSON(),this.boot()}start(t){if(this.timer.isRunning)return this;var e=this.target;this.propertyKey=hs(t,"key","value");var i=e[this.propertyKey];return this.fromValue=hs(t,"from",i),this.toValue=hs(t,"to",i),this.setEase(hs(t,"ease",this.ease)),this.setDuration(hs(t,"duration",this.duration)),this.setRepeat(hs(t,"repeat",0)),this.setDelay(hs(t,"delay",0)),this.setRepeatDelay(hs(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]=os(this.fromValue,this.toValue,i)}}const ds=Phaser.Utils.Objects.IsPlainObject;class us extends Ze{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 ls(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(ds(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(ds(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 cs={easeDataTo(t,e,i,s){return this._easeData||(this._easeData=new us(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),Ti(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}},ps=Phaser.Utils.Array.Remove,vs={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 ks={delayCall(t,e,i){return this.delayCallTimer=function(t,e,i,s,r){var n=He(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}},Ds={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}},Rs={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}},Ms={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}},Ls={};Object.assign(Ls,ks,Ds,Rs,Ms);const As=Phaser.Utils.Objects.GetValue;class js extends Ze{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 Ts(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(js.prototype,Ls);var zs=function(t){if(t.parentContainer)return zs(t.parentContainer);var e=function(t){var e=t.displayList;return H(e)?e:null}(t);return e?zs(e):t};class Xs extends Ze{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=zs(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 Fs=Phaser.GameObjects.Rectangle;class Ys extends Fs{constructor(t,e,i){super(t,0,0,2,2,e,1),this.fullWindow=new Xs(this),this.setAlpha(i)}get tint(){return this.fillColor}set tint(t){this.setFillStyle(t,this.fillAlpha)}}const Is=Phaser.Utils.Objects.GetValue;class Ns extends Ze{constructor(t,e){super(t,{eventEmitter:!1}),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setHitAreaMode(Is(t,"hitAreaMode",0)),this.setEnable(Is(t,"enable",!0)),this.setStopMode(Is(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=Ws[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 Ws={default:0,fullWindow:1};const Vs=Phaser.Utils.Objects.GetValue;class Bs extends Ys{constructor(t,e){super(t,Vs(e,"color",0),Vs(e,"alpha",.8)),this.touchEventStop=new Ns(this,{hitAreaMode:1})}}var Gs={popUp(t,e){void 0!==t._modalScaleSave?(t.scaleX=t._modalScaleSave,t.scaleY=t._modalScaleSave):t._modalScaleSave=t.scaleX,Oi(t,e)},scaleDown(t,e){Ei(t,e,void 0,void 0,!1)},fadeIn(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Yi(t,e)},fadeOut(t,e){Ii(t,e,!1)}},Us=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Yi(t,e,t.alpha)},Hs=function(t,e){Ii(t,e,!1)},Js=function(t,e,i,s,r){return!(!t||s&&!s(t,e,i)||!rt(t,!0).contains(e,i)||r&&!r(t,e,i))};const $s=Phaser.Utils.Objects.GetValue;let qs=class extends js{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=Ks.popUp),null==e.transitOut&&(e.transitOut=Ks.scaleDown),e.destroy=$s(e,"destroy",!0),super(t,e);var i=$s(e,"cover");this.cover=!1!==i?function(t,e){var i=t.scene,s=new Bs(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($s(i,"transitIn",Us)),this.setCoverTransitOutCallback($s(i,"transitOut",Hs)));var s=$s(e,"touchOutsideClose",!1),r=$s(e,"duration.hold",-1),n=$s(e,"timeOutClose",r>=0),a=$s(e,"anyTouchClose",!1);$s(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),$s(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&&Js(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=Ks[t]),t){case Ks.popUp:t=Gs.popUp;break;case Ks.fadeIn:t=Gs.fadeIn}return super.setTransitInCallback(t),this}setTransitOutCallback(t){switch("string"==typeof t&&(t=Ks[t]),t){case Ks.scaleDown:t=Gs.scaleDown;break;case Ks.fadeOut:t=Gs.fadeOut}return super.setTransitOutCallback(t),this}setCoverTransitInCallback(t){return this.coverTransitInCallback=t,this}setCoverTransitOutCallback(t){return this.coverTransitOutCallback=t,this}};const Ks={popUp:0,fadeIn:1,scaleDown:0,fadeOut:1};var Zs=function(t){return t&&"function"==typeof t},Qs={modal(t,e){return Zs(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}},tr=function(t,e,i,s,r){Zs(e)&&(r=s,s=i,i=e,e=this);var n=this.scene.events;return this.bindEvent(e,n,t,i,s,r),this},er={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 tr.call(this,"preupdate",t,e,i,s),this},bindSceneUpdateEvent(t,e,i,s){return tr.call(this,"update",t,e,i,s),this},bindScenePostupdateEvent(t,e,i,s){return tr.call(this,"postupdate",t,e,i,s),this},bindSceneRenderEvent(t,e,i,s){return tr.call(this,"render",t,e,i,s),this},bindScenePauseEvent(t,e,i,s){return tr.call(this,"pause",t,e,i,s),this},bindSceneResumeEvent(t,e,i,s){return tr.call(this,"resume",t,e,i,s),this},bindSceneSleepEvent(t,e,i,s){return tr.call(this,"sleep",t,e,i,s),this},bindSceneWakeEvent(t,e,i,s){return tr.call(this,"wake",t,e,i,s),this},bindSceneShutdownEvent(t,e,i,s){return tr.call(this,"shutdown",t,e,i,s),this}},ir=function(t,e,i){var s=t.camera;return s?(void 0===i?i={}:!0===i&&(i=sr),s===e?(i.x=t.worldX,i.y=t.worldY):s.getWorldPoint(t.x,t.y,i),i):null},sr={},rr=function(t,e,i,s){var r,n=t.scene.sys.cameras.main,a=0===t.scrollFactorX&&0===t.scrollFactorY;if(e)return a?Js(t,e.x,e.y,i,s):!!(r=ir(e,n,!0))&&Js(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 fr={press:0,pointerdown:0,release:1,pointerup:1};var gr={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 vr(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}},mr=function(t,e,i,s,r){if(e)return!(i&&!i(t,e)||!yr(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 br.length=0,!0;return br.length=0,!1},br=[];const Cr=Phaser.Utils.Objects.GetValue;class _r extends Ze{constructor(t,e){super(t,e),this._enable=void 0;var i=Cr(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(Cr(t,"enable",!0)),this.setMode(Cr(t,"mode",1)),this.setClickInterval(Cr(t,"clickInterval",100)),this.setDragThreshold(Cr(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=Sr[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?mr:rr)(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 Sr={press:0,pointerdown:0,release:1,pointerup:1};var Pr={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 _r(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 wr extends Es{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 Or extends Ze{constructor(t,e){super(t,e),this._enable=void 0,this.cooldown=new wr,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 Er={isPointerInBounds(t){return void 0===t?t=this:"string"==typeof t&&(t=this.getElement(t)),!!t&&rr(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 Or(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 Or(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}},Tr={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}},kr=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=Gr,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===Ur&&this.onDragEnd(),this.pointer=void 0,this.tracerState=Gr,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=Hr,this}isPointerInGameObject(t,e,i){var s=this.lastPointer;return!!s&&rr(t,s,e,i)}}const Gr=0,Ur=1,Hr="IDLE",Jr=Phaser.Utils.Objects.GetValue,$r=Phaser.Math.Distance.Between;class qr extends Br{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=Kr},eventEmitter:!1};this.setRecongizedStateObject(new Es(s))}resetFromJSON(t){super.resetFromJSON(t),this.setHoldTime(Jr(t,"time",250)),this.setTapInterval(Jr(t,"tapInterval",200)),this.setDragThreshold(Jr(t,"threshold",9)),this.setTapOffset(Jr(t,"tapOffset",10));var e=Jr(t,"taps",void 0);return void 0!==e?this.setTaps(e):(this.setMaxTaps(Jr(t,"maxTaps",void 0)),this.setMinTaps(Jr(t,"minTaps",void 0))),this}onDragStart(){switch(this.state){case Kr:this.state=Zr;break;case Zr:var t=this.lastPointer;$r(t.upX,t.upY,t.x,t.y)>this.tapOffset&&(this.state=Qr,this.state=Zr);break;case Qr:this.state=Zr}}onDragEnd(){this.state===Zr&&(this.tapsCount++,this.emit("tapping",this,this.gameObject,this.lastPointer),void 0!==this.maxTaps&&this.tapsCount===this.maxTaps&&(this.state=Qr))}onDrag(){this.state!==Kr&&this.pointer.getDistance()>this.dragThreshold&&(this.state=Kr)}preUpdate(t,e){if(this.isRunning&&this.enable&&this.state===Zr){var i=this.lastPointer;i.isDown?t-i.downTime>this.holdTime&&(this.state=Kr):t-i.upTime>this.tapInterval&&(void 0===this.minTaps||this.tapsCount>=this.minTaps?this.state=Qr:this.state=Kr)}}postUpdate(t,e){this.isRunning&&this.enable&&this.state===Qr&&(this.state=Kr)}get isTapped(){return this.state===Qr}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 Kr="IDLE",Zr="BEGIN",Qr="RECOGNIZED",tn=Phaser.Utils.Objects.GetValue;class en extends Br{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=sn},eventEmitter:!1};this.setRecongizedStateObject(new Es(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(tn(t,"threshold",9)),this.setHoldTime(tn(t,"time",251)),this}onDragStart(){this.state=rn,0===this.holdTime&&(this.state=nn)}onDragEnd(){this.state=sn}onDrag(){this.state!==sn&&this.pointer.getDistance()>this.dragThreshold&&(this.state=sn)}preUpdate(t,e){this.isRunning&&this.enable&&this.state===rn&&t-this.pointer.downTime>=this.holdTime&&(this.state=nn)}get isPressed(){return this.state===nn}setHoldTime(t){return this.holdTime=t,this}setDragThreshold(t){return this.dragThreshold=t,this}}const sn="IDLE",rn="BEGIN",nn="RECOGNIZED";Phaser.Utils.Objects.GetValue;const an=Phaser.Math.Distance.Between,hn=Phaser.Math.Angle.Between;var on={getDt:function(){var t;return t=this.scene,qe(t).loop.delta},getVelocity:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return an(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 hn(e.x,e.y,t.x,t.y)}},ln={"up&down":0,"left&right":1,"4dir":2,"8dir":3},dn={};const un=Phaser.Utils.Objects.GetValue,cn=Phaser.Math.RadToDeg;class pn extends Br{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=vn},eventEmitter:!1};this.setRecongizedStateObject(new Es(s)),this.clearDirectionStates()}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(un(t,"threshold",10)),this.setVelocityThreshold(un(t,"velocityThreshold",1e3)),this.setDirectionMode(un(t,"dir","8dir")),this}onDragStart(){this.state=fn}onDragEnd(){this.state=vn}onDrag(){this.state===fn&&(this.validDrag||(this.validDrag=0===this.dragThreshold||this.pointer.getDistance()>=this.dragThreshold),this.validDrag&&this.dragVelocity>this.velocityThreshold&&(this.state=gn))}postUpdate(t,e){this.isRunning&&this.enable&&this.state===gn&&(this.state=vn)}get isSwiped(){return this.state===gn}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=ln[t]),this.dirMode=t,this}updateDirectionStates(){return function(t,e,i){switch(void 0===i?i={}:!0===i&&(i=dn),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(pn.prototype,on);const vn="IDLE",fn="BEGIN",gn="RECOGNIZED",mn=Phaser.Utils.Objects.GetValue,yn=Phaser.Utils.Array.SpliceOne,bn=Phaser.Math.Distance.Between,Cn=Phaser.Math.Angle.Between;class _n{constructor(t,e){var i=He(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(mn(e,"inputConfig",void 0)),this.setEventEmitter(mn(e,"eventEmitter",void 0)),this._enable=void 0,this.pointers=[],this.movedState={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setEnable(mn(t,"enable",!0)),this.bounds=mn(t,"bounds",void 0),this.tracerState=Pn,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 Pn:this.tracerState=wn,this.onDrag1Start();break;case wn: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],yn(this.pointers,e),this.tracerState){case wn:this.tracerState=Pn,this.onDrag1End();break;case xn:this.tracerState=wn,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 wn:this.onDrag1();break;case xn:this.onDrag2()}}}dragCancel(){return this.tracerState===xn&&this.onDrag2End(),this.pointers.length=0,ft(this.movedState),this.tracerState=Pn,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 bn(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 Cn(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;Sn.x=e.x-i.x,Sn.y=e.y-i.y}else Sn.x=0,Sn.y=0;return Sn}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=On,this}isPointer0InGameObject(t,e,i){var s=this.pointers[0];return!!s&&rr(t,s,e,i)}isPointer1InGameObject(t,e,i){var s=this.pointers[1];return!!s&&rr(t,s,e,i)}}Object.assign(_n.prototype,Be);var Sn={};const Pn=0,wn=1,xn=2,On="IDLE";Phaser.Utils.Objects.GetValue;const En=Phaser.Math.RotateAround;var Tn=function(t,e,i,s){return En(t,e,i,s),t.rotation+=s,t},kn={};const Dn=Phaser.Utils.Objects.GetValue,Rn=Phaser.Math.Angle.WrapDegrees,Mn=Phaser.Math.Angle.ShortestBetween,Ln=Phaser.Math.RadToDeg,An=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=kn),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=Rn(Ln(this.angleBetween));this.angle=Mn(this.prevAngle,t),this.prevAngle=t,this.state=Fn}break;case Fn:t=Rn(Ln(this.angleBetween)),this.angle=Mn(this.prevAngle,t),this.prevAngle=t,this.emit("rotate",this)}}get isRotated(){return this.state===Fn}get rotation(){return An(this.angle)}setDragThreshold(t){return this.dragThreshold=t,this}}.prototype,jn);const zn="IDLE",Xn="BEGIN",Fn="RECOGNIZED",Yn=Phaser.Utils.Objects.GetValue;var In=function(t){var e=Yn(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){Dr(i.eventEmitter,`${i.eventNamePrefix}${t.tapsCount}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Nn=Phaser.Utils.Objects.GetValue;var Wn=function(t){var e=Nn(t,"press",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._press=new en(this,e),this._press.on("pressstart",(function(t,e,s){Dr(i.eventEmitter,`${i.eventNamePrefix}pressstart`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this).on("pressend",(function(t,e,s){Dr(i.eventEmitter,`${i.eventNamePrefix}pressend`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Vn=Phaser.Utils.Objects.GetValue;var Bn=function(t){var e=Vn(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 pn(this,e),this._swipe.on("swipe",(function(t,e,s){var r=t.left?"left":t.right?"right":t.up?"up":"down";Dr(i.eventEmitter,`${i.eventNamePrefix}swipe${r}`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Gn=Phaser.Utils.Objects.GetValue;var Un=function(t,e){return t.setInteractive(),Gn(e,"dropZone",!1)&&(t.input.dropZone=!0),t._childrenInteractive={targetSizers:Gn(e,"targets",[t]),targetMode:Gn(e,"targetMode","parent"),eventEmitter:Gn(e,"eventEmitter",t),eventNamePrefix:Gn(e,"inputEventPrefix","child.")},Mr.call(t,e),jr.call(t,e),Fr.call(t,e),Wr.call(t,e),In.call(t,e),Wn.call(t,e),Bn.call(t,e),t},Hn={getSizerConfig:function(t){return void 0===t&&(t=this),Tt(t)},getChildPrevState:function(t){var e=Tt(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=ae(e,"color"),s=ae(e,"lineWidth");var o=ae(e,"name",!1);o&&(r=ae(o,"createTextCallback",oe),n=ae(o,"createTextCallbackScope",void 0),"string"==typeof(a=ae(o,"align","left-top"))&&(a=At[a]))}if(void 0===i&&(i=16777215),void 0===s&&(s=1),r&&!t.children){t.children=new he(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)}}for(var d,u,c=this.getAllShownChildren([this]),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 ia=Phaser.Utils.Objects.IsPlainObject,sa=Phaser.Utils.Objects.GetValue,ra=Phaser.Display.Align.CENTER,na={min:0,full:-1};var aa=function(t,e,i,s,r,n,a,h,o,l){pe.call(this,t);var d=t.isRexSpace,u=typeof e;if(null===e)return this;if("number"===u);else if("string"===u)e=na[e];else if(ia(e)){var c;e=sa(c=e,"proportion",void 0),i=sa(c,"align",ra),s=sa(c,"padding",0),r=sa(c,"expand",!1),n=sa(c,"key",void 0),a=sa(c,"index",void 0),t.isRexSizer||(h=sa(c,"minWidth",void 0),o=sa(c,"minHeight",void 0)),l=sa(c,"fitRatio",0)}return"string"==typeof i&&(i=At[i]),void 0===e&&(e=d?1:0),void 0===i&&(i=ra),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===h&&(d?h=0:t.isRexSizer||(h=t._minWidth)),void 0===o&&(d?o=0:t.isRexSizer||(o=t._minHeight)),void 0===l||!1===l?l=0:!0===l&&(l=Q(t)/tt(t)),(c=this.getSizerConfig(t)).proportion=e,c.align=i,c.padding=ue(s),c.expand=r,c.fitRatio=0===e?l:0,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},ha={add:aa,addSpace(t){return this.insertSpace(void 0,t),this},insertSpace(t,e){return void 0===e&&(e=1),aa.call(this,new ta(this.scene),{proportion:e,minWidth:0,minHeight:0,index:t}),this},insert(t,e,i,s,r,n,a,h){return ia(i)&&(i.index=t),aa.call(this,e,i,s,r,n,a,t,h),this},insertAtPosition(t,e,i,s,r,n,a,h,o){var l=ea.call(this,t,e);return-1===l&&(l=void 0),this.insert(l,i,s,r,n,a,h,o),this}};const oa=Et.prototype.clear;var la=function(t){this.backgroundChildren&&(this.backgroundChildren.length=0);var e,i=!t&&this.sizerEventsEnable;if(i&&(e=this.getChildren([])),oa.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,la.call(this,t),this}},ca={getChildAlign(t){return this.getSizerConfig(t).align},setChildAlign(t,e){return"string"==typeof e&&(e=At[e]),this.getSizerConfig(t).align=e,this}},pa={getChildProportion(t){return this.getSizerConfig(t).proportion},setChildProportion(t,e){return this.getSizerConfig(t).proportion=e,this}},va={getChildExpand(t){return this.getSizerConfig(t).expand},setChildExpand(t,e){return this.getSizerConfig(t).expand=e,this}},fa={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}},ga={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&&(Ie(t,0,0),e.resolved=!1,this.hasRatioFitChild=!0);return this._childrenProportion=void 0,this.hasProportion0Child=!1,this.proportionLength=void 0,Xe.call(this),this},layoutChildren:function(){for(var t,e,i,s,r,n,a,h,o,l,d=this.sizerChildren,u=this.innerLeft,c=this.innerTop,p=this.innerWidth,v=this.innerHeight,f=u,g=c,m=this.startChildIndex,y=0,b=d.length;y0?(e=t-this.getChildrenWidth(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},resolveHeight:function(t){if(void 0!==(t=Le.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)||Re.call(this)},runWidthWrap:function(t){this.wrapResult||(1===this.orientation&&Zn.call(this,t,void 0),Me.call(this,t))},hasHeightWrap:function(){return!(!this.hasRatioFitChild||0!==this.orientation)||Ae.call(this)},runHeightWrap:function(t){this.wrapResult||(0===this.orientation&&Zn.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(ga,ha,ua,ca,pa,va,fa);var ma=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},ya={x:0,h:0,horizontal:0,"left-to-right":0,y:1,v:1,vertical:1,"top-to-bottom":1};const ba=Phaser.Utils.Objects.IsPlainObject,Ca=Phaser.Utils.Objects.GetValue;class _a extends $n{constructor(t,e,i,s,r,n,a){ba(e)?(e=Ca(a=e,"x",0),i=Ca(a,"y",0),s=Ca(a,"width",void 0),r=Ca(a,"height",void 0),n=Ca(a,"orientation",0)):ba(s)?(s=Ca(a=s,"width",void 0),r=Ca(a,"height",void 0),n=Ca(a,"orientation",0)):ba(n)&&(n=Ca(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(Ca(a,"space.item",0)),this.setStartChildIndex(Ca(a,"startChildIndex",0)),this.setRTL(Ca(a,"rtl",!1)),this.addChildrenMap("items",this.sizerChildren)}setOrientation(t){return this.orientation=function(t){return"string"==typeof t&&(t=ya[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=ma.call(this)),this._childrenProportion}}Object.assign(_a.prototype,ga);var Sa=Phaser.Renderer.WebGL.Utils,Pa=function(t,e,i,s,r,n){for(var a=Sa.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+")"},Ta=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 ka=Phaser.Renderer.Canvas.SetTransform;var Da={renderWebGL:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.pipelines.set(e.pipeline),n=Oa(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&&Pa(r,a,e,l,h,o),e.isStroked&&xa(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(ka(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(Ma.prototype,Da);const La=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=La(t,"x",0),i=La(t,"y",0));var s=this.cornerRadius;s.tl=ja(La(t,"tl",void 0),e,i),s.tr=ja(La(t,"tr",void 0),e,i),s.bl=ja(La(t,"bl",void 0),e,i),s.br=ja(La(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 ja=function(t,e,i){return void 0===t?t={x:e,y:i}:"number"==typeof t&&(t={x:t,y:t}),Xa(t),t},za=function(t,e){"number"==typeof e?(t.x=e,t.y=e):(t.x=La(e,"x",0),t.y=La(e,"y",0)),Xa(t)},Xa=function(t){t.convex=t.x>=0||t.y>=0,t.x=Math.abs(t.x),t.y=Math.abs(t.y)},Fa=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 Ya=Phaser.Math.DegToRad;var Ia=function(t,e,i,s,r,n,a,h,o){a&&n>r?n-=360:!a&&n0&&t.y>0};const Ua={rectangle:0,circle:1},Ha=Phaser.Utils.Objects.GetValue;class Ja extends Ze{constructor(t,e){super(t,e),this.style=Ha(e,"style",this);var i=Ha(e,"propertiesMap");this.activeStyle=$a(e,"active",i),this.hoverStyle=$a(e,"hover",i),this.disableStyle=$a(e,"disable",i),this.onModifyStyle=Ha(e,"onModifyStyle")}getStyle(t){return function(t,e,i){if(void 0===i&&(i={}),Array.isArray(e))for(var s=0,r=e.length;s0,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};const Nh=Phaser.Utils.Objects.GetValue,Wh=Phaser.Utils.Objects.IsPlainObject;class Vh extends(ph(nh)){constructor(t,e,i,s,r,n,a,h){Wh(e)?(e=Nh(h=e,"x",0),i=Nh(h,"y",0),s=Nh(h,"width",2),r=Nh(h,"height",2),n=Nh(h,"barColor",void 0),a=Nh(h,"value",0)):Wh(s)?(s=Nh(h=s,"width",2),r=Nh(h,"height",2),n=Nh(h,"barColor",void 0),a=Nh(h,"value",0)):Wh(n)&&(n=Nh(h=n,"barColor",void 0),a=Nh(h,"value",0)),super(t,e,i,s,r,h),this.type="rexLineProgress",this.bootProgressBase(h),this.addShape((new Yh).setName("trackFill")).addShape((new Yh).setName("bar")).addShape((new Yh).setName("trackStroke")),this.setTrackColor(Nh(h,"trackColor",void 0)),this.setBarColor(n),this.setTrackStroke(Nh(h,"trackStrokeThickness",2),Nh(h,"trackStrokeColor",void 0)),this.setSkewX(Nh(h,"skewX",0)),this.setRTL(Nh(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 Bh={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&&Ih(s,0,0,e,i,t).close();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),Ih(a,r,0,n,i,t).close());var h=this.getShape("trackStroke");h.lineStyle(this.trackStrokeThickness,this.trackStrokeColor),h.isStroked&&Ih(h,0,0,e,i,t).end()}};Object.assign(Vh.prototype,Bh);var Gh=function(t){return null==t||""===t||0===t.length},Uh=function(t,e,i,s){if(void 0===s&&(s="."),"object"==typeof t){if(Gh(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(Gh(e));else{var r;"string"==typeof e&&(e=e.split("."));for(var n=0,a=e.length;nuo(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}const co=Phaser.Utils.Objects.IsPlainObject,po=Phaser.Utils.Objects.GetValue;var vo=function(t){return"string"==typeof t&&(t=fo[t]),t};const fo={scale:0,repeat:1};var go=function(t,e){return 0===t||t===this.columns.count-1||0===e||e===this.rows.count-1},mo={_beginDraw:jt,_drawImage:jt,_drawTileSprite:jt,_endDraw:jt,setGetFrameNameCallback:function(t){return void 0===t&&(t=lo),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=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),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 co(t)?(this.stretchMode.edge=vo(po(t,"edge",0)),this.stretchMode.internal=vo(po(t,"internal",0))):(t=vo(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 yo=Phaser.Utils.Objects.IsPlainObject,bo=Phaser.Utils.Objects.GetValue,Co=Phaser.GameObjects;var _o=void 0,So=function(t,e){if(_o||(_o={},qe(t).events.once("destroy",(function(){for(var t in _o)_o[t].destroy();_o=void 0}))),!_o.hasOwnProperty(e)){var i=qe(t).scene.systemScene;(t=new Co[e](i)).setOrigin(0),_o[e]=t}return _o[e]};const Po=Phaser.GameObjects.RenderTexture;class wo extends(function(t,e){class i extends t{constructor(t,i,s,r,n,a,h,o,l,d){if(yo(i)?(i=bo(d=i,"x",0),s=bo(d,"y",0),r=bo(d,"width",1),n=bo(d,"height",1),a=bo(d,"key",void 0),h=bo(d,"baseFrame",void 0),o=bo(d,"columns",void 0),l=bo(d,"rows",void 0)):yo(r)?(r=bo(d=r,"width",1),n=bo(d,"height",1),a=bo(d,"key",void 0),h=bo(d,"baseFrame",void 0),o=bo(d,"columns",void 0),l=bo(d,"rows",void 0)):yo(a)?(a=bo(d=a,"key",void 0),h=bo(d,"baseFrame",void 0),o=bo(d,"columns",void 0),l=bo(d,"rows",void 0)):yo(h)?(h=bo(d=h,"baseFrame",void 0),o=bo(d,"columns",void 0),l=bo(d,"rows",void 0)):Array.isArray(h)?(d=l,l=o,o=h,h=bo(d,"baseFrame",void 0)):yo(o)&&(o=bo(d=o,"columns",void 0),l=bo(d,"rows",void 0)),void 0===h&&(h=bo(d,"frame",void 0)),void 0===o){var u=bo(d,"leftWidth",void 0),c=bo(d,"rightWidth",void 0);void 0!==u&&void 0!==c&&(o=[u,void 0,c])}if(void 0===l){var p=bo(d,"topHeight",void 0),v=bo(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(bo(d,"getFrameNameCallback",void 0)),this.setStretchMode(bo(d,"stretchMode",0)),this.setPreserveRatio(bo(d,"preserveRatio",!0));var f=bo(d,"maxFixedPartScale",1),g=bo(d,"maxFixedPartScaleX",f),m=bo(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,mo),i}(Po,"rexNinePatch")){}var xo={_drawImage:function(t,e,i,s,r,n){var a=So(this,"Image").setTexture(t,e).setDisplaySize(r,n);this.draw(a,i,s)},_drawTileSprite:function(t,e,i,s,r,n){var a=So(this,"TileSprite").setTexture(t,e).setSize(r,n);this.draw(a,i,s)}};Object.assign(wo.prototype,xo);class Oo extends Ze{constructor(t,e){return super(t),new Proxy(this,this)}get(t,e){if($h(t,e))return t[e];var i=t.parent;return $h(i,e)?i[e]:void 0}set(t,e,i){return $h(t,e)?t[e]=i:$h(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 Eo=Phaser.Utils.Objects.GetValue;class To extends wo{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexStatesNinePatch";var i=Eo(e,"effects",!0);i&&to(this,i),this.style=new Oo(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign(To.prototype,Ka);const ko=["alpha","tint","flipX","flipY"];var Do=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 Hh(t,e);break;case"image":s=new oo(t,e);break;case"nineSlice":s=e.hasOwnProperty("stretchMode")?new To(t,e):new ro(t,e);break;default:s=new Za(t,e)}return function(t,e){if(!e)return t;for(var i=0,s=ko.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 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}},we=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 xe=/(\S+)\[(\d+)\]/i,Oe=Phaser.Utils.Objects.GetValue;var Ee=function(t,e){return void 0===e?t:t[e]},Te=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=Oe(e,"left",0),t.right=Oe(e,"right",0),t.top=Oe(e,"top",0),t.bottom=Oe(e,"bottom",0)),t},ke={getInnerPadding(t){return Ee(this.space,t)},setInnerPadding(t,e){return Te(this.space,t,e),this},getOuterPadding(t){return Ee(this.getSizerConfig(this).padding,t)},setOuterPadding(t,e){return Te(this.getSizerConfig(this).padding,t,e),this},getChildOuterPadding(t,e){return"string"==typeof t&&(t=this.getElement(t)),Ee(this.getSizerConfig(t).padding,e)},setChildOuterPadding(t,e,i){return"string"==typeof t&&(t=this.getElement(t)),Te(this.getSizerConfig(t).padding,e,i),this}},De=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}},Re=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},Me=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},Le=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},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},ze={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}},Xe=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?pi:ci,this.repeatCounter=0,this}stop(){return this.state=ui,this}update(t,e){this.state!==ui&&this.state!==fi&&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=vi)):(this.nowTime=this.duration,this.state=fi):this.nowTime>=0&&(this.state=pi))}get t(){var t;switch(this.state){case ui:case ci:case vi:t=0;break;case pi:t=this.nowTime/this.duration;break;case fi:t=1}return li(t,0,1)}set t(t){(t=li(t,-1,1))<0?(this.state=ci,this.nowTime=-this.delay*t):(this.state=pi,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===ui}get isDelay(){return this.state===ci}get isCountDown(){return this.state===pi}get isRunning(){return this.state===ci||this.state===pi}get isDone(){return this.state===fi}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}}const ui=0,ci=1,pi=2,vi=3,fi=-1;class gi extends ai{constructor(t,e){super(t,e),this.timer=new di}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 mi=Phaser.Utils.Objects.GetValue,yi=Phaser.Utils.Objects.GetAdvancedValue,bi=Phaser.Tweens.Builders.GetEaseFunction;class Ci extends gi{resetFromJSON(t){return this.timer.resetFromJSON(mi(t,"timer")),this.setEnable(mi(t,"enable",!0)),this.setTarget(mi(t,"target",this.parent)),this.setDelay(yi(t,"delay",0)),this.setDuration(yi(t,"duration",1e3)),this.setEase(mi(t,"ease","Linear")),this.setRepeat(mi(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=bi(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 _i=Phaser.Utils.Objects.GetValue,Si=Phaser.Utils.Objects.GetAdvancedValue,Pi=Phaser.Math.Linear;let wi=class extends Ci{constructor(t,e){super(t,e),this.scaleStart={},this.scaleEnd={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(_i(t,"mode",0)),this.setScaleRange(Si(t,"start",void 0),Si(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=xi[t]),this.mode=t,this}setScaleRange(t,e){return"number"==typeof t?(this.startX=t,this.startY=t):(this.startX=Si(t,"x",this.parent.scaleX),this.startY=Si(t,"y",this.parent.scaleY)),"number"==typeof e?(this.endX=e,this.endY=e):(this.endX=Si(e,"x",void 0),this.endY=Si(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=Pi(this.startX,this.endX,i)),this.hasScaleY&&(t.scaleY=Pi(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}};const xi={stop:0,destroy:1,yoyo:2};var Oi=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 wi(t,h):r.resetFromJSON(h),r.restart(),r},Ei=function(t,e,i,s,r,n){void 0===s&&(s="Linear"),r instanceof wi&&(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 wi(t,a):n.resetFromJSON(a),n.restart(),n},Ti=function(t,e){return new Promise((function(i,s){t.once(e,(function(){i()}))}))},ki=function(t){return Ti(t,"complete")};const Di=Phaser.Utils.Objects.IsPlainObject;var Ri={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(Di(t)){var s=t;t=s.duration,e=s.orientation,i=s.ease}var r=void 0===this._scaleBehavior;return this._scaleBehavior=Oi(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),ki(this._scaleBehavior)},isRunningPopUp(){return this._scaleBehavior&&"popup.complete"===this._scaleBehavior.completeEventName},scaleDownDestroy(t,e,i,s){if(Di(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=Ei(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),ki(this._scaleBehavior)},scaleDown(t,e,i){return this.scaleDownDestroy(t,e,i,!1),this},scaleDownPromise(t,e,i){return this.scaleDown(t,e,i),ki(this._scaleBehavior)},isRunningScaleDown(){return this._scaleBehavior&&"scaledown.complete"===this._scaleBehavior.completeEventName},scaleYoyo(t,e,i,s,r){if(Di(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 wi(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),ki(this._scaleBehavior)},isRunningScaleYoyo(){return this._scaleBehavior&&(this._scaleBehavior.completeEventName="scaleyoyo.complete")},isRunningEaseScale(){return this.isRunningPopUp()||this.isRunningScaleDown()||this.isRunningScaleYoyo()}},Mi={};Object.assign(Mi,Ri),Mi.onInitScale=function(){Ri.onInitScale.call(this);var t=this;this._scaleBehavior.on("update",(function(){var e=ge.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const Li=Phaser.Utils.Objects.GetValue,Ai=Phaser.Utils.Objects.GetAdvancedValue,ji=Phaser.Math.Linear;class zi extends Ci{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(Li(t,"mode",0)),this.setAlphaRange(Ai(t,"start",this.parent.alpha),Ai(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=Xi[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 Xi={stop:0,destroy:1,yoyo:2},Fi=Phaser.Utils.Objects.IsPlainObject;var Yi=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 a={mode:0,start:r,end:n,duration:e};return void 0===s?s=new zi(t,a):s.resetFromJSON(a),s.restart(),s},Ii=function(t,e,i,s){i instanceof zi&&(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 zi(t,r):s.resetFromJSON(r),s.restart(),s};const Ni=Phaser.Utils.Objects.IsPlainObject;var Wi={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=Yi(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadein.complete",this},fadeInPromise(t,e){return this.fadeIn(t,e),ki(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=Ii(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadeout.complete",this},fadeOutDestroyPromise(t,e){return this.fadeOutDestroy(t,e),ki(this._fade)},fadeOut(t){return this.fadeOutDestroy(t,!1),this},fadeOutPromise(t){return this.fadeOut(t),ki(this._fade)},isRunningFadeOut(){return this._fade&&"fadeout.complete"===this._fade.completeEventName},isRunningEaseFade(){return this.isRunningFadeIn()||this.isRunningFadeOut()}},Vi={};Object.assign(Vi,Wi),Vi.onInitFade=function(){Wi.onInitFade.call(this);var t=this;this._fade.on("update",(function(){var e=ge.getParentSizer(t);e&&e.resetChildAlphaState(t)}))};const Bi=Phaser.Utils.Objects.GetValue,Gi=Phaser.Utils.Objects.GetAdvancedValue,Ui=Phaser.Math.Linear;class Hi extends Ci{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){if(super.resetFromJSON(t),this.setMode(Bi(t,"mode",0)),t&&(t.hasOwnProperty("x")||t.hasOwnProperty("y"))){var e=Gi(t,"x",void 0),i=Gi(t,"y",void 0);this.setTargetPosition(e,i)}else this.setTargetPosition(t);return this}setMode(t){return"string"==typeof t&&(t=Ji[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=Gi(i,"startX",void 0),this.startY=Gi(i,"startY",void 0),this.endX=Gi(i,"endX",void 0),this.endY=Gi(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=Ui(this.startX,this.endX,i)),this.hasMoveY&&(t.y=Ui(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Ji={stop:0,destroy:1,yoyo:2};var $i=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,Ki=Phaser.Math.Distance.Between;var Zi={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*Ki(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 Hi&&(a=n,n=void 0),void 0===n&&(n=!1);var h={};return h.mode=n?1:0,void 0!==i&&(h.startX=$i(i,t.x),h.endX=t.x),void 0!==s&&(h.startY=$i(s,t.y),h.endY=t.y),h.duration=e,h.ease=void 0===r?"Linear":r,void 0===a?a=new Hi(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),ki(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),ki(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*Ki(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 Hi&&(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=$i(i,t.x)),void 0!==s&&(h.startY=t.y,h.endY=$i(s,t.y)),h.duration=e,h.ease=void 0===r?"Linear":r,void 0===a?a=new Hi(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),ki(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),ki(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}},Qi={};Object.assign(Qi,Zi),Qi.onInitEaseMove=function(){Zi.onInitEaseMove.call(this);var t=this;this._easeMove.on("update",(function(){var e=ge.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const ts=Phaser.Utils.Objects.GetValue;class es extends si{constructor(t,e){super(t,e),this.timer=new di,this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.timer.resetFromJSON(ts(t,"timer")),this.setEnable(ts(t,"enable",!0)),this.setMode(ts(t,"mode",1)),this.isRunning=ts(t,"isRunning",!1),this.setMagnitudeMode(ts(t,"magnitudeMode",1)),this.setAxisMode(ts(t,"axis",0)),this.setDuration(ts(t,"duration",500)),this.setMagnitude(ts(t,"magnitude",10)),this.ox=ts(t,"ox",void 0),this.oy=ts(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=is[t]),this.mode=t,this}setMagnitudeMode(t){return"string"==typeof t&&(t=rs[t]),this.magnitudeMode=t,this}setAxisMode(t){return"string"==typeof t&&(t=ss[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=ts(i,"magnitude",void 0),t=ts(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 is={effect:0,behavior:1},ss={both:0,"h&v":0,"x&y":0,horizontal:1,h:1,x:1,vertical:2,v:2,y:2},rs={constant:0,decay:1},ns=Phaser.Utils.Objects.IsPlainObject;var as={shake(t,e,i){if(ns(t)){var s=t;t=s.duration,e=s.magnitude,i=s.magnitudeMode}return void 0===this._shake&&(this._shake=new es(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),ki(this._shake)}};const hs=Phaser.Utils.Objects.GetValue,os=Phaser.Math.Linear;class ls extends Ci{constructor(t,e){super(t,e),this.resetFromJSON(),this.boot()}start(t){if(this.timer.isRunning)return this;var e=this.target;this.propertyKey=hs(t,"key","value");var i=e[this.propertyKey];return this.fromValue=hs(t,"from",i),this.toValue=hs(t,"to",i),this.setEase(hs(t,"ease",this.ease)),this.setDuration(hs(t,"duration",this.duration)),this.setRepeat(hs(t,"repeat",0)),this.setDelay(hs(t,"delay",0)),this.setRepeatDelay(hs(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]=os(this.fromValue,this.toValue,i)}}const ds=Phaser.Utils.Objects.IsPlainObject;class us extends Ze{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 ls(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(ds(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(ds(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 cs={easeDataTo(t,e,i,s){return this._easeData||(this._easeData=new us(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),Ti(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}},ps=Phaser.Utils.Array.Remove,vs={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 ks={delayCall(t,e,i){return this.delayCallTimer=function(t,e,i,s,r){var n=He(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}},Ds={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}},Rs={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}},Ms={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}},Ls={};Object.assign(Ls,ks,Ds,Rs,Ms);const As=Phaser.Utils.Objects.GetValue;class js extends Ze{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 Ts(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(js.prototype,Ls);var zs=function(t){if(t.parentContainer)return zs(t.parentContainer);var e=function(t){var e=t.displayList;return H(e)?e:null}(t);return e?zs(e):t};class Xs extends Ze{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=zs(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 Fs=Phaser.GameObjects.Rectangle;class Ys extends Fs{constructor(t,e,i){super(t,0,0,2,2,e,1),this.fullWindow=new Xs(this),this.setAlpha(i)}get tint(){return this.fillColor}set tint(t){this.setFillStyle(t,this.fillAlpha)}}const Is=Phaser.Utils.Objects.GetValue;class Ns extends Ze{constructor(t,e){super(t,{eventEmitter:!1}),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setHitAreaMode(Is(t,"hitAreaMode",0)),this.setEnable(Is(t,"enable",!0)),this.setStopMode(Is(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=Ws[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 Ws={default:0,fullWindow:1};const Vs=Phaser.Utils.Objects.GetValue;class Bs extends Ys{constructor(t,e){super(t,Vs(e,"color",0),Vs(e,"alpha",.8)),this.touchEventStop=new Ns(this,{hitAreaMode:1})}}var Gs={popUp(t,e){void 0!==t._modalScaleSave?(t.scaleX=t._modalScaleSave,t.scaleY=t._modalScaleSave):t._modalScaleSave=t.scaleX,Oi(t,e)},scaleDown(t,e){Ei(t,e,void 0,void 0,!1)},fadeIn(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Yi(t,e)},fadeOut(t,e){Ii(t,e,!1)}},Us=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Yi(t,e,t.alpha)},Hs=function(t,e){Ii(t,e,!1)},Js=function(t,e,i,s,r){return!(!t||s&&!s(t,e,i)||!rt(t,!0).contains(e,i)||r&&!r(t,e,i))};const $s=Phaser.Utils.Objects.GetValue;let qs=class extends js{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=Ks.popUp),null==e.transitOut&&(e.transitOut=Ks.scaleDown),e.destroy=$s(e,"destroy",!0),super(t,e);var i=$s(e,"cover");this.cover=!1!==i?function(t,e){var i=t.scene,s=new Bs(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($s(i,"transitIn",Us)),this.setCoverTransitOutCallback($s(i,"transitOut",Hs)));var s=$s(e,"touchOutsideClose",!1),r=$s(e,"duration.hold",-1),n=$s(e,"timeOutClose",r>=0),a=$s(e,"anyTouchClose",!1);$s(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),$s(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&&Js(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=Ks[t]),t){case Ks.popUp:t=Gs.popUp;break;case Ks.fadeIn:t=Gs.fadeIn}return super.setTransitInCallback(t),this}setTransitOutCallback(t){switch("string"==typeof t&&(t=Ks[t]),t){case Ks.scaleDown:t=Gs.scaleDown;break;case Ks.fadeOut:t=Gs.fadeOut}return super.setTransitOutCallback(t),this}setCoverTransitInCallback(t){return this.coverTransitInCallback=t,this}setCoverTransitOutCallback(t){return this.coverTransitOutCallback=t,this}};const Ks={popUp:0,fadeIn:1,scaleDown:0,fadeOut:1};var Zs=function(t){return t&&"function"==typeof t},Qs={modal(t,e){return Zs(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}},tr=function(t,e,i,s,r){Zs(e)&&(r=s,s=i,i=e,e=this);var n=this.scene.events;return this.bindEvent(e,n,t,i,s,r),this},er={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 tr.call(this,"preupdate",t,e,i,s),this},bindSceneUpdateEvent(t,e,i,s){return tr.call(this,"update",t,e,i,s),this},bindScenePostupdateEvent(t,e,i,s){return tr.call(this,"postupdate",t,e,i,s),this},bindSceneRenderEvent(t,e,i,s){return tr.call(this,"render",t,e,i,s),this},bindScenePauseEvent(t,e,i,s){return tr.call(this,"pause",t,e,i,s),this},bindSceneResumeEvent(t,e,i,s){return tr.call(this,"resume",t,e,i,s),this},bindSceneSleepEvent(t,e,i,s){return tr.call(this,"sleep",t,e,i,s),this},bindSceneWakeEvent(t,e,i,s){return tr.call(this,"wake",t,e,i,s),this},bindSceneShutdownEvent(t,e,i,s){return tr.call(this,"shutdown",t,e,i,s),this}},ir=function(t,e,i){var s=t.camera;return s?(void 0===i?i={}:!0===i&&(i=sr),s===e?(i.x=t.worldX,i.y=t.worldY):s.getWorldPoint(t.x,t.y,i),i):null},sr={},rr=function(t,e,i,s){var r,n=t.scene.sys.cameras.main,a=0===t.scrollFactorX&&0===t.scrollFactorY;if(e)return a?Js(t,e.x,e.y,i,s):!!(r=ir(e,n,!0))&&Js(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 fr={press:0,pointerdown:0,release:1,pointerup:1};var gr={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 vr(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}},mr=function(t,e,i,s,r){if(e)return!(i&&!i(t,e)||!yr(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 br.length=0,!0;return br.length=0,!1},br=[];const Cr=Phaser.Utils.Objects.GetValue;class _r extends Ze{constructor(t,e){super(t,e),this._enable=void 0;var i=Cr(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(Cr(t,"enable",!0)),this.setMode(Cr(t,"mode",1)),this.setClickInterval(Cr(t,"clickInterval",100)),this.setDragThreshold(Cr(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=Sr[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?mr:rr)(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 Sr={press:0,pointerdown:0,release:1,pointerup:1};var Pr={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 _r(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 wr extends Es{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 Or extends Ze{constructor(t,e){super(t,e),this._enable=void 0,this.cooldown=new wr,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 Er={isPointerInBounds(t){return void 0===t?t=this:"string"==typeof t&&(t=this.getElement(t)),!!t&&rr(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 Or(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 Or(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}},Tr={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}},kr=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=Gr,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===Ur&&this.onDragEnd(),this.pointer=void 0,this.tracerState=Gr,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=Hr,this}isPointerInGameObject(t,e,i){var s=this.lastPointer;return!!s&&rr(t,s,e,i)}}const Gr=0,Ur=1,Hr="IDLE",Jr=Phaser.Utils.Objects.GetValue,$r=Phaser.Math.Distance.Between;class qr extends Br{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=Kr},eventEmitter:!1};this.setRecongizedStateObject(new Es(s))}resetFromJSON(t){super.resetFromJSON(t),this.setHoldTime(Jr(t,"time",250)),this.setTapInterval(Jr(t,"tapInterval",200)),this.setDragThreshold(Jr(t,"threshold",9)),this.setTapOffset(Jr(t,"tapOffset",10));var e=Jr(t,"taps",void 0);return void 0!==e?this.setTaps(e):(this.setMaxTaps(Jr(t,"maxTaps",void 0)),this.setMinTaps(Jr(t,"minTaps",void 0))),this}onDragStart(){switch(this.state){case Kr:this.state=Zr;break;case Zr:var t=this.lastPointer;$r(t.upX,t.upY,t.x,t.y)>this.tapOffset&&(this.state=Qr,this.state=Zr);break;case Qr:this.state=Zr}}onDragEnd(){this.state===Zr&&(this.tapsCount++,this.emit("tapping",this,this.gameObject,this.lastPointer),void 0!==this.maxTaps&&this.tapsCount===this.maxTaps&&(this.state=Qr))}onDrag(){this.state!==Kr&&this.pointer.getDistance()>this.dragThreshold&&(this.state=Kr)}preUpdate(t,e){if(this.isRunning&&this.enable&&this.state===Zr){var i=this.lastPointer;i.isDown?t-i.downTime>this.holdTime&&(this.state=Kr):t-i.upTime>this.tapInterval&&(void 0===this.minTaps||this.tapsCount>=this.minTaps?this.state=Qr:this.state=Kr)}}postUpdate(t,e){this.isRunning&&this.enable&&this.state===Qr&&(this.state=Kr)}get isTapped(){return this.state===Qr}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 Kr="IDLE",Zr="BEGIN",Qr="RECOGNIZED",tn=Phaser.Utils.Objects.GetValue;class en extends Br{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=sn},eventEmitter:!1};this.setRecongizedStateObject(new Es(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(tn(t,"threshold",9)),this.setHoldTime(tn(t,"time",251)),this}onDragStart(){this.state=rn,0===this.holdTime&&(this.state=nn)}onDragEnd(){this.state=sn}onDrag(){this.state!==sn&&this.pointer.getDistance()>this.dragThreshold&&(this.state=sn)}preUpdate(t,e){this.isRunning&&this.enable&&this.state===rn&&t-this.pointer.downTime>=this.holdTime&&(this.state=nn)}get isPressed(){return this.state===nn}setHoldTime(t){return this.holdTime=t,this}setDragThreshold(t){return this.dragThreshold=t,this}}const sn="IDLE",rn="BEGIN",nn="RECOGNIZED";Phaser.Utils.Objects.GetValue;const an=Phaser.Math.Distance.Between,hn=Phaser.Math.Angle.Between;var on={getDt:function(){var t;return t=this.scene,qe(t).loop.delta},getVelocity:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return an(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 hn(e.x,e.y,t.x,t.y)}},ln={"up&down":0,"left&right":1,"4dir":2,"8dir":3},dn={};const un=Phaser.Utils.Objects.GetValue,cn=Phaser.Math.RadToDeg;class pn extends Br{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=vn},eventEmitter:!1};this.setRecongizedStateObject(new Es(s)),this.clearDirectionStates()}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(un(t,"threshold",10)),this.setVelocityThreshold(un(t,"velocityThreshold",1e3)),this.setDirectionMode(un(t,"dir","8dir")),this}onDragStart(){this.state=fn}onDragEnd(){this.state=vn}onDrag(){this.state===fn&&(this.validDrag||(this.validDrag=0===this.dragThreshold||this.pointer.getDistance()>=this.dragThreshold),this.validDrag&&this.dragVelocity>this.velocityThreshold&&(this.state=gn))}postUpdate(t,e){this.isRunning&&this.enable&&this.state===gn&&(this.state=vn)}get isSwiped(){return this.state===gn}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=ln[t]),this.dirMode=t,this}updateDirectionStates(){return function(t,e,i){switch(void 0===i?i={}:!0===i&&(i=dn),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(pn.prototype,on);const vn="IDLE",fn="BEGIN",gn="RECOGNIZED",mn=Phaser.Utils.Objects.GetValue,yn=Phaser.Utils.Array.SpliceOne,bn=Phaser.Math.Distance.Between,Cn=Phaser.Math.Angle.Between;class _n{constructor(t,e){var i=He(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(mn(e,"inputConfig",void 0)),this.setEventEmitter(mn(e,"eventEmitter",void 0)),this._enable=void 0,this.pointers=[],this.movedState={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setEnable(mn(t,"enable",!0)),this.bounds=mn(t,"bounds",void 0),this.tracerState=Pn,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 Pn:this.tracerState=wn,this.onDrag1Start();break;case wn: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],yn(this.pointers,e),this.tracerState){case wn:this.tracerState=Pn,this.onDrag1End();break;case xn:this.tracerState=wn,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 wn:this.onDrag1();break;case xn:this.onDrag2()}}}dragCancel(){return this.tracerState===xn&&this.onDrag2End(),this.pointers.length=0,ft(this.movedState),this.tracerState=Pn,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 bn(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 Cn(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;Sn.x=e.x-i.x,Sn.y=e.y-i.y}else Sn.x=0,Sn.y=0;return Sn}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=On,this}isPointer0InGameObject(t,e,i){var s=this.pointers[0];return!!s&&rr(t,s,e,i)}isPointer1InGameObject(t,e,i){var s=this.pointers[1];return!!s&&rr(t,s,e,i)}}Object.assign(_n.prototype,Be);var Sn={};const Pn=0,wn=1,xn=2,On="IDLE";Phaser.Utils.Objects.GetValue;const En=Phaser.Math.RotateAround;var Tn=function(t,e,i,s){return En(t,e,i,s),t.rotation+=s,t},kn={};const Dn=Phaser.Utils.Objects.GetValue,Rn=Phaser.Math.Angle.WrapDegrees,Mn=Phaser.Math.Angle.ShortestBetween,Ln=Phaser.Math.RadToDeg,An=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=kn),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=Rn(Ln(this.angleBetween));this.angle=Mn(this.prevAngle,t),this.prevAngle=t,this.state=Fn}break;case Fn:t=Rn(Ln(this.angleBetween)),this.angle=Mn(this.prevAngle,t),this.prevAngle=t,this.emit("rotate",this)}}get isRotated(){return this.state===Fn}get rotation(){return An(this.angle)}setDragThreshold(t){return this.dragThreshold=t,this}}.prototype,jn);const zn="IDLE",Xn="BEGIN",Fn="RECOGNIZED",Yn=Phaser.Utils.Objects.GetValue;var In=function(t){var e=Yn(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){Dr(i.eventEmitter,`${i.eventNamePrefix}${t.tapsCount}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Nn=Phaser.Utils.Objects.GetValue;var Wn=function(t){var e=Nn(t,"press",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._press=new en(this,e),this._press.on("pressstart",(function(t,e,s){Dr(i.eventEmitter,`${i.eventNamePrefix}pressstart`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this).on("pressend",(function(t,e,s){Dr(i.eventEmitter,`${i.eventNamePrefix}pressend`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Vn=Phaser.Utils.Objects.GetValue;var Bn=function(t){var e=Vn(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 pn(this,e),this._swipe.on("swipe",(function(t,e,s){var r=t.left?"left":t.right?"right":t.up?"up":"down";Dr(i.eventEmitter,`${i.eventNamePrefix}swipe${r}`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Gn=Phaser.Utils.Objects.GetValue;var Un=function(t,e){return t.setInteractive(),Gn(e,"dropZone",!1)&&(t.input.dropZone=!0),t._childrenInteractive={targetSizers:Gn(e,"targets",[t]),targetMode:Gn(e,"targetMode","parent"),eventEmitter:Gn(e,"eventEmitter",t),eventNamePrefix:Gn(e,"inputEventPrefix","child.")},Mr.call(t,e),jr.call(t,e),Fr.call(t,e),Wr.call(t,e),In.call(t,e),Wn.call(t,e),Bn.call(t,e),t},Hn={getSizerConfig:function(t){return void 0===t&&(t=this),Tt(t)},getChildPrevState:function(t){var e=Tt(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=ae(e,"color"),s=ae(e,"lineWidth");var o=ae(e,"name",!1);o&&(r=ae(o,"createTextCallback",oe),n=ae(o,"createTextCallbackScope",void 0),"string"==typeof(a=ae(o,"align","left-top"))&&(a=At[a]))}if(void 0===i&&(i=16777215),void 0===s&&(s=1),r&&!t.children){t.children=new he(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)}}for(var d,u,c=this.getAllShownChildren([this]),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 ia=Phaser.Utils.Objects.IsPlainObject,sa=Phaser.Utils.Objects.GetValue,ra=Phaser.Display.Align.CENTER,na={min:0,full:-1};var aa=function(t,e,i,s,r,n,a,h,o,l){pe.call(this,t);var d=t.isRexSpace,u=typeof e;if(null===e)return this;if("number"===u);else if("string"===u)e=na[e];else if(ia(e)){var c;e=sa(c=e,"proportion",void 0),i=sa(c,"align",ra),s=sa(c,"padding",0),r=sa(c,"expand",!1),n=sa(c,"key",void 0),a=sa(c,"index",void 0),t.isRexSizer||(h=sa(c,"minWidth",void 0),o=sa(c,"minHeight",void 0)),l=sa(c,"fitRatio",0)}return"string"==typeof i&&(i=At[i]),void 0===e&&(e=d?1:0),void 0===i&&(i=ra),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===h&&(d?h=0:t.isRexSizer||(h=t._minWidth)),void 0===o&&(d?o=0:t.isRexSizer||(o=t._minHeight)),void 0===l||!1===l?l=0:!0===l&&(l=Q(t)/tt(t)),(c=this.getSizerConfig(t)).proportion=e,c.align=i,c.padding=ue(s),c.expand=r,c.fitRatio=0===e?l:0,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},ha={add:aa,addSpace(t){return this.insertSpace(void 0,t),this},insertSpace(t,e){return void 0===e&&(e=1),aa.call(this,new ta(this.scene),{proportion:e,minWidth:0,minHeight:0,index:t}),this},insert(t,e,i,s,r,n,a,h){return ia(i)&&(i.index=t),aa.call(this,e,i,s,r,n,a,t,h),this},insertAtPosition(t,e,i,s,r,n,a,h,o){var l=ea.call(this,t,e);return-1===l&&(l=void 0),this.insert(l,i,s,r,n,a,h,o),this}};const oa=Et.prototype.clear;var la=function(t){this.backgroundChildren&&(this.backgroundChildren.length=0);var e,i=!t&&this.sizerEventsEnable;if(i&&(e=this.getChildren([])),oa.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,la.call(this,t),this}},ca={getChildAlign(t){return this.getSizerConfig(t).align},setChildAlign(t,e){return"string"==typeof e&&(e=At[e]),this.getSizerConfig(t).align=e,this}},pa={getChildProportion(t){return this.getSizerConfig(t).proportion},setChildProportion(t,e){return this.getSizerConfig(t).proportion=e,this}},va={getChildExpand(t){return this.getSizerConfig(t).expand},setChildExpand(t,e){return this.getSizerConfig(t).expand=e,this}},fa={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}},ga={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&&(Ie(t,0,0),e.resolved=!1,this.hasRatioFitChild=!0);return this._childrenProportion=void 0,this.hasProportion0Child=!1,this.proportionLength=void 0,Xe.call(this),this},layoutChildren:function(){for(var t,e,i,s,r,n,a,h,o,l,d=this.sizerChildren,u=this.innerLeft,c=this.innerTop,p=this.innerWidth,v=this.innerHeight,f=u,g=c,m=this.startChildIndex,y=0,b=d.length;y0?(e=t-this.getChildrenWidth(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},resolveHeight:function(t){if(void 0!==(t=Le.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)||Re.call(this)},runWidthWrap:function(t){this.wrapResult||(1===this.orientation&&Zn.call(this,t,void 0),Me.call(this,t))},hasHeightWrap:function(){return!(!this.hasRatioFitChild||0!==this.orientation)||Ae.call(this)},runHeightWrap:function(t){this.wrapResult||(0===this.orientation&&Zn.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(ga,ha,ua,ca,pa,va,fa);var ma=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},ya={x:0,h:0,horizontal:0,"left-to-right":0,y:1,v:1,vertical:1,"top-to-bottom":1};const ba=Phaser.Utils.Objects.IsPlainObject,Ca=Phaser.Utils.Objects.GetValue;class _a extends $n{constructor(t,e,i,s,r,n,a){ba(e)?(e=Ca(a=e,"x",0),i=Ca(a,"y",0),s=Ca(a,"width",void 0),r=Ca(a,"height",void 0),n=Ca(a,"orientation",0)):ba(s)?(s=Ca(a=s,"width",void 0),r=Ca(a,"height",void 0),n=Ca(a,"orientation",0)):ba(n)&&(n=Ca(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(Ca(a,"space.item",0)),this.setStartChildIndex(Ca(a,"startChildIndex",0)),this.setRTL(Ca(a,"rtl",!1)),this.addChildrenMap("items",this.sizerChildren)}setOrientation(t){return this.orientation=function(t){return"string"==typeof t&&(t=ya[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=ma.call(this)),this._childrenProportion}}Object.assign(_a.prototype,ga);var Sa=Phaser.Renderer.WebGL.Utils,Pa=function(t,e,i,s,r,n){for(var a=Sa.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+")"},Ta=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 ka=Phaser.Renderer.Canvas.SetTransform;var Da={renderWebGL:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.pipelines.set(e.pipeline),n=Oa(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&&Pa(r,a,e,l,h,o),e.isStroked&&xa(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(ka(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(Ma.prototype,Da);const La=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=La(t,"x",0),i=La(t,"y",0));var s=this.cornerRadius;s.tl=ja(La(t,"tl",void 0),e,i),s.tr=ja(La(t,"tr",void 0),e,i),s.bl=ja(La(t,"bl",void 0),e,i),s.br=ja(La(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 ja=function(t,e,i){return void 0===t?t={x:e,y:i}:"number"==typeof t&&(t={x:t,y:t}),Xa(t),t},za=function(t,e){"number"==typeof e?(t.x=e,t.y=e):(t.x=La(e,"x",0),t.y=La(e,"y",0)),Xa(t)},Xa=function(t){t.convex=t.x>=0||t.y>=0,t.x=Math.abs(t.x),t.y=Math.abs(t.y)},Fa=function(t){return t.x>0&&t.y>0},Ya=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 Ia=Phaser.Math.DegToRad;var Na=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 Nh=Phaser.Utils.Objects.GetValue,Wh=Phaser.Utils.Objects.IsPlainObject;class Vh extends(ph(nh)){constructor(t,e,i,s,r,n,a,h){Wh(e)?(e=(h=e).x,i=h.y,s=h.width,r=h.height,n=h.barColor,a=h.value):Wh(s)?(s=(h=s).width,r=h.height,n=h.barColor,a=h.value):Wh(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 Yh).setName("trackFill")).addShape((new Yh).setName("bar")).addShape((new Yh).setName("trackStroke")),this.setTrackColor(Nh(h,"trackColor",void 0)),this.setBarColor(n),this.setTrackStroke(Nh(h,"trackStrokeThickness",2),Nh(h,"trackStrokeColor",void 0)),this.setSkewX(Nh(h,"skewX",0)),this.setRTL(Nh(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 Bh={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&&Ih(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),Ih(a,r,0,n,i,t));var h=this.getShape("trackStroke");h.lineStyle(this.trackStrokeThickness,this.trackStrokeColor),h.isStroked&&Ih(h,0,0,e,i,t)}};Object.assign(Vh.prototype,Bh);var Gh=function(t){return null==t||""===t||0===t.length},Uh=function(t,e,i,s){if(void 0===s&&(s="."),"object"==typeof t){if(Gh(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(Gh(e));else{var r;"string"==typeof e&&(e=e.split("."));for(var n=0,a=e.length;nuo(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}const co=Phaser.Utils.Objects.IsPlainObject,po=Phaser.Utils.Objects.GetValue;var vo=function(t){return"string"==typeof t&&(t=fo[t]),t};const fo={scale:0,repeat:1};var go=function(t,e){return 0===t||t===this.columns.count-1||0===e||e===this.rows.count-1},mo={_beginDraw:jt,_drawImage:jt,_drawTileSprite:jt,_endDraw:jt,setGetFrameNameCallback:function(t){return void 0===t&&(t=lo),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=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),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 co(t)?(this.stretchMode.edge=vo(po(t,"edge",0)),this.stretchMode.internal=vo(po(t,"internal",0))):(t=vo(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 yo=Phaser.Utils.Objects.IsPlainObject,bo=Phaser.Utils.Objects.GetValue,Co=Phaser.GameObjects;var _o=void 0,So=function(t,e){if(_o||(_o={},qe(t).events.once("destroy",(function(){for(var t in _o)_o[t].destroy();_o=void 0}))),!_o.hasOwnProperty(e)){var i=qe(t).scene.systemScene;(t=new Co[e](i)).setOrigin(0),_o[e]=t}return _o[e]};const Po=Phaser.GameObjects.RenderTexture;class wo extends(function(t,e){class i extends t{constructor(t,i,s,r,n,a,h,o,l,d){if(yo(i)?(i=bo(d=i,"x",0),s=bo(d,"y",0),r=bo(d,"width",1),n=bo(d,"height",1),a=bo(d,"key",void 0),h=bo(d,"baseFrame",void 0),o=bo(d,"columns",void 0),l=bo(d,"rows",void 0)):yo(r)?(r=bo(d=r,"width",1),n=bo(d,"height",1),a=bo(d,"key",void 0),h=bo(d,"baseFrame",void 0),o=bo(d,"columns",void 0),l=bo(d,"rows",void 0)):yo(a)?(a=bo(d=a,"key",void 0),h=bo(d,"baseFrame",void 0),o=bo(d,"columns",void 0),l=bo(d,"rows",void 0)):yo(h)?(h=bo(d=h,"baseFrame",void 0),o=bo(d,"columns",void 0),l=bo(d,"rows",void 0)):Array.isArray(h)?(d=l,l=o,o=h,h=bo(d,"baseFrame",void 0)):yo(o)&&(o=bo(d=o,"columns",void 0),l=bo(d,"rows",void 0)),void 0===h&&(h=bo(d,"frame",void 0)),void 0===o){var u=bo(d,"leftWidth",void 0),c=bo(d,"rightWidth",void 0);void 0!==u&&void 0!==c&&(o=[u,void 0,c])}if(void 0===l){var p=bo(d,"topHeight",void 0),v=bo(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(bo(d,"getFrameNameCallback",void 0)),this.setStretchMode(bo(d,"stretchMode",0)),this.setPreserveRatio(bo(d,"preserveRatio",!0));var f=bo(d,"maxFixedPartScale",1),g=bo(d,"maxFixedPartScaleX",f),m=bo(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,mo),i}(Po,"rexNinePatch")){}var xo={_drawImage:function(t,e,i,s,r,n){var a=So(this,"Image").setTexture(t,e).setDisplaySize(r,n);this.draw(a,i,s)},_drawTileSprite:function(t,e,i,s,r,n){var a=So(this,"TileSprite").setTexture(t,e).setSize(r,n);this.draw(a,i,s)}};Object.assign(wo.prototype,xo);class Oo extends Ze{constructor(t,e){return super(t),new Proxy(this,this)}get(t,e){if($h(t,e))return t[e];var i=t.parent;return $h(i,e)?i[e]:void 0}set(t,e,i){return $h(t,e)?t[e]=i:$h(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 Eo=Phaser.Utils.Objects.GetValue;class To extends wo{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexStatesNinePatch";var i=Eo(e,"effects",!0);i&&to(this,i),this.style=new Oo(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign(To.prototype,Ka);const ko=["alpha","tint","flipX","flipY"];var Do=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 Hh(t,e);break;case"image":s=new oo(t,e);break;case"nineSlice":s=e.hasOwnProperty("stretchMode")?new To(t,e):new ro(t,e);break;default:s=new Za(t,e)}return function(t,e){if(!e)return t;for(var i=0,s=ko.length;i 0) && (radius.y > 0)); + }; + var LineTo = function (x, y, pathData) { var cnt = pathData.length; if (cnt >= 2) { @@ -22073,8 +22077,7 @@ geom.setTo(0, 0, width, height, radius); } - var iteration = GetValue$A(radiusConfig, 'iteration', undefined); - this.setIteration(iteration); + this.setIteration(GetValue$A(radiusConfig, 'iteration', undefined)); this.setPosition(x, y); this.setFillStyle(fillColor, fillAlpha); @@ -22327,10 +22330,6 @@ } - var IsArcCorner = function (radius) { - return ((radius.x > 0) && (radius.y > 0)); - }; - const ShapeTypeMap = { rectangle: 0, circle: 1 @@ -23844,6 +23843,7 @@ var skewX = this.skewX; var width = this.width - Math.abs(skewX); var height = this.height; + var trackFill = this.getShape('trackFill'); trackFill.fillStyle(this.trackColor); if (trackFill.isFilled) { @@ -23852,8 +23852,7 @@ 0, 0, // x0, y0 width, height, // x1, y1 skewX // skewX - ) - .close(); + ); } var bar = this.getShape('bar'); @@ -23873,8 +23872,7 @@ barX0, 0, // x0, y0 barX1, height, // x1, y1 skewX // skew - ) - .close(); + ); } var trackStroke = this.getShape('trackStroke'); @@ -23885,8 +23883,7 @@ 0, 0, // x0, y0 width, height, // x1, y1 skewX // skewX - ) - .end(); + ); } }; @@ -23906,6 +23903,8 @@ .lineTo(x0, y0).lineTo(startX, y0); } + lines.close(); + return lines; }; @@ -23916,24 +23915,33 @@ constructor(scene, x, y, width, height, barColor, value, config) { if (IsPlainObject$7(x)) { config = x; - x = GetValue$x(config, 'x', 0); - y = GetValue$x(config, 'y', 0); - width = GetValue$x(config, 'width', 2); - height = GetValue$x(config, 'height', 2); - barColor = GetValue$x(config, 'barColor', undefined); - value = GetValue$x(config, 'value', 0); + + x = config.x; + y = config.y; + width = config.width; + height = config.height; + barColor = config.barColor; + value = config.value; } else if (IsPlainObject$7(width)) { config = width; - width = GetValue$x(config, 'width', 2); - height = GetValue$x(config, 'height', 2); - barColor = GetValue$x(config, 'barColor', undefined); - value = GetValue$x(config, 'value', 0); + + width = config.width; + height = config.height; + barColor = config.barColor; + value = config.value; } else if (IsPlainObject$7(barColor)) { config = barColor; - barColor = GetValue$x(config, 'barColor', undefined); - value = GetValue$x(config, 'value', 0); + + barColor = config.barColor; + value = config.value; } + if (x === undefined) { x = 0; } + if (y === undefined) { y = 0; } + if (width === undefined) { width = 2; } + if (height === undefined) { height = width; } + if (value === undefined) { value = 0; } + super(scene, x, y, width, height, config); this.type = 'rexLineProgress'; diff --git a/dist/rexsimpledropdownlist.min.js b/dist/rexsimpledropdownlist.min.js index f185dc2bf6..18fccfbc51 100644 --- a/dist/rexsimpledropdownlist.min.js +++ b/dist/rexsimpledropdownlist.min.js @@ -1,4 +1,4 @@ -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 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}},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}},Pe=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 _e=/(\S+)\[(\d+)\]/i,Te=Phaser.Utils.Objects.GetValue;var Ee=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=Te(e,"left",0),t.right=Te(e,"right",0),t.top=Te(e,"top",0),t.bottom=Te(e,"bottom",0)),t},Re={getInnerPadding(t){return Ee(this.space,t)},setInnerPadding(t,e){return Me(this.space,t,e),this},getOuterPadding(t){return Ee(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)),Ee(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}},De=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},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}},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},Xe=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}},Be=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:vi,this.repeatCounter=0,this}stop(){return this.state=pi,this}update(t,e){this.state!==pi&&this.state!==mi&&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=fi)):(this.nowTime=this.duration,this.state=mi):this.nowTime>=0&&(this.state=gi))}get t(){var t;switch(this.state){case pi:case vi:case fi:t=0;break;case gi:t=this.nowTime/this.duration;break;case mi:t=1}return ci(t,0,1)}set t(t){(t=ci(t,-1,1))<0?(this.state=vi,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===pi}get isDelay(){return this.state===vi}get isCountDown(){return this.state===gi}get isRunning(){return this.state===vi||this.state===gi}get isDone(){return this.state===mi}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}}const pi=0,vi=1,gi=2,fi=3,mi=-1;class yi extends oi{constructor(t,e){super(t,e),this.timer=new ui}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 bi=Phaser.Utils.Objects.GetValue,xi=Phaser.Utils.Objects.GetAdvancedValue,Ci=Phaser.Tweens.Builders.GetEaseFunction;class Si extends yi{resetFromJSON(t){return this.timer.resetFromJSON(bi(t,"timer")),this.setEnable(bi(t,"enable",!0)),this.setTarget(bi(t,"target",this.parent)),this.setDelay(xi(t,"delay",0)),this.setDuration(xi(t,"duration",1e3)),this.setEase(bi(t,"ease","Linear")),this.setRepeat(bi(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 wi=Phaser.Utils.Objects.GetValue,Oi=Phaser.Utils.Objects.GetAdvancedValue,ki=Phaser.Math.Linear;let Pi=class extends Si{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=_i[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=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 _i={stop:0,destroy:1,yoyo:2};var Ti=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 Pi(t,a):r.resetFromJSON(a),r.restart(),r},Ei=function(t,e,i,s,r,n){void 0===s&&(s="Linear"),r instanceof Pi&&(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 Pi(t,h):n.resetFromJSON(h),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 Di={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=Ti(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=Ei(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 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 Pi(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),Ri(this._scaleBehavior)},isRunningScaleYoyo(){return this._scaleBehavior&&(this._scaleBehavior.completeEventName="scaleyoyo.complete")},isRunningEaseScale(){return this.isRunningPopUp()||this.isRunningScaleDown()||this.isRunningScaleYoyo()}},Yi={};Object.assign(Yi,Di),Yi.onInitScale=function(){Di.onInitScale.call(this);var t=this;this._scaleBehavior.on("update",(function(){var e=ye.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const Ai=Phaser.Utils.Objects.GetValue,zi=Phaser.Utils.Objects.GetAdvancedValue,Xi=Phaser.Math.Linear;class Wi extends Si{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(zi(t,"start",this.parent.alpha),zi(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=Bi[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=Xi(this.alphaStart,this.alphaEnd,i)}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Bi={stop:0,destroy:1,yoyo:2},ji=Phaser.Utils.Objects.IsPlainObject;var Ii=function(t,e,i,s){var r,n;ji(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},Fi=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=Ii(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(Hi(t)){var i=t;t=i.duration,e=i.destroy}var s=void 0===this._fade;return this._fade=Fi(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()}},Ni={};Object.assign(Ni,Gi),Ni.onInitFade=function(){Gi.onInitFade.call(this);var t=this;this._fade.on("update",(function(){var e=ye.getParentSizer(t);e&&e.resetChildAlphaState(t)}))};const Vi=Phaser.Utils.Objects.GetValue,Ui=Phaser.Utils.Objects.GetAdvancedValue,$i=Phaser.Math.Linear;class Ji extends Si{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){if(super.resetFromJSON(t),this.setMode(Vi(t,"mode",0)),t&&(t.hasOwnProperty("x")||t.hasOwnProperty("y"))){var e=Ui(t,"x",void 0),i=Ui(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=Ui(i,"startX",void 0),this.startY=Ui(i,"startY",void 0),this.endX=Ui(i,"endX",void 0),this.endY=Ui(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 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 Zi=Phaser.Utils.Objects.IsPlainObject,Qi=Phaser.Math.Distance.Between;var ts={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(Zi(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*Qi(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 Ji&&(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 Ji(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),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(Zi(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*Qi(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 Ji&&(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 Ji(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),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}},es={};Object.assign(es,ts),es.onInitEaseMove=function(){ts.onInitEaseMove.call(this);var t=this;this._easeMove.on("update",(function(){var e=ye.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const is=Phaser.Utils.Objects.GetValue;class ss extends ni{constructor(t,e){super(t,e),this.timer=new ui,this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.timer.resetFromJSON(is(t,"timer")),this.setEnable(is(t,"enable",!0)),this.setMode(is(t,"mode",1)),this.isRunning=is(t,"isRunning",!1),this.setMagnitudeMode(is(t,"magnitudeMode",1)),this.setAxisMode(is(t,"axis",0)),this.setDuration(is(t,"duration",500)),this.setMagnitude(is(t,"magnitude",10)),this.ox=is(t,"ox",void 0),this.oy=is(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=rs[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=ns[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=is(i,"magnitude",void 0),t=is(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 rs={effect:0,behavior:1},ns={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},as=Phaser.Utils.Objects.IsPlainObject;var os={shake(t,e,i){if(as(t)){var s=t;t=s.duration,e=s.magnitude,i=s.magnitudeMode}return void 0===this._shake&&(this._shake=new ss(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 ls=Phaser.Utils.Objects.GetValue,ds=Phaser.Math.Linear;class cs extends Si{constructor(t,e){super(t,e),this.resetFromJSON(),this.boot()}start(t){if(this.timer.isRunning)return this;var e=this.target;this.propertyKey=ls(t,"key","value");var i=e[this.propertyKey];return this.fromValue=ls(t,"from",i),this.toValue=ls(t,"to",i),this.setEase(ls(t,"ease",this.ease)),this.setDuration(ls(t,"duration",this.duration)),this.setRepeat(ls(t,"repeat",0)),this.setDelay(ls(t,"delay",0)),this.setRepeatDelay(ls(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]=ds(this.fromValue,this.toValue,i)}}const us=Phaser.Utils.Objects.IsPlainObject;class ps extends ti{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(us(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(us(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 vs={easeDataTo(t,e,i,s){return this._easeData||(this._easeData=new ps(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,fs={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=Je(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}},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}},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,Ys,As,zs,Xs);const Bs=Phaser.Utils.Objects.GetValue;class js extends ti{constructor(t,e){super(t,e),this.setTransitInTime(Bs(e,"duration.in",200)),this.setTransitOutTime(Bs(e,"duration.out",200)),this.setTransitInCallback(Bs(e,"transitIn")),this.setTransitOutCallback(Bs(e,"transitOut")),this.oneShotMode=Bs(e,"destroy",!1),this.delayCallTimer=void 0,this._state=new Ds(this,{eventEmitter:!1,initState:Bs(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,Ws);var Is=function(t){if(t.parentContainer)return Is(t.parentContainer);var e=function(t){var e=t.displayList;return U(e)?e:null}(t);return e?Is(e):t};class Fs extends ti{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 Hs=Phaser.GameObjects.Rectangle;class Gs extends Hs{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 Vs extends ti{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=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 $s=Phaser.Utils.Objects.GetValue;class Js extends Gs{constructor(t,e){super(t,$s(e,"color",0),$s(e,"alpha",.8)),this.touchEventStop=new Vs(this,{hitAreaMode:1})}}var Ks={popUp(t,e){void 0!==t._modalScaleSave?(t.scaleX=t._modalScaleSave,t.scaleY=t._modalScaleSave):t._modalScaleSave=t.scaleX,Ti(t,e)},scaleDown(t,e){Ei(t,e,void 0,void 0,!1)},fadeIn(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Ii(t,e)},fadeOut(t,e){Fi(t,e,!1)}},qs=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Ii(t,e,t.alpha)},Zs=function(t,e){Fi(t,e,!1)},Qs=function(t,e,i,s,r){return!(!t||s&&!s(t,e,i)||!rt(t,!0).contains(e,i)||r&&!r(t,e,i))};const tr=Phaser.Utils.Objects.GetValue;let er=class extends js{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",qs)),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=Ks.popUp;break;case ir.fadeIn:t=Ks.fadeIn}return super.setTransitInCallback(t),this}setTransitOutCallback(t){switch("string"==typeof t&&(t=ir[t]),t){case ir.scaleDown:t=Ks.scaleDown;break;case ir.fadeOut:t=Ks.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 xr(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)||!Or(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 Pr=Phaser.Utils.Objects.GetValue;class _r extends ti{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=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?wr: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 Tr={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 _r(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 Ls{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 Rr=Phaser.Utils.Objects.GetValue;class Lr extends ti{constructor(t,e){super(t,e),this._enable=void 0,this.cooldown=new Mr,this.parent.setInteractive(Rr(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.prevIsInTouch=!1,this.isInTouching=!1,this.setEnable(Rr(t,"enable",!0)),this.setCooldown(Rr(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&&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 Lr(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 Lr(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}},Ar=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===Zr&&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=Qr,this}isPointerInGameObject(t,e,i){var s=this.lastPointer;return!!s&&lr(t,s,e,i)}}const qr=0,Zr=1,Qr="IDLE",tn=Phaser.Utils.Objects.GetValue,en=Phaser.Math.Distance.Between;class sn extends Kr{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=rn},eventEmitter:!1};this.setRecongizedStateObject(new Ls(s))}resetFromJSON(t){super.resetFromJSON(t),this.setHoldTime(tn(t,"time",250)),this.setTapInterval(tn(t,"tapInterval",200)),this.setDragThreshold(tn(t,"threshold",9)),this.setTapOffset(tn(t,"tapOffset",10));var e=tn(t,"taps",void 0);return void 0!==e?this.setTaps(e):(this.setMaxTaps(tn(t,"maxTaps",void 0)),this.setMinTaps(tn(t,"minTaps",void 0))),this}onDragStart(){switch(this.state){case rn:this.state=nn;break;case nn:var t=this.lastPointer;en(t.upX,t.upY,t.x,t.y)>this.tapOffset&&(this.state=hn,this.state=nn);break;case hn:this.state=nn}}onDragEnd(){this.state===nn&&(this.tapsCount++,this.emit("tapping",this,this.gameObject,this.lastPointer),void 0!==this.maxTaps&&this.tapsCount===this.maxTaps&&(this.state=hn))}onDrag(){this.state!==rn&&this.pointer.getDistance()>this.dragThreshold&&(this.state=rn)}preUpdate(t,e){if(this.isRunning&&this.enable&&this.state===nn){var i=this.lastPointer;i.isDown?t-i.downTime>this.holdTime&&(this.state=rn):t-i.upTime>this.tapInterval&&(void 0===this.minTaps||this.tapsCount>=this.minTaps?this.state=hn:this.state=rn)}}postUpdate(t,e){this.isRunning&&this.enable&&this.state===hn&&(this.state=rn)}get isTapped(){return this.state===hn}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 rn="IDLE",nn="BEGIN",hn="RECOGNIZED",an=Phaser.Utils.Objects.GetValue;class on extends Kr{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=ln},eventEmitter:!1};this.setRecongizedStateObject(new Ls(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(an(t,"threshold",9)),this.setHoldTime(an(t,"time",251)),this}onDragStart(){this.state=dn,0===this.holdTime&&(this.state=cn)}onDragEnd(){this.state=ln}onDrag(){this.state!==ln&&this.pointer.getDistance()>this.dragThreshold&&(this.state=ln)}preUpdate(t,e){this.isRunning&&this.enable&&this.state===dn&&t-this.pointer.downTime>=this.holdTime&&(this.state=cn)}get isPressed(){return this.state===cn}setHoldTime(t){return this.holdTime=t,this}setDragThreshold(t){return this.dragThreshold=t,this}}const ln="IDLE",dn="BEGIN",cn="RECOGNIZED";Phaser.Utils.Objects.GetValue;var un=function(t){return Ze(t).loop.delta};const pn=Phaser.Math.Distance.Between,vn=Phaser.Math.Angle.Between;var gn={getDt:function(){return un(this.scene)},getVelocity:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return pn(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 vn(e.x,e.y,t.x,t.y)}},fn={"up&down":0,"left&right":1,"4dir":2,"8dir":3},mn={};const yn=Phaser.Utils.Objects.GetValue,bn=Phaser.Math.RadToDeg;class xn extends Kr{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 Ls(s)),this.clearDirectionStates()}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(yn(t,"threshold",10)),this.setVelocityThreshold(yn(t,"velocityThreshold",1e3)),this.setDirectionMode(yn(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=wn))}postUpdate(t,e){this.isRunning&&this.enable&&this.state===wn&&(this.state=Cn)}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=fn[t]),this.dirMode=t,this}updateDirectionStates(){return function(t,e,i){switch(void 0===i?i={}:!0===i&&(i=mn),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}}(bn(this.getVelocityAngle()),this.dirMode,this),this}clearDirectionStates(){return this.left=!1,this.right=!1,this.up=!1,this.down=!1,this}}Object.assign(xn.prototype,gn);const Cn="IDLE",Sn="BEGIN",wn="RECOGNIZED",On=Phaser.Utils.Objects.GetValue,kn=Phaser.Utils.Array.SpliceOne,Pn=Phaser.Math.Distance.Between,_n=Phaser.Math.Angle.Between;class Tn{constructor(t,e){var i=Je(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(On(e,"inputConfig",void 0)),this.setEventEmitter(On(e,"eventEmitter",void 0)),this._enable=void 0,this.pointers=[],this.movedState={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setEnable(On(t,"enable",!0)),this.bounds=On(t,"bounds",void 0),this.tracerState=Mn,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 Mn:this.tracerState=Rn,this.onDrag1Start();break;case Rn:this.tracerState=Ln,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 Rn:this.tracerState=Mn,this.onDrag1End();break;case Ln:this.tracerState=Rn,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 Rn:this.onDrag1();break;case Ln:this.onDrag2()}}}dragCancel(){return this.tracerState===Ln&&this.onDrag2End(),this.pointers.length=0,ft(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!==Ln)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!==Ln)return 0;var t=this.pointers[0],e=this.pointers[1];return _n(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!==Ln)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.x+e.x)/2}get centerY(){if(this.tracerState!==Ln)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.y+e.y)/2}get prevCenterX(){if(this.tracerState!==Ln)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!==Ln)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&&lr(t,s,e,i)}isPointer1InGameObject(t,e,i){var s=this.pointers[1];return!!s&&lr(t,s,e,i)}}Object.assign(Tn.prototype,Ve);var En={};const Mn=0,Rn=1,Ln=2,Dn="IDLE";Phaser.Utils.Objects.GetValue;const Yn=Phaser.Math.RotateAround;var An=function(t,e,i,s){return Yn(t,e,i,s),t.rotation+=s,t},zn={};const Xn=Phaser.Utils.Objects.GetValue,Wn=Phaser.Math.Angle.WrapDegrees,Bn=Phaser.Math.Angle.ShortestBetween,jn=Phaser.Math.RadToDeg,In=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=zn),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=Wn(jn(this.angleBetween));this.angle=Bn(this.prevAngle,t),this.prevAngle=t,this.state=Nn}break;case Nn:t=Wn(jn(this.angleBetween)),this.angle=Bn(this.prevAngle,t),this.prevAngle=t,this.emit("rotate",this)}}get isRotated(){return this.state===Nn}get rotation(){return In(this.angle)}setDragThreshold(t){return this.dragThreshold=t,this}}.prototype,Fn);const Hn="IDLE",Gn="BEGIN",Nn="RECOGNIZED",Vn=Phaser.Utils.Objects.GetValue;var Un=function(t){var e=Vn(t,"tap",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._tap=new sn(this,e),this._tap.on("tap",(function(t,e,s){zr(i.eventEmitter,`${i.eventNamePrefix}${t.tapsCount}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const $n=Phaser.Utils.Objects.GetValue;var Jn=function(t){var e=$n(t,"press",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._press=new on(this,e),this._press.on("pressstart",(function(t,e,s){zr(i.eventEmitter,`${i.eventNamePrefix}pressstart`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this).on("pressend",(function(t,e,s){zr(i.eventEmitter,`${i.eventNamePrefix}pressend`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Kn=Phaser.Utils.Objects.GetValue;var qn=function(t){var e=Kn(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 xn(this,e),this._swipe.on("swipe",(function(t,e,s){var r=t.left?"left":t.right?"right":t.up?"up":"down";zr(i.eventEmitter,`${i.eventNamePrefix}swipe${r}`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Zn=Phaser.Utils.Objects.GetValue;var Qn=function(t,e){return t.setInteractive(),Zn(e,"dropZone",!1)&&(t.input.dropZone=!0),t._childrenInteractive={targetSizers:Zn(e,"targets",[t]),targetMode:Zn(e,"targetMode","parent"),eventEmitter:Zn(e,"eventEmitter",t),eventNamePrefix:Zn(e,"inputEventPrefix","child.")},Wr.call(t,e),Ir.call(t,e),Gr.call(t,e),$r.call(t,e),Un.call(t,e),Jn.call(t,e),qn.call(t,e),t},th={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",de),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)}}for(var d,c,u=this.getAllShownChildren([this]),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 lh=Phaser.Utils.Objects.IsPlainObject,dh=Phaser.Utils.Objects.GetValue,ch=Phaser.Display.Align.CENTER,uh={min:0,full:-1};var ph=function(t,e,i,s,r,n,h,a,o,l){ge.call(this,t);var d=t.isRexSpace,c=typeof e;if(null===e)return this;if("number"===c);else if("string"===c)e=uh[e];else if(lh(e)){var u;e=dh(u=e,"proportion",void 0),i=dh(u,"align",ch),s=dh(u,"padding",0),r=dh(u,"expand",!1),n=dh(u,"key",void 0),h=dh(u,"index",void 0),t.isRexSizer||(a=dh(u,"minWidth",void 0),o=dh(u,"minHeight",void 0)),l=dh(u,"fitRatio",0)}return"string"==typeof i&&(i=zt[i]),void 0===e&&(e=d?1:0),void 0===i&&(i=ch),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===a&&(d?a=0:t.isRexSizer||(a=t._minWidth)),void 0===o&&(d?o=0:t.isRexSizer||(o=t._minHeight)),void 0===l||!1===l?l=0:!0===l&&(l=Q(t)/tt(t)),(u=this.getSizerConfig(t)).proportion=e,u.align=i,u.padding=pe(s),u.expand=r,u.fitRatio=0===e?l:0,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},vh={add:ph,addSpace(t){return this.insertSpace(void 0,t),this},insertSpace(t,e){return void 0===e&&(e=1),ph.call(this,new ah(this.scene),{proportion:e,minWidth:0,minHeight:0,index:t}),this},insert(t,e,i,s,r,n,h,a){return lh(i)&&(i.index=t),ph.call(this,e,i,s,r,n,h,t,a),this},insertAtPosition(t,e,i,s,r,n,h,a,o){var l=oh.call(this,t,e);return-1===l&&(l=void 0),this.insert(l,i,s,r,n,h,a,o),this}};const gh=Et.prototype.clear;var fh=function(t){this.backgroundChildren&&(this.backgroundChildren.length=0);var e,i=!t&&this.sizerEventsEnable;if(i&&(e=this.getChildren([])),gh.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,fh.call(this,t),this}},bh={getChildAlign(t){return this.getSizerConfig(t).align},setChildAlign(t,e){return"string"==typeof e&&(e=zt[e]),this.getSizerConfig(t).align=e,this}},xh={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}},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&&(Fe(t,0,0),e.resolved=!1,this.hasRatioFitChild=!0);return this._childrenProportion=void 0,this.hasProportion0Child=!1,this.proportionLength=void 0,Be.call(this),this},layoutChildren:function(){for(var t,e,i,s,r,n,h,a,o,l,d=this.sizerChildren,c=this.innerLeft,u=this.innerTop,p=this.innerWidth,v=this.innerHeight,g=c,f=u,m=this.startChildIndex,y=0,b=d.length;y0?(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)||De.call(this)},runWidthWrap:function(t){this.wrapResult||(1===this.orientation&&nh.call(this,t,void 0),Ye.call(this,t))},hasHeightWrap:function(){return!(!this.hasRatioFitChild||0!==this.orientation)||ze.call(this)},runHeightWrap:function(t){this.wrapResult||(0===this.orientation&&nh.call(this,void 0,t),Xe.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,vh,yh,bh,xh,Ch,Sh);var Oh=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},Ph=function(t){return"string"==typeof t&&(t=kh[t]),t};const _h=Phaser.Utils.Objects.IsPlainObject,Th=Phaser.Utils.Objects.GetValue;class Eh extends ih{constructor(t,e,i,s,r,n,h){_h(e)?(e=Th(h=e,"x",0),i=Th(h,"y",0),s=Th(h,"width",void 0),r=Th(h,"height",void 0),n=Th(h,"orientation",0)):_h(s)?(s=Th(h=s,"width",void 0),r=Th(h,"height",void 0),n=Th(h,"orientation",0)):_h(n)&&(n=Th(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(Th(h,"space.item",0)),this.setStartChildIndex(Th(h,"startChildIndex",0)),this.setRTL(Th(h,"rtl",!1)),this.addChildrenMap("items",this.sizerChildren)}setOrientation(t){return this.orientation=Ph(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=Oh.call(this)),this._childrenProportion}}Object.assign(Eh.prototype,wh);var Mh=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}},Rh=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},Lh={appendText:Rh,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 Dh extends Eh{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&&(Mh(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&&(Mh(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&&Mh(t,this.iconWidth,this.iconHeight);var e=this.childrenMap.action;e&&void 0!==this.actionWidth&&void 0!==this.actionHeight&&Mh(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(Dh.prototype,Lh);var Yh=function(t,e,i,s,r){if(this.clear().fillStyle(16777215),1===this.shapeType){i=i.left;var n=Math.min(t,e)/2;this.fillCircle(-t*(s-.5),-e*(r-.5),n+i)}else this.fillRect(-t*s-i.left,-e*r-i.top,t+i.left+i.right,e+i.top+i.bottom)},Ah=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};const zh=Phaser.GameObjects.Graphics;class Xh extends zh{constructor(t,e,i){void 0===e&&(e=0),"string"==typeof e&&(e=Wh[e]),super(t.scene),this.parent=t,this.shapeType=e,this.padding=pe(i),this.setPosition().resize().setVisible(!1)}destroy(){return this.parent=void 0,super.destroy(),this}setPosition(t,e){var i=this.parent;return void 0===t&&(t=i.x),void 0===e&&(e=i.y),super.setPosition(t,e),this}resize(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=pe(i));var r=this.width!==t||this.height!==e,n=this.padding!==i&&!Ah(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,Yh.call(this,t,e,i,s.originX,s.originY),this):this}setOrigin(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,Yh.call(this,this.width,this.height,this.padding,t,e)),this}}const Wh={rectangle:0,circle:1};var Bh=function(t,e,i,s){var r=new Xh(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 jh=Phaser.GameObjects.Text;var Ih=function(t){return t instanceof jh};const Fh=Phaser.GameObjects.BitmapText;var Hh=function(t){return t instanceof Fh},Gh=function(t){return Hh(t)?2:Ih(t)?0:1},Nh=/^[\x00-\x7F]+$/,Vh=function(t){return Nh.test(t)},Uh=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},Jh=0,Kh=1,qh=2,Zh=0,Qh=1,ta=2,ea=/(?:\r\n|\r|\n)/;const ia={none:Zh,word:Qh,char:ta,character:ta,mix:3},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=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)},oa={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,aa(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 la=Phaser.Display.Canvas.CanvasPool,da=Phaser.GameObjects.GameObject,ca=Phaser.Utils.String.UUID;class ua extends da{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=la.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=ca(),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(){la.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 pa=Phaser.GameObjects.Components;Phaser.Class.mixin(ua,[pa.Alpha,pa.BlendMode,pa.Crop,pa.Depth,pa.Flip,pa.GetBounds,pa.Mask,pa.Origin,pa.Pipeline,pa.PostPipeline,pa.ScrollFactor,pa.Tint,pa.Transform,pa.Visible,ra,ha,oa]);var va={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 ga{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(ga.prototype,va);var fa={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 ma=Phaser.Math.RotateAround;var ya;const ba=Phaser.Geom.Rectangle;var xa,Ca=function(t){void 0===xa&&(xa=new ba);var e=t.drawTLX,i=t.drawTLY;return xa.setTo(e,i,t.drawTRX-e,t.drawBLY-i),xa};const Sa=Phaser.Math.RotateAround;var wa,Oa=function(t,e,i,s){return void 0===s?s={}:!0===s&&(void 0===wa&&(wa={}),s=wa),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 ka=Phaser.GameObjects.Components.TransformMatrix;var Pa,_a,Ta={},Ea=function(t,e,i,s,r){var n=Oa(e,i,s,!0),h=function(t,e,i,s){void 0===s?s={}:!0===s&&(s=Ta);var r=e-t.width*t.originX,n=i-t.height*t.originY;return void 0===Pa&&(Pa=new ka,_a=new ka),t.parentContainer?t.getWorldTransformMatrix(Pa,_a):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},Ma=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 Ea(t,e,n,h,r)},Ra={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===ya&&(ya={}),s=ya),s.x=(t-i.drawX)/i.scaleX,s.y=(e-i.drawY)/i.scaleY,0!==i.rotation&&ma(s,0,0,-i.rotation),s}(t,e,this,!0);return Ca(this).contains(i.x,i.y)},getWorldPosition:function(t,e,i){return Ma(this.parent,this,t,e,i)}};Object.assign(Ra,fa);const La=Phaser.Math.DegToRad,Da=Phaser.Math.RadToDeg,Ya=Phaser.Utils.Objects.GetValue;class Aa extends ga{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 Da(this._rotation)}set angle(t){this.rotation=La(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(Aa.prototype,Ra);const za=Phaser.Utils.String.Pad;var Xa=function(t,e,i){if(null==t)return t;switch(typeof t){case"string":default:return t;case"number":return`#${za(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}},Wa=function(t,e,i){return e.hasOwnProperty(t)?e[t]:i[t]};const Ba=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=Ba(t,"x",0),i=Ba(t,"y",0));var s=this.cornerRadius;s.tl=Ia(Ba(t,"tl",void 0),e,i),s.tr=Ia(Ba(t,"tr",void 0),e,i),s.bl=Ia(Ba(t,"bl",void 0),e,i),s.br=Ia(Ba(t,"br",void 0),e,i)}get radiusTL(){var t=this.cornerRadius.tl;return Math.max(t.x,t.y)}set radiusTL(t){Fa(this.cornerRadius.tl,t)}get radiusTR(){var t=this.cornerRadius.tr;return Math.max(t.x,t.y)}set radiusTR(t){Fa(this.cornerRadius.tr,t)}get radiusBL(){var t=this.cornerRadius.bl;return Math.max(t.x,t.y)}set radiusBL(t){Fa(this.cornerRadius.bl,t)}get radiusBR(){var t=this.cornerRadius.br;return Math.max(t.x,t.y)}set radiusBR(t){Fa(this.cornerRadius.br,t)}};var Ia=function(t,e,i){return void 0===t?t={x:e,y:i}:"number"==typeof t&&(t={x:t,y:t}),Ha(t),t},Fa=function(t,e){"number"==typeof e?(t.x=e,t.y=e):(t.x=Ba(e,"x",0),t.y=Ba(e,"y",0)),Ha(t)},Ha=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 Na=function(t){return!t.hasOwnProperty("convex")||t.convex},Va=function(t){return t.x>0&&t.y>0},Ua=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,Na(a)?Ua(t,o,l,o,l,180,270,!1,h):Ua(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,Na(a)?Ua(t,s-o,l,o,l,270,360,!1,h):Ua(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,Na(a)?Ua(t,s-o,r-l,o,l,0,90,!1,h):Ua(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,Na(a)?Ua(t,o,r-l,o,l,90,180,!1,h):Ua(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())},Ja=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),$a(t.canvas,t.context,d,d,o,l,r,e,i,s,n,h,a)}};const Ka=Phaser.Utils.Objects.GetValue;class qa extends Aa{constructor(t,e){super(t,"background"),this.setScrollFactor(0),this.setColor(Ka(e,"color",null),Ka(e,"color2",null),Ka(e,"horizontalGradient",!0)),this.setStroke(Ka(e,"stroke",null),Ka(e,"strokeThickness",2)),this.setCornerRadius(Ka(e,"cornerRadius",0),Ka(e,"cornerIteration",null))}set color(t){t=Xa(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=Xa(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=Xa(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,Wa("color2",t,this),Wa("horizontalGradient",t,this)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,Wa("strokeThickness",t,this)),t.hasOwnProperty("cornerRadius")&&this.setCornerRadius(t.cornerRadius,Wa("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(){Ja(this.parent,this.color,this.stroke,this.strokeThickness,this.cornerRadius,this.color2,this.horizontalGradient,this.cornerIteration)}}const Za=Phaser.Utils.Objects.GetValue;class Qa extends Aa{constructor(t,e){super(t,"innerbounds"),this.setScrollFactor(0),this.setColor(Za(e,"color",null),Za(e,"color2",null),Za(e,"horizontalGradient",!0)),this.setStroke(Za(e,"stroke",null),Za(e,"strokeThickness",2))}set color(t){t=Xa(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=Xa(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=Xa(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,Za(t,"color2",null),Za(t,"horizontalGradient",!0)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,Za(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 to=Phaser.Utils.Objects.GetValue;let eo=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(to(t,"bold",!1)),this.setItalic(to(t,"italic",!1)),this.setFontSize(to(t,"fontSize","16px")),this.setFontFamily(to(t,"fontFamily","Courier")),this.setColor(to(t,"color","#fff")),this.setStrokeStyle(to(t,"stroke",null),to(t,"strokeThickness",0)),this.setShadow(to(t,"shadowColor",null),to(t,"shadowOffsetX",0),to(t,"shadowOffsetY",0),to(t,"shadowBlur",0)),this.setOffset(to(t,"offsetX",0),to(t,"offsetY",0)),this.setSpace(to(t,"leftSpace",0),to(t,"rightSpace",0)),this.setAlign(to(t,"align",void 0)),this.setBackgroundColor(to(t,"backgroundColor",null)),this.setBackgroundHeight(to(t,"backgroundHeight",void 0)),this.setBackgroundBottomY(to(t,"backgroundBottomY",void 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(Wa("stroke",t,this),Wa("strokeThickness",t,this)),t.hasOwnProperty("shadowColor")&&this.setShadowColor(t.shadowColor),(t.hasOwnProperty("shadowOffsetX")||t.hasOwnProperty("shadowOffsetY"))&&this.setShadowOffset(Wa("shadowOffsetX",t,this),Wa("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),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=Xa(t),this}get hasFill(){return null!=this.color}setStrokeStyle(t,e){return this.stroke=Xa(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=Xa(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=Xa(t),this}get hasBackgroundColor(){return null!=this.backgroundColor}setBackgroundHeight(t){return this.backgroundHeight=t,this}setBackgroundBottomY(t){return this.backgroundBottomY=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 io=Phaser.Utils.Array.Remove,so=Phaser.Utils.Array.Remove,ro="text",no="image",ho="drawer",ao="space",oo="command";var lo=function(t){return t.type===ro&&"\n"===t.text},co=function(t){return t.type===ro&&"\f"===t.text},uo=function(t){return t.type===ro};class po extends Aa{constructor(t,e,i){super(t,ro),this.updateTextFlag=!1,this.style=new eo(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,s=this.drawTRX-i+1,r=e.backgroundBottomY;null==r&&(r=this.drawBLY);var n=e.backgroundHeight;null==n&&(n=r-this.drawTLY);var h=r-n;t.fillRect(i,h,s,n)}var a=e.hasFill,o=e.hasStroke;(a||o)&&(e.syncFont(t).syncStyle(t),o&&(e.syncShadow(t),t.strokeText(this.text,0,0)),a&&(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 vo=function(t,e){var i=this.createCharChildren(t,e);return this.addChild(i),this};const go=Phaser.Display.Canvas.CanvasPool;var fo=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=go.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),go.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 mo extends Aa{constructor(t,e,i){super(t,no),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(){fo(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 yo extends Aa{constructor(t,e,i,s){super(t,ho),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 Aa{constructor(t,e){super(t,ao),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 xo extends ga{constructor(t,e,i,s,r){super(t,oo),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 Co(t){if(null===t||"object"!=typeof t)return t;if(Array.isArray(t))return t.map((t=>Co(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]=Co(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 wo={none:0,word:1,char:2,character:2,mix:3};var Oo=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=To.call(this)).height,h=l.ascent,i=Math.floor((o-h)/n))}else{var l;n=(l=To.call(this)).height,h=l.ascent}}else this.fixedHeight>0?void 0===(i=Mo(t,"maxLines"))&&(o=this.fixedHeight-s,i=Math.floor(o/n)):i=Mo(t,"maxLines",0);void 0===h&&(h=n);var d=0===i,c=Mo(t,"wrapMode");void 0===c&&(c=Mo(t,"charWrap",!1)?"char":"word"),"string"==typeof c&&(c=wo[c]);var u=Mo(t,"wrapWidth",void 0);void 0===u&&(this.fixedWidth>0?u=this.fixedWidth-r:(u=1/0,c=0));for(var p=Mo(t,"letterSpacing",0),v=Mo(t,"hAlign",0),g=Mo(t,"vAlign",0),f=Mo(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,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=Do(t,"maxLines",void 0))){var h=this.fixedWidth-r;i=Math.floor(h/n)+1}}else i=Do(t,"maxLines",0);var a=0===i,o=Do(t,"fixedCharacterHeight",void 0);if(void 0===o){var l=Do(t,"charPerLine",void 0);if(void 0!==l){var d=this.fixedHeight-s;o=Math.floor(d/l)}}var c=Do(t,"wrapHeight",void 0);void 0===c&&(c=this.fixedHeight>0?this.fixedHeight-s:1/0);for(var u=Do(t,"letterSpacing",0),p=Do(t,"rtl",!0),v=Do(t,"hAlign",p?2:0),g=Do(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,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 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 Me(i,t,e),this.dirty=this.dirty||s!=i.left||r!=i.right||n!=i.top||h!=i.bottom,this},getPadding:function(t){return Ee(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),io(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 so(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(ro);return null===i?i=new po(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)),Ma(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 nl={};class hl{constructor(t){this.pools=rl(t,"pools",nl)}free(t){if(!this.pools)return this;var e=t.type;return this.pools.hasOwnProperty(e)||(this.pools[e]=new sl),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=vl(t,r,e,i,n),a=0;a<=cl&&0!==h;a++){if((r+=h)<0){r=0;break}h=vl(t,r,e,i,n)}return a===cl&&console.warn("FontSizeFit: Test count exceeds 65535"),t.setFontSize(r),gl(t,e,i),t},pl=function(t,e,i){return void 0===i[e]&&(t.setFontSize(e),i[e]={width:t.width,height:t.height}),i[e]},vl=function(t,e,i,s,r){var n,h=pl(t,e,r),a=pl(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)},gl=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 fl=Phaser.Utils.Objects.GetValue,ml=Phaser.Utils.Objects.GetValue;class yl extends Dh{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexLabel";var i,s=ml(e,"background",void 0),r=ml(e,"icon",void 0),n=ml(e,"iconMask",void 0),h=ml(e,"text",void 0),a=ml(e,"action",void 0),o=ml(e,"actionMask",void 0),l=ml(e,"align",void 0);if(s&&this.addBackground(s),r){0===this.orientation?(h||a)&&(i={right:ml(e,"space.icon",0),top:ml(e,"space.iconTop",0),bottom:ml(e,"space.iconBottom",0),left:ml(e,"space.iconLeft",0)}):(h||a)&&(i={bottom:ml(e,"space.icon",0),left:ml(e,"space.iconLeft",0),right:ml(e,"space.iconRight",0),top:ml(e,"space.iconTop",0)});var d=ml(e,"squareFitIcon",!1)?1:0;if(this.add(r,{proportion:0,padding:i,fitRatio:d}),n&&(n=Bh.call(this,r,r,1)),!d){var c=ml(e,"iconSize",void 0);this.setIconSize(ml(e,"iconWidth",c),ml(e,"iconHeight",c))}}if(h){var u=ml(e,"wrapText",!1),p=ml(e,"adjustTextFontSize",!1);u?(!0===u&&(u="word"),function(t,e){switch(Gh(t)){case 0:switch("string"==typeof e&&(e=ia[e]||0),t.style.wrapMode=e,e){case 2:case 3:t.style.wordWrapCallback=Uh;break;default:t.style.wordWrapCallback=null}break;case 1:"string"==typeof e&&(e=ia[e]||0),t.style.wrapMode=e}}(h,u),e.expandTextWidth=!0,dl(h)):p&&(e.expandTextWidth=!0,e.expandTextHeight=!0,function(t,e){"number"==typeof e&&(e={minWidth:e});var i=fl(e,"minWidth",0),s=fl(e,"minHeight",0),r=fl(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 ul(t,e,i),t}):(t.runWidthWrap=function(e){return t.setFixedSize&&t.setFixedSize(0,0),ul(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=ml(e,"space.text",0),m=ml(e,"expandTextWidth",!1),y=ml(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:ml(e,"space.actionTop",0),bottom:ml(e,"space.actionBottom",0),right:ml(e,"space.actionRight",0)}:{left:ml(e,"space.actionLeft",0),right:ml(e,"space.actionRight",0),bottom:ml(e,"space.actionBottom",0)},d=ml(e,"squareFitAction",!1)?1:0,this.add(a,{proportion:0,padding:i,fitRatio:d}),o&&(o=Bh.call(this,a,a,1)),!d)){var b=ml(e,"actionSize");this.setActionSize(ml(e,"actionWidth",b),ml(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 bl={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=xl[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 xl={down:0,up:1},Cl=Eh.prototype.add,Sl=Eh.prototype.addSpace;var wl=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)&&Sl.call(this),Cl.call(this,t,{proportion:i,expand:!0});var s=!this.buttonsExpand&&"center"===this.buttonsAlign;s&&Sl.call(this),this.hasTailSpace=s}else Cl.call(this,t,{proportion:i,expand:!0}),this.hasTailSpace=!1;else if(this.hasTailSpace){var r=this.sizerChildren.length-1;Cl.call(this,t,{index:r,proportion:i,expand:!0})}else Cl.call(this,t,{proportion:i,expand:!0});return e&&this.buttonGroup.add(t),this},Ol={addButton(t){if(dr(t))for(var e=t,i=0,s=e.length;i=0;i--)_l.call(this,e[i],t);return this}},El=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)}},Ml=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,El.call(e,t,i,s)}},enumerable:!0,configurable:!0}),t.selected=!1},Rl={add(t){return this.buttons.push(t),t._click||(t._click=new xr(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`),Ml.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=Nl(a.left,a.centerY,t,e))&&(r=o,s=n);var o,l=i[n+1];l&&l.y===a.y||r>(o=Nl(a.right,a.centerY,t,e))&&(r=o,s=n+1)}}return s};const Ul=Phaser.Utils.Objects.IsPlainObject,$l=Phaser.Utils.Objects.GetValue,Jl=Phaser.Display.Align.CENTER;var Kl=function(t,e,i,s){return"\n"===t?(this.addNewLine(),this):(ge.call(this,t),Ul(e)&&(e=$l(r=e,"padding",0),i=$l(r,"key",void 0),s=$l(r,"index",void 0)),void 0===e&&(e=0),(r=this.getSizerConfig(t)).align=Jl,r.padding=pe(e),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},ql={add(t,e,i){if(dr(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,fh.call(this,t),this}},td={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&&ad.addNewLine(this)}else for(n=0,h=t.length;n=0;i--)ud.call(this,e[i],t);return this}};const vd=Phaser.Utils.Objects.GetValue;class gd extends nd{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 Wl({parent:this,eventEmitter:vd(e,"eventEmitter",this),groupName:vd(e,"groupName",void 0),clickConfig:vd(e,"click",void 0)}).setButtonsType(e);var s=vd(e,"background",void 0),r=vd(e,"buttons",void 0);this.buttonsAlign=vd(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(gd.prototype,ld,pd,Xl,jl);var fd={v:0,vertical:0,y:0,h:1,horizontal:1,x:1,xy:2,vh:2},md=function(t,e){void 0===e&&(e="scrollMode"),t.hasOwnProperty(e)||(t[e]=yd(t));var i=t[e];return"string"==typeof i&&(i=fd[i]),i},yd=function(t){var e=!!t.sliderY||!!t.scrollerY,i=!!t.sliderX||!!t.scrollerX;return e&&i?2:e?0:i?1:0},bd=function(){return Array.prototype.reduce.call(arguments,xd,0)},xd=function(t,e){return t+e};const Cd=Phaser.Utils.Objects.IsPlainObject,Sd=Phaser.Utils.Objects.GetValue,wd=Phaser.Display.Align.CENTER;var Od=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 Pd(this.sizerChildren,null),fh.call(this,t),this}},Td={setColumnSpace(t){if(this.space.column||(this.space.column=[]),this.space.column.length=this.columnCount-1,"number"==typeof t)Pd(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},Ld={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===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,Pd(this.sizerChildren,null),this.columnProportions=[],this.columnProportions.length=t,"number"==typeof i)Pd(this.columnProportions,i);else for(var n=0;n0?e+=t:0===t&&(this.hasColumnProportion0Child=!0);return e},Yd=function(){for(var t,e=0,i=0;i0?e+=t:0===t&&(this.hasRowProportion0Child=!0);return e};const Ad=Phaser.Utils.Objects.IsPlainObject,zd=Phaser.Utils.Objects.GetValue;class Xd extends ih{constructor(t,e,i,s,r,n,h,a,o,l){Ad(e)?(e=zd(l=e,"x",0),i=zd(l,"y",0),s=zd(l,"width",void 0),r=zd(l,"height",void 0),n=zd(l,"column",l.col||0),h=zd(l,"row",0),a=zd(l,"columnProportions",0),o=zd(l,"rowProportions",0)):Ad(s)?(s=zd(l=s,"width",void 0),r=zd(l,"height",void 0),n=zd(l,"column",l.col||0),h=zd(l,"row",0),a=zd(l,"columnProportions",0),o=zd(l,"rowProportions",0)):Ad(n)?(n=zd(l=n,"column",l.col||0),h=zd(l,"row",0),a=zd(l,"columnProportions",0),o=zd(l,"rowProportions",0)):Ad(a)&&(a=zd(l=a,"columnProportions",0),o=zd(l,"rowProportions",0)),super(t,e,i,s,r,l),this.type="rexGridSizer",this.sizerChildren=[],this.addChildrenMap("items",this.sizerChildren),this.setCreateCellContainerCallback(zd(l,"createCellContainerCallback")),this.setIndentLeft(zd(l,"space.indentLeftOdd",0),zd(l,"space.indentLeftEven",0)),this.setIndentTop(zd(l,"space.indentTopOdd",0),zd(l,"space.indentTopEven",0)),this.resetGrid(n,h,a,o,zd(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=Dd.call(this)),this._totalColumnProportions}get totalRowProportions(){return void 0===this._totalRowProportions&&(this._totalRowProportions=Yd.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,Ld);const Wd=Phaser.Utils.Objects.GetValue;var Bd=Phaser.Renderer.WebGL.Utils,jd=function(t,e,i,s,r,n){for(var h=Bd.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+")"},Nd=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 Vd=Phaser.Renderer.Canvas.SetTransform;var Ud={renderWebGL:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.pipelines.set(e.pipeline),n=Hd(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&&jd(r,h,e,l,a,o),e.isStroked&&Fd(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(Vd(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(Jd.prototype,Ud);var Kd=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 qd=Phaser.Math.DegToRad;var Zd=function(t,e,i,s,r,n,h,a,o){h&&n>r?n-=360:!h&&n0&&t.y>0};const rc={rectangle:0,circle:1},nc=Phaser.Utils.Objects.GetValue;class hc extends ti{constructor(t,e){super(t,e),this.style=nc(e,"style",this);var i=nc(e,"propertiesMap");this.activeStyle=ac(e,"active",i),this.hoverStyle=ac(e,"hover",i),this.disableStyle=ac(e,"disable",i),this.onModifyStyle=nc(e,"onModifyStyle")}getStyle(t){return function(t,e,i){if(void 0===i&&(i={}),Array.isArray(e))for(var s=0,r=e.length;s0,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};const Zc=Phaser.Utils.Objects.GetValue,Qc=Phaser.Utils.Objects.IsPlainObject;class tu extends(kc(mc)){constructor(t,e,i,s,r,n,h,a){Qc(e)?(e=Zc(a=e,"x",0),i=Zc(a,"y",0),s=Zc(a,"width",2),r=Zc(a,"height",2),n=Zc(a,"barColor",void 0),h=Zc(a,"value",0)):Qc(s)?(s=Zc(a=s,"width",2),r=Zc(a,"height",2),n=Zc(a,"barColor",void 0),h=Zc(a,"value",0)):Qc(n)&&(n=Zc(a=n,"barColor",void 0),h=Zc(a,"value",0)),super(t,e,i,s,r,a),this.type="rexLineProgress",this.bootProgressBase(a),this.addShape((new Kc).setName("trackFill")).addShape((new Kc).setName("bar")).addShape((new Kc).setName("trackStroke")),this.setTrackColor(Zc(a,"trackColor",void 0)),this.setBarColor(n),this.setTrackStroke(Zc(a,"trackStrokeThickness",2),Zc(a,"trackStrokeColor",void 0)),this.setSkewX(Zc(a,"skewX",0)),this.setRTL(Zc(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 eu={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&&qc(s,0,0,e,i,t).close();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),qc(h,r,0,n,i,t).close());var a=this.getShape("trackStroke");a.lineStyle(this.trackStrokeThickness,this.trackStrokeColor),a.isStroked&&qc(a,0,0,e,i,t).end()}};Object.assign(tu.prototype,eu);var iu=function(t){return null==t||""===t||0===t.length},su=function(t,e,i,s){if(void 0===s&&(s="."),"object"==typeof t){if(iu(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(iu(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=Co(i),s=Co(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 Cu(t)?(this.stretchMode.edge=wu(Su(t,"edge",0)),this.stretchMode.internal=wu(Su(t,"internal",0))):(t=wu(t),this.stretchMode.edge=t,this.stretchMode.internal=t),this},getStretchMode:function(t,e){return ku.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 _u=Phaser.Utils.Objects.IsPlainObject,Tu=Phaser.Utils.Objects.GetValue,Eu=Phaser.GameObjects;var Mu=void 0,Ru=function(t,e){if(Mu||(Mu={},Ze(t).events.once("destroy",(function(){for(var t in Mu)Mu[t].destroy();Mu=void 0}))),!Mu.hasOwnProperty(e)){var i=Ze(t).scene.systemScene;(t=new Eu[e](i)).setOrigin(0),Mu[e]=t}return Mu[e]};const Lu=Phaser.GameObjects.RenderTexture;class Du extends(function(t,e){class i extends t{constructor(t,i,s,r,n,h,a,o,l,d){if(_u(i)?(i=Tu(d=i,"x",0),s=Tu(d,"y",0),r=Tu(d,"width",1),n=Tu(d,"height",1),h=Tu(d,"key",void 0),a=Tu(d,"baseFrame",void 0),o=Tu(d,"columns",void 0),l=Tu(d,"rows",void 0)):_u(r)?(r=Tu(d=r,"width",1),n=Tu(d,"height",1),h=Tu(d,"key",void 0),a=Tu(d,"baseFrame",void 0),o=Tu(d,"columns",void 0),l=Tu(d,"rows",void 0)):_u(h)?(h=Tu(d=h,"key",void 0),a=Tu(d,"baseFrame",void 0),o=Tu(d,"columns",void 0),l=Tu(d,"rows",void 0)):_u(a)?(a=Tu(d=a,"baseFrame",void 0),o=Tu(d,"columns",void 0),l=Tu(d,"rows",void 0)):Array.isArray(a)?(d=l,l=o,o=a,a=Tu(d,"baseFrame",void 0)):_u(o)&&(o=Tu(d=o,"columns",void 0),l=Tu(d,"rows",void 0)),void 0===a&&(a=Tu(d,"frame",void 0)),void 0===o){var c=Tu(d,"leftWidth",void 0),u=Tu(d,"rightWidth",void 0);void 0!==c&&void 0!==u&&(o=[c,void 0,u])}if(void 0===l){var p=Tu(d,"topHeight",void 0),v=Tu(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(Tu(d,"getFrameNameCallback",void 0)),this.setStretchMode(Tu(d,"stretchMode",0)),this.setPreserveRatio(Tu(d,"preserveRatio",!0));var g=Tu(d,"maxFixedPartScale",1),f=Tu(d,"maxFixedPartScaleX",g),m=Tu(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,Pu),i}(Lu,"rexNinePatch")){}var Yu={_drawImage:function(t,e,i,s,r,n){var h=Ru(this,"Image").setTexture(t,e).setDisplaySize(r,n);this.draw(h,i,s)},_drawTileSprite:function(t,e,i,s,r,n){var h=Ru(this,"TileSprite").setTexture(t,e).setSize(r,n);this.draw(h,i,s)}};Object.assign(Du.prototype,Yu);let Au=class extends ti{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 zu=Phaser.Utils.Objects.GetValue;class Xu extends Du{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexStatesNinePatch";var i=zu(e,"effects",!0);i&&cu(this,i),this.style=new Au(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign(Xu.prototype,lc);const Wu=["alpha","tint","flipX","flipY"];var Bu=function(t,e){if(!e)return t;for(var i=0,s=Wu.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 mp=Phaser.Utils.Objects.GetValue,yp=Phaser.Math.Distance.Between;class bp extends ti{constructor(t,e){super(t,e),this._enable=void 0,this.rectBoundsInteractive=mp(e,"rectBoundsInteractive",!1),this.rectBoundsInteractive||t.setInteractive(mp(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(mp(t,"enable",!0)),this.holdThreshold=mp(t,"holdThreshold",50),this.pointerOutReleaseEnable=mp(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 un(this.scene)}get speed(){return this.x===this.preX&&this.y===this.preY?0:yp(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 xp=Phaser.Utils.Objects.GetValue;class Cp{constructor(t){this.resetFromJSON(t)}resetFromJSON(t){return this.setValue(xp(t,"value",0)),this.setSpeed(xp(t,"speed",0)),this.setAcceleration(xp(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 Sp{constructor(){this.value,this.dir,this.movement=new Cp}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 Pp={y:0,v:0,vertical:0,x:1,h:1,horizontal:1},_p=Phaser.Utils.Objects.GetValue;class Tp extends ti{constructor(t,e){switch(super(t,e),this.parent!==this.scene?this.focusMode=_p(e,"focus",!0):this.focusMode=!1,"boolean"==typeof this.focusMode&&(this.focusMode=this.focusMode?1:0),this.setSpeed(_p(e,"speed",.1)),this.setEnable(_p(e,"enable",!0)),this.focusMode){case 0:case 2:this.scene.input.on("wheel",this.onSceneScroll,this);break;default:t.setInteractive(_p(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 Ep=Phaser.Utils.Objects.GetValue;var Mp=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)?Ep(s,l,void 0):Ep(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 gp(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);var p=Ep(r,"position",0);"string"==typeof p&&(p=Rp[p]);var v,g,f=Ep(s,`space.slider${i}`,void 0);void 0===f&&void 0===(f=Ep(s,"space.slider",void 0))&&(a?f=0:v=Ep(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:Ep(v,"right",v)}):(d=0,c=1,u=void 0===v?g?{right:f}:f:{right:Ep(v,"left",v)}):0===p?(d=1,c=2,u=void 0===v?g?{top:f}:f:{top:Ep(v,"bottom",v)}):(d=1,c=0,u=void 0===v?g?{bottom:f}:f:{bottom:Ep(v,"top",v)}),e.add(n,{column:d,row:c,align:"center",padding:u,expand:!0}),t[`hideUnscrollableSlider${i}`]=Ep(r,"hideUnscrollableSlider",!1),t[`adaptThumb${i}SizeMode`]=Ep(r,"adaptThumbSize",!1),t[`minThumb${i}Size`]=Ep(r,"minThumbSize",void 0)}else t[`hideUnscrollableSlider${i}`]=!1,t[`adaptThumb${i}SizeMode`]=!1,t[`minThumb${i}Size`]=void 0;var m,y,b=Ep(s,"scrollDetectionMode");"string"==typeof b&&(b=Lp[b]);var x=`scroller${i}`;(m=a||s.hasOwnProperty(x)?Ep(s,x,!0):Ep(s,"scroller",!0))&&o&&(!0===m&&(m={}),m.orientation=h?0:1,void 0!==b&&(m.rectBoundsInteractive=1===b),y=new kp(o,m),o.isRexContainerLite&&o.sendChildToBack(o));var C,S,w,O,k,P=Ep(s,a?`mouseWheelScroller${i}`:"mouseWheelScroller",!1);P&&o&&(void 0!==b&&(P.focus=1===b?2:0),C=new Tp(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.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&&(k=a?`addChildO${i}`:"addChildOY",C.on("scroll",(function(e){t[k](-e,!0)})))};const Rp={right:0,left:1,bottom:0,top:1},Lp={gameObject:0,rectBounds:1},Dp=Phaser.Utils.Objects.GetValue;var Yp=function(t,e){var i=t.scene,s=[0,1,0],r=[0,1,0],n=Dp(e,"width"),h=Dp(e,"height");n||Dp(e,"child.expandWidth",!0)||(s[1]=0),h||Dp(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=Wd(i,"child"),r=Wd(s,"gameObject",void 0);if(r){var n=Wd(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=Wd(n,"top",0),h.bottom=Wd(n,"bottom",0),a.left=Wd(n,"left",0),a.right=Wd(n,"right",0);break;case 1:h.top=Wd(n,"left",0),h.bottom=Wd(n,"right",0),a.top=Wd(n,"top",0),a.bottom=Wd(n,"bottom",0);break;default:h.top=Wd(n,"top",0),h.bottom=Wd(n,"bottom",0),h.left=Wd(n,"left",0),h.right=Wd(n,"right",0)}e.add(r,{column:1,row:1,align:Wd(s,"align","center"),padding:a,expand:{width:Wd(s,"expandWidth",!0),height:Wd(s,"expandHeight",!0)}})}t.addChildrenMap("child",r)}(t,a,e),t.scrollMode){case 0:Mp(t,a,"y",e);break;case 1:Mp(t,a,"x",e);break;default:Mp(t,a,"y",e),Mp(t,a,"x",e)}return a},Ap=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}`]}if(s){var n="Y"===t?this.scaleY:this.scaleX;s.setBounds(e,i*n)}r&&r.setEnable(e!==i)},zp=function(t){switch(this.scrollMode){case 0:case 1:(e=this.childrenMap.slider)&&this.hideUnscrollableSlider&&this.setChildVisible(e,this.isOverflow);break;default:t=t.toUpperCase();var e=this.childrenMap[`slider${t}`],i=this[`hideUnscrollableSlider${t}`],s=this[`isOverflow${t}`];e&&i&&this.setChildVisible(e,s)}},Xp=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(rv.prototype,tv);const nv=["top","bottom","centerY","center"],hv=["left","right","centerX","center"];var av=function(t,e,i){var s,r="Y"===(e=e.toUpperCase()),n=this.childrenMap.child;if(r){if(i)for(var h=0,a=nv.length;h=0?0:Math.abs(l)<=Math.abs(d)?l:d}}else{if(i)for(h=0,a=hv.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 ov=Phaser.Utils.Objects.GetValue;class lv extends Ip{constructor(t,e){void 0===e&&(e={});var i=md(e),s=ov(e,"panel",void 0);void 0===s&&(s={}),s.scrollMode=i,s.clampChildOY=ov(e,"clampChildOY",!1),s.clampChildOX=ov(e,"clampChildOX",!1);var r,n,h=new rv(t,s);switch(t.add.existing(h),i){case 0:r=ov(e,"expand.panel",!0),n=!0;break;case 1:r=!0,n=ov(e,"expand.panel",!0);break;default:r=!0,n=!0}e.type="rexScrollablePanel",e.child={gameObject:h,expandWidth:r,expandHeight:n,align:ov(e,"align.panel","center")};var a=ov(e,"space",void 0);a&&(a.child=ov(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]),Qn(this.childrenMap.child,t),this}}var dv={scrollToChild:function(t,e){if(!this.hasChild(t))return this;switch(this.scrollMode){case 0:av.call(this,t,"y",e);break;case 1:av.call(this,t,"x",e);break;default:av.call(this,t,"y",e),av.call(this,t,"x",e)}return this}};Object.assign(lv.prototype,dv);const cv=Phaser.Utils.Objects.GetValue;var uv=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=pv(e,u),this.listMaxHeight>0&&(s.layout(),s.height<=this.listMaxHeight&&(d=s)),!d){0===c&&(c=this.listMaxHeight);var p=vv(e,this.listCreateSliderTrackCallback),v=vv(e,this.listCreateSliderThumbCallback);d=new lv(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:cv(this.listSpace,"panel",0)}}),e.add.existing(d)}}else u.height=c,s=pv(e,u),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},pv=function(t,e,i){var s;return i?(e.orientation="x",s=new gd(t,e)):(e.orientation="y",s=new Fl(t,e)),t.add.existing(s),s},vv=function(t,e,i){var s;return e&&(s=e.call(i,t),t.add.existing(s)),s},gv=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 yv={down:0,up:1},bv=Phaser.Utils.Objects.GetValue;class xv extends js{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=function(t,e){Ti(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 Pi(t,n):r.resetFromJSON(n),r.restart()}(t,e,"y","Linear")}),e.manualClose=!0,e.clickOutsideClose=!0,e.destroy=!0,super(t,e),mv(t,e),t.isRexSizer&&t.layout();var i=bv(e,"touchOutsideClose",!1),s=bv(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&&Qs(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 Cv={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}},Sv={openListPanel:function(){if(this.listPanel)return this;if(0===this.options.length)return this;var t,e=uv.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 xv(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(Sv,bl,Cv);const wv=Phaser.Utils.Objects.GetValue;class Ov extends yl{constructor(t,e){super(t,e),this.type="rexDropDownList",this.timer=void 0,this.listPanel=void 0,this.currentOverIndex=void 0,this.setOptions(wv(e,"options"));var i=wv(e,"list");this.setWrapEnable(wv(i,"wrap",!1)),this.setCreateButtonCallback(wv(i,"createButtonCallback")),this.setCreateListBackgroundCallback(wv(i,"createBackgroundCallback")),this.setCreateListSliderTrackCallback(wv(i,"createTrackCallback")),this.setCreateListSliderThumbCallback(wv(i,"createThumbCallback")),this.setListSliderAdaptThumbSizeEnable(wv(i,"sliderAdaptThumbSize",!1)),this.setListScrollerConfig(wv(i,"scroller")),this.setListMouseWheelScrollerConfig(wv(i,"mouseWheelScroller")),this.setButtonClickCallback(wv(i,"onButtonClick")),this.setButtonOverCallback(wv(i,"onButtonOver")),this.setButtonOutCallback(wv(i,"onButtonOut")),this.setListExpandDirection(wv(i,"expandDirection")),this.setListEaseInDuration(wv(i,"easeIn",500)),this.setListEaseOutDuration(wv(i,"easeOut",100)),this.setListTransitInCallback(wv(i,"transitIn")),this.settListTransitOutCallback(wv(i,"transitOut")),this.setListMaxHeight(wv(i,"maxHeight",0)),this.setListSize(wv(i,"width"),wv(i,"height",0)),this.setListAlignmentMode(wv(i,"alignParent","text")),this.setListAlignmentSide(wv(i,"alignSide","")),this.setListBounds(wv(i,"bounds")),this.setListSpace(wv(i,"space")),this.setListDraggable(wv(i,"draggable",!1)),this.setValueChangeCallback(wv(e,"setValueCallback"),wv(e,"setValueCallbackScope")),this.setValue(wv(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(Ov.prototype,Sv);const kv=Phaser.GameObjects.Text,Pv=Phaser.Utils.Objects.GetValue;class _v extends kv{constructor(t,e){void 0===e&&(e={}),super(t,Pv(e,"x",0),Pv(e,"y",0),Pv(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(_v.prototype,lc);var Tv=Phaser.Renderer.WebGL.Utils,Ev={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=Tv.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 Mv=Phaser.Display.Canvas.CanvasPool;e();const Rv=Phaser.GameObjects.GameObject;class Lv extends Rv{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=Mv.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 Mv.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}},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}},Pe=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 _e=/(\S+)\[(\d+)\]/i,Te=Phaser.Utils.Objects.GetValue;var Ee=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=Te(e,"left",0),t.right=Te(e,"right",0),t.top=Te(e,"top",0),t.bottom=Te(e,"bottom",0)),t},Re={getInnerPadding(t){return Ee(this.space,t)},setInnerPadding(t,e){return Me(this.space,t,e),this},getOuterPadding(t){return Ee(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)),Ee(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}},De=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},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}},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},Xe=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}},Be=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:vi,this.repeatCounter=0,this}stop(){return this.state=pi,this}update(t,e){this.state!==pi&&this.state!==mi&&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=fi)):(this.nowTime=this.duration,this.state=mi):this.nowTime>=0&&(this.state=gi))}get t(){var t;switch(this.state){case pi:case vi:case fi:t=0;break;case gi:t=this.nowTime/this.duration;break;case mi:t=1}return ci(t,0,1)}set t(t){(t=ci(t,-1,1))<0?(this.state=vi,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===pi}get isDelay(){return this.state===vi}get isCountDown(){return this.state===gi}get isRunning(){return this.state===vi||this.state===gi}get isDone(){return this.state===mi}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}}const pi=0,vi=1,gi=2,fi=3,mi=-1;class yi extends oi{constructor(t,e){super(t,e),this.timer=new ui}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 bi=Phaser.Utils.Objects.GetValue,xi=Phaser.Utils.Objects.GetAdvancedValue,Ci=Phaser.Tweens.Builders.GetEaseFunction;class Si extends yi{resetFromJSON(t){return this.timer.resetFromJSON(bi(t,"timer")),this.setEnable(bi(t,"enable",!0)),this.setTarget(bi(t,"target",this.parent)),this.setDelay(xi(t,"delay",0)),this.setDuration(xi(t,"duration",1e3)),this.setEase(bi(t,"ease","Linear")),this.setRepeat(bi(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 wi=Phaser.Utils.Objects.GetValue,Oi=Phaser.Utils.Objects.GetAdvancedValue,ki=Phaser.Math.Linear;let Pi=class extends Si{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=_i[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=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 _i={stop:0,destroy:1,yoyo:2};var Ti=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 Pi(t,a):r.resetFromJSON(a),r.restart(),r},Ei=function(t,e,i,s,r,n){void 0===s&&(s="Linear"),r instanceof Pi&&(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 Pi(t,h):n.resetFromJSON(h),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 Di={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=Ti(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=Ei(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 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 Pi(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),Ri(this._scaleBehavior)},isRunningScaleYoyo(){return this._scaleBehavior&&(this._scaleBehavior.completeEventName="scaleyoyo.complete")},isRunningEaseScale(){return this.isRunningPopUp()||this.isRunningScaleDown()||this.isRunningScaleYoyo()}},Yi={};Object.assign(Yi,Di),Yi.onInitScale=function(){Di.onInitScale.call(this);var t=this;this._scaleBehavior.on("update",(function(){var e=ye.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const Ai=Phaser.Utils.Objects.GetValue,zi=Phaser.Utils.Objects.GetAdvancedValue,Xi=Phaser.Math.Linear;class Wi extends Si{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(zi(t,"start",this.parent.alpha),zi(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=Bi[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=Xi(this.alphaStart,this.alphaEnd,i)}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Bi={stop:0,destroy:1,yoyo:2},ji=Phaser.Utils.Objects.IsPlainObject;var Ii=function(t,e,i,s){var r,n;ji(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},Fi=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=Ii(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(Hi(t)){var i=t;t=i.duration,e=i.destroy}var s=void 0===this._fade;return this._fade=Fi(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()}},Ni={};Object.assign(Ni,Gi),Ni.onInitFade=function(){Gi.onInitFade.call(this);var t=this;this._fade.on("update",(function(){var e=ye.getParentSizer(t);e&&e.resetChildAlphaState(t)}))};const Vi=Phaser.Utils.Objects.GetValue,Ui=Phaser.Utils.Objects.GetAdvancedValue,$i=Phaser.Math.Linear;class Ji extends Si{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){if(super.resetFromJSON(t),this.setMode(Vi(t,"mode",0)),t&&(t.hasOwnProperty("x")||t.hasOwnProperty("y"))){var e=Ui(t,"x",void 0),i=Ui(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=Ui(i,"startX",void 0),this.startY=Ui(i,"startY",void 0),this.endX=Ui(i,"endX",void 0),this.endY=Ui(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 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 Zi=Phaser.Utils.Objects.IsPlainObject,Qi=Phaser.Math.Distance.Between;var ts={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(Zi(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*Qi(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 Ji&&(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 Ji(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),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(Zi(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*Qi(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 Ji&&(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 Ji(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),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}},es={};Object.assign(es,ts),es.onInitEaseMove=function(){ts.onInitEaseMove.call(this);var t=this;this._easeMove.on("update",(function(){var e=ye.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const is=Phaser.Utils.Objects.GetValue;class ss extends ni{constructor(t,e){super(t,e),this.timer=new ui,this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.timer.resetFromJSON(is(t,"timer")),this.setEnable(is(t,"enable",!0)),this.setMode(is(t,"mode",1)),this.isRunning=is(t,"isRunning",!1),this.setMagnitudeMode(is(t,"magnitudeMode",1)),this.setAxisMode(is(t,"axis",0)),this.setDuration(is(t,"duration",500)),this.setMagnitude(is(t,"magnitude",10)),this.ox=is(t,"ox",void 0),this.oy=is(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=rs[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=ns[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=is(i,"magnitude",void 0),t=is(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 rs={effect:0,behavior:1},ns={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},as=Phaser.Utils.Objects.IsPlainObject;var os={shake(t,e,i){if(as(t)){var s=t;t=s.duration,e=s.magnitude,i=s.magnitudeMode}return void 0===this._shake&&(this._shake=new ss(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 ls=Phaser.Utils.Objects.GetValue,ds=Phaser.Math.Linear;class cs extends Si{constructor(t,e){super(t,e),this.resetFromJSON(),this.boot()}start(t){if(this.timer.isRunning)return this;var e=this.target;this.propertyKey=ls(t,"key","value");var i=e[this.propertyKey];return this.fromValue=ls(t,"from",i),this.toValue=ls(t,"to",i),this.setEase(ls(t,"ease",this.ease)),this.setDuration(ls(t,"duration",this.duration)),this.setRepeat(ls(t,"repeat",0)),this.setDelay(ls(t,"delay",0)),this.setRepeatDelay(ls(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]=ds(this.fromValue,this.toValue,i)}}const us=Phaser.Utils.Objects.IsPlainObject;class ps extends ti{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(us(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(us(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 vs={easeDataTo(t,e,i,s){return this._easeData||(this._easeData=new ps(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,fs={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=Je(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}},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}},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,Ys,As,zs,Xs);const Bs=Phaser.Utils.Objects.GetValue;class js extends ti{constructor(t,e){super(t,e),this.setTransitInTime(Bs(e,"duration.in",200)),this.setTransitOutTime(Bs(e,"duration.out",200)),this.setTransitInCallback(Bs(e,"transitIn")),this.setTransitOutCallback(Bs(e,"transitOut")),this.oneShotMode=Bs(e,"destroy",!1),this.delayCallTimer=void 0,this._state=new Ds(this,{eventEmitter:!1,initState:Bs(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,Ws);var Is=function(t){if(t.parentContainer)return Is(t.parentContainer);var e=function(t){var e=t.displayList;return U(e)?e:null}(t);return e?Is(e):t};class Fs extends ti{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 Hs=Phaser.GameObjects.Rectangle;class Gs extends Hs{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 Vs extends ti{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=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 $s=Phaser.Utils.Objects.GetValue;class Js extends Gs{constructor(t,e){super(t,$s(e,"color",0),$s(e,"alpha",.8)),this.touchEventStop=new Vs(this,{hitAreaMode:1})}}var Ks={popUp(t,e){void 0!==t._modalScaleSave?(t.scaleX=t._modalScaleSave,t.scaleY=t._modalScaleSave):t._modalScaleSave=t.scaleX,Ti(t,e)},scaleDown(t,e){Ei(t,e,void 0,void 0,!1)},fadeIn(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Ii(t,e)},fadeOut(t,e){Fi(t,e,!1)}},qs=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Ii(t,e,t.alpha)},Zs=function(t,e){Fi(t,e,!1)},Qs=function(t,e,i,s,r){return!(!t||s&&!s(t,e,i)||!rt(t,!0).contains(e,i)||r&&!r(t,e,i))};const tr=Phaser.Utils.Objects.GetValue;let er=class extends js{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",qs)),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=Ks.popUp;break;case ir.fadeIn:t=Ks.fadeIn}return super.setTransitInCallback(t),this}setTransitOutCallback(t){switch("string"==typeof t&&(t=ir[t]),t){case ir.scaleDown:t=Ks.scaleDown;break;case ir.fadeOut:t=Ks.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 xr(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)||!Or(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 Pr=Phaser.Utils.Objects.GetValue;class _r extends ti{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=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?wr: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 Tr={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 _r(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 Ls{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 Rr=Phaser.Utils.Objects.GetValue;class Lr extends ti{constructor(t,e){super(t,e),this._enable=void 0,this.cooldown=new Mr,this.parent.setInteractive(Rr(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.prevIsInTouch=!1,this.isInTouching=!1,this.setEnable(Rr(t,"enable",!0)),this.setCooldown(Rr(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&&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 Lr(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 Lr(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}},Ar=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===Zr&&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=Qr,this}isPointerInGameObject(t,e,i){var s=this.lastPointer;return!!s&&lr(t,s,e,i)}}const qr=0,Zr=1,Qr="IDLE",tn=Phaser.Utils.Objects.GetValue,en=Phaser.Math.Distance.Between;class sn extends Kr{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=rn},eventEmitter:!1};this.setRecongizedStateObject(new Ls(s))}resetFromJSON(t){super.resetFromJSON(t),this.setHoldTime(tn(t,"time",250)),this.setTapInterval(tn(t,"tapInterval",200)),this.setDragThreshold(tn(t,"threshold",9)),this.setTapOffset(tn(t,"tapOffset",10));var e=tn(t,"taps",void 0);return void 0!==e?this.setTaps(e):(this.setMaxTaps(tn(t,"maxTaps",void 0)),this.setMinTaps(tn(t,"minTaps",void 0))),this}onDragStart(){switch(this.state){case rn:this.state=nn;break;case nn:var t=this.lastPointer;en(t.upX,t.upY,t.x,t.y)>this.tapOffset&&(this.state=hn,this.state=nn);break;case hn:this.state=nn}}onDragEnd(){this.state===nn&&(this.tapsCount++,this.emit("tapping",this,this.gameObject,this.lastPointer),void 0!==this.maxTaps&&this.tapsCount===this.maxTaps&&(this.state=hn))}onDrag(){this.state!==rn&&this.pointer.getDistance()>this.dragThreshold&&(this.state=rn)}preUpdate(t,e){if(this.isRunning&&this.enable&&this.state===nn){var i=this.lastPointer;i.isDown?t-i.downTime>this.holdTime&&(this.state=rn):t-i.upTime>this.tapInterval&&(void 0===this.minTaps||this.tapsCount>=this.minTaps?this.state=hn:this.state=rn)}}postUpdate(t,e){this.isRunning&&this.enable&&this.state===hn&&(this.state=rn)}get isTapped(){return this.state===hn}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 rn="IDLE",nn="BEGIN",hn="RECOGNIZED",an=Phaser.Utils.Objects.GetValue;class on extends Kr{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=ln},eventEmitter:!1};this.setRecongizedStateObject(new Ls(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(an(t,"threshold",9)),this.setHoldTime(an(t,"time",251)),this}onDragStart(){this.state=dn,0===this.holdTime&&(this.state=cn)}onDragEnd(){this.state=ln}onDrag(){this.state!==ln&&this.pointer.getDistance()>this.dragThreshold&&(this.state=ln)}preUpdate(t,e){this.isRunning&&this.enable&&this.state===dn&&t-this.pointer.downTime>=this.holdTime&&(this.state=cn)}get isPressed(){return this.state===cn}setHoldTime(t){return this.holdTime=t,this}setDragThreshold(t){return this.dragThreshold=t,this}}const ln="IDLE",dn="BEGIN",cn="RECOGNIZED";Phaser.Utils.Objects.GetValue;var un=function(t){return Ze(t).loop.delta};const pn=Phaser.Math.Distance.Between,vn=Phaser.Math.Angle.Between;var gn={getDt:function(){return un(this.scene)},getVelocity:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return pn(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 vn(e.x,e.y,t.x,t.y)}},fn={"up&down":0,"left&right":1,"4dir":2,"8dir":3},mn={};const yn=Phaser.Utils.Objects.GetValue,bn=Phaser.Math.RadToDeg;class xn extends Kr{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 Ls(s)),this.clearDirectionStates()}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(yn(t,"threshold",10)),this.setVelocityThreshold(yn(t,"velocityThreshold",1e3)),this.setDirectionMode(yn(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=wn))}postUpdate(t,e){this.isRunning&&this.enable&&this.state===wn&&(this.state=Cn)}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=fn[t]),this.dirMode=t,this}updateDirectionStates(){return function(t,e,i){switch(void 0===i?i={}:!0===i&&(i=mn),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}}(bn(this.getVelocityAngle()),this.dirMode,this),this}clearDirectionStates(){return this.left=!1,this.right=!1,this.up=!1,this.down=!1,this}}Object.assign(xn.prototype,gn);const Cn="IDLE",Sn="BEGIN",wn="RECOGNIZED",On=Phaser.Utils.Objects.GetValue,kn=Phaser.Utils.Array.SpliceOne,Pn=Phaser.Math.Distance.Between,_n=Phaser.Math.Angle.Between;class Tn{constructor(t,e){var i=Je(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(On(e,"inputConfig",void 0)),this.setEventEmitter(On(e,"eventEmitter",void 0)),this._enable=void 0,this.pointers=[],this.movedState={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setEnable(On(t,"enable",!0)),this.bounds=On(t,"bounds",void 0),this.tracerState=Mn,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 Mn:this.tracerState=Rn,this.onDrag1Start();break;case Rn:this.tracerState=Ln,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 Rn:this.tracerState=Mn,this.onDrag1End();break;case Ln:this.tracerState=Rn,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 Rn:this.onDrag1();break;case Ln:this.onDrag2()}}}dragCancel(){return this.tracerState===Ln&&this.onDrag2End(),this.pointers.length=0,ft(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!==Ln)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!==Ln)return 0;var t=this.pointers[0],e=this.pointers[1];return _n(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!==Ln)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.x+e.x)/2}get centerY(){if(this.tracerState!==Ln)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.y+e.y)/2}get prevCenterX(){if(this.tracerState!==Ln)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!==Ln)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&&lr(t,s,e,i)}isPointer1InGameObject(t,e,i){var s=this.pointers[1];return!!s&&lr(t,s,e,i)}}Object.assign(Tn.prototype,Ve);var En={};const Mn=0,Rn=1,Ln=2,Dn="IDLE";Phaser.Utils.Objects.GetValue;const Yn=Phaser.Math.RotateAround;var An=function(t,e,i,s){return Yn(t,e,i,s),t.rotation+=s,t},zn={};const Xn=Phaser.Utils.Objects.GetValue,Wn=Phaser.Math.Angle.WrapDegrees,Bn=Phaser.Math.Angle.ShortestBetween,jn=Phaser.Math.RadToDeg,In=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=zn),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=Wn(jn(this.angleBetween));this.angle=Bn(this.prevAngle,t),this.prevAngle=t,this.state=Nn}break;case Nn:t=Wn(jn(this.angleBetween)),this.angle=Bn(this.prevAngle,t),this.prevAngle=t,this.emit("rotate",this)}}get isRotated(){return this.state===Nn}get rotation(){return In(this.angle)}setDragThreshold(t){return this.dragThreshold=t,this}}.prototype,Fn);const Hn="IDLE",Gn="BEGIN",Nn="RECOGNIZED",Vn=Phaser.Utils.Objects.GetValue;var Un=function(t){var e=Vn(t,"tap",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._tap=new sn(this,e),this._tap.on("tap",(function(t,e,s){zr(i.eventEmitter,`${i.eventNamePrefix}${t.tapsCount}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const $n=Phaser.Utils.Objects.GetValue;var Jn=function(t){var e=$n(t,"press",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._press=new on(this,e),this._press.on("pressstart",(function(t,e,s){zr(i.eventEmitter,`${i.eventNamePrefix}pressstart`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this).on("pressend",(function(t,e,s){zr(i.eventEmitter,`${i.eventNamePrefix}pressend`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Kn=Phaser.Utils.Objects.GetValue;var qn=function(t){var e=Kn(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 xn(this,e),this._swipe.on("swipe",(function(t,e,s){var r=t.left?"left":t.right?"right":t.up?"up":"down";zr(i.eventEmitter,`${i.eventNamePrefix}swipe${r}`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Zn=Phaser.Utils.Objects.GetValue;var Qn=function(t,e){return t.setInteractive(),Zn(e,"dropZone",!1)&&(t.input.dropZone=!0),t._childrenInteractive={targetSizers:Zn(e,"targets",[t]),targetMode:Zn(e,"targetMode","parent"),eventEmitter:Zn(e,"eventEmitter",t),eventNamePrefix:Zn(e,"inputEventPrefix","child.")},Wr.call(t,e),Ir.call(t,e),Gr.call(t,e),$r.call(t,e),Un.call(t,e),Jn.call(t,e),qn.call(t,e),t},th={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",de),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)}}for(var d,c,u=this.getAllShownChildren([this]),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 lh=Phaser.Utils.Objects.IsPlainObject,dh=Phaser.Utils.Objects.GetValue,ch=Phaser.Display.Align.CENTER,uh={min:0,full:-1};var ph=function(t,e,i,s,r,n,h,a,o,l){ge.call(this,t);var d=t.isRexSpace,c=typeof e;if(null===e)return this;if("number"===c);else if("string"===c)e=uh[e];else if(lh(e)){var u;e=dh(u=e,"proportion",void 0),i=dh(u,"align",ch),s=dh(u,"padding",0),r=dh(u,"expand",!1),n=dh(u,"key",void 0),h=dh(u,"index",void 0),t.isRexSizer||(a=dh(u,"minWidth",void 0),o=dh(u,"minHeight",void 0)),l=dh(u,"fitRatio",0)}return"string"==typeof i&&(i=zt[i]),void 0===e&&(e=d?1:0),void 0===i&&(i=ch),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===a&&(d?a=0:t.isRexSizer||(a=t._minWidth)),void 0===o&&(d?o=0:t.isRexSizer||(o=t._minHeight)),void 0===l||!1===l?l=0:!0===l&&(l=Q(t)/tt(t)),(u=this.getSizerConfig(t)).proportion=e,u.align=i,u.padding=pe(s),u.expand=r,u.fitRatio=0===e?l:0,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},vh={add:ph,addSpace(t){return this.insertSpace(void 0,t),this},insertSpace(t,e){return void 0===e&&(e=1),ph.call(this,new ah(this.scene),{proportion:e,minWidth:0,minHeight:0,index:t}),this},insert(t,e,i,s,r,n,h,a){return lh(i)&&(i.index=t),ph.call(this,e,i,s,r,n,h,t,a),this},insertAtPosition(t,e,i,s,r,n,h,a,o){var l=oh.call(this,t,e);return-1===l&&(l=void 0),this.insert(l,i,s,r,n,h,a,o),this}};const gh=Et.prototype.clear;var fh=function(t){this.backgroundChildren&&(this.backgroundChildren.length=0);var e,i=!t&&this.sizerEventsEnable;if(i&&(e=this.getChildren([])),gh.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,fh.call(this,t),this}},bh={getChildAlign(t){return this.getSizerConfig(t).align},setChildAlign(t,e){return"string"==typeof e&&(e=zt[e]),this.getSizerConfig(t).align=e,this}},xh={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}},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&&(Fe(t,0,0),e.resolved=!1,this.hasRatioFitChild=!0);return this._childrenProportion=void 0,this.hasProportion0Child=!1,this.proportionLength=void 0,Be.call(this),this},layoutChildren:function(){for(var t,e,i,s,r,n,h,a,o,l,d=this.sizerChildren,c=this.innerLeft,u=this.innerTop,p=this.innerWidth,v=this.innerHeight,g=c,f=u,m=this.startChildIndex,y=0,b=d.length;y0?(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)||De.call(this)},runWidthWrap:function(t){this.wrapResult||(1===this.orientation&&nh.call(this,t,void 0),Ye.call(this,t))},hasHeightWrap:function(){return!(!this.hasRatioFitChild||0!==this.orientation)||ze.call(this)},runHeightWrap:function(t){this.wrapResult||(0===this.orientation&&nh.call(this,void 0,t),Xe.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,vh,yh,bh,xh,Ch,Sh);var Oh=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},Ph=function(t){return"string"==typeof t&&(t=kh[t]),t};const _h=Phaser.Utils.Objects.IsPlainObject,Th=Phaser.Utils.Objects.GetValue;class Eh extends ih{constructor(t,e,i,s,r,n,h){_h(e)?(e=Th(h=e,"x",0),i=Th(h,"y",0),s=Th(h,"width",void 0),r=Th(h,"height",void 0),n=Th(h,"orientation",0)):_h(s)?(s=Th(h=s,"width",void 0),r=Th(h,"height",void 0),n=Th(h,"orientation",0)):_h(n)&&(n=Th(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(Th(h,"space.item",0)),this.setStartChildIndex(Th(h,"startChildIndex",0)),this.setRTL(Th(h,"rtl",!1)),this.addChildrenMap("items",this.sizerChildren)}setOrientation(t){return this.orientation=Ph(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=Oh.call(this)),this._childrenProportion}}Object.assign(Eh.prototype,wh);var Mh=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}},Rh=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},Lh={appendText:Rh,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 Dh extends Eh{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&&(Mh(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&&(Mh(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&&Mh(t,this.iconWidth,this.iconHeight);var e=this.childrenMap.action;e&&void 0!==this.actionWidth&&void 0!==this.actionHeight&&Mh(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(Dh.prototype,Lh);var Yh=function(t,e,i,s,r){if(this.clear().fillStyle(16777215),1===this.shapeType){i=i.left;var n=Math.min(t,e)/2;this.fillCircle(-t*(s-.5),-e*(r-.5),n+i)}else this.fillRect(-t*s-i.left,-e*r-i.top,t+i.left+i.right,e+i.top+i.bottom)},Ah=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};const zh=Phaser.GameObjects.Graphics;class Xh extends zh{constructor(t,e,i){void 0===e&&(e=0),"string"==typeof e&&(e=Wh[e]),super(t.scene),this.parent=t,this.shapeType=e,this.padding=pe(i),this.setPosition().resize().setVisible(!1)}destroy(){return this.parent=void 0,super.destroy(),this}setPosition(t,e){var i=this.parent;return void 0===t&&(t=i.x),void 0===e&&(e=i.y),super.setPosition(t,e),this}resize(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=pe(i));var r=this.width!==t||this.height!==e,n=this.padding!==i&&!Ah(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,Yh.call(this,t,e,i,s.originX,s.originY),this):this}setOrigin(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,Yh.call(this,this.width,this.height,this.padding,t,e)),this}}const Wh={rectangle:0,circle:1};var Bh=function(t,e,i,s){var r=new Xh(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 jh=Phaser.GameObjects.Text;var Ih=function(t){return t instanceof jh};const Fh=Phaser.GameObjects.BitmapText;var Hh=function(t){return t instanceof Fh},Gh=function(t){return Hh(t)?2:Ih(t)?0:1},Nh=/^[\x00-\x7F]+$/,Vh=function(t){return Nh.test(t)},Uh=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},Jh=0,Kh=1,qh=2,Zh=0,Qh=1,ta=2,ea=/(?:\r\n|\r|\n)/;const ia={none:Zh,word:Qh,char:ta,character:ta,mix:3},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=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)},oa={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,aa(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 la=Phaser.Display.Canvas.CanvasPool,da=Phaser.GameObjects.GameObject,ca=Phaser.Utils.String.UUID;class ua extends da{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=la.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=ca(),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(){la.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 pa=Phaser.GameObjects.Components;Phaser.Class.mixin(ua,[pa.Alpha,pa.BlendMode,pa.Crop,pa.Depth,pa.Flip,pa.GetBounds,pa.Mask,pa.Origin,pa.Pipeline,pa.PostPipeline,pa.ScrollFactor,pa.Tint,pa.Transform,pa.Visible,ra,ha,oa]);var va={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 ga{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(ga.prototype,va);var fa={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 ma=Phaser.Math.RotateAround;var ya;const ba=Phaser.Geom.Rectangle;var xa,Ca=function(t){void 0===xa&&(xa=new ba);var e=t.drawTLX,i=t.drawTLY;return xa.setTo(e,i,t.drawTRX-e,t.drawBLY-i),xa};const Sa=Phaser.Math.RotateAround;var wa,Oa=function(t,e,i,s){return void 0===s?s={}:!0===s&&(void 0===wa&&(wa={}),s=wa),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 ka=Phaser.GameObjects.Components.TransformMatrix;var Pa,_a,Ta={},Ea=function(t,e,i,s,r){var n=Oa(e,i,s,!0),h=function(t,e,i,s){void 0===s?s={}:!0===s&&(s=Ta);var r=e-t.width*t.originX,n=i-t.height*t.originY;return void 0===Pa&&(Pa=new ka,_a=new ka),t.parentContainer?t.getWorldTransformMatrix(Pa,_a):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},Ma=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 Ea(t,e,n,h,r)},Ra={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===ya&&(ya={}),s=ya),s.x=(t-i.drawX)/i.scaleX,s.y=(e-i.drawY)/i.scaleY,0!==i.rotation&&ma(s,0,0,-i.rotation),s}(t,e,this,!0);return Ca(this).contains(i.x,i.y)},getWorldPosition:function(t,e,i){return Ma(this.parent,this,t,e,i)}};Object.assign(Ra,fa);const La=Phaser.Math.DegToRad,Da=Phaser.Math.RadToDeg,Ya=Phaser.Utils.Objects.GetValue;class Aa extends ga{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 Da(this._rotation)}set angle(t){this.rotation=La(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(Aa.prototype,Ra);const za=Phaser.Utils.String.Pad;var Xa=function(t,e,i){if(null==t)return t;switch(typeof t){case"string":default:return t;case"number":return`#${za(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}},Wa=function(t,e,i){return e.hasOwnProperty(t)?e[t]:i[t]};const Ba=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=Ba(t,"x",0),i=Ba(t,"y",0));var s=this.cornerRadius;s.tl=Ia(Ba(t,"tl",void 0),e,i),s.tr=Ia(Ba(t,"tr",void 0),e,i),s.bl=Ia(Ba(t,"bl",void 0),e,i),s.br=Ia(Ba(t,"br",void 0),e,i)}get radiusTL(){var t=this.cornerRadius.tl;return Math.max(t.x,t.y)}set radiusTL(t){Fa(this.cornerRadius.tl,t)}get radiusTR(){var t=this.cornerRadius.tr;return Math.max(t.x,t.y)}set radiusTR(t){Fa(this.cornerRadius.tr,t)}get radiusBL(){var t=this.cornerRadius.bl;return Math.max(t.x,t.y)}set radiusBL(t){Fa(this.cornerRadius.bl,t)}get radiusBR(){var t=this.cornerRadius.br;return Math.max(t.x,t.y)}set radiusBR(t){Fa(this.cornerRadius.br,t)}};var Ia=function(t,e,i){return void 0===t?t={x:e,y:i}:"number"==typeof t&&(t={x:t,y:t}),Ha(t),t},Fa=function(t,e){"number"==typeof e?(t.x=e,t.y=e):(t.x=Ba(e,"x",0),t.y=Ba(e,"y",0)),Ha(t)},Ha=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 Na=function(t){return!t.hasOwnProperty("convex")||t.convex},Va=function(t){return t.x>0&&t.y>0},Ua=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,Na(a)?Ua(t,o,l,o,l,180,270,!1,h):Ua(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,Na(a)?Ua(t,s-o,l,o,l,270,360,!1,h):Ua(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,Na(a)?Ua(t,s-o,r-l,o,l,0,90,!1,h):Ua(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,Na(a)?Ua(t,o,r-l,o,l,90,180,!1,h):Ua(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())},Ja=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),$a(t.canvas,t.context,d,d,o,l,r,e,i,s,n,h,a)}};const Ka=Phaser.Utils.Objects.GetValue;class qa extends Aa{constructor(t,e){super(t,"background"),this.setScrollFactor(0),this.setColor(Ka(e,"color",null),Ka(e,"color2",null),Ka(e,"horizontalGradient",!0)),this.setStroke(Ka(e,"stroke",null),Ka(e,"strokeThickness",2)),this.setCornerRadius(Ka(e,"cornerRadius",0),Ka(e,"cornerIteration",null))}set color(t){t=Xa(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=Xa(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=Xa(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,Wa("color2",t,this),Wa("horizontalGradient",t,this)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,Wa("strokeThickness",t,this)),t.hasOwnProperty("cornerRadius")&&this.setCornerRadius(t.cornerRadius,Wa("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(){Ja(this.parent,this.color,this.stroke,this.strokeThickness,this.cornerRadius,this.color2,this.horizontalGradient,this.cornerIteration)}}const Za=Phaser.Utils.Objects.GetValue;class Qa extends Aa{constructor(t,e){super(t,"innerbounds"),this.setScrollFactor(0),this.setColor(Za(e,"color",null),Za(e,"color2",null),Za(e,"horizontalGradient",!0)),this.setStroke(Za(e,"stroke",null),Za(e,"strokeThickness",2))}set color(t){t=Xa(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=Xa(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=Xa(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,Za(t,"color2",null),Za(t,"horizontalGradient",!0)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,Za(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 to=Phaser.Utils.Objects.GetValue;let eo=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(to(t,"bold",!1)),this.setItalic(to(t,"italic",!1)),this.setFontSize(to(t,"fontSize","16px")),this.setFontFamily(to(t,"fontFamily","Courier")),this.setColor(to(t,"color","#fff")),this.setStrokeStyle(to(t,"stroke",null),to(t,"strokeThickness",0)),this.setShadow(to(t,"shadowColor",null),to(t,"shadowOffsetX",0),to(t,"shadowOffsetY",0),to(t,"shadowBlur",0)),this.setOffset(to(t,"offsetX",0),to(t,"offsetY",0)),this.setSpace(to(t,"leftSpace",0),to(t,"rightSpace",0)),this.setAlign(to(t,"align",void 0)),this.setBackgroundColor(to(t,"backgroundColor",null)),this.setBackgroundHeight(to(t,"backgroundHeight",void 0)),this.setBackgroundBottomY(to(t,"backgroundBottomY",void 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(Wa("stroke",t,this),Wa("strokeThickness",t,this)),t.hasOwnProperty("shadowColor")&&this.setShadowColor(t.shadowColor),(t.hasOwnProperty("shadowOffsetX")||t.hasOwnProperty("shadowOffsetY"))&&this.setShadowOffset(Wa("shadowOffsetX",t,this),Wa("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),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=Xa(t),this}get hasFill(){return null!=this.color}setStrokeStyle(t,e){return this.stroke=Xa(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=Xa(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=Xa(t),this}get hasBackgroundColor(){return null!=this.backgroundColor}setBackgroundHeight(t){return this.backgroundHeight=t,this}setBackgroundBottomY(t){return this.backgroundBottomY=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 io=Phaser.Utils.Array.Remove,so=Phaser.Utils.Array.Remove,ro="text",no="image",ho="drawer",ao="space",oo="command";var lo=function(t){return t.type===ro&&"\n"===t.text},co=function(t){return t.type===ro&&"\f"===t.text},uo=function(t){return t.type===ro};class po extends Aa{constructor(t,e,i){super(t,ro),this.updateTextFlag=!1,this.style=new eo(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,s=this.drawTRX-i+1,r=e.backgroundBottomY;null==r&&(r=this.drawBLY);var n=e.backgroundHeight;null==n&&(n=r-this.drawTLY);var h=r-n;t.fillRect(i,h,s,n)}var a=e.hasFill,o=e.hasStroke;(a||o)&&(e.syncFont(t).syncStyle(t),o&&(e.syncShadow(t),t.strokeText(this.text,0,0)),a&&(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 vo=function(t,e){var i=this.createCharChildren(t,e);return this.addChild(i),this};const go=Phaser.Display.Canvas.CanvasPool;var fo=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=go.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),go.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 mo extends Aa{constructor(t,e,i){super(t,no),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(){fo(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 yo extends Aa{constructor(t,e,i,s){super(t,ho),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 Aa{constructor(t,e){super(t,ao),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 xo extends ga{constructor(t,e,i,s,r){super(t,oo),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 Co(t){if(null===t||"object"!=typeof t)return t;if(Array.isArray(t))return t.map((t=>Co(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]=Co(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 wo={none:0,word:1,char:2,character:2,mix:3};var Oo=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=To.call(this)).height,h=l.ascent,i=Math.floor((o-h)/n))}else{var l;n=(l=To.call(this)).height,h=l.ascent}}else this.fixedHeight>0?void 0===(i=Mo(t,"maxLines"))&&(o=this.fixedHeight-s,i=Math.floor(o/n)):i=Mo(t,"maxLines",0);void 0===h&&(h=n);var d=0===i,c=Mo(t,"wrapMode");void 0===c&&(c=Mo(t,"charWrap",!1)?"char":"word"),"string"==typeof c&&(c=wo[c]);var u=Mo(t,"wrapWidth",void 0);void 0===u&&(this.fixedWidth>0?u=this.fixedWidth-r:(u=1/0,c=0));for(var p=Mo(t,"letterSpacing",0),v=Mo(t,"hAlign",0),g=Mo(t,"vAlign",0),f=Mo(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,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=Do(t,"maxLines",void 0))){var h=this.fixedWidth-r;i=Math.floor(h/n)+1}}else i=Do(t,"maxLines",0);var a=0===i,o=Do(t,"fixedCharacterHeight",void 0);if(void 0===o){var l=Do(t,"charPerLine",void 0);if(void 0!==l){var d=this.fixedHeight-s;o=Math.floor(d/l)}}var c=Do(t,"wrapHeight",void 0);void 0===c&&(c=this.fixedHeight>0?this.fixedHeight-s:1/0);for(var u=Do(t,"letterSpacing",0),p=Do(t,"rtl",!0),v=Do(t,"hAlign",p?2:0),g=Do(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,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 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 Me(i,t,e),this.dirty=this.dirty||s!=i.left||r!=i.right||n!=i.top||h!=i.bottom,this},getPadding:function(t){return Ee(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),io(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 so(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(ro);return null===i?i=new po(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)),Ma(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 nl={};class hl{constructor(t){this.pools=rl(t,"pools",nl)}free(t){if(!this.pools)return this;var e=t.type;return this.pools.hasOwnProperty(e)||(this.pools[e]=new sl),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=vl(t,r,e,i,n),a=0;a<=cl&&0!==h;a++){if((r+=h)<0){r=0;break}h=vl(t,r,e,i,n)}return a===cl&&console.warn("FontSizeFit: Test count exceeds 65535"),t.setFontSize(r),gl(t,e,i),t},pl=function(t,e,i){return void 0===i[e]&&(t.setFontSize(e),i[e]={width:t.width,height:t.height}),i[e]},vl=function(t,e,i,s,r){var n,h=pl(t,e,r),a=pl(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)},gl=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 fl=Phaser.Utils.Objects.GetValue,ml=Phaser.Utils.Objects.GetValue;class yl extends Dh{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexLabel";var i,s=ml(e,"background",void 0),r=ml(e,"icon",void 0),n=ml(e,"iconMask",void 0),h=ml(e,"text",void 0),a=ml(e,"action",void 0),o=ml(e,"actionMask",void 0),l=ml(e,"align",void 0);if(s&&this.addBackground(s),r){0===this.orientation?(h||a)&&(i={right:ml(e,"space.icon",0),top:ml(e,"space.iconTop",0),bottom:ml(e,"space.iconBottom",0),left:ml(e,"space.iconLeft",0)}):(h||a)&&(i={bottom:ml(e,"space.icon",0),left:ml(e,"space.iconLeft",0),right:ml(e,"space.iconRight",0),top:ml(e,"space.iconTop",0)});var d=ml(e,"squareFitIcon",!1)?1:0;if(this.add(r,{proportion:0,padding:i,fitRatio:d}),n&&(n=Bh.call(this,r,r,1)),!d){var c=ml(e,"iconSize",void 0);this.setIconSize(ml(e,"iconWidth",c),ml(e,"iconHeight",c))}}if(h){var u=ml(e,"wrapText",!1),p=ml(e,"adjustTextFontSize",!1);u?(!0===u&&(u="word"),function(t,e){switch(Gh(t)){case 0:switch("string"==typeof e&&(e=ia[e]||0),t.style.wrapMode=e,e){case 2:case 3:t.style.wordWrapCallback=Uh;break;default:t.style.wordWrapCallback=null}break;case 1:"string"==typeof e&&(e=ia[e]||0),t.style.wrapMode=e}}(h,u),e.expandTextWidth=!0,dl(h)):p&&(e.expandTextWidth=!0,e.expandTextHeight=!0,function(t,e){"number"==typeof e&&(e={minWidth:e});var i=fl(e,"minWidth",0),s=fl(e,"minHeight",0),r=fl(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 ul(t,e,i),t}):(t.runWidthWrap=function(e){return t.setFixedSize&&t.setFixedSize(0,0),ul(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=ml(e,"space.text",0),m=ml(e,"expandTextWidth",!1),y=ml(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:ml(e,"space.actionTop",0),bottom:ml(e,"space.actionBottom",0),right:ml(e,"space.actionRight",0)}:{left:ml(e,"space.actionLeft",0),right:ml(e,"space.actionRight",0),bottom:ml(e,"space.actionBottom",0)},d=ml(e,"squareFitAction",!1)?1:0,this.add(a,{proportion:0,padding:i,fitRatio:d}),o&&(o=Bh.call(this,a,a,1)),!d)){var b=ml(e,"actionSize");this.setActionSize(ml(e,"actionWidth",b),ml(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 bl={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=xl[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 xl={down:0,up:1},Cl=Eh.prototype.add,Sl=Eh.prototype.addSpace;var wl=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)&&Sl.call(this),Cl.call(this,t,{proportion:i,expand:!0});var s=!this.buttonsExpand&&"center"===this.buttonsAlign;s&&Sl.call(this),this.hasTailSpace=s}else Cl.call(this,t,{proportion:i,expand:!0}),this.hasTailSpace=!1;else if(this.hasTailSpace){var r=this.sizerChildren.length-1;Cl.call(this,t,{index:r,proportion:i,expand:!0})}else Cl.call(this,t,{proportion:i,expand:!0});return e&&this.buttonGroup.add(t),this},Ol={addButton(t){if(dr(t))for(var e=t,i=0,s=e.length;i=0;i--)_l.call(this,e[i],t);return this}},El=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)}},Ml=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,El.call(e,t,i,s)}},enumerable:!0,configurable:!0}),t.selected=!1},Rl={add(t){return this.buttons.push(t),t._click||(t._click=new xr(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`),Ml.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=Nl(a.left,a.centerY,t,e))&&(r=o,s=n);var o,l=i[n+1];l&&l.y===a.y||r>(o=Nl(a.right,a.centerY,t,e))&&(r=o,s=n+1)}}return s};const Ul=Phaser.Utils.Objects.IsPlainObject,$l=Phaser.Utils.Objects.GetValue,Jl=Phaser.Display.Align.CENTER;var Kl=function(t,e,i,s){return"\n"===t?(this.addNewLine(),this):(ge.call(this,t),Ul(e)&&(e=$l(r=e,"padding",0),i=$l(r,"key",void 0),s=$l(r,"index",void 0)),void 0===e&&(e=0),(r=this.getSizerConfig(t)).align=Jl,r.padding=pe(e),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},ql={add(t,e,i){if(dr(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,fh.call(this,t),this}},td={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&&ad.addNewLine(this)}else for(n=0,h=t.length;n=0;i--)ud.call(this,e[i],t);return this}};const vd=Phaser.Utils.Objects.GetValue;class gd extends nd{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 Wl({parent:this,eventEmitter:vd(e,"eventEmitter",this),groupName:vd(e,"groupName",void 0),clickConfig:vd(e,"click",void 0)}).setButtonsType(e);var s=vd(e,"background",void 0),r=vd(e,"buttons",void 0);this.buttonsAlign=vd(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(gd.prototype,ld,pd,Xl,jl);var fd={v:0,vertical:0,y:0,h:1,horizontal:1,x:1,xy:2,vh:2},md=function(t,e){void 0===e&&(e="scrollMode"),t.hasOwnProperty(e)||(t[e]=yd(t));var i=t[e];return"string"==typeof i&&(i=fd[i]),i},yd=function(t){var e=!!t.sliderY||!!t.scrollerY,i=!!t.sliderX||!!t.scrollerX;return e&&i?2:e?0:i?1:0},bd=function(){return Array.prototype.reduce.call(arguments,xd,0)},xd=function(t,e){return t+e};const Cd=Phaser.Utils.Objects.IsPlainObject,Sd=Phaser.Utils.Objects.GetValue,wd=Phaser.Display.Align.CENTER;var Od=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 Pd(this.sizerChildren,null),fh.call(this,t),this}},Td={setColumnSpace(t){if(this.space.column||(this.space.column=[]),this.space.column.length=this.columnCount-1,"number"==typeof t)Pd(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},Ld={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===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,Pd(this.sizerChildren,null),this.columnProportions=[],this.columnProportions.length=t,"number"==typeof i)Pd(this.columnProportions,i);else for(var n=0;n0?e+=t:0===t&&(this.hasColumnProportion0Child=!0);return e},Yd=function(){for(var t,e=0,i=0;i0?e+=t:0===t&&(this.hasRowProportion0Child=!0);return e};const Ad=Phaser.Utils.Objects.IsPlainObject,zd=Phaser.Utils.Objects.GetValue;class Xd extends ih{constructor(t,e,i,s,r,n,h,a,o,l){Ad(e)?(e=zd(l=e,"x",0),i=zd(l,"y",0),s=zd(l,"width",void 0),r=zd(l,"height",void 0),n=zd(l,"column",l.col||0),h=zd(l,"row",0),a=zd(l,"columnProportions",0),o=zd(l,"rowProportions",0)):Ad(s)?(s=zd(l=s,"width",void 0),r=zd(l,"height",void 0),n=zd(l,"column",l.col||0),h=zd(l,"row",0),a=zd(l,"columnProportions",0),o=zd(l,"rowProportions",0)):Ad(n)?(n=zd(l=n,"column",l.col||0),h=zd(l,"row",0),a=zd(l,"columnProportions",0),o=zd(l,"rowProportions",0)):Ad(a)&&(a=zd(l=a,"columnProportions",0),o=zd(l,"rowProportions",0)),super(t,e,i,s,r,l),this.type="rexGridSizer",this.sizerChildren=[],this.addChildrenMap("items",this.sizerChildren),this.setCreateCellContainerCallback(zd(l,"createCellContainerCallback")),this.setIndentLeft(zd(l,"space.indentLeftOdd",0),zd(l,"space.indentLeftEven",0)),this.setIndentTop(zd(l,"space.indentTopOdd",0),zd(l,"space.indentTopEven",0)),this.resetGrid(n,h,a,o,zd(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=Dd.call(this)),this._totalColumnProportions}get totalRowProportions(){return void 0===this._totalRowProportions&&(this._totalRowProportions=Yd.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,Ld);const Wd=Phaser.Utils.Objects.GetValue;var Bd=Phaser.Renderer.WebGL.Utils,jd=function(t,e,i,s,r,n){for(var h=Bd.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+")"},Nd=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 Vd=Phaser.Renderer.Canvas.SetTransform;var Ud={renderWebGL:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.pipelines.set(e.pipeline),n=Hd(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&&jd(r,h,e,l,a,o),e.isStroked&&Fd(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(Vd(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(Jd.prototype,Ud);var Kd=function(t){return t.x>0&&t.y>0},qd=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 Zd=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 Zc=Phaser.Utils.Objects.GetValue,Qc=Phaser.Utils.Objects.IsPlainObject;class tu extends(kc(mc)){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 Kc).setName("trackFill")).addShape((new Kc).setName("bar")).addShape((new Kc).setName("trackStroke")),this.setTrackColor(Zc(a,"trackColor",void 0)),this.setBarColor(n),this.setTrackStroke(Zc(a,"trackStrokeThickness",2),Zc(a,"trackStrokeColor",void 0)),this.setSkewX(Zc(a,"skewX",0)),this.setRTL(Zc(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 eu={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&&qc(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),qc(h,r,0,n,i,t));var a=this.getShape("trackStroke");a.lineStyle(this.trackStrokeThickness,this.trackStrokeColor),a.isStroked&&qc(a,0,0,e,i,t)}};Object.assign(tu.prototype,eu);var iu=function(t){return null==t||""===t||0===t.length},su=function(t,e,i,s){if(void 0===s&&(s="."),"object"==typeof t){if(iu(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(iu(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=Co(i),s=Co(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 Cu(t)?(this.stretchMode.edge=wu(Su(t,"edge",0)),this.stretchMode.internal=wu(Su(t,"internal",0))):(t=wu(t),this.stretchMode.edge=t,this.stretchMode.internal=t),this},getStretchMode:function(t,e){return ku.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 _u=Phaser.Utils.Objects.IsPlainObject,Tu=Phaser.Utils.Objects.GetValue,Eu=Phaser.GameObjects;var Mu=void 0,Ru=function(t,e){if(Mu||(Mu={},Ze(t).events.once("destroy",(function(){for(var t in Mu)Mu[t].destroy();Mu=void 0}))),!Mu.hasOwnProperty(e)){var i=Ze(t).scene.systemScene;(t=new Eu[e](i)).setOrigin(0),Mu[e]=t}return Mu[e]};const Lu=Phaser.GameObjects.RenderTexture;class Du extends(function(t,e){class i extends t{constructor(t,i,s,r,n,h,a,o,l,d){if(_u(i)?(i=Tu(d=i,"x",0),s=Tu(d,"y",0),r=Tu(d,"width",1),n=Tu(d,"height",1),h=Tu(d,"key",void 0),a=Tu(d,"baseFrame",void 0),o=Tu(d,"columns",void 0),l=Tu(d,"rows",void 0)):_u(r)?(r=Tu(d=r,"width",1),n=Tu(d,"height",1),h=Tu(d,"key",void 0),a=Tu(d,"baseFrame",void 0),o=Tu(d,"columns",void 0),l=Tu(d,"rows",void 0)):_u(h)?(h=Tu(d=h,"key",void 0),a=Tu(d,"baseFrame",void 0),o=Tu(d,"columns",void 0),l=Tu(d,"rows",void 0)):_u(a)?(a=Tu(d=a,"baseFrame",void 0),o=Tu(d,"columns",void 0),l=Tu(d,"rows",void 0)):Array.isArray(a)?(d=l,l=o,o=a,a=Tu(d,"baseFrame",void 0)):_u(o)&&(o=Tu(d=o,"columns",void 0),l=Tu(d,"rows",void 0)),void 0===a&&(a=Tu(d,"frame",void 0)),void 0===o){var c=Tu(d,"leftWidth",void 0),u=Tu(d,"rightWidth",void 0);void 0!==c&&void 0!==u&&(o=[c,void 0,u])}if(void 0===l){var p=Tu(d,"topHeight",void 0),v=Tu(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(Tu(d,"getFrameNameCallback",void 0)),this.setStretchMode(Tu(d,"stretchMode",0)),this.setPreserveRatio(Tu(d,"preserveRatio",!0));var g=Tu(d,"maxFixedPartScale",1),f=Tu(d,"maxFixedPartScaleX",g),m=Tu(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,Pu),i}(Lu,"rexNinePatch")){}var Yu={_drawImage:function(t,e,i,s,r,n){var h=Ru(this,"Image").setTexture(t,e).setDisplaySize(r,n);this.draw(h,i,s)},_drawTileSprite:function(t,e,i,s,r,n){var h=Ru(this,"TileSprite").setTexture(t,e).setSize(r,n);this.draw(h,i,s)}};Object.assign(Du.prototype,Yu);let Au=class extends ti{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 zu=Phaser.Utils.Objects.GetValue;class Xu extends Du{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexStatesNinePatch";var i=zu(e,"effects",!0);i&&cu(this,i),this.style=new Au(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign(Xu.prototype,lc);const Wu=["alpha","tint","flipX","flipY"];var Bu=function(t,e){if(!e)return t;for(var i=0,s=Wu.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 mp=Phaser.Utils.Objects.GetValue,yp=Phaser.Math.Distance.Between;class bp extends ti{constructor(t,e){super(t,e),this._enable=void 0,this.rectBoundsInteractive=mp(e,"rectBoundsInteractive",!1),this.rectBoundsInteractive||t.setInteractive(mp(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(mp(t,"enable",!0)),this.holdThreshold=mp(t,"holdThreshold",50),this.pointerOutReleaseEnable=mp(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 un(this.scene)}get speed(){return this.x===this.preX&&this.y===this.preY?0:yp(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 xp=Phaser.Utils.Objects.GetValue;class Cp{constructor(t){this.resetFromJSON(t)}resetFromJSON(t){return this.setValue(xp(t,"value",0)),this.setSpeed(xp(t,"speed",0)),this.setAcceleration(xp(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 Sp{constructor(){this.value,this.dir,this.movement=new Cp}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 Pp={y:0,v:0,vertical:0,x:1,h:1,horizontal:1},_p=Phaser.Utils.Objects.GetValue;class Tp extends ti{constructor(t,e){switch(super(t,e),this.parent!==this.scene?this.focusMode=_p(e,"focus",!0):this.focusMode=!1,"boolean"==typeof this.focusMode&&(this.focusMode=this.focusMode?1:0),this.setSpeed(_p(e,"speed",.1)),this.setEnable(_p(e,"enable",!0)),this.focusMode){case 0:case 2:this.scene.input.on("wheel",this.onSceneScroll,this);break;default:t.setInteractive(_p(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 Ep=Phaser.Utils.Objects.GetValue;var Mp=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)?Ep(s,l,void 0):Ep(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 gp(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);var p=Ep(r,"position",0);"string"==typeof p&&(p=Rp[p]);var v,g,f=Ep(s,`space.slider${i}`,void 0);void 0===f&&void 0===(f=Ep(s,"space.slider",void 0))&&(a?f=0:v=Ep(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:Ep(v,"right",v)}):(d=0,c=1,u=void 0===v?g?{right:f}:f:{right:Ep(v,"left",v)}):0===p?(d=1,c=2,u=void 0===v?g?{top:f}:f:{top:Ep(v,"bottom",v)}):(d=1,c=0,u=void 0===v?g?{bottom:f}:f:{bottom:Ep(v,"top",v)}),e.add(n,{column:d,row:c,align:"center",padding:u,expand:!0}),t[`hideUnscrollableSlider${i}`]=Ep(r,"hideUnscrollableSlider",!1),t[`adaptThumb${i}SizeMode`]=Ep(r,"adaptThumbSize",!1),t[`minThumb${i}Size`]=Ep(r,"minThumbSize",void 0)}else t[`hideUnscrollableSlider${i}`]=!1,t[`adaptThumb${i}SizeMode`]=!1,t[`minThumb${i}Size`]=void 0;var m,y,b=Ep(s,"scrollDetectionMode");"string"==typeof b&&(b=Lp[b]);var x=`scroller${i}`;(m=a||s.hasOwnProperty(x)?Ep(s,x,!0):Ep(s,"scroller",!0))&&o&&(!0===m&&(m={}),m.orientation=h?0:1,void 0!==b&&(m.rectBoundsInteractive=1===b),y=new kp(o,m),o.isRexContainerLite&&o.sendChildToBack(o));var C,S,w,O,k,P=Ep(s,a?`mouseWheelScroller${i}`:"mouseWheelScroller",!1);P&&o&&(void 0!==b&&(P.focus=1===b?2:0),C=new Tp(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.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&&(k=a?`addChildO${i}`:"addChildOY",C.on("scroll",(function(e){t[k](-e,!0)})))};const Rp={right:0,left:1,bottom:0,top:1},Lp={gameObject:0,rectBounds:1},Dp=Phaser.Utils.Objects.GetValue;var Yp=function(t,e){var i=t.scene,s=[0,1,0],r=[0,1,0],n=Dp(e,"width"),h=Dp(e,"height");n||Dp(e,"child.expandWidth",!0)||(s[1]=0),h||Dp(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=Wd(i,"child"),r=Wd(s,"gameObject",void 0);if(r){var n=Wd(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=Wd(n,"top",0),h.bottom=Wd(n,"bottom",0),a.left=Wd(n,"left",0),a.right=Wd(n,"right",0);break;case 1:h.top=Wd(n,"left",0),h.bottom=Wd(n,"right",0),a.top=Wd(n,"top",0),a.bottom=Wd(n,"bottom",0);break;default:h.top=Wd(n,"top",0),h.bottom=Wd(n,"bottom",0),h.left=Wd(n,"left",0),h.right=Wd(n,"right",0)}e.add(r,{column:1,row:1,align:Wd(s,"align","center"),padding:a,expand:{width:Wd(s,"expandWidth",!0),height:Wd(s,"expandHeight",!0)}})}t.addChildrenMap("child",r)}(t,a,e),t.scrollMode){case 0:Mp(t,a,"y",e);break;case 1:Mp(t,a,"x",e);break;default:Mp(t,a,"y",e),Mp(t,a,"x",e)}return a},Ap=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}`]}if(s){var n="Y"===t?this.scaleY:this.scaleX;s.setBounds(e,i*n)}r&&r.setEnable(e!==i)},zp=function(t){switch(this.scrollMode){case 0:case 1:(e=this.childrenMap.slider)&&this.hideUnscrollableSlider&&this.setChildVisible(e,this.isOverflow);break;default:t=t.toUpperCase();var e=this.childrenMap[`slider${t}`],i=this[`hideUnscrollableSlider${t}`],s=this[`isOverflow${t}`];e&&i&&this.setChildVisible(e,s)}},Xp=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(rv.prototype,tv);const nv=["top","bottom","centerY","center"],hv=["left","right","centerX","center"];var av=function(t,e,i){var s,r="Y"===(e=e.toUpperCase()),n=this.childrenMap.child;if(r){if(i)for(var h=0,a=nv.length;h=0?0:Math.abs(l)<=Math.abs(d)?l:d}}else{if(i)for(h=0,a=hv.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 ov=Phaser.Utils.Objects.GetValue;class lv extends Ip{constructor(t,e){void 0===e&&(e={});var i=md(e),s=ov(e,"panel",void 0);void 0===s&&(s={}),s.scrollMode=i,s.clampChildOY=ov(e,"clampChildOY",!1),s.clampChildOX=ov(e,"clampChildOX",!1);var r,n,h=new rv(t,s);switch(t.add.existing(h),i){case 0:r=ov(e,"expand.panel",!0),n=!0;break;case 1:r=!0,n=ov(e,"expand.panel",!0);break;default:r=!0,n=!0}e.type="rexScrollablePanel",e.child={gameObject:h,expandWidth:r,expandHeight:n,align:ov(e,"align.panel","center")};var a=ov(e,"space",void 0);a&&(a.child=ov(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]),Qn(this.childrenMap.child,t),this}}var dv={scrollToChild:function(t,e){if(!this.hasChild(t))return this;switch(this.scrollMode){case 0:av.call(this,t,"y",e);break;case 1:av.call(this,t,"x",e);break;default:av.call(this,t,"y",e),av.call(this,t,"x",e)}return this}};Object.assign(lv.prototype,dv);const cv=Phaser.Utils.Objects.GetValue;var uv=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=pv(e,u),this.listMaxHeight>0&&(s.layout(),s.height<=this.listMaxHeight&&(d=s)),!d){0===c&&(c=this.listMaxHeight);var p=vv(e,this.listCreateSliderTrackCallback),v=vv(e,this.listCreateSliderThumbCallback);d=new lv(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:cv(this.listSpace,"panel",0)}}),e.add.existing(d)}}else u.height=c,s=pv(e,u),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},pv=function(t,e,i){var s;return i?(e.orientation="x",s=new gd(t,e)):(e.orientation="y",s=new Fl(t,e)),t.add.existing(s),s},vv=function(t,e,i){var s;return e&&(s=e.call(i,t),t.add.existing(s)),s},gv=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 yv={down:0,up:1},bv=Phaser.Utils.Objects.GetValue;class xv extends js{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=function(t,e){Ti(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 Pi(t,n):r.resetFromJSON(n),r.restart()}(t,e,"y","Linear")}),e.manualClose=!0,e.clickOutsideClose=!0,e.destroy=!0,super(t,e),mv(t,e),t.isRexSizer&&t.layout();var i=bv(e,"touchOutsideClose",!1),s=bv(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&&Qs(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 Cv={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}},Sv={openListPanel:function(){if(this.listPanel)return this;if(0===this.options.length)return this;var t,e=uv.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 xv(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(Sv,bl,Cv);const wv=Phaser.Utils.Objects.GetValue;class Ov extends yl{constructor(t,e){super(t,e),this.type="rexDropDownList",this.timer=void 0,this.listPanel=void 0,this.currentOverIndex=void 0,this.setOptions(wv(e,"options"));var i=wv(e,"list");this.setWrapEnable(wv(i,"wrap",!1)),this.setCreateButtonCallback(wv(i,"createButtonCallback")),this.setCreateListBackgroundCallback(wv(i,"createBackgroundCallback")),this.setCreateListSliderTrackCallback(wv(i,"createTrackCallback")),this.setCreateListSliderThumbCallback(wv(i,"createThumbCallback")),this.setListSliderAdaptThumbSizeEnable(wv(i,"sliderAdaptThumbSize",!1)),this.setListScrollerConfig(wv(i,"scroller")),this.setListMouseWheelScrollerConfig(wv(i,"mouseWheelScroller")),this.setButtonClickCallback(wv(i,"onButtonClick")),this.setButtonOverCallback(wv(i,"onButtonOver")),this.setButtonOutCallback(wv(i,"onButtonOut")),this.setListExpandDirection(wv(i,"expandDirection")),this.setListEaseInDuration(wv(i,"easeIn",500)),this.setListEaseOutDuration(wv(i,"easeOut",100)),this.setListTransitInCallback(wv(i,"transitIn")),this.settListTransitOutCallback(wv(i,"transitOut")),this.setListMaxHeight(wv(i,"maxHeight",0)),this.setListSize(wv(i,"width"),wv(i,"height",0)),this.setListAlignmentMode(wv(i,"alignParent","text")),this.setListAlignmentSide(wv(i,"alignSide","")),this.setListBounds(wv(i,"bounds")),this.setListSpace(wv(i,"space")),this.setListDraggable(wv(i,"draggable",!1)),this.setValueChangeCallback(wv(e,"setValueCallback"),wv(e,"setValueCallbackScope")),this.setValue(wv(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(Ov.prototype,Sv);const kv=Phaser.GameObjects.Text,Pv=Phaser.Utils.Objects.GetValue;class _v extends kv{constructor(t,e){void 0===e&&(e={}),super(t,Pv(e,"x",0),Pv(e,"y",0),Pv(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(_v.prototype,lc);var Tv=Phaser.Renderer.WebGL.Utils,Ev={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=Tv.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 Mv=Phaser.Display.Canvas.CanvasPool;e();const Rv=Phaser.GameObjects.GameObject;class Lv extends Rv{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=Mv.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 Mv.remove(s),i;for(var l=r.getImageData(0,0,h,o).data,d=!1,c=0;c * @copyright 2018 Photon Storm Ltd. diff --git a/dist/rexsimplelabel.js b/dist/rexsimplelabel.js index 95eca4c266..d02dd82f06 100644 --- a/dist/rexsimplelabel.js +++ b/dist/rexsimplelabel.js @@ -19052,6 +19052,10 @@ Render$2 ); + var IsArcCorner = function (radius) { + return ((radius.x > 0) && (radius.y > 0)); + }; + var LineTo = function (x, y, pathData) { var cnt = pathData.length; if (cnt >= 2) { @@ -19133,8 +19137,7 @@ geom.setTo(0, 0, width, height, radius); } - var iteration = GetValue$x(radiusConfig, 'iteration', undefined); - this.setIteration(iteration); + this.setIteration(GetValue$x(radiusConfig, 'iteration', undefined)); this.setPosition(x, y); this.setFillStyle(fillColor, fillAlpha); @@ -19387,10 +19390,6 @@ } - var IsArcCorner = function (radius) { - return ((radius.x > 0) && (radius.y > 0)); - }; - const ShapeTypeMap = { rectangle: 0, circle: 1 @@ -20904,6 +20903,7 @@ var skewX = this.skewX; var width = this.width - Math.abs(skewX); var height = this.height; + var trackFill = this.getShape('trackFill'); trackFill.fillStyle(this.trackColor); if (trackFill.isFilled) { @@ -20912,8 +20912,7 @@ 0, 0, // x0, y0 width, height, // x1, y1 skewX // skewX - ) - .close(); + ); } var bar = this.getShape('bar'); @@ -20933,8 +20932,7 @@ barX0, 0, // x0, y0 barX1, height, // x1, y1 skewX // skew - ) - .close(); + ); } var trackStroke = this.getShape('trackStroke'); @@ -20945,8 +20943,7 @@ 0, 0, // x0, y0 width, height, // x1, y1 skewX // skewX - ) - .end(); + ); } }; @@ -20966,6 +20963,8 @@ .lineTo(x0, y0).lineTo(startX, y0); } + lines.close(); + return lines; }; @@ -20976,24 +20975,33 @@ constructor(scene, x, y, width, height, barColor, value, config) { if (IsPlainObject$8(x)) { config = x; - x = GetValue$u(config, 'x', 0); - y = GetValue$u(config, 'y', 0); - width = GetValue$u(config, 'width', 2); - height = GetValue$u(config, 'height', 2); - barColor = GetValue$u(config, 'barColor', undefined); - value = GetValue$u(config, 'value', 0); + + x = config.x; + y = config.y; + width = config.width; + height = config.height; + barColor = config.barColor; + value = config.value; } else if (IsPlainObject$8(width)) { config = width; - width = GetValue$u(config, 'width', 2); - height = GetValue$u(config, 'height', 2); - barColor = GetValue$u(config, 'barColor', undefined); - value = GetValue$u(config, 'value', 0); + + width = config.width; + height = config.height; + barColor = config.barColor; + value = config.value; } else if (IsPlainObject$8(barColor)) { config = barColor; - barColor = GetValue$u(config, 'barColor', undefined); - value = GetValue$u(config, 'value', 0); + + barColor = config.barColor; + value = config.value; } + if (x === undefined) { x = 0; } + if (y === undefined) { y = 0; } + if (width === undefined) { width = 2; } + if (height === undefined) { height = width; } + if (value === undefined) { value = 0; } + super(scene, x, y, width, height, config); this.type = 'rexLineProgress'; diff --git a/dist/rexsimplelabel.min.js b/dist/rexsimplelabel.min.js index a97050aec2..4be17fc8ea 100644 --- a/dist/rexsimplelabel.min.js +++ b/dist/rexsimplelabel.min.js @@ -1,4 +1,4 @@ -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}},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 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}},Pe=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 _e=/(\S+)\[(\d+)\]/i,Te=Phaser.Utils.Objects.GetValue;var ke=function(t,e){return void 0===e?t:t[e]},Ee=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=Te(e,"left",0),t.right=Te(e,"right",0),t.top=Te(e,"top",0),t.bottom=Te(e,"bottom",0)),t},Me={getInnerPadding(t){return ke(this.space,t)},setInnerPadding(t,e){return Ee(this.space,t,e),this},getOuterPadding(t){return ke(this.getSizerConfig(this).padding,t)},setOuterPadding(t,e){return Ee(this.getSizerConfig(this).padding,t,e),this},getChildOuterPadding(t,e){return"string"==typeof t&&(t=this.getElement(t)),ke(this.getSizerConfig(t).padding,e)},setChildOuterPadding(t,e,i){return"string"==typeof t&&(t=this.getElement(t)),Ee(this.getSizerConfig(t).padding,e,i),this}},Re=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}},Le=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},De=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}},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},Xe=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},ze={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}},We=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?vi:pi,this.repeatCounter=0,this}stop(){return this.state=ui,this}update(t,e){this.state!==ui&&this.state!==fi&&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=gi)):(this.nowTime=this.duration,this.state=fi):this.nowTime>=0&&(this.state=vi))}get t(){var t;switch(this.state){case ui:case pi:case gi:t=0;break;case vi:t=this.nowTime/this.duration;break;case fi:t=1}return di(t,0,1)}set t(t){(t=di(t,-1,1))<0?(this.state=pi,this.nowTime=-this.delay*t):(this.state=vi,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===ui}get isDelay(){return this.state===pi}get isCountDown(){return this.state===vi}get isRunning(){return this.state===pi||this.state===vi}get isDone(){return this.state===fi}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}}const ui=0,pi=1,vi=2,gi=3,fi=-1;class mi extends ai{constructor(t,e){super(t,e),this.timer=new ci}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 yi=Phaser.Utils.Objects.GetValue,bi=Phaser.Utils.Objects.GetAdvancedValue,xi=Phaser.Tweens.Builders.GetEaseFunction;class wi extends mi{resetFromJSON(t){return this.timer.resetFromJSON(yi(t,"timer")),this.setEnable(yi(t,"enable",!0)),this.setTarget(yi(t,"target",this.parent)),this.setDelay(bi(t,"delay",0)),this.setDuration(bi(t,"duration",1e3)),this.setEase(yi(t,"ease","Linear")),this.setRepeat(yi(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 Si=Phaser.Utils.Objects.GetValue,Ci=Phaser.Utils.Objects.GetAdvancedValue,Oi=Phaser.Math.Linear;let Pi=class extends wi{constructor(t,e){super(t,e),this.scaleStart={},this.scaleEnd={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(Si(t,"mode",0)),this.setScaleRange(Ci(t,"start",void 0),Ci(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=_i[t]),this.mode=t,this}setScaleRange(t,e){return"number"==typeof t?(this.startX=t,this.startY=t):(this.startX=Ci(t,"x",this.parent.scaleX),this.startY=Ci(t,"y",this.parent.scaleY)),"number"==typeof e?(this.endX=e,this.endY=e):(this.endX=Ci(e,"x",void 0),this.endY=Ci(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 _i={stop:0,destroy:1,yoyo:2};var Ti=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 Pi(t,a):r.resetFromJSON(a),r.restart(),r},ki=function(t,e,i,s,r,n){void 0===s&&(s="Linear"),r instanceof Pi&&(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 Pi(t,h):n.resetFromJSON(h),n.restart(),n},Ei=function(t,e){return new Promise((function(i,s){t.once(e,(function(){i()}))}))},Mi=function(t){return Ei(t,"complete")};const Ri=Phaser.Utils.Objects.IsPlainObject;var Li={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(Ri(t)){var s=t;t=s.duration,e=s.orientation,i=s.ease}var r=void 0===this._scaleBehavior;return this._scaleBehavior=Ti(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(Ri(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=ki(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(Ri(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 Pi(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),Mi(this._scaleBehavior)},isRunningScaleYoyo(){return this._scaleBehavior&&(this._scaleBehavior.completeEventName="scaleyoyo.complete")},isRunningEaseScale(){return this.isRunningPopUp()||this.isRunningScaleDown()||this.isRunningScaleYoyo()}},Di={};Object.assign(Di,Li),Di.onInitScale=function(){Li.onInitScale.call(this);var t=this;this._scaleBehavior.on("update",(function(){var e=me.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const Ai=Phaser.Utils.Objects.GetValue,Yi=Phaser.Utils.Objects.GetAdvancedValue,Xi=Phaser.Math.Linear;class zi extends wi{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(Yi(t,"start",this.parent.alpha),Yi(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=Wi[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=Xi(this.alphaStart,this.alphaEnd,i)}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Wi={stop:0,destroy:1,yoyo:2},Fi=Phaser.Utils.Objects.IsPlainObject;var ji=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 zi(t,h):s.resetFromJSON(h),s.restart(),s},Ii=function(t,e,i,s){i instanceof zi&&(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 zi(t,r):s.resetFromJSON(r),s.restart(),s};const Bi=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(Bi(t)){var i=t;t=i.duration,e=i.alpha}var s=void 0===this._fade;return this._fade=ji(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(Bi(t)){var i=t;t=i.duration,e=i.destroy}var s=void 0===this._fade;return this._fade=Ii(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()}},Ni={};Object.assign(Ni,Hi),Ni.onInitFade=function(){Hi.onInitFade.call(this);var t=this;this._fade.on("update",(function(){var e=me.getParentSizer(t);e&&e.resetChildAlphaState(t)}))};const Gi=Phaser.Utils.Objects.GetValue,Vi=Phaser.Utils.Objects.GetAdvancedValue,Ui=Phaser.Math.Linear;class $i extends wi{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){if(super.resetFromJSON(t),this.setMode(Gi(t,"mode",0)),t&&(t.hasOwnProperty("x")||t.hasOwnProperty("y"))){var e=Vi(t,"x",void 0),i=Vi(t,"y",void 0);this.setTargetPosition(e,i)}else this.setTargetPosition(t);return this}setMode(t){return"string"==typeof t&&(t=Ji[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=Vi(i,"startX",void 0),this.startY=Vi(i,"startY",void 0),this.endX=Vi(i,"endX",void 0),this.endY=Vi(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=Ui(this.startX,this.endX,i)),this.hasMoveY&&(t.y=Ui(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Ji={stop:0,destroy:1,yoyo:2};var Ki=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,Zi=Phaser.Math.Distance.Between;var Qi={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*Zi(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 $i&&(h=n,n=void 0),void 0===n&&(n=!1);var a={};return a.mode=n?1:0,void 0!==i&&(a.startX=Ki(i,t.x),a.endX=t.x),void 0!==s&&(a.startY=Ki(s,t.y),a.endY=t.y),a.duration=e,a.ease=void 0===r?"Linear":r,void 0===h?h=new $i(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),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*Zi(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 $i&&(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=Ki(i,t.x)),void 0!==s&&(a.startY=t.y,a.endY=Ki(s,t.y)),a.duration=e,a.ease=void 0===r?"Linear":r,void 0===h?h=new $i(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),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}},ts={};Object.assign(ts,Qi),ts.onInitEaseMove=function(){Qi.onInitEaseMove.call(this);var t=this;this._easeMove.on("update",(function(){var e=me.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const es=Phaser.Utils.Objects.GetValue;class is extends ri{constructor(t,e){super(t,e),this.timer=new ci,this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.timer.resetFromJSON(es(t,"timer")),this.setEnable(es(t,"enable",!0)),this.setMode(es(t,"mode",1)),this.isRunning=es(t,"isRunning",!1),this.setMagnitudeMode(es(t,"magnitudeMode",1)),this.setAxisMode(es(t,"axis",0)),this.setDuration(es(t,"duration",500)),this.setMagnitude(es(t,"magnitude",10)),this.ox=es(t,"ox",void 0),this.oy=es(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=ss[t]),this.mode=t,this}setMagnitudeMode(t){return"string"==typeof t&&(t=ns[t]),this.magnitudeMode=t,this}setAxisMode(t){return"string"==typeof t&&(t=rs[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=es(i,"magnitude",void 0),t=es(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 ss={effect:0,behavior:1},rs={both:0,"h&v":0,"x&y":0,horizontal:1,h:1,x:1,vertical:2,v:2,y:2},ns={constant:0,decay:1},hs=Phaser.Utils.Objects.IsPlainObject;var as={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 is(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 os=Phaser.Utils.Objects.GetValue,ls=Phaser.Math.Linear;class ds extends wi{constructor(t,e){super(t,e),this.resetFromJSON(),this.boot()}start(t){if(this.timer.isRunning)return this;var e=this.target;this.propertyKey=os(t,"key","value");var i=e[this.propertyKey];return this.fromValue=os(t,"from",i),this.toValue=os(t,"to",i),this.setEase(os(t,"ease",this.ease)),this.setDuration(os(t,"duration",this.duration)),this.setRepeat(os(t,"repeat",0)),this.setDelay(os(t,"delay",0)),this.setRepeatDelay(os(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]=ls(this.fromValue,this.toValue,i)}}const cs=Phaser.Utils.Objects.IsPlainObject;class us extends Qe{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 ds(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(cs(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(cs(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 ps={easeDataTo(t,e,i,s){return this._easeData||(this._easeData=new us(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),Ei(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}},vs=Phaser.Utils.Array.Remove,gs={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=$e(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}},Rs={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}},Ls={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}},Ds={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,Ms,Rs,Ls,Ds);const Ys=Phaser.Utils.Objects.GetValue;class Xs extends Qe{constructor(t,e){super(t,e),this.setTransitInTime(Ys(e,"duration.in",200)),this.setTransitOutTime(Ys(e,"duration.out",200)),this.setTransitInCallback(Ys(e,"transitIn")),this.setTransitOutCallback(Ys(e,"transitOut")),this.oneShotMode=Ys(e,"destroy",!1),this.delayCallTimer=void 0,this._state=new Es(this,{eventEmitter:!1,initState:Ys(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(Xs.prototype,As);var zs=function(t){if(t.parentContainer)return zs(t.parentContainer);var e=function(t){var e=t.displayList;return U(e)?e:null}(t);return e?zs(e):t};class Ws extends Qe{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=zs(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 js extends Fs{constructor(t,e,i){super(t,0,0,2,2,e,1),this.fullWindow=new Ws(this),this.setAlpha(i)}get tint(){return this.fillColor}set tint(t){this.setFillStyle(t,this.fillAlpha)}}const Is=Phaser.Utils.Objects.GetValue;class Bs extends Qe{constructor(t,e){super(t,{eventEmitter:!1}),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setHitAreaMode(Is(t,"hitAreaMode",0)),this.setEnable(Is(t,"enable",!0)),this.setStopMode(Is(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 Ns=Phaser.Utils.Objects.GetValue;class Gs extends js{constructor(t,e){super(t,Ns(e,"color",0),Ns(e,"alpha",.8)),this.touchEventStop=new Bs(this,{hitAreaMode:1})}}var Vs={popUp(t,e){void 0!==t._modalScaleSave?(t.scaleX=t._modalScaleSave,t.scaleY=t._modalScaleSave):t._modalScaleSave=t.scaleX,Ti(t,e)},scaleDown(t,e){ki(t,e,void 0,void 0,!1)},fadeIn(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,ji(t,e)},fadeOut(t,e){Ii(t,e,!1)}},Us=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,ji(t,e,t.alpha)},$s=function(t,e){Ii(t,e,!1)},Js=function(t,e,i,s,r){return!(!t||s&&!s(t,e,i)||!rt(t,!0).contains(e,i)||r&&!r(t,e,i))};const Ks=Phaser.Utils.Objects.GetValue;let qs=class extends Xs{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=Zs.popUp),null==e.transitOut&&(e.transitOut=Zs.scaleDown),e.destroy=Ks(e,"destroy",!0),super(t,e);var i=Ks(e,"cover");this.cover=!1!==i?function(t,e){var i=t.scene,s=new Gs(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(Ks(i,"transitIn",Us)),this.setCoverTransitOutCallback(Ks(i,"transitOut",$s)));var s=Ks(e,"touchOutsideClose",!1),r=Ks(e,"duration.hold",-1),n=Ks(e,"timeOutClose",r>=0),h=Ks(e,"anyTouchClose",!1);Ks(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),Ks(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&&Js(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=Zs[t]),t){case Zs.popUp:t=Vs.popUp;break;case Zs.fadeIn:t=Vs.fadeIn}return super.setTransitInCallback(t),this}setTransitOutCallback(t){switch("string"==typeof t&&(t=Zs[t]),t){case Zs.scaleDown:t=Vs.scaleDown;break;case Zs.fadeOut:t=Vs.fadeOut}return super.setTransitOutCallback(t),this}setCoverTransitInCallback(t){return this.coverTransitInCallback=t,this}setCoverTransitOutCallback(t){return this.coverTransitOutCallback=t,this}};const Zs={popUp:0,fadeIn:1,scaleDown:0,fadeOut:1};var Qs=function(t){return t&&"function"==typeof t},tr={modal(t,e){return Qs(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}},er=function(t,e,i,s,r){Qs(e)&&(r=s,s=i,i=e,e=this);var n=this.scene.events;return this.bindEvent(e,n,t,i,s,r),this},ir={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 er.call(this,"preupdate",t,e,i,s),this},bindSceneUpdateEvent(t,e,i,s){return er.call(this,"update",t,e,i,s),this},bindScenePostupdateEvent(t,e,i,s){return er.call(this,"postupdate",t,e,i,s),this},bindSceneRenderEvent(t,e,i,s){return er.call(this,"render",t,e,i,s),this},bindScenePauseEvent(t,e,i,s){return er.call(this,"pause",t,e,i,s),this},bindSceneResumeEvent(t,e,i,s){return er.call(this,"resume",t,e,i,s),this},bindSceneSleepEvent(t,e,i,s){return er.call(this,"sleep",t,e,i,s),this},bindSceneWakeEvent(t,e,i,s){return er.call(this,"wake",t,e,i,s),this},bindSceneShutdownEvent(t,e,i,s){return er.call(this,"shutdown",t,e,i,s),this}},sr=function(t,e,i){var s=t.camera;return s?(void 0===i?i={}:!0===i&&(i=rr),s===e?(i.x=t.worldX,i.y=t.worldY):s.getWorldPoint(t.x,t.y,i),i):null},rr={},nr=function(t,e,i,s){var r,n=t.scene.sys.cameras.main,h=0===t.scrollFactorX&&0===t.scrollFactorY;if(e)return h?Js(t,e.x,e.y,i,s):!!(r=sr(e,n,!0))&&Js(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 fr={press:0,pointerdown:0,release:1,pointerup:1};var mr={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 gr(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}},yr=function(t,e,i,s,r){if(e)return!(i&&!i(t,e)||!br(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 wr=Phaser.Utils.Objects.GetValue;class Sr extends Qe{constructor(t,e){super(t,e),this._enable=void 0;var i=wr(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(wr(t,"enable",!0)),this.setMode(wr(t,"mode",1)),this.setClickInterval(wr(t,"clickInterval",100)),this.setDragThreshold(wr(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=Cr[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?yr:nr)(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 Cr={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 Sr(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 Pr extends ks{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 _r=Phaser.Utils.Objects.GetValue;class Tr extends Qe{constructor(t,e){super(t,e),this._enable=void 0,this.cooldown=new Pr,this.parent.setInteractive(_r(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.prevIsInTouch=!1,this.isInTouching=!1,this.setEnable(_r(t,"enable",!0)),this.setCooldown(_r(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 kr={isPointerInBounds(t){return void 0===t?t=this:"string"==typeof t&&(t=this.getElement(t)),!!t&&nr(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 Tr(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 Tr(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}},Er={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,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=Vr,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===Ur&&this.onDragEnd(),this.pointer=void 0,this.tracerState=Vr,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=$r,this}isPointerInGameObject(t,e,i){var s=this.lastPointer;return!!s&&nr(t,s,e,i)}}const Vr=0,Ur=1,$r="IDLE",Jr=Phaser.Utils.Objects.GetValue,Kr=Phaser.Math.Distance.Between;class qr extends Gr{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=Zr},eventEmitter:!1};this.setRecongizedStateObject(new ks(s))}resetFromJSON(t){super.resetFromJSON(t),this.setHoldTime(Jr(t,"time",250)),this.setTapInterval(Jr(t,"tapInterval",200)),this.setDragThreshold(Jr(t,"threshold",9)),this.setTapOffset(Jr(t,"tapOffset",10));var e=Jr(t,"taps",void 0);return void 0!==e?this.setTaps(e):(this.setMaxTaps(Jr(t,"maxTaps",void 0)),this.setMinTaps(Jr(t,"minTaps",void 0))),this}onDragStart(){switch(this.state){case Zr:this.state=Qr;break;case Qr:var t=this.lastPointer;Kr(t.upX,t.upY,t.x,t.y)>this.tapOffset&&(this.state=tn,this.state=Qr);break;case tn:this.state=Qr}}onDragEnd(){this.state===Qr&&(this.tapsCount++,this.emit("tapping",this,this.gameObject,this.lastPointer),void 0!==this.maxTaps&&this.tapsCount===this.maxTaps&&(this.state=tn))}onDrag(){this.state!==Zr&&this.pointer.getDistance()>this.dragThreshold&&(this.state=Zr)}preUpdate(t,e){if(this.isRunning&&this.enable&&this.state===Qr){var i=this.lastPointer;i.isDown?t-i.downTime>this.holdTime&&(this.state=Zr):t-i.upTime>this.tapInterval&&(void 0===this.minTaps||this.tapsCount>=this.minTaps?this.state=tn:this.state=Zr)}}postUpdate(t,e){this.isRunning&&this.enable&&this.state===tn&&(this.state=Zr)}get isTapped(){return this.state===tn}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 Zr="IDLE",Qr="BEGIN",tn="RECOGNIZED",en=Phaser.Utils.Objects.GetValue;class sn extends Gr{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=rn},eventEmitter:!1};this.setRecongizedStateObject(new ks(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(en(t,"threshold",9)),this.setHoldTime(en(t,"time",251)),this}onDragStart(){this.state=nn,0===this.holdTime&&(this.state=hn)}onDragEnd(){this.state=rn}onDrag(){this.state!==rn&&this.pointer.getDistance()>this.dragThreshold&&(this.state=rn)}preUpdate(t,e){this.isRunning&&this.enable&&this.state===nn&&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 rn="IDLE",nn="BEGIN",hn="RECOGNIZED";Phaser.Utils.Objects.GetValue;var an=function(t){return qe(t).loop.delta};const on=Phaser.Math.Distance.Between,ln=Phaser.Math.Angle.Between;var dn={getDt:function(){return an(this.scene)},getVelocity:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return on(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 ln(e.x,e.y,t.x,t.y)}},cn={"up&down":0,"left&right":1,"4dir":2,"8dir":3},un={};const pn=Phaser.Utils.Objects.GetValue,vn=Phaser.Math.RadToDeg;class gn extends Gr{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=fn},eventEmitter:!1};this.setRecongizedStateObject(new ks(s)),this.clearDirectionStates()}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(pn(t,"threshold",10)),this.setVelocityThreshold(pn(t,"velocityThreshold",1e3)),this.setDirectionMode(pn(t,"dir","8dir")),this}onDragStart(){this.state=mn}onDragEnd(){this.state=fn}onDrag(){this.state===mn&&(this.validDrag||(this.validDrag=0===this.dragThreshold||this.pointer.getDistance()>=this.dragThreshold),this.validDrag&&this.dragVelocity>this.velocityThreshold&&(this.state=yn))}postUpdate(t,e){this.isRunning&&this.enable&&this.state===yn&&(this.state=fn)}get isSwiped(){return this.state===yn}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=un),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}}(vn(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,dn);const fn="IDLE",mn="BEGIN",yn="RECOGNIZED",bn=Phaser.Utils.Objects.GetValue,xn=Phaser.Utils.Array.SpliceOne,wn=Phaser.Math.Distance.Between,Sn=Phaser.Math.Angle.Between;class Cn{constructor(t,e){var i=$e(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(bn(e,"inputConfig",void 0)),this.setEventEmitter(bn(e,"eventEmitter",void 0)),this._enable=void 0,this.pointers=[],this.movedState={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setEnable(bn(t,"enable",!0)),this.bounds=bn(t,"bounds",void 0),this.tracerState=Pn,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 Pn:this.tracerState=_n,this.onDrag1Start();break;case _n: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],xn(this.pointers,e),this.tracerState){case _n:this.tracerState=Pn,this.onDrag1End();break;case Tn:this.tracerState=_n,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 _n:this.onDrag1();break;case Tn:this.onDrag2()}}}dragCancel(){return this.tracerState===Tn&&this.onDrag2End(),this.pointers.length=0,gt(this.movedState),this.tracerState=Pn,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 wn(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 Sn(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!==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&&nr(t,s,e,i)}isPointer1InGameObject(t,e,i){var s=this.pointers[1];return!!s&&nr(t,s,e,i)}}Object.assign(Cn.prototype,Ge);var On={};const Pn=0,_n=1,Tn=2,kn="IDLE";Phaser.Utils.Objects.GetValue;const En=Phaser.Math.RotateAround;var Mn=function(t,e,i,s){return En(t,e,i,s),t.rotation+=s,t},Rn={};const Ln=Phaser.Utils.Objects.GetValue,Dn=Phaser.Math.Angle.WrapDegrees,An=Phaser.Math.Angle.ShortestBetween,Yn=Phaser.Math.RadToDeg,Xn=Phaser.Math.DegToRad;var zn={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,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=Dn(Yn(this.angleBetween));this.angle=An(this.prevAngle,t),this.prevAngle=t,this.state=jn}break;case jn:t=Dn(Yn(this.angleBetween)),this.angle=An(this.prevAngle,t),this.prevAngle=t,this.emit("rotate",this)}}get isRotated(){return this.state===jn}get rotation(){return Xn(this.angle)}setDragThreshold(t){return this.dragThreshold=t,this}}.prototype,zn);const Wn="IDLE",Fn="BEGIN",jn="RECOGNIZED",In=Phaser.Utils.Objects.GetValue;var Bn=function(t){var e=In(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){Rr(i.eventEmitter,`${i.eventNamePrefix}${t.tapsCount}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Hn=Phaser.Utils.Objects.GetValue;var Nn=function(t){var e=Hn(t,"press",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._press=new sn(this,e),this._press.on("pressstart",(function(t,e,s){Rr(i.eventEmitter,`${i.eventNamePrefix}pressstart`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this).on("pressend",(function(t,e,s){Rr(i.eventEmitter,`${i.eventNamePrefix}pressend`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Gn=Phaser.Utils.Objects.GetValue;var Vn=function(t){var e=Gn(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";Rr(i.eventEmitter,`${i.eventNamePrefix}swipe${r}`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Un=Phaser.Utils.Objects.GetValue;var $n=function(t,e){return t.setInteractive(),Un(e,"dropZone",!1)&&(t.input.dropZone=!0),t._childrenInteractive={targetSizers:Un(e,"targets",[t]),targetMode:Un(e,"targetMode","parent"),eventEmitter:Un(e,"eventEmitter",t),eventNamePrefix:Un(e,"inputEventPrefix","child.")},Dr.call(t,e),Xr.call(t,e),Fr.call(t,e),Hr.call(t,e),Bn.call(t,e),Nn.call(t,e),Vn.call(t,e),t},Jn={getSizerConfig:function(t){return void 0===t&&(t=this),Et(t)},getChildPrevState:function(t){var e=Et(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=ae(e,"color"),s=ae(e,"lineWidth");var o=ae(e,"name",!1);o&&(r=ae(o,"createTextCallback",le),n=ae(o,"createTextCallbackScope",void 0),"string"==typeof(h=ae(o,"align","left-top"))&&(h=Yt[h]))}if(void 0===i&&(i=16777215),void 0===s&&(s=1),r&&!t.children){t.children=new oe(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)}}for(var d,c,u=this.getAllShownChildren([this]),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 rh=Phaser.Utils.Objects.IsPlainObject,nh=Phaser.Utils.Objects.GetValue,hh=Phaser.Display.Align.CENTER,ah={min:0,full:-1};var oh=function(t,e,i,s,r,n,h,a,o,l){ve.call(this,t);var d=t.isRexSpace,c=typeof e;if(null===e)return this;if("number"===c);else if("string"===c)e=ah[e];else if(rh(e)){var u;e=nh(u=e,"proportion",void 0),i=nh(u,"align",hh),s=nh(u,"padding",0),r=nh(u,"expand",!1),n=nh(u,"key",void 0),h=nh(u,"index",void 0),t.isRexSizer||(a=nh(u,"minWidth",void 0),o=nh(u,"minHeight",void 0)),l=nh(u,"fitRatio",0)}return"string"==typeof i&&(i=Yt[i]),void 0===e&&(e=d?1:0),void 0===i&&(i=hh),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===a&&(d?a=0:t.isRexSizer||(a=t._minWidth)),void 0===o&&(d?o=0:t.isRexSizer||(o=t._minHeight)),void 0===l||!1===l?l=0:!0===l&&(l=Q(t)/tt(t)),(u=this.getSizerConfig(t)).proportion=e,u.align=i,u.padding=ue(s),u.expand=r,u.fitRatio=0===e?l:0,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},lh={add:oh,addSpace(t){return this.insertSpace(void 0,t),this},insertSpace(t,e){return void 0===e&&(e=1),oh.call(this,new ih(this.scene),{proportion:e,minWidth:0,minHeight:0,index:t}),this},insert(t,e,i,s,r,n,h,a){return rh(i)&&(i.index=t),oh.call(this,e,i,s,r,n,h,t,a),this},insertAtPosition(t,e,i,s,r,n,h,a,o){var l=sh.call(this,t,e);return-1===l&&(l=void 0),this.insert(l,i,s,r,n,h,a,o),this}};const dh=kt.prototype.clear;var ch=function(t){this.backgroundChildren&&(this.backgroundChildren.length=0);var e,i=!t&&this.sizerEventsEnable;if(i&&(e=this.getChildren([])),dh.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}},vh={getChildAlign(t){return this.getSizerConfig(t).align},setChildAlign(t,e){return"string"==typeof e&&(e=Yt[e]),this.getSizerConfig(t).align=e,this}},gh={getChildProportion(t){return this.getSizerConfig(t).proportion},setChildProportion(t,e){return this.getSizerConfig(t).proportion=e,this}},fh={getChildExpand(t){return this.getSizerConfig(t).expand},setChildExpand(t,e){return this.getSizerConfig(t).expand=e,this}},mh={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}},yh={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&&(Ie(t,0,0),e.resolved=!1,this.hasRatioFitChild=!0);return this._childrenProportion=void 0,this.hasProportion0Child=!1,this.proportionLength=void 0,We.call(this),this},layoutChildren:function(){for(var t,e,i,s,r,n,h,a,o,l,d=this.sizerChildren,c=this.innerLeft,u=this.innerTop,p=this.innerWidth,v=this.innerHeight,g=c,f=u,m=this.startChildIndex,y=0,b=d.length;y0?(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)||Le.call(this)},runWidthWrap:function(t){this.wrapResult||(1===this.orientation&&th.call(this,t,void 0),De.call(this,t))},hasHeightWrap:function(){return!(!this.hasRatioFitChild||0!==this.orientation)||Ye.call(this)},runHeightWrap:function(t){this.wrapResult||(0===this.orientation&&th.call(this,void 0,t),Xe.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(yh,lh,ph,vh,gh,fh,mh);var bh=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 wh=Phaser.Utils.Objects.IsPlainObject,Sh=Phaser.Utils.Objects.GetValue;class Ch extends qn{constructor(t,e,i,s,r,n,h){wh(e)?(e=Sh(h=e,"x",0),i=Sh(h,"y",0),s=Sh(h,"width",void 0),r=Sh(h,"height",void 0),n=Sh(h,"orientation",0)):wh(s)?(s=Sh(h=s,"width",void 0),r=Sh(h,"height",void 0),n=Sh(h,"orientation",0)):wh(n)&&(n=Sh(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(Sh(h,"space.item",0)),this.setStartChildIndex(Sh(h,"startChildIndex",0)),this.setRTL(Sh(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=bh.call(this)),this._childrenProportion}}Object.assign(Ch.prototype,yh);var Oh=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}},Ph=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},_h={appendText:Ph,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 Th extends Ch{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&&(Oh(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&&(Oh(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&&Oh(t,this.iconWidth,this.iconHeight);var e=this.childrenMap.action;e&&void 0!==this.actionWidth&&void 0!==this.actionHeight&&Oh(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(Th.prototype,_h);var kh=function(t,e,i,s,r){if(this.clear().fillStyle(16777215),1===this.shapeType){i=i.left;var n=Math.min(t,e)/2;this.fillCircle(-t*(s-.5),-e*(r-.5),n+i)}else this.fillRect(-t*s-i.left,-e*r-i.top,t+i.left+i.right,e+i.top+i.bottom)},Eh=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};const Mh=Phaser.GameObjects.Graphics;class Rh extends Mh{constructor(t,e,i){void 0===e&&(e=0),"string"==typeof e&&(e=Lh[e]),super(t.scene),this.parent=t,this.shapeType=e,this.padding=ue(i),this.setPosition().resize().setVisible(!1)}destroy(){return this.parent=void 0,super.destroy(),this}setPosition(t,e){var i=this.parent;return void 0===t&&(t=i.x),void 0===e&&(e=i.y),super.setPosition(t,e),this}resize(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=ue(i));var r=this.width!==t||this.height!==e,n=this.padding!==i&&!Eh(this.padding,i);return r||n?(this.width=t,this.height=e,n&&ft(i,this.padding),this.originX=s.originX,this.originY=s.originY,kh.call(this,t,e,i,s.originX,s.originY),this):this}setOrigin(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,kh.call(this,this.width,this.height,this.padding,t,e)),this}}const Lh={rectangle:0,circle:1};var Dh=function(t,e,i,s){var r=new Rh(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 Ah=Phaser.GameObjects.Text;var Yh=function(t){return t instanceof Ah};const Xh=Phaser.GameObjects.BitmapText;var zh=function(t){return t instanceof Xh},Wh=function(t){return zh(t)?2:Yh(t)?0:1},Fh=/^[\x00-\x7F]+$/,jh=function(t){return Fh.test(t)},Ih=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},Hh=0,Nh=1,Gh=2,Vh=0,Uh=1,$h=2,Jh=/(?:\r\n|\r|\n)/;const Kh={none:Vh,word:Uh,char:$h,character:$h,mix:3},qh=Phaser.Renderer.WebGL.Utils;var Zh={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=qh.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 Qh=Phaser.Display.Color;var ta={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 Qh);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}},ea=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)},ia={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,ea(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 sa=Phaser.Display.Canvas.CanvasPool,ra=Phaser.GameObjects.GameObject,na=Phaser.Utils.String.UUID;class ha extends ra{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=sa.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=na(),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(){sa.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 aa=Phaser.GameObjects.Components;Phaser.Class.mixin(ha,[aa.Alpha,aa.BlendMode,aa.Crop,aa.Depth,aa.Flip,aa.GetBounds,aa.Mask,aa.Origin,aa.Pipeline,aa.PostPipeline,aa.ScrollFactor,aa.Tint,aa.Transform,aa.Visible,Zh,ta,ia]);var oa={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:Cs(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&>(this.data),this}};class la{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(la.prototype,oa);var da={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 ca=Phaser.Math.RotateAround;var ua;const pa=Phaser.Geom.Rectangle;var va,ga=function(t){void 0===va&&(va=new pa);var e=t.drawTLX,i=t.drawTLY;return va.setTo(e,i,t.drawTRX-e,t.drawBLY-i),va};const fa=Phaser.Math.RotateAround;var ma,ya=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&&fa(s,0,0,t.rotation),s.x=s.x*t.scaleX+t.drawX,s.y=s.y*t.scaleY+t.drawY,s};const ba=Phaser.GameObjects.Components.TransformMatrix;var xa,wa,Sa={},Ca=function(t,e,i,s,r){var n=ya(e,i,s,!0),h=function(t,e,i,s){void 0===s?s={}:!0===s&&(s=Sa);var r=e-t.width*t.originX,n=i-t.height*t.originY;return void 0===xa&&(xa=new ba,wa=new ba),t.parentContainer?t.getWorldTransformMatrix(xa,wa):xa.applyITRS(t.x,t.y,t.rotation,t.scaleX,t.scaleY),xa.transformPoint(r,n,s),s}(t,n.x,n.y,r);return h},Oa=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 Ca(t,e,n,h,r)},Pa={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===ua&&(ua={}),s=ua),s.x=(t-i.drawX)/i.scaleX,s.y=(e-i.drawY)/i.scaleY,0!==i.rotation&&ca(s,0,0,-i.rotation),s}(t,e,this,!0);return ga(this).contains(i.x,i.y)},getWorldPosition:function(t,e,i){return Oa(this.parent,this,t,e,i)}};Object.assign(Pa,da);const _a=Phaser.Math.DegToRad,Ta=Phaser.Math.RadToDeg,ka=Phaser.Utils.Objects.GetValue;class Ea extends la{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 Ta(this._rotation)}set angle(t){this.rotation=_a(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=ka(t,"width",void 0),i=ka(t,"height",void 0),s=ka(t,"scaleX",void 0),r=ka(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(Ea.prototype,Pa);const Ma=Phaser.Utils.String.Pad;var Ra=function(t,e,i){if(null==t)return t;switch(typeof t){case"string":default:return t;case"number":return`#${Ma(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}},La=function(t,e,i){return e.hasOwnProperty(t)?e[t]:i[t]};const Da=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=Da(t,"x",0),i=Da(t,"y",0));var s=this.cornerRadius;s.tl=Ya(Da(t,"tl",void 0),e,i),s.tr=Ya(Da(t,"tr",void 0),e,i),s.bl=Ya(Da(t,"bl",void 0),e,i),s.br=Ya(Da(t,"br",void 0),e,i)}get radiusTL(){var t=this.cornerRadius.tl;return Math.max(t.x,t.y)}set radiusTL(t){Xa(this.cornerRadius.tl,t)}get radiusTR(){var t=this.cornerRadius.tr;return Math.max(t.x,t.y)}set radiusTR(t){Xa(this.cornerRadius.tr,t)}get radiusBL(){var t=this.cornerRadius.bl;return Math.max(t.x,t.y)}set radiusBL(t){Xa(this.cornerRadius.bl,t)}get radiusBR(){var t=this.cornerRadius.br;return Math.max(t.x,t.y)}set radiusBR(t){Xa(this.cornerRadius.br,t)}};var Ya=function(t,e,i){return void 0===t?t={x:e,y:i}:"number"==typeof t&&(t={x:t,y:t}),za(t),t},Xa=function(t,e){"number"==typeof e?(t.x=e,t.y=e):(t.x=Da(e,"x",0),t.y=Da(e,"y",0)),za(t)},za=function(t){t.convex=t.x>=0||t.y>=0,t.x=Math.abs(t.x),t.y=Math.abs(t.y)};const Wa=Phaser.Math.DegToRad;var Fa=function(t){return!t.hasOwnProperty("convex")||t.convex},ja=function(t){return t.x>0&&t.y>0},Ia=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,ja(a)?(o=a.x*g,l=a.y*f,Fa(a)?Ia(t,o,l,o,l,180,270,!1,h):Ia(t,0,0,o,l,90,0,!0,h),d=0,c=l):(t.lineTo(0,0),d=0,c=0),a=m.tr,ja(a)?(o=a.x*g,l=a.y*f,Fa(a)?Ia(t,s-o,l,o,l,270,360,!1,h):Ia(t,s,0,o,l,180,90,!0,h)):t.lineTo(s,0),a=m.br,ja(a)?(o=a.x*g,l=a.y*f,Fa(a)?Ia(t,s-o,r-l,o,l,0,90,!1,h):Ia(t,s,r,o,l,270,180,!0,h)):t.lineTo(s,r),a=m.bl,ja(a)?(o=a.x*g,l=a.y*f,Fa(a)?Ia(t,o,r-l,o,l,90,180,!1,h):Ia(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())},Ha=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),Ba(t.canvas,t.context,d,d,o,l,r,e,i,s,n,h,a)}};const Na=Phaser.Utils.Objects.GetValue;class Ga extends Ea{constructor(t,e){super(t,"background"),this.setScrollFactor(0),this.setColor(Na(e,"color",null),Na(e,"color2",null),Na(e,"horizontalGradient",!0)),this.setStroke(Na(e,"stroke",null),Na(e,"strokeThickness",2)),this.setCornerRadius(Na(e,"cornerRadius",0),Na(e,"cornerIteration",null))}set color(t){t=Ra(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=Ra(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=Ra(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,La("color2",t,this),La("horizontalGradient",t,this)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,La("strokeThickness",t,this)),t.hasOwnProperty("cornerRadius")&&this.setCornerRadius(t.cornerRadius,La("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(){Ha(this.parent,this.color,this.stroke,this.strokeThickness,this.cornerRadius,this.color2,this.horizontalGradient,this.cornerIteration)}}const Va=Phaser.Utils.Objects.GetValue;class Ua extends Ea{constructor(t,e){super(t,"innerbounds"),this.setScrollFactor(0),this.setColor(Va(e,"color",null),Va(e,"color2",null),Va(e,"horizontalGradient",!0)),this.setStroke(Va(e,"stroke",null),Va(e,"strokeThickness",2))}set color(t){t=Ra(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=Ra(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=Ra(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,Va(t,"color2",null),Va(t,"horizontalGradient",!0)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,Va(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 $a=Phaser.Utils.Objects.GetValue;let Ja=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($a(t,"bold",!1)),this.setItalic($a(t,"italic",!1)),this.setFontSize($a(t,"fontSize","16px")),this.setFontFamily($a(t,"fontFamily","Courier")),this.setColor($a(t,"color","#fff")),this.setStrokeStyle($a(t,"stroke",null),$a(t,"strokeThickness",0)),this.setShadow($a(t,"shadowColor",null),$a(t,"shadowOffsetX",0),$a(t,"shadowOffsetY",0),$a(t,"shadowBlur",0)),this.setOffset($a(t,"offsetX",0),$a(t,"offsetY",0)),this.setSpace($a(t,"leftSpace",0),$a(t,"rightSpace",0)),this.setAlign($a(t,"align",void 0)),this.setBackgroundColor($a(t,"backgroundColor",null)),this.setBackgroundHeight($a(t,"backgroundHeight",void 0)),this.setBackgroundBottomY($a(t,"backgroundBottomY",void 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(La("stroke",t,this),La("strokeThickness",t,this)),t.hasOwnProperty("shadowColor")&&this.setShadowColor(t.shadowColor),(t.hasOwnProperty("shadowOffsetX")||t.hasOwnProperty("shadowOffsetY"))&&this.setShadowOffset(La("shadowOffsetX",t,this),La("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),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=Ra(t),this}get hasFill(){return null!=this.color}setStrokeStyle(t,e){return this.stroke=Ra(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=Ra(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=Ra(t),this}get hasBackgroundColor(){return null!=this.backgroundColor}setBackgroundHeight(t){return this.backgroundHeight=t,this}setBackgroundBottomY(t){return this.backgroundBottomY=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 Ka=Phaser.Utils.Array.Remove,qa=Phaser.Utils.Array.Remove,Za="text",Qa="image",to="drawer",eo="space",io="command";var so=function(t){return t.type===Za&&"\n"===t.text},ro=function(t){return t.type===Za&&"\f"===t.text},no=function(t){return t.type===Za};class ho extends Ea{constructor(t,e,i){super(t,Za),this.updateTextFlag=!1,this.style=new Ja(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,s=this.drawTRX-i+1,r=e.backgroundBottomY;null==r&&(r=this.drawBLY);var n=e.backgroundHeight;null==n&&(n=r-this.drawTLY);var h=r-n;t.fillRect(i,h,s,n)}var a=e.hasFill,o=e.hasStroke;(a||o)&&(e.syncFont(t).syncStyle(t),o&&(e.syncShadow(t),t.strokeText(this.text,0,0)),a&&(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 ao=function(t,e){var i=this.createCharChildren(t,e);return this.addChild(i),this};const oo=Phaser.Display.Canvas.CanvasPool;var lo=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=oo.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),oo.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 co extends Ea{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(){lo(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 uo extends Ea{constructor(t,e,i,s){super(t,to),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 Ea{constructor(t,e){super(t,eo),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 vo extends la{constructor(t,e,i,s,r){super(t,io),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 go(t){if(null===t||"object"!=typeof t)return t;if(Array.isArray(t))return t.map((t=>go(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]=go(t[i]));return e}var fo=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 yo=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=So.call(this)).height,h=l.ascent,i=Math.floor((o-h)/n))}else{var l;n=(l=So.call(this)).height,h=l.ascent}}else this.fixedHeight>0?void 0===(i=Oo(t,"maxLines"))&&(o=this.fixedHeight-s,i=Math.floor(o/n)):i=Oo(t,"maxLines",0);void 0===h&&(h=n);var d=0===i,c=Oo(t,"wrapMode");void 0===c&&(c=Oo(t,"charWrap",!1)?"char":"word"),"string"==typeof c&&(c=mo[c]);var u=Oo(t,"wrapWidth",void 0);void 0===u&&(this.fixedWidth>0?u=this.fixedWidth-r:(u=1/0,c=0));for(var p=Oo(t,"letterSpacing",0),v=Oo(t,"hAlign",0),g=Oo(t,"vAlign",0),f=Oo(t,"justifyPercentage",.25),m=fo({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=To(t,"maxLines",void 0))){var h=this.fixedWidth-r;i=Math.floor(h/n)+1}}else i=To(t,"maxLines",0);var a=0===i,o=To(t,"fixedCharacterHeight",void 0);if(void 0===o){var l=To(t,"charPerLine",void 0);if(void 0!==l){var d=this.fixedHeight-s;o=Math.floor(d/l)}}var c=To(t,"wrapHeight",void 0);void 0===c&&(c=this.fixedHeight>0?this.fixedHeight-s:1/0);for(var u=To(t,"letterSpacing",0),p=To(t,"rtl",!0),v=To(t,"hAlign",p?2:0),g=To(t,"vAlign",0),f=fo({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,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 Ee(i,t,e),this.dirty=this.dirty||s!=i.left||r!=i.right||n!=i.top||h!=i.bottom,this},getPadding:function(t){return ke(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),Ka(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 qa(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(Za);return null===i?i=new ho(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)),Oa(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 Zo=Phaser.Utils.Objects.GetFastValue;var Qo={};class tl{constructor(t){this.pools=Zo(t,"pools",Qo)}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;ei&&(r=Math.floor(i));for(var n={},h=ol(t,r,e,i,n),a=0;a<=nl&&0!==h;a++){if((r+=h)<0){r=0;break}h=ol(t,r,e,i,n)}return a===nl&&console.warn("FontSizeFit: Test count exceeds 65535"),t.setFontSize(r),ll(t,e,i),t},al=function(t,e,i){return void 0===i[e]&&(t.setFontSize(e),i[e]={width:t.width,height:t.height}),i[e]},ol=function(t,e,i,s,r){var n,h=al(t,e,r),a=al(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)},ll=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 dl=Phaser.Utils.Objects.GetValue,cl=Phaser.Utils.Objects.GetValue;class ul extends Th{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexLabel";var i,s=cl(e,"background",void 0),r=cl(e,"icon",void 0),n=cl(e,"iconMask",void 0),h=cl(e,"text",void 0),a=cl(e,"action",void 0),o=cl(e,"actionMask",void 0),l=cl(e,"align",void 0);if(s&&this.addBackground(s),r){0===this.orientation?(h||a)&&(i={right:cl(e,"space.icon",0),top:cl(e,"space.iconTop",0),bottom:cl(e,"space.iconBottom",0),left:cl(e,"space.iconLeft",0)}):(h||a)&&(i={bottom:cl(e,"space.icon",0),left:cl(e,"space.iconLeft",0),right:cl(e,"space.iconRight",0),top:cl(e,"space.iconTop",0)});var d=cl(e,"squareFitIcon",!1)?1:0;if(this.add(r,{proportion:0,padding:i,fitRatio:d}),n&&(n=Dh.call(this,r,r,1)),!d){var c=cl(e,"iconSize",void 0);this.setIconSize(cl(e,"iconWidth",c),cl(e,"iconHeight",c))}}if(h){var u=cl(e,"wrapText",!1),p=cl(e,"adjustTextFontSize",!1);u?(!0===u&&(u="word"),function(t,e){switch(Wh(t)){case 0:switch("string"==typeof e&&(e=Kh[e]||0),t.style.wrapMode=e,e){case 2:case 3:t.style.wordWrapCallback=Ih;break;default:t.style.wordWrapCallback=null}break;case 1:"string"==typeof e&&(e=Kh[e]||0),t.style.wrapMode=e}}(h,u),e.expandTextWidth=!0,rl(h)):p&&(e.expandTextWidth=!0,e.expandTextHeight=!0,function(t,e){"number"==typeof e&&(e={minWidth:e});var i=dl(e,"minWidth",0),s=dl(e,"minHeight",0),r=dl(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 hl(t,e,i),t}):(t.runWidthWrap=function(e){return t.setFixedSize&&t.setFixedSize(0,0),hl(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=cl(e,"space.text",0),m=cl(e,"expandTextWidth",!1),y=cl(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:cl(e,"space.actionTop",0),bottom:cl(e,"space.actionBottom",0),right:cl(e,"space.actionRight",0)}:{left:cl(e,"space.actionLeft",0),right:cl(e,"space.actionRight",0),bottom:cl(e,"space.actionBottom",0)},d=cl(e,"squareFitAction",!1)?1:0,this.add(a,{proportion:0,padding:i,fitRatio:d}),o&&(o=Dh.call(this,a,a,1)),!d)){var b=cl(e,"actionSize");this.setActionSize(cl(e,"actionWidth",b),cl(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=Phaser.Renderer.WebGL.Utils,vl=function(t,e,i,s,r,n){for(var h=pl.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+")"},bl=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 xl=Phaser.Renderer.Canvas.SetTransform;var wl={renderWebGL:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.pipelines.set(e.pipeline),n=ml(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&&vl(r,h,e,l,a,o),e.isStroked&&fl(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(xl(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(Cl.prototype,wl);var Ol=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 Pl=Phaser.Math.DegToRad;var _l=function(t,e,i,s,r,n,h,a,o){h&&n>r?n-=360:!h&&n0&&t.y>0};const Ll={rectangle:0,circle:1},Dl=Phaser.Utils.Objects.GetValue;class Al extends Qe{constructor(t,e){super(t,e),this.style=Dl(e,"style",this);var i=Dl(e,"propertiesMap");this.activeStyle=Yl(e,"active",i),this.hoverStyle=Yl(e,"hover",i),this.disableStyle=Yl(e,"disable",i),this.onModifyStyle=Dl(e,"onModifyStyle")}getStyle(t){return function(t,e,i){if(void 0===i&&(i={}),Array.isArray(e))for(var s=0,r=e.length;s0,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};const _d=Phaser.Utils.Objects.GetValue,Td=Phaser.Utils.Objects.IsPlainObject;class kd extends(Ql(Gl)){constructor(t,e,i,s,r,n,h,a){Td(e)?(e=_d(a=e,"x",0),i=_d(a,"y",0),s=_d(a,"width",2),r=_d(a,"height",2),n=_d(a,"barColor",void 0),h=_d(a,"value",0)):Td(s)?(s=_d(a=s,"width",2),r=_d(a,"height",2),n=_d(a,"barColor",void 0),h=_d(a,"value",0)):Td(n)&&(n=_d(a=n,"barColor",void 0),h=_d(a,"value",0)),super(t,e,i,s,r,a),this.type="rexLineProgress",this.bootProgressBase(a),this.addShape((new Od).setName("trackFill")).addShape((new Od).setName("bar")).addShape((new Od).setName("trackStroke")),this.setTrackColor(_d(a,"trackColor",void 0)),this.setBarColor(n),this.setTrackStroke(_d(a,"trackStrokeThickness",2),_d(a,"trackStrokeColor",void 0)),this.setSkewX(_d(a,"skewX",0)),this.setRTL(_d(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 Ed={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&&Pd(s,0,0,e,i,t).close();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),Pd(h,r,0,n,i,t).close());var a=this.getShape("trackStroke");a.lineStyle(this.trackStrokeThickness,this.trackStrokeColor),a.isStroked&&Pd(a,0,0,e,i,t).end()}};Object.assign(kd.prototype,Ed);var Md=function(t){return null==t||""===t||0===t.length},Rd=function(t,e,i,s){if(void 0===s&&(s="."),"object"==typeof t){if(Md(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(Md(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=go(i),s=go(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 Jd(t)?(this.stretchMode.edge=qd(Kd(t,"edge",0)),this.stretchMode.internal=qd(Kd(t,"internal",0))):(t=qd(t),this.stretchMode.edge=t,this.stretchMode.internal=t),this},getStretchMode:function(t,e){return Qd.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 ec=Phaser.Utils.Objects.IsPlainObject,ic=Phaser.Utils.Objects.GetValue,sc=Phaser.GameObjects;var rc=void 0,nc=function(t,e){if(rc||(rc={},qe(t).events.once("destroy",(function(){for(var t in rc)rc[t].destroy();rc=void 0}))),!rc.hasOwnProperty(e)){var i=qe(t).scene.systemScene;(t=new sc[e](i)).setOrigin(0),rc[e]=t}return rc[e]};const hc=Phaser.GameObjects.RenderTexture;class ac extends(function(t,e){class i extends t{constructor(t,i,s,r,n,h,a,o,l,d){if(ec(i)?(i=ic(d=i,"x",0),s=ic(d,"y",0),r=ic(d,"width",1),n=ic(d,"height",1),h=ic(d,"key",void 0),a=ic(d,"baseFrame",void 0),o=ic(d,"columns",void 0),l=ic(d,"rows",void 0)):ec(r)?(r=ic(d=r,"width",1),n=ic(d,"height",1),h=ic(d,"key",void 0),a=ic(d,"baseFrame",void 0),o=ic(d,"columns",void 0),l=ic(d,"rows",void 0)):ec(h)?(h=ic(d=h,"key",void 0),a=ic(d,"baseFrame",void 0),o=ic(d,"columns",void 0),l=ic(d,"rows",void 0)):ec(a)?(a=ic(d=a,"baseFrame",void 0),o=ic(d,"columns",void 0),l=ic(d,"rows",void 0)):Array.isArray(a)?(d=l,l=o,o=a,a=ic(d,"baseFrame",void 0)):ec(o)&&(o=ic(d=o,"columns",void 0),l=ic(d,"rows",void 0)),void 0===a&&(a=ic(d,"frame",void 0)),void 0===o){var c=ic(d,"leftWidth",void 0),u=ic(d,"rightWidth",void 0);void 0!==c&&void 0!==u&&(o=[c,void 0,u])}if(void 0===l){var p=ic(d,"topHeight",void 0),v=ic(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(ic(d,"getFrameNameCallback",void 0)),this.setStretchMode(ic(d,"stretchMode",0)),this.setPreserveRatio(ic(d,"preserveRatio",!0));var g=ic(d,"maxFixedPartScale",1),f=ic(d,"maxFixedPartScaleX",g),m=ic(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,tc),i}(hc,"rexNinePatch")){}var oc={_drawImage:function(t,e,i,s,r,n){var h=nc(this,"Image").setTexture(t,e).setDisplaySize(r,n);this.draw(h,i,s)},_drawTileSprite:function(t,e,i,s,r,n){var h=nc(this,"TileSprite").setTexture(t,e).setSize(r,n);this.draw(h,i,s)}};Object.assign(ac.prototype,oc);let lc=class extends Qe{constructor(t,e){return super(t),new Proxy(this,this)}get(t,e){if(Ad(t,e))return t[e];var i=t.parent;return Ad(i,e)?i[e]:void 0}set(t,e,i){return Ad(t,e)?t[e]=i:Ad(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 dc=Phaser.Utils.Objects.GetValue;class cc extends ac{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexStatesNinePatch";var i=dc(e,"effects",!0);i&&Fd(this,i),this.style=new lc(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign(cc.prototype,zl);const uc=["alpha","tint","flipX","flipY"];var pc=function(t,e){if(!e)return t;for(var i=0,s=uc.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}},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}},Pe=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 _e=/(\S+)\[(\d+)\]/i,Te=Phaser.Utils.Objects.GetValue;var ke=function(t,e){return void 0===e?t:t[e]},Ee=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=Te(e,"left",0),t.right=Te(e,"right",0),t.top=Te(e,"top",0),t.bottom=Te(e,"bottom",0)),t},Me={getInnerPadding(t){return ke(this.space,t)},setInnerPadding(t,e){return Ee(this.space,t,e),this},getOuterPadding(t){return ke(this.getSizerConfig(this).padding,t)},setOuterPadding(t,e){return Ee(this.getSizerConfig(this).padding,t,e),this},getChildOuterPadding(t,e){return"string"==typeof t&&(t=this.getElement(t)),ke(this.getSizerConfig(t).padding,e)},setChildOuterPadding(t,e,i){return"string"==typeof t&&(t=this.getElement(t)),Ee(this.getSizerConfig(t).padding,e,i),this}},Re=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}},Le=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},De=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}},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},Xe=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},ze={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}},We=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?vi:pi,this.repeatCounter=0,this}stop(){return this.state=ui,this}update(t,e){this.state!==ui&&this.state!==fi&&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=gi)):(this.nowTime=this.duration,this.state=fi):this.nowTime>=0&&(this.state=vi))}get t(){var t;switch(this.state){case ui:case pi:case gi:t=0;break;case vi:t=this.nowTime/this.duration;break;case fi:t=1}return di(t,0,1)}set t(t){(t=di(t,-1,1))<0?(this.state=pi,this.nowTime=-this.delay*t):(this.state=vi,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===ui}get isDelay(){return this.state===pi}get isCountDown(){return this.state===vi}get isRunning(){return this.state===pi||this.state===vi}get isDone(){return this.state===fi}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}}const ui=0,pi=1,vi=2,gi=3,fi=-1;class mi extends ai{constructor(t,e){super(t,e),this.timer=new ci}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 yi=Phaser.Utils.Objects.GetValue,bi=Phaser.Utils.Objects.GetAdvancedValue,xi=Phaser.Tweens.Builders.GetEaseFunction;class wi extends mi{resetFromJSON(t){return this.timer.resetFromJSON(yi(t,"timer")),this.setEnable(yi(t,"enable",!0)),this.setTarget(yi(t,"target",this.parent)),this.setDelay(bi(t,"delay",0)),this.setDuration(bi(t,"duration",1e3)),this.setEase(yi(t,"ease","Linear")),this.setRepeat(yi(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 Si=Phaser.Utils.Objects.GetValue,Ci=Phaser.Utils.Objects.GetAdvancedValue,Oi=Phaser.Math.Linear;let Pi=class extends wi{constructor(t,e){super(t,e),this.scaleStart={},this.scaleEnd={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(Si(t,"mode",0)),this.setScaleRange(Ci(t,"start",void 0),Ci(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=_i[t]),this.mode=t,this}setScaleRange(t,e){return"number"==typeof t?(this.startX=t,this.startY=t):(this.startX=Ci(t,"x",this.parent.scaleX),this.startY=Ci(t,"y",this.parent.scaleY)),"number"==typeof e?(this.endX=e,this.endY=e):(this.endX=Ci(e,"x",void 0),this.endY=Ci(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 _i={stop:0,destroy:1,yoyo:2};var Ti=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 Pi(t,a):r.resetFromJSON(a),r.restart(),r},ki=function(t,e,i,s,r,n){void 0===s&&(s="Linear"),r instanceof Pi&&(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 Pi(t,h):n.resetFromJSON(h),n.restart(),n},Ei=function(t,e){return new Promise((function(i,s){t.once(e,(function(){i()}))}))},Mi=function(t){return Ei(t,"complete")};const Ri=Phaser.Utils.Objects.IsPlainObject;var Li={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(Ri(t)){var s=t;t=s.duration,e=s.orientation,i=s.ease}var r=void 0===this._scaleBehavior;return this._scaleBehavior=Ti(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(Ri(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=ki(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(Ri(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 Pi(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),Mi(this._scaleBehavior)},isRunningScaleYoyo(){return this._scaleBehavior&&(this._scaleBehavior.completeEventName="scaleyoyo.complete")},isRunningEaseScale(){return this.isRunningPopUp()||this.isRunningScaleDown()||this.isRunningScaleYoyo()}},Di={};Object.assign(Di,Li),Di.onInitScale=function(){Li.onInitScale.call(this);var t=this;this._scaleBehavior.on("update",(function(){var e=me.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const Ai=Phaser.Utils.Objects.GetValue,Yi=Phaser.Utils.Objects.GetAdvancedValue,Xi=Phaser.Math.Linear;class zi extends wi{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(Yi(t,"start",this.parent.alpha),Yi(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=Wi[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=Xi(this.alphaStart,this.alphaEnd,i)}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Wi={stop:0,destroy:1,yoyo:2},Fi=Phaser.Utils.Objects.IsPlainObject;var ji=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 zi(t,h):s.resetFromJSON(h),s.restart(),s},Ii=function(t,e,i,s){i instanceof zi&&(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 zi(t,r):s.resetFromJSON(r),s.restart(),s};const Bi=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(Bi(t)){var i=t;t=i.duration,e=i.alpha}var s=void 0===this._fade;return this._fade=ji(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(Bi(t)){var i=t;t=i.duration,e=i.destroy}var s=void 0===this._fade;return this._fade=Ii(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()}},Ni={};Object.assign(Ni,Hi),Ni.onInitFade=function(){Hi.onInitFade.call(this);var t=this;this._fade.on("update",(function(){var e=me.getParentSizer(t);e&&e.resetChildAlphaState(t)}))};const Gi=Phaser.Utils.Objects.GetValue,Vi=Phaser.Utils.Objects.GetAdvancedValue,Ui=Phaser.Math.Linear;class $i extends wi{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){if(super.resetFromJSON(t),this.setMode(Gi(t,"mode",0)),t&&(t.hasOwnProperty("x")||t.hasOwnProperty("y"))){var e=Vi(t,"x",void 0),i=Vi(t,"y",void 0);this.setTargetPosition(e,i)}else this.setTargetPosition(t);return this}setMode(t){return"string"==typeof t&&(t=Ji[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=Vi(i,"startX",void 0),this.startY=Vi(i,"startY",void 0),this.endX=Vi(i,"endX",void 0),this.endY=Vi(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=Ui(this.startX,this.endX,i)),this.hasMoveY&&(t.y=Ui(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Ji={stop:0,destroy:1,yoyo:2};var Ki=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,Zi=Phaser.Math.Distance.Between;var Qi={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*Zi(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 $i&&(h=n,n=void 0),void 0===n&&(n=!1);var a={};return a.mode=n?1:0,void 0!==i&&(a.startX=Ki(i,t.x),a.endX=t.x),void 0!==s&&(a.startY=Ki(s,t.y),a.endY=t.y),a.duration=e,a.ease=void 0===r?"Linear":r,void 0===h?h=new $i(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),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*Zi(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 $i&&(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=Ki(i,t.x)),void 0!==s&&(a.startY=t.y,a.endY=Ki(s,t.y)),a.duration=e,a.ease=void 0===r?"Linear":r,void 0===h?h=new $i(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),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}},ts={};Object.assign(ts,Qi),ts.onInitEaseMove=function(){Qi.onInitEaseMove.call(this);var t=this;this._easeMove.on("update",(function(){var e=me.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const es=Phaser.Utils.Objects.GetValue;class is extends ri{constructor(t,e){super(t,e),this.timer=new ci,this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.timer.resetFromJSON(es(t,"timer")),this.setEnable(es(t,"enable",!0)),this.setMode(es(t,"mode",1)),this.isRunning=es(t,"isRunning",!1),this.setMagnitudeMode(es(t,"magnitudeMode",1)),this.setAxisMode(es(t,"axis",0)),this.setDuration(es(t,"duration",500)),this.setMagnitude(es(t,"magnitude",10)),this.ox=es(t,"ox",void 0),this.oy=es(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=ss[t]),this.mode=t,this}setMagnitudeMode(t){return"string"==typeof t&&(t=ns[t]),this.magnitudeMode=t,this}setAxisMode(t){return"string"==typeof t&&(t=rs[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=es(i,"magnitude",void 0),t=es(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 ss={effect:0,behavior:1},rs={both:0,"h&v":0,"x&y":0,horizontal:1,h:1,x:1,vertical:2,v:2,y:2},ns={constant:0,decay:1},hs=Phaser.Utils.Objects.IsPlainObject;var as={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 is(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 os=Phaser.Utils.Objects.GetValue,ls=Phaser.Math.Linear;class ds extends wi{constructor(t,e){super(t,e),this.resetFromJSON(),this.boot()}start(t){if(this.timer.isRunning)return this;var e=this.target;this.propertyKey=os(t,"key","value");var i=e[this.propertyKey];return this.fromValue=os(t,"from",i),this.toValue=os(t,"to",i),this.setEase(os(t,"ease",this.ease)),this.setDuration(os(t,"duration",this.duration)),this.setRepeat(os(t,"repeat",0)),this.setDelay(os(t,"delay",0)),this.setRepeatDelay(os(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]=ls(this.fromValue,this.toValue,i)}}const cs=Phaser.Utils.Objects.IsPlainObject;class us extends Qe{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 ds(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(cs(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(cs(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 ps={easeDataTo(t,e,i,s){return this._easeData||(this._easeData=new us(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),Ei(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}},vs=Phaser.Utils.Array.Remove,gs={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=$e(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}},Rs={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}},Ls={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}},Ds={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,Ms,Rs,Ls,Ds);const Ys=Phaser.Utils.Objects.GetValue;class Xs extends Qe{constructor(t,e){super(t,e),this.setTransitInTime(Ys(e,"duration.in",200)),this.setTransitOutTime(Ys(e,"duration.out",200)),this.setTransitInCallback(Ys(e,"transitIn")),this.setTransitOutCallback(Ys(e,"transitOut")),this.oneShotMode=Ys(e,"destroy",!1),this.delayCallTimer=void 0,this._state=new Es(this,{eventEmitter:!1,initState:Ys(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(Xs.prototype,As);var zs=function(t){if(t.parentContainer)return zs(t.parentContainer);var e=function(t){var e=t.displayList;return U(e)?e:null}(t);return e?zs(e):t};class Ws extends Qe{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=zs(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 js extends Fs{constructor(t,e,i){super(t,0,0,2,2,e,1),this.fullWindow=new Ws(this),this.setAlpha(i)}get tint(){return this.fillColor}set tint(t){this.setFillStyle(t,this.fillAlpha)}}const Is=Phaser.Utils.Objects.GetValue;class Bs extends Qe{constructor(t,e){super(t,{eventEmitter:!1}),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setHitAreaMode(Is(t,"hitAreaMode",0)),this.setEnable(Is(t,"enable",!0)),this.setStopMode(Is(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 Ns=Phaser.Utils.Objects.GetValue;class Gs extends js{constructor(t,e){super(t,Ns(e,"color",0),Ns(e,"alpha",.8)),this.touchEventStop=new Bs(this,{hitAreaMode:1})}}var Vs={popUp(t,e){void 0!==t._modalScaleSave?(t.scaleX=t._modalScaleSave,t.scaleY=t._modalScaleSave):t._modalScaleSave=t.scaleX,Ti(t,e)},scaleDown(t,e){ki(t,e,void 0,void 0,!1)},fadeIn(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,ji(t,e)},fadeOut(t,e){Ii(t,e,!1)}},Us=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,ji(t,e,t.alpha)},$s=function(t,e){Ii(t,e,!1)},Js=function(t,e,i,s,r){return!(!t||s&&!s(t,e,i)||!rt(t,!0).contains(e,i)||r&&!r(t,e,i))};const Ks=Phaser.Utils.Objects.GetValue;let qs=class extends Xs{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=Zs.popUp),null==e.transitOut&&(e.transitOut=Zs.scaleDown),e.destroy=Ks(e,"destroy",!0),super(t,e);var i=Ks(e,"cover");this.cover=!1!==i?function(t,e){var i=t.scene,s=new Gs(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(Ks(i,"transitIn",Us)),this.setCoverTransitOutCallback(Ks(i,"transitOut",$s)));var s=Ks(e,"touchOutsideClose",!1),r=Ks(e,"duration.hold",-1),n=Ks(e,"timeOutClose",r>=0),h=Ks(e,"anyTouchClose",!1);Ks(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),Ks(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&&Js(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=Zs[t]),t){case Zs.popUp:t=Vs.popUp;break;case Zs.fadeIn:t=Vs.fadeIn}return super.setTransitInCallback(t),this}setTransitOutCallback(t){switch("string"==typeof t&&(t=Zs[t]),t){case Zs.scaleDown:t=Vs.scaleDown;break;case Zs.fadeOut:t=Vs.fadeOut}return super.setTransitOutCallback(t),this}setCoverTransitInCallback(t){return this.coverTransitInCallback=t,this}setCoverTransitOutCallback(t){return this.coverTransitOutCallback=t,this}};const Zs={popUp:0,fadeIn:1,scaleDown:0,fadeOut:1};var Qs=function(t){return t&&"function"==typeof t},tr={modal(t,e){return Qs(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}},er=function(t,e,i,s,r){Qs(e)&&(r=s,s=i,i=e,e=this);var n=this.scene.events;return this.bindEvent(e,n,t,i,s,r),this},ir={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 er.call(this,"preupdate",t,e,i,s),this},bindSceneUpdateEvent(t,e,i,s){return er.call(this,"update",t,e,i,s),this},bindScenePostupdateEvent(t,e,i,s){return er.call(this,"postupdate",t,e,i,s),this},bindSceneRenderEvent(t,e,i,s){return er.call(this,"render",t,e,i,s),this},bindScenePauseEvent(t,e,i,s){return er.call(this,"pause",t,e,i,s),this},bindSceneResumeEvent(t,e,i,s){return er.call(this,"resume",t,e,i,s),this},bindSceneSleepEvent(t,e,i,s){return er.call(this,"sleep",t,e,i,s),this},bindSceneWakeEvent(t,e,i,s){return er.call(this,"wake",t,e,i,s),this},bindSceneShutdownEvent(t,e,i,s){return er.call(this,"shutdown",t,e,i,s),this}},sr=function(t,e,i){var s=t.camera;return s?(void 0===i?i={}:!0===i&&(i=rr),s===e?(i.x=t.worldX,i.y=t.worldY):s.getWorldPoint(t.x,t.y,i),i):null},rr={},nr=function(t,e,i,s){var r,n=t.scene.sys.cameras.main,h=0===t.scrollFactorX&&0===t.scrollFactorY;if(e)return h?Js(t,e.x,e.y,i,s):!!(r=sr(e,n,!0))&&Js(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 fr={press:0,pointerdown:0,release:1,pointerup:1};var mr={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 gr(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}},yr=function(t,e,i,s,r){if(e)return!(i&&!i(t,e)||!br(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 wr=Phaser.Utils.Objects.GetValue;class Sr extends Qe{constructor(t,e){super(t,e),this._enable=void 0;var i=wr(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(wr(t,"enable",!0)),this.setMode(wr(t,"mode",1)),this.setClickInterval(wr(t,"clickInterval",100)),this.setDragThreshold(wr(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=Cr[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?yr:nr)(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 Cr={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 Sr(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 Pr extends ks{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 _r=Phaser.Utils.Objects.GetValue;class Tr extends Qe{constructor(t,e){super(t,e),this._enable=void 0,this.cooldown=new Pr,this.parent.setInteractive(_r(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.prevIsInTouch=!1,this.isInTouching=!1,this.setEnable(_r(t,"enable",!0)),this.setCooldown(_r(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 kr={isPointerInBounds(t){return void 0===t?t=this:"string"==typeof t&&(t=this.getElement(t)),!!t&&nr(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 Tr(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 Tr(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}},Er={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,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=Vr,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===Ur&&this.onDragEnd(),this.pointer=void 0,this.tracerState=Vr,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=$r,this}isPointerInGameObject(t,e,i){var s=this.lastPointer;return!!s&&nr(t,s,e,i)}}const Vr=0,Ur=1,$r="IDLE",Jr=Phaser.Utils.Objects.GetValue,Kr=Phaser.Math.Distance.Between;class qr extends Gr{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=Zr},eventEmitter:!1};this.setRecongizedStateObject(new ks(s))}resetFromJSON(t){super.resetFromJSON(t),this.setHoldTime(Jr(t,"time",250)),this.setTapInterval(Jr(t,"tapInterval",200)),this.setDragThreshold(Jr(t,"threshold",9)),this.setTapOffset(Jr(t,"tapOffset",10));var e=Jr(t,"taps",void 0);return void 0!==e?this.setTaps(e):(this.setMaxTaps(Jr(t,"maxTaps",void 0)),this.setMinTaps(Jr(t,"minTaps",void 0))),this}onDragStart(){switch(this.state){case Zr:this.state=Qr;break;case Qr:var t=this.lastPointer;Kr(t.upX,t.upY,t.x,t.y)>this.tapOffset&&(this.state=tn,this.state=Qr);break;case tn:this.state=Qr}}onDragEnd(){this.state===Qr&&(this.tapsCount++,this.emit("tapping",this,this.gameObject,this.lastPointer),void 0!==this.maxTaps&&this.tapsCount===this.maxTaps&&(this.state=tn))}onDrag(){this.state!==Zr&&this.pointer.getDistance()>this.dragThreshold&&(this.state=Zr)}preUpdate(t,e){if(this.isRunning&&this.enable&&this.state===Qr){var i=this.lastPointer;i.isDown?t-i.downTime>this.holdTime&&(this.state=Zr):t-i.upTime>this.tapInterval&&(void 0===this.minTaps||this.tapsCount>=this.minTaps?this.state=tn:this.state=Zr)}}postUpdate(t,e){this.isRunning&&this.enable&&this.state===tn&&(this.state=Zr)}get isTapped(){return this.state===tn}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 Zr="IDLE",Qr="BEGIN",tn="RECOGNIZED",en=Phaser.Utils.Objects.GetValue;class sn extends Gr{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=rn},eventEmitter:!1};this.setRecongizedStateObject(new ks(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(en(t,"threshold",9)),this.setHoldTime(en(t,"time",251)),this}onDragStart(){this.state=nn,0===this.holdTime&&(this.state=hn)}onDragEnd(){this.state=rn}onDrag(){this.state!==rn&&this.pointer.getDistance()>this.dragThreshold&&(this.state=rn)}preUpdate(t,e){this.isRunning&&this.enable&&this.state===nn&&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 rn="IDLE",nn="BEGIN",hn="RECOGNIZED";Phaser.Utils.Objects.GetValue;var an=function(t){return qe(t).loop.delta};const on=Phaser.Math.Distance.Between,ln=Phaser.Math.Angle.Between;var dn={getDt:function(){return an(this.scene)},getVelocity:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return on(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 ln(e.x,e.y,t.x,t.y)}},cn={"up&down":0,"left&right":1,"4dir":2,"8dir":3},un={};const pn=Phaser.Utils.Objects.GetValue,vn=Phaser.Math.RadToDeg;class gn extends Gr{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=fn},eventEmitter:!1};this.setRecongizedStateObject(new ks(s)),this.clearDirectionStates()}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(pn(t,"threshold",10)),this.setVelocityThreshold(pn(t,"velocityThreshold",1e3)),this.setDirectionMode(pn(t,"dir","8dir")),this}onDragStart(){this.state=mn}onDragEnd(){this.state=fn}onDrag(){this.state===mn&&(this.validDrag||(this.validDrag=0===this.dragThreshold||this.pointer.getDistance()>=this.dragThreshold),this.validDrag&&this.dragVelocity>this.velocityThreshold&&(this.state=yn))}postUpdate(t,e){this.isRunning&&this.enable&&this.state===yn&&(this.state=fn)}get isSwiped(){return this.state===yn}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=un),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}}(vn(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,dn);const fn="IDLE",mn="BEGIN",yn="RECOGNIZED",bn=Phaser.Utils.Objects.GetValue,xn=Phaser.Utils.Array.SpliceOne,wn=Phaser.Math.Distance.Between,Sn=Phaser.Math.Angle.Between;class Cn{constructor(t,e){var i=$e(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(bn(e,"inputConfig",void 0)),this.setEventEmitter(bn(e,"eventEmitter",void 0)),this._enable=void 0,this.pointers=[],this.movedState={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setEnable(bn(t,"enable",!0)),this.bounds=bn(t,"bounds",void 0),this.tracerState=Pn,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 Pn:this.tracerState=_n,this.onDrag1Start();break;case _n: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],xn(this.pointers,e),this.tracerState){case _n:this.tracerState=Pn,this.onDrag1End();break;case Tn:this.tracerState=_n,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 _n:this.onDrag1();break;case Tn:this.onDrag2()}}}dragCancel(){return this.tracerState===Tn&&this.onDrag2End(),this.pointers.length=0,gt(this.movedState),this.tracerState=Pn,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 wn(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 Sn(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!==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&&nr(t,s,e,i)}isPointer1InGameObject(t,e,i){var s=this.pointers[1];return!!s&&nr(t,s,e,i)}}Object.assign(Cn.prototype,Ge);var On={};const Pn=0,_n=1,Tn=2,kn="IDLE";Phaser.Utils.Objects.GetValue;const En=Phaser.Math.RotateAround;var Mn=function(t,e,i,s){return En(t,e,i,s),t.rotation+=s,t},Rn={};const Ln=Phaser.Utils.Objects.GetValue,Dn=Phaser.Math.Angle.WrapDegrees,An=Phaser.Math.Angle.ShortestBetween,Yn=Phaser.Math.RadToDeg,Xn=Phaser.Math.DegToRad;var zn={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,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=Dn(Yn(this.angleBetween));this.angle=An(this.prevAngle,t),this.prevAngle=t,this.state=jn}break;case jn:t=Dn(Yn(this.angleBetween)),this.angle=An(this.prevAngle,t),this.prevAngle=t,this.emit("rotate",this)}}get isRotated(){return this.state===jn}get rotation(){return Xn(this.angle)}setDragThreshold(t){return this.dragThreshold=t,this}}.prototype,zn);const Wn="IDLE",Fn="BEGIN",jn="RECOGNIZED",In=Phaser.Utils.Objects.GetValue;var Bn=function(t){var e=In(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){Rr(i.eventEmitter,`${i.eventNamePrefix}${t.tapsCount}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Hn=Phaser.Utils.Objects.GetValue;var Nn=function(t){var e=Hn(t,"press",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._press=new sn(this,e),this._press.on("pressstart",(function(t,e,s){Rr(i.eventEmitter,`${i.eventNamePrefix}pressstart`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this).on("pressend",(function(t,e,s){Rr(i.eventEmitter,`${i.eventNamePrefix}pressend`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Gn=Phaser.Utils.Objects.GetValue;var Vn=function(t){var e=Gn(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";Rr(i.eventEmitter,`${i.eventNamePrefix}swipe${r}`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Un=Phaser.Utils.Objects.GetValue;var $n=function(t,e){return t.setInteractive(),Un(e,"dropZone",!1)&&(t.input.dropZone=!0),t._childrenInteractive={targetSizers:Un(e,"targets",[t]),targetMode:Un(e,"targetMode","parent"),eventEmitter:Un(e,"eventEmitter",t),eventNamePrefix:Un(e,"inputEventPrefix","child.")},Dr.call(t,e),Xr.call(t,e),Fr.call(t,e),Hr.call(t,e),Bn.call(t,e),Nn.call(t,e),Vn.call(t,e),t},Jn={getSizerConfig:function(t){return void 0===t&&(t=this),Et(t)},getChildPrevState:function(t){var e=Et(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=ae(e,"color"),s=ae(e,"lineWidth");var o=ae(e,"name",!1);o&&(r=ae(o,"createTextCallback",le),n=ae(o,"createTextCallbackScope",void 0),"string"==typeof(h=ae(o,"align","left-top"))&&(h=Yt[h]))}if(void 0===i&&(i=16777215),void 0===s&&(s=1),r&&!t.children){t.children=new oe(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)}}for(var d,c,u=this.getAllShownChildren([this]),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 rh=Phaser.Utils.Objects.IsPlainObject,nh=Phaser.Utils.Objects.GetValue,hh=Phaser.Display.Align.CENTER,ah={min:0,full:-1};var oh=function(t,e,i,s,r,n,h,a,o,l){ve.call(this,t);var d=t.isRexSpace,c=typeof e;if(null===e)return this;if("number"===c);else if("string"===c)e=ah[e];else if(rh(e)){var u;e=nh(u=e,"proportion",void 0),i=nh(u,"align",hh),s=nh(u,"padding",0),r=nh(u,"expand",!1),n=nh(u,"key",void 0),h=nh(u,"index",void 0),t.isRexSizer||(a=nh(u,"minWidth",void 0),o=nh(u,"minHeight",void 0)),l=nh(u,"fitRatio",0)}return"string"==typeof i&&(i=Yt[i]),void 0===e&&(e=d?1:0),void 0===i&&(i=hh),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===a&&(d?a=0:t.isRexSizer||(a=t._minWidth)),void 0===o&&(d?o=0:t.isRexSizer||(o=t._minHeight)),void 0===l||!1===l?l=0:!0===l&&(l=Q(t)/tt(t)),(u=this.getSizerConfig(t)).proportion=e,u.align=i,u.padding=ue(s),u.expand=r,u.fitRatio=0===e?l:0,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},lh={add:oh,addSpace(t){return this.insertSpace(void 0,t),this},insertSpace(t,e){return void 0===e&&(e=1),oh.call(this,new ih(this.scene),{proportion:e,minWidth:0,minHeight:0,index:t}),this},insert(t,e,i,s,r,n,h,a){return rh(i)&&(i.index=t),oh.call(this,e,i,s,r,n,h,t,a),this},insertAtPosition(t,e,i,s,r,n,h,a,o){var l=sh.call(this,t,e);return-1===l&&(l=void 0),this.insert(l,i,s,r,n,h,a,o),this}};const dh=kt.prototype.clear;var ch=function(t){this.backgroundChildren&&(this.backgroundChildren.length=0);var e,i=!t&&this.sizerEventsEnable;if(i&&(e=this.getChildren([])),dh.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}},vh={getChildAlign(t){return this.getSizerConfig(t).align},setChildAlign(t,e){return"string"==typeof e&&(e=Yt[e]),this.getSizerConfig(t).align=e,this}},gh={getChildProportion(t){return this.getSizerConfig(t).proportion},setChildProportion(t,e){return this.getSizerConfig(t).proportion=e,this}},fh={getChildExpand(t){return this.getSizerConfig(t).expand},setChildExpand(t,e){return this.getSizerConfig(t).expand=e,this}},mh={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}},yh={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&&(Ie(t,0,0),e.resolved=!1,this.hasRatioFitChild=!0);return this._childrenProportion=void 0,this.hasProportion0Child=!1,this.proportionLength=void 0,We.call(this),this},layoutChildren:function(){for(var t,e,i,s,r,n,h,a,o,l,d=this.sizerChildren,c=this.innerLeft,u=this.innerTop,p=this.innerWidth,v=this.innerHeight,g=c,f=u,m=this.startChildIndex,y=0,b=d.length;y0?(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)||Le.call(this)},runWidthWrap:function(t){this.wrapResult||(1===this.orientation&&th.call(this,t,void 0),De.call(this,t))},hasHeightWrap:function(){return!(!this.hasRatioFitChild||0!==this.orientation)||Ye.call(this)},runHeightWrap:function(t){this.wrapResult||(0===this.orientation&&th.call(this,void 0,t),Xe.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(yh,lh,ph,vh,gh,fh,mh);var bh=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 wh=Phaser.Utils.Objects.IsPlainObject,Sh=Phaser.Utils.Objects.GetValue;class Ch extends qn{constructor(t,e,i,s,r,n,h){wh(e)?(e=Sh(h=e,"x",0),i=Sh(h,"y",0),s=Sh(h,"width",void 0),r=Sh(h,"height",void 0),n=Sh(h,"orientation",0)):wh(s)?(s=Sh(h=s,"width",void 0),r=Sh(h,"height",void 0),n=Sh(h,"orientation",0)):wh(n)&&(n=Sh(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(Sh(h,"space.item",0)),this.setStartChildIndex(Sh(h,"startChildIndex",0)),this.setRTL(Sh(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=bh.call(this)),this._childrenProportion}}Object.assign(Ch.prototype,yh);var Oh=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}},Ph=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},_h={appendText:Ph,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 Th extends Ch{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&&(Oh(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&&(Oh(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&&Oh(t,this.iconWidth,this.iconHeight);var e=this.childrenMap.action;e&&void 0!==this.actionWidth&&void 0!==this.actionHeight&&Oh(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(Th.prototype,_h);var kh=function(t,e,i,s,r){if(this.clear().fillStyle(16777215),1===this.shapeType){i=i.left;var n=Math.min(t,e)/2;this.fillCircle(-t*(s-.5),-e*(r-.5),n+i)}else this.fillRect(-t*s-i.left,-e*r-i.top,t+i.left+i.right,e+i.top+i.bottom)},Eh=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};const Mh=Phaser.GameObjects.Graphics;class Rh extends Mh{constructor(t,e,i){void 0===e&&(e=0),"string"==typeof e&&(e=Lh[e]),super(t.scene),this.parent=t,this.shapeType=e,this.padding=ue(i),this.setPosition().resize().setVisible(!1)}destroy(){return this.parent=void 0,super.destroy(),this}setPosition(t,e){var i=this.parent;return void 0===t&&(t=i.x),void 0===e&&(e=i.y),super.setPosition(t,e),this}resize(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=ue(i));var r=this.width!==t||this.height!==e,n=this.padding!==i&&!Eh(this.padding,i);return r||n?(this.width=t,this.height=e,n&&ft(i,this.padding),this.originX=s.originX,this.originY=s.originY,kh.call(this,t,e,i,s.originX,s.originY),this):this}setOrigin(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,kh.call(this,this.width,this.height,this.padding,t,e)),this}}const Lh={rectangle:0,circle:1};var Dh=function(t,e,i,s){var r=new Rh(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 Ah=Phaser.GameObjects.Text;var Yh=function(t){return t instanceof Ah};const Xh=Phaser.GameObjects.BitmapText;var zh=function(t){return t instanceof Xh},Wh=function(t){return zh(t)?2:Yh(t)?0:1},Fh=/^[\x00-\x7F]+$/,jh=function(t){return Fh.test(t)},Ih=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},Hh=0,Nh=1,Gh=2,Vh=0,Uh=1,$h=2,Jh=/(?:\r\n|\r|\n)/;const Kh={none:Vh,word:Uh,char:$h,character:$h,mix:3},qh=Phaser.Renderer.WebGL.Utils;var Zh={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=qh.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 Qh=Phaser.Display.Color;var ta={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 Qh);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}},ea=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)},ia={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,ea(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 sa=Phaser.Display.Canvas.CanvasPool,ra=Phaser.GameObjects.GameObject,na=Phaser.Utils.String.UUID;class ha extends ra{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=sa.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=na(),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(){sa.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 aa=Phaser.GameObjects.Components;Phaser.Class.mixin(ha,[aa.Alpha,aa.BlendMode,aa.Crop,aa.Depth,aa.Flip,aa.GetBounds,aa.Mask,aa.Origin,aa.Pipeline,aa.PostPipeline,aa.ScrollFactor,aa.Tint,aa.Transform,aa.Visible,Zh,ta,ia]);var oa={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:Cs(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&>(this.data),this}};class la{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(la.prototype,oa);var da={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 ca=Phaser.Math.RotateAround;var ua;const pa=Phaser.Geom.Rectangle;var va,ga=function(t){void 0===va&&(va=new pa);var e=t.drawTLX,i=t.drawTLY;return va.setTo(e,i,t.drawTRX-e,t.drawBLY-i),va};const fa=Phaser.Math.RotateAround;var ma,ya=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&&fa(s,0,0,t.rotation),s.x=s.x*t.scaleX+t.drawX,s.y=s.y*t.scaleY+t.drawY,s};const ba=Phaser.GameObjects.Components.TransformMatrix;var xa,wa,Sa={},Ca=function(t,e,i,s,r){var n=ya(e,i,s,!0),h=function(t,e,i,s){void 0===s?s={}:!0===s&&(s=Sa);var r=e-t.width*t.originX,n=i-t.height*t.originY;return void 0===xa&&(xa=new ba,wa=new ba),t.parentContainer?t.getWorldTransformMatrix(xa,wa):xa.applyITRS(t.x,t.y,t.rotation,t.scaleX,t.scaleY),xa.transformPoint(r,n,s),s}(t,n.x,n.y,r);return h},Oa=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 Ca(t,e,n,h,r)},Pa={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===ua&&(ua={}),s=ua),s.x=(t-i.drawX)/i.scaleX,s.y=(e-i.drawY)/i.scaleY,0!==i.rotation&&ca(s,0,0,-i.rotation),s}(t,e,this,!0);return ga(this).contains(i.x,i.y)},getWorldPosition:function(t,e,i){return Oa(this.parent,this,t,e,i)}};Object.assign(Pa,da);const _a=Phaser.Math.DegToRad,Ta=Phaser.Math.RadToDeg,ka=Phaser.Utils.Objects.GetValue;class Ea extends la{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 Ta(this._rotation)}set angle(t){this.rotation=_a(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=ka(t,"width",void 0),i=ka(t,"height",void 0),s=ka(t,"scaleX",void 0),r=ka(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(Ea.prototype,Pa);const Ma=Phaser.Utils.String.Pad;var Ra=function(t,e,i){if(null==t)return t;switch(typeof t){case"string":default:return t;case"number":return`#${Ma(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}},La=function(t,e,i){return e.hasOwnProperty(t)?e[t]:i[t]};const Da=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=Da(t,"x",0),i=Da(t,"y",0));var s=this.cornerRadius;s.tl=Ya(Da(t,"tl",void 0),e,i),s.tr=Ya(Da(t,"tr",void 0),e,i),s.bl=Ya(Da(t,"bl",void 0),e,i),s.br=Ya(Da(t,"br",void 0),e,i)}get radiusTL(){var t=this.cornerRadius.tl;return Math.max(t.x,t.y)}set radiusTL(t){Xa(this.cornerRadius.tl,t)}get radiusTR(){var t=this.cornerRadius.tr;return Math.max(t.x,t.y)}set radiusTR(t){Xa(this.cornerRadius.tr,t)}get radiusBL(){var t=this.cornerRadius.bl;return Math.max(t.x,t.y)}set radiusBL(t){Xa(this.cornerRadius.bl,t)}get radiusBR(){var t=this.cornerRadius.br;return Math.max(t.x,t.y)}set radiusBR(t){Xa(this.cornerRadius.br,t)}};var Ya=function(t,e,i){return void 0===t?t={x:e,y:i}:"number"==typeof t&&(t={x:t,y:t}),za(t),t},Xa=function(t,e){"number"==typeof e?(t.x=e,t.y=e):(t.x=Da(e,"x",0),t.y=Da(e,"y",0)),za(t)},za=function(t){t.convex=t.x>=0||t.y>=0,t.x=Math.abs(t.x),t.y=Math.abs(t.y)};const Wa=Phaser.Math.DegToRad;var Fa=function(t){return!t.hasOwnProperty("convex")||t.convex},ja=function(t){return t.x>0&&t.y>0},Ia=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,ja(a)?(o=a.x*g,l=a.y*f,Fa(a)?Ia(t,o,l,o,l,180,270,!1,h):Ia(t,0,0,o,l,90,0,!0,h),d=0,c=l):(t.lineTo(0,0),d=0,c=0),a=m.tr,ja(a)?(o=a.x*g,l=a.y*f,Fa(a)?Ia(t,s-o,l,o,l,270,360,!1,h):Ia(t,s,0,o,l,180,90,!0,h)):t.lineTo(s,0),a=m.br,ja(a)?(o=a.x*g,l=a.y*f,Fa(a)?Ia(t,s-o,r-l,o,l,0,90,!1,h):Ia(t,s,r,o,l,270,180,!0,h)):t.lineTo(s,r),a=m.bl,ja(a)?(o=a.x*g,l=a.y*f,Fa(a)?Ia(t,o,r-l,o,l,90,180,!1,h):Ia(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())},Ha=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),Ba(t.canvas,t.context,d,d,o,l,r,e,i,s,n,h,a)}};const Na=Phaser.Utils.Objects.GetValue;class Ga extends Ea{constructor(t,e){super(t,"background"),this.setScrollFactor(0),this.setColor(Na(e,"color",null),Na(e,"color2",null),Na(e,"horizontalGradient",!0)),this.setStroke(Na(e,"stroke",null),Na(e,"strokeThickness",2)),this.setCornerRadius(Na(e,"cornerRadius",0),Na(e,"cornerIteration",null))}set color(t){t=Ra(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=Ra(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=Ra(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,La("color2",t,this),La("horizontalGradient",t,this)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,La("strokeThickness",t,this)),t.hasOwnProperty("cornerRadius")&&this.setCornerRadius(t.cornerRadius,La("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(){Ha(this.parent,this.color,this.stroke,this.strokeThickness,this.cornerRadius,this.color2,this.horizontalGradient,this.cornerIteration)}}const Va=Phaser.Utils.Objects.GetValue;class Ua extends Ea{constructor(t,e){super(t,"innerbounds"),this.setScrollFactor(0),this.setColor(Va(e,"color",null),Va(e,"color2",null),Va(e,"horizontalGradient",!0)),this.setStroke(Va(e,"stroke",null),Va(e,"strokeThickness",2))}set color(t){t=Ra(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=Ra(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=Ra(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,Va(t,"color2",null),Va(t,"horizontalGradient",!0)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,Va(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 $a=Phaser.Utils.Objects.GetValue;let Ja=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($a(t,"bold",!1)),this.setItalic($a(t,"italic",!1)),this.setFontSize($a(t,"fontSize","16px")),this.setFontFamily($a(t,"fontFamily","Courier")),this.setColor($a(t,"color","#fff")),this.setStrokeStyle($a(t,"stroke",null),$a(t,"strokeThickness",0)),this.setShadow($a(t,"shadowColor",null),$a(t,"shadowOffsetX",0),$a(t,"shadowOffsetY",0),$a(t,"shadowBlur",0)),this.setOffset($a(t,"offsetX",0),$a(t,"offsetY",0)),this.setSpace($a(t,"leftSpace",0),$a(t,"rightSpace",0)),this.setAlign($a(t,"align",void 0)),this.setBackgroundColor($a(t,"backgroundColor",null)),this.setBackgroundHeight($a(t,"backgroundHeight",void 0)),this.setBackgroundBottomY($a(t,"backgroundBottomY",void 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(La("stroke",t,this),La("strokeThickness",t,this)),t.hasOwnProperty("shadowColor")&&this.setShadowColor(t.shadowColor),(t.hasOwnProperty("shadowOffsetX")||t.hasOwnProperty("shadowOffsetY"))&&this.setShadowOffset(La("shadowOffsetX",t,this),La("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),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=Ra(t),this}get hasFill(){return null!=this.color}setStrokeStyle(t,e){return this.stroke=Ra(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=Ra(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=Ra(t),this}get hasBackgroundColor(){return null!=this.backgroundColor}setBackgroundHeight(t){return this.backgroundHeight=t,this}setBackgroundBottomY(t){return this.backgroundBottomY=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 Ka=Phaser.Utils.Array.Remove,qa=Phaser.Utils.Array.Remove,Za="text",Qa="image",to="drawer",eo="space",io="command";var so=function(t){return t.type===Za&&"\n"===t.text},ro=function(t){return t.type===Za&&"\f"===t.text},no=function(t){return t.type===Za};class ho extends Ea{constructor(t,e,i){super(t,Za),this.updateTextFlag=!1,this.style=new Ja(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,s=this.drawTRX-i+1,r=e.backgroundBottomY;null==r&&(r=this.drawBLY);var n=e.backgroundHeight;null==n&&(n=r-this.drawTLY);var h=r-n;t.fillRect(i,h,s,n)}var a=e.hasFill,o=e.hasStroke;(a||o)&&(e.syncFont(t).syncStyle(t),o&&(e.syncShadow(t),t.strokeText(this.text,0,0)),a&&(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 ao=function(t,e){var i=this.createCharChildren(t,e);return this.addChild(i),this};const oo=Phaser.Display.Canvas.CanvasPool;var lo=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=oo.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),oo.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 co extends Ea{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(){lo(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 uo extends Ea{constructor(t,e,i,s){super(t,to),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 Ea{constructor(t,e){super(t,eo),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 vo extends la{constructor(t,e,i,s,r){super(t,io),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 go(t){if(null===t||"object"!=typeof t)return t;if(Array.isArray(t))return t.map((t=>go(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]=go(t[i]));return e}var fo=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 yo=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=So.call(this)).height,h=l.ascent,i=Math.floor((o-h)/n))}else{var l;n=(l=So.call(this)).height,h=l.ascent}}else this.fixedHeight>0?void 0===(i=Oo(t,"maxLines"))&&(o=this.fixedHeight-s,i=Math.floor(o/n)):i=Oo(t,"maxLines",0);void 0===h&&(h=n);var d=0===i,c=Oo(t,"wrapMode");void 0===c&&(c=Oo(t,"charWrap",!1)?"char":"word"),"string"==typeof c&&(c=mo[c]);var u=Oo(t,"wrapWidth",void 0);void 0===u&&(this.fixedWidth>0?u=this.fixedWidth-r:(u=1/0,c=0));for(var p=Oo(t,"letterSpacing",0),v=Oo(t,"hAlign",0),g=Oo(t,"vAlign",0),f=Oo(t,"justifyPercentage",.25),m=fo({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=To(t,"maxLines",void 0))){var h=this.fixedWidth-r;i=Math.floor(h/n)+1}}else i=To(t,"maxLines",0);var a=0===i,o=To(t,"fixedCharacterHeight",void 0);if(void 0===o){var l=To(t,"charPerLine",void 0);if(void 0!==l){var d=this.fixedHeight-s;o=Math.floor(d/l)}}var c=To(t,"wrapHeight",void 0);void 0===c&&(c=this.fixedHeight>0?this.fixedHeight-s:1/0);for(var u=To(t,"letterSpacing",0),p=To(t,"rtl",!0),v=To(t,"hAlign",p?2:0),g=To(t,"vAlign",0),f=fo({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,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 Ee(i,t,e),this.dirty=this.dirty||s!=i.left||r!=i.right||n!=i.top||h!=i.bottom,this},getPadding:function(t){return ke(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),Ka(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 qa(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(Za);return null===i?i=new ho(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)),Oa(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 Zo=Phaser.Utils.Objects.GetFastValue;var Qo={};class tl{constructor(t){this.pools=Zo(t,"pools",Qo)}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;ei&&(r=Math.floor(i));for(var n={},h=ol(t,r,e,i,n),a=0;a<=nl&&0!==h;a++){if((r+=h)<0){r=0;break}h=ol(t,r,e,i,n)}return a===nl&&console.warn("FontSizeFit: Test count exceeds 65535"),t.setFontSize(r),ll(t,e,i),t},al=function(t,e,i){return void 0===i[e]&&(t.setFontSize(e),i[e]={width:t.width,height:t.height}),i[e]},ol=function(t,e,i,s,r){var n,h=al(t,e,r),a=al(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)},ll=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 dl=Phaser.Utils.Objects.GetValue,cl=Phaser.Utils.Objects.GetValue;class ul extends Th{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexLabel";var i,s=cl(e,"background",void 0),r=cl(e,"icon",void 0),n=cl(e,"iconMask",void 0),h=cl(e,"text",void 0),a=cl(e,"action",void 0),o=cl(e,"actionMask",void 0),l=cl(e,"align",void 0);if(s&&this.addBackground(s),r){0===this.orientation?(h||a)&&(i={right:cl(e,"space.icon",0),top:cl(e,"space.iconTop",0),bottom:cl(e,"space.iconBottom",0),left:cl(e,"space.iconLeft",0)}):(h||a)&&(i={bottom:cl(e,"space.icon",0),left:cl(e,"space.iconLeft",0),right:cl(e,"space.iconRight",0),top:cl(e,"space.iconTop",0)});var d=cl(e,"squareFitIcon",!1)?1:0;if(this.add(r,{proportion:0,padding:i,fitRatio:d}),n&&(n=Dh.call(this,r,r,1)),!d){var c=cl(e,"iconSize",void 0);this.setIconSize(cl(e,"iconWidth",c),cl(e,"iconHeight",c))}}if(h){var u=cl(e,"wrapText",!1),p=cl(e,"adjustTextFontSize",!1);u?(!0===u&&(u="word"),function(t,e){switch(Wh(t)){case 0:switch("string"==typeof e&&(e=Kh[e]||0),t.style.wrapMode=e,e){case 2:case 3:t.style.wordWrapCallback=Ih;break;default:t.style.wordWrapCallback=null}break;case 1:"string"==typeof e&&(e=Kh[e]||0),t.style.wrapMode=e}}(h,u),e.expandTextWidth=!0,rl(h)):p&&(e.expandTextWidth=!0,e.expandTextHeight=!0,function(t,e){"number"==typeof e&&(e={minWidth:e});var i=dl(e,"minWidth",0),s=dl(e,"minHeight",0),r=dl(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 hl(t,e,i),t}):(t.runWidthWrap=function(e){return t.setFixedSize&&t.setFixedSize(0,0),hl(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=cl(e,"space.text",0),m=cl(e,"expandTextWidth",!1),y=cl(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:cl(e,"space.actionTop",0),bottom:cl(e,"space.actionBottom",0),right:cl(e,"space.actionRight",0)}:{left:cl(e,"space.actionLeft",0),right:cl(e,"space.actionRight",0),bottom:cl(e,"space.actionBottom",0)},d=cl(e,"squareFitAction",!1)?1:0,this.add(a,{proportion:0,padding:i,fitRatio:d}),o&&(o=Dh.call(this,a,a,1)),!d)){var b=cl(e,"actionSize");this.setActionSize(cl(e,"actionWidth",b),cl(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=Phaser.Renderer.WebGL.Utils,vl=function(t,e,i,s,r,n){for(var h=pl.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+")"},bl=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 xl=Phaser.Renderer.Canvas.SetTransform;var wl={renderWebGL:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.pipelines.set(e.pipeline),n=ml(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&&vl(r,h,e,l,a,o),e.isStroked&&fl(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(xl(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(Cl.prototype,wl);var Ol=function(t){return t.x>0&&t.y>0},Pl=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 _l=Phaser.Math.DegToRad;var Tl=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 _d=Phaser.Utils.Objects.GetValue,Td=Phaser.Utils.Objects.IsPlainObject;class kd extends(Ql(Gl)){constructor(t,e,i,s,r,n,h,a){Td(e)?(e=(a=e).x,i=a.y,s=a.width,r=a.height,n=a.barColor,h=a.value):Td(s)?(s=(a=s).width,r=a.height,n=a.barColor,h=a.value):Td(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 Od).setName("trackFill")).addShape((new Od).setName("bar")).addShape((new Od).setName("trackStroke")),this.setTrackColor(_d(a,"trackColor",void 0)),this.setBarColor(n),this.setTrackStroke(_d(a,"trackStrokeThickness",2),_d(a,"trackStrokeColor",void 0)),this.setSkewX(_d(a,"skewX",0)),this.setRTL(_d(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 Ed={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&&Pd(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),Pd(h,r,0,n,i,t));var a=this.getShape("trackStroke");a.lineStyle(this.trackStrokeThickness,this.trackStrokeColor),a.isStroked&&Pd(a,0,0,e,i,t)}};Object.assign(kd.prototype,Ed);var Md=function(t){return null==t||""===t||0===t.length},Rd=function(t,e,i,s){if(void 0===s&&(s="."),"object"==typeof t){if(Md(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(Md(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=go(i),s=go(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 Jd(t)?(this.stretchMode.edge=qd(Kd(t,"edge",0)),this.stretchMode.internal=qd(Kd(t,"internal",0))):(t=qd(t),this.stretchMode.edge=t,this.stretchMode.internal=t),this},getStretchMode:function(t,e){return Qd.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 ec=Phaser.Utils.Objects.IsPlainObject,ic=Phaser.Utils.Objects.GetValue,sc=Phaser.GameObjects;var rc=void 0,nc=function(t,e){if(rc||(rc={},qe(t).events.once("destroy",(function(){for(var t in rc)rc[t].destroy();rc=void 0}))),!rc.hasOwnProperty(e)){var i=qe(t).scene.systemScene;(t=new sc[e](i)).setOrigin(0),rc[e]=t}return rc[e]};const hc=Phaser.GameObjects.RenderTexture;class ac extends(function(t,e){class i extends t{constructor(t,i,s,r,n,h,a,o,l,d){if(ec(i)?(i=ic(d=i,"x",0),s=ic(d,"y",0),r=ic(d,"width",1),n=ic(d,"height",1),h=ic(d,"key",void 0),a=ic(d,"baseFrame",void 0),o=ic(d,"columns",void 0),l=ic(d,"rows",void 0)):ec(r)?(r=ic(d=r,"width",1),n=ic(d,"height",1),h=ic(d,"key",void 0),a=ic(d,"baseFrame",void 0),o=ic(d,"columns",void 0),l=ic(d,"rows",void 0)):ec(h)?(h=ic(d=h,"key",void 0),a=ic(d,"baseFrame",void 0),o=ic(d,"columns",void 0),l=ic(d,"rows",void 0)):ec(a)?(a=ic(d=a,"baseFrame",void 0),o=ic(d,"columns",void 0),l=ic(d,"rows",void 0)):Array.isArray(a)?(d=l,l=o,o=a,a=ic(d,"baseFrame",void 0)):ec(o)&&(o=ic(d=o,"columns",void 0),l=ic(d,"rows",void 0)),void 0===a&&(a=ic(d,"frame",void 0)),void 0===o){var c=ic(d,"leftWidth",void 0),u=ic(d,"rightWidth",void 0);void 0!==c&&void 0!==u&&(o=[c,void 0,u])}if(void 0===l){var p=ic(d,"topHeight",void 0),v=ic(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(ic(d,"getFrameNameCallback",void 0)),this.setStretchMode(ic(d,"stretchMode",0)),this.setPreserveRatio(ic(d,"preserveRatio",!0));var g=ic(d,"maxFixedPartScale",1),f=ic(d,"maxFixedPartScaleX",g),m=ic(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,tc),i}(hc,"rexNinePatch")){}var oc={_drawImage:function(t,e,i,s,r,n){var h=nc(this,"Image").setTexture(t,e).setDisplaySize(r,n);this.draw(h,i,s)},_drawTileSprite:function(t,e,i,s,r,n){var h=nc(this,"TileSprite").setTexture(t,e).setSize(r,n);this.draw(h,i,s)}};Object.assign(ac.prototype,oc);let lc=class extends Qe{constructor(t,e){return super(t),new Proxy(this,this)}get(t,e){if(Ad(t,e))return t[e];var i=t.parent;return Ad(i,e)?i[e]:void 0}set(t,e,i){return Ad(t,e)?t[e]=i:Ad(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 dc=Phaser.Utils.Objects.GetValue;class cc extends ac{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexStatesNinePatch";var i=dc(e,"effects",!0);i&&Fd(this,i),this.style=new lc(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign(cc.prototype,zl);const uc=["alpha","tint","flipX","flipY"];var pc=function(t,e){if(!e)return t;for(var i=0,s=uc.length;i * @copyright 2018 Photon Storm Ltd. diff --git a/dist/rexslider.js b/dist/rexslider.js index 2621e773a8..82a0f0b3ff 100644 --- a/dist/rexslider.js +++ b/dist/rexslider.js @@ -13430,6 +13430,10 @@ radius.y = Math.abs(radius.y); }; + var IsArcCorner = function (radius) { + return ((radius.x > 0) && (radius.y > 0)); + }; + var LineTo = function (x, y, pathData) { var cnt = pathData.length; if (cnt >= 2) { @@ -13511,8 +13515,7 @@ geom.setTo(0, 0, width, height, radius); } - var iteration = GetValue$9(radiusConfig, 'iteration', undefined); - this.setIteration(iteration); + this.setIteration(GetValue$9(radiusConfig, 'iteration', undefined)); this.setPosition(x, y); this.setFillStyle(fillColor, fillAlpha); @@ -13765,10 +13768,6 @@ } - var IsArcCorner = function (radius) { - return ((radius.x > 0) && (radius.y > 0)); - }; - const ShapeTypeMap = { rectangle: 0, circle: 1 @@ -15354,6 +15353,7 @@ var skewX = this.skewX; var width = this.width - Math.abs(skewX); var height = this.height; + var trackFill = this.getShape('trackFill'); trackFill.fillStyle(this.trackColor); if (trackFill.isFilled) { @@ -15362,8 +15362,7 @@ 0, 0, // x0, y0 width, height, // x1, y1 skewX // skewX - ) - .close(); + ); } var bar = this.getShape('bar'); @@ -15383,8 +15382,7 @@ barX0, 0, // x0, y0 barX1, height, // x1, y1 skewX // skew - ) - .close(); + ); } var trackStroke = this.getShape('trackStroke'); @@ -15395,8 +15393,7 @@ 0, 0, // x0, y0 width, height, // x1, y1 skewX // skewX - ) - .end(); + ); } }; @@ -15416,6 +15413,8 @@ .lineTo(x0, y0).lineTo(startX, y0); } + lines.close(); + return lines; }; @@ -15426,24 +15425,33 @@ constructor(scene, x, y, width, height, barColor, value, config) { if (IsPlainObject$3(x)) { config = x; - x = GetValue$6(config, 'x', 0); - y = GetValue$6(config, 'y', 0); - width = GetValue$6(config, 'width', 2); - height = GetValue$6(config, 'height', 2); - barColor = GetValue$6(config, 'barColor', undefined); - value = GetValue$6(config, 'value', 0); + + x = config.x; + y = config.y; + width = config.width; + height = config.height; + barColor = config.barColor; + value = config.value; } else if (IsPlainObject$3(width)) { config = width; - width = GetValue$6(config, 'width', 2); - height = GetValue$6(config, 'height', 2); - barColor = GetValue$6(config, 'barColor', undefined); - value = GetValue$6(config, 'value', 0); + + width = config.width; + height = config.height; + barColor = config.barColor; + value = config.value; } else if (IsPlainObject$3(barColor)) { config = barColor; - barColor = GetValue$6(config, 'barColor', undefined); - value = GetValue$6(config, 'value', 0); + + barColor = config.barColor; + value = config.value; } + if (x === undefined) { x = 0; } + if (y === undefined) { y = 0; } + if (width === undefined) { width = 2; } + if (height === undefined) { height = width; } + if (value === undefined) { value = 0; } + super(scene, x, y, width, height, config); this.type = 'rexLineProgress'; diff --git a/dist/rexslider.min.js b/dist/rexslider.min.js index 3220efb9fc..ad893ed602 100644 --- a/dist/rexslider.min.js +++ b/dist/rexslider.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 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=O(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=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 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}},we=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 xe=/(\S+)\[(\d+)\]/i,Oe=Phaser.Utils.Objects.GetValue;var Te=function(t,e){return void 0===e?t:t[e]},Ee=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=Oe(e,"left",0),t.right=Oe(e,"right",0),t.top=Oe(e,"top",0),t.bottom=Oe(e,"bottom",0)),t},ke={getInnerPadding(t){return Te(this.space,t)},setInnerPadding(t,e){return Ee(this.space,t,e),this},getOuterPadding(t){return Te(this.getSizerConfig(this).padding,t)},setOuterPadding(t,e){return Ee(this.getSizerConfig(this).padding,t,e),this},getChildOuterPadding(t,e){return"string"==typeof t&&(t=this.getElement(t)),Te(this.getSizerConfig(t).padding,e)},setChildOuterPadding(t,e,i){return"string"==typeof t&&(t=this.getElement(t)),Ee(this.getSizerConfig(t).padding,e,i),this}},De=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}},Re=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},Me=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},Le=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},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},ze={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}},Xe=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?pi:ci,this.repeatCounter=0,this}stop(){return this.state=ui,this}update(t,e){this.state!==ui&&this.state!==fi&&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=vi)):(this.nowTime=this.duration,this.state=fi):this.nowTime>=0&&(this.state=pi))}get t(){var t;switch(this.state){case ui:case ci:case vi:t=0;break;case pi:t=this.nowTime/this.duration;break;case fi:t=1}return li(t,0,1)}set t(t){(t=li(t,-1,1))<0?(this.state=ci,this.nowTime=-this.delay*t):(this.state=pi,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===ui}get isDelay(){return this.state===ci}get isCountDown(){return this.state===pi}get isRunning(){return this.state===ci||this.state===pi}get isDone(){return this.state===fi}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}}const ui=0,ci=1,pi=2,vi=3,fi=-1;class gi extends ai{constructor(t,e){super(t,e),this.timer=new di}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 mi=Phaser.Utils.Objects.GetValue,yi=Phaser.Utils.Objects.GetAdvancedValue,bi=Phaser.Tweens.Builders.GetEaseFunction;class Ci extends gi{resetFromJSON(t){return this.timer.resetFromJSON(mi(t,"timer")),this.setEnable(mi(t,"enable",!0)),this.setTarget(mi(t,"target",this.parent)),this.setDelay(yi(t,"delay",0)),this.setDuration(yi(t,"duration",1e3)),this.setEase(mi(t,"ease","Linear")),this.setRepeat(mi(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=bi(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 _i=Phaser.Utils.Objects.GetValue,Si=Phaser.Utils.Objects.GetAdvancedValue,Pi=Phaser.Math.Linear;let wi=class extends Ci{constructor(t,e){super(t,e),this.scaleStart={},this.scaleEnd={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(_i(t,"mode",0)),this.setScaleRange(Si(t,"start",void 0),Si(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=xi[t]),this.mode=t,this}setScaleRange(t,e){return"number"==typeof t?(this.startX=t,this.startY=t):(this.startX=Si(t,"x",this.parent.scaleX),this.startY=Si(t,"y",this.parent.scaleY)),"number"==typeof e?(this.endX=e,this.endY=e):(this.endX=Si(e,"x",void 0),this.endY=Si(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=Pi(this.startX,this.endX,i)),this.hasScaleY&&(t.scaleY=Pi(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}};const xi={stop:0,destroy:1,yoyo:2};var Oi=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 wi(t,h):r.resetFromJSON(h),r.restart(),r},Ti=function(t,e,i,s,r,n){void 0===s&&(s="Linear"),r instanceof wi&&(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 wi(t,a):n.resetFromJSON(a),n.restart(),n},Ei=function(t,e){return new Promise((function(i,s){t.once(e,(function(){i()}))}))},ki=function(t){return Ei(t,"complete")};const Di=Phaser.Utils.Objects.IsPlainObject;var Ri={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(Di(t)){var s=t;t=s.duration,e=s.orientation,i=s.ease}var r=void 0===this._scaleBehavior;return this._scaleBehavior=Oi(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),ki(this._scaleBehavior)},isRunningPopUp(){return this._scaleBehavior&&"popup.complete"===this._scaleBehavior.completeEventName},scaleDownDestroy(t,e,i,s){if(Di(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=Ti(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),ki(this._scaleBehavior)},scaleDown(t,e,i){return this.scaleDownDestroy(t,e,i,!1),this},scaleDownPromise(t,e,i){return this.scaleDown(t,e,i),ki(this._scaleBehavior)},isRunningScaleDown(){return this._scaleBehavior&&"scaledown.complete"===this._scaleBehavior.completeEventName},scaleYoyo(t,e,i,s,r){if(Di(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 wi(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),ki(this._scaleBehavior)},isRunningScaleYoyo(){return this._scaleBehavior&&(this._scaleBehavior.completeEventName="scaleyoyo.complete")},isRunningEaseScale(){return this.isRunningPopUp()||this.isRunningScaleDown()||this.isRunningScaleYoyo()}},Mi={};Object.assign(Mi,Ri),Mi.onInitScale=function(){Ri.onInitScale.call(this);var t=this;this._scaleBehavior.on("update",(function(){var e=ge.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const Li=Phaser.Utils.Objects.GetValue,Ai=Phaser.Utils.Objects.GetAdvancedValue,ji=Phaser.Math.Linear;class zi extends Ci{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(Li(t,"mode",0)),this.setAlphaRange(Ai(t,"start",this.parent.alpha),Ai(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=Xi[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 Xi={stop:0,destroy:1,yoyo:2},Fi=Phaser.Utils.Objects.IsPlainObject;var Yi=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 a={mode:0,start:r,end:n,duration:e};return void 0===s?s=new zi(t,a):s.resetFromJSON(a),s.restart(),s},Ii=function(t,e,i,s){i instanceof zi&&(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 zi(t,r):s.resetFromJSON(r),s.restart(),s};const Ni=Phaser.Utils.Objects.IsPlainObject;var Wi={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=Yi(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadein.complete",this},fadeInPromise(t,e){return this.fadeIn(t,e),ki(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=Ii(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadeout.complete",this},fadeOutDestroyPromise(t,e){return this.fadeOutDestroy(t,e),ki(this._fade)},fadeOut(t){return this.fadeOutDestroy(t,!1),this},fadeOutPromise(t){return this.fadeOut(t),ki(this._fade)},isRunningFadeOut(){return this._fade&&"fadeout.complete"===this._fade.completeEventName},isRunningEaseFade(){return this.isRunningFadeIn()||this.isRunningFadeOut()}},Bi={};Object.assign(Bi,Wi),Bi.onInitFade=function(){Wi.onInitFade.call(this);var t=this;this._fade.on("update",(function(){var e=ge.getParentSizer(t);e&&e.resetChildAlphaState(t)}))};const Vi=Phaser.Utils.Objects.GetValue,Gi=Phaser.Utils.Objects.GetAdvancedValue,Ui=Phaser.Math.Linear;class Hi extends Ci{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){if(super.resetFromJSON(t),this.setMode(Vi(t,"mode",0)),t&&(t.hasOwnProperty("x")||t.hasOwnProperty("y"))){var e=Gi(t,"x",void 0),i=Gi(t,"y",void 0);this.setTargetPosition(e,i)}else this.setTargetPosition(t);return this}setMode(t){return"string"==typeof t&&(t=Ji[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=Gi(i,"startX",void 0),this.startY=Gi(i,"startY",void 0),this.endX=Gi(i,"endX",void 0),this.endY=Gi(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=Ui(this.startX,this.endX,i)),this.hasMoveY&&(t.y=Ui(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Ji={stop:0,destroy:1,yoyo:2};var $i=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,Ki=Phaser.Math.Distance.Between;var Zi={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*Ki(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 Hi&&(a=n,n=void 0),void 0===n&&(n=!1);var h={};return h.mode=n?1:0,void 0!==i&&(h.startX=$i(i,t.x),h.endX=t.x),void 0!==s&&(h.startY=$i(s,t.y),h.endY=t.y),h.duration=e,h.ease=void 0===r?"Linear":r,void 0===a?a=new Hi(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),ki(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),ki(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*Ki(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 Hi&&(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=$i(i,t.x)),void 0!==s&&(h.startY=t.y,h.endY=$i(s,t.y)),h.duration=e,h.ease=void 0===r?"Linear":r,void 0===a?a=new Hi(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),ki(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),ki(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}},Qi={};Object.assign(Qi,Zi),Qi.onInitEaseMove=function(){Zi.onInitEaseMove.call(this);var t=this;this._easeMove.on("update",(function(){var e=ge.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const ts=Phaser.Utils.Objects.GetValue;class es extends si{constructor(t,e){super(t,e),this.timer=new di,this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.timer.resetFromJSON(ts(t,"timer")),this.setEnable(ts(t,"enable",!0)),this.setMode(ts(t,"mode",1)),this.isRunning=ts(t,"isRunning",!1),this.setMagnitudeMode(ts(t,"magnitudeMode",1)),this.setAxisMode(ts(t,"axis",0)),this.setDuration(ts(t,"duration",500)),this.setMagnitude(ts(t,"magnitude",10)),this.ox=ts(t,"ox",void 0),this.oy=ts(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=is[t]),this.mode=t,this}setMagnitudeMode(t){return"string"==typeof t&&(t=rs[t]),this.magnitudeMode=t,this}setAxisMode(t){return"string"==typeof t&&(t=ss[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=ts(i,"magnitude",void 0),t=ts(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 is={effect:0,behavior:1},ss={both:0,"h&v":0,"x&y":0,horizontal:1,h:1,x:1,vertical:2,v:2,y:2},rs={constant:0,decay:1},ns=Phaser.Utils.Objects.IsPlainObject;var as={shake(t,e,i){if(ns(t)){var s=t;t=s.duration,e=s.magnitude,i=s.magnitudeMode}return void 0===this._shake&&(this._shake=new es(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),ki(this._shake)}};const hs=Phaser.Utils.Objects.GetValue,os=Phaser.Math.Linear;class ls extends Ci{constructor(t,e){super(t,e),this.resetFromJSON(),this.boot()}start(t){if(this.timer.isRunning)return this;var e=this.target;this.propertyKey=hs(t,"key","value");var i=e[this.propertyKey];return this.fromValue=hs(t,"from",i),this.toValue=hs(t,"to",i),this.setEase(hs(t,"ease",this.ease)),this.setDuration(hs(t,"duration",this.duration)),this.setRepeat(hs(t,"repeat",0)),this.setDelay(hs(t,"delay",0)),this.setRepeatDelay(hs(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]=os(this.fromValue,this.toValue,i)}}const ds=Phaser.Utils.Objects.IsPlainObject;class us extends Ze{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 ls(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(ds(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(ds(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 cs={easeDataTo(t,e,i,s){return this._easeData||(this._easeData=new us(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),Ei(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}},ps=Phaser.Utils.Array.Remove,vs={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 ks={delayCall(t,e,i){return this.delayCallTimer=function(t,e,i,s,r){var n=He(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}},Ds={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}},Rs={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}},Ms={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}},Ls={};Object.assign(Ls,ks,Ds,Rs,Ms);const As=Phaser.Utils.Objects.GetValue;class js extends Ze{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 Es(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(js.prototype,Ls);var zs=function(t){if(t.parentContainer)return zs(t.parentContainer);var e=function(t){var e=t.displayList;return H(e)?e:null}(t);return e?zs(e):t};class Xs extends Ze{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=zs(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 Fs=Phaser.GameObjects.Rectangle;class Ys extends Fs{constructor(t,e,i){super(t,0,0,2,2,e,1),this.fullWindow=new Xs(this),this.setAlpha(i)}get tint(){return this.fillColor}set tint(t){this.setFillStyle(t,this.fillAlpha)}}const Is=Phaser.Utils.Objects.GetValue;class Ns extends Ze{constructor(t,e){super(t,{eventEmitter:!1}),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setHitAreaMode(Is(t,"hitAreaMode",0)),this.setEnable(Is(t,"enable",!0)),this.setStopMode(Is(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=Ws[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 Ws={default:0,fullWindow:1};const Bs=Phaser.Utils.Objects.GetValue;class Vs extends Ys{constructor(t,e){super(t,Bs(e,"color",0),Bs(e,"alpha",.8)),this.touchEventStop=new Ns(this,{hitAreaMode:1})}}var Gs={popUp(t,e){void 0!==t._modalScaleSave?(t.scaleX=t._modalScaleSave,t.scaleY=t._modalScaleSave):t._modalScaleSave=t.scaleX,Oi(t,e)},scaleDown(t,e){Ti(t,e,void 0,void 0,!1)},fadeIn(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Yi(t,e)},fadeOut(t,e){Ii(t,e,!1)}},Us=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Yi(t,e,t.alpha)},Hs=function(t,e){Ii(t,e,!1)},Js=function(t,e,i,s,r){return!(!t||s&&!s(t,e,i)||!rt(t,!0).contains(e,i)||r&&!r(t,e,i))};const $s=Phaser.Utils.Objects.GetValue;let qs=class extends js{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=Ks.popUp),null==e.transitOut&&(e.transitOut=Ks.scaleDown),e.destroy=$s(e,"destroy",!0),super(t,e);var i=$s(e,"cover");this.cover=!1!==i?function(t,e){var i=t.scene,s=new Vs(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($s(i,"transitIn",Us)),this.setCoverTransitOutCallback($s(i,"transitOut",Hs)));var s=$s(e,"touchOutsideClose",!1),r=$s(e,"duration.hold",-1),n=$s(e,"timeOutClose",r>=0),a=$s(e,"anyTouchClose",!1);$s(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),$s(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&&Js(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=Ks[t]),t){case Ks.popUp:t=Gs.popUp;break;case Ks.fadeIn:t=Gs.fadeIn}return super.setTransitInCallback(t),this}setTransitOutCallback(t){switch("string"==typeof t&&(t=Ks[t]),t){case Ks.scaleDown:t=Gs.scaleDown;break;case Ks.fadeOut:t=Gs.fadeOut}return super.setTransitOutCallback(t),this}setCoverTransitInCallback(t){return this.coverTransitInCallback=t,this}setCoverTransitOutCallback(t){return this.coverTransitOutCallback=t,this}};const Ks={popUp:0,fadeIn:1,scaleDown:0,fadeOut:1};var Zs=function(t){return t&&"function"==typeof t},Qs={modal(t,e){return Zs(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}},tr=function(t,e,i,s,r){Zs(e)&&(r=s,s=i,i=e,e=this);var n=this.scene.events;return this.bindEvent(e,n,t,i,s,r),this},er={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 tr.call(this,"preupdate",t,e,i,s),this},bindSceneUpdateEvent(t,e,i,s){return tr.call(this,"update",t,e,i,s),this},bindScenePostupdateEvent(t,e,i,s){return tr.call(this,"postupdate",t,e,i,s),this},bindSceneRenderEvent(t,e,i,s){return tr.call(this,"render",t,e,i,s),this},bindScenePauseEvent(t,e,i,s){return tr.call(this,"pause",t,e,i,s),this},bindSceneResumeEvent(t,e,i,s){return tr.call(this,"resume",t,e,i,s),this},bindSceneSleepEvent(t,e,i,s){return tr.call(this,"sleep",t,e,i,s),this},bindSceneWakeEvent(t,e,i,s){return tr.call(this,"wake",t,e,i,s),this},bindSceneShutdownEvent(t,e,i,s){return tr.call(this,"shutdown",t,e,i,s),this}},ir=function(t,e,i){var s=t.camera;return s?(void 0===i?i={}:!0===i&&(i=sr),s===e?(i.x=t.worldX,i.y=t.worldY):s.getWorldPoint(t.x,t.y,i),i):null},sr={},rr=function(t,e,i,s){var r,n=t.scene.sys.cameras.main,a=0===t.scrollFactorX&&0===t.scrollFactorY;if(e)return a?Js(t,e.x,e.y,i,s):!!(r=ir(e,n,!0))&&Js(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 fr={press:0,pointerdown:0,release:1,pointerup:1};var gr={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 vr(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}},mr=function(t,e,i,s,r){if(e)return!(i&&!i(t,e)||!yr(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 br.length=0,!0;return br.length=0,!1},br=[];const Cr=Phaser.Utils.Objects.GetValue;class _r extends Ze{constructor(t,e){super(t,e),this._enable=void 0;var i=Cr(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(Cr(t,"enable",!0)),this.setMode(Cr(t,"mode",1)),this.setClickInterval(Cr(t,"clickInterval",100)),this.setDragThreshold(Cr(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=Sr[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?mr:rr)(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 Sr={press:0,pointerdown:0,release:1,pointerup:1};var Pr={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 _r(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 wr extends Ts{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 Or extends Ze{constructor(t,e){super(t,e),this._enable=void 0,this.cooldown=new wr,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 Tr={isPointerInBounds(t){return void 0===t?t=this:"string"==typeof t&&(t=this.getElement(t)),!!t&&rr(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 Or(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 Or(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}},Er={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}},kr=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=Gr,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===Ur&&this.onDragEnd(),this.pointer=void 0,this.tracerState=Gr,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=Hr,this}isPointerInGameObject(t,e,i){var s=this.lastPointer;return!!s&&rr(t,s,e,i)}}const Gr=0,Ur=1,Hr="IDLE",Jr=Phaser.Utils.Objects.GetValue,$r=Phaser.Math.Distance.Between;class qr extends Vr{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=Kr},eventEmitter:!1};this.setRecongizedStateObject(new Ts(s))}resetFromJSON(t){super.resetFromJSON(t),this.setHoldTime(Jr(t,"time",250)),this.setTapInterval(Jr(t,"tapInterval",200)),this.setDragThreshold(Jr(t,"threshold",9)),this.setTapOffset(Jr(t,"tapOffset",10));var e=Jr(t,"taps",void 0);return void 0!==e?this.setTaps(e):(this.setMaxTaps(Jr(t,"maxTaps",void 0)),this.setMinTaps(Jr(t,"minTaps",void 0))),this}onDragStart(){switch(this.state){case Kr:this.state=Zr;break;case Zr:var t=this.lastPointer;$r(t.upX,t.upY,t.x,t.y)>this.tapOffset&&(this.state=Qr,this.state=Zr);break;case Qr:this.state=Zr}}onDragEnd(){this.state===Zr&&(this.tapsCount++,this.emit("tapping",this,this.gameObject,this.lastPointer),void 0!==this.maxTaps&&this.tapsCount===this.maxTaps&&(this.state=Qr))}onDrag(){this.state!==Kr&&this.pointer.getDistance()>this.dragThreshold&&(this.state=Kr)}preUpdate(t,e){if(this.isRunning&&this.enable&&this.state===Zr){var i=this.lastPointer;i.isDown?t-i.downTime>this.holdTime&&(this.state=Kr):t-i.upTime>this.tapInterval&&(void 0===this.minTaps||this.tapsCount>=this.minTaps?this.state=Qr:this.state=Kr)}}postUpdate(t,e){this.isRunning&&this.enable&&this.state===Qr&&(this.state=Kr)}get isTapped(){return this.state===Qr}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 Kr="IDLE",Zr="BEGIN",Qr="RECOGNIZED",tn=Phaser.Utils.Objects.GetValue;class en extends Vr{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=sn},eventEmitter:!1};this.setRecongizedStateObject(new Ts(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(tn(t,"threshold",9)),this.setHoldTime(tn(t,"time",251)),this}onDragStart(){this.state=rn,0===this.holdTime&&(this.state=nn)}onDragEnd(){this.state=sn}onDrag(){this.state!==sn&&this.pointer.getDistance()>this.dragThreshold&&(this.state=sn)}preUpdate(t,e){this.isRunning&&this.enable&&this.state===rn&&t-this.pointer.downTime>=this.holdTime&&(this.state=nn)}get isPressed(){return this.state===nn}setHoldTime(t){return this.holdTime=t,this}setDragThreshold(t){return this.dragThreshold=t,this}}const sn="IDLE",rn="BEGIN",nn="RECOGNIZED";Phaser.Utils.Objects.GetValue;const an=Phaser.Math.Distance.Between,hn=Phaser.Math.Angle.Between;var on={getDt:function(){var t;return t=this.scene,qe(t).loop.delta},getVelocity:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return an(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 hn(e.x,e.y,t.x,t.y)}},ln={"up&down":0,"left&right":1,"4dir":2,"8dir":3},dn={};const un=Phaser.Utils.Objects.GetValue,cn=Phaser.Math.RadToDeg;class pn extends Vr{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=vn},eventEmitter:!1};this.setRecongizedStateObject(new Ts(s)),this.clearDirectionStates()}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(un(t,"threshold",10)),this.setVelocityThreshold(un(t,"velocityThreshold",1e3)),this.setDirectionMode(un(t,"dir","8dir")),this}onDragStart(){this.state=fn}onDragEnd(){this.state=vn}onDrag(){this.state===fn&&(this.validDrag||(this.validDrag=0===this.dragThreshold||this.pointer.getDistance()>=this.dragThreshold),this.validDrag&&this.dragVelocity>this.velocityThreshold&&(this.state=gn))}postUpdate(t,e){this.isRunning&&this.enable&&this.state===gn&&(this.state=vn)}get isSwiped(){return this.state===gn}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=ln[t]),this.dirMode=t,this}updateDirectionStates(){return function(t,e,i){switch(void 0===i?i={}:!0===i&&(i=dn),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(pn.prototype,on);const vn="IDLE",fn="BEGIN",gn="RECOGNIZED",mn=Phaser.Utils.Objects.GetValue,yn=Phaser.Utils.Array.SpliceOne,bn=Phaser.Math.Distance.Between,Cn=Phaser.Math.Angle.Between;class _n{constructor(t,e){var i=He(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(mn(e,"inputConfig",void 0)),this.setEventEmitter(mn(e,"eventEmitter",void 0)),this._enable=void 0,this.pointers=[],this.movedState={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setEnable(mn(t,"enable",!0)),this.bounds=mn(t,"bounds",void 0),this.tracerState=Pn,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 Pn:this.tracerState=wn,this.onDrag1Start();break;case wn: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],yn(this.pointers,e),this.tracerState){case wn:this.tracerState=Pn,this.onDrag1End();break;case xn:this.tracerState=wn,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 wn:this.onDrag1();break;case xn:this.onDrag2()}}}dragCancel(){return this.tracerState===xn&&this.onDrag2End(),this.pointers.length=0,ft(this.movedState),this.tracerState=Pn,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 bn(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 Cn(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;Sn.x=e.x-i.x,Sn.y=e.y-i.y}else Sn.x=0,Sn.y=0;return Sn}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=On,this}isPointer0InGameObject(t,e,i){var s=this.pointers[0];return!!s&&rr(t,s,e,i)}isPointer1InGameObject(t,e,i){var s=this.pointers[1];return!!s&&rr(t,s,e,i)}}Object.assign(_n.prototype,Ve);var Sn={};const Pn=0,wn=1,xn=2,On="IDLE";Phaser.Utils.Objects.GetValue;const Tn=Phaser.Math.RotateAround;var En=function(t,e,i,s){return Tn(t,e,i,s),t.rotation+=s,t},kn={};const Dn=Phaser.Utils.Objects.GetValue,Rn=Phaser.Math.Angle.WrapDegrees,Mn=Phaser.Math.Angle.ShortestBetween,Ln=Phaser.Math.RadToDeg,An=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=kn),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=Rn(Ln(this.angleBetween));this.angle=Mn(this.prevAngle,t),this.prevAngle=t,this.state=Fn}break;case Fn:t=Rn(Ln(this.angleBetween)),this.angle=Mn(this.prevAngle,t),this.prevAngle=t,this.emit("rotate",this)}}get isRotated(){return this.state===Fn}get rotation(){return An(this.angle)}setDragThreshold(t){return this.dragThreshold=t,this}}.prototype,jn);const zn="IDLE",Xn="BEGIN",Fn="RECOGNIZED",Yn=Phaser.Utils.Objects.GetValue;var In=function(t){var e=Yn(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){Dr(i.eventEmitter,`${i.eventNamePrefix}${t.tapsCount}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Nn=Phaser.Utils.Objects.GetValue;var Wn=function(t){var e=Nn(t,"press",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._press=new en(this,e),this._press.on("pressstart",(function(t,e,s){Dr(i.eventEmitter,`${i.eventNamePrefix}pressstart`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this).on("pressend",(function(t,e,s){Dr(i.eventEmitter,`${i.eventNamePrefix}pressend`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Bn=Phaser.Utils.Objects.GetValue;var Vn=function(t){var e=Bn(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 pn(this,e),this._swipe.on("swipe",(function(t,e,s){var r=t.left?"left":t.right?"right":t.up?"up":"down";Dr(i.eventEmitter,`${i.eventNamePrefix}swipe${r}`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Gn=Phaser.Utils.Objects.GetValue;var Un=function(t,e){return t.setInteractive(),Gn(e,"dropZone",!1)&&(t.input.dropZone=!0),t._childrenInteractive={targetSizers:Gn(e,"targets",[t]),targetMode:Gn(e,"targetMode","parent"),eventEmitter:Gn(e,"eventEmitter",t),eventNamePrefix:Gn(e,"inputEventPrefix","child.")},Mr.call(t,e),jr.call(t,e),Fr.call(t,e),Wr.call(t,e),In.call(t,e),Wn.call(t,e),Vn.call(t,e),t},Hn={getSizerConfig:function(t){return void 0===t&&(t=this),Et(t)},getChildPrevState:function(t){var e=Et(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=ae(e,"color"),s=ae(e,"lineWidth");var o=ae(e,"name",!1);o&&(r=ae(o,"createTextCallback",oe),n=ae(o,"createTextCallbackScope",void 0),"string"==typeof(a=ae(o,"align","left-top"))&&(a=At[a]))}if(void 0===i&&(i=16777215),void 0===s&&(s=1),r&&!t.children){t.children=new he(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)}}for(var d,u,c=this.getAllShownChildren([this]),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 ia=Phaser.Utils.Objects.IsPlainObject,sa=Phaser.Utils.Objects.GetValue,ra=Phaser.Display.Align.CENTER,na={min:0,full:-1};var aa=function(t,e,i,s,r,n,a,h,o,l){pe.call(this,t);var d=t.isRexSpace,u=typeof e;if(null===e)return this;if("number"===u);else if("string"===u)e=na[e];else if(ia(e)){var c;e=sa(c=e,"proportion",void 0),i=sa(c,"align",ra),s=sa(c,"padding",0),r=sa(c,"expand",!1),n=sa(c,"key",void 0),a=sa(c,"index",void 0),t.isRexSizer||(h=sa(c,"minWidth",void 0),o=sa(c,"minHeight",void 0)),l=sa(c,"fitRatio",0)}return"string"==typeof i&&(i=At[i]),void 0===e&&(e=d?1:0),void 0===i&&(i=ra),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===h&&(d?h=0:t.isRexSizer||(h=t._minWidth)),void 0===o&&(d?o=0:t.isRexSizer||(o=t._minHeight)),void 0===l||!1===l?l=0:!0===l&&(l=Q(t)/tt(t)),(c=this.getSizerConfig(t)).proportion=e,c.align=i,c.padding=ue(s),c.expand=r,c.fitRatio=0===e?l:0,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},ha={add:aa,addSpace(t){return this.insertSpace(void 0,t),this},insertSpace(t,e){return void 0===e&&(e=1),aa.call(this,new ta(this.scene),{proportion:e,minWidth:0,minHeight:0,index:t}),this},insert(t,e,i,s,r,n,a,h){return ia(i)&&(i.index=t),aa.call(this,e,i,s,r,n,a,t,h),this},insertAtPosition(t,e,i,s,r,n,a,h,o){var l=ea.call(this,t,e);return-1===l&&(l=void 0),this.insert(l,i,s,r,n,a,h,o),this}};const oa=Tt.prototype.clear;var la=function(t){this.backgroundChildren&&(this.backgroundChildren.length=0);var e,i=!t&&this.sizerEventsEnable;if(i&&(e=this.getChildren([])),oa.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,la.call(this,t),this}},ca={getChildAlign(t){return this.getSizerConfig(t).align},setChildAlign(t,e){return"string"==typeof e&&(e=At[e]),this.getSizerConfig(t).align=e,this}},pa={getChildProportion(t){return this.getSizerConfig(t).proportion},setChildProportion(t,e){return this.getSizerConfig(t).proportion=e,this}},va={getChildExpand(t){return this.getSizerConfig(t).expand},setChildExpand(t,e){return this.getSizerConfig(t).expand=e,this}},fa={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}},ga={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&&(Ie(t,0,0),e.resolved=!1,this.hasRatioFitChild=!0);return this._childrenProportion=void 0,this.hasProportion0Child=!1,this.proportionLength=void 0,Xe.call(this),this},layoutChildren:function(){for(var t,e,i,s,r,n,a,h,o,l,d=this.sizerChildren,u=this.innerLeft,c=this.innerTop,p=this.innerWidth,v=this.innerHeight,f=u,g=c,m=this.startChildIndex,y=0,b=d.length;y0?(e=t-this.getChildrenWidth(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},resolveHeight:function(t){if(void 0!==(t=Le.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)||Re.call(this)},runWidthWrap:function(t){this.wrapResult||(1===this.orientation&&Zn.call(this,t,void 0),Me.call(this,t))},hasHeightWrap:function(){return!(!this.hasRatioFitChild||0!==this.orientation)||Ae.call(this)},runHeightWrap:function(t){this.wrapResult||(0===this.orientation&&Zn.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(ga,ha,ua,ca,pa,va,fa);var ma=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},ya={x:0,h:0,horizontal:0,"left-to-right":0,y:1,v:1,vertical:1,"top-to-bottom":1};const ba=Phaser.Utils.Objects.IsPlainObject,Ca=Phaser.Utils.Objects.GetValue;class _a extends $n{constructor(t,e,i,s,r,n,a){ba(e)?(e=Ca(a=e,"x",0),i=Ca(a,"y",0),s=Ca(a,"width",void 0),r=Ca(a,"height",void 0),n=Ca(a,"orientation",0)):ba(s)?(s=Ca(a=s,"width",void 0),r=Ca(a,"height",void 0),n=Ca(a,"orientation",0)):ba(n)&&(n=Ca(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(Ca(a,"space.item",0)),this.setStartChildIndex(Ca(a,"startChildIndex",0)),this.setRTL(Ca(a,"rtl",!1)),this.addChildrenMap("items",this.sizerChildren)}setOrientation(t){return this.orientation=function(t){return"string"==typeof t&&(t=ya[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=ma.call(this)),this._childrenProportion}}Object.assign(_a.prototype,ga);var Sa=Phaser.Renderer.WebGL.Utils,Pa=function(t,e,i,s,r,n){for(var a=Sa.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+")"},Ea=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 ka=Phaser.Renderer.Canvas.SetTransform;var Da={renderWebGL:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.pipelines.set(e.pipeline),n=Oa(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&&Pa(r,a,e,l,h,o),e.isStroked&&xa(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(ka(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(Ma.prototype,Da);const La=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=La(t,"x",0),i=La(t,"y",0));var s=this.cornerRadius;s.tl=ja(La(t,"tl",void 0),e,i),s.tr=ja(La(t,"tr",void 0),e,i),s.bl=ja(La(t,"bl",void 0),e,i),s.br=ja(La(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 ja=function(t,e,i){return void 0===t?t={x:e,y:i}:"number"==typeof t&&(t={x:t,y:t}),Xa(t),t},za=function(t,e){"number"==typeof e?(t.x=e,t.y=e):(t.x=La(e,"x",0),t.y=La(e,"y",0)),Xa(t)},Xa=function(t){t.convex=t.x>=0||t.y>=0,t.x=Math.abs(t.x),t.y=Math.abs(t.y)},Fa=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 Ya=Phaser.Math.DegToRad;var Ia=function(t,e,i,s,r,n,a,h,o){a&&n>r?n-=360:!a&&n0&&t.y>0};const Ua={rectangle:0,circle:1},Ha=Phaser.Utils.Objects.GetValue;class Ja extends Ze{constructor(t,e){super(t,e),this.style=Ha(e,"style",this);var i=Ha(e,"propertiesMap");this.activeStyle=$a(e,"active",i),this.hoverStyle=$a(e,"hover",i),this.disableStyle=$a(e,"disable",i),this.onModifyStyle=Ha(e,"onModifyStyle")}getStyle(t){return function(t,e,i){if(void 0===i&&(i={}),Array.isArray(e))for(var s=0,r=e.length;s0,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};const Nh=Phaser.Utils.Objects.GetValue,Wh=Phaser.Utils.Objects.IsPlainObject;class Bh extends(ph(nh)){constructor(t,e,i,s,r,n,a,h){Wh(e)?(e=Nh(h=e,"x",0),i=Nh(h,"y",0),s=Nh(h,"width",2),r=Nh(h,"height",2),n=Nh(h,"barColor",void 0),a=Nh(h,"value",0)):Wh(s)?(s=Nh(h=s,"width",2),r=Nh(h,"height",2),n=Nh(h,"barColor",void 0),a=Nh(h,"value",0)):Wh(n)&&(n=Nh(h=n,"barColor",void 0),a=Nh(h,"value",0)),super(t,e,i,s,r,h),this.type="rexLineProgress",this.bootProgressBase(h),this.addShape((new Yh).setName("trackFill")).addShape((new Yh).setName("bar")).addShape((new Yh).setName("trackStroke")),this.setTrackColor(Nh(h,"trackColor",void 0)),this.setBarColor(n),this.setTrackStroke(Nh(h,"trackStrokeThickness",2),Nh(h,"trackStrokeColor",void 0)),this.setSkewX(Nh(h,"skewX",0)),this.setRTL(Nh(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 Vh={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&&Ih(s,0,0,e,i,t).close();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),Ih(a,r,0,n,i,t).close());var h=this.getShape("trackStroke");h.lineStyle(this.trackStrokeThickness,this.trackStrokeColor),h.isStroked&&Ih(h,0,0,e,i,t).end()}};Object.assign(Bh.prototype,Vh);var Gh=function(t){return null==t||""===t||0===t.length},Uh=function(t,e,i,s){if(void 0===s&&(s="."),"object"==typeof t){if(Gh(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(Gh(e));else{var r;"string"==typeof e&&(e=e.split("."));for(var n=0,a=e.length;nuo(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}const co=Phaser.Utils.Objects.IsPlainObject,po=Phaser.Utils.Objects.GetValue;var vo=function(t){return"string"==typeof t&&(t=fo[t]),t};const fo={scale:0,repeat:1};var go=function(t,e){return 0===t||t===this.columns.count-1||0===e||e===this.rows.count-1},mo={_beginDraw:jt,_drawImage:jt,_drawTileSprite:jt,_endDraw:jt,setGetFrameNameCallback:function(t){return void 0===t&&(t=lo),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=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),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 co(t)?(this.stretchMode.edge=vo(po(t,"edge",0)),this.stretchMode.internal=vo(po(t,"internal",0))):(t=vo(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 yo=Phaser.Utils.Objects.IsPlainObject,bo=Phaser.Utils.Objects.GetValue,Co=Phaser.GameObjects;var _o=void 0,So=function(t,e){if(_o||(_o={},qe(t).events.once("destroy",(function(){for(var t in _o)_o[t].destroy();_o=void 0}))),!_o.hasOwnProperty(e)){var i=qe(t).scene.systemScene;(t=new Co[e](i)).setOrigin(0),_o[e]=t}return _o[e]};const Po=Phaser.GameObjects.RenderTexture;class wo extends(function(t,e){class i extends t{constructor(t,i,s,r,n,a,h,o,l,d){if(yo(i)?(i=bo(d=i,"x",0),s=bo(d,"y",0),r=bo(d,"width",1),n=bo(d,"height",1),a=bo(d,"key",void 0),h=bo(d,"baseFrame",void 0),o=bo(d,"columns",void 0),l=bo(d,"rows",void 0)):yo(r)?(r=bo(d=r,"width",1),n=bo(d,"height",1),a=bo(d,"key",void 0),h=bo(d,"baseFrame",void 0),o=bo(d,"columns",void 0),l=bo(d,"rows",void 0)):yo(a)?(a=bo(d=a,"key",void 0),h=bo(d,"baseFrame",void 0),o=bo(d,"columns",void 0),l=bo(d,"rows",void 0)):yo(h)?(h=bo(d=h,"baseFrame",void 0),o=bo(d,"columns",void 0),l=bo(d,"rows",void 0)):Array.isArray(h)?(d=l,l=o,o=h,h=bo(d,"baseFrame",void 0)):yo(o)&&(o=bo(d=o,"columns",void 0),l=bo(d,"rows",void 0)),void 0===h&&(h=bo(d,"frame",void 0)),void 0===o){var u=bo(d,"leftWidth",void 0),c=bo(d,"rightWidth",void 0);void 0!==u&&void 0!==c&&(o=[u,void 0,c])}if(void 0===l){var p=bo(d,"topHeight",void 0),v=bo(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(bo(d,"getFrameNameCallback",void 0)),this.setStretchMode(bo(d,"stretchMode",0)),this.setPreserveRatio(bo(d,"preserveRatio",!0));var f=bo(d,"maxFixedPartScale",1),g=bo(d,"maxFixedPartScaleX",f),m=bo(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,mo),i}(Po,"rexNinePatch")){}var xo={_drawImage:function(t,e,i,s,r,n){var a=So(this,"Image").setTexture(t,e).setDisplaySize(r,n);this.draw(a,i,s)},_drawTileSprite:function(t,e,i,s,r,n){var a=So(this,"TileSprite").setTexture(t,e).setSize(r,n);this.draw(a,i,s)}};Object.assign(wo.prototype,xo);class Oo extends Ze{constructor(t,e){return super(t),new Proxy(this,this)}get(t,e){if($h(t,e))return t[e];var i=t.parent;return $h(i,e)?i[e]:void 0}set(t,e,i){return $h(t,e)?t[e]=i:$h(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 To=Phaser.Utils.Objects.GetValue;class Eo extends wo{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexStatesNinePatch";var i=To(e,"effects",!0);i&&to(this,i),this.style=new Oo(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign(Eo.prototype,Ka);const ko=["alpha","tint","flipX","flipY"];var Do=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 Hh(t,e);break;case"image":s=new oo(t,e);break;case"nineSlice":s=e.hasOwnProperty("stretchMode")?new Eo(t,e):new ro(t,e);break;default:s=new Za(t,e)}return function(t,e){if(!e)return t;for(var i=0,s=ko.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 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=O(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=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 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}},we=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 xe=/(\S+)\[(\d+)\]/i,Oe=Phaser.Utils.Objects.GetValue;var Te=function(t,e){return void 0===e?t:t[e]},Ee=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=Oe(e,"left",0),t.right=Oe(e,"right",0),t.top=Oe(e,"top",0),t.bottom=Oe(e,"bottom",0)),t},ke={getInnerPadding(t){return Te(this.space,t)},setInnerPadding(t,e){return Ee(this.space,t,e),this},getOuterPadding(t){return Te(this.getSizerConfig(this).padding,t)},setOuterPadding(t,e){return Ee(this.getSizerConfig(this).padding,t,e),this},getChildOuterPadding(t,e){return"string"==typeof t&&(t=this.getElement(t)),Te(this.getSizerConfig(t).padding,e)},setChildOuterPadding(t,e,i){return"string"==typeof t&&(t=this.getElement(t)),Ee(this.getSizerConfig(t).padding,e,i),this}},De=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}},Re=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},Me=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},Le=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},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},ze={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}},Xe=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?pi:ci,this.repeatCounter=0,this}stop(){return this.state=ui,this}update(t,e){this.state!==ui&&this.state!==fi&&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=vi)):(this.nowTime=this.duration,this.state=fi):this.nowTime>=0&&(this.state=pi))}get t(){var t;switch(this.state){case ui:case ci:case vi:t=0;break;case pi:t=this.nowTime/this.duration;break;case fi:t=1}return li(t,0,1)}set t(t){(t=li(t,-1,1))<0?(this.state=ci,this.nowTime=-this.delay*t):(this.state=pi,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===ui}get isDelay(){return this.state===ci}get isCountDown(){return this.state===pi}get isRunning(){return this.state===ci||this.state===pi}get isDone(){return this.state===fi}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}}const ui=0,ci=1,pi=2,vi=3,fi=-1;class gi extends ai{constructor(t,e){super(t,e),this.timer=new di}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 mi=Phaser.Utils.Objects.GetValue,yi=Phaser.Utils.Objects.GetAdvancedValue,bi=Phaser.Tweens.Builders.GetEaseFunction;class Ci extends gi{resetFromJSON(t){return this.timer.resetFromJSON(mi(t,"timer")),this.setEnable(mi(t,"enable",!0)),this.setTarget(mi(t,"target",this.parent)),this.setDelay(yi(t,"delay",0)),this.setDuration(yi(t,"duration",1e3)),this.setEase(mi(t,"ease","Linear")),this.setRepeat(mi(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=bi(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 _i=Phaser.Utils.Objects.GetValue,Si=Phaser.Utils.Objects.GetAdvancedValue,Pi=Phaser.Math.Linear;let wi=class extends Ci{constructor(t,e){super(t,e),this.scaleStart={},this.scaleEnd={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(_i(t,"mode",0)),this.setScaleRange(Si(t,"start",void 0),Si(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=xi[t]),this.mode=t,this}setScaleRange(t,e){return"number"==typeof t?(this.startX=t,this.startY=t):(this.startX=Si(t,"x",this.parent.scaleX),this.startY=Si(t,"y",this.parent.scaleY)),"number"==typeof e?(this.endX=e,this.endY=e):(this.endX=Si(e,"x",void 0),this.endY=Si(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=Pi(this.startX,this.endX,i)),this.hasScaleY&&(t.scaleY=Pi(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}};const xi={stop:0,destroy:1,yoyo:2};var Oi=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 wi(t,h):r.resetFromJSON(h),r.restart(),r},Ti=function(t,e,i,s,r,n){void 0===s&&(s="Linear"),r instanceof wi&&(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 wi(t,a):n.resetFromJSON(a),n.restart(),n},Ei=function(t,e){return new Promise((function(i,s){t.once(e,(function(){i()}))}))},ki=function(t){return Ei(t,"complete")};const Di=Phaser.Utils.Objects.IsPlainObject;var Ri={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(Di(t)){var s=t;t=s.duration,e=s.orientation,i=s.ease}var r=void 0===this._scaleBehavior;return this._scaleBehavior=Oi(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),ki(this._scaleBehavior)},isRunningPopUp(){return this._scaleBehavior&&"popup.complete"===this._scaleBehavior.completeEventName},scaleDownDestroy(t,e,i,s){if(Di(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=Ti(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),ki(this._scaleBehavior)},scaleDown(t,e,i){return this.scaleDownDestroy(t,e,i,!1),this},scaleDownPromise(t,e,i){return this.scaleDown(t,e,i),ki(this._scaleBehavior)},isRunningScaleDown(){return this._scaleBehavior&&"scaledown.complete"===this._scaleBehavior.completeEventName},scaleYoyo(t,e,i,s,r){if(Di(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 wi(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),ki(this._scaleBehavior)},isRunningScaleYoyo(){return this._scaleBehavior&&(this._scaleBehavior.completeEventName="scaleyoyo.complete")},isRunningEaseScale(){return this.isRunningPopUp()||this.isRunningScaleDown()||this.isRunningScaleYoyo()}},Mi={};Object.assign(Mi,Ri),Mi.onInitScale=function(){Ri.onInitScale.call(this);var t=this;this._scaleBehavior.on("update",(function(){var e=ge.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const Li=Phaser.Utils.Objects.GetValue,Ai=Phaser.Utils.Objects.GetAdvancedValue,ji=Phaser.Math.Linear;class zi extends Ci{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(Li(t,"mode",0)),this.setAlphaRange(Ai(t,"start",this.parent.alpha),Ai(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=Xi[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 Xi={stop:0,destroy:1,yoyo:2},Fi=Phaser.Utils.Objects.IsPlainObject;var Yi=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 a={mode:0,start:r,end:n,duration:e};return void 0===s?s=new zi(t,a):s.resetFromJSON(a),s.restart(),s},Ii=function(t,e,i,s){i instanceof zi&&(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 zi(t,r):s.resetFromJSON(r),s.restart(),s};const Ni=Phaser.Utils.Objects.IsPlainObject;var Wi={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=Yi(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadein.complete",this},fadeInPromise(t,e){return this.fadeIn(t,e),ki(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=Ii(this,t,e,this._fade),s&&this.onInitFade(),this._fade.completeEventName="fadeout.complete",this},fadeOutDestroyPromise(t,e){return this.fadeOutDestroy(t,e),ki(this._fade)},fadeOut(t){return this.fadeOutDestroy(t,!1),this},fadeOutPromise(t){return this.fadeOut(t),ki(this._fade)},isRunningFadeOut(){return this._fade&&"fadeout.complete"===this._fade.completeEventName},isRunningEaseFade(){return this.isRunningFadeIn()||this.isRunningFadeOut()}},Bi={};Object.assign(Bi,Wi),Bi.onInitFade=function(){Wi.onInitFade.call(this);var t=this;this._fade.on("update",(function(){var e=ge.getParentSizer(t);e&&e.resetChildAlphaState(t)}))};const Vi=Phaser.Utils.Objects.GetValue,Gi=Phaser.Utils.Objects.GetAdvancedValue,Ui=Phaser.Math.Linear;class Hi extends Ci{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){if(super.resetFromJSON(t),this.setMode(Vi(t,"mode",0)),t&&(t.hasOwnProperty("x")||t.hasOwnProperty("y"))){var e=Gi(t,"x",void 0),i=Gi(t,"y",void 0);this.setTargetPosition(e,i)}else this.setTargetPosition(t);return this}setMode(t){return"string"==typeof t&&(t=Ji[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=Gi(i,"startX",void 0),this.startY=Gi(i,"startY",void 0),this.endX=Gi(i,"endX",void 0),this.endY=Gi(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=Ui(this.startX,this.endX,i)),this.hasMoveY&&(t.y=Ui(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Ji={stop:0,destroy:1,yoyo:2};var $i=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,Ki=Phaser.Math.Distance.Between;var Zi={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*Ki(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 Hi&&(a=n,n=void 0),void 0===n&&(n=!1);var h={};return h.mode=n?1:0,void 0!==i&&(h.startX=$i(i,t.x),h.endX=t.x),void 0!==s&&(h.startY=$i(s,t.y),h.endY=t.y),h.duration=e,h.ease=void 0===r?"Linear":r,void 0===a?a=new Hi(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),ki(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),ki(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*Ki(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 Hi&&(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=$i(i,t.x)),void 0!==s&&(h.startY=t.y,h.endY=$i(s,t.y)),h.duration=e,h.ease=void 0===r?"Linear":r,void 0===a?a=new Hi(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),ki(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),ki(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}},Qi={};Object.assign(Qi,Zi),Qi.onInitEaseMove=function(){Zi.onInitEaseMove.call(this);var t=this;this._easeMove.on("update",(function(){var e=ge.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const ts=Phaser.Utils.Objects.GetValue;class es extends si{constructor(t,e){super(t,e),this.timer=new di,this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.timer.resetFromJSON(ts(t,"timer")),this.setEnable(ts(t,"enable",!0)),this.setMode(ts(t,"mode",1)),this.isRunning=ts(t,"isRunning",!1),this.setMagnitudeMode(ts(t,"magnitudeMode",1)),this.setAxisMode(ts(t,"axis",0)),this.setDuration(ts(t,"duration",500)),this.setMagnitude(ts(t,"magnitude",10)),this.ox=ts(t,"ox",void 0),this.oy=ts(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=is[t]),this.mode=t,this}setMagnitudeMode(t){return"string"==typeof t&&(t=rs[t]),this.magnitudeMode=t,this}setAxisMode(t){return"string"==typeof t&&(t=ss[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=ts(i,"magnitude",void 0),t=ts(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 is={effect:0,behavior:1},ss={both:0,"h&v":0,"x&y":0,horizontal:1,h:1,x:1,vertical:2,v:2,y:2},rs={constant:0,decay:1},ns=Phaser.Utils.Objects.IsPlainObject;var as={shake(t,e,i){if(ns(t)){var s=t;t=s.duration,e=s.magnitude,i=s.magnitudeMode}return void 0===this._shake&&(this._shake=new es(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),ki(this._shake)}};const hs=Phaser.Utils.Objects.GetValue,os=Phaser.Math.Linear;class ls extends Ci{constructor(t,e){super(t,e),this.resetFromJSON(),this.boot()}start(t){if(this.timer.isRunning)return this;var e=this.target;this.propertyKey=hs(t,"key","value");var i=e[this.propertyKey];return this.fromValue=hs(t,"from",i),this.toValue=hs(t,"to",i),this.setEase(hs(t,"ease",this.ease)),this.setDuration(hs(t,"duration",this.duration)),this.setRepeat(hs(t,"repeat",0)),this.setDelay(hs(t,"delay",0)),this.setRepeatDelay(hs(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]=os(this.fromValue,this.toValue,i)}}const ds=Phaser.Utils.Objects.IsPlainObject;class us extends Ze{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 ls(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(ds(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(ds(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 cs={easeDataTo(t,e,i,s){return this._easeData||(this._easeData=new us(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),Ei(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}},ps=Phaser.Utils.Array.Remove,vs={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 ks={delayCall(t,e,i){return this.delayCallTimer=function(t,e,i,s,r){var n=He(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}},Ds={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}},Rs={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}},Ms={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}},Ls={};Object.assign(Ls,ks,Ds,Rs,Ms);const As=Phaser.Utils.Objects.GetValue;class js extends Ze{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 Es(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(js.prototype,Ls);var zs=function(t){if(t.parentContainer)return zs(t.parentContainer);var e=function(t){var e=t.displayList;return H(e)?e:null}(t);return e?zs(e):t};class Xs extends Ze{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=zs(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 Fs=Phaser.GameObjects.Rectangle;class Ys extends Fs{constructor(t,e,i){super(t,0,0,2,2,e,1),this.fullWindow=new Xs(this),this.setAlpha(i)}get tint(){return this.fillColor}set tint(t){this.setFillStyle(t,this.fillAlpha)}}const Is=Phaser.Utils.Objects.GetValue;class Ns extends Ze{constructor(t,e){super(t,{eventEmitter:!1}),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setHitAreaMode(Is(t,"hitAreaMode",0)),this.setEnable(Is(t,"enable",!0)),this.setStopMode(Is(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=Ws[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 Ws={default:0,fullWindow:1};const Bs=Phaser.Utils.Objects.GetValue;class Vs extends Ys{constructor(t,e){super(t,Bs(e,"color",0),Bs(e,"alpha",.8)),this.touchEventStop=new Ns(this,{hitAreaMode:1})}}var Gs={popUp(t,e){void 0!==t._modalScaleSave?(t.scaleX=t._modalScaleSave,t.scaleY=t._modalScaleSave):t._modalScaleSave=t.scaleX,Oi(t,e)},scaleDown(t,e){Ti(t,e,void 0,void 0,!1)},fadeIn(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Yi(t,e)},fadeOut(t,e){Ii(t,e,!1)}},Us=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Yi(t,e,t.alpha)},Hs=function(t,e){Ii(t,e,!1)},Js=function(t,e,i,s,r){return!(!t||s&&!s(t,e,i)||!rt(t,!0).contains(e,i)||r&&!r(t,e,i))};const $s=Phaser.Utils.Objects.GetValue;let qs=class extends js{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=Ks.popUp),null==e.transitOut&&(e.transitOut=Ks.scaleDown),e.destroy=$s(e,"destroy",!0),super(t,e);var i=$s(e,"cover");this.cover=!1!==i?function(t,e){var i=t.scene,s=new Vs(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($s(i,"transitIn",Us)),this.setCoverTransitOutCallback($s(i,"transitOut",Hs)));var s=$s(e,"touchOutsideClose",!1),r=$s(e,"duration.hold",-1),n=$s(e,"timeOutClose",r>=0),a=$s(e,"anyTouchClose",!1);$s(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),$s(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&&Js(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=Ks[t]),t){case Ks.popUp:t=Gs.popUp;break;case Ks.fadeIn:t=Gs.fadeIn}return super.setTransitInCallback(t),this}setTransitOutCallback(t){switch("string"==typeof t&&(t=Ks[t]),t){case Ks.scaleDown:t=Gs.scaleDown;break;case Ks.fadeOut:t=Gs.fadeOut}return super.setTransitOutCallback(t),this}setCoverTransitInCallback(t){return this.coverTransitInCallback=t,this}setCoverTransitOutCallback(t){return this.coverTransitOutCallback=t,this}};const Ks={popUp:0,fadeIn:1,scaleDown:0,fadeOut:1};var Zs=function(t){return t&&"function"==typeof t},Qs={modal(t,e){return Zs(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}},tr=function(t,e,i,s,r){Zs(e)&&(r=s,s=i,i=e,e=this);var n=this.scene.events;return this.bindEvent(e,n,t,i,s,r),this},er={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 tr.call(this,"preupdate",t,e,i,s),this},bindSceneUpdateEvent(t,e,i,s){return tr.call(this,"update",t,e,i,s),this},bindScenePostupdateEvent(t,e,i,s){return tr.call(this,"postupdate",t,e,i,s),this},bindSceneRenderEvent(t,e,i,s){return tr.call(this,"render",t,e,i,s),this},bindScenePauseEvent(t,e,i,s){return tr.call(this,"pause",t,e,i,s),this},bindSceneResumeEvent(t,e,i,s){return tr.call(this,"resume",t,e,i,s),this},bindSceneSleepEvent(t,e,i,s){return tr.call(this,"sleep",t,e,i,s),this},bindSceneWakeEvent(t,e,i,s){return tr.call(this,"wake",t,e,i,s),this},bindSceneShutdownEvent(t,e,i,s){return tr.call(this,"shutdown",t,e,i,s),this}},ir=function(t,e,i){var s=t.camera;return s?(void 0===i?i={}:!0===i&&(i=sr),s===e?(i.x=t.worldX,i.y=t.worldY):s.getWorldPoint(t.x,t.y,i),i):null},sr={},rr=function(t,e,i,s){var r,n=t.scene.sys.cameras.main,a=0===t.scrollFactorX&&0===t.scrollFactorY;if(e)return a?Js(t,e.x,e.y,i,s):!!(r=ir(e,n,!0))&&Js(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 fr={press:0,pointerdown:0,release:1,pointerup:1};var gr={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 vr(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}},mr=function(t,e,i,s,r){if(e)return!(i&&!i(t,e)||!yr(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 br.length=0,!0;return br.length=0,!1},br=[];const Cr=Phaser.Utils.Objects.GetValue;class _r extends Ze{constructor(t,e){super(t,e),this._enable=void 0;var i=Cr(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(Cr(t,"enable",!0)),this.setMode(Cr(t,"mode",1)),this.setClickInterval(Cr(t,"clickInterval",100)),this.setDragThreshold(Cr(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=Sr[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?mr:rr)(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 Sr={press:0,pointerdown:0,release:1,pointerup:1};var Pr={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 _r(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 wr extends Ts{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 Or extends Ze{constructor(t,e){super(t,e),this._enable=void 0,this.cooldown=new wr,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 Tr={isPointerInBounds(t){return void 0===t?t=this:"string"==typeof t&&(t=this.getElement(t)),!!t&&rr(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 Or(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 Or(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}},Er={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}},kr=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=Gr,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===Ur&&this.onDragEnd(),this.pointer=void 0,this.tracerState=Gr,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=Hr,this}isPointerInGameObject(t,e,i){var s=this.lastPointer;return!!s&&rr(t,s,e,i)}}const Gr=0,Ur=1,Hr="IDLE",Jr=Phaser.Utils.Objects.GetValue,$r=Phaser.Math.Distance.Between;class qr extends Vr{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=Kr},eventEmitter:!1};this.setRecongizedStateObject(new Ts(s))}resetFromJSON(t){super.resetFromJSON(t),this.setHoldTime(Jr(t,"time",250)),this.setTapInterval(Jr(t,"tapInterval",200)),this.setDragThreshold(Jr(t,"threshold",9)),this.setTapOffset(Jr(t,"tapOffset",10));var e=Jr(t,"taps",void 0);return void 0!==e?this.setTaps(e):(this.setMaxTaps(Jr(t,"maxTaps",void 0)),this.setMinTaps(Jr(t,"minTaps",void 0))),this}onDragStart(){switch(this.state){case Kr:this.state=Zr;break;case Zr:var t=this.lastPointer;$r(t.upX,t.upY,t.x,t.y)>this.tapOffset&&(this.state=Qr,this.state=Zr);break;case Qr:this.state=Zr}}onDragEnd(){this.state===Zr&&(this.tapsCount++,this.emit("tapping",this,this.gameObject,this.lastPointer),void 0!==this.maxTaps&&this.tapsCount===this.maxTaps&&(this.state=Qr))}onDrag(){this.state!==Kr&&this.pointer.getDistance()>this.dragThreshold&&(this.state=Kr)}preUpdate(t,e){if(this.isRunning&&this.enable&&this.state===Zr){var i=this.lastPointer;i.isDown?t-i.downTime>this.holdTime&&(this.state=Kr):t-i.upTime>this.tapInterval&&(void 0===this.minTaps||this.tapsCount>=this.minTaps?this.state=Qr:this.state=Kr)}}postUpdate(t,e){this.isRunning&&this.enable&&this.state===Qr&&(this.state=Kr)}get isTapped(){return this.state===Qr}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 Kr="IDLE",Zr="BEGIN",Qr="RECOGNIZED",tn=Phaser.Utils.Objects.GetValue;class en extends Vr{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=sn},eventEmitter:!1};this.setRecongizedStateObject(new Ts(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(tn(t,"threshold",9)),this.setHoldTime(tn(t,"time",251)),this}onDragStart(){this.state=rn,0===this.holdTime&&(this.state=nn)}onDragEnd(){this.state=sn}onDrag(){this.state!==sn&&this.pointer.getDistance()>this.dragThreshold&&(this.state=sn)}preUpdate(t,e){this.isRunning&&this.enable&&this.state===rn&&t-this.pointer.downTime>=this.holdTime&&(this.state=nn)}get isPressed(){return this.state===nn}setHoldTime(t){return this.holdTime=t,this}setDragThreshold(t){return this.dragThreshold=t,this}}const sn="IDLE",rn="BEGIN",nn="RECOGNIZED";Phaser.Utils.Objects.GetValue;const an=Phaser.Math.Distance.Between,hn=Phaser.Math.Angle.Between;var on={getDt:function(){var t;return t=this.scene,qe(t).loop.delta},getVelocity:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return an(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 hn(e.x,e.y,t.x,t.y)}},ln={"up&down":0,"left&right":1,"4dir":2,"8dir":3},dn={};const un=Phaser.Utils.Objects.GetValue,cn=Phaser.Math.RadToDeg;class pn extends Vr{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=vn},eventEmitter:!1};this.setRecongizedStateObject(new Ts(s)),this.clearDirectionStates()}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(un(t,"threshold",10)),this.setVelocityThreshold(un(t,"velocityThreshold",1e3)),this.setDirectionMode(un(t,"dir","8dir")),this}onDragStart(){this.state=fn}onDragEnd(){this.state=vn}onDrag(){this.state===fn&&(this.validDrag||(this.validDrag=0===this.dragThreshold||this.pointer.getDistance()>=this.dragThreshold),this.validDrag&&this.dragVelocity>this.velocityThreshold&&(this.state=gn))}postUpdate(t,e){this.isRunning&&this.enable&&this.state===gn&&(this.state=vn)}get isSwiped(){return this.state===gn}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=ln[t]),this.dirMode=t,this}updateDirectionStates(){return function(t,e,i){switch(void 0===i?i={}:!0===i&&(i=dn),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(pn.prototype,on);const vn="IDLE",fn="BEGIN",gn="RECOGNIZED",mn=Phaser.Utils.Objects.GetValue,yn=Phaser.Utils.Array.SpliceOne,bn=Phaser.Math.Distance.Between,Cn=Phaser.Math.Angle.Between;class _n{constructor(t,e){var i=He(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(mn(e,"inputConfig",void 0)),this.setEventEmitter(mn(e,"eventEmitter",void 0)),this._enable=void 0,this.pointers=[],this.movedState={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setEnable(mn(t,"enable",!0)),this.bounds=mn(t,"bounds",void 0),this.tracerState=Pn,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 Pn:this.tracerState=wn,this.onDrag1Start();break;case wn: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],yn(this.pointers,e),this.tracerState){case wn:this.tracerState=Pn,this.onDrag1End();break;case xn:this.tracerState=wn,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 wn:this.onDrag1();break;case xn:this.onDrag2()}}}dragCancel(){return this.tracerState===xn&&this.onDrag2End(),this.pointers.length=0,ft(this.movedState),this.tracerState=Pn,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 bn(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 Cn(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;Sn.x=e.x-i.x,Sn.y=e.y-i.y}else Sn.x=0,Sn.y=0;return Sn}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=On,this}isPointer0InGameObject(t,e,i){var s=this.pointers[0];return!!s&&rr(t,s,e,i)}isPointer1InGameObject(t,e,i){var s=this.pointers[1];return!!s&&rr(t,s,e,i)}}Object.assign(_n.prototype,Ve);var Sn={};const Pn=0,wn=1,xn=2,On="IDLE";Phaser.Utils.Objects.GetValue;const Tn=Phaser.Math.RotateAround;var En=function(t,e,i,s){return Tn(t,e,i,s),t.rotation+=s,t},kn={};const Dn=Phaser.Utils.Objects.GetValue,Rn=Phaser.Math.Angle.WrapDegrees,Mn=Phaser.Math.Angle.ShortestBetween,Ln=Phaser.Math.RadToDeg,An=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=kn),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=Rn(Ln(this.angleBetween));this.angle=Mn(this.prevAngle,t),this.prevAngle=t,this.state=Fn}break;case Fn:t=Rn(Ln(this.angleBetween)),this.angle=Mn(this.prevAngle,t),this.prevAngle=t,this.emit("rotate",this)}}get isRotated(){return this.state===Fn}get rotation(){return An(this.angle)}setDragThreshold(t){return this.dragThreshold=t,this}}.prototype,jn);const zn="IDLE",Xn="BEGIN",Fn="RECOGNIZED",Yn=Phaser.Utils.Objects.GetValue;var In=function(t){var e=Yn(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){Dr(i.eventEmitter,`${i.eventNamePrefix}${t.tapsCount}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Nn=Phaser.Utils.Objects.GetValue;var Wn=function(t){var e=Nn(t,"press",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._press=new en(this,e),this._press.on("pressstart",(function(t,e,s){Dr(i.eventEmitter,`${i.eventNamePrefix}pressstart`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this).on("pressend",(function(t,e,s){Dr(i.eventEmitter,`${i.eventNamePrefix}pressend`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Bn=Phaser.Utils.Objects.GetValue;var Vn=function(t){var e=Bn(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 pn(this,e),this._swipe.on("swipe",(function(t,e,s){var r=t.left?"left":t.right?"right":t.up?"up":"down";Dr(i.eventEmitter,`${i.eventNamePrefix}swipe${r}`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Gn=Phaser.Utils.Objects.GetValue;var Un=function(t,e){return t.setInteractive(),Gn(e,"dropZone",!1)&&(t.input.dropZone=!0),t._childrenInteractive={targetSizers:Gn(e,"targets",[t]),targetMode:Gn(e,"targetMode","parent"),eventEmitter:Gn(e,"eventEmitter",t),eventNamePrefix:Gn(e,"inputEventPrefix","child.")},Mr.call(t,e),jr.call(t,e),Fr.call(t,e),Wr.call(t,e),In.call(t,e),Wn.call(t,e),Vn.call(t,e),t},Hn={getSizerConfig:function(t){return void 0===t&&(t=this),Et(t)},getChildPrevState:function(t){var e=Et(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=ae(e,"color"),s=ae(e,"lineWidth");var o=ae(e,"name",!1);o&&(r=ae(o,"createTextCallback",oe),n=ae(o,"createTextCallbackScope",void 0),"string"==typeof(a=ae(o,"align","left-top"))&&(a=At[a]))}if(void 0===i&&(i=16777215),void 0===s&&(s=1),r&&!t.children){t.children=new he(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)}}for(var d,u,c=this.getAllShownChildren([this]),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 ia=Phaser.Utils.Objects.IsPlainObject,sa=Phaser.Utils.Objects.GetValue,ra=Phaser.Display.Align.CENTER,na={min:0,full:-1};var aa=function(t,e,i,s,r,n,a,h,o,l){pe.call(this,t);var d=t.isRexSpace,u=typeof e;if(null===e)return this;if("number"===u);else if("string"===u)e=na[e];else if(ia(e)){var c;e=sa(c=e,"proportion",void 0),i=sa(c,"align",ra),s=sa(c,"padding",0),r=sa(c,"expand",!1),n=sa(c,"key",void 0),a=sa(c,"index",void 0),t.isRexSizer||(h=sa(c,"minWidth",void 0),o=sa(c,"minHeight",void 0)),l=sa(c,"fitRatio",0)}return"string"==typeof i&&(i=At[i]),void 0===e&&(e=d?1:0),void 0===i&&(i=ra),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===h&&(d?h=0:t.isRexSizer||(h=t._minWidth)),void 0===o&&(d?o=0:t.isRexSizer||(o=t._minHeight)),void 0===l||!1===l?l=0:!0===l&&(l=Q(t)/tt(t)),(c=this.getSizerConfig(t)).proportion=e,c.align=i,c.padding=ue(s),c.expand=r,c.fitRatio=0===e?l:0,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},ha={add:aa,addSpace(t){return this.insertSpace(void 0,t),this},insertSpace(t,e){return void 0===e&&(e=1),aa.call(this,new ta(this.scene),{proportion:e,minWidth:0,minHeight:0,index:t}),this},insert(t,e,i,s,r,n,a,h){return ia(i)&&(i.index=t),aa.call(this,e,i,s,r,n,a,t,h),this},insertAtPosition(t,e,i,s,r,n,a,h,o){var l=ea.call(this,t,e);return-1===l&&(l=void 0),this.insert(l,i,s,r,n,a,h,o),this}};const oa=Tt.prototype.clear;var la=function(t){this.backgroundChildren&&(this.backgroundChildren.length=0);var e,i=!t&&this.sizerEventsEnable;if(i&&(e=this.getChildren([])),oa.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,la.call(this,t),this}},ca={getChildAlign(t){return this.getSizerConfig(t).align},setChildAlign(t,e){return"string"==typeof e&&(e=At[e]),this.getSizerConfig(t).align=e,this}},pa={getChildProportion(t){return this.getSizerConfig(t).proportion},setChildProportion(t,e){return this.getSizerConfig(t).proportion=e,this}},va={getChildExpand(t){return this.getSizerConfig(t).expand},setChildExpand(t,e){return this.getSizerConfig(t).expand=e,this}},fa={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}},ga={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&&(Ie(t,0,0),e.resolved=!1,this.hasRatioFitChild=!0);return this._childrenProportion=void 0,this.hasProportion0Child=!1,this.proportionLength=void 0,Xe.call(this),this},layoutChildren:function(){for(var t,e,i,s,r,n,a,h,o,l,d=this.sizerChildren,u=this.innerLeft,c=this.innerTop,p=this.innerWidth,v=this.innerHeight,f=u,g=c,m=this.startChildIndex,y=0,b=d.length;y0?(e=t-this.getChildrenWidth(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},resolveHeight:function(t){if(void 0!==(t=Le.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)||Re.call(this)},runWidthWrap:function(t){this.wrapResult||(1===this.orientation&&Zn.call(this,t,void 0),Me.call(this,t))},hasHeightWrap:function(){return!(!this.hasRatioFitChild||0!==this.orientation)||Ae.call(this)},runHeightWrap:function(t){this.wrapResult||(0===this.orientation&&Zn.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(ga,ha,ua,ca,pa,va,fa);var ma=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},ya={x:0,h:0,horizontal:0,"left-to-right":0,y:1,v:1,vertical:1,"top-to-bottom":1};const ba=Phaser.Utils.Objects.IsPlainObject,Ca=Phaser.Utils.Objects.GetValue;class _a extends $n{constructor(t,e,i,s,r,n,a){ba(e)?(e=Ca(a=e,"x",0),i=Ca(a,"y",0),s=Ca(a,"width",void 0),r=Ca(a,"height",void 0),n=Ca(a,"orientation",0)):ba(s)?(s=Ca(a=s,"width",void 0),r=Ca(a,"height",void 0),n=Ca(a,"orientation",0)):ba(n)&&(n=Ca(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(Ca(a,"space.item",0)),this.setStartChildIndex(Ca(a,"startChildIndex",0)),this.setRTL(Ca(a,"rtl",!1)),this.addChildrenMap("items",this.sizerChildren)}setOrientation(t){return this.orientation=function(t){return"string"==typeof t&&(t=ya[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=ma.call(this)),this._childrenProportion}}Object.assign(_a.prototype,ga);var Sa=Phaser.Renderer.WebGL.Utils,Pa=function(t,e,i,s,r,n){for(var a=Sa.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+")"},Ea=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 ka=Phaser.Renderer.Canvas.SetTransform;var Da={renderWebGL:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.pipelines.set(e.pipeline),n=Oa(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&&Pa(r,a,e,l,h,o),e.isStroked&&xa(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(ka(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(Ma.prototype,Da);const La=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=La(t,"x",0),i=La(t,"y",0));var s=this.cornerRadius;s.tl=ja(La(t,"tl",void 0),e,i),s.tr=ja(La(t,"tr",void 0),e,i),s.bl=ja(La(t,"bl",void 0),e,i),s.br=ja(La(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 ja=function(t,e,i){return void 0===t?t={x:e,y:i}:"number"==typeof t&&(t={x:t,y:t}),Xa(t),t},za=function(t,e){"number"==typeof e?(t.x=e,t.y=e):(t.x=La(e,"x",0),t.y=La(e,"y",0)),Xa(t)},Xa=function(t){t.convex=t.x>=0||t.y>=0,t.x=Math.abs(t.x),t.y=Math.abs(t.y)},Fa=function(t){return t.x>0&&t.y>0},Ya=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 Ia=Phaser.Math.DegToRad;var Na=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 Nh=Phaser.Utils.Objects.GetValue,Wh=Phaser.Utils.Objects.IsPlainObject;class Bh extends(ph(nh)){constructor(t,e,i,s,r,n,a,h){Wh(e)?(e=(h=e).x,i=h.y,s=h.width,r=h.height,n=h.barColor,a=h.value):Wh(s)?(s=(h=s).width,r=h.height,n=h.barColor,a=h.value):Wh(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 Yh).setName("trackFill")).addShape((new Yh).setName("bar")).addShape((new Yh).setName("trackStroke")),this.setTrackColor(Nh(h,"trackColor",void 0)),this.setBarColor(n),this.setTrackStroke(Nh(h,"trackStrokeThickness",2),Nh(h,"trackStrokeColor",void 0)),this.setSkewX(Nh(h,"skewX",0)),this.setRTL(Nh(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 Vh={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&&Ih(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),Ih(a,r,0,n,i,t));var h=this.getShape("trackStroke");h.lineStyle(this.trackStrokeThickness,this.trackStrokeColor),h.isStroked&&Ih(h,0,0,e,i,t)}};Object.assign(Bh.prototype,Vh);var Gh=function(t){return null==t||""===t||0===t.length},Uh=function(t,e,i,s){if(void 0===s&&(s="."),"object"==typeof t){if(Gh(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(Gh(e));else{var r;"string"==typeof e&&(e=e.split("."));for(var n=0,a=e.length;nuo(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}const co=Phaser.Utils.Objects.IsPlainObject,po=Phaser.Utils.Objects.GetValue;var vo=function(t){return"string"==typeof t&&(t=fo[t]),t};const fo={scale:0,repeat:1};var go=function(t,e){return 0===t||t===this.columns.count-1||0===e||e===this.rows.count-1},mo={_beginDraw:jt,_drawImage:jt,_drawTileSprite:jt,_endDraw:jt,setGetFrameNameCallback:function(t){return void 0===t&&(t=lo),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=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),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 co(t)?(this.stretchMode.edge=vo(po(t,"edge",0)),this.stretchMode.internal=vo(po(t,"internal",0))):(t=vo(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 yo=Phaser.Utils.Objects.IsPlainObject,bo=Phaser.Utils.Objects.GetValue,Co=Phaser.GameObjects;var _o=void 0,So=function(t,e){if(_o||(_o={},qe(t).events.once("destroy",(function(){for(var t in _o)_o[t].destroy();_o=void 0}))),!_o.hasOwnProperty(e)){var i=qe(t).scene.systemScene;(t=new Co[e](i)).setOrigin(0),_o[e]=t}return _o[e]};const Po=Phaser.GameObjects.RenderTexture;class wo extends(function(t,e){class i extends t{constructor(t,i,s,r,n,a,h,o,l,d){if(yo(i)?(i=bo(d=i,"x",0),s=bo(d,"y",0),r=bo(d,"width",1),n=bo(d,"height",1),a=bo(d,"key",void 0),h=bo(d,"baseFrame",void 0),o=bo(d,"columns",void 0),l=bo(d,"rows",void 0)):yo(r)?(r=bo(d=r,"width",1),n=bo(d,"height",1),a=bo(d,"key",void 0),h=bo(d,"baseFrame",void 0),o=bo(d,"columns",void 0),l=bo(d,"rows",void 0)):yo(a)?(a=bo(d=a,"key",void 0),h=bo(d,"baseFrame",void 0),o=bo(d,"columns",void 0),l=bo(d,"rows",void 0)):yo(h)?(h=bo(d=h,"baseFrame",void 0),o=bo(d,"columns",void 0),l=bo(d,"rows",void 0)):Array.isArray(h)?(d=l,l=o,o=h,h=bo(d,"baseFrame",void 0)):yo(o)&&(o=bo(d=o,"columns",void 0),l=bo(d,"rows",void 0)),void 0===h&&(h=bo(d,"frame",void 0)),void 0===o){var u=bo(d,"leftWidth",void 0),c=bo(d,"rightWidth",void 0);void 0!==u&&void 0!==c&&(o=[u,void 0,c])}if(void 0===l){var p=bo(d,"topHeight",void 0),v=bo(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(bo(d,"getFrameNameCallback",void 0)),this.setStretchMode(bo(d,"stretchMode",0)),this.setPreserveRatio(bo(d,"preserveRatio",!0));var f=bo(d,"maxFixedPartScale",1),g=bo(d,"maxFixedPartScaleX",f),m=bo(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,mo),i}(Po,"rexNinePatch")){}var xo={_drawImage:function(t,e,i,s,r,n){var a=So(this,"Image").setTexture(t,e).setDisplaySize(r,n);this.draw(a,i,s)},_drawTileSprite:function(t,e,i,s,r,n){var a=So(this,"TileSprite").setTexture(t,e).setSize(r,n);this.draw(a,i,s)}};Object.assign(wo.prototype,xo);class Oo extends Ze{constructor(t,e){return super(t),new Proxy(this,this)}get(t,e){if($h(t,e))return t[e];var i=t.parent;return $h(i,e)?i[e]:void 0}set(t,e,i){return $h(t,e)?t[e]=i:$h(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 To=Phaser.Utils.Objects.GetValue;class Eo extends wo{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexStatesNinePatch";var i=To(e,"effects",!0);i&&to(this,i),this.style=new Oo(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign(Eo.prototype,Ka);const ko=["alpha","tint","flipX","flipY"];var Do=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 Hh(t,e);break;case"image":s=new oo(t,e);break;case"nineSlice":s=e.hasOwnProperty("stretchMode")?new Eo(t,e):new ro(t,e);break;default:s=new Za(t,e)}return function(t,e){if(!e)return t;for(var i=0,s=ko.length;i 0) && (radius.y > 0)); + }; + var LineTo = function (x, y, pathData) { var cnt = pathData.length; if (cnt >= 2) { @@ -592,8 +596,7 @@ geom.setTo(0, 0, width, height, radius); } - var iteration = GetValue$2(radiusConfig, 'iteration', undefined); - this.setIteration(iteration); + this.setIteration(GetValue$2(radiusConfig, 'iteration', undefined)); this.setPosition(x, y); this.setFillStyle(fillColor, fillAlpha); @@ -846,10 +849,6 @@ } - var IsArcCorner = function (radius) { - return ((radius.x > 0) && (radius.y > 0)); - }; - const ShapeTypeMap = { rectangle: 0, circle: 1 diff --git a/dist/rexstatesroundrectangle.min.js b/dist/rexstatesroundrectangle.min.js index 1d842abf0d..ba45b87b3c 100644 --- a/dist/rexstatesroundrectangle.min.js +++ b/dist/rexstatesroundrectangle.min.js @@ -1 +1 @@ -var t,e;t=void 0,e=function(){var t=Phaser.Renderer.WebGL.Utils,e=Phaser.Renderer.WebGL.Utils;const i=Phaser.GameObjects.GetCalcMatrix,s=Phaser.Renderer.Canvas.SetTransform;var r={renderWebGL:function(s,r,n,h){r.dirty&&(r.updateData(),r.dirty=!1),n.addToRenderList(r);var a=s.pipelines.set(r.pipeline),o=i(r,n,h),l=a.calcMatrix.copyFrom(o.calc),d=r._displayOriginX,u=r._displayOriginY,v=n.alpha*r.alpha;s.pipelines.preBatch(r),r.isFilled&&function(e,i,s,r,n,h){for(var a=t.getTintAppendFloatAlpha(s.fillColor,s.fillAlpha*r),o=s.pathData,l=s.pathIndexes,d=0;d>>16,a=(65280&r)>>>8,o=255&r;t.fillStyle="rgba("+h+","+a+","+o+","+n+")"}(n,e),n.fill()),e.isStroked&&(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}(n,e),n.stroke()),n.restore()}}};const n=Phaser.GameObjects.Shape;class h extends n{get fillColor(){return this._fillColor}set fillColor(t){this._fillColor=t,this.isFilled=null!=t&&this._fillAlpha>0}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(h.prototype,r);const a=Phaser.Utils.Objects.GetValue;let o=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=a(t,"x",0),i=a(t,"y",0));var s=this.cornerRadius;s.tl=l(a(t,"tl",void 0),e,i),s.tr=l(a(t,"tr",void 0),e,i),s.bl=l(a(t,"bl",void 0),e,i),s.br=l(a(t,"br",void 0),e,i)}get radiusTL(){var t=this.cornerRadius.tl;return Math.max(t.x,t.y)}set radiusTL(t){d(this.cornerRadius.tl,t)}get radiusTR(){var t=this.cornerRadius.tr;return Math.max(t.x,t.y)}set radiusTR(t){d(this.cornerRadius.tr,t)}get radiusBL(){var t=this.cornerRadius.bl;return Math.max(t.x,t.y)}set radiusBL(t){d(this.cornerRadius.bl,t)}get radiusBR(){var t=this.cornerRadius.br;return Math.max(t.x,t.y)}set radiusBR(t){d(this.cornerRadius.br,t)}};var l=function(t,e,i){return void 0===t?t={x:e,y:i}:"number"==typeof t&&(t={x:t,y:t}),u(t),t},d=function(t,e){"number"==typeof e?(t.x=e,t.y=e):(t.x=a(e,"x",0),t.y=a(e,"y",0)),u(t)},u=function(t){t.convex=t.x>=0||t.y>=0,t.x=Math.abs(t.x),t.y=Math.abs(t.y)},v=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 p=Phaser.Math.DegToRad;var y=function(t,e,i,s,r,n,h,a,o){h&&n>r?n-=360:!h&&n0&&t.y>0};const x={rectangle:0,circle:1};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 S=Phaser.Scene;var R=function(t){return t instanceof S};const b=Phaser.Game;var T=function(t){return t instanceof b};const A=Phaser.Utils.Objects.GetValue;class k{constructor(t,e){this.setParent(t),this.isShutdown=!1,this.setEventEmitter(A(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:R(e)?e:e.scene&&R(e.scene)?e.scene:e.parent&&e.parent.scene&&R(e.parent.scene)?e.parent.scene:null,this.game=function(t){return null==t||"object"!=typeof t?null:T(t)?t:T(t.game)?t.game:R(t)?t.sys.game:R(t.scene)?t.scene.sys.game:void 0}(t),this}}Object.assign(k.prototype,E);const P=Phaser.Utils.Objects.GetValue;class L extends k{constructor(t,e){super(t,e),this.style=P(e,"style",this);var i=P(e,"propertiesMap");this.activeStyle=M(e,"active",i),this.hoverStyle=M(e,"hover",i),this.disableStyle=M(e,"disable",i),this.onModifyStyle=P(e,"onModifyStyle")}getStyle(t){return function(t,e,i){if(void 0===i&&(i={}),Array.isArray(e))for(var s=0,r=e.length;s>>16,a=(65280&r)>>>8,o=255&r;t.fillStyle="rgba("+h+","+a+","+o+","+n+")"}(n,e),n.fill()),e.isStroked&&(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}(n,e),n.stroke()),n.restore()}}};const n=Phaser.GameObjects.Shape;class h extends n{get fillColor(){return this._fillColor}set fillColor(t){this._fillColor=t,this.isFilled=null!=t&&this._fillAlpha>0}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(h.prototype,r);const a=Phaser.Utils.Objects.GetValue;let o=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=a(t,"x",0),i=a(t,"y",0));var s=this.cornerRadius;s.tl=l(a(t,"tl",void 0),e,i),s.tr=l(a(t,"tr",void 0),e,i),s.bl=l(a(t,"bl",void 0),e,i),s.br=l(a(t,"br",void 0),e,i)}get radiusTL(){var t=this.cornerRadius.tl;return Math.max(t.x,t.y)}set radiusTL(t){d(this.cornerRadius.tl,t)}get radiusTR(){var t=this.cornerRadius.tr;return Math.max(t.x,t.y)}set radiusTR(t){d(this.cornerRadius.tr,t)}get radiusBL(){var t=this.cornerRadius.bl;return Math.max(t.x,t.y)}set radiusBL(t){d(this.cornerRadius.bl,t)}get radiusBR(){var t=this.cornerRadius.br;return Math.max(t.x,t.y)}set radiusBR(t){d(this.cornerRadius.br,t)}};var l=function(t,e,i){return void 0===t?t={x:e,y:i}:"number"==typeof t&&(t={x:t,y:t}),u(t),t},d=function(t,e){"number"==typeof e?(t.x=e,t.y=e):(t.x=a(e,"x",0),t.y=a(e,"y",0)),u(t)},u=function(t){t.convex=t.x>=0||t.y>=0,t.x=Math.abs(t.x),t.y=Math.abs(t.y)},v=function(t){return t.x>0&&t.y>0},p=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 y=Phaser.Math.DegToRad;var c=function(t,e,i,s,r,n,h,a,o){h&&n>r?n-=360:!h&&n 0) && (radius.y > 0)); + }; + var LineTo = function (x, y, pathData) { var cnt = pathData.length; if (cnt >= 2) { @@ -14566,8 +14570,7 @@ geom.setTo(0, 0, width, height, radius); } - var iteration = GetValue$j(radiusConfig, 'iteration', undefined); - this.setIteration(iteration); + this.setIteration(GetValue$j(radiusConfig, 'iteration', undefined)); this.setPosition(x, y); this.setFillStyle(fillColor, fillAlpha); @@ -14820,10 +14823,6 @@ } - var IsArcCorner = function (radius) { - return ((radius.x > 0) && (radius.y > 0)); - }; - const ShapeTypeMap = { rectangle: 0, circle: 1 @@ -16409,6 +16408,7 @@ var skewX = this.skewX; var width = this.width - Math.abs(skewX); var height = this.height; + var trackFill = this.getShape('trackFill'); trackFill.fillStyle(this.trackColor); if (trackFill.isFilled) { @@ -16417,8 +16417,7 @@ 0, 0, // x0, y0 width, height, // x1, y1 skewX // skewX - ) - .close(); + ); } var bar = this.getShape('bar'); @@ -16438,8 +16437,7 @@ barX0, 0, // x0, y0 barX1, height, // x1, y1 skewX // skew - ) - .close(); + ); } var trackStroke = this.getShape('trackStroke'); @@ -16450,8 +16448,7 @@ 0, 0, // x0, y0 width, height, // x1, y1 skewX // skewX - ) - .end(); + ); } }; @@ -16471,6 +16468,8 @@ .lineTo(x0, y0).lineTo(startX, y0); } + lines.close(); + return lines; }; @@ -16481,24 +16480,33 @@ constructor(scene, x, y, width, height, barColor, value, config) { if (IsPlainObject$4(x)) { config = x; - x = GetValue$g(config, 'x', 0); - y = GetValue$g(config, 'y', 0); - width = GetValue$g(config, 'width', 2); - height = GetValue$g(config, 'height', 2); - barColor = GetValue$g(config, 'barColor', undefined); - value = GetValue$g(config, 'value', 0); + + x = config.x; + y = config.y; + width = config.width; + height = config.height; + barColor = config.barColor; + value = config.value; } else if (IsPlainObject$4(width)) { config = width; - width = GetValue$g(config, 'width', 2); - height = GetValue$g(config, 'height', 2); - barColor = GetValue$g(config, 'barColor', undefined); - value = GetValue$g(config, 'value', 0); + + width = config.width; + height = config.height; + barColor = config.barColor; + value = config.value; } else if (IsPlainObject$4(barColor)) { config = barColor; - barColor = GetValue$g(config, 'barColor', undefined); - value = GetValue$g(config, 'value', 0); + + barColor = config.barColor; + value = config.value; } + if (x === undefined) { x = 0; } + if (y === undefined) { y = 0; } + if (width === undefined) { width = 2; } + if (height === undefined) { height = width; } + if (value === undefined) { value = 0; } + super(scene, x, y, width, height, config); this.type = 'rexLineProgress'; diff --git a/dist/rextextarea.min.js b/dist/rextextarea.min.js index cffee26c69..07156dfd74 100644 --- a/dist/rextextarea.min.js +++ b/dist/rextextarea.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},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=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},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}},Pe=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 Oe=/(\S+)\[(\d+)\]/i,Ee=Phaser.Utils.Objects.GetValue;var Te=function(t,e){return void 0===e?t:t[e]},ke=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=Ee(e,"left",0),t.right=Ee(e,"right",0),t.top=Ee(e,"top",0),t.bottom=Ee(e,"bottom",0)),t},Me={getInnerPadding(t){return Te(this.space,t)},setInnerPadding(t,e){return ke(this.space,t,e),this},getOuterPadding(t){return Te(this.getSizerConfig(this).padding,t)},setOuterPadding(t,e){return ke(this.getSizerConfig(this).padding,t,e),this},getChildOuterPadding(t,e){return"string"==typeof t&&(t=this.getElement(t)),Te(this.getSizerConfig(t).padding,e)},setChildOuterPadding(t,e,i){return"string"==typeof t&&(t=this.getElement(t)),ke(this.getSizerConfig(t).padding,e,i),this}},De=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}},Re=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},Le=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},Ye=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}},je=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},ze=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}},Ae=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?vi:pi,this.repeatCounter=0,this}stop(){return this.state=ui,this}update(t,e){this.state!==ui&&this.state!==fi&&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=gi)):(this.nowTime=this.duration,this.state=fi):this.nowTime>=0&&(this.state=vi))}get t(){var t;switch(this.state){case ui:case pi:case gi:t=0;break;case vi:t=this.nowTime/this.duration;break;case fi:t=1}return di(t,0,1)}set t(t){(t=di(t,-1,1))<0?(this.state=pi,this.nowTime=-this.delay*t):(this.state=vi,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===ui}get isDelay(){return this.state===pi}get isCountDown(){return this.state===vi}get isRunning(){return this.state===pi||this.state===vi}get isDone(){return this.state===fi}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}}const ui=0,pi=1,vi=2,gi=3,fi=-1;class mi extends ai{constructor(t,e){super(t,e),this.timer=new ci}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 yi=Phaser.Utils.Objects.GetValue,bi=Phaser.Utils.Objects.GetAdvancedValue,Ci=Phaser.Tweens.Builders.GetEaseFunction;class xi extends mi{resetFromJSON(t){return this.timer.resetFromJSON(yi(t,"timer")),this.setEnable(yi(t,"enable",!0)),this.setTarget(yi(t,"target",this.parent)),this.setDelay(bi(t,"delay",0)),this.setDuration(bi(t,"duration",1e3)),this.setEase(yi(t,"ease","Linear")),this.setRepeat(yi(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 Si=Phaser.Utils.Objects.GetValue,_i=Phaser.Utils.Objects.GetAdvancedValue,wi=Phaser.Math.Linear;let Pi=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(Si(t,"mode",0)),this.setScaleRange(_i(t,"start",void 0),_i(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=Oi[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=wi(this.startX,this.endX,i)),this.hasScaleY&&(t.scaleY=wi(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}};const Oi={stop:0,destroy:1,yoyo:2};var Ei=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 Pi(t,a):r.resetFromJSON(a),r.restart(),r},Ti=function(t,e,i,s,r,n){void 0===s&&(s="Linear"),r instanceof Pi&&(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 Pi(t,h):n.resetFromJSON(h),n.restart(),n},ki=function(t,e){return new Promise((function(i,s){t.once(e,(function(){i()}))}))},Mi=function(t){return ki(t,"complete")};const Di=Phaser.Utils.Objects.IsPlainObject;var Ri={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(Di(t)){var s=t;t=s.duration,e=s.orientation,i=s.ease}var r=void 0===this._scaleBehavior;return this._scaleBehavior=Ei(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(Di(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=Ti(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(Di(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 Pi(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),Mi(this._scaleBehavior)},isRunningScaleYoyo(){return this._scaleBehavior&&(this._scaleBehavior.completeEventName="scaleyoyo.complete")},isRunningEaseScale(){return this.isRunningPopUp()||this.isRunningScaleDown()||this.isRunningScaleYoyo()}},Li={};Object.assign(Li,Ri),Li.onInitScale=function(){Ri.onInitScale.call(this);var t=this;this._scaleBehavior.on("update",(function(){var e=me.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const Yi=Phaser.Utils.Objects.GetValue,ji=Phaser.Utils.Objects.GetAdvancedValue,zi=Phaser.Math.Linear;class Xi extends xi{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(Yi(t,"mode",0)),this.setAlphaRange(ji(t,"start",this.parent.alpha),ji(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=Ai[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=zi(this.alphaStart,this.alphaEnd,i)}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Ai={stop:0,destroy:1,yoyo:2},Ii=Phaser.Utils.Objects.IsPlainObject;var Wi=function(t,e,i,s){var r,n;Ii(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 Xi(t,h):s.resetFromJSON(h),s.restart(),s},Fi=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 Vi=Phaser.Utils.Objects.IsPlainObject;var Bi={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=Fi(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()}},Ni={};Object.assign(Ni,Bi),Ni.onInitFade=function(){Bi.onInitFade.call(this);var t=this;this._fade.on("update",(function(){var e=me.getParentSizer(t);e&&e.resetChildAlphaState(t)}))};const Hi=Phaser.Utils.Objects.GetValue,Gi=Phaser.Utils.Objects.GetAdvancedValue,Ui=Phaser.Math.Linear;class $i extends xi{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=Gi(t,"x",void 0),i=Gi(t,"y",void 0);this.setTargetPosition(e,i)}else this.setTargetPosition(t);return this}setMode(t){return"string"==typeof t&&(t=Ji[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=Gi(i,"startX",void 0),this.startY=Gi(i,"startY",void 0),this.endX=Gi(i,"endX",void 0),this.endY=Gi(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=Ui(this.startX,this.endX,i)),this.hasMoveY&&(t.y=Ui(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Ji={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 Ki=Phaser.Utils.Objects.IsPlainObject,Zi=Phaser.Math.Distance.Between;var Qi={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(Ki(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*Zi(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 $i&&(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 $i(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),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(Ki(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*Zi(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 $i&&(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 $i(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),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}},ts={};Object.assign(ts,Qi),ts.onInitEaseMove=function(){Qi.onInitEaseMove.call(this);var t=this;this._easeMove.on("update",(function(){var e=me.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const es=Phaser.Utils.Objects.GetValue;class is extends ri{constructor(t,e){super(t,e),this.timer=new ci,this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.timer.resetFromJSON(es(t,"timer")),this.setEnable(es(t,"enable",!0)),this.setMode(es(t,"mode",1)),this.isRunning=es(t,"isRunning",!1),this.setMagnitudeMode(es(t,"magnitudeMode",1)),this.setAxisMode(es(t,"axis",0)),this.setDuration(es(t,"duration",500)),this.setMagnitude(es(t,"magnitude",10)),this.ox=es(t,"ox",void 0),this.oy=es(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=ss[t]),this.mode=t,this}setMagnitudeMode(t){return"string"==typeof t&&(t=ns[t]),this.magnitudeMode=t,this}setAxisMode(t){return"string"==typeof t&&(t=rs[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=es(i,"magnitude",void 0),t=es(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 ss={effect:0,behavior:1},rs={both:0,"h&v":0,"x&y":0,horizontal:1,h:1,x:1,vertical:2,v:2,y:2},ns={constant:0,decay:1},hs=Phaser.Utils.Objects.IsPlainObject;var as={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 is(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 os=Phaser.Utils.Objects.GetValue,ls=Phaser.Math.Linear;class ds 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=os(t,"key","value");var i=e[this.propertyKey];return this.fromValue=os(t,"from",i),this.toValue=os(t,"to",i),this.setEase(os(t,"ease",this.ease)),this.setDuration(os(t,"duration",this.duration)),this.setRepeat(os(t,"repeat",0)),this.setDelay(os(t,"delay",0)),this.setRepeatDelay(os(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]=ls(this.fromValue,this.toValue,i)}}const cs=Phaser.Utils.Objects.IsPlainObject;class us extends Qe{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 ds(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(cs(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(cs(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 ps={easeDataTo(t,e,i,s){return this._easeData||(this._easeData=new us(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),ki(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}},vs=Phaser.Utils.Array.Remove,gs={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=$e(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}},Ds={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}},Rs={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}},Ls={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}},Ys={};Object.assign(Ys,Ms,Ds,Rs,Ls);const js=Phaser.Utils.Objects.GetValue;class zs extends Qe{constructor(t,e){super(t,e),this.setTransitInTime(js(e,"duration.in",200)),this.setTransitOutTime(js(e,"duration.out",200)),this.setTransitInCallback(js(e,"transitIn")),this.setTransitOutCallback(js(e,"transitOut")),this.oneShotMode=js(e,"destroy",!1),this.delayCallTimer=void 0,this._state=new ks(this,{eventEmitter:!1,initState:js(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(zs.prototype,Ys);var Xs=function(t){if(t.parentContainer)return Xs(t.parentContainer);var e=function(t){var e=t.displayList;return U(e)?e:null}(t);return e?Xs(e):t};class As extends Qe{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=Xs(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 Is=Phaser.GameObjects.Rectangle;class Ws extends Is{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)}}const Fs=Phaser.Utils.Objects.GetValue;class Vs extends Qe{constructor(t,e){super(t,{eventEmitter:!1}),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setHitAreaMode(Fs(t,"hitAreaMode",0)),this.setEnable(Fs(t,"enable",!0)),this.setStopMode(Fs(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=Bs[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 Bs={default:0,fullWindow:1};const Ns=Phaser.Utils.Objects.GetValue;class Hs extends Ws{constructor(t,e){super(t,Ns(e,"color",0),Ns(e,"alpha",.8)),this.touchEventStop=new Vs(this,{hitAreaMode:1})}}var Gs={popUp(t,e){void 0!==t._modalScaleSave?(t.scaleX=t._modalScaleSave,t.scaleY=t._modalScaleSave):t._modalScaleSave=t.scaleX,Ei(t,e)},scaleDown(t,e){Ti(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){Fi(t,e,!1)}},Us=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Wi(t,e,t.alpha)},$s=function(t,e){Fi(t,e,!1)},Js=function(t,e,i,s,r){return!(!t||s&&!s(t,e,i)||!rt(t,!0).contains(e,i)||r&&!r(t,e,i))};const qs=Phaser.Utils.Objects.GetValue;let Ks=class extends zs{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=Zs.popUp),null==e.transitOut&&(e.transitOut=Zs.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 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(qs(i,"transitIn",Us)),this.setCoverTransitOutCallback(qs(i,"transitOut",$s)));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&&Js(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=Zs[t]),t){case Zs.popUp:t=Gs.popUp;break;case Zs.fadeIn:t=Gs.fadeIn}return super.setTransitInCallback(t),this}setTransitOutCallback(t){switch("string"==typeof t&&(t=Zs[t]),t){case Zs.scaleDown:t=Gs.scaleDown;break;case Zs.fadeOut:t=Gs.fadeOut}return super.setTransitOutCallback(t),this}setCoverTransitInCallback(t){return this.coverTransitInCallback=t,this}setCoverTransitOutCallback(t){return this.coverTransitOutCallback=t,this}};const Zs={popUp:0,fadeIn:1,scaleDown:0,fadeOut:1};var Qs=function(t){return t&&"function"==typeof t},tr={modal(t,e){return Qs(t)&&(e=t,t=void 0),void 0===this._modalBehavior&&(this.onCreateModalBehavior&&this.onCreateModalBehavior(this,t),this._modalBehavior=function(t,e){var i=new Ks(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}},er=function(t,e,i,s,r){Qs(e)&&(r=s,s=i,i=e,e=this);var n=this.scene.events;return this.bindEvent(e,n,t,i,s,r),this},ir={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 er.call(this,"preupdate",t,e,i,s),this},bindSceneUpdateEvent(t,e,i,s){return er.call(this,"update",t,e,i,s),this},bindScenePostupdateEvent(t,e,i,s){return er.call(this,"postupdate",t,e,i,s),this},bindSceneRenderEvent(t,e,i,s){return er.call(this,"render",t,e,i,s),this},bindScenePauseEvent(t,e,i,s){return er.call(this,"pause",t,e,i,s),this},bindSceneResumeEvent(t,e,i,s){return er.call(this,"resume",t,e,i,s),this},bindSceneSleepEvent(t,e,i,s){return er.call(this,"sleep",t,e,i,s),this},bindSceneWakeEvent(t,e,i,s){return er.call(this,"wake",t,e,i,s),this},bindSceneShutdownEvent(t,e,i,s){return er.call(this,"shutdown",t,e,i,s),this}},sr=function(t,e,i){var s=t.camera;return s?(void 0===i?i={}:!0===i&&(i=rr),s===e?(i.x=t.worldX,i.y=t.worldY):s.getWorldPoint(t.x,t.y,i),i):null},rr={},nr=function(t,e,i,s){var r,n=t.scene.sys.cameras.main,h=0===t.scrollFactorX&&0===t.scrollFactorY;if(e)return h?Js(t,e.x,e.y,i,s):!!(r=sr(e,n,!0))&&Js(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 fr={press:0,pointerdown:0,release:1,pointerup:1};var mr={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 gr(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}},yr=function(t,e,i,s,r){if(e)return!(i&&!i(t,e)||!br(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 xr=Phaser.Utils.Objects.GetValue;class Sr extends Qe{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?yr:nr)(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 wr={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 Sr(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 Pr extends Ts{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 Or=Phaser.Utils.Objects.GetValue;class Er extends Qe{constructor(t,e){super(t,e),this._enable=void 0,this.cooldown=new Pr,this.parent.setInteractive(Or(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.prevIsInTouch=!1,this.isInTouching=!1,this.setEnable(Or(t,"enable",!0)),this.setCooldown(Or(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 Tr={isPointerInBounds(t){return void 0===t?t=this:"string"==typeof t&&(t=this.getElement(t)),!!t&&nr(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 Er(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 Er(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}},kr={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,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=Gr,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===Ur&&this.onDragEnd(),this.pointer=void 0,this.tracerState=Gr,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=$r,this}isPointerInGameObject(t,e,i){var s=this.lastPointer;return!!s&&nr(t,s,e,i)}}const Gr=0,Ur=1,$r="IDLE",Jr=Phaser.Utils.Objects.GetValue,qr=Phaser.Math.Distance.Between;class Kr 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=Zr},eventEmitter:!1};this.setRecongizedStateObject(new Ts(s))}resetFromJSON(t){super.resetFromJSON(t),this.setHoldTime(Jr(t,"time",250)),this.setTapInterval(Jr(t,"tapInterval",200)),this.setDragThreshold(Jr(t,"threshold",9)),this.setTapOffset(Jr(t,"tapOffset",10));var e=Jr(t,"taps",void 0);return void 0!==e?this.setTaps(e):(this.setMaxTaps(Jr(t,"maxTaps",void 0)),this.setMinTaps(Jr(t,"minTaps",void 0))),this}onDragStart(){switch(this.state){case Zr:this.state=Qr;break;case Qr:var t=this.lastPointer;qr(t.upX,t.upY,t.x,t.y)>this.tapOffset&&(this.state=tn,this.state=Qr);break;case tn:this.state=Qr}}onDragEnd(){this.state===Qr&&(this.tapsCount++,this.emit("tapping",this,this.gameObject,this.lastPointer),void 0!==this.maxTaps&&this.tapsCount===this.maxTaps&&(this.state=tn))}onDrag(){this.state!==Zr&&this.pointer.getDistance()>this.dragThreshold&&(this.state=Zr)}preUpdate(t,e){if(this.isRunning&&this.enable&&this.state===Qr){var i=this.lastPointer;i.isDown?t-i.downTime>this.holdTime&&(this.state=Zr):t-i.upTime>this.tapInterval&&(void 0===this.minTaps||this.tapsCount>=this.minTaps?this.state=tn:this.state=Zr)}}postUpdate(t,e){this.isRunning&&this.enable&&this.state===tn&&(this.state=Zr)}get isTapped(){return this.state===tn}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 Zr="IDLE",Qr="BEGIN",tn="RECOGNIZED",en=Phaser.Utils.Objects.GetValue;class sn 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=rn},eventEmitter:!1};this.setRecongizedStateObject(new Ts(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(en(t,"threshold",9)),this.setHoldTime(en(t,"time",251)),this}onDragStart(){this.state=nn,0===this.holdTime&&(this.state=hn)}onDragEnd(){this.state=rn}onDrag(){this.state!==rn&&this.pointer.getDistance()>this.dragThreshold&&(this.state=rn)}preUpdate(t,e){this.isRunning&&this.enable&&this.state===nn&&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 rn="IDLE",nn="BEGIN",hn="RECOGNIZED";Phaser.Utils.Objects.GetValue;var an=function(t){return Ke(t).loop.delta};const on=Phaser.Math.Distance.Between,ln=Phaser.Math.Angle.Between;var dn={getDt:function(){return an(this.scene)},getVelocity:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return on(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 ln(e.x,e.y,t.x,t.y)}},cn={"up&down":0,"left&right":1,"4dir":2,"8dir":3},un={};const pn=Phaser.Utils.Objects.GetValue,vn=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=fn},eventEmitter:!1};this.setRecongizedStateObject(new Ts(s)),this.clearDirectionStates()}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(pn(t,"threshold",10)),this.setVelocityThreshold(pn(t,"velocityThreshold",1e3)),this.setDirectionMode(pn(t,"dir","8dir")),this}onDragStart(){this.state=mn}onDragEnd(){this.state=fn}onDrag(){this.state===mn&&(this.validDrag||(this.validDrag=0===this.dragThreshold||this.pointer.getDistance()>=this.dragThreshold),this.validDrag&&this.dragVelocity>this.velocityThreshold&&(this.state=yn))}postUpdate(t,e){this.isRunning&&this.enable&&this.state===yn&&(this.state=fn)}get isSwiped(){return this.state===yn}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=un),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}}(vn(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,dn);const fn="IDLE",mn="BEGIN",yn="RECOGNIZED",bn=Phaser.Utils.Objects.GetValue,Cn=Phaser.Utils.Array.SpliceOne,xn=Phaser.Math.Distance.Between,Sn=Phaser.Math.Angle.Between;class _n{constructor(t,e){var i=$e(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(bn(e,"inputConfig",void 0)),this.setEventEmitter(bn(e,"eventEmitter",void 0)),this._enable=void 0,this.pointers=[],this.movedState={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setEnable(bn(t,"enable",!0)),this.bounds=bn(t,"bounds",void 0),this.tracerState=Pn,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 Pn:this.tracerState=On,this.onDrag1Start();break;case On:this.tracerState=En,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 On:this.tracerState=Pn,this.onDrag1End();break;case En:this.tracerState=On,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 On:this.onDrag1();break;case En:this.onDrag2()}}}dragCancel(){return this.tracerState===En&&this.onDrag2End(),this.pointers.length=0,gt(this.movedState),this.tracerState=Pn,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!==En)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!==En)return 0;var t=this.pointers[0],e=this.pointers[1];return Sn(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;wn.x=e.x-i.x,wn.y=e.y-i.y}else wn.x=0,wn.y=0;return wn}get centerX(){if(this.tracerState!==En)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.x+e.x)/2}get centerY(){if(this.tracerState!==En)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.y+e.y)/2}get prevCenterX(){if(this.tracerState!==En)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!==En)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=Tn,this}isPointer0InGameObject(t,e,i){var s=this.pointers[0];return!!s&&nr(t,s,e,i)}isPointer1InGameObject(t,e,i){var s=this.pointers[1];return!!s&&nr(t,s,e,i)}}Object.assign(_n.prototype,He);var wn={};const Pn=0,On=1,En=2,Tn="IDLE";Phaser.Utils.Objects.GetValue;const kn=Phaser.Math.RotateAround;var Mn=function(t,e,i,s){return kn(t,e,i,s),t.rotation+=s,t},Dn={};const Rn=Phaser.Utils.Objects.GetValue,Ln=Phaser.Math.Angle.WrapDegrees,Yn=Phaser.Math.Angle.ShortestBetween,jn=Phaser.Math.RadToDeg,zn=Phaser.Math.DegToRad;var Xn={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=Dn),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=Ln(jn(this.angleBetween));this.angle=Yn(this.prevAngle,t),this.prevAngle=t,this.state=Wn}break;case Wn:t=Ln(jn(this.angleBetween)),this.angle=Yn(this.prevAngle,t),this.prevAngle=t,this.emit("rotate",this)}}get isRotated(){return this.state===Wn}get rotation(){return zn(this.angle)}setDragThreshold(t){return this.dragThreshold=t,this}}.prototype,Xn);const An="IDLE",In="BEGIN",Wn="RECOGNIZED",Fn=Phaser.Utils.Objects.GetValue;var Vn=function(t){var e=Fn(t,"tap",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._tap=new Kr(this,e),this._tap.on("tap",(function(t,e,s){Dr(i.eventEmitter,`${i.eventNamePrefix}${t.tapsCount}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Bn=Phaser.Utils.Objects.GetValue;var Nn=function(t){var e=Bn(t,"press",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._press=new sn(this,e),this._press.on("pressstart",(function(t,e,s){Dr(i.eventEmitter,`${i.eventNamePrefix}pressstart`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this).on("pressend",(function(t,e,s){Dr(i.eventEmitter,`${i.eventNamePrefix}pressend`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Hn=Phaser.Utils.Objects.GetValue;var Gn=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 gn(this,e),this._swipe.on("swipe",(function(t,e,s){var r=t.left?"left":t.right?"right":t.up?"up":"down";Dr(i.eventEmitter,`${i.eventNamePrefix}swipe${r}`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Un=Phaser.Utils.Objects.GetValue;var $n=function(t,e){return t.setInteractive(),Un(e,"dropZone",!1)&&(t.input.dropZone=!0),t._childrenInteractive={targetSizers:Un(e,"targets",[t]),targetMode:Un(e,"targetMode","parent"),eventEmitter:Un(e,"eventEmitter",t),eventNamePrefix:Un(e,"inputEventPrefix","child.")},Lr.call(t,e),zr.call(t,e),Ir.call(t,e),Br.call(t,e),Vn.call(t,e),Nn.call(t,e),Gn.call(t,e),t},Jn={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,h,a=t.scene;if("number"==typeof e)i=e;else{i=ae(e,"color"),s=ae(e,"lineWidth");var o=ae(e,"name",!1);o&&(r=ae(o,"createTextCallback",le),n=ae(o,"createTextCallbackScope",void 0),"string"==typeof(h=ae(o,"align","left-top"))&&(h=jt[h]))}if(void 0===i&&(i=16777215),void 0===s&&(s=1),r&&!t.children){t.children=new oe(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)}}for(var d,c,u=this.getAllShownChildren([this]),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 rh=Phaser.Utils.Objects.IsPlainObject,nh=Phaser.Utils.Objects.GetValue,hh=Phaser.Display.Align.CENTER,ah={min:0,full:-1};var oh=function(t,e,i,s,r,n,h,a,o,l){ve.call(this,t);var d=t.isRexSpace,c=typeof e;if(null===e)return this;if("number"===c);else if("string"===c)e=ah[e];else if(rh(e)){var u;e=nh(u=e,"proportion",void 0),i=nh(u,"align",hh),s=nh(u,"padding",0),r=nh(u,"expand",!1),n=nh(u,"key",void 0),h=nh(u,"index",void 0),t.isRexSizer||(a=nh(u,"minWidth",void 0),o=nh(u,"minHeight",void 0)),l=nh(u,"fitRatio",0)}return"string"==typeof i&&(i=jt[i]),void 0===e&&(e=d?1:0),void 0===i&&(i=hh),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===a&&(d?a=0:t.isRexSizer||(a=t._minWidth)),void 0===o&&(d?o=0:t.isRexSizer||(o=t._minHeight)),void 0===l||!1===l?l=0:!0===l&&(l=Q(t)/tt(t)),(u=this.getSizerConfig(t)).proportion=e,u.align=i,u.padding=ue(s),u.expand=r,u.fitRatio=0===e?l:0,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},lh={add:oh,addSpace(t){return this.insertSpace(void 0,t),this},insertSpace(t,e){return void 0===e&&(e=1),oh.call(this,new ih(this.scene),{proportion:e,minWidth:0,minHeight:0,index:t}),this},insert(t,e,i,s,r,n,h,a){return rh(i)&&(i.index=t),oh.call(this,e,i,s,r,n,h,t,a),this},insertAtPosition(t,e,i,s,r,n,h,a,o){var l=sh.call(this,t,e);return-1===l&&(l=void 0),this.insert(l,i,s,r,n,h,a,o),this}};const dh=Tt.prototype.clear;var ch=function(t){this.backgroundChildren&&(this.backgroundChildren.length=0);var e,i=!t&&this.sizerEventsEnable;if(i&&(e=this.getChildren([])),dh.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}},vh={getChildAlign(t){return this.getSizerConfig(t).align},setChildAlign(t,e){return"string"==typeof e&&(e=jt[e]),this.getSizerConfig(t).align=e,this}},gh={getChildProportion(t){return this.getSizerConfig(t).proportion},setChildProportion(t,e){return this.getSizerConfig(t).proportion=e,this}},fh={getChildExpand(t){return this.getSizerConfig(t).expand},setChildExpand(t,e){return this.getSizerConfig(t).expand=e,this}},mh={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}},yh={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&&(Fe(t,0,0),e.resolved=!1,this.hasRatioFitChild=!0);return this._childrenProportion=void 0,this.hasProportion0Child=!1,this.proportionLength=void 0,Ae.call(this),this},layoutChildren:function(){for(var t,e,i,s,r,n,h,a,o,l,d=this.sizerChildren,c=this.innerLeft,u=this.innerTop,p=this.innerWidth,v=this.innerHeight,g=c,f=u,m=this.startChildIndex,y=0,b=d.length;y0?(e=t-this.getChildrenWidth(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},resolveHeight:function(t){if(void 0!==(t=Ye.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)||Re.call(this)},runWidthWrap:function(t){this.wrapResult||(1===this.orientation&&th.call(this,t,void 0),Le.call(this,t))},hasHeightWrap:function(){return!(!this.hasRatioFitChild||0!==this.orientation)||je.call(this)},runHeightWrap:function(t){this.wrapResult||(0===this.orientation&&th.call(this,void 0,t),ze.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(yh,lh,ph,vh,gh,fh,mh);var bh=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 xh=Phaser.Utils.Objects.IsPlainObject,Sh=Phaser.Utils.Objects.GetValue;class _h extends Kn{constructor(t,e,i,s,r,n,h){xh(e)?(e=Sh(h=e,"x",0),i=Sh(h,"y",0),s=Sh(h,"width",void 0),r=Sh(h,"height",void 0),n=Sh(h,"orientation",0)):xh(s)?(s=Sh(h=s,"width",void 0),r=Sh(h,"height",void 0),n=Sh(h,"orientation",0)):xh(n)&&(n=Sh(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(Sh(h,"space.item",0)),this.setStartChildIndex(Sh(h,"startChildIndex",0)),this.setRTL(Sh(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=bh.call(this)),this._childrenProportion}}Object.assign(_h.prototype,yh);var wh={v:0,vertical:0,y:0,h:1,horizontal:1,x:1,xy:2,vh:2},Ph=function(t){var e=!!t.sliderY||!!t.scrollerY,i=!!t.sliderX||!!t.scrollerX;return e&&i?2:e?0:i?1:0},Oh=function(){return Array.prototype.reduce.call(arguments,Eh,0)},Eh=function(t,e){return t+e};const Th=Phaser.Utils.Objects.IsPlainObject,kh=Phaser.Utils.Objects.GetValue,Mh=Phaser.Display.Align.CENTER;var Dh=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 Lh(this.sizerChildren,null),ch.call(this,t),this}},jh={setColumnSpace(t){if(this.space.column||(this.space.column=[]),this.space.column.length=this.columnCount-1,"number"==typeof t)Lh(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},Ih={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=Ye.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===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,Lh(this.sizerChildren,null),this.columnProportions=[],this.columnProportions.length=t,"number"==typeof i)Lh(this.columnProportions,i);else for(var n=0;n0?e+=t:0===t&&(this.hasColumnProportion0Child=!0);return e},Fh=function(){for(var t,e=0,i=0;i0?e+=t:0===t&&(this.hasRowProportion0Child=!0);return e};const Vh=Phaser.Utils.Objects.IsPlainObject,Bh=Phaser.Utils.Objects.GetValue;class Nh extends Kn{constructor(t,e,i,s,r,n,h,a,o,l){Vh(e)?(e=Bh(l=e,"x",0),i=Bh(l,"y",0),s=Bh(l,"width",void 0),r=Bh(l,"height",void 0),n=Bh(l,"column",l.col||0),h=Bh(l,"row",0),a=Bh(l,"columnProportions",0),o=Bh(l,"rowProportions",0)):Vh(s)?(s=Bh(l=s,"width",void 0),r=Bh(l,"height",void 0),n=Bh(l,"column",l.col||0),h=Bh(l,"row",0),a=Bh(l,"columnProportions",0),o=Bh(l,"rowProportions",0)):Vh(n)?(n=Bh(l=n,"column",l.col||0),h=Bh(l,"row",0),a=Bh(l,"columnProportions",0),o=Bh(l,"rowProportions",0)):Vh(a)&&(a=Bh(l=a,"columnProportions",0),o=Bh(l,"rowProportions",0)),super(t,e,i,s,r,l),this.type="rexGridSizer",this.sizerChildren=[],this.addChildrenMap("items",this.sizerChildren),this.setCreateCellContainerCallback(Bh(l,"createCellContainerCallback")),this.setIndentLeft(Bh(l,"space.indentLeftOdd",0),Bh(l,"space.indentLeftEven",0)),this.setIndentTop(Bh(l,"space.indentTopOdd",0),Bh(l,"space.indentTopEven",0)),this.resetGrid(n,h,a,o,Bh(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=Wh.call(this)),this._totalColumnProportions}get totalRowProportions(){return void 0===this._totalRowProportions&&(this._totalRowProportions=Fh.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(Nh.prototype,Ih);const Hh=Phaser.Utils.Objects.GetValue;var Gh=Phaser.Renderer.WebGL.Utils,Uh=function(t,e,i,s,r,n){for(var h=Gh.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+")"},Zh=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 Qh=Phaser.Renderer.Canvas.SetTransform;var ta={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&&Uh(r,h,e,l,a,o),e.isStroked&&Jh(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(Qh(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(ia.prototype,ta);const sa=Phaser.Utils.Objects.GetValue;let ra=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=sa(t,"x",0),i=sa(t,"y",0));var s=this.cornerRadius;s.tl=na(sa(t,"tl",void 0),e,i),s.tr=na(sa(t,"tr",void 0),e,i),s.bl=na(sa(t,"bl",void 0),e,i),s.br=na(sa(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 na=function(t,e,i){return void 0===t?t={x:e,y:i}:"number"==typeof t&&(t={x:t,y:t}),aa(t),t},ha=function(t,e){"number"==typeof e?(t.x=e,t.y=e):(t.x=sa(e,"x",0),t.y=sa(e,"y",0)),aa(t)},aa=function(t){t.convex=t.x>=0||t.y>=0,t.x=Math.abs(t.x),t.y=Math.abs(t.y)},oa=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 la=Phaser.Math.DegToRad;var da=function(t,e,i,s,r,n,h,a,o){h&&n>r?n-=360:!h&&n0&&t.y>0};const fa={rectangle:0,circle:1};var ma=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};const ya=Phaser.Utils.Objects.GetValue;class ba extends Qe{constructor(t,e){super(t,e),this.style=ya(e,"style",this);var i=ya(e,"propertiesMap");this.activeStyle=Ca(e,"active",i),this.hoverStyle=Ca(e,"hover",i),this.disableStyle=Ca(e,"disable",i),this.onModifyStyle=ya(e,"onModifyStyle")}getStyle(t){return function(t,e,i){if(void 0===i&&(i={}),Array.isArray(e))for(var s=0,r=e.length;s0,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};const po=Phaser.Utils.Objects.GetValue,vo=Phaser.Utils.Objects.IsPlainObject;class go extends(Aa(Ma)){constructor(t,e,i,s,r,n,h,a){vo(e)?(e=po(a=e,"x",0),i=po(a,"y",0),s=po(a,"width",2),r=po(a,"height",2),n=po(a,"barColor",void 0),h=po(a,"value",0)):vo(s)?(s=po(a=s,"width",2),r=po(a,"height",2),n=po(a,"barColor",void 0),h=po(a,"value",0)):vo(n)&&(n=po(a=n,"barColor",void 0),h=po(a,"value",0)),super(t,e,i,s,r,a),this.type="rexLineProgress",this.bootProgressBase(a),this.addShape((new co).setName("trackFill")).addShape((new co).setName("bar")).addShape((new co).setName("trackStroke")),this.setTrackColor(po(a,"trackColor",void 0)),this.setBarColor(n),this.setTrackStroke(po(a,"trackStrokeThickness",2),po(a,"trackStrokeColor",void 0)),this.setSkewX(po(a,"skewX",0)),this.setRTL(po(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 fo={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&&uo(s,0,0,e,i,t).close();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),uo(h,r,0,n,i,t).close());var a=this.getShape("trackStroke");a.lineStyle(this.trackStrokeThickness,this.trackStrokeColor),a.isStroked&&uo(a,0,0,e,i,t).end()}};Object.assign(go.prototype,fo);var mo=function(t){return null==t||""===t||0===t.length},yo=function(t,e,i,s){if(void 0===s&&(s="."),"object"==typeof t){if(mo(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(mo(e));else{var r;"string"==typeof e&&(e=e.split("."));for(var n=0,h=e.length;nzo(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]=zo(t[i]));return e}const Xo=Phaser.Utils.Objects.IsPlainObject,Ao=Phaser.Utils.Objects.GetValue;var Io=function(t){return"string"==typeof t&&(t=Wo[t]),t};const Wo={scale:0,repeat:1};var Fo=function(t,e){return 0===t||t===this.columns.count-1||0===e||e===this.rows.count-1},Vo={_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=zo(i),s=zo(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 _=i.length;o<_;o++){if(void 0===i[o]&&(i[o]=d),"number"==typeof i[o]&&(i[o]={width:i[o],stretch:o%2}),f=(v=i[o]).width,0===x&&(this.columns.stretch+=0|v.stretch,this.columns.minWidth+=v.stretch>0?0:f),f>=1&&g>=1){var w=typeof(m=this.getFrameNameCallback(o,x,e));"string"!==w&&"number"!==w||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 Xo(t)?(this.stretchMode.edge=Io(Ao(t,"edge",0)),this.stretchMode.internal=Io(Ao(t,"internal",0))):(t=Io(t),this.stretchMode.edge=t,this.stretchMode.internal=t),this},getStretchMode:function(t,e){return Fo.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 Bo=Phaser.Utils.Objects.IsPlainObject,No=Phaser.Utils.Objects.GetValue,Ho=Phaser.GameObjects;var Go=void 0,Uo=function(t,e){if(Go||(Go={},Ke(t).events.once("destroy",(function(){for(var t in Go)Go[t].destroy();Go=void 0}))),!Go.hasOwnProperty(e)){var i=Ke(t).scene.systemScene;(t=new Ho[e](i)).setOrigin(0),Go[e]=t}return Go[e]};const $o=Phaser.GameObjects.RenderTexture;class Jo extends(function(t,e){class i extends t{constructor(t,i,s,r,n,h,a,o,l,d){if(Bo(i)?(i=No(d=i,"x",0),s=No(d,"y",0),r=No(d,"width",1),n=No(d,"height",1),h=No(d,"key",void 0),a=No(d,"baseFrame",void 0),o=No(d,"columns",void 0),l=No(d,"rows",void 0)):Bo(r)?(r=No(d=r,"width",1),n=No(d,"height",1),h=No(d,"key",void 0),a=No(d,"baseFrame",void 0),o=No(d,"columns",void 0),l=No(d,"rows",void 0)):Bo(h)?(h=No(d=h,"key",void 0),a=No(d,"baseFrame",void 0),o=No(d,"columns",void 0),l=No(d,"rows",void 0)):Bo(a)?(a=No(d=a,"baseFrame",void 0),o=No(d,"columns",void 0),l=No(d,"rows",void 0)):Array.isArray(a)?(d=l,l=o,o=a,a=No(d,"baseFrame",void 0)):Bo(o)&&(o=No(d=o,"columns",void 0),l=No(d,"rows",void 0)),void 0===a&&(a=No(d,"frame",void 0)),void 0===o){var c=No(d,"leftWidth",void 0),u=No(d,"rightWidth",void 0);void 0!==c&&void 0!==u&&(o=[c,void 0,u])}if(void 0===l){var p=No(d,"topHeight",void 0),v=No(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(No(d,"getFrameNameCallback",void 0)),this.setStretchMode(No(d,"stretchMode",0)),this.setPreserveRatio(No(d,"preserveRatio",!0));var g=No(d,"maxFixedPartScale",1),f=No(d,"maxFixedPartScaleX",g),m=No(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,Vo),i}($o,"rexNinePatch")){}var qo={_drawImage:function(t,e,i,s,r,n){var h=Uo(this,"Image").setTexture(t,e).setDisplaySize(r,n);this.draw(h,i,s)},_drawTileSprite:function(t,e,i,s,r,n){var h=Uo(this,"TileSprite").setTexture(t,e).setSize(r,n);this.draw(h,i,s)}};Object.assign(Jo.prototype,qo);class Ko extends Qe{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 Zo=Phaser.Utils.Objects.GetValue;class Qo extends Jo{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexStatesNinePatch";var i=Zo(e,"effects",!0);i&&Oo(this,i),this.style=new Ko(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign(Qo.prototype,Sa);const tl=["alpha","tint","flipX","flipY"];var el=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 bo(t,e);break;case"image":s=new Yo(t,e);break;case"nineSlice":s=e.hasOwnProperty("stretchMode")?new Qo(t,e):new Mo(t,e);break;default:s=new _a(t,e)}return function(t,e){if(!e)return t;for(var i=0,s=tl.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 Rl=Phaser.Utils.Objects.GetValue,Ll=Phaser.Math.Distance.Between;class Yl extends Qe{constructor(t,e){super(t,e),this._enable=void 0,this.rectBoundsInteractive=Rl(e,"rectBoundsInteractive",!1),this.rectBoundsInteractive||t.setInteractive(Rl(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(Rl(t,"enable",!0)),this.holdThreshold=Rl(t,"holdThreshold",50),this.pointerOutReleaseEnable=Rl(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 an(this.scene)}get speed(){return this.x===this.preX&&this.y===this.preY?0:Ll(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&&!nr(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&&!nr(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 zl{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 Xl{constructor(){this.value,this.dir,this.movement=new zl}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 Fl={y:0,v:0,vertical:0,x:1,h:1,horizontal:1},Vl=Phaser.Utils.Objects.GetValue;class Bl extends Qe{constructor(t,e){switch(super(t,e),this.parent!==this.scene?this.focusMode=Vl(e,"focus",!0):this.focusMode=!1,"boolean"==typeof this.focusMode&&(this.focusMode=this.focusMode?1:0),this.setSpeed(Vl(e,"speed",.1)),this.setEnable(Vl(e,"enable",!0)),this.focusMode){case 0:case 2:this.scene.input.on("wheel",this.onSceneScroll,this);break;default:t.setInteractive(Vl(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||nr(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 Nl=Phaser.Utils.Objects.GetValue;var Hl=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)?Nl(s,l,void 0):Nl(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=ft(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 Ml(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);var p=Nl(r,"position",0);"string"==typeof p&&(p=Gl[p]);var v,g,f=Nl(s,`space.slider${i}`,void 0);void 0===f&&void 0===(f=Nl(s,"space.slider",void 0))&&(a?f=0:v=Nl(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:Nl(v,"right",v)}):(d=0,c=1,u=void 0===v?g?{right:f}:f:{right:Nl(v,"left",v)}):0===p?(d=1,c=2,u=void 0===v?g?{top:f}:f:{top:Nl(v,"bottom",v)}):(d=1,c=0,u=void 0===v?g?{bottom:f}:f:{bottom:Nl(v,"top",v)}),e.add(n,{column:d,row:c,align:"center",padding:u,expand:!0}),t[`hideUnscrollableSlider${i}`]=Nl(r,"hideUnscrollableSlider",!1),t[`adaptThumb${i}SizeMode`]=Nl(r,"adaptThumbSize",!1),t[`minThumb${i}Size`]=Nl(r,"minThumbSize",void 0)}else t[`hideUnscrollableSlider${i}`]=!1,t[`adaptThumb${i}SizeMode`]=!1,t[`minThumb${i}Size`]=void 0;var m,y,b=Nl(s,"scrollDetectionMode");"string"==typeof b&&(b=Ul[b]);var C=`scroller${i}`;(m=a||s.hasOwnProperty(C)?Nl(s,C,!0):Nl(s,"scroller",!0))&&o&&(!0===m&&(m={}),m.orientation=h?0:1,void 0!==b&&(m.rectBoundsInteractive=1===b),y=new Wl(o,m),o.isRexContainerLite&&o.sendChildToBack(o));var x,S,_,w,P,O=Nl(s,a?`mouseWheelScroller${i}`:"mouseWheelScroller",!1);O&&o&&(void 0!==b&&(O.focus=1===b?2:0),x=new Bl(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.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",w=`scroll${i}`):(S="t",w="scroll"),n.on("valuechange",(function(e){t[S]=e,t.emit(w,t)}))),y&&(a?(_=`childO${i}`,w=`scroll${i}`):(_="childOY",w="scroll"),y.on("valuechange",(function(e){t[_]=e,t.emit(w,t)}))),x&&(P=a?`addChildO${i}`:"addChildOY",x.on("scroll",(function(e){t[P](-e,!0)})))};const Gl={right:0,left:1,bottom:0,top:1},Ul={gameObject:0,rectBounds:1},$l=Phaser.Utils.Objects.GetValue;var Jl=function(t,e){var i=t.scene,s=[0,1,0],r=[0,1,0],n=$l(e,"width"),h=$l(e,"height");n||$l(e,"child.expandWidth",!0)||(s[1]=0),h||$l(e,"child.expandHeight",!0)||(r[1]=0);var a=new Nh(i,{column:3,row:3,columnProportions:s,rowProportions:r});switch(function(t,e,i){var s=Hh(i,"child"),r=Hh(s,"gameObject",void 0);if(r){var n=Hh(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=Hh(n,"top",0),h.bottom=Hh(n,"bottom",0),a.left=Hh(n,"left",0),a.right=Hh(n,"right",0);break;case 1:h.top=Hh(n,"left",0),h.bottom=Hh(n,"right",0),a.top=Hh(n,"top",0),a.bottom=Hh(n,"bottom",0);break;default:h.top=Hh(n,"top",0),h.bottom=Hh(n,"bottom",0),h.left=Hh(n,"left",0),h.right=Hh(n,"right",0)}e.add(r,{column:1,row:1,align:Hh(s,"align","center"),padding:a,expand:{width:Hh(s,"expandWidth",!0),height:Hh(s,"expandHeight",!0)}})}t.addChildrenMap("child",r)}(t,a,e),t.scrollMode){case 0:Hl(t,a,"y",e);break;case 1:Hl(t,a,"x",e);break;default:Hl(t,a,"y",e),Hl(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}`]}if(s){var n="Y"===t?this.scaleY:this.scaleX;s.setBounds(e,i*n)}r&&r.setEnable(e!==i)},Kl=function(t){switch(this.scrollMode){case 0:case 1:(e=this.childrenMap.slider)&&this.hideUnscrollableSlider&&this.setChildVisible(e,this.isOverflow);break;default:t=t.toUpperCase();var e=this.childrenMap[`slider${t}`],i=this[`hideUnscrollableSlider${t}`],s=this[`isOverflow${t}`];e&&i&&this.setChildVisible(e,s)}},Zl=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(ud.call(this,-this.textOY)),0),e=pd.call(this,t)+this.textOY,i=vd.call(this,t);return function(t,e){switch(hd(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,gd.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,Ae.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,md.call(this,t,n,h),he(t,s,r,n,h,e.align),e.preOffsetY=0,gd.call(this),this.textMask&&(this.textMask.setPosition().resize(),this.resetChildPositionState(this.textMask)))}};const bd=Phaser.Utils.Objects.IsPlainObject,Cd=Phaser.Utils.Objects.GetValue,xd=Phaser.Display.Align.TOP_LEFT;class Sd extends Kn{constructor(t,e,i,s,r,n){bd(e)?(e=Cd(n=e,"x",0),i=Cd(n,"y",0),s=Cd(n,"width",void 0),r=Cd(n,"height",void 0)):bd(s)&&(s=Cd(n=s,"width",void 0),r=Cd(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=Cd(n,"content",""),this._textOY=0,this.execeedTopState=!1,this.execeedBottomState=!1,this.setClampMode(Cd(n,"clampTextOY",!0)),this.alwaysScrollable=Cd(n,"alwaysScrollable",!1);var h=Cd(n,"background",void 0),a=Cd(n,"text",void 0);void 0===a&&(a=_d(t)),this.textCropEnable=Cd(n,"textCrop",!!a.setCrop);var o=Cd(n,"textMask",!this.textCropEnable);h&&this.addBackground(h),this.add(a),this.sizerChildren=[a];var l=this.getSizerConfig(a);l.align=xd,l.padding=ue(0),l.expand=!0,this.textObject=a,this.textObjectType=hd(a),l.preOffsetY=0,l.offsetY=0,o&&(this.textMask=cd.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(ud.call(this,this._textObjectRealHeight))),this._visibleLinesCount}get topTextOY(){return 0}get bottomTextOY(){return-this.textVisibleHeight}get textHeight(){return void 0===this._textHeight&&(this._textHeight=pd.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 _d=function(t){return t.add.text(0,0,"")};Object.assign(Sd.prototype,yd);var wd={setText(t){return this.childrenMap.child.setText(t),this.resizeController(),this},appendText(t){return this.setText(this.text+t),this}},Pd={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 Od=Phaser.Utils.Objects.GetValue;class Ed extends id{constructor(t,e){void 0===e&&(e={});var i=Od(e,"text",void 0),s=Od(e,"textWidth",void 0),r=Od(e,"textHeight",void 0),n=Od(e,"textCrop",!!i.setCrop),h=Od(e,"textMask",!n),a=Od(e,"content",""),o=new Sd(t,{width:s,height:r,text:i,textMask:h,textCrop:n&&!h,content:a,clampTextOY:Od(e,"clampChildOY",!1),alwaysScrollable:Od(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=Od(e,"space",void 0);l&&(l.child=Od(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(Ed.prototype,wd,Pd),Ed},"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=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},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=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},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}},Pe=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 Oe=/(\S+)\[(\d+)\]/i,Ee=Phaser.Utils.Objects.GetValue;var Te=function(t,e){return void 0===e?t:t[e]},ke=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=Ee(e,"left",0),t.right=Ee(e,"right",0),t.top=Ee(e,"top",0),t.bottom=Ee(e,"bottom",0)),t},Me={getInnerPadding(t){return Te(this.space,t)},setInnerPadding(t,e){return ke(this.space,t,e),this},getOuterPadding(t){return Te(this.getSizerConfig(this).padding,t)},setOuterPadding(t,e){return ke(this.getSizerConfig(this).padding,t,e),this},getChildOuterPadding(t,e){return"string"==typeof t&&(t=this.getElement(t)),Te(this.getSizerConfig(t).padding,e)},setChildOuterPadding(t,e,i){return"string"==typeof t&&(t=this.getElement(t)),ke(this.getSizerConfig(t).padding,e,i),this}},De=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}},Re=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},Le=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},Ye=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}},je=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},ze=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}},Ae=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?vi:pi,this.repeatCounter=0,this}stop(){return this.state=ui,this}update(t,e){this.state!==ui&&this.state!==fi&&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=gi)):(this.nowTime=this.duration,this.state=fi):this.nowTime>=0&&(this.state=vi))}get t(){var t;switch(this.state){case ui:case pi:case gi:t=0;break;case vi:t=this.nowTime/this.duration;break;case fi:t=1}return di(t,0,1)}set t(t){(t=di(t,-1,1))<0?(this.state=pi,this.nowTime=-this.delay*t):(this.state=vi,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===ui}get isDelay(){return this.state===pi}get isCountDown(){return this.state===vi}get isRunning(){return this.state===pi||this.state===vi}get isDone(){return this.state===fi}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}}const ui=0,pi=1,vi=2,gi=3,fi=-1;class mi extends ai{constructor(t,e){super(t,e),this.timer=new ci}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 yi=Phaser.Utils.Objects.GetValue,bi=Phaser.Utils.Objects.GetAdvancedValue,Ci=Phaser.Tweens.Builders.GetEaseFunction;class xi extends mi{resetFromJSON(t){return this.timer.resetFromJSON(yi(t,"timer")),this.setEnable(yi(t,"enable",!0)),this.setTarget(yi(t,"target",this.parent)),this.setDelay(bi(t,"delay",0)),this.setDuration(bi(t,"duration",1e3)),this.setEase(yi(t,"ease","Linear")),this.setRepeat(yi(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 Si=Phaser.Utils.Objects.GetValue,_i=Phaser.Utils.Objects.GetAdvancedValue,wi=Phaser.Math.Linear;let Pi=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(Si(t,"mode",0)),this.setScaleRange(_i(t,"start",void 0),_i(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=Oi[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=wi(this.startX,this.endX,i)),this.hasScaleY&&(t.scaleY=wi(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}};const Oi={stop:0,destroy:1,yoyo:2};var Ei=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 Pi(t,a):r.resetFromJSON(a),r.restart(),r},Ti=function(t,e,i,s,r,n){void 0===s&&(s="Linear"),r instanceof Pi&&(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 Pi(t,h):n.resetFromJSON(h),n.restart(),n},ki=function(t,e){return new Promise((function(i,s){t.once(e,(function(){i()}))}))},Mi=function(t){return ki(t,"complete")};const Di=Phaser.Utils.Objects.IsPlainObject;var Ri={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(Di(t)){var s=t;t=s.duration,e=s.orientation,i=s.ease}var r=void 0===this._scaleBehavior;return this._scaleBehavior=Ei(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(Di(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=Ti(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(Di(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 Pi(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),Mi(this._scaleBehavior)},isRunningScaleYoyo(){return this._scaleBehavior&&(this._scaleBehavior.completeEventName="scaleyoyo.complete")},isRunningEaseScale(){return this.isRunningPopUp()||this.isRunningScaleDown()||this.isRunningScaleYoyo()}},Li={};Object.assign(Li,Ri),Li.onInitScale=function(){Ri.onInitScale.call(this);var t=this;this._scaleBehavior.on("update",(function(){var e=me.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const Yi=Phaser.Utils.Objects.GetValue,ji=Phaser.Utils.Objects.GetAdvancedValue,zi=Phaser.Math.Linear;class Xi extends xi{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(Yi(t,"mode",0)),this.setAlphaRange(ji(t,"start",this.parent.alpha),ji(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=Ai[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=zi(this.alphaStart,this.alphaEnd,i)}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Ai={stop:0,destroy:1,yoyo:2},Ii=Phaser.Utils.Objects.IsPlainObject;var Wi=function(t,e,i,s){var r,n;Ii(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 Xi(t,h):s.resetFromJSON(h),s.restart(),s},Fi=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 Vi=Phaser.Utils.Objects.IsPlainObject;var Bi={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=Fi(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()}},Ni={};Object.assign(Ni,Bi),Ni.onInitFade=function(){Bi.onInitFade.call(this);var t=this;this._fade.on("update",(function(){var e=me.getParentSizer(t);e&&e.resetChildAlphaState(t)}))};const Hi=Phaser.Utils.Objects.GetValue,Gi=Phaser.Utils.Objects.GetAdvancedValue,Ui=Phaser.Math.Linear;class $i extends xi{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=Gi(t,"x",void 0),i=Gi(t,"y",void 0);this.setTargetPosition(e,i)}else this.setTargetPosition(t);return this}setMode(t){return"string"==typeof t&&(t=Ji[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=Gi(i,"startX",void 0),this.startY=Gi(i,"startY",void 0),this.endX=Gi(i,"endX",void 0),this.endY=Gi(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=Ui(this.startX,this.endX,i)),this.hasMoveY&&(t.y=Ui(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Ji={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 Ki=Phaser.Utils.Objects.IsPlainObject,Zi=Phaser.Math.Distance.Between;var Qi={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(Ki(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*Zi(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 $i&&(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 $i(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),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(Ki(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*Zi(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 $i&&(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 $i(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),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}},ts={};Object.assign(ts,Qi),ts.onInitEaseMove=function(){Qi.onInitEaseMove.call(this);var t=this;this._easeMove.on("update",(function(){var e=me.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const es=Phaser.Utils.Objects.GetValue;class is extends ri{constructor(t,e){super(t,e),this.timer=new ci,this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.timer.resetFromJSON(es(t,"timer")),this.setEnable(es(t,"enable",!0)),this.setMode(es(t,"mode",1)),this.isRunning=es(t,"isRunning",!1),this.setMagnitudeMode(es(t,"magnitudeMode",1)),this.setAxisMode(es(t,"axis",0)),this.setDuration(es(t,"duration",500)),this.setMagnitude(es(t,"magnitude",10)),this.ox=es(t,"ox",void 0),this.oy=es(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=ss[t]),this.mode=t,this}setMagnitudeMode(t){return"string"==typeof t&&(t=ns[t]),this.magnitudeMode=t,this}setAxisMode(t){return"string"==typeof t&&(t=rs[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=es(i,"magnitude",void 0),t=es(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 ss={effect:0,behavior:1},rs={both:0,"h&v":0,"x&y":0,horizontal:1,h:1,x:1,vertical:2,v:2,y:2},ns={constant:0,decay:1},hs=Phaser.Utils.Objects.IsPlainObject;var as={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 is(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 os=Phaser.Utils.Objects.GetValue,ls=Phaser.Math.Linear;class ds 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=os(t,"key","value");var i=e[this.propertyKey];return this.fromValue=os(t,"from",i),this.toValue=os(t,"to",i),this.setEase(os(t,"ease",this.ease)),this.setDuration(os(t,"duration",this.duration)),this.setRepeat(os(t,"repeat",0)),this.setDelay(os(t,"delay",0)),this.setRepeatDelay(os(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]=ls(this.fromValue,this.toValue,i)}}const cs=Phaser.Utils.Objects.IsPlainObject;class us extends Qe{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 ds(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(cs(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(cs(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 ps={easeDataTo(t,e,i,s){return this._easeData||(this._easeData=new us(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),ki(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}},vs=Phaser.Utils.Array.Remove,gs={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=$e(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}},Ds={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}},Rs={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}},Ls={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}},Ys={};Object.assign(Ys,Ms,Ds,Rs,Ls);const js=Phaser.Utils.Objects.GetValue;class zs extends Qe{constructor(t,e){super(t,e),this.setTransitInTime(js(e,"duration.in",200)),this.setTransitOutTime(js(e,"duration.out",200)),this.setTransitInCallback(js(e,"transitIn")),this.setTransitOutCallback(js(e,"transitOut")),this.oneShotMode=js(e,"destroy",!1),this.delayCallTimer=void 0,this._state=new ks(this,{eventEmitter:!1,initState:js(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(zs.prototype,Ys);var Xs=function(t){if(t.parentContainer)return Xs(t.parentContainer);var e=function(t){var e=t.displayList;return U(e)?e:null}(t);return e?Xs(e):t};class As extends Qe{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=Xs(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 Is=Phaser.GameObjects.Rectangle;class Ws extends Is{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)}}const Fs=Phaser.Utils.Objects.GetValue;class Vs extends Qe{constructor(t,e){super(t,{eventEmitter:!1}),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setHitAreaMode(Fs(t,"hitAreaMode",0)),this.setEnable(Fs(t,"enable",!0)),this.setStopMode(Fs(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=Bs[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 Bs={default:0,fullWindow:1};const Ns=Phaser.Utils.Objects.GetValue;class Hs extends Ws{constructor(t,e){super(t,Ns(e,"color",0),Ns(e,"alpha",.8)),this.touchEventStop=new Vs(this,{hitAreaMode:1})}}var Gs={popUp(t,e){void 0!==t._modalScaleSave?(t.scaleX=t._modalScaleSave,t.scaleY=t._modalScaleSave):t._modalScaleSave=t.scaleX,Ei(t,e)},scaleDown(t,e){Ti(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){Fi(t,e,!1)}},Us=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Wi(t,e,t.alpha)},$s=function(t,e){Fi(t,e,!1)},Js=function(t,e,i,s,r){return!(!t||s&&!s(t,e,i)||!rt(t,!0).contains(e,i)||r&&!r(t,e,i))};const qs=Phaser.Utils.Objects.GetValue;let Ks=class extends zs{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=Zs.popUp),null==e.transitOut&&(e.transitOut=Zs.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 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(qs(i,"transitIn",Us)),this.setCoverTransitOutCallback(qs(i,"transitOut",$s)));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&&Js(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=Zs[t]),t){case Zs.popUp:t=Gs.popUp;break;case Zs.fadeIn:t=Gs.fadeIn}return super.setTransitInCallback(t),this}setTransitOutCallback(t){switch("string"==typeof t&&(t=Zs[t]),t){case Zs.scaleDown:t=Gs.scaleDown;break;case Zs.fadeOut:t=Gs.fadeOut}return super.setTransitOutCallback(t),this}setCoverTransitInCallback(t){return this.coverTransitInCallback=t,this}setCoverTransitOutCallback(t){return this.coverTransitOutCallback=t,this}};const Zs={popUp:0,fadeIn:1,scaleDown:0,fadeOut:1};var Qs=function(t){return t&&"function"==typeof t},tr={modal(t,e){return Qs(t)&&(e=t,t=void 0),void 0===this._modalBehavior&&(this.onCreateModalBehavior&&this.onCreateModalBehavior(this,t),this._modalBehavior=function(t,e){var i=new Ks(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}},er=function(t,e,i,s,r){Qs(e)&&(r=s,s=i,i=e,e=this);var n=this.scene.events;return this.bindEvent(e,n,t,i,s,r),this},ir={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 er.call(this,"preupdate",t,e,i,s),this},bindSceneUpdateEvent(t,e,i,s){return er.call(this,"update",t,e,i,s),this},bindScenePostupdateEvent(t,e,i,s){return er.call(this,"postupdate",t,e,i,s),this},bindSceneRenderEvent(t,e,i,s){return er.call(this,"render",t,e,i,s),this},bindScenePauseEvent(t,e,i,s){return er.call(this,"pause",t,e,i,s),this},bindSceneResumeEvent(t,e,i,s){return er.call(this,"resume",t,e,i,s),this},bindSceneSleepEvent(t,e,i,s){return er.call(this,"sleep",t,e,i,s),this},bindSceneWakeEvent(t,e,i,s){return er.call(this,"wake",t,e,i,s),this},bindSceneShutdownEvent(t,e,i,s){return er.call(this,"shutdown",t,e,i,s),this}},sr=function(t,e,i){var s=t.camera;return s?(void 0===i?i={}:!0===i&&(i=rr),s===e?(i.x=t.worldX,i.y=t.worldY):s.getWorldPoint(t.x,t.y,i),i):null},rr={},nr=function(t,e,i,s){var r,n=t.scene.sys.cameras.main,h=0===t.scrollFactorX&&0===t.scrollFactorY;if(e)return h?Js(t,e.x,e.y,i,s):!!(r=sr(e,n,!0))&&Js(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 fr={press:0,pointerdown:0,release:1,pointerup:1};var mr={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 gr(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}},yr=function(t,e,i,s,r){if(e)return!(i&&!i(t,e)||!br(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 xr=Phaser.Utils.Objects.GetValue;class Sr extends Qe{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?yr:nr)(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 wr={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 Sr(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 Pr extends Ts{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 Or=Phaser.Utils.Objects.GetValue;class Er extends Qe{constructor(t,e){super(t,e),this._enable=void 0,this.cooldown=new Pr,this.parent.setInteractive(Or(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.prevIsInTouch=!1,this.isInTouching=!1,this.setEnable(Or(t,"enable",!0)),this.setCooldown(Or(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 Tr={isPointerInBounds(t){return void 0===t?t=this:"string"==typeof t&&(t=this.getElement(t)),!!t&&nr(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 Er(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 Er(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}},kr={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,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=Gr,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===Ur&&this.onDragEnd(),this.pointer=void 0,this.tracerState=Gr,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=$r,this}isPointerInGameObject(t,e,i){var s=this.lastPointer;return!!s&&nr(t,s,e,i)}}const Gr=0,Ur=1,$r="IDLE",Jr=Phaser.Utils.Objects.GetValue,qr=Phaser.Math.Distance.Between;class Kr 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=Zr},eventEmitter:!1};this.setRecongizedStateObject(new Ts(s))}resetFromJSON(t){super.resetFromJSON(t),this.setHoldTime(Jr(t,"time",250)),this.setTapInterval(Jr(t,"tapInterval",200)),this.setDragThreshold(Jr(t,"threshold",9)),this.setTapOffset(Jr(t,"tapOffset",10));var e=Jr(t,"taps",void 0);return void 0!==e?this.setTaps(e):(this.setMaxTaps(Jr(t,"maxTaps",void 0)),this.setMinTaps(Jr(t,"minTaps",void 0))),this}onDragStart(){switch(this.state){case Zr:this.state=Qr;break;case Qr:var t=this.lastPointer;qr(t.upX,t.upY,t.x,t.y)>this.tapOffset&&(this.state=tn,this.state=Qr);break;case tn:this.state=Qr}}onDragEnd(){this.state===Qr&&(this.tapsCount++,this.emit("tapping",this,this.gameObject,this.lastPointer),void 0!==this.maxTaps&&this.tapsCount===this.maxTaps&&(this.state=tn))}onDrag(){this.state!==Zr&&this.pointer.getDistance()>this.dragThreshold&&(this.state=Zr)}preUpdate(t,e){if(this.isRunning&&this.enable&&this.state===Qr){var i=this.lastPointer;i.isDown?t-i.downTime>this.holdTime&&(this.state=Zr):t-i.upTime>this.tapInterval&&(void 0===this.minTaps||this.tapsCount>=this.minTaps?this.state=tn:this.state=Zr)}}postUpdate(t,e){this.isRunning&&this.enable&&this.state===tn&&(this.state=Zr)}get isTapped(){return this.state===tn}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 Zr="IDLE",Qr="BEGIN",tn="RECOGNIZED",en=Phaser.Utils.Objects.GetValue;class sn 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=rn},eventEmitter:!1};this.setRecongizedStateObject(new Ts(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(en(t,"threshold",9)),this.setHoldTime(en(t,"time",251)),this}onDragStart(){this.state=nn,0===this.holdTime&&(this.state=hn)}onDragEnd(){this.state=rn}onDrag(){this.state!==rn&&this.pointer.getDistance()>this.dragThreshold&&(this.state=rn)}preUpdate(t,e){this.isRunning&&this.enable&&this.state===nn&&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 rn="IDLE",nn="BEGIN",hn="RECOGNIZED";Phaser.Utils.Objects.GetValue;var an=function(t){return Ke(t).loop.delta};const on=Phaser.Math.Distance.Between,ln=Phaser.Math.Angle.Between;var dn={getDt:function(){return an(this.scene)},getVelocity:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return on(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 ln(e.x,e.y,t.x,t.y)}},cn={"up&down":0,"left&right":1,"4dir":2,"8dir":3},un={};const pn=Phaser.Utils.Objects.GetValue,vn=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=fn},eventEmitter:!1};this.setRecongizedStateObject(new Ts(s)),this.clearDirectionStates()}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(pn(t,"threshold",10)),this.setVelocityThreshold(pn(t,"velocityThreshold",1e3)),this.setDirectionMode(pn(t,"dir","8dir")),this}onDragStart(){this.state=mn}onDragEnd(){this.state=fn}onDrag(){this.state===mn&&(this.validDrag||(this.validDrag=0===this.dragThreshold||this.pointer.getDistance()>=this.dragThreshold),this.validDrag&&this.dragVelocity>this.velocityThreshold&&(this.state=yn))}postUpdate(t,e){this.isRunning&&this.enable&&this.state===yn&&(this.state=fn)}get isSwiped(){return this.state===yn}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=un),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}}(vn(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,dn);const fn="IDLE",mn="BEGIN",yn="RECOGNIZED",bn=Phaser.Utils.Objects.GetValue,Cn=Phaser.Utils.Array.SpliceOne,xn=Phaser.Math.Distance.Between,Sn=Phaser.Math.Angle.Between;class _n{constructor(t,e){var i=$e(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(bn(e,"inputConfig",void 0)),this.setEventEmitter(bn(e,"eventEmitter",void 0)),this._enable=void 0,this.pointers=[],this.movedState={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setEnable(bn(t,"enable",!0)),this.bounds=bn(t,"bounds",void 0),this.tracerState=Pn,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 Pn:this.tracerState=On,this.onDrag1Start();break;case On:this.tracerState=En,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 On:this.tracerState=Pn,this.onDrag1End();break;case En:this.tracerState=On,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 On:this.onDrag1();break;case En:this.onDrag2()}}}dragCancel(){return this.tracerState===En&&this.onDrag2End(),this.pointers.length=0,gt(this.movedState),this.tracerState=Pn,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!==En)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!==En)return 0;var t=this.pointers[0],e=this.pointers[1];return Sn(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;wn.x=e.x-i.x,wn.y=e.y-i.y}else wn.x=0,wn.y=0;return wn}get centerX(){if(this.tracerState!==En)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.x+e.x)/2}get centerY(){if(this.tracerState!==En)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.y+e.y)/2}get prevCenterX(){if(this.tracerState!==En)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!==En)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=Tn,this}isPointer0InGameObject(t,e,i){var s=this.pointers[0];return!!s&&nr(t,s,e,i)}isPointer1InGameObject(t,e,i){var s=this.pointers[1];return!!s&&nr(t,s,e,i)}}Object.assign(_n.prototype,He);var wn={};const Pn=0,On=1,En=2,Tn="IDLE";Phaser.Utils.Objects.GetValue;const kn=Phaser.Math.RotateAround;var Mn=function(t,e,i,s){return kn(t,e,i,s),t.rotation+=s,t},Dn={};const Rn=Phaser.Utils.Objects.GetValue,Ln=Phaser.Math.Angle.WrapDegrees,Yn=Phaser.Math.Angle.ShortestBetween,jn=Phaser.Math.RadToDeg,zn=Phaser.Math.DegToRad;var Xn={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=Dn),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=Ln(jn(this.angleBetween));this.angle=Yn(this.prevAngle,t),this.prevAngle=t,this.state=Wn}break;case Wn:t=Ln(jn(this.angleBetween)),this.angle=Yn(this.prevAngle,t),this.prevAngle=t,this.emit("rotate",this)}}get isRotated(){return this.state===Wn}get rotation(){return zn(this.angle)}setDragThreshold(t){return this.dragThreshold=t,this}}.prototype,Xn);const An="IDLE",In="BEGIN",Wn="RECOGNIZED",Fn=Phaser.Utils.Objects.GetValue;var Vn=function(t){var e=Fn(t,"tap",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._tap=new Kr(this,e),this._tap.on("tap",(function(t,e,s){Dr(i.eventEmitter,`${i.eventNamePrefix}${t.tapsCount}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Bn=Phaser.Utils.Objects.GetValue;var Nn=function(t){var e=Bn(t,"press",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._press=new sn(this,e),this._press.on("pressstart",(function(t,e,s){Dr(i.eventEmitter,`${i.eventNamePrefix}pressstart`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this).on("pressend",(function(t,e,s){Dr(i.eventEmitter,`${i.eventNamePrefix}pressend`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Hn=Phaser.Utils.Objects.GetValue;var Gn=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 gn(this,e),this._swipe.on("swipe",(function(t,e,s){var r=t.left?"left":t.right?"right":t.up?"up":"down";Dr(i.eventEmitter,`${i.eventNamePrefix}swipe${r}`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Un=Phaser.Utils.Objects.GetValue;var $n=function(t,e){return t.setInteractive(),Un(e,"dropZone",!1)&&(t.input.dropZone=!0),t._childrenInteractive={targetSizers:Un(e,"targets",[t]),targetMode:Un(e,"targetMode","parent"),eventEmitter:Un(e,"eventEmitter",t),eventNamePrefix:Un(e,"inputEventPrefix","child.")},Lr.call(t,e),zr.call(t,e),Ir.call(t,e),Br.call(t,e),Vn.call(t,e),Nn.call(t,e),Gn.call(t,e),t},Jn={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,h,a=t.scene;if("number"==typeof e)i=e;else{i=ae(e,"color"),s=ae(e,"lineWidth");var o=ae(e,"name",!1);o&&(r=ae(o,"createTextCallback",le),n=ae(o,"createTextCallbackScope",void 0),"string"==typeof(h=ae(o,"align","left-top"))&&(h=jt[h]))}if(void 0===i&&(i=16777215),void 0===s&&(s=1),r&&!t.children){t.children=new oe(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)}}for(var d,c,u=this.getAllShownChildren([this]),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 rh=Phaser.Utils.Objects.IsPlainObject,nh=Phaser.Utils.Objects.GetValue,hh=Phaser.Display.Align.CENTER,ah={min:0,full:-1};var oh=function(t,e,i,s,r,n,h,a,o,l){ve.call(this,t);var d=t.isRexSpace,c=typeof e;if(null===e)return this;if("number"===c);else if("string"===c)e=ah[e];else if(rh(e)){var u;e=nh(u=e,"proportion",void 0),i=nh(u,"align",hh),s=nh(u,"padding",0),r=nh(u,"expand",!1),n=nh(u,"key",void 0),h=nh(u,"index",void 0),t.isRexSizer||(a=nh(u,"minWidth",void 0),o=nh(u,"minHeight",void 0)),l=nh(u,"fitRatio",0)}return"string"==typeof i&&(i=jt[i]),void 0===e&&(e=d?1:0),void 0===i&&(i=hh),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===a&&(d?a=0:t.isRexSizer||(a=t._minWidth)),void 0===o&&(d?o=0:t.isRexSizer||(o=t._minHeight)),void 0===l||!1===l?l=0:!0===l&&(l=Q(t)/tt(t)),(u=this.getSizerConfig(t)).proportion=e,u.align=i,u.padding=ue(s),u.expand=r,u.fitRatio=0===e?l:0,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},lh={add:oh,addSpace(t){return this.insertSpace(void 0,t),this},insertSpace(t,e){return void 0===e&&(e=1),oh.call(this,new ih(this.scene),{proportion:e,minWidth:0,minHeight:0,index:t}),this},insert(t,e,i,s,r,n,h,a){return rh(i)&&(i.index=t),oh.call(this,e,i,s,r,n,h,t,a),this},insertAtPosition(t,e,i,s,r,n,h,a,o){var l=sh.call(this,t,e);return-1===l&&(l=void 0),this.insert(l,i,s,r,n,h,a,o),this}};const dh=Tt.prototype.clear;var ch=function(t){this.backgroundChildren&&(this.backgroundChildren.length=0);var e,i=!t&&this.sizerEventsEnable;if(i&&(e=this.getChildren([])),dh.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}},vh={getChildAlign(t){return this.getSizerConfig(t).align},setChildAlign(t,e){return"string"==typeof e&&(e=jt[e]),this.getSizerConfig(t).align=e,this}},gh={getChildProportion(t){return this.getSizerConfig(t).proportion},setChildProportion(t,e){return this.getSizerConfig(t).proportion=e,this}},fh={getChildExpand(t){return this.getSizerConfig(t).expand},setChildExpand(t,e){return this.getSizerConfig(t).expand=e,this}},mh={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}},yh={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&&(Fe(t,0,0),e.resolved=!1,this.hasRatioFitChild=!0);return this._childrenProportion=void 0,this.hasProportion0Child=!1,this.proportionLength=void 0,Ae.call(this),this},layoutChildren:function(){for(var t,e,i,s,r,n,h,a,o,l,d=this.sizerChildren,c=this.innerLeft,u=this.innerTop,p=this.innerWidth,v=this.innerHeight,g=c,f=u,m=this.startChildIndex,y=0,b=d.length;y0?(e=t-this.getChildrenWidth(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},resolveHeight:function(t){if(void 0!==(t=Ye.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)||Re.call(this)},runWidthWrap:function(t){this.wrapResult||(1===this.orientation&&th.call(this,t,void 0),Le.call(this,t))},hasHeightWrap:function(){return!(!this.hasRatioFitChild||0!==this.orientation)||je.call(this)},runHeightWrap:function(t){this.wrapResult||(0===this.orientation&&th.call(this,void 0,t),ze.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(yh,lh,ph,vh,gh,fh,mh);var bh=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 xh=Phaser.Utils.Objects.IsPlainObject,Sh=Phaser.Utils.Objects.GetValue;class _h extends Kn{constructor(t,e,i,s,r,n,h){xh(e)?(e=Sh(h=e,"x",0),i=Sh(h,"y",0),s=Sh(h,"width",void 0),r=Sh(h,"height",void 0),n=Sh(h,"orientation",0)):xh(s)?(s=Sh(h=s,"width",void 0),r=Sh(h,"height",void 0),n=Sh(h,"orientation",0)):xh(n)&&(n=Sh(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(Sh(h,"space.item",0)),this.setStartChildIndex(Sh(h,"startChildIndex",0)),this.setRTL(Sh(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=bh.call(this)),this._childrenProportion}}Object.assign(_h.prototype,yh);var wh={v:0,vertical:0,y:0,h:1,horizontal:1,x:1,xy:2,vh:2},Ph=function(t){var e=!!t.sliderY||!!t.scrollerY,i=!!t.sliderX||!!t.scrollerX;return e&&i?2:e?0:i?1:0},Oh=function(){return Array.prototype.reduce.call(arguments,Eh,0)},Eh=function(t,e){return t+e};const Th=Phaser.Utils.Objects.IsPlainObject,kh=Phaser.Utils.Objects.GetValue,Mh=Phaser.Display.Align.CENTER;var Dh=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 Lh(this.sizerChildren,null),ch.call(this,t),this}},jh={setColumnSpace(t){if(this.space.column||(this.space.column=[]),this.space.column.length=this.columnCount-1,"number"==typeof t)Lh(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},Ih={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=Ye.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===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,Lh(this.sizerChildren,null),this.columnProportions=[],this.columnProportions.length=t,"number"==typeof i)Lh(this.columnProportions,i);else for(var n=0;n0?e+=t:0===t&&(this.hasColumnProportion0Child=!0);return e},Fh=function(){for(var t,e=0,i=0;i0?e+=t:0===t&&(this.hasRowProportion0Child=!0);return e};const Vh=Phaser.Utils.Objects.IsPlainObject,Bh=Phaser.Utils.Objects.GetValue;class Nh extends Kn{constructor(t,e,i,s,r,n,h,a,o,l){Vh(e)?(e=Bh(l=e,"x",0),i=Bh(l,"y",0),s=Bh(l,"width",void 0),r=Bh(l,"height",void 0),n=Bh(l,"column",l.col||0),h=Bh(l,"row",0),a=Bh(l,"columnProportions",0),o=Bh(l,"rowProportions",0)):Vh(s)?(s=Bh(l=s,"width",void 0),r=Bh(l,"height",void 0),n=Bh(l,"column",l.col||0),h=Bh(l,"row",0),a=Bh(l,"columnProportions",0),o=Bh(l,"rowProportions",0)):Vh(n)?(n=Bh(l=n,"column",l.col||0),h=Bh(l,"row",0),a=Bh(l,"columnProportions",0),o=Bh(l,"rowProportions",0)):Vh(a)&&(a=Bh(l=a,"columnProportions",0),o=Bh(l,"rowProportions",0)),super(t,e,i,s,r,l),this.type="rexGridSizer",this.sizerChildren=[],this.addChildrenMap("items",this.sizerChildren),this.setCreateCellContainerCallback(Bh(l,"createCellContainerCallback")),this.setIndentLeft(Bh(l,"space.indentLeftOdd",0),Bh(l,"space.indentLeftEven",0)),this.setIndentTop(Bh(l,"space.indentTopOdd",0),Bh(l,"space.indentTopEven",0)),this.resetGrid(n,h,a,o,Bh(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=Wh.call(this)),this._totalColumnProportions}get totalRowProportions(){return void 0===this._totalRowProportions&&(this._totalRowProportions=Fh.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(Nh.prototype,Ih);const Hh=Phaser.Utils.Objects.GetValue;var Gh=Phaser.Renderer.WebGL.Utils,Uh=function(t,e,i,s,r,n){for(var h=Gh.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+")"},Zh=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 Qh=Phaser.Renderer.Canvas.SetTransform;var ta={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&&Uh(r,h,e,l,a,o),e.isStroked&&Jh(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(Qh(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(ia.prototype,ta);const sa=Phaser.Utils.Objects.GetValue;let ra=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=sa(t,"x",0),i=sa(t,"y",0));var s=this.cornerRadius;s.tl=na(sa(t,"tl",void 0),e,i),s.tr=na(sa(t,"tr",void 0),e,i),s.bl=na(sa(t,"bl",void 0),e,i),s.br=na(sa(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 na=function(t,e,i){return void 0===t?t={x:e,y:i}:"number"==typeof t&&(t={x:t,y:t}),aa(t),t},ha=function(t,e){"number"==typeof e?(t.x=e,t.y=e):(t.x=sa(e,"x",0),t.y=sa(e,"y",0)),aa(t)},aa=function(t){t.convex=t.x>=0||t.y>=0,t.x=Math.abs(t.x),t.y=Math.abs(t.y)},oa=function(t){return t.x>0&&t.y>0},la=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 da=Phaser.Math.DegToRad;var ca=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 po=Phaser.Utils.Objects.GetValue,vo=Phaser.Utils.Objects.IsPlainObject;class go extends(Aa(Ma)){constructor(t,e,i,s,r,n,h,a){vo(e)?(e=(a=e).x,i=a.y,s=a.width,r=a.height,n=a.barColor,h=a.value):vo(s)?(s=(a=s).width,r=a.height,n=a.barColor,h=a.value):vo(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 co).setName("trackFill")).addShape((new co).setName("bar")).addShape((new co).setName("trackStroke")),this.setTrackColor(po(a,"trackColor",void 0)),this.setBarColor(n),this.setTrackStroke(po(a,"trackStrokeThickness",2),po(a,"trackStrokeColor",void 0)),this.setSkewX(po(a,"skewX",0)),this.setRTL(po(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 fo={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&&uo(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),uo(h,r,0,n,i,t));var a=this.getShape("trackStroke");a.lineStyle(this.trackStrokeThickness,this.trackStrokeColor),a.isStroked&&uo(a,0,0,e,i,t)}};Object.assign(go.prototype,fo);var mo=function(t){return null==t||""===t||0===t.length},yo=function(t,e,i,s){if(void 0===s&&(s="."),"object"==typeof t){if(mo(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(mo(e));else{var r;"string"==typeof e&&(e=e.split("."));for(var n=0,h=e.length;nzo(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]=zo(t[i]));return e}const Xo=Phaser.Utils.Objects.IsPlainObject,Ao=Phaser.Utils.Objects.GetValue;var Io=function(t){return"string"==typeof t&&(t=Wo[t]),t};const Wo={scale:0,repeat:1};var Fo=function(t,e){return 0===t||t===this.columns.count-1||0===e||e===this.rows.count-1},Vo={_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=zo(i),s=zo(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 _=i.length;o<_;o++){if(void 0===i[o]&&(i[o]=d),"number"==typeof i[o]&&(i[o]={width:i[o],stretch:o%2}),f=(v=i[o]).width,0===x&&(this.columns.stretch+=0|v.stretch,this.columns.minWidth+=v.stretch>0?0:f),f>=1&&g>=1){var w=typeof(m=this.getFrameNameCallback(o,x,e));"string"!==w&&"number"!==w||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 Xo(t)?(this.stretchMode.edge=Io(Ao(t,"edge",0)),this.stretchMode.internal=Io(Ao(t,"internal",0))):(t=Io(t),this.stretchMode.edge=t,this.stretchMode.internal=t),this},getStretchMode:function(t,e){return Fo.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 Bo=Phaser.Utils.Objects.IsPlainObject,No=Phaser.Utils.Objects.GetValue,Ho=Phaser.GameObjects;var Go=void 0,Uo=function(t,e){if(Go||(Go={},Ke(t).events.once("destroy",(function(){for(var t in Go)Go[t].destroy();Go=void 0}))),!Go.hasOwnProperty(e)){var i=Ke(t).scene.systemScene;(t=new Ho[e](i)).setOrigin(0),Go[e]=t}return Go[e]};const $o=Phaser.GameObjects.RenderTexture;class Jo extends(function(t,e){class i extends t{constructor(t,i,s,r,n,h,a,o,l,d){if(Bo(i)?(i=No(d=i,"x",0),s=No(d,"y",0),r=No(d,"width",1),n=No(d,"height",1),h=No(d,"key",void 0),a=No(d,"baseFrame",void 0),o=No(d,"columns",void 0),l=No(d,"rows",void 0)):Bo(r)?(r=No(d=r,"width",1),n=No(d,"height",1),h=No(d,"key",void 0),a=No(d,"baseFrame",void 0),o=No(d,"columns",void 0),l=No(d,"rows",void 0)):Bo(h)?(h=No(d=h,"key",void 0),a=No(d,"baseFrame",void 0),o=No(d,"columns",void 0),l=No(d,"rows",void 0)):Bo(a)?(a=No(d=a,"baseFrame",void 0),o=No(d,"columns",void 0),l=No(d,"rows",void 0)):Array.isArray(a)?(d=l,l=o,o=a,a=No(d,"baseFrame",void 0)):Bo(o)&&(o=No(d=o,"columns",void 0),l=No(d,"rows",void 0)),void 0===a&&(a=No(d,"frame",void 0)),void 0===o){var c=No(d,"leftWidth",void 0),u=No(d,"rightWidth",void 0);void 0!==c&&void 0!==u&&(o=[c,void 0,u])}if(void 0===l){var p=No(d,"topHeight",void 0),v=No(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(No(d,"getFrameNameCallback",void 0)),this.setStretchMode(No(d,"stretchMode",0)),this.setPreserveRatio(No(d,"preserveRatio",!0));var g=No(d,"maxFixedPartScale",1),f=No(d,"maxFixedPartScaleX",g),m=No(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,Vo),i}($o,"rexNinePatch")){}var qo={_drawImage:function(t,e,i,s,r,n){var h=Uo(this,"Image").setTexture(t,e).setDisplaySize(r,n);this.draw(h,i,s)},_drawTileSprite:function(t,e,i,s,r,n){var h=Uo(this,"TileSprite").setTexture(t,e).setSize(r,n);this.draw(h,i,s)}};Object.assign(Jo.prototype,qo);class Ko extends Qe{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 Zo=Phaser.Utils.Objects.GetValue;class Qo extends Jo{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexStatesNinePatch";var i=Zo(e,"effects",!0);i&&Oo(this,i),this.style=new Ko(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign(Qo.prototype,Sa);const tl=["alpha","tint","flipX","flipY"];var el=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 bo(t,e);break;case"image":s=new Yo(t,e);break;case"nineSlice":s=e.hasOwnProperty("stretchMode")?new Qo(t,e):new Mo(t,e);break;default:s=new _a(t,e)}return function(t,e){if(!e)return t;for(var i=0,s=tl.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 Rl=Phaser.Utils.Objects.GetValue,Ll=Phaser.Math.Distance.Between;class Yl extends Qe{constructor(t,e){super(t,e),this._enable=void 0,this.rectBoundsInteractive=Rl(e,"rectBoundsInteractive",!1),this.rectBoundsInteractive||t.setInteractive(Rl(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(Rl(t,"enable",!0)),this.holdThreshold=Rl(t,"holdThreshold",50),this.pointerOutReleaseEnable=Rl(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 an(this.scene)}get speed(){return this.x===this.preX&&this.y===this.preY?0:Ll(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&&!nr(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&&!nr(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 zl{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 Xl{constructor(){this.value,this.dir,this.movement=new zl}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 Fl={y:0,v:0,vertical:0,x:1,h:1,horizontal:1},Vl=Phaser.Utils.Objects.GetValue;class Bl extends Qe{constructor(t,e){switch(super(t,e),this.parent!==this.scene?this.focusMode=Vl(e,"focus",!0):this.focusMode=!1,"boolean"==typeof this.focusMode&&(this.focusMode=this.focusMode?1:0),this.setSpeed(Vl(e,"speed",.1)),this.setEnable(Vl(e,"enable",!0)),this.focusMode){case 0:case 2:this.scene.input.on("wheel",this.onSceneScroll,this);break;default:t.setInteractive(Vl(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||nr(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 Nl=Phaser.Utils.Objects.GetValue;var Hl=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)?Nl(s,l,void 0):Nl(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=ft(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 Ml(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);var p=Nl(r,"position",0);"string"==typeof p&&(p=Gl[p]);var v,g,f=Nl(s,`space.slider${i}`,void 0);void 0===f&&void 0===(f=Nl(s,"space.slider",void 0))&&(a?f=0:v=Nl(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:Nl(v,"right",v)}):(d=0,c=1,u=void 0===v?g?{right:f}:f:{right:Nl(v,"left",v)}):0===p?(d=1,c=2,u=void 0===v?g?{top:f}:f:{top:Nl(v,"bottom",v)}):(d=1,c=0,u=void 0===v?g?{bottom:f}:f:{bottom:Nl(v,"top",v)}),e.add(n,{column:d,row:c,align:"center",padding:u,expand:!0}),t[`hideUnscrollableSlider${i}`]=Nl(r,"hideUnscrollableSlider",!1),t[`adaptThumb${i}SizeMode`]=Nl(r,"adaptThumbSize",!1),t[`minThumb${i}Size`]=Nl(r,"minThumbSize",void 0)}else t[`hideUnscrollableSlider${i}`]=!1,t[`adaptThumb${i}SizeMode`]=!1,t[`minThumb${i}Size`]=void 0;var m,y,b=Nl(s,"scrollDetectionMode");"string"==typeof b&&(b=Ul[b]);var C=`scroller${i}`;(m=a||s.hasOwnProperty(C)?Nl(s,C,!0):Nl(s,"scroller",!0))&&o&&(!0===m&&(m={}),m.orientation=h?0:1,void 0!==b&&(m.rectBoundsInteractive=1===b),y=new Wl(o,m),o.isRexContainerLite&&o.sendChildToBack(o));var x,S,_,w,P,O=Nl(s,a?`mouseWheelScroller${i}`:"mouseWheelScroller",!1);O&&o&&(void 0!==b&&(O.focus=1===b?2:0),x=new Bl(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.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",w=`scroll${i}`):(S="t",w="scroll"),n.on("valuechange",(function(e){t[S]=e,t.emit(w,t)}))),y&&(a?(_=`childO${i}`,w=`scroll${i}`):(_="childOY",w="scroll"),y.on("valuechange",(function(e){t[_]=e,t.emit(w,t)}))),x&&(P=a?`addChildO${i}`:"addChildOY",x.on("scroll",(function(e){t[P](-e,!0)})))};const Gl={right:0,left:1,bottom:0,top:1},Ul={gameObject:0,rectBounds:1},$l=Phaser.Utils.Objects.GetValue;var Jl=function(t,e){var i=t.scene,s=[0,1,0],r=[0,1,0],n=$l(e,"width"),h=$l(e,"height");n||$l(e,"child.expandWidth",!0)||(s[1]=0),h||$l(e,"child.expandHeight",!0)||(r[1]=0);var a=new Nh(i,{column:3,row:3,columnProportions:s,rowProportions:r});switch(function(t,e,i){var s=Hh(i,"child"),r=Hh(s,"gameObject",void 0);if(r){var n=Hh(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=Hh(n,"top",0),h.bottom=Hh(n,"bottom",0),a.left=Hh(n,"left",0),a.right=Hh(n,"right",0);break;case 1:h.top=Hh(n,"left",0),h.bottom=Hh(n,"right",0),a.top=Hh(n,"top",0),a.bottom=Hh(n,"bottom",0);break;default:h.top=Hh(n,"top",0),h.bottom=Hh(n,"bottom",0),h.left=Hh(n,"left",0),h.right=Hh(n,"right",0)}e.add(r,{column:1,row:1,align:Hh(s,"align","center"),padding:a,expand:{width:Hh(s,"expandWidth",!0),height:Hh(s,"expandHeight",!0)}})}t.addChildrenMap("child",r)}(t,a,e),t.scrollMode){case 0:Hl(t,a,"y",e);break;case 1:Hl(t,a,"x",e);break;default:Hl(t,a,"y",e),Hl(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}`]}if(s){var n="Y"===t?this.scaleY:this.scaleX;s.setBounds(e,i*n)}r&&r.setEnable(e!==i)},Kl=function(t){switch(this.scrollMode){case 0:case 1:(e=this.childrenMap.slider)&&this.hideUnscrollableSlider&&this.setChildVisible(e,this.isOverflow);break;default:t=t.toUpperCase();var e=this.childrenMap[`slider${t}`],i=this[`hideUnscrollableSlider${t}`],s=this[`isOverflow${t}`];e&&i&&this.setChildVisible(e,s)}},Zl=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(ud.call(this,-this.textOY)),0),e=pd.call(this,t)+this.textOY,i=vd.call(this,t);return function(t,e){switch(hd(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,gd.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,Ae.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,md.call(this,t,n,h),he(t,s,r,n,h,e.align),e.preOffsetY=0,gd.call(this),this.textMask&&(this.textMask.setPosition().resize(),this.resetChildPositionState(this.textMask)))}};const bd=Phaser.Utils.Objects.IsPlainObject,Cd=Phaser.Utils.Objects.GetValue,xd=Phaser.Display.Align.TOP_LEFT;class Sd extends Kn{constructor(t,e,i,s,r,n){bd(e)?(e=Cd(n=e,"x",0),i=Cd(n,"y",0),s=Cd(n,"width",void 0),r=Cd(n,"height",void 0)):bd(s)&&(s=Cd(n=s,"width",void 0),r=Cd(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=Cd(n,"content",""),this._textOY=0,this.execeedTopState=!1,this.execeedBottomState=!1,this.setClampMode(Cd(n,"clampTextOY",!0)),this.alwaysScrollable=Cd(n,"alwaysScrollable",!1);var h=Cd(n,"background",void 0),a=Cd(n,"text",void 0);void 0===a&&(a=_d(t)),this.textCropEnable=Cd(n,"textCrop",!!a.setCrop);var o=Cd(n,"textMask",!this.textCropEnable);h&&this.addBackground(h),this.add(a),this.sizerChildren=[a];var l=this.getSizerConfig(a);l.align=xd,l.padding=ue(0),l.expand=!0,this.textObject=a,this.textObjectType=hd(a),l.preOffsetY=0,l.offsetY=0,o&&(this.textMask=cd.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(ud.call(this,this._textObjectRealHeight))),this._visibleLinesCount}get topTextOY(){return 0}get bottomTextOY(){return-this.textVisibleHeight}get textHeight(){return void 0===this._textHeight&&(this._textHeight=pd.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 _d=function(t){return t.add.text(0,0,"")};Object.assign(Sd.prototype,yd);var wd={setText(t){return this.childrenMap.child.setText(t),this.resizeController(),this},appendText(t){return this.setText(this.text+t),this}},Pd={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 Od=Phaser.Utils.Objects.GetValue;class Ed extends id{constructor(t,e){void 0===e&&(e={});var i=Od(e,"text",void 0),s=Od(e,"textWidth",void 0),r=Od(e,"textHeight",void 0),n=Od(e,"textCrop",!!i.setCrop),h=Od(e,"textMask",!n),a=Od(e,"content",""),o=new Sd(t,{width:s,height:r,text:i,textMask:h,textCrop:n&&!h,content:a,clampTextOY:Od(e,"clampChildOY",!1),alwaysScrollable:Od(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=Od(e,"space",void 0);l&&(l.child=Od(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(Ed.prototype,wd,Pd),Ed},"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 01834e3f05..b232354485 100644 --- a/dist/rextextareainput.js +++ b/dist/rextextareainput.js @@ -14485,6 +14485,10 @@ radius.y = Math.abs(radius.y); }; + var IsArcCorner$1 = function (radius) { + return ((radius.x > 0) && (radius.y > 0)); + }; + var LineTo = function (x, y, pathData) { var cnt = pathData.length; if (cnt >= 2) { @@ -14566,8 +14570,7 @@ geom.setTo(0, 0, width, height, radius); } - var iteration = GetValue$v(radiusConfig, 'iteration', undefined); - this.setIteration(iteration); + this.setIteration(GetValue$v(radiusConfig, 'iteration', undefined)); this.setPosition(x, y); this.setFillStyle(fillColor, fillAlpha); @@ -14820,10 +14823,6 @@ } - var IsArcCorner$1 = function (radius) { - return ((radius.x > 0) && (radius.y > 0)); - }; - const ShapeTypeMap = { rectangle: 0, circle: 1 @@ -16409,6 +16408,7 @@ var skewX = this.skewX; var width = this.width - Math.abs(skewX); var height = this.height; + var trackFill = this.getShape('trackFill'); trackFill.fillStyle(this.trackColor); if (trackFill.isFilled) { @@ -16417,8 +16417,7 @@ 0, 0, // x0, y0 width, height, // x1, y1 skewX // skewX - ) - .close(); + ); } var bar = this.getShape('bar'); @@ -16438,8 +16437,7 @@ barX0, 0, // x0, y0 barX1, height, // x1, y1 skewX // skew - ) - .close(); + ); } var trackStroke = this.getShape('trackStroke'); @@ -16450,8 +16448,7 @@ 0, 0, // x0, y0 width, height, // x1, y1 skewX // skewX - ) - .end(); + ); } }; @@ -16471,6 +16468,8 @@ .lineTo(x0, y0).lineTo(startX, y0); } + lines.close(); + return lines; }; @@ -16481,24 +16480,33 @@ constructor(scene, x, y, width, height, barColor, value, config) { if (IsPlainObject$5(x)) { config = x; - x = GetValue$s(config, 'x', 0); - y = GetValue$s(config, 'y', 0); - width = GetValue$s(config, 'width', 2); - height = GetValue$s(config, 'height', 2); - barColor = GetValue$s(config, 'barColor', undefined); - value = GetValue$s(config, 'value', 0); + + x = config.x; + y = config.y; + width = config.width; + height = config.height; + barColor = config.barColor; + value = config.value; } else if (IsPlainObject$5(width)) { config = width; - width = GetValue$s(config, 'width', 2); - height = GetValue$s(config, 'height', 2); - barColor = GetValue$s(config, 'barColor', undefined); - value = GetValue$s(config, 'value', 0); + + width = config.width; + height = config.height; + barColor = config.barColor; + value = config.value; } else if (IsPlainObject$5(barColor)) { config = barColor; - barColor = GetValue$s(config, 'barColor', undefined); - value = GetValue$s(config, 'value', 0); + + barColor = config.barColor; + value = config.value; } + if (x === undefined) { x = 0; } + if (y === undefined) { y = 0; } + if (width === undefined) { width = 2; } + if (height === undefined) { height = width; } + if (value === undefined) { value = 0; } + super(scene, x, y, width, height, config); this.type = 'rexLineProgress'; diff --git a/dist/rextextareainput.min.js b/dist/rextextareainput.min.js index 4cece4e096..c1c2f67032 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}},Oe=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 _e=/(\S+)\[(\d+)\]/i,Te=Phaser.Utils.Objects.GetValue;var ke=function(t,e){return void 0===e?t:t[e]},Ee=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=Te(e,"left",0),t.right=Te(e,"right",0),t.top=Te(e,"top",0),t.bottom=Te(e,"bottom",0)),t},Me={getInnerPadding(t){return ke(this.space,t)},setInnerPadding(t,e){return Ee(this.space,t,e),this},getOuterPadding(t){return ke(this.getSizerConfig(this).padding,t)},setOuterPadding(t,e){return Ee(this.getSizerConfig(this).padding,t,e),this},getChildOuterPadding(t,e){return"string"==typeof t&&(t=this.getElement(t)),ke(this.getSizerConfig(t).padding,e)},setChildOuterPadding(t,e,i){return"string"==typeof t&&(t=this.getElement(t)),Ee(this.getSizerConfig(t).padding,e,i),this}},De=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}},Re=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},Le=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}},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},Ae=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},ze={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}},We=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?vi:pi,this.repeatCounter=0,this}stop(){return this.state=ui,this}update(t,e){this.state!==ui&&this.state!==fi&&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=gi)):(this.nowTime=this.duration,this.state=fi):this.nowTime>=0&&(this.state=vi))}get t(){var t;switch(this.state){case ui:case pi:case gi:t=0;break;case vi:t=this.nowTime/this.duration;break;case fi:t=1}return di(t,0,1)}set t(t){(t=di(t,-1,1))<0?(this.state=pi,this.nowTime=-this.delay*t):(this.state=vi,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===ui}get isDelay(){return this.state===pi}get isCountDown(){return this.state===vi}get isRunning(){return this.state===pi||this.state===vi}get isDone(){return this.state===fi}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}}const ui=0,pi=1,vi=2,gi=3,fi=-1;class mi extends oi{constructor(t,e){super(t,e),this.timer=new ci}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 yi=Phaser.Utils.Objects.GetValue,bi=Phaser.Utils.Objects.GetAdvancedValue,Ci=Phaser.Tweens.Builders.GetEaseFunction;class xi extends mi{resetFromJSON(t){return this.timer.resetFromJSON(yi(t,"timer")),this.setEnable(yi(t,"enable",!0)),this.setTarget(yi(t,"target",this.parent)),this.setDelay(bi(t,"delay",0)),this.setDuration(bi(t,"duration",1e3)),this.setEase(yi(t,"ease","Linear")),this.setRepeat(yi(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 wi=Phaser.Utils.Objects.GetValue,Si=Phaser.Utils.Objects.GetAdvancedValue,Pi=Phaser.Math.Linear;let Oi=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(Si(t,"start",void 0),Si(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=_i[t]),this.mode=t,this}setScaleRange(t,e){return"number"==typeof t?(this.startX=t,this.startY=t):(this.startX=Si(t,"x",this.parent.scaleX),this.startY=Si(t,"y",this.parent.scaleY)),"number"==typeof e?(this.endX=e,this.endY=e):(this.endX=Si(e,"x",void 0),this.endY=Si(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=Pi(this.startX,this.endX,i)),this.hasScaleY&&(t.scaleY=Pi(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}};const _i={stop:0,destroy:1,yoyo:2};var Ti=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 o={mode:0,start:n,end:h,duration:e,ease:s};return void 0===r?r=new Oi(t,o):r.resetFromJSON(o),r.restart(),r},ki=function(t,e,i,s,r,n){void 0===s&&(s="Linear"),r instanceof Oi&&(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 Oi(t,h):n.resetFromJSON(h),n.restart(),n},Ei=function(t,e){return new Promise((function(i,s){t.once(e,(function(){i()}))}))},Mi=function(t){return Ei(t,"complete")};const Di=Phaser.Utils.Objects.IsPlainObject;var Ri={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(Di(t)){var s=t;t=s.duration,e=s.orientation,i=s.ease}var r=void 0===this._scaleBehavior;return this._scaleBehavior=Ti(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(Di(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=ki(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(Di(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 o,a;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},a={x:i};break;case 1:case"y":o={y:t.scaleX},a={y:i};break;default:o=t.scaleX,a=i}var l={mode:2,start:o,end:a,duration:e/2,ease:n,repeat:s};return void 0===h?h=new Oi(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),Mi(this._scaleBehavior)},isRunningScaleYoyo(){return this._scaleBehavior&&(this._scaleBehavior.completeEventName="scaleyoyo.complete")},isRunningEaseScale(){return this.isRunningPopUp()||this.isRunningScaleDown()||this.isRunningScaleYoyo()}},Li={};Object.assign(Li,Ri),Li.onInitScale=function(){Ri.onInitScale.call(this);var t=this;this._scaleBehavior.on("update",(function(){var e=me.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const Xi=Phaser.Utils.Objects.GetValue,Yi=Phaser.Utils.Objects.GetAdvancedValue,Ai=Phaser.Math.Linear;class zi 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(Yi(t,"start",this.parent.alpha),Yi(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=Wi[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=Ai(this.alphaStart,this.alphaEnd,i)}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Wi={stop:0,destroy:1,yoyo:2},ji=Phaser.Utils.Objects.IsPlainObject;var Ii=function(t,e,i,s){var r,n;ji(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 zi(t,h):s.resetFromJSON(h),s.restart(),s},Fi=function(t,e,i,s){i instanceof zi&&(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 zi(t,r):s.resetFromJSON(r),s.restart(),s};const Bi=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(Bi(t)){var i=t;t=i.duration,e=i.alpha}var s=void 0===this._fade;return this._fade=Ii(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(Bi(t)){var i=t;t=i.duration,e=i.destroy}var s=void 0===this._fade;return this._fade=Fi(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()}},Hi={};Object.assign(Hi,Vi),Hi.onInitFade=function(){Vi.onInitFade.call(this);var t=this;this._fade.on("update",(function(){var e=me.getParentSizer(t);e&&e.resetChildAlphaState(t)}))};const Ni=Phaser.Utils.Objects.GetValue,Gi=Phaser.Utils.Objects.GetAdvancedValue,Ui=Phaser.Math.Linear;class $i extends xi{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){if(super.resetFromJSON(t),this.setMode(Ni(t,"mode",0)),t&&(t.hasOwnProperty("x")||t.hasOwnProperty("y"))){var e=Gi(t,"x",void 0),i=Gi(t,"y",void 0);this.setTargetPosition(e,i)}else this.setTargetPosition(t);return this}setMode(t){return"string"==typeof t&&(t=Ji[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=Gi(i,"startX",void 0),this.startY=Gi(i,"startY",void 0),this.endX=Gi(i,"endX",void 0),this.endY=Gi(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=Ui(this.startX,this.endX,i)),this.hasMoveY&&(t.y=Ui(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Ji={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 Ki=Phaser.Utils.Objects.IsPlainObject,Zi=Phaser.Math.Distance.Between;var Qi={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(Ki(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*Zi(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 $i&&(h=n,n=void 0),void 0===n&&(n=!1);var o={};return o.mode=n?1:0,void 0!==i&&(o.startX=qi(i,t.x),o.endX=t.x),void 0!==s&&(o.startY=qi(s,t.y),o.endY=t.y),o.duration=e,o.ease=void 0===r?"Linear":r,void 0===h?h=new $i(t,o):h.resetFromJSON(o),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),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(Ki(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*Zi(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 $i&&(h=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=qi(i,t.x)),void 0!==s&&(o.startY=t.y,o.endY=qi(s,t.y)),o.duration=e,o.ease=void 0===r?"Linear":r,void 0===h?h=new $i(t,o):h.resetFromJSON(o),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),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}},ts={};Object.assign(ts,Qi),ts.onInitEaseMove=function(){Qi.onInitEaseMove.call(this);var t=this;this._easeMove.on("update",(function(){var e=me.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const es=Phaser.Utils.Objects.GetValue;class is extends ri{constructor(t,e){super(t,e),this.timer=new ci,this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.timer.resetFromJSON(es(t,"timer")),this.setEnable(es(t,"enable",!0)),this.setMode(es(t,"mode",1)),this.isRunning=es(t,"isRunning",!1),this.setMagnitudeMode(es(t,"magnitudeMode",1)),this.setAxisMode(es(t,"axis",0)),this.setDuration(es(t,"duration",500)),this.setMagnitude(es(t,"magnitude",10)),this.ox=es(t,"ox",void 0),this.oy=es(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=ss[t]),this.mode=t,this}setMagnitudeMode(t){return"string"==typeof t&&(t=ns[t]),this.magnitudeMode=t,this}setAxisMode(t){return"string"==typeof t&&(t=rs[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=es(i,"magnitude",void 0),t=es(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 ss={effect:0,behavior:1},rs={both:0,"h&v":0,"x&y":0,horizontal:1,h:1,x:1,vertical:2,v:2,y:2},ns={constant:0,decay:1},hs=Phaser.Utils.Objects.IsPlainObject;var os={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 is(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 as=Phaser.Utils.Objects.GetValue,ls=Phaser.Math.Linear;class ds 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=as(t,"key","value");var i=e[this.propertyKey];return this.fromValue=as(t,"from",i),this.toValue=as(t,"to",i),this.setEase(as(t,"ease",this.ease)),this.setDuration(as(t,"duration",this.duration)),this.setRepeat(as(t,"repeat",0)),this.setDelay(as(t,"delay",0)),this.setRepeatDelay(as(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]=ls(this.fromValue,this.toValue,i)}}const cs=Phaser.Utils.Objects.IsPlainObject;class us extends Qe{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 ds(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(cs(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(cs(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 ps={easeDataTo(t,e,i,s){return this._easeData||(this._easeData=new us(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),Ei(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}},vs=Phaser.Utils.Array.Remove,gs={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=$e(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}},Ds={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}},Rs={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}},Ls={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,Ms,Ds,Rs,Ls);const Ys=Phaser.Utils.Objects.GetValue;class As extends Qe{constructor(t,e){super(t,e),this.setTransitInTime(Ys(e,"duration.in",200)),this.setTransitOutTime(Ys(e,"duration.out",200)),this.setTransitInCallback(Ys(e,"transitIn")),this.setTransitOutCallback(Ys(e,"transitOut")),this.oneShotMode=Ys(e,"destroy",!1),this.delayCallTimer=void 0,this._state=new Es(this,{eventEmitter:!1,initState:Ys(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(As.prototype,Xs);var zs=function(t){if(t.parentContainer)return zs(t.parentContainer);var e=function(t){var e=t.displayList;return U(e)?e:null}(t);return e?zs(e):t};class Ws extends Qe{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=zs(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,o=r/2,a=n/2,l=r*h,d=n*h;e.x===o&&e.y===a||e.setPosition(o,a),e.width===l&&e.height===d||e.setSize(l,d)}}}const js=Phaser.GameObjects.Rectangle;let Is=class extends js{constructor(t,e,i){super(t,0,0,2,2,e,1),this.fullWindow=new Ws(this),this.setAlpha(i)}get tint(){return this.fillColor}set tint(t){this.setFillStyle(t,this.fillAlpha)}};const Fs=Phaser.Utils.Objects.GetValue;class Bs extends Qe{constructor(t,e){super(t,{eventEmitter:!1}),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setHitAreaMode(Fs(t,"hitAreaMode",0)),this.setEnable(Fs(t,"enable",!0)),this.setStopMode(Fs(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 Hs=Phaser.Utils.Objects.GetValue;class Ns extends Is{constructor(t,e){super(t,Hs(e,"color",0),Hs(e,"alpha",.8)),this.touchEventStop=new Bs(this,{hitAreaMode:1})}}var Gs={popUp(t,e){void 0!==t._modalScaleSave?(t.scaleX=t._modalScaleSave,t.scaleY=t._modalScaleSave):t._modalScaleSave=t.scaleX,Ti(t,e)},scaleDown(t,e){ki(t,e,void 0,void 0,!1)},fadeIn(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Ii(t,e)},fadeOut(t,e){Fi(t,e,!1)}},Us=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Ii(t,e,t.alpha)},$s=function(t,e){Fi(t,e,!1)},Js=function(t,e,i,s,r){return!(!t||s&&!s(t,e,i)||!rt(t,!0).contains(e,i)||r&&!r(t,e,i))};const qs=Phaser.Utils.Objects.GetValue;let Ks=class extends As{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=Zs.popUp),null==e.transitOut&&(e.transitOut=Zs.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 Ns(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",Us)),this.setCoverTransitOutCallback(qs(i,"transitOut",$s)));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&&Js(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=Zs[t]),t){case Zs.popUp:t=Gs.popUp;break;case Zs.fadeIn:t=Gs.fadeIn}return super.setTransitInCallback(t),this}setTransitOutCallback(t){switch("string"==typeof t&&(t=Zs[t]),t){case Zs.scaleDown:t=Gs.scaleDown;break;case Zs.fadeOut:t=Gs.fadeOut}return super.setTransitOutCallback(t),this}setCoverTransitInCallback(t){return this.coverTransitInCallback=t,this}setCoverTransitOutCallback(t){return this.coverTransitOutCallback=t,this}};const Zs={popUp:0,fadeIn:1,scaleDown:0,fadeOut:1};var Qs=function(t){return t&&"function"==typeof t},tr={modal(t,e){return Qs(t)&&(e=t,t=void 0),void 0===this._modalBehavior&&(this.onCreateModalBehavior&&this.onCreateModalBehavior(this,t),this._modalBehavior=function(t,e){var i=new Ks(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}},er=function(t,e,i,s,r){Qs(e)&&(r=s,s=i,i=e,e=this);var n=this.scene.events;return this.bindEvent(e,n,t,i,s,r),this},ir={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 er.call(this,"preupdate",t,e,i,s),this},bindSceneUpdateEvent(t,e,i,s){return er.call(this,"update",t,e,i,s),this},bindScenePostupdateEvent(t,e,i,s){return er.call(this,"postupdate",t,e,i,s),this},bindSceneRenderEvent(t,e,i,s){return er.call(this,"render",t,e,i,s),this},bindScenePauseEvent(t,e,i,s){return er.call(this,"pause",t,e,i,s),this},bindSceneResumeEvent(t,e,i,s){return er.call(this,"resume",t,e,i,s),this},bindSceneSleepEvent(t,e,i,s){return er.call(this,"sleep",t,e,i,s),this},bindSceneWakeEvent(t,e,i,s){return er.call(this,"wake",t,e,i,s),this},bindSceneShutdownEvent(t,e,i,s){return er.call(this,"shutdown",t,e,i,s),this}},sr=function(t,e,i){var s=t.camera;return s?(void 0===i?i={}:!0===i&&(i=rr),s===e?(i.x=t.worldX,i.y=t.worldY):s.getWorldPoint(t.x,t.y,i),i):null},rr={},nr=function(t,e,i,s){var r,n=t.scene.sys.cameras.main,h=0===t.scrollFactorX&&0===t.scrollFactorY;if(e)return h?Js(t,e.x,e.y,i,s):!!(r=sr(e,n,!0))&&Js(t,r.x,r.y,i,s);for(var o=t.scene.input.manager,a=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 fr={press:0,pointerdown:0,release:1,pointerup:1};var mr={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 gr(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}},yr=function(t,e,i,s,r){if(e)return!(i&&!i(t,e)||!br(t,e)||s&&!s(t,e));void 0===r&&(r=!1);for(var n=t.scene.input.manager,h=n.pointersTotal,o=n.pointers,a=0;a0)return Cr.length=0,!0;return Cr.length=0,!1},Cr=[];const xr=Phaser.Utils.Objects.GetValue;class wr extends Qe{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=Sr[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?yr:nr)(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 Sr={press:0,pointerdown:0,release:1,pointerup:1};var Pr={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 Or extends ks{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 _r=Phaser.Utils.Objects.GetValue;class Tr extends Qe{constructor(t,e){super(t,e),this._enable=void 0,this.cooldown=new Or,this.parent.setInteractive(_r(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.prevIsInTouch=!1,this.isInTouching=!1,this.setEnable(_r(t,"enable",!0)),this.setCooldown(_r(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 kr={isPointerInBounds(t){return void 0===t?t=this:"string"==typeof t&&(t=this.getElement(t)),!!t&&nr(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 Tr(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 Tr(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}},Er={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,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=Gr,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===Ur&&this.onDragEnd(),this.pointer=void 0,this.tracerState=Gr,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=$r,this}isPointerInGameObject(t,e,i){var s=this.lastPointer;return!!s&&nr(t,s,e,i)}}const Gr=0,Ur=1,$r="IDLE",Jr=Phaser.Utils.Objects.GetValue,qr=Phaser.Math.Distance.Between;class Kr extends Nr{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=Zr},eventEmitter:!1};this.setRecongizedStateObject(new ks(s))}resetFromJSON(t){super.resetFromJSON(t),this.setHoldTime(Jr(t,"time",250)),this.setTapInterval(Jr(t,"tapInterval",200)),this.setDragThreshold(Jr(t,"threshold",9)),this.setTapOffset(Jr(t,"tapOffset",10));var e=Jr(t,"taps",void 0);return void 0!==e?this.setTaps(e):(this.setMaxTaps(Jr(t,"maxTaps",void 0)),this.setMinTaps(Jr(t,"minTaps",void 0))),this}onDragStart(){switch(this.state){case Zr:this.state=Qr;break;case Qr:var t=this.lastPointer;qr(t.upX,t.upY,t.x,t.y)>this.tapOffset&&(this.state=tn,this.state=Qr);break;case tn:this.state=Qr}}onDragEnd(){this.state===Qr&&(this.tapsCount++,this.emit("tapping",this,this.gameObject,this.lastPointer),void 0!==this.maxTaps&&this.tapsCount===this.maxTaps&&(this.state=tn))}onDrag(){this.state!==Zr&&this.pointer.getDistance()>this.dragThreshold&&(this.state=Zr)}preUpdate(t,e){if(this.isRunning&&this.enable&&this.state===Qr){var i=this.lastPointer;i.isDown?t-i.downTime>this.holdTime&&(this.state=Zr):t-i.upTime>this.tapInterval&&(void 0===this.minTaps||this.tapsCount>=this.minTaps?this.state=tn:this.state=Zr)}}postUpdate(t,e){this.isRunning&&this.enable&&this.state===tn&&(this.state=Zr)}get isTapped(){return this.state===tn}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 Zr="IDLE",Qr="BEGIN",tn="RECOGNIZED",en=Phaser.Utils.Objects.GetValue;class sn extends Nr{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=rn},eventEmitter:!1};this.setRecongizedStateObject(new ks(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(en(t,"threshold",9)),this.setHoldTime(en(t,"time",251)),this}onDragStart(){this.state=nn,0===this.holdTime&&(this.state=hn)}onDragEnd(){this.state=rn}onDrag(){this.state!==rn&&this.pointer.getDistance()>this.dragThreshold&&(this.state=rn)}preUpdate(t,e){this.isRunning&&this.enable&&this.state===nn&&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 rn="IDLE",nn="BEGIN",hn="RECOGNIZED";Phaser.Utils.Objects.GetValue;var on=function(t){return Ke(t).loop.delta};const an=Phaser.Math.Distance.Between,ln=Phaser.Math.Angle.Between;var dn={getDt:function(){return on(this.scene)},getVelocity:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return an(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 ln(e.x,e.y,t.x,t.y)}},cn={"up&down":0,"left&right":1,"4dir":2,"8dir":3},un={};const pn=Phaser.Utils.Objects.GetValue,vn=Phaser.Math.RadToDeg;class gn extends Nr{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=fn},eventEmitter:!1};this.setRecongizedStateObject(new ks(s)),this.clearDirectionStates()}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(pn(t,"threshold",10)),this.setVelocityThreshold(pn(t,"velocityThreshold",1e3)),this.setDirectionMode(pn(t,"dir","8dir")),this}onDragStart(){this.state=mn}onDragEnd(){this.state=fn}onDrag(){this.state===mn&&(this.validDrag||(this.validDrag=0===this.dragThreshold||this.pointer.getDistance()>=this.dragThreshold),this.validDrag&&this.dragVelocity>this.velocityThreshold&&(this.state=yn))}postUpdate(t,e){this.isRunning&&this.enable&&this.state===yn&&(this.state=fn)}get isSwiped(){return this.state===yn}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=un),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}}(vn(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,dn);const fn="IDLE",mn="BEGIN",yn="RECOGNIZED",bn=Phaser.Utils.Objects.GetValue,Cn=Phaser.Utils.Array.SpliceOne,xn=Phaser.Math.Distance.Between,wn=Phaser.Math.Angle.Between;class Sn{constructor(t,e){var i=$e(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(bn(e,"inputConfig",void 0)),this.setEventEmitter(bn(e,"eventEmitter",void 0)),this._enable=void 0,this.pointers=[],this.movedState={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setEnable(bn(t,"enable",!0)),this.bounds=bn(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=_n,this.onDrag1Start();break;case _n: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],Cn(this.pointers,e),this.tracerState){case _n:this.tracerState=On,this.onDrag1End();break;case Tn:this.tracerState=_n,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 _n: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 xn(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 wn(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;Pn.x=e.x-i.x,Pn.y=e.y-i.y}else Pn.x=0,Pn.y=0;return Pn}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&&nr(t,s,e,i)}isPointer1InGameObject(t,e,i){var s=this.pointers[1];return!!s&&nr(t,s,e,i)}}Object.assign(Sn.prototype,Ne);var Pn={};const On=0,_n=1,Tn=2,kn="IDLE";Phaser.Utils.Objects.GetValue;const En=Phaser.Math.RotateAround;var Mn=function(t,e,i,s){return En(t,e,i,s),t.rotation+=s,t},Dn={};const Rn=Phaser.Utils.Objects.GetValue,Ln=Phaser.Math.Angle.WrapDegrees,Xn=Phaser.Math.Angle.ShortestBetween,Yn=Phaser.Math.RadToDeg,An=Phaser.Math.DegToRad;var zn={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=Dn),i.getWorldPoint(t,e,s),s}(this.centerX,this.centerY,e,!0),n=r.x,h=r.y,o=this.rotation;if(Array.isArray(t))for(var a=t,l=0,d=a.length;l=this.dragThreshold&&this.pointers[1].getDistance()>=this.dragThreshold){var t=Ln(Yn(this.angleBetween));this.angle=Xn(this.prevAngle,t),this.prevAngle=t,this.state=In}break;case In:t=Ln(Yn(this.angleBetween)),this.angle=Xn(this.prevAngle,t),this.prevAngle=t,this.emit("rotate",this)}}get isRotated(){return this.state===In}get rotation(){return An(this.angle)}setDragThreshold(t){return this.dragThreshold=t,this}}.prototype,zn);const Wn="IDLE",jn="BEGIN",In="RECOGNIZED",Fn=Phaser.Utils.Objects.GetValue;var Bn=function(t){var e=Fn(t,"tap",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._tap=new Kr(this,e),this._tap.on("tap",(function(t,e,s){Dr(i.eventEmitter,`${i.eventNamePrefix}${t.tapsCount}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Vn=Phaser.Utils.Objects.GetValue;var Hn=function(t){var e=Vn(t,"press",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._press=new sn(this,e),this._press.on("pressstart",(function(t,e,s){Dr(i.eventEmitter,`${i.eventNamePrefix}pressstart`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this).on("pressend",(function(t,e,s){Dr(i.eventEmitter,`${i.eventNamePrefix}pressend`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Nn=Phaser.Utils.Objects.GetValue;var Gn=function(t){var e=Nn(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";Dr(i.eventEmitter,`${i.eventNamePrefix}swipe${r}`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Un=Phaser.Utils.Objects.GetValue;var $n=function(t,e){return t.setInteractive(),Un(e,"dropZone",!1)&&(t.input.dropZone=!0),t._childrenInteractive={targetSizers:Un(e,"targets",[t]),targetMode:Un(e,"targetMode","parent"),eventEmitter:Un(e,"eventEmitter",t),eventNamePrefix:Un(e,"inputEventPrefix","child.")},Lr.call(t,e),Ar.call(t,e),jr.call(t,e),Vr.call(t,e),Bn.call(t,e),Hn.call(t,e),Gn.call(t,e),t},Jn={getSizerConfig:function(t){return void 0===t&&(t=this),Et(t)},getChildPrevState:function(t){var e=Et(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,h,o=t.scene;if("number"==typeof e)i=e;else{i=oe(e,"color"),s=oe(e,"lineWidth");var a=oe(e,"name",!1);a&&(r=oe(a,"createTextCallback",le),n=oe(a,"createTextCallbackScope",void 0),"string"==typeof(h=oe(a,"align","left-top"))&&(h=Yt[h]))}if(void 0===i&&(i=16777215),void 0===s&&(s=1),r&&!t.children){t.children=new ae(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)}}for(var d,c,u=this.getAllShownChildren([this]),p=0,v=u.length;p(i=0===this.orientation?Math.abs(a.left-t):Math.abs(a.top-e))&&(n=i,r=h)}return a=s[s.length-1],n>(i=0===this.orientation?Math.abs(a.right-t):Math.abs(a.bottom-e))&&(n=i,r=h+1),r};const rh=Phaser.Utils.Objects.IsPlainObject,nh=Phaser.Utils.Objects.GetValue,hh=Phaser.Display.Align.CENTER,oh={min:0,full:-1};var ah=function(t,e,i,s,r,n,h,o,a,l){ve.call(this,t);var d=t.isRexSpace,c=typeof e;if(null===e)return this;if("number"===c);else if("string"===c)e=oh[e];else if(rh(e)){var u;e=nh(u=e,"proportion",void 0),i=nh(u,"align",hh),s=nh(u,"padding",0),r=nh(u,"expand",!1),n=nh(u,"key",void 0),h=nh(u,"index",void 0),t.isRexSizer||(o=nh(u,"minWidth",void 0),a=nh(u,"minHeight",void 0)),l=nh(u,"fitRatio",0)}return"string"==typeof i&&(i=Yt[i]),void 0===e&&(e=d?1:0),void 0===i&&(i=hh),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===o&&(d?o=0:t.isRexSizer||(o=t._minWidth)),void 0===a&&(d?a=0:t.isRexSizer||(a=t._minHeight)),void 0===l||!1===l?l=0:!0===l&&(l=Q(t)/tt(t)),(u=this.getSizerConfig(t)).proportion=e,u.align=i,u.padding=ue(s),u.expand=r,u.fitRatio=0===e?l:0,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===o?Q(t):o:t.minHeight=void 0===a?tt(t):a),r&&(0===this.orientation?t.minHeight=a:t.minWidth=o)),void 0!==n&&this.addChildrenMap(n,t),this},lh={add:ah,addSpace(t){return this.insertSpace(void 0,t),this},insertSpace(t,e){return void 0===e&&(e=1),ah.call(this,new ih(this.scene),{proportion:e,minWidth:0,minHeight:0,index:t}),this},insert(t,e,i,s,r,n,h,o){return rh(i)&&(i.index=t),ah.call(this,e,i,s,r,n,h,t,o),this},insertAtPosition(t,e,i,s,r,n,h,o,a){var l=sh.call(this,t,e);return-1===l&&(l=void 0),this.insert(l,i,s,r,n,h,o,a),this}};const dh=kt.prototype.clear;var ch=function(t){this.backgroundChildren&&(this.backgroundChildren.length=0);var e,i=!t&&this.sizerEventsEnable;if(i&&(e=this.getChildren([])),dh.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}},vh={getChildAlign(t){return this.getSizerConfig(t).align},setChildAlign(t,e){return"string"==typeof e&&(e=Yt[e]),this.getSizerConfig(t).align=e,this}},gh={getChildProportion(t){return this.getSizerConfig(t).proportion},setChildProportion(t,e){return this.getSizerConfig(t).proportion=e,this}},fh={getChildExpand(t){return this.getSizerConfig(t).expand},setChildExpand(t,e){return this.getSizerConfig(t).expand=e,this}},mh={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}},yh={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,h=0,o=this.sizerChildren,a=!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?a=!0:n=0)):n=0,a||(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=o.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?a=!0:n=0)):n=0,a||(n+=((r=i.padding).top+r.bottom)*this.scaleY,c?c=!1:n+=this.space.item*this.scaleY,h+=n)))}return a?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&&(Fe(t,0,0),e.resolved=!1,this.hasRatioFitChild=!0);return this._childrenProportion=void 0,this.hasProportion0Child=!1,this.proportionLength=void 0,We.call(this),this},layoutChildren:function(){for(var t,e,i,s,r,n,h,o,a,l,d=this.sizerChildren,c=this.innerLeft,u=this.innerTop,p=this.innerWidth,v=this.innerHeight,g=c,f=u,m=this.startChildIndex,y=0,b=d.length;y0?(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)||Re.call(this)},runWidthWrap:function(t){this.wrapResult||(1===this.orientation&&th.call(this,t,void 0),Le.call(this,t))},hasHeightWrap:function(){return!(!this.hasRatioFitChild||0!==this.orientation)||Ye.call(this)},runHeightWrap:function(t){this.wrapResult||(0===this.orientation&&th.call(this,void 0,t),Ae.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(yh,lh,ph,vh,gh,fh,mh);var bh=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 xh=Phaser.Utils.Objects.IsPlainObject,wh=Phaser.Utils.Objects.GetValue;class Sh extends Kn{constructor(t,e,i,s,r,n,h){xh(e)?(e=wh(h=e,"x",0),i=wh(h,"y",0),s=wh(h,"width",void 0),r=wh(h,"height",void 0),n=wh(h,"orientation",0)):xh(s)?(s=wh(h=s,"width",void 0),r=wh(h,"height",void 0),n=wh(h,"orientation",0)):xh(n)&&(n=wh(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(wh(h,"space.item",0)),this.setStartChildIndex(wh(h,"startChildIndex",0)),this.setRTL(wh(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=bh.call(this)),this._childrenProportion}}Object.assign(Sh.prototype,yh);var Ph={v:0,vertical:0,y:0,h:1,horizontal:1,x:1,xy:2,vh:2},Oh=function(t){var e=!!t.sliderY||!!t.scrollerY,i=!!t.sliderX||!!t.scrollerX;return e&&i?2:e?0:i?1:0},_h=function(){return Array.prototype.reduce.call(arguments,Th,0)},Th=function(t,e){return t+e};const kh=Phaser.Utils.Objects.IsPlainObject,Eh=Phaser.Utils.Objects.GetValue,Mh=Phaser.Display.Align.CENTER;var Dh=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 Lh(this.sizerChildren,null),ch.call(this,t),this}},Yh={setColumnSpace(t){if(this.space.column||(this.space.column=[]),this.space.column.length=this.columnCount-1,"number"==typeof t)Lh(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},jh={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,h=0,o=this.sizerChildren,a=!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===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,Lh(this.sizerChildren,null),this.columnProportions=[],this.columnProportions.length=t,"number"==typeof i)Lh(this.columnProportions,i);else for(var n=0;n0?e+=t:0===t&&(this.hasColumnProportion0Child=!0);return e},Fh=function(){for(var t,e=0,i=0;i0?e+=t:0===t&&(this.hasRowProportion0Child=!0);return e};const Bh=Phaser.Utils.Objects.IsPlainObject,Vh=Phaser.Utils.Objects.GetValue;class Hh extends Kn{constructor(t,e,i,s,r,n,h,o,a,l){Bh(e)?(e=Vh(l=e,"x",0),i=Vh(l,"y",0),s=Vh(l,"width",void 0),r=Vh(l,"height",void 0),n=Vh(l,"column",l.col||0),h=Vh(l,"row",0),o=Vh(l,"columnProportions",0),a=Vh(l,"rowProportions",0)):Bh(s)?(s=Vh(l=s,"width",void 0),r=Vh(l,"height",void 0),n=Vh(l,"column",l.col||0),h=Vh(l,"row",0),o=Vh(l,"columnProportions",0),a=Vh(l,"rowProportions",0)):Bh(n)?(n=Vh(l=n,"column",l.col||0),h=Vh(l,"row",0),o=Vh(l,"columnProportions",0),a=Vh(l,"rowProportions",0)):Bh(o)&&(o=Vh(l=o,"columnProportions",0),a=Vh(l,"rowProportions",0)),super(t,e,i,s,r,l),this.type="rexGridSizer",this.sizerChildren=[],this.addChildrenMap("items",this.sizerChildren),this.setCreateCellContainerCallback(Vh(l,"createCellContainerCallback")),this.setIndentLeft(Vh(l,"space.indentLeftOdd",0),Vh(l,"space.indentLeftEven",0)),this.setIndentTop(Vh(l,"space.indentTopOdd",0),Vh(l,"space.indentTopEven",0)),this.resetGrid(n,h,o,a,Vh(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=Ih.call(this)),this._totalColumnProportions}get totalRowProportions(){return void 0===this._totalRowProportions&&(this._totalRowProportions=Fh.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(Hh.prototype,jh);const Nh=Phaser.Utils.Objects.GetValue;var Gh=Phaser.Renderer.WebGL.Utils,Uh=function(t,e,i,s,r,n){for(var h=Gh.getTintAppendFloatAlpha(i.fillColor,i.fillAlpha*s),o=i.pathData,a=i.pathIndexes,l=0;l>>16,o=(65280&r)>>>8,a=255&r;t.fillStyle="rgba("+h+","+o+","+a+","+n+")"},Zh=function(t,e,i,s){var r=i||e.strokeColor,n=s||e.strokeAlpha,h=(16711680&r)>>>16,o=(65280&r)>>>8,a=255&r;t.strokeStyle="rgba("+h+","+o+","+a+","+n+")",t.lineWidth=e.lineWidth};const Qh=Phaser.Renderer.Canvas.SetTransform;var to={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),o=e._displayOriginX,a=e._displayOriginY,l=i.alpha*e.alpha;t.pipelines.preBatch(e),e.isFilled&&Uh(r,h,e,l,o,a),e.isStroked&&Jh(r,e,l,o,a),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(Qh(t,r,e,i,s)){var n=e._displayOriginX,h=e._displayOriginY,o=e.pathData,a=o.length-1,l=o[0]-n,d=o[1]-h;r.beginPath(),r.moveTo(l,d),e.closePath||(a-=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(io.prototype,to);const so=Phaser.Utils.Objects.GetValue;let ro=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=so(t,"x",0),i=so(t,"y",0));var s=this.cornerRadius;s.tl=no(so(t,"tl",void 0),e,i),s.tr=no(so(t,"tr",void 0),e,i),s.bl=no(so(t,"bl",void 0),e,i),s.br=no(so(t,"br",void 0),e,i)}get radiusTL(){var t=this.cornerRadius.tl;return Math.max(t.x,t.y)}set radiusTL(t){ho(this.cornerRadius.tl,t)}get radiusTR(){var t=this.cornerRadius.tr;return Math.max(t.x,t.y)}set radiusTR(t){ho(this.cornerRadius.tr,t)}get radiusBL(){var t=this.cornerRadius.bl;return Math.max(t.x,t.y)}set radiusBL(t){ho(this.cornerRadius.bl,t)}get radiusBR(){var t=this.cornerRadius.br;return Math.max(t.x,t.y)}set radiusBR(t){ho(this.cornerRadius.br,t)}};var no=function(t,e,i){return void 0===t?t={x:e,y:i}:"number"==typeof t&&(t={x:t,y:t}),oo(t),t},ho=function(t,e){"number"==typeof e?(t.x=e,t.y=e):(t.x=so(e,"x",0),t.y=so(e,"y",0)),oo(t)},oo=function(t){t.convex=t.x>=0||t.y>=0,t.x=Math.abs(t.x),t.y=Math.abs(t.y)},ao=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 lo=Phaser.Math.DegToRad;var co=function(t,e,i,s,r,n,h,o,a){h&&n>r?n-=360:!h&&n0&&t.y>0};const mo={rectangle:0,circle:1};var yo=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},bo=function(t,e,i){if(void 0===i&&(i={}),Array.isArray(e))for(var s=0,r=e.length;s0,h=0,o=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};const ga=Phaser.Utils.Objects.GetValue,fa=Phaser.Utils.Objects.IsPlainObject;class ma extends(Fo(Lo)){constructor(t,e,i,s,r,n,h,o){fa(e)?(e=ga(o=e,"x",0),i=ga(o,"y",0),s=ga(o,"width",2),r=ga(o,"height",2),n=ga(o,"barColor",void 0),h=ga(o,"value",0)):fa(s)?(s=ga(o=s,"width",2),r=ga(o,"height",2),n=ga(o,"barColor",void 0),h=ga(o,"value",0)):fa(n)&&(n=ga(o=n,"barColor",void 0),h=ga(o,"value",0)),super(t,e,i,s,r,o),this.type="rexLineProgress",this.bootProgressBase(o),this.addShape((new pa).setName("trackFill")).addShape((new pa).setName("bar")).addShape((new pa).setName("trackStroke")),this.setTrackColor(ga(o,"trackColor",void 0)),this.setBarColor(n),this.setTrackStroke(ga(o,"trackStrokeThickness",2),ga(o,"trackStrokeColor",void 0)),this.setSkewX(ga(o,"skewX",0)),this.setRTL(ga(o,"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 ya={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&&va(s,0,0,e,i,t).close();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),va(h,r,0,n,i,t).close());var o=this.getShape("trackStroke");o.lineStyle(this.trackStrokeThickness,this.trackStrokeColor),o.isStroked&&va(o,0,0,e,i,t).end()}};Object.assign(ma.prototype,ya);var ba=function(t){return null==t||""===t||0===t.length},Ca=function(t,e,i,s){if(void 0===s&&(s="."),"object"==typeof t){if(ba(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(ba(e));else{var r;"string"==typeof e&&(e=e.split("."));for(var n=0,h=e.length;nWa(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]=Wa(t[i]));return e}const ja=Phaser.Utils.Objects.IsPlainObject,Ia=Phaser.Utils.Objects.GetValue;var Fa=function(t){return"string"==typeof t&&(t=Ba[t]),t};const Ba={scale:0,repeat:1};var Va=function(t,e){return 0===t||t===this.columns.count-1||0===e||e===this.rows.count-1},Ha={_beginDraw:At,_drawImage:At,_drawTileSprite:At,_endDraw:At,setGetFrameNameCallback:function(t){return void 0===t&&(t=za),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=Wa(i),s=Wa(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,o=0,a=0,l=i.length;a0?h/o:0,c=n.height,u=0;for(a=0,l=s.length;a0?0:g,b=0,a=0;for(var S=i.length;a0?0:f),f>=1&&g>=1){var P=typeof(m=this.getFrameNameCallback(a,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,o,a=this.columns.minWidth*this.maxFixedPartScaleX,l=this.rows.minHeight*this.maxFixedPartScaleY,d=this.width-a,c=this.height-l,u=d>=0?this.maxFixedPartScaleX:this.width/a,p=c>=0?this.maxFixedPartScaleY:this.height/l;if(this.preserveRatio){var v=Math.min(u,p);if(u>v){var g=(u-v)*a;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&&o>0&&(0==(0===n.stretch&&0===r.stretch||0===this.getStretchMode(x,b)?0:1)?this._drawImage(this.textureKey,s,m,y,h,o):this._drawTileSprite(this.textureKey,s,m,y,h,o)),m+=h;y+=o}this._endDraw()},setStretchMode:function(t){return ja(t)?(this.stretchMode.edge=Fa(Ia(t,"edge",0)),this.stretchMode.internal=Fa(Ia(t,"internal",0))):(t=Fa(t),this.stretchMode.edge=t,this.stretchMode.internal=t),this},getStretchMode:function(t,e){return Va.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 Na=Phaser.Utils.Objects.IsPlainObject,Ga=Phaser.Utils.Objects.GetValue,Ua=Phaser.GameObjects;var $a=void 0,Ja=function(t,e){if($a||($a={},Ke(t).events.once("destroy",(function(){for(var t in $a)$a[t].destroy();$a=void 0}))),!$a.hasOwnProperty(e)){var i=Ke(t).scene.systemScene;(t=new Ua[e](i)).setOrigin(0),$a[e]=t}return $a[e]};const qa=Phaser.GameObjects.RenderTexture;class Ka extends(function(t,e){class i extends t{constructor(t,i,s,r,n,h,o,a,l,d){if(Na(i)?(i=Ga(d=i,"x",0),s=Ga(d,"y",0),r=Ga(d,"width",1),n=Ga(d,"height",1),h=Ga(d,"key",void 0),o=Ga(d,"baseFrame",void 0),a=Ga(d,"columns",void 0),l=Ga(d,"rows",void 0)):Na(r)?(r=Ga(d=r,"width",1),n=Ga(d,"height",1),h=Ga(d,"key",void 0),o=Ga(d,"baseFrame",void 0),a=Ga(d,"columns",void 0),l=Ga(d,"rows",void 0)):Na(h)?(h=Ga(d=h,"key",void 0),o=Ga(d,"baseFrame",void 0),a=Ga(d,"columns",void 0),l=Ga(d,"rows",void 0)):Na(o)?(o=Ga(d=o,"baseFrame",void 0),a=Ga(d,"columns",void 0),l=Ga(d,"rows",void 0)):Array.isArray(o)?(d=l,l=a,a=o,o=Ga(d,"baseFrame",void 0)):Na(a)&&(a=Ga(d=a,"columns",void 0),l=Ga(d,"rows",void 0)),void 0===o&&(o=Ga(d,"frame",void 0)),void 0===a){var c=Ga(d,"leftWidth",void 0),u=Ga(d,"rightWidth",void 0);void 0!==c&&void 0!==u&&(a=[c,void 0,u])}if(void 0===l){var p=Ga(d,"topHeight",void 0),v=Ga(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(Ga(d,"getFrameNameCallback",void 0)),this.setStretchMode(Ga(d,"stretchMode",0)),this.setPreserveRatio(Ga(d,"preserveRatio",!0));var g=Ga(d,"maxFixedPartScale",1),f=Ga(d,"maxFixedPartScaleX",g),m=Ga(d,"maxFixedPartScaleY",void 0);this.setMaxFixedPartScale(f,m),this.setBaseTexture(h,o,a,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,Ha),i}(qa,"rexNinePatch")){}var Za={_drawImage:function(t,e,i,s,r,n){var h=Ja(this,"Image").setTexture(t,e).setDisplaySize(r,n);this.draw(h,i,s)},_drawTileSprite:function(t,e,i,s,r,n){var h=Ja(this,"TileSprite").setTexture(t,e).setSize(r,n);this.draw(h,i,s)}};Object.assign(Ka.prototype,Za);class Qa extends Qe{constructor(t,e){return super(t),new Proxy(this,this)}get(t,e){if(Sa(t,e))return t[e];var i=t.parent;return Sa(i,e)?i[e]:void 0}set(t,e,i){return Sa(t,e)?t[e]=i:Sa(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 Ka{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexStatesNinePatch";var i=tl(e,"effects",!0);i&&ka(this,i),this.style=new Qa(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign(el.prototype,Oo);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 xa(t,e);break;case"image":s=new Aa(t,e);break;case"nineSlice":s=e.hasOwnProperty("stretchMode")?new el(t,e):new Ra(t,e);break;default:s=new _o(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 Xl=Phaser.Utils.Objects.GetValue,Yl=Phaser.Math.Distance.Between;class Al extends Qe{constructor(t,e){super(t,e),this._enable=void 0,this.rectBoundsInteractive=Xl(e,"rectBoundsInteractive",!1),this.rectBoundsInteractive||t.setInteractive(Xl(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(Xl(t,"enable",!0)),this.holdThreshold=Xl(t,"holdThreshold",50),this.pointerOutReleaseEnable=Xl(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 on(this.scene)}get speed(){return this.x===this.preX&&this.y===this.preY?0:Yl(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&&!nr(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&&!nr(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 Wl{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 jl{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 Vl={y:0,v:0,vertical:0,x:1,h:1,horizontal:1},Hl=Phaser.Utils.Objects.GetValue;class Nl extends Qe{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||nr(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()),o=2===t.scrollMode,a=t.childrenMap.child,l=`slider${i}`;if(r=o||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=ft(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);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))&&(o?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[`adaptThumb${i}SizeMode`]=Gl(r,"adaptThumbSize",!1),t[`minThumb${i}Size`]=Gl(r,"minThumbSize",void 0)}else t[`hideUnscrollableSlider${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=o||s.hasOwnProperty(C)?Gl(s,C,!0):Gl(s,"scroller",!0))&&a&&(!0===m&&(m={}),m.orientation=h?0:1,void 0!==b&&(m.rectBoundsInteractive=1===b),y=new Bl(a,m),a.isRexContainerLite&&a.sendChildToBack(a));var x,w,S,P,O,_=Gl(s,o?`mouseWheelScroller${i}`:"mouseWheelScroller",!1);_&&a&&(void 0!==b&&(_.focus=1===b?2:0),x=new Nl(a,_)),t.addChildrenMap(`slider${i}`,n),t.addChildrenMap(`scroller${i}`,y),t.addChildrenMap(`mouseWheelScroller${i}`,x),o&&!h||(t.hideUnscrollableSlider=t[`hideUnscrollableSlider${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&&(o?(w=h?"t":"s",P=`scroll${i}`):(w="t",P="scroll"),n.on("valuechange",(function(e){t[w]=e,t.emit(P,t)}))),y&&(o?(S=`childO${i}`,P=`scroll${i}`):(S="childOY",P="scroll"),y.on("valuechange",(function(e){t[S]=e,t.emit(P,t)}))),x&&(O=o?`addChildO${i}`:"addChildOY",x.on("scroll",(function(e){t[O](-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 o=new Hh(i,{column:3,row:3,columnProportions:s,rowProportions:r});switch(function(t,e,i){var s=Nh(i,"child"),r=Nh(s,"gameObject",void 0);if(r){var n=Nh(i,"space.child",0);t.childMargin={};var h=t.childMargin,o={};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=Nh(n,"top",0),h.bottom=Nh(n,"bottom",0),o.left=Nh(n,"left",0),o.right=Nh(n,"right",0);break;case 1:h.top=Nh(n,"left",0),h.bottom=Nh(n,"right",0),o.top=Nh(n,"top",0),o.bottom=Nh(n,"bottom",0);break;default:h.top=Nh(n,"top",0),h.bottom=Nh(n,"bottom",0),h.left=Nh(n,"left",0),h.right=Nh(n,"right",0)}e.add(r,{column:1,row:1,align:Nh(s,"align","center"),padding:o,expand:{width:Nh(s,"expandWidth",!0),height:Nh(s,"expandHeight",!0)}})}t.addChildrenMap("child",r)}(t,o,e),t.scrollMode){case 0:Ul(t,o,"y",e);break;case 1:Ul(t,o,"x",e);break;default:Ul(t,o,"y",e),Ul(t,o,"x",e)}return o},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}`]}if(s){var n="Y"===t?this.scaleY:this.scaleX;s.setBounds(e,i*n)}r&&r.setEnable(e!==i)},Ql=function(t){switch(this.scrollMode){case 0:case 1:(e=this.childrenMap.slider)&&this.hideUnscrollableSlider&&this.setChildVisible(e,this.isOverflow);break;default:t=t.toUpperCase();var e=this.childrenMap[`slider${t}`],i=this[`hideUnscrollableSlider${t}`],s=this[`isOverflow${t}`];e&&i&&this.setChildVisible(e,s)}},td=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}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(Ad.prototype,Rd);const zd=Phaser.Utils.String.Pad;var Wd=function(t,e,i){if(null==t)return t;switch(typeof t){case"string":default:return t;case"number":return`#${zd(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}},jd=function(t,e,i){return e.hasOwnProperty(t)?e[t]:i[t]};const Id=Phaser.Math.DegToRad;var Fd=function(t){return!t.hasOwnProperty("convex")||t.convex},Bd=function(t){return t.x>0&&t.y>0},Vd=function(t,e,i,s,r,n,h,o,a){if(o&&h>n?h-=360:!o&&h=p?1:s/p,f=r>=v?1:r/v,m=u.cornerRadius;t.save(),t.beginPath(),t.translate(e,i),o=m.tl,Bd(o)?(a=o.x*g,l=o.y*f,Fd(o)?Vd(t,a,l,a,l,180,270,!1,h):Vd(t,0,0,a,l,90,0,!0,h),d=0,c=l):(t.lineTo(0,0),d=0,c=0),o=m.tr,Bd(o)?(a=o.x*g,l=o.y*f,Fd(o)?Vd(t,s-a,l,a,l,270,360,!1,h):Vd(t,s,0,a,l,180,90,!0,h)):t.lineTo(s,0),o=m.br,Bd(o)?(a=o.x*g,l=o.y*f,Fd(o)?Vd(t,s-a,r-l,a,l,0,90,!1,h):Vd(t,s,r,a,l,270,180,!0,h)):t.lineTo(s,r),o=m.bl,Bd(o)?(a=o.x*g,l=o.y*f,Fd(o)?Vd(t,a,r-l,a,l,90,180,!1,h):Vd(t,0,r,a,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!=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!=a&&l>0&&(e.strokeStyle=a,e.lineWidth=l,e.stroke())};const Nd=Phaser.Utils.Objects.GetValue;class Gd extends Ad{constructor(t,e){super(t,"background"),this.setScrollFactor(0),this.setColor(Nd(e,"color",null),Nd(e,"color2",null),Nd(e,"horizontalGradient",!0)),this.setStroke(Nd(e,"stroke",null),Nd(e,"strokeThickness",2)),this.setCornerRadius(Nd(e,"cornerRadius",0),Nd(e,"cornerIteration",null))}set color(t){t=Wd(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=Wd(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=Wd(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,jd("color2",t,this),jd("horizontalGradient",t,this)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,jd("strokeThickness",t,this)),t.hasOwnProperty("cornerRadius")&&this.setCornerRadius(t.cornerRadius,jd("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,o){if(null!=e||null!=i){var a=t.canvas.width,l=t.canvas.height;null==i&&(s=0);var d=s/2;a=Math.max(1,a-s),l=Math.max(1,l-s),Hd(t.canvas,t.context,d,d,a,l,r,e,i,s,n,h,o)}}(this.parent,this.color,this.stroke,this.strokeThickness,this.cornerRadius,this.color2,this.horizontalGradient,this.cornerIteration)}}const Ud=Phaser.Utils.Objects.GetValue;class $d extends Ad{constructor(t,e){super(t,"innerbounds"),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))}set color(t){t=Wd(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=Wd(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=Wd(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,Ud(t,"color2",null),Ud(t,"horizontalGradient",!0)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,Ud(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,o=this.context;null!=this.color&&(null!=this.color2?((e=this.horizontalGradient?o.createLinearGradient(0,0,n,0):o.createLinearGradient(0,0,0,h)).addColorStop(0,this.color),e.addColorStop(1,this.color2),t=e):t=this.color,o.fillStyle=t,o.fillRect(s,r,n,h));null!=this.stroke&&this.strokeThickness>0&&(o.strokeStyle=this.stroke,o.lineWidth=this.strokeThickness,o.strokeRect(s,r,n,h))}}const Jd=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(Jd(t,"bold",!1)),this.setItalic(Jd(t,"italic",!1)),this.setFontSize(Jd(t,"fontSize","16px")),this.setFontFamily(Jd(t,"fontFamily","Courier")),this.setColor(Jd(t,"color","#fff")),this.setStrokeStyle(Jd(t,"stroke",null),Jd(t,"strokeThickness",0)),this.setShadow(Jd(t,"shadowColor",null),Jd(t,"shadowOffsetX",0),Jd(t,"shadowOffsetY",0),Jd(t,"shadowBlur",0)),this.setOffset(Jd(t,"offsetX",0),Jd(t,"offsetY",0)),this.setSpace(Jd(t,"leftSpace",0),Jd(t,"rightSpace",0)),this.setAlign(Jd(t,"align",void 0)),this.setBackgroundColor(Jd(t,"backgroundColor",null)),this.setBackgroundHeight(Jd(t,"backgroundHeight",void 0)),this.setBackgroundBottomY(Jd(t,"backgroundBottomY",void 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(jd("stroke",t,this),jd("strokeThickness",t,this)),t.hasOwnProperty("shadowColor")&&this.setShadowColor(t.shadowColor),(t.hasOwnProperty("shadowOffsetX")||t.hasOwnProperty("shadowOffsetY"))&&this.setShadowOffset(jd("shadowOffsetX",t,this),jd("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),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=Wd(t),this}get hasFill(){return null!=this.color}setStrokeStyle(t,e){return this.stroke=Wd(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=Wd(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=Wd(t),this}get hasBackgroundColor(){return null!=this.backgroundColor}setBackgroundHeight(t){return this.backgroundHeight=t,this}setBackgroundBottomY(t){return this.backgroundBottomY=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 Kd=Phaser.Utils.Array.Remove,Zd=Phaser.Utils.Array.Remove,Qd="text",tc="image",ec="drawer",ic="space",sc="command";var rc=function(t){return t.type===Qd&&"\n"===t.text},nc=function(t){return t.type===Qd&&"\f"===t.text},hc=function(t){return t.type===Qd};class oc extends Ad{constructor(t,e,i){super(t,Qd),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,s=this.drawTRX-i+1,r=e.backgroundBottomY;null==r&&(r=this.drawBLY);var n=e.backgroundHeight;null==n&&(n=r-this.drawTLY);var h=r-n;t.fillRect(i,h,s,n)}var o=e.hasFill,a=e.hasStroke;(o||a)&&(e.syncFont(t).syncStyle(t),a&&(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 ac=function(t,e){var i=this.createCharChildren(t,e);return this.addChild(i),this};const lc=Phaser.Display.Canvas.CanvasPool;Phaser.Display.Canvas.CanvasPool;class dc extends Ad{constructor(t,e,i){super(t,tc),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,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 a=e.getContext("2d",{willReadFrequently:!0});if(h){var l=lc.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),a.drawImage(l,0,0,r,n,i,s,r,n),lc.remove(l)}else a.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 cc extends Ad{constructor(t,e,i,s){super(t,ec),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 uc extends Ad{constructor(t,e){super(t,ic),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 pc extends fd{constructor(t,e,i,s,r){super(t,sc),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 vc=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 gc={none:0,word:1,char:2,character:2,mix:3};var fc=/^[\x00-\x7F]+$/,mc=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,o=!n&&!h,a=t.length,l=e,d=s.word,c=0,u=!1;l0&&!o){var a=this.fixedHeight-s;i>0?n=a/i:(n=(l=xc.call(this)).height,h=l.ascent,i=Math.floor((a-h)/n))}else{var l;n=(l=xc.call(this)).height,h=l.ascent}}else this.fixedHeight>0?void 0===(i=Sc(t,"maxLines"))&&(a=this.fixedHeight-s,i=Math.floor(a/n)):i=Sc(t,"maxLines",0);void 0===h&&(h=n);var d=0===i,c=Sc(t,"wrapMode");void 0===c&&(c=Sc(t,"charWrap",!1)?"char":"word"),"string"==typeof c&&(c=gc[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),v=Sc(t,"hAlign",0),g=Sc(t,"vAlign",0),f=Sc(t,"justifyPercentage",.25),m=vc({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,o=t.justifyPercentage,a=t.lines,l=0,d=a.length;l0?(h=this.fixedWidth-r)/i:0;else if(this.fixedWidth>0){if(void 0===(i=_c(t,"maxLines",void 0))){var h=this.fixedWidth-r;i=Math.floor(h/n)+1}}else i=_c(t,"maxLines",0);var o=0===i,a=_c(t,"fixedCharacterHeight",void 0);if(void 0===a){var l=_c(t,"charPerLine",void 0);if(void 0!==l){var d=this.fixedHeight-s;a=Math.floor(d/l)}}var c=_c(t,"wrapHeight",void 0);void 0===c&&(c=this.fixedHeight>0?this.fixedHeight-s:1/0);for(var u=_c(t,"letterSpacing",0),p=_c(t,"rtl",!0),v=_c(t,"hAlign",p?2:0),g=_c(t,"vAlign",0),f=vc({callback:"runVerticalWrap",start:e,padding:this.wrapPadding,letterSpacing:u,maxLines:i,hAlign:v,vAlign:g,lineWidth:n,fixedCharacterHeight:a,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,o=t.rtl,a=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=a.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 Ee(i,t,e),this.dirty=this.dirty||s!=i.left||r!=i.right||n!=i.top||h!=i.bottom,this},getPadding:function(t){return ke(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),Kd(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 Zd(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(Qd);return null===i?i=new oc(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)),Dd(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 Kc=Phaser.Utils.Objects.GetFastValue;var Zc={};class Qc{constructor(t){this.pools=Kc(t,"pools",Zc)}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&&a=i&&ai.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,o=t.drawY,a=h+t.drawTLX,l=h+t.drawTRX,d=o+t.drawTLY,c=o+t.drawBLY;e=a<0?0-a: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)):(wu(this),Su(this)),this}setNumberInput(){return this.onUpdateCallback=xu,this}setSelectAllWhenFocusEnable(t){return void 0===t&&(t=!0),this.selectAllWhenFocus=t,this}setRequestCursorPosition(t){return this.isOpened?(this.requestCursorPosition=t,this):this}}const _u=Phaser.Utils.Objects.GetValue,Tu=["inputType","onOpen","clickOutSideTarget","onFocus","onClose","onBlur","onUpdate","enterClose","readOnly","maxLength","minLength","selectAll"];var ku=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(o,o+h.count));o+=h.count,h.added||(a+=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}Yu.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,o=t.length,a=1,l=h+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>=h&&c+1>=o)return n([{value:this.join(e),count:e.length}]);function u(){for(let s=-1*a;s<=a;s+=2){let a,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>=o)return n(Au(r,a.components,e,t,r.useLongestToken));d[s]=a}else d[s]=void 0}var i;a++}if(s)!function t(){setTimeout((function(){if(a>l)return s();u()||t()}),0)}();else for(;a<=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,o=h-s,a=0;for(;h+1t,tokenize:t=>t.split(""),join:t=>t.join("")};const zu=new Yu,Wu=/^[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,ju=/\S/,Iu=new Yu;Iu.equals=function(t,e){return this.options.ignoreCase&&(t=t.toLowerCase(),e=e.toLowerCase()),t===e||this.options.ignoreWhitespace&&!ju.test(t)&&!ju.test(e)},Iu.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(Hu(t,null,null,i),i," ")},Vu.equals=function(t,e){return Yu.prototype.equals.call(Vu,t.replace(/,([\r\n])/g,"$1"),e.replace(/,([\r\n])/g,"$1"))};const Nu=new Yu;Nu.tokenize=function(t){return t.slice()},Nu.join=Nu.removeEmpty=function(t){return t};const Gu=Phaser.Utils.Array.Remove;var Uu=function(t,e){var i=t.text;if(e!==i){if(null==i&&(i=""),Gu(t.children,t.lastInsertCursor),""===e)t.removeChildren();else for(var s=(a=i,l=e,zu.diff(a,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},Zu={cursorMoveLeft(){if(!this.isOpened)return this;var t=Ju(this.cursorPosition-1,0,this.inputText.length);return this.setCursorPosition(t),this},cursorMoveRight(){if(!this.isOpened)return this;var t=Ju(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=Ju(Ku(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=Ju(Ku(this.characterCountOfLines,t),0,this.inputText.length);return this.setCursorPosition(e),this}};const Qu=Phaser.Utils.Objects.IsPlainObject;class tp extends iu{constructor(t,e,i,s,r,n){Qu(e)?n=e:Qu(s)&&(n=s),void 0===n&&(n={}),function(t,e){var i=!e.textArea;if(ku(e,"wrap.vAlign")||Ca(e,"wrap.vAlign",s=i?"center":"top"),ku(e,"wrap.wrapMode")||Ca(e,"wrap.wrapMode","char"),ku(e,"wrap.maxLines")||Ca(e,"wrap.maxLines",s=i?1:void 0),i&&Ca(e,"wrap.wrapWidth",1/0),ku(e,"wrap.useDefaultTextHeight")||Ca(e,"wrap.useDefaultTextHeight",!0),e.edit||(e.edit={}),!ku(e.edit,"inputType")){var s=i?"text":"textarea";Ca(e.edit,"inputType",s)}if(!0===e.clickOutSideTarget){var r=new Mu(t);t.add.existing(r),e.clickOutSideTarget=r}}(t,n);var h=n.text;h&&delete n.text;var o=yo(n.background,"focus"),a=yo(n.style,"cursor");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=_u(e,"edit");return void 0===i&&(i={}),nu(e,i,Tu),new Ou(t,i)}(this,n),Du.call(this),n.focusStyle&&Object.assign(o,n.focusStyle),Xu.call(this,o),n.cursorStyle&&Object.assign(a,n.cursorStyle),Lu.call(this,a);var l=n.onAddChar;l&&this.on("addchar",l);var d=n.onCursorOut;d&&this.on("cursorout",d);var c=n.onCursorIn;c&&this.on("cursorin",c);var u,p=n.onMoveCursor;p&&this.on("movecursor",p),this.setParseTextCallback(n.parseTextCallback),this.lastInsertCursor=((u=this.createCharChild("|")).text="",u),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}},Oe=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 _e=/(\S+)\[(\d+)\]/i,Te=Phaser.Utils.Objects.GetValue;var ke=function(t,e){return void 0===e?t:t[e]},Ee=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=Te(e,"left",0),t.right=Te(e,"right",0),t.top=Te(e,"top",0),t.bottom=Te(e,"bottom",0)),t},Me={getInnerPadding(t){return ke(this.space,t)},setInnerPadding(t,e){return Ee(this.space,t,e),this},getOuterPadding(t){return ke(this.getSizerConfig(this).padding,t)},setOuterPadding(t,e){return Ee(this.getSizerConfig(this).padding,t,e),this},getChildOuterPadding(t,e){return"string"==typeof t&&(t=this.getElement(t)),ke(this.getSizerConfig(t).padding,e)},setChildOuterPadding(t,e,i){return"string"==typeof t&&(t=this.getElement(t)),Ee(this.getSizerConfig(t).padding,e,i),this}},De=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}},Re=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},Le=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}},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},Ae=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},ze={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}},We=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?vi:pi,this.repeatCounter=0,this}stop(){return this.state=ui,this}update(t,e){this.state!==ui&&this.state!==fi&&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=gi)):(this.nowTime=this.duration,this.state=fi):this.nowTime>=0&&(this.state=vi))}get t(){var t;switch(this.state){case ui:case pi:case gi:t=0;break;case vi:t=this.nowTime/this.duration;break;case fi:t=1}return di(t,0,1)}set t(t){(t=di(t,-1,1))<0?(this.state=pi,this.nowTime=-this.delay*t):(this.state=vi,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===ui}get isDelay(){return this.state===pi}get isCountDown(){return this.state===vi}get isRunning(){return this.state===pi||this.state===vi}get isDone(){return this.state===fi}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}}const ui=0,pi=1,vi=2,gi=3,fi=-1;class mi extends oi{constructor(t,e){super(t,e),this.timer=new ci}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 yi=Phaser.Utils.Objects.GetValue,bi=Phaser.Utils.Objects.GetAdvancedValue,Ci=Phaser.Tweens.Builders.GetEaseFunction;class xi extends mi{resetFromJSON(t){return this.timer.resetFromJSON(yi(t,"timer")),this.setEnable(yi(t,"enable",!0)),this.setTarget(yi(t,"target",this.parent)),this.setDelay(bi(t,"delay",0)),this.setDuration(bi(t,"duration",1e3)),this.setEase(yi(t,"ease","Linear")),this.setRepeat(yi(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 wi=Phaser.Utils.Objects.GetValue,Si=Phaser.Utils.Objects.GetAdvancedValue,Pi=Phaser.Math.Linear;let Oi=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(Si(t,"start",void 0),Si(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=_i[t]),this.mode=t,this}setScaleRange(t,e){return"number"==typeof t?(this.startX=t,this.startY=t):(this.startX=Si(t,"x",this.parent.scaleX),this.startY=Si(t,"y",this.parent.scaleY)),"number"==typeof e?(this.endX=e,this.endY=e):(this.endX=Si(e,"x",void 0),this.endY=Si(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=Pi(this.startX,this.endX,i)),this.hasScaleY&&(t.scaleY=Pi(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}};const _i={stop:0,destroy:1,yoyo:2};var Ti=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 o={mode:0,start:n,end:h,duration:e,ease:s};return void 0===r?r=new Oi(t,o):r.resetFromJSON(o),r.restart(),r},ki=function(t,e,i,s,r,n){void 0===s&&(s="Linear"),r instanceof Oi&&(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 Oi(t,h):n.resetFromJSON(h),n.restart(),n},Ei=function(t,e){return new Promise((function(i,s){t.once(e,(function(){i()}))}))},Mi=function(t){return Ei(t,"complete")};const Di=Phaser.Utils.Objects.IsPlainObject;var Ri={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(Di(t)){var s=t;t=s.duration,e=s.orientation,i=s.ease}var r=void 0===this._scaleBehavior;return this._scaleBehavior=Ti(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(Di(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=ki(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(Di(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 o,a;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},a={x:i};break;case 1:case"y":o={y:t.scaleX},a={y:i};break;default:o=t.scaleX,a=i}var l={mode:2,start:o,end:a,duration:e/2,ease:n,repeat:s};return void 0===h?h=new Oi(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),Mi(this._scaleBehavior)},isRunningScaleYoyo(){return this._scaleBehavior&&(this._scaleBehavior.completeEventName="scaleyoyo.complete")},isRunningEaseScale(){return this.isRunningPopUp()||this.isRunningScaleDown()||this.isRunningScaleYoyo()}},Li={};Object.assign(Li,Ri),Li.onInitScale=function(){Ri.onInitScale.call(this);var t=this;this._scaleBehavior.on("update",(function(){var e=me.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const Xi=Phaser.Utils.Objects.GetValue,Yi=Phaser.Utils.Objects.GetAdvancedValue,Ai=Phaser.Math.Linear;class zi 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(Yi(t,"start",this.parent.alpha),Yi(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=Wi[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=Ai(this.alphaStart,this.alphaEnd,i)}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Wi={stop:0,destroy:1,yoyo:2},ji=Phaser.Utils.Objects.IsPlainObject;var Ii=function(t,e,i,s){var r,n;ji(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 zi(t,h):s.resetFromJSON(h),s.restart(),s},Fi=function(t,e,i,s){i instanceof zi&&(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 zi(t,r):s.resetFromJSON(r),s.restart(),s};const Bi=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(Bi(t)){var i=t;t=i.duration,e=i.alpha}var s=void 0===this._fade;return this._fade=Ii(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(Bi(t)){var i=t;t=i.duration,e=i.destroy}var s=void 0===this._fade;return this._fade=Fi(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()}},Hi={};Object.assign(Hi,Vi),Hi.onInitFade=function(){Vi.onInitFade.call(this);var t=this;this._fade.on("update",(function(){var e=me.getParentSizer(t);e&&e.resetChildAlphaState(t)}))};const Ni=Phaser.Utils.Objects.GetValue,Gi=Phaser.Utils.Objects.GetAdvancedValue,Ui=Phaser.Math.Linear;class $i extends xi{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){if(super.resetFromJSON(t),this.setMode(Ni(t,"mode",0)),t&&(t.hasOwnProperty("x")||t.hasOwnProperty("y"))){var e=Gi(t,"x",void 0),i=Gi(t,"y",void 0);this.setTargetPosition(e,i)}else this.setTargetPosition(t);return this}setMode(t){return"string"==typeof t&&(t=Ji[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=Gi(i,"startX",void 0),this.startY=Gi(i,"startY",void 0),this.endX=Gi(i,"endX",void 0),this.endY=Gi(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=Ui(this.startX,this.endX,i)),this.hasMoveY&&(t.y=Ui(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Ji={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 Ki=Phaser.Utils.Objects.IsPlainObject,Zi=Phaser.Math.Distance.Between;var Qi={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(Ki(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*Zi(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 $i&&(h=n,n=void 0),void 0===n&&(n=!1);var o={};return o.mode=n?1:0,void 0!==i&&(o.startX=qi(i,t.x),o.endX=t.x),void 0!==s&&(o.startY=qi(s,t.y),o.endY=t.y),o.duration=e,o.ease=void 0===r?"Linear":r,void 0===h?h=new $i(t,o):h.resetFromJSON(o),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),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(Ki(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*Zi(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 $i&&(h=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=qi(i,t.x)),void 0!==s&&(o.startY=t.y,o.endY=qi(s,t.y)),o.duration=e,o.ease=void 0===r?"Linear":r,void 0===h?h=new $i(t,o):h.resetFromJSON(o),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),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}},ts={};Object.assign(ts,Qi),ts.onInitEaseMove=function(){Qi.onInitEaseMove.call(this);var t=this;this._easeMove.on("update",(function(){var e=me.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const es=Phaser.Utils.Objects.GetValue;class is extends ri{constructor(t,e){super(t,e),this.timer=new ci,this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.timer.resetFromJSON(es(t,"timer")),this.setEnable(es(t,"enable",!0)),this.setMode(es(t,"mode",1)),this.isRunning=es(t,"isRunning",!1),this.setMagnitudeMode(es(t,"magnitudeMode",1)),this.setAxisMode(es(t,"axis",0)),this.setDuration(es(t,"duration",500)),this.setMagnitude(es(t,"magnitude",10)),this.ox=es(t,"ox",void 0),this.oy=es(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=ss[t]),this.mode=t,this}setMagnitudeMode(t){return"string"==typeof t&&(t=ns[t]),this.magnitudeMode=t,this}setAxisMode(t){return"string"==typeof t&&(t=rs[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=es(i,"magnitude",void 0),t=es(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 ss={effect:0,behavior:1},rs={both:0,"h&v":0,"x&y":0,horizontal:1,h:1,x:1,vertical:2,v:2,y:2},ns={constant:0,decay:1},hs=Phaser.Utils.Objects.IsPlainObject;var os={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 is(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 as=Phaser.Utils.Objects.GetValue,ls=Phaser.Math.Linear;class ds 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=as(t,"key","value");var i=e[this.propertyKey];return this.fromValue=as(t,"from",i),this.toValue=as(t,"to",i),this.setEase(as(t,"ease",this.ease)),this.setDuration(as(t,"duration",this.duration)),this.setRepeat(as(t,"repeat",0)),this.setDelay(as(t,"delay",0)),this.setRepeatDelay(as(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]=ls(this.fromValue,this.toValue,i)}}const cs=Phaser.Utils.Objects.IsPlainObject;class us extends Qe{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 ds(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(cs(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(cs(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 ps={easeDataTo(t,e,i,s){return this._easeData||(this._easeData=new us(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),Ei(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}},vs=Phaser.Utils.Array.Remove,gs={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=$e(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}},Ds={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}},Rs={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}},Ls={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,Ms,Ds,Rs,Ls);const Ys=Phaser.Utils.Objects.GetValue;class As extends Qe{constructor(t,e){super(t,e),this.setTransitInTime(Ys(e,"duration.in",200)),this.setTransitOutTime(Ys(e,"duration.out",200)),this.setTransitInCallback(Ys(e,"transitIn")),this.setTransitOutCallback(Ys(e,"transitOut")),this.oneShotMode=Ys(e,"destroy",!1),this.delayCallTimer=void 0,this._state=new Es(this,{eventEmitter:!1,initState:Ys(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(As.prototype,Xs);var zs=function(t){if(t.parentContainer)return zs(t.parentContainer);var e=function(t){var e=t.displayList;return U(e)?e:null}(t);return e?zs(e):t};class Ws extends Qe{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=zs(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,o=r/2,a=n/2,l=r*h,d=n*h;e.x===o&&e.y===a||e.setPosition(o,a),e.width===l&&e.height===d||e.setSize(l,d)}}}const js=Phaser.GameObjects.Rectangle;let Is=class extends js{constructor(t,e,i){super(t,0,0,2,2,e,1),this.fullWindow=new Ws(this),this.setAlpha(i)}get tint(){return this.fillColor}set tint(t){this.setFillStyle(t,this.fillAlpha)}};const Fs=Phaser.Utils.Objects.GetValue;class Bs extends Qe{constructor(t,e){super(t,{eventEmitter:!1}),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setHitAreaMode(Fs(t,"hitAreaMode",0)),this.setEnable(Fs(t,"enable",!0)),this.setStopMode(Fs(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 Hs=Phaser.Utils.Objects.GetValue;class Ns extends Is{constructor(t,e){super(t,Hs(e,"color",0),Hs(e,"alpha",.8)),this.touchEventStop=new Bs(this,{hitAreaMode:1})}}var Gs={popUp(t,e){void 0!==t._modalScaleSave?(t.scaleX=t._modalScaleSave,t.scaleY=t._modalScaleSave):t._modalScaleSave=t.scaleX,Ti(t,e)},scaleDown(t,e){ki(t,e,void 0,void 0,!1)},fadeIn(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Ii(t,e)},fadeOut(t,e){Fi(t,e,!1)}},Us=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Ii(t,e,t.alpha)},$s=function(t,e){Fi(t,e,!1)},Js=function(t,e,i,s,r){return!(!t||s&&!s(t,e,i)||!rt(t,!0).contains(e,i)||r&&!r(t,e,i))};const qs=Phaser.Utils.Objects.GetValue;let Ks=class extends As{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=Zs.popUp),null==e.transitOut&&(e.transitOut=Zs.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 Ns(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",Us)),this.setCoverTransitOutCallback(qs(i,"transitOut",$s)));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&&Js(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=Zs[t]),t){case Zs.popUp:t=Gs.popUp;break;case Zs.fadeIn:t=Gs.fadeIn}return super.setTransitInCallback(t),this}setTransitOutCallback(t){switch("string"==typeof t&&(t=Zs[t]),t){case Zs.scaleDown:t=Gs.scaleDown;break;case Zs.fadeOut:t=Gs.fadeOut}return super.setTransitOutCallback(t),this}setCoverTransitInCallback(t){return this.coverTransitInCallback=t,this}setCoverTransitOutCallback(t){return this.coverTransitOutCallback=t,this}};const Zs={popUp:0,fadeIn:1,scaleDown:0,fadeOut:1};var Qs=function(t){return t&&"function"==typeof t},tr={modal(t,e){return Qs(t)&&(e=t,t=void 0),void 0===this._modalBehavior&&(this.onCreateModalBehavior&&this.onCreateModalBehavior(this,t),this._modalBehavior=function(t,e){var i=new Ks(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}},er=function(t,e,i,s,r){Qs(e)&&(r=s,s=i,i=e,e=this);var n=this.scene.events;return this.bindEvent(e,n,t,i,s,r),this},ir={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 er.call(this,"preupdate",t,e,i,s),this},bindSceneUpdateEvent(t,e,i,s){return er.call(this,"update",t,e,i,s),this},bindScenePostupdateEvent(t,e,i,s){return er.call(this,"postupdate",t,e,i,s),this},bindSceneRenderEvent(t,e,i,s){return er.call(this,"render",t,e,i,s),this},bindScenePauseEvent(t,e,i,s){return er.call(this,"pause",t,e,i,s),this},bindSceneResumeEvent(t,e,i,s){return er.call(this,"resume",t,e,i,s),this},bindSceneSleepEvent(t,e,i,s){return er.call(this,"sleep",t,e,i,s),this},bindSceneWakeEvent(t,e,i,s){return er.call(this,"wake",t,e,i,s),this},bindSceneShutdownEvent(t,e,i,s){return er.call(this,"shutdown",t,e,i,s),this}},sr=function(t,e,i){var s=t.camera;return s?(void 0===i?i={}:!0===i&&(i=rr),s===e?(i.x=t.worldX,i.y=t.worldY):s.getWorldPoint(t.x,t.y,i),i):null},rr={},nr=function(t,e,i,s){var r,n=t.scene.sys.cameras.main,h=0===t.scrollFactorX&&0===t.scrollFactorY;if(e)return h?Js(t,e.x,e.y,i,s):!!(r=sr(e,n,!0))&&Js(t,r.x,r.y,i,s);for(var o=t.scene.input.manager,a=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 fr={press:0,pointerdown:0,release:1,pointerup:1};var mr={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 gr(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}},yr=function(t,e,i,s,r){if(e)return!(i&&!i(t,e)||!br(t,e)||s&&!s(t,e));void 0===r&&(r=!1);for(var n=t.scene.input.manager,h=n.pointersTotal,o=n.pointers,a=0;a0)return Cr.length=0,!0;return Cr.length=0,!1},Cr=[];const xr=Phaser.Utils.Objects.GetValue;class wr extends Qe{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=Sr[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?yr:nr)(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 Sr={press:0,pointerdown:0,release:1,pointerup:1};var Pr={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 Or extends ks{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 _r=Phaser.Utils.Objects.GetValue;class Tr extends Qe{constructor(t,e){super(t,e),this._enable=void 0,this.cooldown=new Or,this.parent.setInteractive(_r(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.prevIsInTouch=!1,this.isInTouching=!1,this.setEnable(_r(t,"enable",!0)),this.setCooldown(_r(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 kr={isPointerInBounds(t){return void 0===t?t=this:"string"==typeof t&&(t=this.getElement(t)),!!t&&nr(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 Tr(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 Tr(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}},Er={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,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=Gr,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===Ur&&this.onDragEnd(),this.pointer=void 0,this.tracerState=Gr,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=$r,this}isPointerInGameObject(t,e,i){var s=this.lastPointer;return!!s&&nr(t,s,e,i)}}const Gr=0,Ur=1,$r="IDLE",Jr=Phaser.Utils.Objects.GetValue,qr=Phaser.Math.Distance.Between;class Kr extends Nr{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=Zr},eventEmitter:!1};this.setRecongizedStateObject(new ks(s))}resetFromJSON(t){super.resetFromJSON(t),this.setHoldTime(Jr(t,"time",250)),this.setTapInterval(Jr(t,"tapInterval",200)),this.setDragThreshold(Jr(t,"threshold",9)),this.setTapOffset(Jr(t,"tapOffset",10));var e=Jr(t,"taps",void 0);return void 0!==e?this.setTaps(e):(this.setMaxTaps(Jr(t,"maxTaps",void 0)),this.setMinTaps(Jr(t,"minTaps",void 0))),this}onDragStart(){switch(this.state){case Zr:this.state=Qr;break;case Qr:var t=this.lastPointer;qr(t.upX,t.upY,t.x,t.y)>this.tapOffset&&(this.state=tn,this.state=Qr);break;case tn:this.state=Qr}}onDragEnd(){this.state===Qr&&(this.tapsCount++,this.emit("tapping",this,this.gameObject,this.lastPointer),void 0!==this.maxTaps&&this.tapsCount===this.maxTaps&&(this.state=tn))}onDrag(){this.state!==Zr&&this.pointer.getDistance()>this.dragThreshold&&(this.state=Zr)}preUpdate(t,e){if(this.isRunning&&this.enable&&this.state===Qr){var i=this.lastPointer;i.isDown?t-i.downTime>this.holdTime&&(this.state=Zr):t-i.upTime>this.tapInterval&&(void 0===this.minTaps||this.tapsCount>=this.minTaps?this.state=tn:this.state=Zr)}}postUpdate(t,e){this.isRunning&&this.enable&&this.state===tn&&(this.state=Zr)}get isTapped(){return this.state===tn}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 Zr="IDLE",Qr="BEGIN",tn="RECOGNIZED",en=Phaser.Utils.Objects.GetValue;class sn extends Nr{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=rn},eventEmitter:!1};this.setRecongizedStateObject(new ks(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(en(t,"threshold",9)),this.setHoldTime(en(t,"time",251)),this}onDragStart(){this.state=nn,0===this.holdTime&&(this.state=hn)}onDragEnd(){this.state=rn}onDrag(){this.state!==rn&&this.pointer.getDistance()>this.dragThreshold&&(this.state=rn)}preUpdate(t,e){this.isRunning&&this.enable&&this.state===nn&&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 rn="IDLE",nn="BEGIN",hn="RECOGNIZED";Phaser.Utils.Objects.GetValue;var on=function(t){return Ke(t).loop.delta};const an=Phaser.Math.Distance.Between,ln=Phaser.Math.Angle.Between;var dn={getDt:function(){return on(this.scene)},getVelocity:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return an(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 ln(e.x,e.y,t.x,t.y)}},cn={"up&down":0,"left&right":1,"4dir":2,"8dir":3},un={};const pn=Phaser.Utils.Objects.GetValue,vn=Phaser.Math.RadToDeg;class gn extends Nr{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=fn},eventEmitter:!1};this.setRecongizedStateObject(new ks(s)),this.clearDirectionStates()}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(pn(t,"threshold",10)),this.setVelocityThreshold(pn(t,"velocityThreshold",1e3)),this.setDirectionMode(pn(t,"dir","8dir")),this}onDragStart(){this.state=mn}onDragEnd(){this.state=fn}onDrag(){this.state===mn&&(this.validDrag||(this.validDrag=0===this.dragThreshold||this.pointer.getDistance()>=this.dragThreshold),this.validDrag&&this.dragVelocity>this.velocityThreshold&&(this.state=yn))}postUpdate(t,e){this.isRunning&&this.enable&&this.state===yn&&(this.state=fn)}get isSwiped(){return this.state===yn}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=un),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}}(vn(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,dn);const fn="IDLE",mn="BEGIN",yn="RECOGNIZED",bn=Phaser.Utils.Objects.GetValue,Cn=Phaser.Utils.Array.SpliceOne,xn=Phaser.Math.Distance.Between,wn=Phaser.Math.Angle.Between;class Sn{constructor(t,e){var i=$e(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(bn(e,"inputConfig",void 0)),this.setEventEmitter(bn(e,"eventEmitter",void 0)),this._enable=void 0,this.pointers=[],this.movedState={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setEnable(bn(t,"enable",!0)),this.bounds=bn(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=_n,this.onDrag1Start();break;case _n: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],Cn(this.pointers,e),this.tracerState){case _n:this.tracerState=On,this.onDrag1End();break;case Tn:this.tracerState=_n,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 _n: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 xn(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 wn(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;Pn.x=e.x-i.x,Pn.y=e.y-i.y}else Pn.x=0,Pn.y=0;return Pn}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&&nr(t,s,e,i)}isPointer1InGameObject(t,e,i){var s=this.pointers[1];return!!s&&nr(t,s,e,i)}}Object.assign(Sn.prototype,Ne);var Pn={};const On=0,_n=1,Tn=2,kn="IDLE";Phaser.Utils.Objects.GetValue;const En=Phaser.Math.RotateAround;var Mn=function(t,e,i,s){return En(t,e,i,s),t.rotation+=s,t},Dn={};const Rn=Phaser.Utils.Objects.GetValue,Ln=Phaser.Math.Angle.WrapDegrees,Xn=Phaser.Math.Angle.ShortestBetween,Yn=Phaser.Math.RadToDeg,An=Phaser.Math.DegToRad;var zn={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=Dn),i.getWorldPoint(t,e,s),s}(this.centerX,this.centerY,e,!0),n=r.x,h=r.y,o=this.rotation;if(Array.isArray(t))for(var a=t,l=0,d=a.length;l=this.dragThreshold&&this.pointers[1].getDistance()>=this.dragThreshold){var t=Ln(Yn(this.angleBetween));this.angle=Xn(this.prevAngle,t),this.prevAngle=t,this.state=In}break;case In:t=Ln(Yn(this.angleBetween)),this.angle=Xn(this.prevAngle,t),this.prevAngle=t,this.emit("rotate",this)}}get isRotated(){return this.state===In}get rotation(){return An(this.angle)}setDragThreshold(t){return this.dragThreshold=t,this}}.prototype,zn);const Wn="IDLE",jn="BEGIN",In="RECOGNIZED",Fn=Phaser.Utils.Objects.GetValue;var Bn=function(t){var e=Fn(t,"tap",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._tap=new Kr(this,e),this._tap.on("tap",(function(t,e,s){Dr(i.eventEmitter,`${i.eventNamePrefix}${t.tapsCount}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Vn=Phaser.Utils.Objects.GetValue;var Hn=function(t){var e=Vn(t,"press",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._press=new sn(this,e),this._press.on("pressstart",(function(t,e,s){Dr(i.eventEmitter,`${i.eventNamePrefix}pressstart`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this).on("pressend",(function(t,e,s){Dr(i.eventEmitter,`${i.eventNamePrefix}pressend`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Nn=Phaser.Utils.Objects.GetValue;var Gn=function(t){var e=Nn(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";Dr(i.eventEmitter,`${i.eventNamePrefix}swipe${r}`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Un=Phaser.Utils.Objects.GetValue;var $n=function(t,e){return t.setInteractive(),Un(e,"dropZone",!1)&&(t.input.dropZone=!0),t._childrenInteractive={targetSizers:Un(e,"targets",[t]),targetMode:Un(e,"targetMode","parent"),eventEmitter:Un(e,"eventEmitter",t),eventNamePrefix:Un(e,"inputEventPrefix","child.")},Lr.call(t,e),Ar.call(t,e),jr.call(t,e),Vr.call(t,e),Bn.call(t,e),Hn.call(t,e),Gn.call(t,e),t},Jn={getSizerConfig:function(t){return void 0===t&&(t=this),Et(t)},getChildPrevState:function(t){var e=Et(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,h,o=t.scene;if("number"==typeof e)i=e;else{i=oe(e,"color"),s=oe(e,"lineWidth");var a=oe(e,"name",!1);a&&(r=oe(a,"createTextCallback",le),n=oe(a,"createTextCallbackScope",void 0),"string"==typeof(h=oe(a,"align","left-top"))&&(h=Yt[h]))}if(void 0===i&&(i=16777215),void 0===s&&(s=1),r&&!t.children){t.children=new ae(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)}}for(var d,c,u=this.getAllShownChildren([this]),p=0,v=u.length;p(i=0===this.orientation?Math.abs(a.left-t):Math.abs(a.top-e))&&(n=i,r=h)}return a=s[s.length-1],n>(i=0===this.orientation?Math.abs(a.right-t):Math.abs(a.bottom-e))&&(n=i,r=h+1),r};const rh=Phaser.Utils.Objects.IsPlainObject,nh=Phaser.Utils.Objects.GetValue,hh=Phaser.Display.Align.CENTER,oh={min:0,full:-1};var ah=function(t,e,i,s,r,n,h,o,a,l){ve.call(this,t);var d=t.isRexSpace,c=typeof e;if(null===e)return this;if("number"===c);else if("string"===c)e=oh[e];else if(rh(e)){var u;e=nh(u=e,"proportion",void 0),i=nh(u,"align",hh),s=nh(u,"padding",0),r=nh(u,"expand",!1),n=nh(u,"key",void 0),h=nh(u,"index",void 0),t.isRexSizer||(o=nh(u,"minWidth",void 0),a=nh(u,"minHeight",void 0)),l=nh(u,"fitRatio",0)}return"string"==typeof i&&(i=Yt[i]),void 0===e&&(e=d?1:0),void 0===i&&(i=hh),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===o&&(d?o=0:t.isRexSizer||(o=t._minWidth)),void 0===a&&(d?a=0:t.isRexSizer||(a=t._minHeight)),void 0===l||!1===l?l=0:!0===l&&(l=Q(t)/tt(t)),(u=this.getSizerConfig(t)).proportion=e,u.align=i,u.padding=ue(s),u.expand=r,u.fitRatio=0===e?l:0,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===o?Q(t):o:t.minHeight=void 0===a?tt(t):a),r&&(0===this.orientation?t.minHeight=a:t.minWidth=o)),void 0!==n&&this.addChildrenMap(n,t),this},lh={add:ah,addSpace(t){return this.insertSpace(void 0,t),this},insertSpace(t,e){return void 0===e&&(e=1),ah.call(this,new ih(this.scene),{proportion:e,minWidth:0,minHeight:0,index:t}),this},insert(t,e,i,s,r,n,h,o){return rh(i)&&(i.index=t),ah.call(this,e,i,s,r,n,h,t,o),this},insertAtPosition(t,e,i,s,r,n,h,o,a){var l=sh.call(this,t,e);return-1===l&&(l=void 0),this.insert(l,i,s,r,n,h,o,a),this}};const dh=kt.prototype.clear;var ch=function(t){this.backgroundChildren&&(this.backgroundChildren.length=0);var e,i=!t&&this.sizerEventsEnable;if(i&&(e=this.getChildren([])),dh.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}},vh={getChildAlign(t){return this.getSizerConfig(t).align},setChildAlign(t,e){return"string"==typeof e&&(e=Yt[e]),this.getSizerConfig(t).align=e,this}},gh={getChildProportion(t){return this.getSizerConfig(t).proportion},setChildProportion(t,e){return this.getSizerConfig(t).proportion=e,this}},fh={getChildExpand(t){return this.getSizerConfig(t).expand},setChildExpand(t,e){return this.getSizerConfig(t).expand=e,this}},mh={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}},yh={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,h=0,o=this.sizerChildren,a=!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?a=!0:n=0)):n=0,a||(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=o.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?a=!0:n=0)):n=0,a||(n+=((r=i.padding).top+r.bottom)*this.scaleY,c?c=!1:n+=this.space.item*this.scaleY,h+=n)))}return a?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&&(Fe(t,0,0),e.resolved=!1,this.hasRatioFitChild=!0);return this._childrenProportion=void 0,this.hasProportion0Child=!1,this.proportionLength=void 0,We.call(this),this},layoutChildren:function(){for(var t,e,i,s,r,n,h,o,a,l,d=this.sizerChildren,c=this.innerLeft,u=this.innerTop,p=this.innerWidth,v=this.innerHeight,g=c,f=u,m=this.startChildIndex,y=0,b=d.length;y0?(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)||Re.call(this)},runWidthWrap:function(t){this.wrapResult||(1===this.orientation&&th.call(this,t,void 0),Le.call(this,t))},hasHeightWrap:function(){return!(!this.hasRatioFitChild||0!==this.orientation)||Ye.call(this)},runHeightWrap:function(t){this.wrapResult||(0===this.orientation&&th.call(this,void 0,t),Ae.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(yh,lh,ph,vh,gh,fh,mh);var bh=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 xh=Phaser.Utils.Objects.IsPlainObject,wh=Phaser.Utils.Objects.GetValue;class Sh extends Kn{constructor(t,e,i,s,r,n,h){xh(e)?(e=wh(h=e,"x",0),i=wh(h,"y",0),s=wh(h,"width",void 0),r=wh(h,"height",void 0),n=wh(h,"orientation",0)):xh(s)?(s=wh(h=s,"width",void 0),r=wh(h,"height",void 0),n=wh(h,"orientation",0)):xh(n)&&(n=wh(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(wh(h,"space.item",0)),this.setStartChildIndex(wh(h,"startChildIndex",0)),this.setRTL(wh(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=bh.call(this)),this._childrenProportion}}Object.assign(Sh.prototype,yh);var Ph={v:0,vertical:0,y:0,h:1,horizontal:1,x:1,xy:2,vh:2},Oh=function(t){var e=!!t.sliderY||!!t.scrollerY,i=!!t.sliderX||!!t.scrollerX;return e&&i?2:e?0:i?1:0},_h=function(){return Array.prototype.reduce.call(arguments,Th,0)},Th=function(t,e){return t+e};const kh=Phaser.Utils.Objects.IsPlainObject,Eh=Phaser.Utils.Objects.GetValue,Mh=Phaser.Display.Align.CENTER;var Dh=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 Lh(this.sizerChildren,null),ch.call(this,t),this}},Yh={setColumnSpace(t){if(this.space.column||(this.space.column=[]),this.space.column.length=this.columnCount-1,"number"==typeof t)Lh(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},jh={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,h=0,o=this.sizerChildren,a=!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===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,Lh(this.sizerChildren,null),this.columnProportions=[],this.columnProportions.length=t,"number"==typeof i)Lh(this.columnProportions,i);else for(var n=0;n0?e+=t:0===t&&(this.hasColumnProportion0Child=!0);return e},Fh=function(){for(var t,e=0,i=0;i0?e+=t:0===t&&(this.hasRowProportion0Child=!0);return e};const Bh=Phaser.Utils.Objects.IsPlainObject,Vh=Phaser.Utils.Objects.GetValue;class Hh extends Kn{constructor(t,e,i,s,r,n,h,o,a,l){Bh(e)?(e=Vh(l=e,"x",0),i=Vh(l,"y",0),s=Vh(l,"width",void 0),r=Vh(l,"height",void 0),n=Vh(l,"column",l.col||0),h=Vh(l,"row",0),o=Vh(l,"columnProportions",0),a=Vh(l,"rowProportions",0)):Bh(s)?(s=Vh(l=s,"width",void 0),r=Vh(l,"height",void 0),n=Vh(l,"column",l.col||0),h=Vh(l,"row",0),o=Vh(l,"columnProportions",0),a=Vh(l,"rowProportions",0)):Bh(n)?(n=Vh(l=n,"column",l.col||0),h=Vh(l,"row",0),o=Vh(l,"columnProportions",0),a=Vh(l,"rowProportions",0)):Bh(o)&&(o=Vh(l=o,"columnProportions",0),a=Vh(l,"rowProportions",0)),super(t,e,i,s,r,l),this.type="rexGridSizer",this.sizerChildren=[],this.addChildrenMap("items",this.sizerChildren),this.setCreateCellContainerCallback(Vh(l,"createCellContainerCallback")),this.setIndentLeft(Vh(l,"space.indentLeftOdd",0),Vh(l,"space.indentLeftEven",0)),this.setIndentTop(Vh(l,"space.indentTopOdd",0),Vh(l,"space.indentTopEven",0)),this.resetGrid(n,h,o,a,Vh(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=Ih.call(this)),this._totalColumnProportions}get totalRowProportions(){return void 0===this._totalRowProportions&&(this._totalRowProportions=Fh.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(Hh.prototype,jh);const Nh=Phaser.Utils.Objects.GetValue;var Gh=Phaser.Renderer.WebGL.Utils,Uh=function(t,e,i,s,r,n){for(var h=Gh.getTintAppendFloatAlpha(i.fillColor,i.fillAlpha*s),o=i.pathData,a=i.pathIndexes,l=0;l>>16,o=(65280&r)>>>8,a=255&r;t.fillStyle="rgba("+h+","+o+","+a+","+n+")"},Zh=function(t,e,i,s){var r=i||e.strokeColor,n=s||e.strokeAlpha,h=(16711680&r)>>>16,o=(65280&r)>>>8,a=255&r;t.strokeStyle="rgba("+h+","+o+","+a+","+n+")",t.lineWidth=e.lineWidth};const Qh=Phaser.Renderer.Canvas.SetTransform;var to={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),o=e._displayOriginX,a=e._displayOriginY,l=i.alpha*e.alpha;t.pipelines.preBatch(e),e.isFilled&&Uh(r,h,e,l,o,a),e.isStroked&&Jh(r,e,l,o,a),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(Qh(t,r,e,i,s)){var n=e._displayOriginX,h=e._displayOriginY,o=e.pathData,a=o.length-1,l=o[0]-n,d=o[1]-h;r.beginPath(),r.moveTo(l,d),e.closePath||(a-=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(io.prototype,to);const so=Phaser.Utils.Objects.GetValue;let ro=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=so(t,"x",0),i=so(t,"y",0));var s=this.cornerRadius;s.tl=no(so(t,"tl",void 0),e,i),s.tr=no(so(t,"tr",void 0),e,i),s.bl=no(so(t,"bl",void 0),e,i),s.br=no(so(t,"br",void 0),e,i)}get radiusTL(){var t=this.cornerRadius.tl;return Math.max(t.x,t.y)}set radiusTL(t){ho(this.cornerRadius.tl,t)}get radiusTR(){var t=this.cornerRadius.tr;return Math.max(t.x,t.y)}set radiusTR(t){ho(this.cornerRadius.tr,t)}get radiusBL(){var t=this.cornerRadius.bl;return Math.max(t.x,t.y)}set radiusBL(t){ho(this.cornerRadius.bl,t)}get radiusBR(){var t=this.cornerRadius.br;return Math.max(t.x,t.y)}set radiusBR(t){ho(this.cornerRadius.br,t)}};var no=function(t,e,i){return void 0===t?t={x:e,y:i}:"number"==typeof t&&(t={x:t,y:t}),oo(t),t},ho=function(t,e){"number"==typeof e?(t.x=e,t.y=e):(t.x=so(e,"x",0),t.y=so(e,"y",0)),oo(t)},oo=function(t){t.convex=t.x>=0||t.y>=0,t.x=Math.abs(t.x),t.y=Math.abs(t.y)},ao=function(t){return t.x>0&&t.y>0},lo=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 co=Phaser.Math.DegToRad;var uo=function(t,e,i,s,r,n,h,o,a){h&&n>r?n-=360:!h&&n0,h=0,o=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 ga=Phaser.Utils.Objects.GetValue,fa=Phaser.Utils.Objects.IsPlainObject;class ma extends(Fo(Lo)){constructor(t,e,i,s,r,n,h,o){fa(e)?(e=(o=e).x,i=o.y,s=o.width,r=o.height,n=o.barColor,h=o.value):fa(s)?(s=(o=s).width,r=o.height,n=o.barColor,h=o.value):fa(n)&&(n=(o=n).barColor,h=o.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,o),this.type="rexLineProgress",this.bootProgressBase(o),this.addShape((new pa).setName("trackFill")).addShape((new pa).setName("bar")).addShape((new pa).setName("trackStroke")),this.setTrackColor(ga(o,"trackColor",void 0)),this.setBarColor(n),this.setTrackStroke(ga(o,"trackStrokeThickness",2),ga(o,"trackStrokeColor",void 0)),this.setSkewX(ga(o,"skewX",0)),this.setRTL(ga(o,"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 ya={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&&va(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),va(h,r,0,n,i,t));var o=this.getShape("trackStroke");o.lineStyle(this.trackStrokeThickness,this.trackStrokeColor),o.isStroked&&va(o,0,0,e,i,t)}};Object.assign(ma.prototype,ya);var ba=function(t){return null==t||""===t||0===t.length},Ca=function(t,e,i,s){if(void 0===s&&(s="."),"object"==typeof t){if(ba(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(ba(e));else{var r;"string"==typeof e&&(e=e.split("."));for(var n=0,h=e.length;nWa(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]=Wa(t[i]));return e}const ja=Phaser.Utils.Objects.IsPlainObject,Ia=Phaser.Utils.Objects.GetValue;var Fa=function(t){return"string"==typeof t&&(t=Ba[t]),t};const Ba={scale:0,repeat:1};var Va=function(t,e){return 0===t||t===this.columns.count-1||0===e||e===this.rows.count-1},Ha={_beginDraw:At,_drawImage:At,_drawTileSprite:At,_endDraw:At,setGetFrameNameCallback:function(t){return void 0===t&&(t=za),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=Wa(i),s=Wa(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,o=0,a=0,l=i.length;a0?h/o:0,c=n.height,u=0;for(a=0,l=s.length;a0?0:g,b=0,a=0;for(var S=i.length;a0?0:f),f>=1&&g>=1){var P=typeof(m=this.getFrameNameCallback(a,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,o,a=this.columns.minWidth*this.maxFixedPartScaleX,l=this.rows.minHeight*this.maxFixedPartScaleY,d=this.width-a,c=this.height-l,u=d>=0?this.maxFixedPartScaleX:this.width/a,p=c>=0?this.maxFixedPartScaleY:this.height/l;if(this.preserveRatio){var v=Math.min(u,p);if(u>v){var g=(u-v)*a;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&&o>0&&(0==(0===n.stretch&&0===r.stretch||0===this.getStretchMode(x,b)?0:1)?this._drawImage(this.textureKey,s,m,y,h,o):this._drawTileSprite(this.textureKey,s,m,y,h,o)),m+=h;y+=o}this._endDraw()},setStretchMode:function(t){return ja(t)?(this.stretchMode.edge=Fa(Ia(t,"edge",0)),this.stretchMode.internal=Fa(Ia(t,"internal",0))):(t=Fa(t),this.stretchMode.edge=t,this.stretchMode.internal=t),this},getStretchMode:function(t,e){return Va.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 Na=Phaser.Utils.Objects.IsPlainObject,Ga=Phaser.Utils.Objects.GetValue,Ua=Phaser.GameObjects;var $a=void 0,Ja=function(t,e){if($a||($a={},Ke(t).events.once("destroy",(function(){for(var t in $a)$a[t].destroy();$a=void 0}))),!$a.hasOwnProperty(e)){var i=Ke(t).scene.systemScene;(t=new Ua[e](i)).setOrigin(0),$a[e]=t}return $a[e]};const qa=Phaser.GameObjects.RenderTexture;class Ka extends(function(t,e){class i extends t{constructor(t,i,s,r,n,h,o,a,l,d){if(Na(i)?(i=Ga(d=i,"x",0),s=Ga(d,"y",0),r=Ga(d,"width",1),n=Ga(d,"height",1),h=Ga(d,"key",void 0),o=Ga(d,"baseFrame",void 0),a=Ga(d,"columns",void 0),l=Ga(d,"rows",void 0)):Na(r)?(r=Ga(d=r,"width",1),n=Ga(d,"height",1),h=Ga(d,"key",void 0),o=Ga(d,"baseFrame",void 0),a=Ga(d,"columns",void 0),l=Ga(d,"rows",void 0)):Na(h)?(h=Ga(d=h,"key",void 0),o=Ga(d,"baseFrame",void 0),a=Ga(d,"columns",void 0),l=Ga(d,"rows",void 0)):Na(o)?(o=Ga(d=o,"baseFrame",void 0),a=Ga(d,"columns",void 0),l=Ga(d,"rows",void 0)):Array.isArray(o)?(d=l,l=a,a=o,o=Ga(d,"baseFrame",void 0)):Na(a)&&(a=Ga(d=a,"columns",void 0),l=Ga(d,"rows",void 0)),void 0===o&&(o=Ga(d,"frame",void 0)),void 0===a){var c=Ga(d,"leftWidth",void 0),u=Ga(d,"rightWidth",void 0);void 0!==c&&void 0!==u&&(a=[c,void 0,u])}if(void 0===l){var p=Ga(d,"topHeight",void 0),v=Ga(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(Ga(d,"getFrameNameCallback",void 0)),this.setStretchMode(Ga(d,"stretchMode",0)),this.setPreserveRatio(Ga(d,"preserveRatio",!0));var g=Ga(d,"maxFixedPartScale",1),f=Ga(d,"maxFixedPartScaleX",g),m=Ga(d,"maxFixedPartScaleY",void 0);this.setMaxFixedPartScale(f,m),this.setBaseTexture(h,o,a,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,Ha),i}(qa,"rexNinePatch")){}var Za={_drawImage:function(t,e,i,s,r,n){var h=Ja(this,"Image").setTexture(t,e).setDisplaySize(r,n);this.draw(h,i,s)},_drawTileSprite:function(t,e,i,s,r,n){var h=Ja(this,"TileSprite").setTexture(t,e).setSize(r,n);this.draw(h,i,s)}};Object.assign(Ka.prototype,Za);class Qa extends Qe{constructor(t,e){return super(t),new Proxy(this,this)}get(t,e){if(Sa(t,e))return t[e];var i=t.parent;return Sa(i,e)?i[e]:void 0}set(t,e,i){return Sa(t,e)?t[e]=i:Sa(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 Ka{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexStatesNinePatch";var i=tl(e,"effects",!0);i&&ka(this,i),this.style=new Qa(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign(el.prototype,Oo);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 xa(t,e);break;case"image":s=new Aa(t,e);break;case"nineSlice":s=e.hasOwnProperty("stretchMode")?new el(t,e):new Ra(t,e);break;default:s=new _o(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 Xl=Phaser.Utils.Objects.GetValue,Yl=Phaser.Math.Distance.Between;class Al extends Qe{constructor(t,e){super(t,e),this._enable=void 0,this.rectBoundsInteractive=Xl(e,"rectBoundsInteractive",!1),this.rectBoundsInteractive||t.setInteractive(Xl(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(Xl(t,"enable",!0)),this.holdThreshold=Xl(t,"holdThreshold",50),this.pointerOutReleaseEnable=Xl(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 on(this.scene)}get speed(){return this.x===this.preX&&this.y===this.preY?0:Yl(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&&!nr(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&&!nr(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 Wl{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 jl{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 Vl={y:0,v:0,vertical:0,x:1,h:1,horizontal:1},Hl=Phaser.Utils.Objects.GetValue;class Nl extends Qe{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||nr(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()),o=2===t.scrollMode,a=t.childrenMap.child,l=`slider${i}`;if(r=o||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=ft(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);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))&&(o?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[`adaptThumb${i}SizeMode`]=Gl(r,"adaptThumbSize",!1),t[`minThumb${i}Size`]=Gl(r,"minThumbSize",void 0)}else t[`hideUnscrollableSlider${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=o||s.hasOwnProperty(C)?Gl(s,C,!0):Gl(s,"scroller",!0))&&a&&(!0===m&&(m={}),m.orientation=h?0:1,void 0!==b&&(m.rectBoundsInteractive=1===b),y=new Bl(a,m),a.isRexContainerLite&&a.sendChildToBack(a));var x,w,S,P,O,_=Gl(s,o?`mouseWheelScroller${i}`:"mouseWheelScroller",!1);_&&a&&(void 0!==b&&(_.focus=1===b?2:0),x=new Nl(a,_)),t.addChildrenMap(`slider${i}`,n),t.addChildrenMap(`scroller${i}`,y),t.addChildrenMap(`mouseWheelScroller${i}`,x),o&&!h||(t.hideUnscrollableSlider=t[`hideUnscrollableSlider${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&&(o?(w=h?"t":"s",P=`scroll${i}`):(w="t",P="scroll"),n.on("valuechange",(function(e){t[w]=e,t.emit(P,t)}))),y&&(o?(S=`childO${i}`,P=`scroll${i}`):(S="childOY",P="scroll"),y.on("valuechange",(function(e){t[S]=e,t.emit(P,t)}))),x&&(O=o?`addChildO${i}`:"addChildOY",x.on("scroll",(function(e){t[O](-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 o=new Hh(i,{column:3,row:3,columnProportions:s,rowProportions:r});switch(function(t,e,i){var s=Nh(i,"child"),r=Nh(s,"gameObject",void 0);if(r){var n=Nh(i,"space.child",0);t.childMargin={};var h=t.childMargin,o={};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=Nh(n,"top",0),h.bottom=Nh(n,"bottom",0),o.left=Nh(n,"left",0),o.right=Nh(n,"right",0);break;case 1:h.top=Nh(n,"left",0),h.bottom=Nh(n,"right",0),o.top=Nh(n,"top",0),o.bottom=Nh(n,"bottom",0);break;default:h.top=Nh(n,"top",0),h.bottom=Nh(n,"bottom",0),h.left=Nh(n,"left",0),h.right=Nh(n,"right",0)}e.add(r,{column:1,row:1,align:Nh(s,"align","center"),padding:o,expand:{width:Nh(s,"expandWidth",!0),height:Nh(s,"expandHeight",!0)}})}t.addChildrenMap("child",r)}(t,o,e),t.scrollMode){case 0:Ul(t,o,"y",e);break;case 1:Ul(t,o,"x",e);break;default:Ul(t,o,"y",e),Ul(t,o,"x",e)}return o},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}`]}if(s){var n="Y"===t?this.scaleY:this.scaleX;s.setBounds(e,i*n)}r&&r.setEnable(e!==i)},Ql=function(t){switch(this.scrollMode){case 0:case 1:(e=this.childrenMap.slider)&&this.hideUnscrollableSlider&&this.setChildVisible(e,this.isOverflow);break;default:t=t.toUpperCase();var e=this.childrenMap[`slider${t}`],i=this[`hideUnscrollableSlider${t}`],s=this[`isOverflow${t}`];e&&i&&this.setChildVisible(e,s)}},td=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}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(Ad.prototype,Rd);const zd=Phaser.Utils.String.Pad;var Wd=function(t,e,i){if(null==t)return t;switch(typeof t){case"string":default:return t;case"number":return`#${zd(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}},jd=function(t,e,i){return e.hasOwnProperty(t)?e[t]:i[t]};const Id=Phaser.Math.DegToRad;var Fd=function(t){return!t.hasOwnProperty("convex")||t.convex},Bd=function(t){return t.x>0&&t.y>0},Vd=function(t,e,i,s,r,n,h,o,a){if(o&&h>n?h-=360:!o&&h=p?1:s/p,f=r>=v?1:r/v,m=u.cornerRadius;t.save(),t.beginPath(),t.translate(e,i),o=m.tl,Bd(o)?(a=o.x*g,l=o.y*f,Fd(o)?Vd(t,a,l,a,l,180,270,!1,h):Vd(t,0,0,a,l,90,0,!0,h),d=0,c=l):(t.lineTo(0,0),d=0,c=0),o=m.tr,Bd(o)?(a=o.x*g,l=o.y*f,Fd(o)?Vd(t,s-a,l,a,l,270,360,!1,h):Vd(t,s,0,a,l,180,90,!0,h)):t.lineTo(s,0),o=m.br,Bd(o)?(a=o.x*g,l=o.y*f,Fd(o)?Vd(t,s-a,r-l,a,l,0,90,!1,h):Vd(t,s,r,a,l,270,180,!0,h)):t.lineTo(s,r),o=m.bl,Bd(o)?(a=o.x*g,l=o.y*f,Fd(o)?Vd(t,a,r-l,a,l,90,180,!1,h):Vd(t,0,r,a,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!=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!=a&&l>0&&(e.strokeStyle=a,e.lineWidth=l,e.stroke())};const Nd=Phaser.Utils.Objects.GetValue;class Gd extends Ad{constructor(t,e){super(t,"background"),this.setScrollFactor(0),this.setColor(Nd(e,"color",null),Nd(e,"color2",null),Nd(e,"horizontalGradient",!0)),this.setStroke(Nd(e,"stroke",null),Nd(e,"strokeThickness",2)),this.setCornerRadius(Nd(e,"cornerRadius",0),Nd(e,"cornerIteration",null))}set color(t){t=Wd(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=Wd(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=Wd(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,jd("color2",t,this),jd("horizontalGradient",t,this)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,jd("strokeThickness",t,this)),t.hasOwnProperty("cornerRadius")&&this.setCornerRadius(t.cornerRadius,jd("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,o){if(null!=e||null!=i){var a=t.canvas.width,l=t.canvas.height;null==i&&(s=0);var d=s/2;a=Math.max(1,a-s),l=Math.max(1,l-s),Hd(t.canvas,t.context,d,d,a,l,r,e,i,s,n,h,o)}}(this.parent,this.color,this.stroke,this.strokeThickness,this.cornerRadius,this.color2,this.horizontalGradient,this.cornerIteration)}}const Ud=Phaser.Utils.Objects.GetValue;class $d extends Ad{constructor(t,e){super(t,"innerbounds"),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))}set color(t){t=Wd(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=Wd(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=Wd(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,Ud(t,"color2",null),Ud(t,"horizontalGradient",!0)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,Ud(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,o=this.context;null!=this.color&&(null!=this.color2?((e=this.horizontalGradient?o.createLinearGradient(0,0,n,0):o.createLinearGradient(0,0,0,h)).addColorStop(0,this.color),e.addColorStop(1,this.color2),t=e):t=this.color,o.fillStyle=t,o.fillRect(s,r,n,h));null!=this.stroke&&this.strokeThickness>0&&(o.strokeStyle=this.stroke,o.lineWidth=this.strokeThickness,o.strokeRect(s,r,n,h))}}const Jd=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(Jd(t,"bold",!1)),this.setItalic(Jd(t,"italic",!1)),this.setFontSize(Jd(t,"fontSize","16px")),this.setFontFamily(Jd(t,"fontFamily","Courier")),this.setColor(Jd(t,"color","#fff")),this.setStrokeStyle(Jd(t,"stroke",null),Jd(t,"strokeThickness",0)),this.setShadow(Jd(t,"shadowColor",null),Jd(t,"shadowOffsetX",0),Jd(t,"shadowOffsetY",0),Jd(t,"shadowBlur",0)),this.setOffset(Jd(t,"offsetX",0),Jd(t,"offsetY",0)),this.setSpace(Jd(t,"leftSpace",0),Jd(t,"rightSpace",0)),this.setAlign(Jd(t,"align",void 0)),this.setBackgroundColor(Jd(t,"backgroundColor",null)),this.setBackgroundHeight(Jd(t,"backgroundHeight",void 0)),this.setBackgroundBottomY(Jd(t,"backgroundBottomY",void 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(jd("stroke",t,this),jd("strokeThickness",t,this)),t.hasOwnProperty("shadowColor")&&this.setShadowColor(t.shadowColor),(t.hasOwnProperty("shadowOffsetX")||t.hasOwnProperty("shadowOffsetY"))&&this.setShadowOffset(jd("shadowOffsetX",t,this),jd("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),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=Wd(t),this}get hasFill(){return null!=this.color}setStrokeStyle(t,e){return this.stroke=Wd(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=Wd(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=Wd(t),this}get hasBackgroundColor(){return null!=this.backgroundColor}setBackgroundHeight(t){return this.backgroundHeight=t,this}setBackgroundBottomY(t){return this.backgroundBottomY=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 Kd=Phaser.Utils.Array.Remove,Zd=Phaser.Utils.Array.Remove,Qd="text",tc="image",ec="drawer",ic="space",sc="command";var rc=function(t){return t.type===Qd&&"\n"===t.text},nc=function(t){return t.type===Qd&&"\f"===t.text},hc=function(t){return t.type===Qd};class oc extends Ad{constructor(t,e,i){super(t,Qd),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,s=this.drawTRX-i+1,r=e.backgroundBottomY;null==r&&(r=this.drawBLY);var n=e.backgroundHeight;null==n&&(n=r-this.drawTLY);var h=r-n;t.fillRect(i,h,s,n)}var o=e.hasFill,a=e.hasStroke;(o||a)&&(e.syncFont(t).syncStyle(t),a&&(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 ac=function(t,e){var i=this.createCharChildren(t,e);return this.addChild(i),this};const lc=Phaser.Display.Canvas.CanvasPool;Phaser.Display.Canvas.CanvasPool;class dc extends Ad{constructor(t,e,i){super(t,tc),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,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 a=e.getContext("2d",{willReadFrequently:!0});if(h){var l=lc.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),a.drawImage(l,0,0,r,n,i,s,r,n),lc.remove(l)}else a.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 cc extends Ad{constructor(t,e,i,s){super(t,ec),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 uc extends Ad{constructor(t,e){super(t,ic),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 pc extends fd{constructor(t,e,i,s,r){super(t,sc),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 vc=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 gc={none:0,word:1,char:2,character:2,mix:3};var fc=/^[\x00-\x7F]+$/,mc=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,o=!n&&!h,a=t.length,l=e,d=s.word,c=0,u=!1;l0&&!o){var a=this.fixedHeight-s;i>0?n=a/i:(n=(l=xc.call(this)).height,h=l.ascent,i=Math.floor((a-h)/n))}else{var l;n=(l=xc.call(this)).height,h=l.ascent}}else this.fixedHeight>0?void 0===(i=Sc(t,"maxLines"))&&(a=this.fixedHeight-s,i=Math.floor(a/n)):i=Sc(t,"maxLines",0);void 0===h&&(h=n);var d=0===i,c=Sc(t,"wrapMode");void 0===c&&(c=Sc(t,"charWrap",!1)?"char":"word"),"string"==typeof c&&(c=gc[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),v=Sc(t,"hAlign",0),g=Sc(t,"vAlign",0),f=Sc(t,"justifyPercentage",.25),m=vc({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,o=t.justifyPercentage,a=t.lines,l=0,d=a.length;l0?(h=this.fixedWidth-r)/i:0;else if(this.fixedWidth>0){if(void 0===(i=_c(t,"maxLines",void 0))){var h=this.fixedWidth-r;i=Math.floor(h/n)+1}}else i=_c(t,"maxLines",0);var o=0===i,a=_c(t,"fixedCharacterHeight",void 0);if(void 0===a){var l=_c(t,"charPerLine",void 0);if(void 0!==l){var d=this.fixedHeight-s;a=Math.floor(d/l)}}var c=_c(t,"wrapHeight",void 0);void 0===c&&(c=this.fixedHeight>0?this.fixedHeight-s:1/0);for(var u=_c(t,"letterSpacing",0),p=_c(t,"rtl",!0),v=_c(t,"hAlign",p?2:0),g=_c(t,"vAlign",0),f=vc({callback:"runVerticalWrap",start:e,padding:this.wrapPadding,letterSpacing:u,maxLines:i,hAlign:v,vAlign:g,lineWidth:n,fixedCharacterHeight:a,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,o=t.rtl,a=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=a.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 Ee(i,t,e),this.dirty=this.dirty||s!=i.left||r!=i.right||n!=i.top||h!=i.bottom,this},getPadding:function(t){return ke(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),Kd(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 Zd(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(Qd);return null===i?i=new oc(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)),Dd(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 Kc=Phaser.Utils.Objects.GetFastValue;var Zc={};class Qc{constructor(t){this.pools=Kc(t,"pools",Zc)}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&&a=i&&ai.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,o=t.drawY,a=h+t.drawTLX,l=h+t.drawTRX,d=o+t.drawTLY,c=o+t.drawBLY;e=a<0?0-a: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)):(wu(this),Su(this)),this}setNumberInput(){return this.onUpdateCallback=xu,this}setSelectAllWhenFocusEnable(t){return void 0===t&&(t=!0),this.selectAllWhenFocus=t,this}setRequestCursorPosition(t){return this.isOpened?(this.requestCursorPosition=t,this):this}}const _u=Phaser.Utils.Objects.GetValue,Tu=["inputType","onOpen","clickOutSideTarget","onFocus","onClose","onBlur","onUpdate","enterClose","readOnly","maxLength","minLength","selectAll"];var ku=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(o,o+h.count));o+=h.count,h.added||(a+=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}Yu.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,o=t.length,a=1,l=h+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>=h&&c+1>=o)return n([{value:this.join(e),count:e.length}]);function u(){for(let s=-1*a;s<=a;s+=2){let a,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>=o)return n(Au(r,a.components,e,t,r.useLongestToken));d[s]=a}else d[s]=void 0}var i;a++}if(s)!function t(){setTimeout((function(){if(a>l)return s();u()||t()}),0)}();else for(;a<=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,o=h-s,a=0;for(;h+1t,tokenize:t=>t.split(""),join:t=>t.join("")};const zu=new Yu,Wu=/^[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,ju=/\S/,Iu=new Yu;Iu.equals=function(t,e){return this.options.ignoreCase&&(t=t.toLowerCase(),e=e.toLowerCase()),t===e||this.options.ignoreWhitespace&&!ju.test(t)&&!ju.test(e)},Iu.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(Hu(t,null,null,i),i," ")},Vu.equals=function(t,e){return Yu.prototype.equals.call(Vu,t.replace(/,([\r\n])/g,"$1"),e.replace(/,([\r\n])/g,"$1"))};const Nu=new Yu;Nu.tokenize=function(t){return t.slice()},Nu.join=Nu.removeEmpty=function(t){return t};const Gu=Phaser.Utils.Array.Remove;var Uu=function(t,e){var i=t.text;if(e!==i){if(null==i&&(i=""),Gu(t.children,t.lastInsertCursor),""===e)t.removeChildren();else for(var s=(a=i,l=e,zu.diff(a,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},Zu={cursorMoveLeft(){if(!this.isOpened)return this;var t=Ju(this.cursorPosition-1,0,this.inputText.length);return this.setCursorPosition(t),this},cursorMoveRight(){if(!this.isOpened)return this;var t=Ju(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=Ju(Ku(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=Ju(Ku(this.characterCountOfLines,t),0,this.inputText.length);return this.setCursorPosition(e),this}};const Qu=Phaser.Utils.Objects.IsPlainObject;class tp extends iu{constructor(t,e,i,s,r,n){Qu(e)?n=e:Qu(s)&&(n=s),void 0===n&&(n={}),function(t,e){var i=!e.textArea;if(ku(e,"wrap.vAlign")||Ca(e,"wrap.vAlign",s=i?"center":"top"),ku(e,"wrap.wrapMode")||Ca(e,"wrap.wrapMode","char"),ku(e,"wrap.maxLines")||Ca(e,"wrap.maxLines",s=i?1:void 0),i&&Ca(e,"wrap.wrapWidth",1/0),ku(e,"wrap.useDefaultTextHeight")||Ca(e,"wrap.useDefaultTextHeight",!0),e.edit||(e.edit={}),!ku(e.edit,"inputType")){var s=i?"text":"textarea";Ca(e.edit,"inputType",s)}if(!0===e.clickOutSideTarget){var r=new Mu(t);t.add.existing(r),e.clickOutSideTarget=r}}(t,n);var h=n.text;h&&delete n.text;var o=yo(n.background,"focus"),a=yo(n.style,"cursor");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=_u(e,"edit");return void 0===i&&(i={}),nu(e,i,Tu),new Ou(t,i)}(this,n),Du.call(this),n.focusStyle&&Object.assign(o,n.focusStyle),Xu.call(this,o),n.cursorStyle&&Object.assign(a,n.cursorStyle),Lu.call(this,a);var l=n.onAddChar;l&&this.on("addchar",l);var d=n.onCursorOut;d&&this.on("cursorout",d);var c=n.onCursorIn;c&&this.on("cursorin",c);var u,p=n.onMoveCursor;p&&this.on("movecursor",p),this.setParseTextCallback(n.parseTextCallback),this.lastInsertCursor=((u=this.createCharChild("|")).text="",u),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) && (radius.y > 0)); + }; + var LineTo = function (x, y, pathData) { var cnt = pathData.length; if (cnt >= 2) { @@ -14004,8 +14008,7 @@ geom.setTo(0, 0, width, height, radius); } - var iteration = GetValue$N(radiusConfig, 'iteration', undefined); - this.setIteration(iteration); + this.setIteration(GetValue$N(radiusConfig, 'iteration', undefined)); this.setPosition(x, y); this.setFillStyle(fillColor, fillAlpha); @@ -14258,10 +14261,6 @@ } - var IsArcCorner$1 = function (radius) { - return ((radius.x > 0) && (radius.y > 0)); - }; - const ShapeTypeMap = { rectangle: 0, circle: 1 @@ -15847,6 +15846,7 @@ var skewX = this.skewX; var width = this.width - Math.abs(skewX); var height = this.height; + var trackFill = this.getShape('trackFill'); trackFill.fillStyle(this.trackColor); if (trackFill.isFilled) { @@ -15855,8 +15855,7 @@ 0, 0, // x0, y0 width, height, // x1, y1 skewX // skewX - ) - .close(); + ); } var bar = this.getShape('bar'); @@ -15876,8 +15875,7 @@ barX0, 0, // x0, y0 barX1, height, // x1, y1 skewX // skew - ) - .close(); + ); } var trackStroke = this.getShape('trackStroke'); @@ -15888,8 +15886,7 @@ 0, 0, // x0, y0 width, height, // x1, y1 skewX // skewX - ) - .end(); + ); } }; @@ -15909,6 +15906,8 @@ .lineTo(x0, y0).lineTo(startX, y0); } + lines.close(); + return lines; }; @@ -15919,24 +15918,33 @@ constructor(scene, x, y, width, height, barColor, value, config) { if (IsPlainObject$a(x)) { config = x; - x = GetValue$K(config, 'x', 0); - y = GetValue$K(config, 'y', 0); - width = GetValue$K(config, 'width', 2); - height = GetValue$K(config, 'height', 2); - barColor = GetValue$K(config, 'barColor', undefined); - value = GetValue$K(config, 'value', 0); + + x = config.x; + y = config.y; + width = config.width; + height = config.height; + barColor = config.barColor; + value = config.value; } else if (IsPlainObject$a(width)) { config = width; - width = GetValue$K(config, 'width', 2); - height = GetValue$K(config, 'height', 2); - barColor = GetValue$K(config, 'barColor', undefined); - value = GetValue$K(config, 'value', 0); + + width = config.width; + height = config.height; + barColor = config.barColor; + value = config.value; } else if (IsPlainObject$a(barColor)) { config = barColor; - barColor = GetValue$K(config, 'barColor', undefined); - value = GetValue$K(config, 'value', 0); + + barColor = config.barColor; + value = config.value; } + if (x === undefined) { x = 0; } + if (y === undefined) { y = 0; } + if (width === undefined) { width = 2; } + if (height === undefined) { height = width; } + if (value === undefined) { value = 0; } + super(scene, x, y, width, height, config); this.type = 'rexLineProgress'; diff --git a/dist/rextrees.min.js b/dist/rextrees.min.js index 91f5f01c2d..a924094cfa 100644 --- a/dist/rextrees.min.js +++ b/dist/rextrees.min.js @@ -1,4 +1,4 @@ -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 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}},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}},Pe=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,_e=Phaser.Utils.Objects.GetValue;var ke=function(t,e){return void 0===e?t:t[e]},Ee=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=_e(e,"left",0),t.right=_e(e,"right",0),t.top=_e(e,"top",0),t.bottom=_e(e,"bottom",0)),t},Me={getInnerPadding(t){return ke(this.space,t)},setInnerPadding(t,e){return Ee(this.space,t,e),this},getOuterPadding(t){return ke(this.getSizerConfig(this).padding,t)},setOuterPadding(t,e){return Ee(this.getSizerConfig(this).padding,t,e),this},getChildOuterPadding(t,e){return"string"==typeof t&&(t=this.getElement(t)),ke(this.getSizerConfig(t).padding,e)},setChildOuterPadding(t,e,i){return"string"==typeof t&&(t=this.getElement(t)),Ee(this.getSizerConfig(t).padding,e,i),this}},Re=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}},Le=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},De=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}},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},ze=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}},We=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?vi:pi,this.repeatCounter=0,this}stop(){return this.state=ui,this}update(t,e){this.state!==ui&&this.state!==fi&&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=gi)):(this.nowTime=this.duration,this.state=fi):this.nowTime>=0&&(this.state=vi))}get t(){var t;switch(this.state){case ui:case pi:case gi:t=0;break;case vi:t=this.nowTime/this.duration;break;case fi:t=1}return di(t,0,1)}set t(t){(t=di(t,-1,1))<0?(this.state=pi,this.nowTime=-this.delay*t):(this.state=vi,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===ui}get isDelay(){return this.state===pi}get isCountDown(){return this.state===vi}get isRunning(){return this.state===pi||this.state===vi}get isDone(){return this.state===fi}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}}const ui=0,pi=1,vi=2,gi=3,fi=-1;class mi extends ai{constructor(t,e){super(t,e),this.timer=new ci}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 yi=Phaser.Utils.Objects.GetValue,bi=Phaser.Utils.Objects.GetAdvancedValue,xi=Phaser.Tweens.Builders.GetEaseFunction;class wi extends mi{resetFromJSON(t){return this.timer.resetFromJSON(yi(t,"timer")),this.setEnable(yi(t,"enable",!0)),this.setTarget(yi(t,"target",this.parent)),this.setDelay(bi(t,"delay",0)),this.setDuration(bi(t,"duration",1e3)),this.setEase(yi(t,"ease","Linear")),this.setRepeat(yi(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 Si=Phaser.Utils.Objects.GetValue,Ci=Phaser.Utils.Objects.GetAdvancedValue,Oi=Phaser.Math.Linear;let Pi=class extends wi{constructor(t,e){super(t,e),this.scaleStart={},this.scaleEnd={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(Si(t,"mode",0)),this.setScaleRange(Ci(t,"start",void 0),Ci(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=Ci(t,"x",this.parent.scaleX),this.startY=Ci(t,"y",this.parent.scaleY)),"number"==typeof e?(this.endX=e,this.endY=e):(this.endX=Ci(e,"x",void 0),this.endY=Ci(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 _i=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 Pi(t,a):r.resetFromJSON(a),r.restart(),r},ki=function(t,e,i,s,r,n){void 0===s&&(s="Linear"),r instanceof Pi&&(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 Pi(t,h):n.resetFromJSON(h),n.restart(),n},Ei=function(t,e){return new Promise((function(i,s){t.once(e,(function(){i()}))}))},Mi=function(t){return Ei(t,"complete")};const Ri=Phaser.Utils.Objects.IsPlainObject;var Li={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(Ri(t)){var s=t;t=s.duration,e=s.orientation,i=s.ease}var r=void 0===this._scaleBehavior;return this._scaleBehavior=_i(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(Ri(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=ki(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(Ri(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 Pi(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),Mi(this._scaleBehavior)},isRunningScaleYoyo(){return this._scaleBehavior&&(this._scaleBehavior.completeEventName="scaleyoyo.complete")},isRunningEaseScale(){return this.isRunningPopUp()||this.isRunningScaleDown()||this.isRunningScaleYoyo()}},Di={};Object.assign(Di,Li),Di.onInitScale=function(){Li.onInitScale.call(this);var t=this;this._scaleBehavior.on("update",(function(){var e=me.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const Ai=Phaser.Utils.Objects.GetValue,Yi=Phaser.Utils.Objects.GetAdvancedValue,zi=Phaser.Math.Linear;class Xi extends wi{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(Yi(t,"start",this.parent.alpha),Yi(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=Wi[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=zi(this.alphaStart,this.alphaEnd,i)}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Wi={stop:0,destroy:1,yoyo:2},ji=Phaser.Utils.Objects.IsPlainObject;var Fi=function(t,e,i,s){var r,n;ji(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 Xi(t,h):s.resetFromJSON(h),s.restart(),s},Ii=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 Bi=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(Bi(t)){var i=t;t=i.duration,e=i.alpha}var s=void 0===this._fade;return this._fade=Fi(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(Bi(t)){var i=t;t=i.duration,e=i.destroy}var s=void 0===this._fade;return this._fade=Ii(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()}},Ni={};Object.assign(Ni,Hi),Ni.onInitFade=function(){Hi.onInitFade.call(this);var t=this;this._fade.on("update",(function(){var e=me.getParentSizer(t);e&&e.resetChildAlphaState(t)}))};const Gi=Phaser.Utils.Objects.GetValue,Vi=Phaser.Utils.Objects.GetAdvancedValue,Ui=Phaser.Math.Linear;class $i extends wi{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){if(super.resetFromJSON(t),this.setMode(Gi(t,"mode",0)),t&&(t.hasOwnProperty("x")||t.hasOwnProperty("y"))){var e=Vi(t,"x",void 0),i=Vi(t,"y",void 0);this.setTargetPosition(e,i)}else this.setTargetPosition(t);return this}setMode(t){return"string"==typeof t&&(t=Ji[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=Vi(i,"startX",void 0),this.startY=Vi(i,"startY",void 0),this.endX=Vi(i,"endX",void 0),this.endY=Vi(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=Ui(this.startX,this.endX,i)),this.hasMoveY&&(t.y=Ui(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Ji={stop:0,destroy:1,yoyo:2};var Ki=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,Zi=Phaser.Math.Distance.Between;var Qi={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*Zi(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 $i&&(h=n,n=void 0),void 0===n&&(n=!1);var a={};return a.mode=n?1:0,void 0!==i&&(a.startX=Ki(i,t.x),a.endX=t.x),void 0!==s&&(a.startY=Ki(s,t.y),a.endY=t.y),a.duration=e,a.ease=void 0===r?"Linear":r,void 0===h?h=new $i(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),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*Zi(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 $i&&(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=Ki(i,t.x)),void 0!==s&&(a.startY=t.y,a.endY=Ki(s,t.y)),a.duration=e,a.ease=void 0===r?"Linear":r,void 0===h?h=new $i(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),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}},ts={};Object.assign(ts,Qi),ts.onInitEaseMove=function(){Qi.onInitEaseMove.call(this);var t=this;this._easeMove.on("update",(function(){var e=me.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const es=Phaser.Utils.Objects.GetValue;class is extends ri{constructor(t,e){super(t,e),this.timer=new ci,this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.timer.resetFromJSON(es(t,"timer")),this.setEnable(es(t,"enable",!0)),this.setMode(es(t,"mode",1)),this.isRunning=es(t,"isRunning",!1),this.setMagnitudeMode(es(t,"magnitudeMode",1)),this.setAxisMode(es(t,"axis",0)),this.setDuration(es(t,"duration",500)),this.setMagnitude(es(t,"magnitude",10)),this.ox=es(t,"ox",void 0),this.oy=es(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=ss[t]),this.mode=t,this}setMagnitudeMode(t){return"string"==typeof t&&(t=ns[t]),this.magnitudeMode=t,this}setAxisMode(t){return"string"==typeof t&&(t=rs[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=es(i,"magnitude",void 0),t=es(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 ss={effect:0,behavior:1},rs={both:0,"h&v":0,"x&y":0,horizontal:1,h:1,x:1,vertical:2,v:2,y:2},ns={constant:0,decay:1},hs=Phaser.Utils.Objects.IsPlainObject;var as={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 is(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 os=Phaser.Utils.Objects.GetValue,ls=Phaser.Math.Linear;class ds extends wi{constructor(t,e){super(t,e),this.resetFromJSON(),this.boot()}start(t){if(this.timer.isRunning)return this;var e=this.target;this.propertyKey=os(t,"key","value");var i=e[this.propertyKey];return this.fromValue=os(t,"from",i),this.toValue=os(t,"to",i),this.setEase(os(t,"ease",this.ease)),this.setDuration(os(t,"duration",this.duration)),this.setRepeat(os(t,"repeat",0)),this.setDelay(os(t,"delay",0)),this.setRepeatDelay(os(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]=ls(this.fromValue,this.toValue,i)}}const cs=Phaser.Utils.Objects.IsPlainObject;class us extends Qe{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 ds(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(cs(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(cs(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 ps={easeDataTo(t,e,i,s){return this._easeData||(this._easeData=new us(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),Ei(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}},vs=Phaser.Utils.Array.Remove,gs={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=$e(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}},Rs={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}},Ls={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}},Ds={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,Ms,Rs,Ls,Ds);const Ys=Phaser.Utils.Objects.GetValue;class zs extends Qe{constructor(t,e){super(t,e),this.setTransitInTime(Ys(e,"duration.in",200)),this.setTransitOutTime(Ys(e,"duration.out",200)),this.setTransitInCallback(Ys(e,"transitIn")),this.setTransitOutCallback(Ys(e,"transitOut")),this.oneShotMode=Ys(e,"destroy",!1),this.delayCallTimer=void 0,this._state=new Es(this,{eventEmitter:!1,initState:Ys(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(zs.prototype,As);var Xs=function(t){if(t.parentContainer)return Xs(t.parentContainer);var e=function(t){var e=t.displayList;return U(e)?e:null}(t);return e?Xs(e):t};class Ws extends Qe{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=Xs(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 js=Phaser.GameObjects.Rectangle;class Fs extends js{constructor(t,e,i){super(t,0,0,2,2,e,1),this.fullWindow=new Ws(this),this.setAlpha(i)}get tint(){return this.fillColor}set tint(t){this.setFillStyle(t,this.fillAlpha)}}const Is=Phaser.Utils.Objects.GetValue;class Bs extends Qe{constructor(t,e){super(t,{eventEmitter:!1}),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setHitAreaMode(Is(t,"hitAreaMode",0)),this.setEnable(Is(t,"enable",!0)),this.setStopMode(Is(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 Ns=Phaser.Utils.Objects.GetValue;class Gs extends Fs{constructor(t,e){super(t,Ns(e,"color",0),Ns(e,"alpha",.8)),this.touchEventStop=new Bs(this,{hitAreaMode:1})}}var Vs={popUp(t,e){void 0!==t._modalScaleSave?(t.scaleX=t._modalScaleSave,t.scaleY=t._modalScaleSave):t._modalScaleSave=t.scaleX,_i(t,e)},scaleDown(t,e){ki(t,e,void 0,void 0,!1)},fadeIn(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Fi(t,e)},fadeOut(t,e){Ii(t,e,!1)}},Us=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Fi(t,e,t.alpha)},$s=function(t,e){Ii(t,e,!1)},Js=function(t,e,i,s,r){return!(!t||s&&!s(t,e,i)||!rt(t,!0).contains(e,i)||r&&!r(t,e,i))};const Ks=Phaser.Utils.Objects.GetValue;let qs=class extends zs{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=Zs.popUp),null==e.transitOut&&(e.transitOut=Zs.scaleDown),e.destroy=Ks(e,"destroy",!0),super(t,e);var i=Ks(e,"cover");this.cover=!1!==i?function(t,e){var i=t.scene,s=new Gs(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(Ks(i,"transitIn",Us)),this.setCoverTransitOutCallback(Ks(i,"transitOut",$s)));var s=Ks(e,"touchOutsideClose",!1),r=Ks(e,"duration.hold",-1),n=Ks(e,"timeOutClose",r>=0),h=Ks(e,"anyTouchClose",!1);Ks(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),Ks(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&&Js(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=Zs[t]),t){case Zs.popUp:t=Vs.popUp;break;case Zs.fadeIn:t=Vs.fadeIn}return super.setTransitInCallback(t),this}setTransitOutCallback(t){switch("string"==typeof t&&(t=Zs[t]),t){case Zs.scaleDown:t=Vs.scaleDown;break;case Zs.fadeOut:t=Vs.fadeOut}return super.setTransitOutCallback(t),this}setCoverTransitInCallback(t){return this.coverTransitInCallback=t,this}setCoverTransitOutCallback(t){return this.coverTransitOutCallback=t,this}};const Zs={popUp:0,fadeIn:1,scaleDown:0,fadeOut:1};var Qs=function(t){return t&&"function"==typeof t},tr={modal(t,e){return Qs(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}},er=function(t,e,i,s,r){Qs(e)&&(r=s,s=i,i=e,e=this);var n=this.scene.events;return this.bindEvent(e,n,t,i,s,r),this},ir={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 er.call(this,"preupdate",t,e,i,s),this},bindSceneUpdateEvent(t,e,i,s){return er.call(this,"update",t,e,i,s),this},bindScenePostupdateEvent(t,e,i,s){return er.call(this,"postupdate",t,e,i,s),this},bindSceneRenderEvent(t,e,i,s){return er.call(this,"render",t,e,i,s),this},bindScenePauseEvent(t,e,i,s){return er.call(this,"pause",t,e,i,s),this},bindSceneResumeEvent(t,e,i,s){return er.call(this,"resume",t,e,i,s),this},bindSceneSleepEvent(t,e,i,s){return er.call(this,"sleep",t,e,i,s),this},bindSceneWakeEvent(t,e,i,s){return er.call(this,"wake",t,e,i,s),this},bindSceneShutdownEvent(t,e,i,s){return er.call(this,"shutdown",t,e,i,s),this}},sr=function(t,e,i){var s=t.camera;return s?(void 0===i?i={}:!0===i&&(i=rr),s===e?(i.x=t.worldX,i.y=t.worldY):s.getWorldPoint(t.x,t.y,i),i):null},rr={},nr=function(t,e,i,s){var r,n=t.scene.sys.cameras.main,h=0===t.scrollFactorX&&0===t.scrollFactorY;if(e)return h?Js(t,e.x,e.y,i,s):!!(r=sr(e,n,!0))&&Js(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 fr={press:0,pointerdown:0,release:1,pointerup:1};var mr={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 gr(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}},yr=function(t,e,i,s,r){if(e)return!(i&&!i(t,e)||!br(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 wr=Phaser.Utils.Objects.GetValue;class Sr extends Qe{constructor(t,e){super(t,e),this._enable=void 0;var i=wr(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(wr(t,"enable",!0)),this.setMode(wr(t,"mode",1)),this.setClickInterval(wr(t,"clickInterval",100)),this.setDragThreshold(wr(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=Cr[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?yr:nr)(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 Cr={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 Sr(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 Pr extends ks{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 _r extends Qe{constructor(t,e){super(t,e),this._enable=void 0,this.cooldown=new Pr,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 kr={isPointerInBounds(t){return void 0===t?t=this:"string"==typeof t&&(t=this.getElement(t)),!!t&&nr(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 _r(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 _r(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}},Er={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,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=Vr,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===Ur&&this.onDragEnd(),this.pointer=void 0,this.tracerState=Vr,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=$r,this}isPointerInGameObject(t,e,i){var s=this.lastPointer;return!!s&&nr(t,s,e,i)}}const Vr=0,Ur=1,$r="IDLE",Jr=Phaser.Utils.Objects.GetValue,Kr=Phaser.Math.Distance.Between;class qr extends Gr{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=Zr},eventEmitter:!1};this.setRecongizedStateObject(new ks(s))}resetFromJSON(t){super.resetFromJSON(t),this.setHoldTime(Jr(t,"time",250)),this.setTapInterval(Jr(t,"tapInterval",200)),this.setDragThreshold(Jr(t,"threshold",9)),this.setTapOffset(Jr(t,"tapOffset",10));var e=Jr(t,"taps",void 0);return void 0!==e?this.setTaps(e):(this.setMaxTaps(Jr(t,"maxTaps",void 0)),this.setMinTaps(Jr(t,"minTaps",void 0))),this}onDragStart(){switch(this.state){case Zr:this.state=Qr;break;case Qr:var t=this.lastPointer;Kr(t.upX,t.upY,t.x,t.y)>this.tapOffset&&(this.state=tn,this.state=Qr);break;case tn:this.state=Qr}}onDragEnd(){this.state===Qr&&(this.tapsCount++,this.emit("tapping",this,this.gameObject,this.lastPointer),void 0!==this.maxTaps&&this.tapsCount===this.maxTaps&&(this.state=tn))}onDrag(){this.state!==Zr&&this.pointer.getDistance()>this.dragThreshold&&(this.state=Zr)}preUpdate(t,e){if(this.isRunning&&this.enable&&this.state===Qr){var i=this.lastPointer;i.isDown?t-i.downTime>this.holdTime&&(this.state=Zr):t-i.upTime>this.tapInterval&&(void 0===this.minTaps||this.tapsCount>=this.minTaps?this.state=tn:this.state=Zr)}}postUpdate(t,e){this.isRunning&&this.enable&&this.state===tn&&(this.state=Zr)}get isTapped(){return this.state===tn}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 Zr="IDLE",Qr="BEGIN",tn="RECOGNIZED",en=Phaser.Utils.Objects.GetValue;class sn extends Gr{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=rn},eventEmitter:!1};this.setRecongizedStateObject(new ks(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(en(t,"threshold",9)),this.setHoldTime(en(t,"time",251)),this}onDragStart(){this.state=nn,0===this.holdTime&&(this.state=hn)}onDragEnd(){this.state=rn}onDrag(){this.state!==rn&&this.pointer.getDistance()>this.dragThreshold&&(this.state=rn)}preUpdate(t,e){this.isRunning&&this.enable&&this.state===nn&&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 rn="IDLE",nn="BEGIN",hn="RECOGNIZED";Phaser.Utils.Objects.GetValue;var an=function(t){return qe(t).loop.delta};const on=Phaser.Math.Distance.Between,ln=Phaser.Math.Angle.Between;var dn={getDt:function(){return an(this.scene)},getVelocity:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return on(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 ln(e.x,e.y,t.x,t.y)}},cn={"up&down":0,"left&right":1,"4dir":2,"8dir":3},un={};const pn=Phaser.Utils.Objects.GetValue,vn=Phaser.Math.RadToDeg;class gn extends Gr{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=fn},eventEmitter:!1};this.setRecongizedStateObject(new ks(s)),this.clearDirectionStates()}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(pn(t,"threshold",10)),this.setVelocityThreshold(pn(t,"velocityThreshold",1e3)),this.setDirectionMode(pn(t,"dir","8dir")),this}onDragStart(){this.state=mn}onDragEnd(){this.state=fn}onDrag(){this.state===mn&&(this.validDrag||(this.validDrag=0===this.dragThreshold||this.pointer.getDistance()>=this.dragThreshold),this.validDrag&&this.dragVelocity>this.velocityThreshold&&(this.state=yn))}postUpdate(t,e){this.isRunning&&this.enable&&this.state===yn&&(this.state=fn)}get isSwiped(){return this.state===yn}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=un),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}}(vn(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,dn);const fn="IDLE",mn="BEGIN",yn="RECOGNIZED",bn=Phaser.Utils.Objects.GetValue,xn=Phaser.Utils.Array.SpliceOne,wn=Phaser.Math.Distance.Between,Sn=Phaser.Math.Angle.Between;class Cn{constructor(t,e){var i=$e(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(bn(e,"inputConfig",void 0)),this.setEventEmitter(bn(e,"eventEmitter",void 0)),this._enable=void 0,this.pointers=[],this.movedState={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setEnable(bn(t,"enable",!0)),this.bounds=bn(t,"bounds",void 0),this.tracerState=Pn,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 Pn:this.tracerState=Tn,this.onDrag1Start();break;case Tn:this.tracerState=_n,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=Pn,this.onDrag1End();break;case _n: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 _n:this.onDrag2()}}}dragCancel(){return this.tracerState===_n&&this.onDrag2End(),this.pointers.length=0,gt(this.movedState),this.tracerState=Pn,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!==_n)return 0;var t=this.pointers[0],e=this.pointers[1];return wn(t.x,t.y,e.x,e.y)}get angleBetween(){if(this.tracerState!==_n)return 0;var t=this.pointers[0],e=this.pointers[1];return Sn(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!==_n)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.x+e.x)/2}get centerY(){if(this.tracerState!==_n)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.y+e.y)/2}get prevCenterX(){if(this.tracerState!==_n)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!==_n)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&&nr(t,s,e,i)}isPointer1InGameObject(t,e,i){var s=this.pointers[1];return!!s&&nr(t,s,e,i)}}Object.assign(Cn.prototype,Ge);var On={};const Pn=0,Tn=1,_n=2,kn="IDLE";Phaser.Utils.Objects.GetValue;const En=Phaser.Math.RotateAround;var Mn=function(t,e,i,s){return En(t,e,i,s),t.rotation+=s,t},Rn={};const Ln=Phaser.Utils.Objects.GetValue,Dn=Phaser.Math.Angle.WrapDegrees,An=Phaser.Math.Angle.ShortestBetween,Yn=Phaser.Math.RadToDeg,zn=Phaser.Math.DegToRad;var Xn={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,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=Dn(Yn(this.angleBetween));this.angle=An(this.prevAngle,t),this.prevAngle=t,this.state=Fn}break;case Fn:t=Dn(Yn(this.angleBetween)),this.angle=An(this.prevAngle,t),this.prevAngle=t,this.emit("rotate",this)}}get isRotated(){return this.state===Fn}get rotation(){return zn(this.angle)}setDragThreshold(t){return this.dragThreshold=t,this}}.prototype,Xn);const Wn="IDLE",jn="BEGIN",Fn="RECOGNIZED",In=Phaser.Utils.Objects.GetValue;var Bn=function(t){var e=In(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){Rr(i.eventEmitter,`${i.eventNamePrefix}${t.tapsCount}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Hn=Phaser.Utils.Objects.GetValue;var Nn=function(t){var e=Hn(t,"press",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._press=new sn(this,e),this._press.on("pressstart",(function(t,e,s){Rr(i.eventEmitter,`${i.eventNamePrefix}pressstart`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this).on("pressend",(function(t,e,s){Rr(i.eventEmitter,`${i.eventNamePrefix}pressend`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Gn=Phaser.Utils.Objects.GetValue;var Vn=function(t){var e=Gn(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";Rr(i.eventEmitter,`${i.eventNamePrefix}swipe${r}`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Un=Phaser.Utils.Objects.GetValue;var $n=function(t,e){return t.setInteractive(),Un(e,"dropZone",!1)&&(t.input.dropZone=!0),t._childrenInteractive={targetSizers:Un(e,"targets",[t]),targetMode:Un(e,"targetMode","parent"),eventEmitter:Un(e,"eventEmitter",t),eventNamePrefix:Un(e,"inputEventPrefix","child.")},Dr.call(t,e),zr.call(t,e),jr.call(t,e),Hr.call(t,e),Bn.call(t,e),Nn.call(t,e),Vn.call(t,e),t},Jn={getSizerConfig:function(t){return void 0===t&&(t=this),Et(t)},getChildPrevState:function(t){var e=Et(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=ae(e,"color"),s=ae(e,"lineWidth");var o=ae(e,"name",!1);o&&(r=ae(o,"createTextCallback",le),n=ae(o,"createTextCallbackScope",void 0),"string"==typeof(h=ae(o,"align","left-top"))&&(h=Yt[h]))}if(void 0===i&&(i=16777215),void 0===s&&(s=1),r&&!t.children){t.children=new oe(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)}}for(var d,c,u=this.getAllShownChildren([this]),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 rh=Phaser.Utils.Objects.IsPlainObject,nh=Phaser.Utils.Objects.GetValue,hh=Phaser.Display.Align.CENTER,ah={min:0,full:-1};var oh=function(t,e,i,s,r,n,h,a,o,l){ve.call(this,t);var d=t.isRexSpace,c=typeof e;if(null===e)return this;if("number"===c);else if("string"===c)e=ah[e];else if(rh(e)){var u;e=nh(u=e,"proportion",void 0),i=nh(u,"align",hh),s=nh(u,"padding",0),r=nh(u,"expand",!1),n=nh(u,"key",void 0),h=nh(u,"index",void 0),t.isRexSizer||(a=nh(u,"minWidth",void 0),o=nh(u,"minHeight",void 0)),l=nh(u,"fitRatio",0)}return"string"==typeof i&&(i=Yt[i]),void 0===e&&(e=d?1:0),void 0===i&&(i=hh),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===a&&(d?a=0:t.isRexSizer||(a=t._minWidth)),void 0===o&&(d?o=0:t.isRexSizer||(o=t._minHeight)),void 0===l||!1===l?l=0:!0===l&&(l=Q(t)/tt(t)),(u=this.getSizerConfig(t)).proportion=e,u.align=i,u.padding=ue(s),u.expand=r,u.fitRatio=0===e?l:0,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},lh={add:oh,addSpace(t){return this.insertSpace(void 0,t),this},insertSpace(t,e){return void 0===e&&(e=1),oh.call(this,new ih(this.scene),{proportion:e,minWidth:0,minHeight:0,index:t}),this},insert(t,e,i,s,r,n,h,a){return rh(i)&&(i.index=t),oh.call(this,e,i,s,r,n,h,t,a),this},insertAtPosition(t,e,i,s,r,n,h,a,o){var l=sh.call(this,t,e);return-1===l&&(l=void 0),this.insert(l,i,s,r,n,h,a,o),this}};const dh=kt.prototype.clear;var ch=function(t){this.backgroundChildren&&(this.backgroundChildren.length=0);var e,i=!t&&this.sizerEventsEnable;if(i&&(e=this.getChildren([])),dh.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}},vh={getChildAlign(t){return this.getSizerConfig(t).align},setChildAlign(t,e){return"string"==typeof e&&(e=Yt[e]),this.getSizerConfig(t).align=e,this}},gh={getChildProportion(t){return this.getSizerConfig(t).proportion},setChildProportion(t,e){return this.getSizerConfig(t).proportion=e,this}},fh={getChildExpand(t){return this.getSizerConfig(t).expand},setChildExpand(t,e){return this.getSizerConfig(t).expand=e,this}},mh={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}},yh={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&&(Ie(t,0,0),e.resolved=!1,this.hasRatioFitChild=!0);return this._childrenProportion=void 0,this.hasProportion0Child=!1,this.proportionLength=void 0,We.call(this),this},layoutChildren:function(){for(var t,e,i,s,r,n,h,a,o,l,d=this.sizerChildren,c=this.innerLeft,u=this.innerTop,p=this.innerWidth,v=this.innerHeight,g=c,f=u,m=this.startChildIndex,y=0,b=d.length;y0?(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)||Le.call(this)},runWidthWrap:function(t){this.wrapResult||(1===this.orientation&&th.call(this,t,void 0),De.call(this,t))},hasHeightWrap:function(){return!(!this.hasRatioFitChild||0!==this.orientation)||Ye.call(this)},runHeightWrap:function(t){this.wrapResult||(0===this.orientation&&th.call(this,void 0,t),ze.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(yh,lh,ph,vh,gh,fh,mh);var bh=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},wh=function(t){return"string"==typeof t&&(t=xh[t]),t};const Sh=Phaser.Utils.Objects.IsPlainObject,Ch=Phaser.Utils.Objects.GetValue;class Oh extends qn{constructor(t,e,i,s,r,n,h){Sh(e)?(e=Ch(h=e,"x",0),i=Ch(h,"y",0),s=Ch(h,"width",void 0),r=Ch(h,"height",void 0),n=Ch(h,"orientation",0)):Sh(s)?(s=Ch(h=s,"width",void 0),r=Ch(h,"height",void 0),n=Ch(h,"orientation",0)):Sh(n)&&(n=Ch(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(Ch(h,"space.item",0)),this.setStartChildIndex(Ch(h,"startChildIndex",0)),this.setRTL(Ch(h,"rtl",!1)),this.addChildrenMap("items",this.sizerChildren)}setOrientation(t){return this.orientation=wh(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=bh.call(this)),this._childrenProportion}}Object.assign(Oh.prototype,yh);var Ph=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 Th extends zs{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 _h={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}},kh=function(t,e){Di.popUp.call(t,e,this.expandDirection)},Eh=function(t,e){Di.scaleDown.call(t,e,this.expandDirection)},Mh={setTransitionDuration(t){return this.transitionDuration=t,this.childTransition.setTransitInTime(t).setTransitOutTime(t),this},setExpandCallback(t){return void 0===t&&(t=kh.bind(this)),this.childTransition.setTransitInCallback(t),this},setCollapseCallback(t){return void 0===t&&(t=Eh.bind(this)),this.childTransition.setTransitOutCallback(t),this}};const Rh=Phaser.Utils.Objects.GetValue;class Lh extends Oh{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=Rh(e,"space"),h=1===this.orientation?"left":"top",a=Rh(e,"align.title",h),o=Rh(e,"expand.title",!0);this.add(s,{proportion:0,align:a,expand:o,padding:{left:Rh(n,"titleLeft",0),right:Rh(n,"titleRight",0),top:Rh(n,"titleTop",0),bottom:Rh(n,"titleBottom",0)}});var l=Rh(e,"toggleByTarget",void 0),d=Rh(e,"toggleClickConfig");if(void 0===l&&(l=s),l&&mr.onClick.call(l,(function(){this.toggle()}),this,d),this.childTransition=new Th(r),!Rh(e,"customChildOrigin",!1)){var c=this.rtl?1:0;r.setOrigin(c)}a=Rh(e,"align.child","left");var u=(o=Rh(e,"expand.child",!0))?1:0;this.add(r,{proportion:u,align:a,expand:o,padding:{left:Rh(n,"childLeft",0),right:Rh(n,"childRight",0),top:Rh(n,"childTop",0),bottom:Rh(n,"childBottom",0)}}),this.addChildrenMap("title",s),this.addChildrenMap("child",r),this.addChildrenMap("background",i);var p=e.transition;this.setTransitionDuration(Rh(p,"duration",200)),this.setExpandCallback(Rh(p,"expandCallback",void 0)),this.setCollapseCallback(Rh(p,"collapseCallback",void 0)),this.reLayoutTarget=Rh(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=Rh(e,"expanded",void 0);void 0!==y&&this.setExpandedState(y)}}Object.assign(Lh.prototype,_h,Mh);var Dh={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}},Ah=function(t,e,i,s,r=!1){var n;return yt(e)?(n=e,delete e[key]):Qs(e)?(n=e(t,i))&&t.add.existing(n):(r||e)&&s&&(n=s(t,e,i)),n},Yh=Phaser.Renderer.WebGL.Utils,zh=function(t,e,i,s,r,n){for(var h=Yh.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+")"},Ih=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 Bh=Phaser.Renderer.Canvas.SetTransform;var Hh={renderWebGL:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.pipelines.set(e.pipeline),n=jh(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&&Wh(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(Bh(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(Gh.prototype,Hh);const Vh=Phaser.Utils.Objects.GetValue;let Uh=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=Vh(t,"x",0),i=Vh(t,"y",0));var s=this.cornerRadius;s.tl=$h(Vh(t,"tl",void 0),e,i),s.tr=$h(Vh(t,"tr",void 0),e,i),s.bl=$h(Vh(t,"bl",void 0),e,i),s.br=$h(Vh(t,"br",void 0),e,i)}get radiusTL(){var t=this.cornerRadius.tl;return Math.max(t.x,t.y)}set radiusTL(t){Jh(this.cornerRadius.tl,t)}get radiusTR(){var t=this.cornerRadius.tr;return Math.max(t.x,t.y)}set radiusTR(t){Jh(this.cornerRadius.tr,t)}get radiusBL(){var t=this.cornerRadius.bl;return Math.max(t.x,t.y)}set radiusBL(t){Jh(this.cornerRadius.bl,t)}get radiusBR(){var t=this.cornerRadius.br;return Math.max(t.x,t.y)}set radiusBR(t){Jh(this.cornerRadius.br,t)}};var $h=function(t,e,i){return void 0===t?t={x:e,y:i}:"number"==typeof t&&(t={x:t,y:t}),Kh(t),t},Jh=function(t,e){"number"==typeof e?(t.x=e,t.y=e):(t.x=Vh(e,"x",0),t.y=Vh(e,"y",0)),Kh(t)},Kh=function(t){t.convex=t.x>=0||t.y>=0,t.x=Math.abs(t.x),t.y=Math.abs(t.y)},qh=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 Zh=Phaser.Math.DegToRad;var Qh=function(t,e,i,s,r,n,h,a,o){h&&n>r?n-=360:!h&&n0&&t.y>0};const na={rectangle:0,circle:1};var ha=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};const aa=Phaser.Utils.Objects.GetValue;class oa extends Qe{constructor(t,e){super(t,e),this.style=aa(e,"style",this);var i=aa(e,"propertiesMap");this.activeStyle=la(e,"active",i),this.hoverStyle=la(e,"hover",i),this.disableStyle=la(e,"disable",i),this.onModifyStyle=aa(e,"onModifyStyle")}getStyle(t){return function(t,e,i){if(void 0===i&&(i={}),Array.isArray(e))for(var s=0,r=e.length;s0,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};const eo=Phaser.Utils.Objects.GetValue,io=Phaser.Utils.Objects.IsPlainObject;class so extends(_a(ba)){constructor(t,e,i,s,r,n,h,a){io(e)?(e=eo(a=e,"x",0),i=eo(a,"y",0),s=eo(a,"width",2),r=eo(a,"height",2),n=eo(a,"barColor",void 0),h=eo(a,"value",0)):io(s)?(s=eo(a=s,"width",2),r=eo(a,"height",2),n=eo(a,"barColor",void 0),h=eo(a,"value",0)):io(n)&&(n=eo(a=n,"barColor",void 0),h=eo(a,"value",0)),super(t,e,i,s,r,a),this.type="rexLineProgress",this.bootProgressBase(a),this.addShape((new Qa).setName("trackFill")).addShape((new Qa).setName("bar")).addShape((new Qa).setName("trackStroke")),this.setTrackColor(eo(a,"trackColor",void 0)),this.setBarColor(n),this.setTrackStroke(eo(a,"trackStrokeThickness",2),eo(a,"trackStrokeColor",void 0)),this.setSkewX(eo(a,"skewX",0)),this.setRTL(eo(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 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).close();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),to(h,r,0,n,i,t).close());var a=this.getShape("trackStroke");a.lineStyle(this.trackStrokeThickness,this.trackStrokeColor),a.isStroked&&to(a,0,0,e,i,t).end()}};Object.assign(so.prototype,ro);var no=function(t){return null==t||""===t||0===t.length},ho=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,h=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 To=Phaser.Utils.Objects.IsPlainObject,_o=Phaser.Utils.Objects.GetValue;var ko=function(t){return"string"==typeof t&&(t=Eo[t]),t};const Eo={scale:0,repeat:1};var Mo=function(t,e){return 0===t||t===this.columns.count-1||0===e||e===this.rows.count-1},Ro={_beginDraw:zt,_drawImage:zt,_drawTileSprite:zt,_endDraw:zt,setGetFrameNameCallback:function(t){return void 0===t&&(t=Oo),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),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 To(t)?(this.stretchMode.edge=ko(_o(t,"edge",0)),this.stretchMode.internal=ko(_o(t,"internal",0))):(t=ko(t),this.stretchMode.edge=t,this.stretchMode.internal=t),this},getStretchMode:function(t,e){return Mo.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 Lo=Phaser.Utils.Objects.IsPlainObject,Do=Phaser.Utils.Objects.GetValue,Ao=Phaser.GameObjects;var Yo=void 0,zo=function(t,e){if(Yo||(Yo={},qe(t).events.once("destroy",(function(){for(var t in Yo)Yo[t].destroy();Yo=void 0}))),!Yo.hasOwnProperty(e)){var i=qe(t).scene.systemScene;(t=new Ao[e](i)).setOrigin(0),Yo[e]=t}return Yo[e]};const Xo=Phaser.GameObjects.RenderTexture;class Wo extends(function(t,e){class i extends t{constructor(t,i,s,r,n,h,a,o,l,d){if(Lo(i)?(i=Do(d=i,"x",0),s=Do(d,"y",0),r=Do(d,"width",1),n=Do(d,"height",1),h=Do(d,"key",void 0),a=Do(d,"baseFrame",void 0),o=Do(d,"columns",void 0),l=Do(d,"rows",void 0)):Lo(r)?(r=Do(d=r,"width",1),n=Do(d,"height",1),h=Do(d,"key",void 0),a=Do(d,"baseFrame",void 0),o=Do(d,"columns",void 0),l=Do(d,"rows",void 0)):Lo(h)?(h=Do(d=h,"key",void 0),a=Do(d,"baseFrame",void 0),o=Do(d,"columns",void 0),l=Do(d,"rows",void 0)):Lo(a)?(a=Do(d=a,"baseFrame",void 0),o=Do(d,"columns",void 0),l=Do(d,"rows",void 0)):Array.isArray(a)?(d=l,l=o,o=a,a=Do(d,"baseFrame",void 0)):Lo(o)&&(o=Do(d=o,"columns",void 0),l=Do(d,"rows",void 0)),void 0===a&&(a=Do(d,"frame",void 0)),void 0===o){var c=Do(d,"leftWidth",void 0),u=Do(d,"rightWidth",void 0);void 0!==c&&void 0!==u&&(o=[c,void 0,u])}if(void 0===l){var p=Do(d,"topHeight",void 0),v=Do(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(Do(d,"getFrameNameCallback",void 0)),this.setStretchMode(Do(d,"stretchMode",0)),this.setPreserveRatio(Do(d,"preserveRatio",!0));var g=Do(d,"maxFixedPartScale",1),f=Do(d,"maxFixedPartScaleX",g),m=Do(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,Ro),i}(Xo,"rexNinePatch")){}var jo={_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(Wo.prototype,jo);let Fo=class extends Qe{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 Io=Phaser.Utils.Objects.GetValue;class Bo extends Wo{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexStatesNinePatch";var i=Io(e,"effects",!0);i&&go(this,i),this.style=new Fo(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign(Bo.prototype,ca);const Ho=["alpha","tint","flipX","flipY"];var No=function(t,e){if(!e)return t;for(var i=0,s=Ho.length;i0&&r.push(o.join("")),r},cl=0,ul=1,pl=2,vl=0,gl=1,fl=2,ml=/(?:\r\n|\r|\n)/;const yl={none:vl,word:gl,char:fl,character:fl,mix:3},bl=Phaser.Renderer.WebGL.Utils;var xl={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=bl.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 wl=Phaser.Display.Color;var Sl={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 wl);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}},Cl=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)},Ol={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,Cl(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 Pl=Phaser.Display.Canvas.CanvasPool,Tl=Phaser.GameObjects.GameObject,_l=Phaser.Utils.String.UUID;class kl extends Tl{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=Pl.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=_l(),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(){Pl.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 El=Phaser.GameObjects.Components;Phaser.Class.mixin(kl,[El.Alpha,El.BlendMode,El.Crop,El.Depth,El.Flip,El.GetBounds,El.Mask,El.Origin,El.Pipeline,El.PostPipeline,El.ScrollFactor,El.Tint,El.Transform,El.Visible,xl,Sl,Ol]);class Ml{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(Ml.prototype,Ea);var Rl={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 Ll=Phaser.Math.RotateAround;var Dl;const Al=Phaser.Geom.Rectangle;var Yl,zl=function(t){void 0===Yl&&(Yl=new Al);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 Wl,jl=function(t,e,i,s){return void 0===s?s={}:!0===s&&(void 0===Wl&&(Wl={}),s=Wl),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 Fl=Phaser.GameObjects.Components.TransformMatrix;var Il,Bl,Hl={},Nl=function(t,e,i,s,r){var n=jl(e,i,s,!0),h=function(t,e,i,s){void 0===s?s={}:!0===s&&(s=Hl);var r=e-t.width*t.originX,n=i-t.height*t.originY;return void 0===Il&&(Il=new Fl,Bl=new Fl),t.parentContainer?t.getWorldTransformMatrix(Il,Bl):Il.applyITRS(t.x,t.y,t.rotation,t.scaleX,t.scaleY),Il.transformPoint(r,n,s),s}(t,n.x,n.y,r);return h},Gl=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 Nl(t,e,n,h,r)},Vl={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===Dl&&(Dl={}),s=Dl),s.x=(t-i.drawX)/i.scaleX,s.y=(e-i.drawY)/i.scaleY,0!==i.rotation&&Ll(s,0,0,-i.rotation),s}(t,e,this,!0);return zl(this).contains(i.x,i.y)},getWorldPosition:function(t,e,i){return Gl(this.parent,this,t,e,i)}};Object.assign(Vl,Rl);const Ul=Phaser.Math.DegToRad,$l=Phaser.Math.RadToDeg,Jl=Phaser.Utils.Objects.GetValue;class Kl extends Ml{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 $l(this._rotation)}set angle(t){this.rotation=Ul(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=Jl(t,"width",void 0),i=Jl(t,"height",void 0),s=Jl(t,"scaleX",void 0),r=Jl(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(Kl.prototype,Vl);const ql=Phaser.Utils.String.Pad;var Zl=function(t,e,i){if(null==t)return t;switch(typeof t){case"string":default:return t;case"number":return`#${ql(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}},Ql=function(t,e,i){return e.hasOwnProperty(t)?e[t]:i[t]};const td=Phaser.Math.DegToRad;var ed=function(t){return!t.hasOwnProperty("convex")||t.convex},id=function(t){return t.x>0&&t.y>0},sd=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,id(a)?(o=a.x*g,l=a.y*f,ed(a)?sd(t,o,l,o,l,180,270,!1,h):sd(t,0,0,o,l,90,0,!0,h),d=0,c=l):(t.lineTo(0,0),d=0,c=0),a=m.tr,id(a)?(o=a.x*g,l=a.y*f,ed(a)?sd(t,s-o,l,o,l,270,360,!1,h):sd(t,s,0,o,l,180,90,!0,h)):t.lineTo(s,0),a=m.br,id(a)?(o=a.x*g,l=a.y*f,ed(a)?sd(t,s-o,r-l,o,l,0,90,!1,h):sd(t,s,r,o,l,270,180,!0,h)):t.lineTo(s,r),a=m.bl,id(a)?(o=a.x*g,l=a.y*f,ed(a)?sd(t,o,r-l,o,l,90,180,!1,h):sd(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())},nd=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),rd(t.canvas,t.context,d,d,o,l,r,e,i,s,n,h,a)}};const hd=Phaser.Utils.Objects.GetValue;class ad extends Kl{constructor(t,e){super(t,"background"),this.setScrollFactor(0),this.setColor(hd(e,"color",null),hd(e,"color2",null),hd(e,"horizontalGradient",!0)),this.setStroke(hd(e,"stroke",null),hd(e,"strokeThickness",2)),this.setCornerRadius(hd(e,"cornerRadius",0),hd(e,"cornerIteration",null))}set color(t){t=Zl(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=Zl(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=Zl(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,Ql("color2",t,this),Ql("horizontalGradient",t,this)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,Ql("strokeThickness",t,this)),t.hasOwnProperty("cornerRadius")&&this.setCornerRadius(t.cornerRadius,Ql("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(){nd(this.parent,this.color,this.stroke,this.strokeThickness,this.cornerRadius,this.color2,this.horizontalGradient,this.cornerIteration)}}const od=Phaser.Utils.Objects.GetValue;class ld extends Kl{constructor(t,e){super(t,"innerbounds"),this.setScrollFactor(0),this.setColor(od(e,"color",null),od(e,"color2",null),od(e,"horizontalGradient",!0)),this.setStroke(od(e,"stroke",null),od(e,"strokeThickness",2))}set color(t){t=Zl(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=Zl(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=Zl(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,od(t,"color2",null),od(t,"horizontalGradient",!0)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,od(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 dd=Phaser.Utils.Objects.GetValue;let cd=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(dd(t,"bold",!1)),this.setItalic(dd(t,"italic",!1)),this.setFontSize(dd(t,"fontSize","16px")),this.setFontFamily(dd(t,"fontFamily","Courier")),this.setColor(dd(t,"color","#fff")),this.setStrokeStyle(dd(t,"stroke",null),dd(t,"strokeThickness",0)),this.setShadow(dd(t,"shadowColor",null),dd(t,"shadowOffsetX",0),dd(t,"shadowOffsetY",0),dd(t,"shadowBlur",0)),this.setOffset(dd(t,"offsetX",0),dd(t,"offsetY",0)),this.setSpace(dd(t,"leftSpace",0),dd(t,"rightSpace",0)),this.setAlign(dd(t,"align",void 0)),this.setBackgroundColor(dd(t,"backgroundColor",null)),this.setBackgroundHeight(dd(t,"backgroundHeight",void 0)),this.setBackgroundBottomY(dd(t,"backgroundBottomY",void 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(Ql("stroke",t,this),Ql("strokeThickness",t,this)),t.hasOwnProperty("shadowColor")&&this.setShadowColor(t.shadowColor),(t.hasOwnProperty("shadowOffsetX")||t.hasOwnProperty("shadowOffsetY"))&&this.setShadowOffset(Ql("shadowOffsetX",t,this),Ql("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),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=Zl(t),this}get hasFill(){return null!=this.color}setStrokeStyle(t,e){return this.stroke=Zl(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=Zl(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=Zl(t),this}get hasBackgroundColor(){return null!=this.backgroundColor}setBackgroundHeight(t){return this.backgroundHeight=t,this}setBackgroundBottomY(t){return this.backgroundBottomY=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 ud=Phaser.Utils.Array.Remove,pd=Phaser.Utils.Array.Remove,vd="text",gd="image",fd="drawer",md="space",yd="command";var bd=function(t){return t.type===vd&&"\n"===t.text},xd=function(t){return t.type===vd&&"\f"===t.text},wd=function(t){return t.type===vd};class Sd extends Kl{constructor(t,e,i){super(t,vd),this.updateTextFlag=!1,this.style=new cd(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,s=this.drawTRX-i+1,r=e.backgroundBottomY;null==r&&(r=this.drawBLY);var n=e.backgroundHeight;null==n&&(n=r-this.drawTLY);var h=r-n;t.fillRect(i,h,s,n)}var a=e.hasFill,o=e.hasStroke;(a||o)&&(e.syncFont(t).syncStyle(t),o&&(e.syncShadow(t),t.strokeText(this.text,0,0)),a&&(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 Od=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=Od.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),Od.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 Td extends Kl{constructor(t,e,i){super(t,gd),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 _d extends Kl{constructor(t,e,i,s){super(t,fd),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 kd extends Kl{constructor(t,e){super(t,md),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 Ed extends Ml{constructor(t,e,i,s,r){super(t,yd),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 Md=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 Rd={none:0,word:1,char:2,character:2,mix:3};var Ld=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=zd.call(this)).height,h=l.ascent,i=Math.floor((o-h)/n))}else{var l;n=(l=zd.call(this)).height,h=l.ascent}}else this.fixedHeight>0?void 0===(i=Wd(t,"maxLines"))&&(o=this.fixedHeight-s,i=Math.floor(o/n)):i=Wd(t,"maxLines",0);void 0===h&&(h=n);var d=0===i,c=Wd(t,"wrapMode");void 0===c&&(c=Wd(t,"charWrap",!1)?"char":"word"),"string"==typeof c&&(c=Rd[c]);var u=Wd(t,"wrapWidth",void 0);void 0===u&&(this.fixedWidth>0?u=this.fixedWidth-r:(u=1/0,c=0));for(var p=Wd(t,"letterSpacing",0),v=Wd(t,"hAlign",0),g=Wd(t,"vAlign",0),f=Wd(t,"justifyPercentage",.25),m=Md({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===_,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=Id(t,"maxLines",void 0))){var h=this.fixedWidth-r;i=Math.floor(h/n)+1}}else i=Id(t,"maxLines",0);var a=0===i,o=Id(t,"fixedCharacterHeight",void 0);if(void 0===o){var l=Id(t,"charPerLine",void 0);if(void 0!==l){var d=this.fixedHeight-s;o=Math.floor(d/l)}}var c=Id(t,"wrapHeight",void 0);void 0===c&&(c=this.fixedHeight>0?this.fixedHeight-s:1/0);for(var u=Id(t,"letterSpacing",0),p=Id(t,"rtl",!0),v=Id(t,"hAlign",p?2:0),g=Id(t,"vAlign",0),f=Md({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+=_.length,f.isLastPage=f.start===T,f.maxLineHeight=R,f.linesWidth=k.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 Ee(i,t,e),this.dirty=this.dirty||s!=i.left||r!=i.right||n!=i.top||h!=i.bottom,this},getPadding:function(t){return ke(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),ud(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 pd(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(vd);return null===i?i=new Sd(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)),Gl(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 uc=Phaser.Utils.Objects.GetFastValue;var pc={};class vc{constructor(t){this.pools=uc(t,"pools",pc)}free(t){if(!this.pools)return this;var e=t.type;return this.pools.hasOwnProperty(e)||(this.pools[e]=new cc),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=Sc(t,r,e,i,n),a=0;a<=bc&&0!==h;a++){if((r+=h)<0){r=0;break}h=Sc(t,r,e,i,n)}return a===bc&&console.warn("FontSizeFit: Test count exceeds 65535"),t.setFontSize(r),Cc(t,e,i),t},wc=function(t,e,i){return void 0===i[e]&&(t.setFontSize(e),i[e]={width:t.width,height:t.height}),i[e]},Sc=function(t,e,i,s,r){var n,h=wc(t,e,r),a=wc(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)},Cc=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 Oc=Phaser.Utils.Objects.GetValue,Pc=Phaser.Utils.Objects.GetValue;class Tc extends Ko{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexLabel";var i,s=Pc(e,"background",void 0),r=Pc(e,"icon",void 0),n=Pc(e,"iconMask",void 0),h=Pc(e,"text",void 0),a=Pc(e,"action",void 0),o=Pc(e,"actionMask",void 0),l=Pc(e,"align",void 0);if(s&&this.addBackground(s),r){0===this.orientation?(h||a)&&(i={right:Pc(e,"space.icon",0),top:Pc(e,"space.iconTop",0),bottom:Pc(e,"space.iconBottom",0),left:Pc(e,"space.iconLeft",0)}):(h||a)&&(i={bottom:Pc(e,"space.icon",0),left:Pc(e,"space.iconLeft",0),right:Pc(e,"space.iconRight",0),top:Pc(e,"space.iconTop",0)});var d=Pc(e,"squareFitIcon",!1)?1:0;if(this.add(r,{proportion:0,padding:i,fitRatio:d}),n&&(n=el.call(this,r,r,1)),!d){var c=Pc(e,"iconSize",void 0);this.setIconSize(Pc(e,"iconWidth",c),Pc(e,"iconHeight",c))}}if(h){var u=Pc(e,"wrapText",!1),p=Pc(e,"adjustTextFontSize",!1);u?(!0===u&&(u="word"),function(t,e){switch(hl(t)){case 0:switch("string"==typeof e&&(e=yl[e]||0),t.style.wrapMode=e,e){case 2:case 3:t.style.wordWrapCallback=ll;break;default:t.style.wordWrapCallback=null}break;case 1:"string"==typeof e&&(e=yl[e]||0),t.style.wrapMode=e}}(h,u),e.expandTextWidth=!0,yc(h)):p&&(e.expandTextWidth=!0,e.expandTextHeight=!0,function(t,e){"number"==typeof e&&(e={minWidth:e});var i=Oc(e,"minWidth",0),s=Oc(e,"minHeight",0),r=Oc(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 xc(t,e,i),t}):(t.runWidthWrap=function(e){return t.setFixedSize&&t.setFixedSize(0,0),xc(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=Pc(e,"space.text",0),m=Pc(e,"expandTextWidth",!1),y=Pc(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:Pc(e,"space.actionTop",0),bottom:Pc(e,"space.actionBottom",0),right:Pc(e,"space.actionRight",0)}:{left:Pc(e,"space.actionLeft",0),right:Pc(e,"space.actionRight",0),bottom:Pc(e,"space.actionBottom",0)},d=Pc(e,"squareFitAction",!1)?1:0,this.add(a,{proportion:0,padding:i,fitRatio:d}),o&&(o=el.call(this,a,a,1)),!d)){var b=Pc(e,"actionSize");this.setActionSize(Pc(e,"actionWidth",b),Pc(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)}}const _c=Phaser.GameObjects.Text,kc=Phaser.Utils.Objects.GetValue;class Ec extends _c{constructor(t,e){void 0===e&&(e={}),super(t,kc(e,"x",0),kc(e,"y",0),kc(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(Ec.prototype,ca);var Mc=Phaser.Renderer.WebGL.Utils,Rc={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=Mc.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 Lc=Phaser.Display.Canvas.CanvasPool;e();const Dc=Phaser.GameObjects.GameObject;class Ac extends Dc{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=Lc.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 Lc.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 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}},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}},Pe=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,_e=Phaser.Utils.Objects.GetValue;var ke=function(t,e){return void 0===e?t:t[e]},Ee=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=_e(e,"left",0),t.right=_e(e,"right",0),t.top=_e(e,"top",0),t.bottom=_e(e,"bottom",0)),t},Me={getInnerPadding(t){return ke(this.space,t)},setInnerPadding(t,e){return Ee(this.space,t,e),this},getOuterPadding(t){return ke(this.getSizerConfig(this).padding,t)},setOuterPadding(t,e){return Ee(this.getSizerConfig(this).padding,t,e),this},getChildOuterPadding(t,e){return"string"==typeof t&&(t=this.getElement(t)),ke(this.getSizerConfig(t).padding,e)},setChildOuterPadding(t,e,i){return"string"==typeof t&&(t=this.getElement(t)),Ee(this.getSizerConfig(t).padding,e,i),this}},Re=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}},Le=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},De=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}},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},ze=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}},We=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?vi:pi,this.repeatCounter=0,this}stop(){return this.state=ui,this}update(t,e){this.state!==ui&&this.state!==fi&&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=gi)):(this.nowTime=this.duration,this.state=fi):this.nowTime>=0&&(this.state=vi))}get t(){var t;switch(this.state){case ui:case pi:case gi:t=0;break;case vi:t=this.nowTime/this.duration;break;case fi:t=1}return di(t,0,1)}set t(t){(t=di(t,-1,1))<0?(this.state=pi,this.nowTime=-this.delay*t):(this.state=vi,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===ui}get isDelay(){return this.state===pi}get isCountDown(){return this.state===vi}get isRunning(){return this.state===pi||this.state===vi}get isDone(){return this.state===fi}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}}const ui=0,pi=1,vi=2,gi=3,fi=-1;class mi extends ai{constructor(t,e){super(t,e),this.timer=new ci}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 yi=Phaser.Utils.Objects.GetValue,bi=Phaser.Utils.Objects.GetAdvancedValue,xi=Phaser.Tweens.Builders.GetEaseFunction;class wi extends mi{resetFromJSON(t){return this.timer.resetFromJSON(yi(t,"timer")),this.setEnable(yi(t,"enable",!0)),this.setTarget(yi(t,"target",this.parent)),this.setDelay(bi(t,"delay",0)),this.setDuration(bi(t,"duration",1e3)),this.setEase(yi(t,"ease","Linear")),this.setRepeat(yi(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 Si=Phaser.Utils.Objects.GetValue,Ci=Phaser.Utils.Objects.GetAdvancedValue,Oi=Phaser.Math.Linear;let Pi=class extends wi{constructor(t,e){super(t,e),this.scaleStart={},this.scaleEnd={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(Si(t,"mode",0)),this.setScaleRange(Ci(t,"start",void 0),Ci(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=Ci(t,"x",this.parent.scaleX),this.startY=Ci(t,"y",this.parent.scaleY)),"number"==typeof e?(this.endX=e,this.endY=e):(this.endX=Ci(e,"x",void 0),this.endY=Ci(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 _i=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 Pi(t,a):r.resetFromJSON(a),r.restart(),r},ki=function(t,e,i,s,r,n){void 0===s&&(s="Linear"),r instanceof Pi&&(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 Pi(t,h):n.resetFromJSON(h),n.restart(),n},Ei=function(t,e){return new Promise((function(i,s){t.once(e,(function(){i()}))}))},Mi=function(t){return Ei(t,"complete")};const Ri=Phaser.Utils.Objects.IsPlainObject;var Li={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(Ri(t)){var s=t;t=s.duration,e=s.orientation,i=s.ease}var r=void 0===this._scaleBehavior;return this._scaleBehavior=_i(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(Ri(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=ki(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(Ri(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 Pi(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),Mi(this._scaleBehavior)},isRunningScaleYoyo(){return this._scaleBehavior&&(this._scaleBehavior.completeEventName="scaleyoyo.complete")},isRunningEaseScale(){return this.isRunningPopUp()||this.isRunningScaleDown()||this.isRunningScaleYoyo()}},Di={};Object.assign(Di,Li),Di.onInitScale=function(){Li.onInitScale.call(this);var t=this;this._scaleBehavior.on("update",(function(){var e=me.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const Ai=Phaser.Utils.Objects.GetValue,Yi=Phaser.Utils.Objects.GetAdvancedValue,zi=Phaser.Math.Linear;class Xi extends wi{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(Yi(t,"start",this.parent.alpha),Yi(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=Wi[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=zi(this.alphaStart,this.alphaEnd,i)}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Wi={stop:0,destroy:1,yoyo:2},ji=Phaser.Utils.Objects.IsPlainObject;var Fi=function(t,e,i,s){var r,n;ji(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 Xi(t,h):s.resetFromJSON(h),s.restart(),s},Ii=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 Bi=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(Bi(t)){var i=t;t=i.duration,e=i.alpha}var s=void 0===this._fade;return this._fade=Fi(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(Bi(t)){var i=t;t=i.duration,e=i.destroy}var s=void 0===this._fade;return this._fade=Ii(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()}},Ni={};Object.assign(Ni,Hi),Ni.onInitFade=function(){Hi.onInitFade.call(this);var t=this;this._fade.on("update",(function(){var e=me.getParentSizer(t);e&&e.resetChildAlphaState(t)}))};const Gi=Phaser.Utils.Objects.GetValue,Vi=Phaser.Utils.Objects.GetAdvancedValue,Ui=Phaser.Math.Linear;class $i extends wi{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){if(super.resetFromJSON(t),this.setMode(Gi(t,"mode",0)),t&&(t.hasOwnProperty("x")||t.hasOwnProperty("y"))){var e=Vi(t,"x",void 0),i=Vi(t,"y",void 0);this.setTargetPosition(e,i)}else this.setTargetPosition(t);return this}setMode(t){return"string"==typeof t&&(t=Ji[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=Vi(i,"startX",void 0),this.startY=Vi(i,"startY",void 0),this.endX=Vi(i,"endX",void 0),this.endY=Vi(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=Ui(this.startX,this.endX,i)),this.hasMoveY&&(t.y=Ui(this.startY,this.endY,i))}complete(){return super.complete(),1===this.mode&&this.parent.destroy(),this}}const Ji={stop:0,destroy:1,yoyo:2};var Ki=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,Zi=Phaser.Math.Distance.Between;var Qi={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*Zi(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 $i&&(h=n,n=void 0),void 0===n&&(n=!1);var a={};return a.mode=n?1:0,void 0!==i&&(a.startX=Ki(i,t.x),a.endX=t.x),void 0!==s&&(a.startY=Ki(s,t.y),a.endY=t.y),a.duration=e,a.ease=void 0===r?"Linear":r,void 0===h?h=new $i(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),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*Zi(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 $i&&(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=Ki(i,t.x)),void 0!==s&&(a.startY=t.y,a.endY=Ki(s,t.y)),a.duration=e,a.ease=void 0===r?"Linear":r,void 0===h?h=new $i(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),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}},ts={};Object.assign(ts,Qi),ts.onInitEaseMove=function(){Qi.onInitEaseMove.call(this);var t=this;this._easeMove.on("update",(function(){var e=me.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const es=Phaser.Utils.Objects.GetValue;class is extends ri{constructor(t,e){super(t,e),this.timer=new ci,this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.timer.resetFromJSON(es(t,"timer")),this.setEnable(es(t,"enable",!0)),this.setMode(es(t,"mode",1)),this.isRunning=es(t,"isRunning",!1),this.setMagnitudeMode(es(t,"magnitudeMode",1)),this.setAxisMode(es(t,"axis",0)),this.setDuration(es(t,"duration",500)),this.setMagnitude(es(t,"magnitude",10)),this.ox=es(t,"ox",void 0),this.oy=es(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=ss[t]),this.mode=t,this}setMagnitudeMode(t){return"string"==typeof t&&(t=ns[t]),this.magnitudeMode=t,this}setAxisMode(t){return"string"==typeof t&&(t=rs[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=es(i,"magnitude",void 0),t=es(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 ss={effect:0,behavior:1},rs={both:0,"h&v":0,"x&y":0,horizontal:1,h:1,x:1,vertical:2,v:2,y:2},ns={constant:0,decay:1},hs=Phaser.Utils.Objects.IsPlainObject;var as={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 is(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 os=Phaser.Utils.Objects.GetValue,ls=Phaser.Math.Linear;class ds extends wi{constructor(t,e){super(t,e),this.resetFromJSON(),this.boot()}start(t){if(this.timer.isRunning)return this;var e=this.target;this.propertyKey=os(t,"key","value");var i=e[this.propertyKey];return this.fromValue=os(t,"from",i),this.toValue=os(t,"to",i),this.setEase(os(t,"ease",this.ease)),this.setDuration(os(t,"duration",this.duration)),this.setRepeat(os(t,"repeat",0)),this.setDelay(os(t,"delay",0)),this.setRepeatDelay(os(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]=ls(this.fromValue,this.toValue,i)}}const cs=Phaser.Utils.Objects.IsPlainObject;class us extends Qe{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 ds(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(cs(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(cs(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 ps={easeDataTo(t,e,i,s){return this._easeData||(this._easeData=new us(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),Ei(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}},vs=Phaser.Utils.Array.Remove,gs={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=$e(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}},Rs={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}},Ls={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}},Ds={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,Ms,Rs,Ls,Ds);const Ys=Phaser.Utils.Objects.GetValue;class zs extends Qe{constructor(t,e){super(t,e),this.setTransitInTime(Ys(e,"duration.in",200)),this.setTransitOutTime(Ys(e,"duration.out",200)),this.setTransitInCallback(Ys(e,"transitIn")),this.setTransitOutCallback(Ys(e,"transitOut")),this.oneShotMode=Ys(e,"destroy",!1),this.delayCallTimer=void 0,this._state=new Es(this,{eventEmitter:!1,initState:Ys(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(zs.prototype,As);var Xs=function(t){if(t.parentContainer)return Xs(t.parentContainer);var e=function(t){var e=t.displayList;return U(e)?e:null}(t);return e?Xs(e):t};class Ws extends Qe{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=Xs(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 js=Phaser.GameObjects.Rectangle;class Fs extends js{constructor(t,e,i){super(t,0,0,2,2,e,1),this.fullWindow=new Ws(this),this.setAlpha(i)}get tint(){return this.fillColor}set tint(t){this.setFillStyle(t,this.fillAlpha)}}const Is=Phaser.Utils.Objects.GetValue;class Bs extends Qe{constructor(t,e){super(t,{eventEmitter:!1}),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setHitAreaMode(Is(t,"hitAreaMode",0)),this.setEnable(Is(t,"enable",!0)),this.setStopMode(Is(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 Ns=Phaser.Utils.Objects.GetValue;class Gs extends Fs{constructor(t,e){super(t,Ns(e,"color",0),Ns(e,"alpha",.8)),this.touchEventStop=new Bs(this,{hitAreaMode:1})}}var Vs={popUp(t,e){void 0!==t._modalScaleSave?(t.scaleX=t._modalScaleSave,t.scaleY=t._modalScaleSave):t._modalScaleSave=t.scaleX,_i(t,e)},scaleDown(t,e){ki(t,e,void 0,void 0,!1)},fadeIn(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Fi(t,e)},fadeOut(t,e){Ii(t,e,!1)}},Us=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Fi(t,e,t.alpha)},$s=function(t,e){Ii(t,e,!1)},Js=function(t,e,i,s,r){return!(!t||s&&!s(t,e,i)||!rt(t,!0).contains(e,i)||r&&!r(t,e,i))};const Ks=Phaser.Utils.Objects.GetValue;let qs=class extends zs{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=Zs.popUp),null==e.transitOut&&(e.transitOut=Zs.scaleDown),e.destroy=Ks(e,"destroy",!0),super(t,e);var i=Ks(e,"cover");this.cover=!1!==i?function(t,e){var i=t.scene,s=new Gs(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(Ks(i,"transitIn",Us)),this.setCoverTransitOutCallback(Ks(i,"transitOut",$s)));var s=Ks(e,"touchOutsideClose",!1),r=Ks(e,"duration.hold",-1),n=Ks(e,"timeOutClose",r>=0),h=Ks(e,"anyTouchClose",!1);Ks(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),Ks(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&&Js(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=Zs[t]),t){case Zs.popUp:t=Vs.popUp;break;case Zs.fadeIn:t=Vs.fadeIn}return super.setTransitInCallback(t),this}setTransitOutCallback(t){switch("string"==typeof t&&(t=Zs[t]),t){case Zs.scaleDown:t=Vs.scaleDown;break;case Zs.fadeOut:t=Vs.fadeOut}return super.setTransitOutCallback(t),this}setCoverTransitInCallback(t){return this.coverTransitInCallback=t,this}setCoverTransitOutCallback(t){return this.coverTransitOutCallback=t,this}};const Zs={popUp:0,fadeIn:1,scaleDown:0,fadeOut:1};var Qs=function(t){return t&&"function"==typeof t},tr={modal(t,e){return Qs(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}},er=function(t,e,i,s,r){Qs(e)&&(r=s,s=i,i=e,e=this);var n=this.scene.events;return this.bindEvent(e,n,t,i,s,r),this},ir={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 er.call(this,"preupdate",t,e,i,s),this},bindSceneUpdateEvent(t,e,i,s){return er.call(this,"update",t,e,i,s),this},bindScenePostupdateEvent(t,e,i,s){return er.call(this,"postupdate",t,e,i,s),this},bindSceneRenderEvent(t,e,i,s){return er.call(this,"render",t,e,i,s),this},bindScenePauseEvent(t,e,i,s){return er.call(this,"pause",t,e,i,s),this},bindSceneResumeEvent(t,e,i,s){return er.call(this,"resume",t,e,i,s),this},bindSceneSleepEvent(t,e,i,s){return er.call(this,"sleep",t,e,i,s),this},bindSceneWakeEvent(t,e,i,s){return er.call(this,"wake",t,e,i,s),this},bindSceneShutdownEvent(t,e,i,s){return er.call(this,"shutdown",t,e,i,s),this}},sr=function(t,e,i){var s=t.camera;return s?(void 0===i?i={}:!0===i&&(i=rr),s===e?(i.x=t.worldX,i.y=t.worldY):s.getWorldPoint(t.x,t.y,i),i):null},rr={},nr=function(t,e,i,s){var r,n=t.scene.sys.cameras.main,h=0===t.scrollFactorX&&0===t.scrollFactorY;if(e)return h?Js(t,e.x,e.y,i,s):!!(r=sr(e,n,!0))&&Js(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 fr={press:0,pointerdown:0,release:1,pointerup:1};var mr={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 gr(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}},yr=function(t,e,i,s,r){if(e)return!(i&&!i(t,e)||!br(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 wr=Phaser.Utils.Objects.GetValue;class Sr extends Qe{constructor(t,e){super(t,e),this._enable=void 0;var i=wr(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(wr(t,"enable",!0)),this.setMode(wr(t,"mode",1)),this.setClickInterval(wr(t,"clickInterval",100)),this.setDragThreshold(wr(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=Cr[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?yr:nr)(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 Cr={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 Sr(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 Pr extends ks{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 _r extends Qe{constructor(t,e){super(t,e),this._enable=void 0,this.cooldown=new Pr,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 kr={isPointerInBounds(t){return void 0===t?t=this:"string"==typeof t&&(t=this.getElement(t)),!!t&&nr(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 _r(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 _r(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}},Er={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,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=Vr,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===Ur&&this.onDragEnd(),this.pointer=void 0,this.tracerState=Vr,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=$r,this}isPointerInGameObject(t,e,i){var s=this.lastPointer;return!!s&&nr(t,s,e,i)}}const Vr=0,Ur=1,$r="IDLE",Jr=Phaser.Utils.Objects.GetValue,Kr=Phaser.Math.Distance.Between;class qr extends Gr{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=Zr},eventEmitter:!1};this.setRecongizedStateObject(new ks(s))}resetFromJSON(t){super.resetFromJSON(t),this.setHoldTime(Jr(t,"time",250)),this.setTapInterval(Jr(t,"tapInterval",200)),this.setDragThreshold(Jr(t,"threshold",9)),this.setTapOffset(Jr(t,"tapOffset",10));var e=Jr(t,"taps",void 0);return void 0!==e?this.setTaps(e):(this.setMaxTaps(Jr(t,"maxTaps",void 0)),this.setMinTaps(Jr(t,"minTaps",void 0))),this}onDragStart(){switch(this.state){case Zr:this.state=Qr;break;case Qr:var t=this.lastPointer;Kr(t.upX,t.upY,t.x,t.y)>this.tapOffset&&(this.state=tn,this.state=Qr);break;case tn:this.state=Qr}}onDragEnd(){this.state===Qr&&(this.tapsCount++,this.emit("tapping",this,this.gameObject,this.lastPointer),void 0!==this.maxTaps&&this.tapsCount===this.maxTaps&&(this.state=tn))}onDrag(){this.state!==Zr&&this.pointer.getDistance()>this.dragThreshold&&(this.state=Zr)}preUpdate(t,e){if(this.isRunning&&this.enable&&this.state===Qr){var i=this.lastPointer;i.isDown?t-i.downTime>this.holdTime&&(this.state=Zr):t-i.upTime>this.tapInterval&&(void 0===this.minTaps||this.tapsCount>=this.minTaps?this.state=tn:this.state=Zr)}}postUpdate(t,e){this.isRunning&&this.enable&&this.state===tn&&(this.state=Zr)}get isTapped(){return this.state===tn}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 Zr="IDLE",Qr="BEGIN",tn="RECOGNIZED",en=Phaser.Utils.Objects.GetValue;class sn extends Gr{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=rn},eventEmitter:!1};this.setRecongizedStateObject(new ks(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(en(t,"threshold",9)),this.setHoldTime(en(t,"time",251)),this}onDragStart(){this.state=nn,0===this.holdTime&&(this.state=hn)}onDragEnd(){this.state=rn}onDrag(){this.state!==rn&&this.pointer.getDistance()>this.dragThreshold&&(this.state=rn)}preUpdate(t,e){this.isRunning&&this.enable&&this.state===nn&&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 rn="IDLE",nn="BEGIN",hn="RECOGNIZED";Phaser.Utils.Objects.GetValue;var an=function(t){return qe(t).loop.delta};const on=Phaser.Math.Distance.Between,ln=Phaser.Math.Angle.Between;var dn={getDt:function(){return an(this.scene)},getVelocity:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return on(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 ln(e.x,e.y,t.x,t.y)}},cn={"up&down":0,"left&right":1,"4dir":2,"8dir":3},un={};const pn=Phaser.Utils.Objects.GetValue,vn=Phaser.Math.RadToDeg;class gn extends Gr{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=fn},eventEmitter:!1};this.setRecongizedStateObject(new ks(s)),this.clearDirectionStates()}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(pn(t,"threshold",10)),this.setVelocityThreshold(pn(t,"velocityThreshold",1e3)),this.setDirectionMode(pn(t,"dir","8dir")),this}onDragStart(){this.state=mn}onDragEnd(){this.state=fn}onDrag(){this.state===mn&&(this.validDrag||(this.validDrag=0===this.dragThreshold||this.pointer.getDistance()>=this.dragThreshold),this.validDrag&&this.dragVelocity>this.velocityThreshold&&(this.state=yn))}postUpdate(t,e){this.isRunning&&this.enable&&this.state===yn&&(this.state=fn)}get isSwiped(){return this.state===yn}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=un),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}}(vn(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,dn);const fn="IDLE",mn="BEGIN",yn="RECOGNIZED",bn=Phaser.Utils.Objects.GetValue,xn=Phaser.Utils.Array.SpliceOne,wn=Phaser.Math.Distance.Between,Sn=Phaser.Math.Angle.Between;class Cn{constructor(t,e){var i=$e(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(bn(e,"inputConfig",void 0)),this.setEventEmitter(bn(e,"eventEmitter",void 0)),this._enable=void 0,this.pointers=[],this.movedState={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setEnable(bn(t,"enable",!0)),this.bounds=bn(t,"bounds",void 0),this.tracerState=Pn,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 Pn:this.tracerState=Tn,this.onDrag1Start();break;case Tn:this.tracerState=_n,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=Pn,this.onDrag1End();break;case _n: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 _n:this.onDrag2()}}}dragCancel(){return this.tracerState===_n&&this.onDrag2End(),this.pointers.length=0,gt(this.movedState),this.tracerState=Pn,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!==_n)return 0;var t=this.pointers[0],e=this.pointers[1];return wn(t.x,t.y,e.x,e.y)}get angleBetween(){if(this.tracerState!==_n)return 0;var t=this.pointers[0],e=this.pointers[1];return Sn(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!==_n)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.x+e.x)/2}get centerY(){if(this.tracerState!==_n)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.y+e.y)/2}get prevCenterX(){if(this.tracerState!==_n)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!==_n)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&&nr(t,s,e,i)}isPointer1InGameObject(t,e,i){var s=this.pointers[1];return!!s&&nr(t,s,e,i)}}Object.assign(Cn.prototype,Ge);var On={};const Pn=0,Tn=1,_n=2,kn="IDLE";Phaser.Utils.Objects.GetValue;const En=Phaser.Math.RotateAround;var Mn=function(t,e,i,s){return En(t,e,i,s),t.rotation+=s,t},Rn={};const Ln=Phaser.Utils.Objects.GetValue,Dn=Phaser.Math.Angle.WrapDegrees,An=Phaser.Math.Angle.ShortestBetween,Yn=Phaser.Math.RadToDeg,zn=Phaser.Math.DegToRad;var Xn={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,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=Dn(Yn(this.angleBetween));this.angle=An(this.prevAngle,t),this.prevAngle=t,this.state=Fn}break;case Fn:t=Dn(Yn(this.angleBetween)),this.angle=An(this.prevAngle,t),this.prevAngle=t,this.emit("rotate",this)}}get isRotated(){return this.state===Fn}get rotation(){return zn(this.angle)}setDragThreshold(t){return this.dragThreshold=t,this}}.prototype,Xn);const Wn="IDLE",jn="BEGIN",Fn="RECOGNIZED",In=Phaser.Utils.Objects.GetValue;var Bn=function(t){var e=In(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){Rr(i.eventEmitter,`${i.eventNamePrefix}${t.tapsCount}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Hn=Phaser.Utils.Objects.GetValue;var Nn=function(t){var e=Hn(t,"press",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._press=new sn(this,e),this._press.on("pressstart",(function(t,e,s){Rr(i.eventEmitter,`${i.eventNamePrefix}pressstart`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this).on("pressend",(function(t,e,s){Rr(i.eventEmitter,`${i.eventNamePrefix}pressend`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Gn=Phaser.Utils.Objects.GetValue;var Vn=function(t){var e=Gn(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";Rr(i.eventEmitter,`${i.eventNamePrefix}swipe${r}`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Un=Phaser.Utils.Objects.GetValue;var $n=function(t,e){return t.setInteractive(),Un(e,"dropZone",!1)&&(t.input.dropZone=!0),t._childrenInteractive={targetSizers:Un(e,"targets",[t]),targetMode:Un(e,"targetMode","parent"),eventEmitter:Un(e,"eventEmitter",t),eventNamePrefix:Un(e,"inputEventPrefix","child.")},Dr.call(t,e),zr.call(t,e),jr.call(t,e),Hr.call(t,e),Bn.call(t,e),Nn.call(t,e),Vn.call(t,e),t},Jn={getSizerConfig:function(t){return void 0===t&&(t=this),Et(t)},getChildPrevState:function(t){var e=Et(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=ae(e,"color"),s=ae(e,"lineWidth");var o=ae(e,"name",!1);o&&(r=ae(o,"createTextCallback",le),n=ae(o,"createTextCallbackScope",void 0),"string"==typeof(h=ae(o,"align","left-top"))&&(h=Yt[h]))}if(void 0===i&&(i=16777215),void 0===s&&(s=1),r&&!t.children){t.children=new oe(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)}}for(var d,c,u=this.getAllShownChildren([this]),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 rh=Phaser.Utils.Objects.IsPlainObject,nh=Phaser.Utils.Objects.GetValue,hh=Phaser.Display.Align.CENTER,ah={min:0,full:-1};var oh=function(t,e,i,s,r,n,h,a,o,l){ve.call(this,t);var d=t.isRexSpace,c=typeof e;if(null===e)return this;if("number"===c);else if("string"===c)e=ah[e];else if(rh(e)){var u;e=nh(u=e,"proportion",void 0),i=nh(u,"align",hh),s=nh(u,"padding",0),r=nh(u,"expand",!1),n=nh(u,"key",void 0),h=nh(u,"index",void 0),t.isRexSizer||(a=nh(u,"minWidth",void 0),o=nh(u,"minHeight",void 0)),l=nh(u,"fitRatio",0)}return"string"==typeof i&&(i=Yt[i]),void 0===e&&(e=d?1:0),void 0===i&&(i=hh),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===a&&(d?a=0:t.isRexSizer||(a=t._minWidth)),void 0===o&&(d?o=0:t.isRexSizer||(o=t._minHeight)),void 0===l||!1===l?l=0:!0===l&&(l=Q(t)/tt(t)),(u=this.getSizerConfig(t)).proportion=e,u.align=i,u.padding=ue(s),u.expand=r,u.fitRatio=0===e?l:0,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},lh={add:oh,addSpace(t){return this.insertSpace(void 0,t),this},insertSpace(t,e){return void 0===e&&(e=1),oh.call(this,new ih(this.scene),{proportion:e,minWidth:0,minHeight:0,index:t}),this},insert(t,e,i,s,r,n,h,a){return rh(i)&&(i.index=t),oh.call(this,e,i,s,r,n,h,t,a),this},insertAtPosition(t,e,i,s,r,n,h,a,o){var l=sh.call(this,t,e);return-1===l&&(l=void 0),this.insert(l,i,s,r,n,h,a,o),this}};const dh=kt.prototype.clear;var ch=function(t){this.backgroundChildren&&(this.backgroundChildren.length=0);var e,i=!t&&this.sizerEventsEnable;if(i&&(e=this.getChildren([])),dh.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}},vh={getChildAlign(t){return this.getSizerConfig(t).align},setChildAlign(t,e){return"string"==typeof e&&(e=Yt[e]),this.getSizerConfig(t).align=e,this}},gh={getChildProportion(t){return this.getSizerConfig(t).proportion},setChildProportion(t,e){return this.getSizerConfig(t).proportion=e,this}},fh={getChildExpand(t){return this.getSizerConfig(t).expand},setChildExpand(t,e){return this.getSizerConfig(t).expand=e,this}},mh={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}},yh={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&&(Ie(t,0,0),e.resolved=!1,this.hasRatioFitChild=!0);return this._childrenProportion=void 0,this.hasProportion0Child=!1,this.proportionLength=void 0,We.call(this),this},layoutChildren:function(){for(var t,e,i,s,r,n,h,a,o,l,d=this.sizerChildren,c=this.innerLeft,u=this.innerTop,p=this.innerWidth,v=this.innerHeight,g=c,f=u,m=this.startChildIndex,y=0,b=d.length;y0?(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)||Le.call(this)},runWidthWrap:function(t){this.wrapResult||(1===this.orientation&&th.call(this,t,void 0),De.call(this,t))},hasHeightWrap:function(){return!(!this.hasRatioFitChild||0!==this.orientation)||Ye.call(this)},runHeightWrap:function(t){this.wrapResult||(0===this.orientation&&th.call(this,void 0,t),ze.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(yh,lh,ph,vh,gh,fh,mh);var bh=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},wh=function(t){return"string"==typeof t&&(t=xh[t]),t};const Sh=Phaser.Utils.Objects.IsPlainObject,Ch=Phaser.Utils.Objects.GetValue;class Oh extends qn{constructor(t,e,i,s,r,n,h){Sh(e)?(e=Ch(h=e,"x",0),i=Ch(h,"y",0),s=Ch(h,"width",void 0),r=Ch(h,"height",void 0),n=Ch(h,"orientation",0)):Sh(s)?(s=Ch(h=s,"width",void 0),r=Ch(h,"height",void 0),n=Ch(h,"orientation",0)):Sh(n)&&(n=Ch(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(Ch(h,"space.item",0)),this.setStartChildIndex(Ch(h,"startChildIndex",0)),this.setRTL(Ch(h,"rtl",!1)),this.addChildrenMap("items",this.sizerChildren)}setOrientation(t){return this.orientation=wh(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=bh.call(this)),this._childrenProportion}}Object.assign(Oh.prototype,yh);var Ph=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 Th extends zs{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 _h={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}},kh=function(t,e){Di.popUp.call(t,e,this.expandDirection)},Eh=function(t,e){Di.scaleDown.call(t,e,this.expandDirection)},Mh={setTransitionDuration(t){return this.transitionDuration=t,this.childTransition.setTransitInTime(t).setTransitOutTime(t),this},setExpandCallback(t){return void 0===t&&(t=kh.bind(this)),this.childTransition.setTransitInCallback(t),this},setCollapseCallback(t){return void 0===t&&(t=Eh.bind(this)),this.childTransition.setTransitOutCallback(t),this}};const Rh=Phaser.Utils.Objects.GetValue;class Lh extends Oh{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=Rh(e,"space"),h=1===this.orientation?"left":"top",a=Rh(e,"align.title",h),o=Rh(e,"expand.title",!0);this.add(s,{proportion:0,align:a,expand:o,padding:{left:Rh(n,"titleLeft",0),right:Rh(n,"titleRight",0),top:Rh(n,"titleTop",0),bottom:Rh(n,"titleBottom",0)}});var l=Rh(e,"toggleByTarget",void 0),d=Rh(e,"toggleClickConfig");if(void 0===l&&(l=s),l&&mr.onClick.call(l,(function(){this.toggle()}),this,d),this.childTransition=new Th(r),!Rh(e,"customChildOrigin",!1)){var c=this.rtl?1:0;r.setOrigin(c)}a=Rh(e,"align.child","left");var u=(o=Rh(e,"expand.child",!0))?1:0;this.add(r,{proportion:u,align:a,expand:o,padding:{left:Rh(n,"childLeft",0),right:Rh(n,"childRight",0),top:Rh(n,"childTop",0),bottom:Rh(n,"childBottom",0)}}),this.addChildrenMap("title",s),this.addChildrenMap("child",r),this.addChildrenMap("background",i);var p=e.transition;this.setTransitionDuration(Rh(p,"duration",200)),this.setExpandCallback(Rh(p,"expandCallback",void 0)),this.setCollapseCallback(Rh(p,"collapseCallback",void 0)),this.reLayoutTarget=Rh(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=Rh(e,"expanded",void 0);void 0!==y&&this.setExpandedState(y)}}Object.assign(Lh.prototype,_h,Mh);var Dh={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}},Ah=function(t,e,i,s,r=!1){var n;return yt(e)?(n=e,delete e[key]):Qs(e)?(n=e(t,i))&&t.add.existing(n):(r||e)&&s&&(n=s(t,e,i)),n},Yh=Phaser.Renderer.WebGL.Utils,zh=function(t,e,i,s,r,n){for(var h=Yh.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+")"},Ih=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 Bh=Phaser.Renderer.Canvas.SetTransform;var Hh={renderWebGL:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.pipelines.set(e.pipeline),n=jh(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&&Wh(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(Bh(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(Gh.prototype,Hh);const Vh=Phaser.Utils.Objects.GetValue;let Uh=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=Vh(t,"x",0),i=Vh(t,"y",0));var s=this.cornerRadius;s.tl=$h(Vh(t,"tl",void 0),e,i),s.tr=$h(Vh(t,"tr",void 0),e,i),s.bl=$h(Vh(t,"bl",void 0),e,i),s.br=$h(Vh(t,"br",void 0),e,i)}get radiusTL(){var t=this.cornerRadius.tl;return Math.max(t.x,t.y)}set radiusTL(t){Jh(this.cornerRadius.tl,t)}get radiusTR(){var t=this.cornerRadius.tr;return Math.max(t.x,t.y)}set radiusTR(t){Jh(this.cornerRadius.tr,t)}get radiusBL(){var t=this.cornerRadius.bl;return Math.max(t.x,t.y)}set radiusBL(t){Jh(this.cornerRadius.bl,t)}get radiusBR(){var t=this.cornerRadius.br;return Math.max(t.x,t.y)}set radiusBR(t){Jh(this.cornerRadius.br,t)}};var $h=function(t,e,i){return void 0===t?t={x:e,y:i}:"number"==typeof t&&(t={x:t,y:t}),Kh(t),t},Jh=function(t,e){"number"==typeof e?(t.x=e,t.y=e):(t.x=Vh(e,"x",0),t.y=Vh(e,"y",0)),Kh(t)},Kh=function(t){t.convex=t.x>=0||t.y>=0,t.x=Math.abs(t.x),t.y=Math.abs(t.y)},qh=function(t){return t.x>0&&t.y>0},Zh=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 Qh=Phaser.Math.DegToRad;var ta=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 eo=Phaser.Utils.Objects.GetValue,io=Phaser.Utils.Objects.IsPlainObject;class so extends(_a(ba)){constructor(t,e,i,s,r,n,h,a){io(e)?(e=(a=e).x,i=a.y,s=a.width,r=a.height,n=a.barColor,h=a.value):io(s)?(s=(a=s).width,r=a.height,n=a.barColor,h=a.value):io(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 Qa).setName("trackFill")).addShape((new Qa).setName("bar")).addShape((new Qa).setName("trackStroke")),this.setTrackColor(eo(a,"trackColor",void 0)),this.setBarColor(n),this.setTrackStroke(eo(a,"trackStrokeThickness",2),eo(a,"trackStrokeColor",void 0)),this.setSkewX(eo(a,"skewX",0)),this.setRTL(eo(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 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,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),to(h,r,0,n,i,t));var a=this.getShape("trackStroke");a.lineStyle(this.trackStrokeThickness,this.trackStrokeColor),a.isStroked&&to(a,0,0,e,i,t)}};Object.assign(so.prototype,ro);var no=function(t){return null==t||""===t||0===t.length},ho=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,h=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 To=Phaser.Utils.Objects.IsPlainObject,_o=Phaser.Utils.Objects.GetValue;var ko=function(t){return"string"==typeof t&&(t=Eo[t]),t};const Eo={scale:0,repeat:1};var Mo=function(t,e){return 0===t||t===this.columns.count-1||0===e||e===this.rows.count-1},Ro={_beginDraw:zt,_drawImage:zt,_drawTileSprite:zt,_endDraw:zt,setGetFrameNameCallback:function(t){return void 0===t&&(t=Oo),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),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 To(t)?(this.stretchMode.edge=ko(_o(t,"edge",0)),this.stretchMode.internal=ko(_o(t,"internal",0))):(t=ko(t),this.stretchMode.edge=t,this.stretchMode.internal=t),this},getStretchMode:function(t,e){return Mo.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 Lo=Phaser.Utils.Objects.IsPlainObject,Do=Phaser.Utils.Objects.GetValue,Ao=Phaser.GameObjects;var Yo=void 0,zo=function(t,e){if(Yo||(Yo={},qe(t).events.once("destroy",(function(){for(var t in Yo)Yo[t].destroy();Yo=void 0}))),!Yo.hasOwnProperty(e)){var i=qe(t).scene.systemScene;(t=new Ao[e](i)).setOrigin(0),Yo[e]=t}return Yo[e]};const Xo=Phaser.GameObjects.RenderTexture;class Wo extends(function(t,e){class i extends t{constructor(t,i,s,r,n,h,a,o,l,d){if(Lo(i)?(i=Do(d=i,"x",0),s=Do(d,"y",0),r=Do(d,"width",1),n=Do(d,"height",1),h=Do(d,"key",void 0),a=Do(d,"baseFrame",void 0),o=Do(d,"columns",void 0),l=Do(d,"rows",void 0)):Lo(r)?(r=Do(d=r,"width",1),n=Do(d,"height",1),h=Do(d,"key",void 0),a=Do(d,"baseFrame",void 0),o=Do(d,"columns",void 0),l=Do(d,"rows",void 0)):Lo(h)?(h=Do(d=h,"key",void 0),a=Do(d,"baseFrame",void 0),o=Do(d,"columns",void 0),l=Do(d,"rows",void 0)):Lo(a)?(a=Do(d=a,"baseFrame",void 0),o=Do(d,"columns",void 0),l=Do(d,"rows",void 0)):Array.isArray(a)?(d=l,l=o,o=a,a=Do(d,"baseFrame",void 0)):Lo(o)&&(o=Do(d=o,"columns",void 0),l=Do(d,"rows",void 0)),void 0===a&&(a=Do(d,"frame",void 0)),void 0===o){var c=Do(d,"leftWidth",void 0),u=Do(d,"rightWidth",void 0);void 0!==c&&void 0!==u&&(o=[c,void 0,u])}if(void 0===l){var p=Do(d,"topHeight",void 0),v=Do(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(Do(d,"getFrameNameCallback",void 0)),this.setStretchMode(Do(d,"stretchMode",0)),this.setPreserveRatio(Do(d,"preserveRatio",!0));var g=Do(d,"maxFixedPartScale",1),f=Do(d,"maxFixedPartScaleX",g),m=Do(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,Ro),i}(Xo,"rexNinePatch")){}var jo={_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(Wo.prototype,jo);let Fo=class extends Qe{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 Io=Phaser.Utils.Objects.GetValue;class Bo extends Wo{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexStatesNinePatch";var i=Io(e,"effects",!0);i&&go(this,i),this.style=new Fo(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign(Bo.prototype,ca);const Ho=["alpha","tint","flipX","flipY"];var No=function(t,e){if(!e)return t;for(var i=0,s=Ho.length;i0&&r.push(o.join("")),r},cl=0,ul=1,pl=2,vl=0,gl=1,fl=2,ml=/(?:\r\n|\r|\n)/;const yl={none:vl,word:gl,char:fl,character:fl,mix:3},bl=Phaser.Renderer.WebGL.Utils;var xl={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=bl.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 wl=Phaser.Display.Color;var Sl={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 wl);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}},Cl=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)},Ol={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,Cl(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 Pl=Phaser.Display.Canvas.CanvasPool,Tl=Phaser.GameObjects.GameObject,_l=Phaser.Utils.String.UUID;class kl extends Tl{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=Pl.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=_l(),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(){Pl.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 El=Phaser.GameObjects.Components;Phaser.Class.mixin(kl,[El.Alpha,El.BlendMode,El.Crop,El.Depth,El.Flip,El.GetBounds,El.Mask,El.Origin,El.Pipeline,El.PostPipeline,El.ScrollFactor,El.Tint,El.Transform,El.Visible,xl,Sl,Ol]);class Ml{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(Ml.prototype,Ea);var Rl={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 Ll=Phaser.Math.RotateAround;var Dl;const Al=Phaser.Geom.Rectangle;var Yl,zl=function(t){void 0===Yl&&(Yl=new Al);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 Wl,jl=function(t,e,i,s){return void 0===s?s={}:!0===s&&(void 0===Wl&&(Wl={}),s=Wl),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 Fl=Phaser.GameObjects.Components.TransformMatrix;var Il,Bl,Hl={},Nl=function(t,e,i,s,r){var n=jl(e,i,s,!0),h=function(t,e,i,s){void 0===s?s={}:!0===s&&(s=Hl);var r=e-t.width*t.originX,n=i-t.height*t.originY;return void 0===Il&&(Il=new Fl,Bl=new Fl),t.parentContainer?t.getWorldTransformMatrix(Il,Bl):Il.applyITRS(t.x,t.y,t.rotation,t.scaleX,t.scaleY),Il.transformPoint(r,n,s),s}(t,n.x,n.y,r);return h},Gl=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 Nl(t,e,n,h,r)},Vl={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===Dl&&(Dl={}),s=Dl),s.x=(t-i.drawX)/i.scaleX,s.y=(e-i.drawY)/i.scaleY,0!==i.rotation&&Ll(s,0,0,-i.rotation),s}(t,e,this,!0);return zl(this).contains(i.x,i.y)},getWorldPosition:function(t,e,i){return Gl(this.parent,this,t,e,i)}};Object.assign(Vl,Rl);const Ul=Phaser.Math.DegToRad,$l=Phaser.Math.RadToDeg,Jl=Phaser.Utils.Objects.GetValue;class Kl extends Ml{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 $l(this._rotation)}set angle(t){this.rotation=Ul(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=Jl(t,"width",void 0),i=Jl(t,"height",void 0),s=Jl(t,"scaleX",void 0),r=Jl(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(Kl.prototype,Vl);const ql=Phaser.Utils.String.Pad;var Zl=function(t,e,i){if(null==t)return t;switch(typeof t){case"string":default:return t;case"number":return`#${ql(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}},Ql=function(t,e,i){return e.hasOwnProperty(t)?e[t]:i[t]};const td=Phaser.Math.DegToRad;var ed=function(t){return!t.hasOwnProperty("convex")||t.convex},id=function(t){return t.x>0&&t.y>0},sd=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,id(a)?(o=a.x*g,l=a.y*f,ed(a)?sd(t,o,l,o,l,180,270,!1,h):sd(t,0,0,o,l,90,0,!0,h),d=0,c=l):(t.lineTo(0,0),d=0,c=0),a=m.tr,id(a)?(o=a.x*g,l=a.y*f,ed(a)?sd(t,s-o,l,o,l,270,360,!1,h):sd(t,s,0,o,l,180,90,!0,h)):t.lineTo(s,0),a=m.br,id(a)?(o=a.x*g,l=a.y*f,ed(a)?sd(t,s-o,r-l,o,l,0,90,!1,h):sd(t,s,r,o,l,270,180,!0,h)):t.lineTo(s,r),a=m.bl,id(a)?(o=a.x*g,l=a.y*f,ed(a)?sd(t,o,r-l,o,l,90,180,!1,h):sd(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())},nd=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),rd(t.canvas,t.context,d,d,o,l,r,e,i,s,n,h,a)}};const hd=Phaser.Utils.Objects.GetValue;class ad extends Kl{constructor(t,e){super(t,"background"),this.setScrollFactor(0),this.setColor(hd(e,"color",null),hd(e,"color2",null),hd(e,"horizontalGradient",!0)),this.setStroke(hd(e,"stroke",null),hd(e,"strokeThickness",2)),this.setCornerRadius(hd(e,"cornerRadius",0),hd(e,"cornerIteration",null))}set color(t){t=Zl(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=Zl(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=Zl(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,Ql("color2",t,this),Ql("horizontalGradient",t,this)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,Ql("strokeThickness",t,this)),t.hasOwnProperty("cornerRadius")&&this.setCornerRadius(t.cornerRadius,Ql("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(){nd(this.parent,this.color,this.stroke,this.strokeThickness,this.cornerRadius,this.color2,this.horizontalGradient,this.cornerIteration)}}const od=Phaser.Utils.Objects.GetValue;class ld extends Kl{constructor(t,e){super(t,"innerbounds"),this.setScrollFactor(0),this.setColor(od(e,"color",null),od(e,"color2",null),od(e,"horizontalGradient",!0)),this.setStroke(od(e,"stroke",null),od(e,"strokeThickness",2))}set color(t){t=Zl(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=Zl(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=Zl(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,od(t,"color2",null),od(t,"horizontalGradient",!0)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,od(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 dd=Phaser.Utils.Objects.GetValue;let cd=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(dd(t,"bold",!1)),this.setItalic(dd(t,"italic",!1)),this.setFontSize(dd(t,"fontSize","16px")),this.setFontFamily(dd(t,"fontFamily","Courier")),this.setColor(dd(t,"color","#fff")),this.setStrokeStyle(dd(t,"stroke",null),dd(t,"strokeThickness",0)),this.setShadow(dd(t,"shadowColor",null),dd(t,"shadowOffsetX",0),dd(t,"shadowOffsetY",0),dd(t,"shadowBlur",0)),this.setOffset(dd(t,"offsetX",0),dd(t,"offsetY",0)),this.setSpace(dd(t,"leftSpace",0),dd(t,"rightSpace",0)),this.setAlign(dd(t,"align",void 0)),this.setBackgroundColor(dd(t,"backgroundColor",null)),this.setBackgroundHeight(dd(t,"backgroundHeight",void 0)),this.setBackgroundBottomY(dd(t,"backgroundBottomY",void 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(Ql("stroke",t,this),Ql("strokeThickness",t,this)),t.hasOwnProperty("shadowColor")&&this.setShadowColor(t.shadowColor),(t.hasOwnProperty("shadowOffsetX")||t.hasOwnProperty("shadowOffsetY"))&&this.setShadowOffset(Ql("shadowOffsetX",t,this),Ql("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),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=Zl(t),this}get hasFill(){return null!=this.color}setStrokeStyle(t,e){return this.stroke=Zl(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=Zl(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=Zl(t),this}get hasBackgroundColor(){return null!=this.backgroundColor}setBackgroundHeight(t){return this.backgroundHeight=t,this}setBackgroundBottomY(t){return this.backgroundBottomY=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 ud=Phaser.Utils.Array.Remove,pd=Phaser.Utils.Array.Remove,vd="text",gd="image",fd="drawer",md="space",yd="command";var bd=function(t){return t.type===vd&&"\n"===t.text},xd=function(t){return t.type===vd&&"\f"===t.text},wd=function(t){return t.type===vd};class Sd extends Kl{constructor(t,e,i){super(t,vd),this.updateTextFlag=!1,this.style=new cd(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,s=this.drawTRX-i+1,r=e.backgroundBottomY;null==r&&(r=this.drawBLY);var n=e.backgroundHeight;null==n&&(n=r-this.drawTLY);var h=r-n;t.fillRect(i,h,s,n)}var a=e.hasFill,o=e.hasStroke;(a||o)&&(e.syncFont(t).syncStyle(t),o&&(e.syncShadow(t),t.strokeText(this.text,0,0)),a&&(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 Od=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=Od.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),Od.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 Td extends Kl{constructor(t,e,i){super(t,gd),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 _d extends Kl{constructor(t,e,i,s){super(t,fd),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 kd extends Kl{constructor(t,e){super(t,md),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 Ed extends Ml{constructor(t,e,i,s,r){super(t,yd),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 Md=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 Rd={none:0,word:1,char:2,character:2,mix:3};var Ld=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=zd.call(this)).height,h=l.ascent,i=Math.floor((o-h)/n))}else{var l;n=(l=zd.call(this)).height,h=l.ascent}}else this.fixedHeight>0?void 0===(i=Wd(t,"maxLines"))&&(o=this.fixedHeight-s,i=Math.floor(o/n)):i=Wd(t,"maxLines",0);void 0===h&&(h=n);var d=0===i,c=Wd(t,"wrapMode");void 0===c&&(c=Wd(t,"charWrap",!1)?"char":"word"),"string"==typeof c&&(c=Rd[c]);var u=Wd(t,"wrapWidth",void 0);void 0===u&&(this.fixedWidth>0?u=this.fixedWidth-r:(u=1/0,c=0));for(var p=Wd(t,"letterSpacing",0),v=Wd(t,"hAlign",0),g=Wd(t,"vAlign",0),f=Wd(t,"justifyPercentage",.25),m=Md({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===_,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=Id(t,"maxLines",void 0))){var h=this.fixedWidth-r;i=Math.floor(h/n)+1}}else i=Id(t,"maxLines",0);var a=0===i,o=Id(t,"fixedCharacterHeight",void 0);if(void 0===o){var l=Id(t,"charPerLine",void 0);if(void 0!==l){var d=this.fixedHeight-s;o=Math.floor(d/l)}}var c=Id(t,"wrapHeight",void 0);void 0===c&&(c=this.fixedHeight>0?this.fixedHeight-s:1/0);for(var u=Id(t,"letterSpacing",0),p=Id(t,"rtl",!0),v=Id(t,"hAlign",p?2:0),g=Id(t,"vAlign",0),f=Md({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+=_.length,f.isLastPage=f.start===T,f.maxLineHeight=R,f.linesWidth=k.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 Ee(i,t,e),this.dirty=this.dirty||s!=i.left||r!=i.right||n!=i.top||h!=i.bottom,this},getPadding:function(t){return ke(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),ud(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 pd(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(vd);return null===i?i=new Sd(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)),Gl(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 uc=Phaser.Utils.Objects.GetFastValue;var pc={};class vc{constructor(t){this.pools=uc(t,"pools",pc)}free(t){if(!this.pools)return this;var e=t.type;return this.pools.hasOwnProperty(e)||(this.pools[e]=new cc),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=Sc(t,r,e,i,n),a=0;a<=bc&&0!==h;a++){if((r+=h)<0){r=0;break}h=Sc(t,r,e,i,n)}return a===bc&&console.warn("FontSizeFit: Test count exceeds 65535"),t.setFontSize(r),Cc(t,e,i),t},wc=function(t,e,i){return void 0===i[e]&&(t.setFontSize(e),i[e]={width:t.width,height:t.height}),i[e]},Sc=function(t,e,i,s,r){var n,h=wc(t,e,r),a=wc(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)},Cc=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 Oc=Phaser.Utils.Objects.GetValue,Pc=Phaser.Utils.Objects.GetValue;class Tc extends Ko{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexLabel";var i,s=Pc(e,"background",void 0),r=Pc(e,"icon",void 0),n=Pc(e,"iconMask",void 0),h=Pc(e,"text",void 0),a=Pc(e,"action",void 0),o=Pc(e,"actionMask",void 0),l=Pc(e,"align",void 0);if(s&&this.addBackground(s),r){0===this.orientation?(h||a)&&(i={right:Pc(e,"space.icon",0),top:Pc(e,"space.iconTop",0),bottom:Pc(e,"space.iconBottom",0),left:Pc(e,"space.iconLeft",0)}):(h||a)&&(i={bottom:Pc(e,"space.icon",0),left:Pc(e,"space.iconLeft",0),right:Pc(e,"space.iconRight",0),top:Pc(e,"space.iconTop",0)});var d=Pc(e,"squareFitIcon",!1)?1:0;if(this.add(r,{proportion:0,padding:i,fitRatio:d}),n&&(n=el.call(this,r,r,1)),!d){var c=Pc(e,"iconSize",void 0);this.setIconSize(Pc(e,"iconWidth",c),Pc(e,"iconHeight",c))}}if(h){var u=Pc(e,"wrapText",!1),p=Pc(e,"adjustTextFontSize",!1);u?(!0===u&&(u="word"),function(t,e){switch(hl(t)){case 0:switch("string"==typeof e&&(e=yl[e]||0),t.style.wrapMode=e,e){case 2:case 3:t.style.wordWrapCallback=ll;break;default:t.style.wordWrapCallback=null}break;case 1:"string"==typeof e&&(e=yl[e]||0),t.style.wrapMode=e}}(h,u),e.expandTextWidth=!0,yc(h)):p&&(e.expandTextWidth=!0,e.expandTextHeight=!0,function(t,e){"number"==typeof e&&(e={minWidth:e});var i=Oc(e,"minWidth",0),s=Oc(e,"minHeight",0),r=Oc(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 xc(t,e,i),t}):(t.runWidthWrap=function(e){return t.setFixedSize&&t.setFixedSize(0,0),xc(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=Pc(e,"space.text",0),m=Pc(e,"expandTextWidth",!1),y=Pc(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:Pc(e,"space.actionTop",0),bottom:Pc(e,"space.actionBottom",0),right:Pc(e,"space.actionRight",0)}:{left:Pc(e,"space.actionLeft",0),right:Pc(e,"space.actionRight",0),bottom:Pc(e,"space.actionBottom",0)},d=Pc(e,"squareFitAction",!1)?1:0,this.add(a,{proportion:0,padding:i,fitRatio:d}),o&&(o=el.call(this,a,a,1)),!d)){var b=Pc(e,"actionSize");this.setActionSize(Pc(e,"actionWidth",b),Pc(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)}}const _c=Phaser.GameObjects.Text,kc=Phaser.Utils.Objects.GetValue;class Ec extends _c{constructor(t,e){void 0===e&&(e={}),super(t,kc(e,"x",0),kc(e,"y",0),kc(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(Ec.prototype,ca);var Mc=Phaser.Renderer.WebGL.Utils,Rc={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=Mc.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 Lc=Phaser.Display.Canvas.CanvasPool;e();const Dc=Phaser.GameObjects.GameObject;class Ac extends Dc{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=Lc.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 Lc.remove(s),i;for(var l=r.getImageData(0,0,h,o).data,d=!1,c=0;c * @copyright 2018 Photon Storm Ltd. diff --git a/dist/rextweaker.js b/dist/rextweaker.js index 313f92bf83..b8a99eb995 100644 --- a/dist/rextweaker.js +++ b/dist/rextweaker.js @@ -19856,6 +19856,10 @@ Render$2 ); + var IsArcCorner = function (radius) { + return ((radius.x > 0) && (radius.y > 0)); + }; + var LineTo = function (x, y, pathData) { var cnt = pathData.length; if (cnt >= 2) { @@ -19937,8 +19941,7 @@ geom.setTo(0, 0, width, height, radius); } - var iteration = GetValue$1p(radiusConfig, 'iteration', undefined); - this.setIteration(iteration); + this.setIteration(GetValue$1p(radiusConfig, 'iteration', undefined)); this.setPosition(x, y); this.setFillStyle(fillColor, fillAlpha); @@ -20191,10 +20194,6 @@ }; - var IsArcCorner = function (radius) { - return ((radius.x > 0) && (radius.y > 0)); - }; - const ShapeTypeMap = { rectangle: 0, circle: 1 @@ -21961,6 +21960,7 @@ var skewX = this.skewX; var width = this.width - Math.abs(skewX); var height = this.height; + var trackFill = this.getShape('trackFill'); trackFill.fillStyle(this.trackColor); if (trackFill.isFilled) { @@ -21969,8 +21969,7 @@ 0, 0, // x0, y0 width, height, // x1, y1 skewX // skewX - ) - .close(); + ); } var bar = this.getShape('bar'); @@ -21990,8 +21989,7 @@ barX0, 0, // x0, y0 barX1, height, // x1, y1 skewX // skew - ) - .close(); + ); } var trackStroke = this.getShape('trackStroke'); @@ -22002,8 +22000,7 @@ 0, 0, // x0, y0 width, height, // x1, y1 skewX // skewX - ) - .end(); + ); } }; @@ -22023,6 +22020,8 @@ .lineTo(x0, y0).lineTo(startX, y0); } + lines.close(); + return lines; }; @@ -22033,24 +22032,33 @@ constructor(scene, x, y, width, height, barColor, value, config) { if (IsPlainObject$i(x)) { config = x; - x = GetValue$1l(config, 'x', 0); - y = GetValue$1l(config, 'y', 0); - width = GetValue$1l(config, 'width', 2); - height = GetValue$1l(config, 'height', 2); - barColor = GetValue$1l(config, 'barColor', undefined); - value = GetValue$1l(config, 'value', 0); + + x = config.x; + y = config.y; + width = config.width; + height = config.height; + barColor = config.barColor; + value = config.value; } else if (IsPlainObject$i(width)) { config = width; - width = GetValue$1l(config, 'width', 2); - height = GetValue$1l(config, 'height', 2); - barColor = GetValue$1l(config, 'barColor', undefined); - value = GetValue$1l(config, 'value', 0); + + width = config.width; + height = config.height; + barColor = config.barColor; + value = config.value; } else if (IsPlainObject$i(barColor)) { config = barColor; - barColor = GetValue$1l(config, 'barColor', undefined); - value = GetValue$1l(config, 'value', 0); + + barColor = config.barColor; + value = config.value; } + if (x === undefined) { x = 0; } + if (y === undefined) { y = 0; } + if (width === undefined) { width = 2; } + if (height === undefined) { height = width; } + if (value === undefined) { value = 0; } + super(scene, x, y, width, height, config); this.type = 'rexLineProgress'; diff --git a/dist/rextweaker.min.js b/dist/rextweaker.min.js index cca3f740cb..681fea9768 100644 --- a/dist/rextweaker.min.js +++ b/dist/rextweaker.min.js @@ -1,4 +1,4 @@ -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 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 Y=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}},Pe=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,_e=Phaser.Utils.Objects.GetValue;var Me=function(t,e){return void 0===e?t:t[e]},Ee=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=_e(e,"left",0),t.right=_e(e,"right",0),t.top=_e(e,"top",0),t.bottom=_e(e,"bottom",0)),t},Re={getInnerPadding(t){return Me(this.space,t)},setInnerPadding(t,e){return Ee(this.space,t,e),this},getOuterPadding(t){return Me(this.getSizerConfig(this).padding,t)},setOuterPadding(t,e){return Ee(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)),Ee(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}},De=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},Be=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},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},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}},je=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:vi,this.repeatCounter=0,this}stop(){return this.state=pi,this}update(t,e){this.state!==pi&&this.state!==mi&&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=fi)):(this.nowTime=this.duration,this.state=mi):this.nowTime>=0&&(this.state=gi))}get t(){var t;switch(this.state){case pi:case vi:case fi:t=0;break;case gi:t=this.nowTime/this.duration;break;case mi:t=1}return ci(t,0,1)}set t(t){(t=ci(t,-1,1))<0?(this.state=vi,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===pi}get isDelay(){return this.state===vi}get isCountDown(){return this.state===gi}get isRunning(){return this.state===vi||this.state===gi}get isDone(){return this.state===mi}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}}const pi=0,vi=1,gi=2,fi=3,mi=-1;class yi extends oi{constructor(t,e){super(t,e),this.timer=new ui}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 bi=Phaser.Utils.Objects.GetValue,xi=Phaser.Utils.Objects.GetAdvancedValue,Ci=Phaser.Tweens.Builders.GetEaseFunction;class wi extends yi{resetFromJSON(t){return this.timer.resetFromJSON(bi(t,"timer")),this.setEnable(bi(t,"enable",!0)),this.setTarget(bi(t,"target",this.parent)),this.setDelay(xi(t,"delay",0)),this.setDuration(xi(t,"duration",1e3)),this.setEase(bi(t,"ease","Linear")),this.setRepeat(bi(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 Si=Phaser.Utils.Objects.GetValue,ki=Phaser.Utils.Objects.GetAdvancedValue,Oi=Phaser.Math.Linear;let Pi=class extends wi{constructor(t,e){super(t,e),this.scaleStart={},this.scaleEnd={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(Si(t,"mode",0)),this.setScaleRange(ki(t,"start",void 0),ki(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=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=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 _i=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 Pi(t,h):r.resetFromJSON(h),r.restart(),r},Mi=function(t,e,i,s,r,n){void 0===s&&(s="Linear"),r instanceof Pi&&(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 Pi(t,a):n.resetFromJSON(a),n.restart(),n},Ei=function(t,e){return new Promise((function(i,s){t.once(e,(function(){i()}))}))},Ri=function(t){return Ei(t,"complete")};const Li=Phaser.Utils.Objects.IsPlainObject;var Di={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=_i(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=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),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 Pi(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()}},Ai={};Object.assign(Ai,Di),Ai.onInitScale=function(){Di.onInitScale.call(this);var t=this;this._scaleBehavior.on("update",(function(){var e=ye.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const Bi=Phaser.Utils.Objects.GetValue,zi=Phaser.Utils.Objects.GetAdvancedValue,Wi=Phaser.Math.Linear;class Ii extends wi{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(Bi(t,"mode",0)),this.setAlphaRange(zi(t,"start",this.parent.alpha),zi(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=ji[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 ji={stop:0,destroy:1,yoyo:2},Yi=Phaser.Utils.Objects.IsPlainObject;var Fi=function(t,e,i,s){var r,n;Yi(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},Xi=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 Hi=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(Hi(t)){var i=t;t=i.duration,e=i.alpha}var s=void 0===this._fade;return this._fade=Fi(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(Hi(t)){var i=t;t=i.duration,e=i.destroy}var s=void 0===this._fade;return this._fade=Xi(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()}},Gi={};Object.assign(Gi,Vi),Gi.onInitFade=function(){Vi.onInitFade.call(this);var t=this;this._fade.on("update",(function(){var e=ye.getParentSizer(t);e&&e.resetChildAlphaState(t)}))};const Ui=Phaser.Utils.Objects.GetValue,Ni=Phaser.Utils.Objects.GetAdvancedValue,$i=Phaser.Math.Linear;class Ki extends wi{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){if(super.resetFromJSON(t),this.setMode(Ui(t,"mode",0)),t&&(t.hasOwnProperty("x")||t.hasOwnProperty("y"))){var e=Ni(t,"x",void 0),i=Ni(t,"y",void 0);this.setTargetPosition(e,i)}else this.setTargetPosition(t);return this}setMode(t){return"string"==typeof t&&(t=Ji[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=Ni(i,"startX",void 0),this.startY=Ni(i,"startY",void 0),this.endX=Ni(i,"endX",void 0),this.endY=Ni(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 Ji={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 Zi=Phaser.Utils.Objects.IsPlainObject,Qi=Phaser.Math.Distance.Between;var ts={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(Zi(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*Qi(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),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(Zi(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*Qi(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),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}},es={};Object.assign(es,ts),es.onInitEaseMove=function(){ts.onInitEaseMove.call(this);var t=this;this._easeMove.on("update",(function(){var e=ye.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const is=Phaser.Utils.Objects.GetValue;class ss extends ni{constructor(t,e){super(t,e),this.timer=new ui,this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.timer.resetFromJSON(is(t,"timer")),this.setEnable(is(t,"enable",!0)),this.setMode(is(t,"mode",1)),this.isRunning=is(t,"isRunning",!1),this.setMagnitudeMode(is(t,"magnitudeMode",1)),this.setAxisMode(is(t,"axis",0)),this.setDuration(is(t,"duration",500)),this.setMagnitude(is(t,"magnitude",10)),this.ox=is(t,"ox",void 0),this.oy=is(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=rs[t]),this.mode=t,this}setMagnitudeMode(t){return"string"==typeof t&&(t=as[t]),this.magnitudeMode=t,this}setAxisMode(t){return"string"==typeof t&&(t=ns[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=is(i,"magnitude",void 0),t=is(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 rs={effect:0,behavior:1},ns={both:0,"h&v":0,"x&y":0,horizontal:1,h:1,x:1,vertical:2,v:2,y:2},as={constant:0,decay:1},hs=Phaser.Utils.Objects.IsPlainObject;var os={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 ss(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 ls=Phaser.Utils.Objects.GetValue,ds=Phaser.Math.Linear;class cs extends wi{constructor(t,e){super(t,e),this.resetFromJSON(),this.boot()}start(t){if(this.timer.isRunning)return this;var e=this.target;this.propertyKey=ls(t,"key","value");var i=e[this.propertyKey];return this.fromValue=ls(t,"from",i),this.toValue=ls(t,"to",i),this.setEase(ls(t,"ease",this.ease)),this.setDuration(ls(t,"duration",this.duration)),this.setRepeat(ls(t,"repeat",0)),this.setDelay(ls(t,"delay",0)),this.setRepeatDelay(ls(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]=ds(this.fromValue,this.toValue,i)}}const us=Phaser.Utils.Objects.IsPlainObject;class ps extends ti{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(us(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(us(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 vs={easeDataTo(t,e,i,s){return this._easeData||(this._easeData=new ps(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),Ei(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,fs={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=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}},Bs={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}},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}},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}},Is={};Object.assign(Is,As,Bs,zs,Ws);const js=Phaser.Utils.Objects.GetValue;class Ys extends ti{constructor(t,e){super(t,e),this.setTransitInTime(js(e,"duration.in",200)),this.setTransitOutTime(js(e,"duration.out",200)),this.setTransitInCallback(js(e,"transitIn")),this.setTransitOutCallback(js(e,"transitOut")),this.oneShotMode=js(e,"destroy",!1),this.delayCallTimer=void 0,this._state=new Ds(this,{eventEmitter:!1,initState:js(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,Is);var Fs=function(t){if(t.parentContainer)return Fs(t.parentContainer);var e=function(t){var e=t.displayList;return N(e)?e:null}(t);return e?Fs(e):t};class Xs extends ti{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 Hs=Phaser.GameObjects.Rectangle;let Vs=class extends Hs{constructor(t,e,i){super(t,0,0,2,2,e,1),this.fullWindow=new Xs(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 ti{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 $s=Phaser.Utils.Objects.GetValue;class Ks extends Vs{constructor(t,e){super(t,$s(e,"color",0),$s(e,"alpha",.8)),this.touchEventStop=new Us(this,{hitAreaMode:1})}}var Js={popUp(t,e){void 0!==t._modalScaleSave?(t.scaleX=t._modalScaleSave,t.scaleY=t._modalScaleSave):t._modalScaleSave=t.scaleX,_i(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,Fi(t,e)},fadeOut(t,e){Xi(t,e,!1)}},qs=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Fi(t,e,t.alpha)},Zs=function(t,e){Xi(t,e,!1)},Qs=function(t,e,i,s,r){return!(!t||s&&!s(t,e,i)||!rt(t,!0).contains(e,i)||r&&!r(t,e,i))};const tr=Phaser.Utils.Objects.GetValue;let er=class extends Ys{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 Ks(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",qs)),this.setCoverTransitOutCallback(tr(i,"transitOut",Zs)));var s=tr(e,"touchOutsideClose",!1),r=tr(e,"duration.hold",-1),n=tr(e,"timeOutClose",r>=0),a=tr(e,"anyTouchClose",!1);tr(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),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=Js.popUp;break;case ir.fadeIn:t=Js.fadeIn}return super.setTransitInCallback(t),this}setTransitOutCallback(t){switch("string"==typeof t&&(t=ir[t]),t){case ir.scaleDown:t=Js.scaleDown;break;case ir.fadeOut:t=Js.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},ar={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}},hr=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,a=0===t.scrollFactorX&&0===t.scrollFactorY;if(e)return a?Qs(t,e.x,e.y,i,s):!!(r=hr(e,n,!0))&&Qs(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 Cr={press:0,pointerdown:0,release:1,pointerup:1};var wr={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 xr(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)||!kr(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 Or.length=0,!0;return Or.length=0,!1},Or=[];const Pr=Phaser.Utils.Objects.GetValue;class Tr extends ti{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?Sr: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 _r={press:0,pointerdown:0,release:1,pointerup:1};var Mr={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 Tr(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 Ls{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 Rr=Phaser.Utils.Objects.GetValue;class Lr extends ti{constructor(t,e){super(t,e),this._enable=void 0,this.cooldown=new Er,this.parent.setInteractive(Rr(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.prevIsInTouch=!1,this.isInTouching=!1,this.setEnable(Rr(t,"enable",!0)),this.setCooldown(Rr(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&&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 Lr(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 Lr(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}},Br=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=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===Zr&&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=Qr,this}isPointerInGameObject(t,e,i){var s=this.lastPointer;return!!s&&lr(t,s,e,i)}}const qr=0,Zr=1,Qr="IDLE",tn=Phaser.Utils.Objects.GetValue,en=Phaser.Math.Distance.Between;class sn 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=rn},eventEmitter:!1};this.setRecongizedStateObject(new Ls(s))}resetFromJSON(t){super.resetFromJSON(t),this.setHoldTime(tn(t,"time",250)),this.setTapInterval(tn(t,"tapInterval",200)),this.setDragThreshold(tn(t,"threshold",9)),this.setTapOffset(tn(t,"tapOffset",10));var e=tn(t,"taps",void 0);return void 0!==e?this.setTaps(e):(this.setMaxTaps(tn(t,"maxTaps",void 0)),this.setMinTaps(tn(t,"minTaps",void 0))),this}onDragStart(){switch(this.state){case rn:this.state=nn;break;case nn:var t=this.lastPointer;en(t.upX,t.upY,t.x,t.y)>this.tapOffset&&(this.state=an,this.state=nn);break;case an:this.state=nn}}onDragEnd(){this.state===nn&&(this.tapsCount++,this.emit("tapping",this,this.gameObject,this.lastPointer),void 0!==this.maxTaps&&this.tapsCount===this.maxTaps&&(this.state=an))}onDrag(){this.state!==rn&&this.pointer.getDistance()>this.dragThreshold&&(this.state=rn)}preUpdate(t,e){if(this.isRunning&&this.enable&&this.state===nn){var i=this.lastPointer;i.isDown?t-i.downTime>this.holdTime&&(this.state=rn):t-i.upTime>this.tapInterval&&(void 0===this.minTaps||this.tapsCount>=this.minTaps?this.state=an:this.state=rn)}}postUpdate(t,e){this.isRunning&&this.enable&&this.state===an&&(this.state=rn)}get isTapped(){return this.state===an}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 rn="IDLE",nn="BEGIN",an="RECOGNIZED",hn=Phaser.Utils.Objects.GetValue;class on 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=ln},eventEmitter:!1};this.setRecongizedStateObject(new Ls(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(hn(t,"threshold",9)),this.setHoldTime(hn(t,"time",251)),this}onDragStart(){this.state=dn,0===this.holdTime&&(this.state=cn)}onDragEnd(){this.state=ln}onDrag(){this.state!==ln&&this.pointer.getDistance()>this.dragThreshold&&(this.state=ln)}preUpdate(t,e){this.isRunning&&this.enable&&this.state===dn&&t-this.pointer.downTime>=this.holdTime&&(this.state=cn)}get isPressed(){return this.state===cn}setHoldTime(t){return this.holdTime=t,this}setDragThreshold(t){return this.dragThreshold=t,this}}const ln="IDLE",dn="BEGIN",cn="RECOGNIZED";Phaser.Utils.Objects.GetValue;var un=function(t){return Ze(t).loop.delta};const pn=Phaser.Math.Distance.Between,vn=Phaser.Math.Angle.Between;var gn={getDt:function(){return un(this.scene)},getVelocity:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return pn(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 vn(e.x,e.y,t.x,t.y)}},fn={"up&down":0,"left&right":1,"4dir":2,"8dir":3},mn={};const yn=Phaser.Utils.Objects.GetValue,bn=Phaser.Math.RadToDeg;class xn 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 Ls(s)),this.clearDirectionStates()}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(yn(t,"threshold",10)),this.setVelocityThreshold(yn(t,"velocityThreshold",1e3)),this.setDirectionMode(yn(t,"dir","8dir")),this}onDragStart(){this.state=wn}onDragEnd(){this.state=Cn}onDrag(){this.state===wn&&(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=Cn)}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=fn[t]),this.dirMode=t,this}updateDirectionStates(){return function(t,e,i){switch(void 0===i?i={}:!0===i&&(i=mn),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}}(bn(this.getVelocityAngle()),this.dirMode,this),this}clearDirectionStates(){return this.left=!1,this.right=!1,this.up=!1,this.down=!1,this}}Object.assign(xn.prototype,gn);const Cn="IDLE",wn="BEGIN",Sn="RECOGNIZED",kn=Phaser.Utils.Objects.GetValue,On=Phaser.Utils.Array.SpliceOne,Pn=Phaser.Math.Distance.Between,Tn=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(kn(e,"inputConfig",void 0)),this.setEventEmitter(kn(e,"eventEmitter",void 0)),this._enable=void 0,this.pointers=[],this.movedState={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setEnable(kn(t,"enable",!0)),this.bounds=kn(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=Rn,this.onDrag1Start();break;case Rn:this.tracerState=Ln,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],On(this.pointers,e),this.tracerState){case Rn:this.tracerState=En,this.onDrag1End();break;case Ln:this.tracerState=Rn,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 Rn:this.onDrag1();break;case Ln:this.onDrag2()}}}dragCancel(){return this.tracerState===Ln&&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!==Ln)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!==Ln)return 0;var t=this.pointers[0],e=this.pointers[1];return Tn(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;Mn.x=e.x-i.x,Mn.y=e.y-i.y}else Mn.x=0,Mn.y=0;return Mn}get centerX(){if(this.tracerState!==Ln)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.x+e.x)/2}get centerY(){if(this.tracerState!==Ln)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.y+e.y)/2}get prevCenterX(){if(this.tracerState!==Ln)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!==Ln)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&&lr(t,s,e,i)}isPointer1InGameObject(t,e,i){var s=this.pointers[1];return!!s&&lr(t,s,e,i)}}Object.assign(_n.prototype,Ue);var Mn={};const En=0,Rn=1,Ln=2,Dn="IDLE";Phaser.Utils.Objects.GetValue;const An=Phaser.Math.RotateAround;var Bn=function(t,e,i,s){return An(t,e,i,s),t.rotation+=s,t},zn={};const Wn=Phaser.Utils.Objects.GetValue,In=Phaser.Math.Angle.WrapDegrees,jn=Phaser.Math.Angle.ShortestBetween,Yn=Phaser.Math.RadToDeg,Fn=Phaser.Math.DegToRad;var Xn={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=zn),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=In(Yn(this.angleBetween));this.angle=jn(this.prevAngle,t),this.prevAngle=t,this.state=Gn}break;case Gn:t=In(Yn(this.angleBetween)),this.angle=jn(this.prevAngle,t),this.prevAngle=t,this.emit("rotate",this)}}get isRotated(){return this.state===Gn}get rotation(){return Fn(this.angle)}setDragThreshold(t){return this.dragThreshold=t,this}}.prototype,Xn);const Hn="IDLE",Vn="BEGIN",Gn="RECOGNIZED",Un=Phaser.Utils.Objects.GetValue;var Nn=function(t){var e=Un(t,"tap",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._tap=new sn(this,e),this._tap.on("tap",(function(t,e,s){zr(i.eventEmitter,`${i.eventNamePrefix}${t.tapsCount}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const $n=Phaser.Utils.Objects.GetValue;var Kn=function(t){var e=$n(t,"press",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._press=new on(this,e),this._press.on("pressstart",(function(t,e,s){zr(i.eventEmitter,`${i.eventNamePrefix}pressstart`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this).on("pressend",(function(t,e,s){zr(i.eventEmitter,`${i.eventNamePrefix}pressend`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),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 xn(this,e),this._swipe.on("swipe",(function(t,e,s){var r=t.left?"left":t.right?"right":t.up?"up":"down";zr(i.eventEmitter,`${i.eventNamePrefix}swipe${r}`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Zn=Phaser.Utils.Objects.GetValue;var Qn=function(t,e){return t.setInteractive(),Zn(e,"dropZone",!1)&&(t.input.dropZone=!0),t._childrenInteractive={targetSizers:Zn(e,"targets",[t]),targetMode:Zn(e,"targetMode","parent"),eventEmitter:Zn(e,"eventEmitter",t),eventNamePrefix:Zn(e,"inputEventPrefix","child.")},Ir.call(t,e),Fr.call(t,e),Vr.call(t,e),$r.call(t,e),Nn.call(t,e),Kn.call(t,e),qn.call(t,e),t},ta={getSizerConfig:function(t){return void 0===t&&(t=this),Et(t)},getChildPrevState:function(t){var e=Et(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",de),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)}}for(var d,c,u=this.getAllShownChildren([this]),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 la=Phaser.Utils.Objects.IsPlainObject,da=Phaser.Utils.Objects.GetValue,ca=Phaser.Display.Align.CENTER,ua={min:0,full:-1};var pa=function(t,e,i,s,r,n,a,h,o,l){ge.call(this,t);var d=t.isRexSpace,c=typeof e;if(null===e)return this;if("number"===c);else if("string"===c)e=ua[e];else if(la(e)){var u;e=da(u=e,"proportion",void 0),i=da(u,"align",ca),s=da(u,"padding",0),r=da(u,"expand",!1),n=da(u,"key",void 0),a=da(u,"index",void 0),t.isRexSizer||(h=da(u,"minWidth",void 0),o=da(u,"minHeight",void 0)),l=da(u,"fitRatio",0)}return"string"==typeof i&&(i=zt[i]),void 0===e&&(e=d?1:0),void 0===i&&(i=ca),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===h&&(d?h=0:t.isRexSizer||(h=t._minWidth)),void 0===o&&(d?o=0:t.isRexSizer||(o=t._minHeight)),void 0===l||!1===l?l=0:!0===l&&(l=Q(t)/tt(t)),(u=this.getSizerConfig(t)).proportion=e,u.align=i,u.padding=pe(s),u.expand=r,u.fitRatio=0===e?l:0,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},va={add:pa,addSpace(t){return this.insertSpace(void 0,t),this},insertSpace(t,e){return void 0===e&&(e=1),pa.call(this,new ha(this.scene),{proportion:e,minWidth:0,minHeight:0,index:t}),this},insert(t,e,i,s,r,n,a,h){return la(i)&&(i.index=t),pa.call(this,e,i,s,r,n,a,t,h),this},insertAtPosition(t,e,i,s,r,n,a,h,o){var l=oa.call(this,t,e);return-1===l&&(l=void 0),this.insert(l,i,s,r,n,a,h,o),this}};const ga=Mt.prototype.clear;var fa=function(t){this.backgroundChildren&&(this.backgroundChildren.length=0);var e,i=!t&&this.sizerEventsEnable;if(i&&(e=this.getChildren([])),ga.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,fa.call(this,t),this}},ba={getChildAlign(t){return this.getSizerConfig(t).align},setChildAlign(t,e){return"string"==typeof e&&(e=zt[e]),this.getSizerConfig(t).align=e,this}},xa={getChildProportion(t){return this.getSizerConfig(t).proportion},setChildProportion(t,e){return this.getSizerConfig(t).proportion=e,this}},Ca={getChildExpand(t){return this.getSizerConfig(t).expand},setChildExpand(t,e){return this.getSizerConfig(t).expand=e,this}},wa={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}},Sa={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&&(Xe(t,0,0),e.resolved=!1,this.hasRatioFitChild=!0);return this._childrenProportion=void 0,this.hasProportion0Child=!1,this.proportionLength=void 0,je.call(this),this},layoutChildren:function(){for(var t,e,i,s,r,n,a,h,o,l,d=this.sizerChildren,c=this.innerLeft,u=this.innerTop,p=this.innerWidth,v=this.innerHeight,g=c,f=u,m=this.startChildIndex,y=0,b=d.length;y0?(e=t-this.getChildrenWidth(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},resolveHeight:function(t){if(void 0!==(t=Be.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)||De.call(this)},runWidthWrap:function(t){this.wrapResult||(1===this.orientation&&na.call(this,t,void 0),Ae.call(this,t))},hasHeightWrap:function(){return!(!this.hasRatioFitChild||0!==this.orientation)||ze.call(this)},runHeightWrap:function(t){this.wrapResult||(0===this.orientation&&na.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],a=n&&n.isRexSpace;return"center"===t?a||this.insertSpace(r+1):a&&this.remove(n,!0),this}};Object.assign(Sa,va,ya,ba,xa,Ca,wa);var ka=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},Oa={x:0,h:0,horizontal:0,"left-to-right":0,y:1,v:1,vertical:1,"top-to-bottom":1},Pa=function(t){return"string"==typeof t&&(t=Oa[t]),t};const Ta=Phaser.Utils.Objects.IsPlainObject,_a=Phaser.Utils.Objects.GetValue;class Ma extends ia{constructor(t,e,i,s,r,n,a){Ta(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)):Ta(s)?(s=_a(a=s,"width",void 0),r=_a(a,"height",void 0),n=_a(a,"orientation",0)):Ta(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=Pa(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=ka.call(this)),this._childrenProportion}}Object.assign(Ma.prototype,Sa);var Ea=function(t,e,i,s){return e/t<=i?e/(s-1):0},Ra=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=La(h.left,h.centerY,t,e))&&(r=o,s=n);var o,l=i[n+1];l&&l.y===h.y||r>(o=La(h.right,h.centerY,t,e))&&(r=o,s=n+1)}}return s};const Aa=Phaser.Utils.Objects.IsPlainObject,Ba=Phaser.Utils.Objects.GetValue,za=Phaser.Display.Align.CENTER;var Wa=function(t,e,i,s){return"\n"===t?(this.addNewLine(),this):(ge.call(this,t),Aa(e)&&(e=Ba(r=e,"padding",0),i=Ba(r,"key",void 0),s=Ba(r,"index",void 0)),void 0===e&&(e=0),(r=this.getSizerConfig(t)).align=za,r.padding=pe(e),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},Ia={add(t,e,i){if(dr(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,fa.call(this,t),this}},Fa={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},gh=0,fh=1,mh=2,yh=0,bh=1,xh=2,Ch=/(?:\r\n|\r|\n)/;const wh={none:yh,word:bh,char:xh,character:xh,mix:3},Sh=Phaser.Renderer.WebGL.Utils;var kh={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=Sh.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 Oh=Phaser.Display.Color;var Ph={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 Oh);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}},Th=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)},_h={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,Th(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 Mh=Phaser.Display.Canvas.CanvasPool,Eh=Phaser.GameObjects.GameObject,Rh=Phaser.Utils.String.UUID;let Lh=class extends Eh{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=Mh.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=Rh(),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(){Mh.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 Dh=Phaser.GameObjects.Components;Phaser.Class.mixin(Lh,[Dh.Alpha,Dh.BlendMode,Dh.Crop,Dh.Depth,Dh.Flip,Dh.GetBounds,Dh.Mask,Dh.Origin,Dh.Pipeline,Dh.PostPipeline,Dh.ScrollFactor,Dh.Tint,Dh.Transform,Dh.Visible,kh,Ph,_h]);var Ah={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 Bh{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(Bh.prototype,Ah);var zh={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 Wh=Phaser.Math.RotateAround;var Ih;const jh=Phaser.Geom.Rectangle;var Yh,Fh=function(t){void 0===Yh&&(Yh=new jh);var e=t.drawTLX,i=t.drawTLY;return Yh.setTo(e,i,t.drawTRX-e,t.drawBLY-i),Yh};const Xh=Phaser.Math.RotateAround;var Hh,Vh=function(t,e,i,s){return void 0===s?s={}:!0===s&&(void 0===Hh&&(Hh={}),s=Hh),s.x=e,s.y=i,0!==t.rotation&&Xh(s,0,0,t.rotation),s.x=s.x*t.scaleX+t.drawX,s.y=s.y*t.scaleY+t.drawY,s};const Gh=Phaser.GameObjects.Components.TransformMatrix;var Uh,Nh,$h={},Kh=function(t,e,i,s,r){var n=Vh(e,i,s,!0),a=function(t,e,i,s){void 0===s?s={}:!0===s&&(s=$h);var r=e-t.width*t.originX,n=i-t.height*t.originY;return void 0===Uh&&(Uh=new Gh,Nh=new Gh),t.parentContainer?t.getWorldTransformMatrix(Uh,Nh):Uh.applyITRS(t.x,t.y,t.rotation,t.scaleX,t.scaleY),Uh.transformPoint(r,n,s),s}(t,n.x,n.y,r);return a},Jh=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 Kh(t,e,n,a,r)},qh={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===Ih&&(Ih={}),s=Ih),s.x=(t-i.drawX)/i.scaleX,s.y=(e-i.drawY)/i.scaleY,0!==i.rotation&&Wh(s,0,0,-i.rotation),s}(t,e,this,!0);return Fh(this).contains(i.x,i.y)},getWorldPosition:function(t,e,i){return Jh(this.parent,this,t,e,i)}};Object.assign(qh,zh);const Zh=Phaser.Math.DegToRad,Qh=Phaser.Math.RadToDeg,to=Phaser.Utils.Objects.GetValue;class eo extends Bh{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 Qh(this._rotation)}set angle(t){this.rotation=Zh(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=to(t,"width",void 0),i=to(t,"height",void 0),s=to(t,"scaleX",void 0),r=to(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(eo.prototype,qh);const io=Phaser.Utils.String.Pad;var so=function(t,e,i){if(null==t)return t;switch(typeof t){case"string":default:return t;case"number":return`#${io(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}},ro=function(t,e,i){return e.hasOwnProperty(t)?e[t]:i[t]};const no=Phaser.Utils.Objects.GetValue;let ao=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=no(t,"x",0),i=no(t,"y",0));var s=this.cornerRadius;s.tl=ho(no(t,"tl",void 0),e,i),s.tr=ho(no(t,"tr",void 0),e,i),s.bl=ho(no(t,"bl",void 0),e,i),s.br=ho(no(t,"br",void 0),e,i)}get radiusTL(){var t=this.cornerRadius.tl;return Math.max(t.x,t.y)}set radiusTL(t){oo(this.cornerRadius.tl,t)}get radiusTR(){var t=this.cornerRadius.tr;return Math.max(t.x,t.y)}set radiusTR(t){oo(this.cornerRadius.tr,t)}get radiusBL(){var t=this.cornerRadius.bl;return Math.max(t.x,t.y)}set radiusBL(t){oo(this.cornerRadius.bl,t)}get radiusBR(){var t=this.cornerRadius.br;return Math.max(t.x,t.y)}set radiusBR(t){oo(this.cornerRadius.br,t)}};var ho=function(t,e,i){return void 0===t?t={x:e,y:i}:"number"==typeof t&&(t={x:t,y:t}),lo(t),t},oo=function(t,e){"number"==typeof e?(t.x=e,t.y=e):(t.x=no(e,"x",0),t.y=no(e,"y",0)),lo(t)},lo=function(t){t.convex=t.x>=0||t.y>=0,t.x=Math.abs(t.x),t.y=Math.abs(t.y)};const co=Phaser.Math.DegToRad;var uo=function(t){return!t.hasOwnProperty("convex")||t.convex},po=function(t){return t.x>0&&t.y>0},vo=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,po(h)?(o=h.x*g,l=h.y*f,uo(h)?vo(t,o,l,o,l,180,270,!1,a):vo(t,0,0,o,l,90,0,!0,a),d=0,c=l):(t.lineTo(0,0),d=0,c=0),h=m.tr,po(h)?(o=h.x*g,l=h.y*f,uo(h)?vo(t,s-o,l,o,l,270,360,!1,a):vo(t,s,0,o,l,180,90,!0,a)):t.lineTo(s,0),h=m.br,po(h)?(o=h.x*g,l=h.y*f,uo(h)?vo(t,s-o,r-l,o,l,0,90,!1,a):vo(t,s,r,o,l,270,180,!0,a)):t.lineTo(s,r),h=m.bl,po(h)?(o=h.x*g,l=h.y*f,uo(h)?vo(t,o,r-l,o,l,90,180,!1,a):vo(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())},fo=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),go(t.canvas,t.context,d,d,o,l,r,e,i,s,n,a,h)}};const mo=Phaser.Utils.Objects.GetValue;class yo extends eo{constructor(t,e){super(t,"background"),this.setScrollFactor(0),this.setColor(mo(e,"color",null),mo(e,"color2",null),mo(e,"horizontalGradient",!0)),this.setStroke(mo(e,"stroke",null),mo(e,"strokeThickness",2)),this.setCornerRadius(mo(e,"cornerRadius",0),mo(e,"cornerIteration",null))}set color(t){t=so(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=so(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=so(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,ro("color2",t,this),ro("horizontalGradient",t,this)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,ro("strokeThickness",t,this)),t.hasOwnProperty("cornerRadius")&&this.setCornerRadius(t.cornerRadius,ro("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(){fo(this.parent,this.color,this.stroke,this.strokeThickness,this.cornerRadius,this.color2,this.horizontalGradient,this.cornerIteration)}}const bo=Phaser.Utils.Objects.GetValue;class xo extends eo{constructor(t,e){super(t,"innerbounds"),this.setScrollFactor(0),this.setColor(bo(e,"color",null),bo(e,"color2",null),bo(e,"horizontalGradient",!0)),this.setStroke(bo(e,"stroke",null),bo(e,"strokeThickness",2))}set color(t){t=so(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=so(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=so(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,bo(t,"color2",null),bo(t,"horizontalGradient",!0)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,bo(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 Co=Phaser.Utils.Objects.GetValue;let wo=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(Co(t,"bold",!1)),this.setItalic(Co(t,"italic",!1)),this.setFontSize(Co(t,"fontSize","16px")),this.setFontFamily(Co(t,"fontFamily","Courier")),this.setColor(Co(t,"color","#fff")),this.setStrokeStyle(Co(t,"stroke",null),Co(t,"strokeThickness",0)),this.setShadow(Co(t,"shadowColor",null),Co(t,"shadowOffsetX",0),Co(t,"shadowOffsetY",0),Co(t,"shadowBlur",0)),this.setOffset(Co(t,"offsetX",0),Co(t,"offsetY",0)),this.setSpace(Co(t,"leftSpace",0),Co(t,"rightSpace",0)),this.setAlign(Co(t,"align",void 0)),this.setBackgroundColor(Co(t,"backgroundColor",null)),this.setBackgroundHeight(Co(t,"backgroundHeight",void 0)),this.setBackgroundBottomY(Co(t,"backgroundBottomY",void 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(ro("stroke",t,this),ro("strokeThickness",t,this)),t.hasOwnProperty("shadowColor")&&this.setShadowColor(t.shadowColor),(t.hasOwnProperty("shadowOffsetX")||t.hasOwnProperty("shadowOffsetY"))&&this.setShadowOffset(ro("shadowOffsetX",t,this),ro("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),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=so(t),this}get hasFill(){return null!=this.color}setStrokeStyle(t,e){return this.stroke=so(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=so(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=so(t),this}get hasBackgroundColor(){return null!=this.backgroundColor}setBackgroundHeight(t){return this.backgroundHeight=t,this}setBackgroundBottomY(t){return this.backgroundBottomY=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,ko=Phaser.Utils.Array.Remove,Oo="text",Po="image",To="drawer",_o="space",Mo="command";var Eo=function(t){return t.type===Oo&&"\n"===t.text},Ro=function(t){return t.type===Oo&&"\f"===t.text},Lo=function(t){return t.type===Oo};class Do extends eo{constructor(t,e,i){super(t,Oo),this.updateTextFlag=!1,this.style=new wo(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,s=this.drawTRX-i+1,r=e.backgroundBottomY;null==r&&(r=this.drawBLY);var n=e.backgroundHeight;null==n&&(n=r-this.drawTLY);var a=r-n;t.fillRect(i,a,s,n)}var h=e.hasFill,o=e.hasStroke;(h||o)&&(e.syncFont(t).syncStyle(t),o&&(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 Ao=function(t,e){var i=this.createCharChildren(t,e);return this.addChild(i),this};const Bo=Phaser.Display.Canvas.CanvasPool;var zo=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=Bo.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),Bo.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 Wo extends eo{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(){zo(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 Io extends eo{constructor(t,e,i,s){super(t,To),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 jo extends eo{constructor(t,e){super(t,_o),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 Yo extends Bh{constructor(t,e,i,s,r){super(t,Mo),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 Fo(t){if(null===t||"object"!=typeof t)return t;if(Array.isArray(t))return t.map((t=>Fo(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}var Xo=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 Ho={none:0,word:1,char:2,character:2,mix:3};var Vo=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=$o.call(this)).height,a=l.ascent,i=Math.floor((o-a)/n))}else{var l;n=(l=$o.call(this)).height,a=l.ascent}}else this.fixedHeight>0?void 0===(i=Jo(t,"maxLines"))&&(o=this.fixedHeight-s,i=Math.floor(o/n)):i=Jo(t,"maxLines",0);void 0===a&&(a=n);var d=0===i,c=Jo(t,"wrapMode");void 0===c&&(c=Jo(t,"charWrap",!1)?"char":"word"),"string"==typeof c&&(c=Ho[c]);var u=Jo(t,"wrapWidth",void 0);void 0===u&&(this.fixedWidth>0?u=this.fixedWidth-r:(u=1/0,c=0));for(var p=Jo(t,"letterSpacing",0),v=Jo(t,"hAlign",0),g=Jo(t,"vAlign",0),f=Jo(t,"justifyPercentage",.25),m=Xo({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&&(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 Y=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,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=Qo(t,"maxLines",void 0))){var a=this.fixedWidth-r;i=Math.floor(a/n)+1}}else i=Qo(t,"maxLines",0);var h=0===i,o=Qo(t,"fixedCharacterHeight",void 0);if(void 0===o){var l=Qo(t,"charPerLine",void 0);if(void 0!==l){var d=this.fixedHeight-s;o=Math.floor(d/l)}}var c=Qo(t,"wrapHeight",void 0);void 0===c&&(c=this.fixedHeight>0?this.fixedHeight-s:1/0);for(var u=Qo(t,"letterSpacing",0),p=Qo(t,"rtl",!0),v=Qo(t,"hAlign",p?2:0),g=Qo(t,"vAlign",0),f=Xo({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: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,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 Ee(i,t,e),this.dirty=this.dirty||s!=i.left||r!=i.right||n!=i.top||a!=i.bottom,this},getPadding:function(t){return Me(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 ko(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(Oo);return null===i?i=new Do(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)),Jh(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 kl=Phaser.Utils.Objects.GetFastValue;var Ol={};class Pl{constructor(t){this.pools=kl(t,"pools",Ol)}free(t){if(!this.pools)return this;var e=t.type;return this.pools.hasOwnProperty(e)||(this.pools[e]=new Sl),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=Al(t,r,e,i,n),h=0;h<=Rl&&0!==a;h++){if((r+=a)<0){r=0;break}a=Al(t,r,e,i,n)}return h===Rl&&console.warn("FontSizeFit: Test count exceeds 65535"),t.setFontSize(r),Bl(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]},Al=function(t,e,i,s,r){var n,a=Dl(t,e,r),h=Dl(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)},Bl=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 zl=Phaser.Utils.Objects.GetValue,Wl=Phaser.Utils.Objects.GetValue;class Il extends Qa{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexLabel";var i,s=Wl(e,"background",void 0),r=Wl(e,"icon",void 0),n=Wl(e,"iconMask",void 0),a=Wl(e,"text",void 0),h=Wl(e,"action",void 0),o=Wl(e,"actionMask",void 0),l=Wl(e,"align",void 0);if(s&&this.addBackground(s),r){0===this.orientation?(a||h)&&(i={right:Wl(e,"space.icon",0),top:Wl(e,"space.iconTop",0),bottom:Wl(e,"space.iconBottom",0),left:Wl(e,"space.iconLeft",0)}):(a||h)&&(i={bottom:Wl(e,"space.icon",0),left:Wl(e,"space.iconLeft",0),right:Wl(e,"space.iconRight",0),top:Wl(e,"space.iconTop",0)});var d=Wl(e,"squareFitIcon",!1)?1:0;if(this.add(r,{proportion:0,padding:i,fitRatio:d}),n&&(n=nh.call(this,r,r,1)),!d){var c=Wl(e,"iconSize",void 0);this.setIconSize(Wl(e,"iconWidth",c),Wl(e,"iconHeight",c))}}if(a){var u=Wl(e,"wrapText",!1),p=Wl(e,"adjustTextFontSize",!1);u?(!0===u&&(u="word"),function(t,e){switch(dh(t)){case 0:switch("string"==typeof e&&(e=wh[e]||0),t.style.wrapMode=e,e){case 2:case 3:t.style.wordWrapCallback=ph;break;default:t.style.wordWrapCallback=null}break;case 1:"string"==typeof e&&(e=wh[e]||0),t.style.wrapMode=e}}(a,u),e.expandTextWidth=!0,El(a)):p&&(e.expandTextWidth=!0,e.expandTextHeight=!0,function(t,e){"number"==typeof e&&(e={minWidth:e});var i=zl(e,"minWidth",0),s=zl(e,"minHeight",0),r=zl(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})}(a,{fitHeight:!0}));var v,g,f=Wl(e,"space.text",0),m=Wl(e,"expandTextWidth",!1),y=Wl(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:Wl(e,"space.actionTop",0),bottom:Wl(e,"space.actionBottom",0),right:Wl(e,"space.actionRight",0)}:{left:Wl(e,"space.actionLeft",0),right:Wl(e,"space.actionRight",0),bottom:Wl(e,"space.actionBottom",0)},d=Wl(e,"squareFitAction",!1)?1:0,this.add(h,{proportion:0,padding:i,fitRatio:d}),o&&(o=nh.call(this,h,h,1)),!d)){var b=Wl(e,"actionSize");this.setActionSize(Wl(e,"actionWidth",b),Wl(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 jl=Phaser.Renderer.WebGL.Utils,Yl=function(t,e,i,s,r,n){for(var a=jl.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+")"},Gl=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 Ul=Phaser.Renderer.Canvas.SetTransform;var Nl={renderWebGL:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.pipelines.set(e.pipeline),n=Hl(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&&Yl(r,a,e,l,h,o),e.isStroked&&Xl(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(Ul(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(Kl.prototype,Nl);var Jl=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 ql=Phaser.Math.DegToRad;var Zl=function(t,e,i,s,r,n,a,h,o){a&&n>r?n-=360:!a&&n0&&t.y>0};const rd={rectangle:0,circle:1};var nd=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},ad=function(t,e,i){if(void 0===i&&(i={}),Array.isArray(e))for(var s=0,r=e.length;s0,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=tc(t,"tl",0),this.radiusTR=tc(t,"tr",0),this.radiusBL=tc(t,"bl",0),this.radiusBR=tc(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?Zl(e,e,e,e,180,270,!1,r,t):Zl(0,0,e,e,90,0,!0,r,t):Jl(0,0,t),(e=this.radiusTR)>0?this._convexTR?Zl(i-e,e,e,e,270,360,!1,r,t):Zl(i,0,e,e,180,90,!0,r,t):Jl(i,0,t),(e=this.radiusBR)>0?this._convexBR?Zl(i-e,s-e,e,e,0,90,!1,r,t):Zl(i,s,e,e,270,180,!0,r,t):Jl(i,s,t),(e=this.radiusBL)>0?this._convexBL?Zl(e,s-e,e,e,90,180,!1,r,t):Zl(0,s,e,e,360,270,!0,r,t):Jl(0,s,t),t.push(t[0],t[1]),Wd(this.x,this.y,t),super.updateData(),this}}Phaser.Renderer.WebGL.Utils.getTintAppendFloatAlpha;var ic=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};const sc=Phaser.Utils.Objects.GetValue,rc=Phaser.Utils.Objects.IsPlainObject;class nc extends(Td(bd)){constructor(t,e,i,s,r,n,a,h){rc(e)?(e=sc(h=e,"x",0),i=sc(h,"y",0),s=sc(h,"width",2),r=sc(h,"height",2),n=sc(h,"barColor",void 0),a=sc(h,"value",0)):rc(s)?(s=sc(h=s,"width",2),r=sc(h,"height",2),n=sc(h,"barColor",void 0),a=sc(h,"value",0)):rc(n)&&(n=sc(h=n,"barColor",void 0),a=sc(h,"value",0)),super(t,e,i,s,r,h),this.type="rexLineProgress",this.bootProgressBase(h),this.addShape((new Qd).setName("trackFill")).addShape((new Qd).setName("bar")).addShape((new Qd).setName("trackStroke")),this.setTrackColor(sc(h,"trackColor",void 0)),this.setBarColor(n),this.setTrackStroke(sc(h,"trackStrokeThickness",2),sc(h,"trackStrokeColor",void 0)),this.setSkewX(sc(h,"skewX",0)),this.setRTL(sc(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 ac={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&&ic(s,0,0,e,i,t).close();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),ic(a,r,0,n,i,t).close());var h=this.getShape("trackStroke");h.lineStyle(this.trackStrokeThickness,this.trackStrokeColor),h.isStroked&&ic(h,0,0,e,i,t).end()}};Object.assign(nc.prototype,ac);var hc=function(t){return null==t||""===t||0===t.length},oc=function(t,e,i,s){if(void 0===s&&(s="."),"object"==typeof t){if(hc(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(hc(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=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),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 S=i.length;o0?0:f),f>=1&&g>=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,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(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 Pc(t)?(this.stretchMode.edge=_c(Tc(t,"edge",0)),this.stretchMode.internal=_c(Tc(t,"internal",0))):(t=_c(t),this.stretchMode.edge=t,this.stretchMode.internal=t),this},getStretchMode:function(t,e){return Ec.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,Ac=Phaser.GameObjects;var Bc=void 0,zc=function(t,e){if(Bc||(Bc={},Ze(t).events.once("destroy",(function(){for(var t in Bc)Bc[t].destroy();Bc=void 0}))),!Bc.hasOwnProperty(e)){var i=Ze(t).scene.systemScene;(t=new Ac[e](i)).setOrigin(0),Bc[e]=t}return Bc[e]};const Wc=Phaser.GameObjects.RenderTexture;class Ic extends(function(t,e){class i extends t{constructor(t,i,s,r,n,a,h,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),a=Dc(d,"key",void 0),h=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),a=Dc(d,"key",void 0),h=Dc(d,"baseFrame",void 0),o=Dc(d,"columns",void 0),l=Dc(d,"rows",void 0)):Lc(a)?(a=Dc(d=a,"key",void 0),h=Dc(d,"baseFrame",void 0),o=Dc(d,"columns",void 0),l=Dc(d,"rows",void 0)):Lc(h)?(h=Dc(d=h,"baseFrame",void 0),o=Dc(d,"columns",void 0),l=Dc(d,"rows",void 0)):Array.isArray(h)?(d=l,l=o,o=h,h=Dc(d,"baseFrame",void 0)):Lc(o)&&(o=Dc(d=o,"columns",void 0),l=Dc(d,"rows",void 0)),void 0===h&&(h=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(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,Rc),i}(Wc,"rexNinePatch")){}var jc={_drawImage:function(t,e,i,s,r,n){var a=zc(this,"Image").setTexture(t,e).setDisplaySize(r,n);this.draw(a,i,s)},_drawTileSprite:function(t,e,i,s,r,n){var a=zc(this,"TileSprite").setTexture(t,e).setSize(r,n);this.draw(a,i,s)}};Object.assign(Ic.prototype,jc);let Yc=class extends ti{constructor(t,e){return super(t),new Proxy(this,this)}get(t,e){if(cc(t,e))return t[e];var i=t.parent;return cc(i,e)?i[e]:void 0}set(t,e,i){return cc(t,e)?t[e]=i:cc(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 Xc extends Ic{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexStatesNinePatch";var i=Fc(e,"effects",!0);i&&fc(this,i),this.style=new Yc(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign(Xc.prototype,cd);const Hc=["alpha","tint","flipX","flipY"];var Vc=function(t,e){if(!e)return t;for(var i=0,s=Hc.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 Y=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}},Pe=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,_e=Phaser.Utils.Objects.GetValue;var Me=function(t,e){return void 0===e?t:t[e]},Ee=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=_e(e,"left",0),t.right=_e(e,"right",0),t.top=_e(e,"top",0),t.bottom=_e(e,"bottom",0)),t},Re={getInnerPadding(t){return Me(this.space,t)},setInnerPadding(t,e){return Ee(this.space,t,e),this},getOuterPadding(t){return Me(this.getSizerConfig(this).padding,t)},setOuterPadding(t,e){return Ee(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)),Ee(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}},De=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},Be=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},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},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}},je=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:vi,this.repeatCounter=0,this}stop(){return this.state=pi,this}update(t,e){this.state!==pi&&this.state!==mi&&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=fi)):(this.nowTime=this.duration,this.state=mi):this.nowTime>=0&&(this.state=gi))}get t(){var t;switch(this.state){case pi:case vi:case fi:t=0;break;case gi:t=this.nowTime/this.duration;break;case mi:t=1}return ci(t,0,1)}set t(t){(t=ci(t,-1,1))<0?(this.state=vi,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===pi}get isDelay(){return this.state===vi}get isCountDown(){return this.state===gi}get isRunning(){return this.state===vi||this.state===gi}get isDone(){return this.state===mi}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}}const pi=0,vi=1,gi=2,fi=3,mi=-1;class yi extends oi{constructor(t,e){super(t,e),this.timer=new ui}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 bi=Phaser.Utils.Objects.GetValue,xi=Phaser.Utils.Objects.GetAdvancedValue,Ci=Phaser.Tweens.Builders.GetEaseFunction;class wi extends yi{resetFromJSON(t){return this.timer.resetFromJSON(bi(t,"timer")),this.setEnable(bi(t,"enable",!0)),this.setTarget(bi(t,"target",this.parent)),this.setDelay(xi(t,"delay",0)),this.setDuration(xi(t,"duration",1e3)),this.setEase(bi(t,"ease","Linear")),this.setRepeat(bi(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 Si=Phaser.Utils.Objects.GetValue,ki=Phaser.Utils.Objects.GetAdvancedValue,Oi=Phaser.Math.Linear;let Pi=class extends wi{constructor(t,e){super(t,e),this.scaleStart={},this.scaleEnd={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(Si(t,"mode",0)),this.setScaleRange(ki(t,"start",void 0),ki(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=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=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 _i=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 Pi(t,h):r.resetFromJSON(h),r.restart(),r},Mi=function(t,e,i,s,r,n){void 0===s&&(s="Linear"),r instanceof Pi&&(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 Pi(t,a):n.resetFromJSON(a),n.restart(),n},Ei=function(t,e){return new Promise((function(i,s){t.once(e,(function(){i()}))}))},Ri=function(t){return Ei(t,"complete")};const Li=Phaser.Utils.Objects.IsPlainObject;var Di={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=_i(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=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),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 Pi(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()}},Ai={};Object.assign(Ai,Di),Ai.onInitScale=function(){Di.onInitScale.call(this);var t=this;this._scaleBehavior.on("update",(function(){var e=ye.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const Bi=Phaser.Utils.Objects.GetValue,zi=Phaser.Utils.Objects.GetAdvancedValue,Wi=Phaser.Math.Linear;class Ii extends wi{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(Bi(t,"mode",0)),this.setAlphaRange(zi(t,"start",this.parent.alpha),zi(t,"end",0)),this}setMode(t){return"string"==typeof t&&(t=ji[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 ji={stop:0,destroy:1,yoyo:2},Yi=Phaser.Utils.Objects.IsPlainObject;var Fi=function(t,e,i,s){var r,n;Yi(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},Xi=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 Hi=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(Hi(t)){var i=t;t=i.duration,e=i.alpha}var s=void 0===this._fade;return this._fade=Fi(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(Hi(t)){var i=t;t=i.duration,e=i.destroy}var s=void 0===this._fade;return this._fade=Xi(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()}},Gi={};Object.assign(Gi,Vi),Gi.onInitFade=function(){Vi.onInitFade.call(this);var t=this;this._fade.on("update",(function(){var e=ye.getParentSizer(t);e&&e.resetChildAlphaState(t)}))};const Ui=Phaser.Utils.Objects.GetValue,Ni=Phaser.Utils.Objects.GetAdvancedValue,$i=Phaser.Math.Linear;class Ki extends wi{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){if(super.resetFromJSON(t),this.setMode(Ui(t,"mode",0)),t&&(t.hasOwnProperty("x")||t.hasOwnProperty("y"))){var e=Ni(t,"x",void 0),i=Ni(t,"y",void 0);this.setTargetPosition(e,i)}else this.setTargetPosition(t);return this}setMode(t){return"string"==typeof t&&(t=Ji[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=Ni(i,"startX",void 0),this.startY=Ni(i,"startY",void 0),this.endX=Ni(i,"endX",void 0),this.endY=Ni(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 Ji={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 Zi=Phaser.Utils.Objects.IsPlainObject,Qi=Phaser.Math.Distance.Between;var ts={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(Zi(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*Qi(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),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(Zi(t)){var n=t;e=n.x,i=n.y,t=n.hasOwnProperty("speed")?1e3*Qi(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),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}},es={};Object.assign(es,ts),es.onInitEaseMove=function(){ts.onInitEaseMove.call(this);var t=this;this._easeMove.on("update",(function(){var e=ye.getParentSizer(t);e&&e.resetChildPositionState(t)}))};const is=Phaser.Utils.Objects.GetValue;class ss extends ni{constructor(t,e){super(t,e),this.timer=new ui,this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.timer.resetFromJSON(is(t,"timer")),this.setEnable(is(t,"enable",!0)),this.setMode(is(t,"mode",1)),this.isRunning=is(t,"isRunning",!1),this.setMagnitudeMode(is(t,"magnitudeMode",1)),this.setAxisMode(is(t,"axis",0)),this.setDuration(is(t,"duration",500)),this.setMagnitude(is(t,"magnitude",10)),this.ox=is(t,"ox",void 0),this.oy=is(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=rs[t]),this.mode=t,this}setMagnitudeMode(t){return"string"==typeof t&&(t=as[t]),this.magnitudeMode=t,this}setAxisMode(t){return"string"==typeof t&&(t=ns[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=is(i,"magnitude",void 0),t=is(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 rs={effect:0,behavior:1},ns={both:0,"h&v":0,"x&y":0,horizontal:1,h:1,x:1,vertical:2,v:2,y:2},as={constant:0,decay:1},hs=Phaser.Utils.Objects.IsPlainObject;var os={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 ss(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 ls=Phaser.Utils.Objects.GetValue,ds=Phaser.Math.Linear;class cs extends wi{constructor(t,e){super(t,e),this.resetFromJSON(),this.boot()}start(t){if(this.timer.isRunning)return this;var e=this.target;this.propertyKey=ls(t,"key","value");var i=e[this.propertyKey];return this.fromValue=ls(t,"from",i),this.toValue=ls(t,"to",i),this.setEase(ls(t,"ease",this.ease)),this.setDuration(ls(t,"duration",this.duration)),this.setRepeat(ls(t,"repeat",0)),this.setDelay(ls(t,"delay",0)),this.setRepeatDelay(ls(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]=ds(this.fromValue,this.toValue,i)}}const us=Phaser.Utils.Objects.IsPlainObject;class ps extends ti{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(us(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(us(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 vs={easeDataTo(t,e,i,s){return this._easeData||(this._easeData=new ps(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),Ei(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,fs={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=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}},Bs={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}},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}},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}},Is={};Object.assign(Is,As,Bs,zs,Ws);const js=Phaser.Utils.Objects.GetValue;class Ys extends ti{constructor(t,e){super(t,e),this.setTransitInTime(js(e,"duration.in",200)),this.setTransitOutTime(js(e,"duration.out",200)),this.setTransitInCallback(js(e,"transitIn")),this.setTransitOutCallback(js(e,"transitOut")),this.oneShotMode=js(e,"destroy",!1),this.delayCallTimer=void 0,this._state=new Ds(this,{eventEmitter:!1,initState:js(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,Is);var Fs=function(t){if(t.parentContainer)return Fs(t.parentContainer);var e=function(t){var e=t.displayList;return N(e)?e:null}(t);return e?Fs(e):t};class Xs extends ti{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 Hs=Phaser.GameObjects.Rectangle;let Vs=class extends Hs{constructor(t,e,i){super(t,0,0,2,2,e,1),this.fullWindow=new Xs(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 ti{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 $s=Phaser.Utils.Objects.GetValue;class Ks extends Vs{constructor(t,e){super(t,$s(e,"color",0),$s(e,"alpha",.8)),this.touchEventStop=new Us(this,{hitAreaMode:1})}}var Js={popUp(t,e){void 0!==t._modalScaleSave?(t.scaleX=t._modalScaleSave,t.scaleY=t._modalScaleSave):t._modalScaleSave=t.scaleX,_i(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,Fi(t,e)},fadeOut(t,e){Xi(t,e,!1)}},qs=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Fi(t,e,t.alpha)},Zs=function(t,e){Xi(t,e,!1)},Qs=function(t,e,i,s,r){return!(!t||s&&!s(t,e,i)||!rt(t,!0).contains(e,i)||r&&!r(t,e,i))};const tr=Phaser.Utils.Objects.GetValue;let er=class extends Ys{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 Ks(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",qs)),this.setCoverTransitOutCallback(tr(i,"transitOut",Zs)));var s=tr(e,"touchOutsideClose",!1),r=tr(e,"duration.hold",-1),n=tr(e,"timeOutClose",r>=0),a=tr(e,"anyTouchClose",!1);tr(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),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=Js.popUp;break;case ir.fadeIn:t=Js.fadeIn}return super.setTransitInCallback(t),this}setTransitOutCallback(t){switch("string"==typeof t&&(t=ir[t]),t){case ir.scaleDown:t=Js.scaleDown;break;case ir.fadeOut:t=Js.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},ar={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}},hr=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,a=0===t.scrollFactorX&&0===t.scrollFactorY;if(e)return a?Qs(t,e.x,e.y,i,s):!!(r=hr(e,n,!0))&&Qs(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 Cr={press:0,pointerdown:0,release:1,pointerup:1};var wr={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 xr(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)||!kr(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 Or.length=0,!0;return Or.length=0,!1},Or=[];const Pr=Phaser.Utils.Objects.GetValue;class Tr extends ti{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?Sr: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 _r={press:0,pointerdown:0,release:1,pointerup:1};var Mr={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 Tr(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 Ls{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 Rr=Phaser.Utils.Objects.GetValue;class Lr extends ti{constructor(t,e){super(t,e),this._enable=void 0,this.cooldown=new Er,this.parent.setInteractive(Rr(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.prevIsInTouch=!1,this.isInTouching=!1,this.setEnable(Rr(t,"enable",!0)),this.setCooldown(Rr(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&&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 Lr(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 Lr(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}},Br=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=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===Zr&&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=Qr,this}isPointerInGameObject(t,e,i){var s=this.lastPointer;return!!s&&lr(t,s,e,i)}}const qr=0,Zr=1,Qr="IDLE",tn=Phaser.Utils.Objects.GetValue,en=Phaser.Math.Distance.Between;class sn 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=rn},eventEmitter:!1};this.setRecongizedStateObject(new Ls(s))}resetFromJSON(t){super.resetFromJSON(t),this.setHoldTime(tn(t,"time",250)),this.setTapInterval(tn(t,"tapInterval",200)),this.setDragThreshold(tn(t,"threshold",9)),this.setTapOffset(tn(t,"tapOffset",10));var e=tn(t,"taps",void 0);return void 0!==e?this.setTaps(e):(this.setMaxTaps(tn(t,"maxTaps",void 0)),this.setMinTaps(tn(t,"minTaps",void 0))),this}onDragStart(){switch(this.state){case rn:this.state=nn;break;case nn:var t=this.lastPointer;en(t.upX,t.upY,t.x,t.y)>this.tapOffset&&(this.state=an,this.state=nn);break;case an:this.state=nn}}onDragEnd(){this.state===nn&&(this.tapsCount++,this.emit("tapping",this,this.gameObject,this.lastPointer),void 0!==this.maxTaps&&this.tapsCount===this.maxTaps&&(this.state=an))}onDrag(){this.state!==rn&&this.pointer.getDistance()>this.dragThreshold&&(this.state=rn)}preUpdate(t,e){if(this.isRunning&&this.enable&&this.state===nn){var i=this.lastPointer;i.isDown?t-i.downTime>this.holdTime&&(this.state=rn):t-i.upTime>this.tapInterval&&(void 0===this.minTaps||this.tapsCount>=this.minTaps?this.state=an:this.state=rn)}}postUpdate(t,e){this.isRunning&&this.enable&&this.state===an&&(this.state=rn)}get isTapped(){return this.state===an}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 rn="IDLE",nn="BEGIN",an="RECOGNIZED",hn=Phaser.Utils.Objects.GetValue;class on 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=ln},eventEmitter:!1};this.setRecongizedStateObject(new Ls(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(hn(t,"threshold",9)),this.setHoldTime(hn(t,"time",251)),this}onDragStart(){this.state=dn,0===this.holdTime&&(this.state=cn)}onDragEnd(){this.state=ln}onDrag(){this.state!==ln&&this.pointer.getDistance()>this.dragThreshold&&(this.state=ln)}preUpdate(t,e){this.isRunning&&this.enable&&this.state===dn&&t-this.pointer.downTime>=this.holdTime&&(this.state=cn)}get isPressed(){return this.state===cn}setHoldTime(t){return this.holdTime=t,this}setDragThreshold(t){return this.dragThreshold=t,this}}const ln="IDLE",dn="BEGIN",cn="RECOGNIZED";Phaser.Utils.Objects.GetValue;var un=function(t){return Ze(t).loop.delta};const pn=Phaser.Math.Distance.Between,vn=Phaser.Math.Angle.Between;var gn={getDt:function(){return un(this.scene)},getVelocity:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return pn(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 vn(e.x,e.y,t.x,t.y)}},fn={"up&down":0,"left&right":1,"4dir":2,"8dir":3},mn={};const yn=Phaser.Utils.Objects.GetValue,bn=Phaser.Math.RadToDeg;class xn 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 Ls(s)),this.clearDirectionStates()}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(yn(t,"threshold",10)),this.setVelocityThreshold(yn(t,"velocityThreshold",1e3)),this.setDirectionMode(yn(t,"dir","8dir")),this}onDragStart(){this.state=wn}onDragEnd(){this.state=Cn}onDrag(){this.state===wn&&(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=Cn)}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=fn[t]),this.dirMode=t,this}updateDirectionStates(){return function(t,e,i){switch(void 0===i?i={}:!0===i&&(i=mn),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}}(bn(this.getVelocityAngle()),this.dirMode,this),this}clearDirectionStates(){return this.left=!1,this.right=!1,this.up=!1,this.down=!1,this}}Object.assign(xn.prototype,gn);const Cn="IDLE",wn="BEGIN",Sn="RECOGNIZED",kn=Phaser.Utils.Objects.GetValue,On=Phaser.Utils.Array.SpliceOne,Pn=Phaser.Math.Distance.Between,Tn=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(kn(e,"inputConfig",void 0)),this.setEventEmitter(kn(e,"eventEmitter",void 0)),this._enable=void 0,this.pointers=[],this.movedState={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setEnable(kn(t,"enable",!0)),this.bounds=kn(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=Rn,this.onDrag1Start();break;case Rn:this.tracerState=Ln,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],On(this.pointers,e),this.tracerState){case Rn:this.tracerState=En,this.onDrag1End();break;case Ln:this.tracerState=Rn,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 Rn:this.onDrag1();break;case Ln:this.onDrag2()}}}dragCancel(){return this.tracerState===Ln&&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!==Ln)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!==Ln)return 0;var t=this.pointers[0],e=this.pointers[1];return Tn(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;Mn.x=e.x-i.x,Mn.y=e.y-i.y}else Mn.x=0,Mn.y=0;return Mn}get centerX(){if(this.tracerState!==Ln)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.x+e.x)/2}get centerY(){if(this.tracerState!==Ln)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.y+e.y)/2}get prevCenterX(){if(this.tracerState!==Ln)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!==Ln)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&&lr(t,s,e,i)}isPointer1InGameObject(t,e,i){var s=this.pointers[1];return!!s&&lr(t,s,e,i)}}Object.assign(_n.prototype,Ue);var Mn={};const En=0,Rn=1,Ln=2,Dn="IDLE";Phaser.Utils.Objects.GetValue;const An=Phaser.Math.RotateAround;var Bn=function(t,e,i,s){return An(t,e,i,s),t.rotation+=s,t},zn={};const Wn=Phaser.Utils.Objects.GetValue,In=Phaser.Math.Angle.WrapDegrees,jn=Phaser.Math.Angle.ShortestBetween,Yn=Phaser.Math.RadToDeg,Fn=Phaser.Math.DegToRad;var Xn={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=zn),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=In(Yn(this.angleBetween));this.angle=jn(this.prevAngle,t),this.prevAngle=t,this.state=Gn}break;case Gn:t=In(Yn(this.angleBetween)),this.angle=jn(this.prevAngle,t),this.prevAngle=t,this.emit("rotate",this)}}get isRotated(){return this.state===Gn}get rotation(){return Fn(this.angle)}setDragThreshold(t){return this.dragThreshold=t,this}}.prototype,Xn);const Hn="IDLE",Vn="BEGIN",Gn="RECOGNIZED",Un=Phaser.Utils.Objects.GetValue;var Nn=function(t){var e=Un(t,"tap",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._tap=new sn(this,e),this._tap.on("tap",(function(t,e,s){zr(i.eventEmitter,`${i.eventNamePrefix}${t.tapsCount}tap`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const $n=Phaser.Utils.Objects.GetValue;var Kn=function(t){var e=$n(t,"press",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._press=new on(this,e),this._press.on("pressstart",(function(t,e,s){zr(i.eventEmitter,`${i.eventNamePrefix}pressstart`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this).on("pressend",(function(t,e,s){zr(i.eventEmitter,`${i.eventNamePrefix}pressend`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),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 xn(this,e),this._swipe.on("swipe",(function(t,e,s){var r=t.left?"left":t.right?"right":t.up?"up":"down";zr(i.eventEmitter,`${i.eventNamePrefix}swipe${r}`,i.targetSizers,i.targetMode,t.worldX,t.worldY,s)}),this)}};const Zn=Phaser.Utils.Objects.GetValue;var Qn=function(t,e){return t.setInteractive(),Zn(e,"dropZone",!1)&&(t.input.dropZone=!0),t._childrenInteractive={targetSizers:Zn(e,"targets",[t]),targetMode:Zn(e,"targetMode","parent"),eventEmitter:Zn(e,"eventEmitter",t),eventNamePrefix:Zn(e,"inputEventPrefix","child.")},Ir.call(t,e),Fr.call(t,e),Vr.call(t,e),$r.call(t,e),Nn.call(t,e),Kn.call(t,e),qn.call(t,e),t},ta={getSizerConfig:function(t){return void 0===t&&(t=this),Et(t)},getChildPrevState:function(t){var e=Et(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",de),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)}}for(var d,c,u=this.getAllShownChildren([this]),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 la=Phaser.Utils.Objects.IsPlainObject,da=Phaser.Utils.Objects.GetValue,ca=Phaser.Display.Align.CENTER,ua={min:0,full:-1};var pa=function(t,e,i,s,r,n,a,h,o,l){ge.call(this,t);var d=t.isRexSpace,c=typeof e;if(null===e)return this;if("number"===c);else if("string"===c)e=ua[e];else if(la(e)){var u;e=da(u=e,"proportion",void 0),i=da(u,"align",ca),s=da(u,"padding",0),r=da(u,"expand",!1),n=da(u,"key",void 0),a=da(u,"index",void 0),t.isRexSizer||(h=da(u,"minWidth",void 0),o=da(u,"minHeight",void 0)),l=da(u,"fitRatio",0)}return"string"==typeof i&&(i=zt[i]),void 0===e&&(e=d?1:0),void 0===i&&(i=ca),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===h&&(d?h=0:t.isRexSizer||(h=t._minWidth)),void 0===o&&(d?o=0:t.isRexSizer||(o=t._minHeight)),void 0===l||!1===l?l=0:!0===l&&(l=Q(t)/tt(t)),(u=this.getSizerConfig(t)).proportion=e,u.align=i,u.padding=pe(s),u.expand=r,u.fitRatio=0===e?l:0,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},va={add:pa,addSpace(t){return this.insertSpace(void 0,t),this},insertSpace(t,e){return void 0===e&&(e=1),pa.call(this,new ha(this.scene),{proportion:e,minWidth:0,minHeight:0,index:t}),this},insert(t,e,i,s,r,n,a,h){return la(i)&&(i.index=t),pa.call(this,e,i,s,r,n,a,t,h),this},insertAtPosition(t,e,i,s,r,n,a,h,o){var l=oa.call(this,t,e);return-1===l&&(l=void 0),this.insert(l,i,s,r,n,a,h,o),this}};const ga=Mt.prototype.clear;var fa=function(t){this.backgroundChildren&&(this.backgroundChildren.length=0);var e,i=!t&&this.sizerEventsEnable;if(i&&(e=this.getChildren([])),ga.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,fa.call(this,t),this}},ba={getChildAlign(t){return this.getSizerConfig(t).align},setChildAlign(t,e){return"string"==typeof e&&(e=zt[e]),this.getSizerConfig(t).align=e,this}},xa={getChildProportion(t){return this.getSizerConfig(t).proportion},setChildProportion(t,e){return this.getSizerConfig(t).proportion=e,this}},Ca={getChildExpand(t){return this.getSizerConfig(t).expand},setChildExpand(t,e){return this.getSizerConfig(t).expand=e,this}},wa={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}},Sa={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&&(Xe(t,0,0),e.resolved=!1,this.hasRatioFitChild=!0);return this._childrenProportion=void 0,this.hasProportion0Child=!1,this.proportionLength=void 0,je.call(this),this},layoutChildren:function(){for(var t,e,i,s,r,n,a,h,o,l,d=this.sizerChildren,c=this.innerLeft,u=this.innerTop,p=this.innerWidth,v=this.innerHeight,g=c,f=u,m=this.startChildIndex,y=0,b=d.length;y0?(e=t-this.getChildrenWidth(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},resolveHeight:function(t){if(void 0!==(t=Be.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)||De.call(this)},runWidthWrap:function(t){this.wrapResult||(1===this.orientation&&na.call(this,t,void 0),Ae.call(this,t))},hasHeightWrap:function(){return!(!this.hasRatioFitChild||0!==this.orientation)||ze.call(this)},runHeightWrap:function(t){this.wrapResult||(0===this.orientation&&na.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],a=n&&n.isRexSpace;return"center"===t?a||this.insertSpace(r+1):a&&this.remove(n,!0),this}};Object.assign(Sa,va,ya,ba,xa,Ca,wa);var ka=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},Oa={x:0,h:0,horizontal:0,"left-to-right":0,y:1,v:1,vertical:1,"top-to-bottom":1},Pa=function(t){return"string"==typeof t&&(t=Oa[t]),t};const Ta=Phaser.Utils.Objects.IsPlainObject,_a=Phaser.Utils.Objects.GetValue;class Ma extends ia{constructor(t,e,i,s,r,n,a){Ta(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)):Ta(s)?(s=_a(a=s,"width",void 0),r=_a(a,"height",void 0),n=_a(a,"orientation",0)):Ta(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=Pa(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=ka.call(this)),this._childrenProportion}}Object.assign(Ma.prototype,Sa);var Ea=function(t,e,i,s){return e/t<=i?e/(s-1):0},Ra=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=La(h.left,h.centerY,t,e))&&(r=o,s=n);var o,l=i[n+1];l&&l.y===h.y||r>(o=La(h.right,h.centerY,t,e))&&(r=o,s=n+1)}}return s};const Aa=Phaser.Utils.Objects.IsPlainObject,Ba=Phaser.Utils.Objects.GetValue,za=Phaser.Display.Align.CENTER;var Wa=function(t,e,i,s){return"\n"===t?(this.addNewLine(),this):(ge.call(this,t),Aa(e)&&(e=Ba(r=e,"padding",0),i=Ba(r,"key",void 0),s=Ba(r,"index",void 0)),void 0===e&&(e=0),(r=this.getSizerConfig(t)).align=za,r.padding=pe(e),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},Ia={add(t,e,i){if(dr(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,fa.call(this,t),this}},Fa={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},gh=0,fh=1,mh=2,yh=0,bh=1,xh=2,Ch=/(?:\r\n|\r|\n)/;const wh={none:yh,word:bh,char:xh,character:xh,mix:3},Sh=Phaser.Renderer.WebGL.Utils;var kh={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=Sh.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 Oh=Phaser.Display.Color;var Ph={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 Oh);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}},Th=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)},_h={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,Th(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 Mh=Phaser.Display.Canvas.CanvasPool,Eh=Phaser.GameObjects.GameObject,Rh=Phaser.Utils.String.UUID;let Lh=class extends Eh{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=Mh.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=Rh(),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(){Mh.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 Dh=Phaser.GameObjects.Components;Phaser.Class.mixin(Lh,[Dh.Alpha,Dh.BlendMode,Dh.Crop,Dh.Depth,Dh.Flip,Dh.GetBounds,Dh.Mask,Dh.Origin,Dh.Pipeline,Dh.PostPipeline,Dh.ScrollFactor,Dh.Tint,Dh.Transform,Dh.Visible,kh,Ph,_h]);var Ah={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 Bh{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(Bh.prototype,Ah);var zh={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 Wh=Phaser.Math.RotateAround;var Ih;const jh=Phaser.Geom.Rectangle;var Yh,Fh=function(t){void 0===Yh&&(Yh=new jh);var e=t.drawTLX,i=t.drawTLY;return Yh.setTo(e,i,t.drawTRX-e,t.drawBLY-i),Yh};const Xh=Phaser.Math.RotateAround;var Hh,Vh=function(t,e,i,s){return void 0===s?s={}:!0===s&&(void 0===Hh&&(Hh={}),s=Hh),s.x=e,s.y=i,0!==t.rotation&&Xh(s,0,0,t.rotation),s.x=s.x*t.scaleX+t.drawX,s.y=s.y*t.scaleY+t.drawY,s};const Gh=Phaser.GameObjects.Components.TransformMatrix;var Uh,Nh,$h={},Kh=function(t,e,i,s,r){var n=Vh(e,i,s,!0),a=function(t,e,i,s){void 0===s?s={}:!0===s&&(s=$h);var r=e-t.width*t.originX,n=i-t.height*t.originY;return void 0===Uh&&(Uh=new Gh,Nh=new Gh),t.parentContainer?t.getWorldTransformMatrix(Uh,Nh):Uh.applyITRS(t.x,t.y,t.rotation,t.scaleX,t.scaleY),Uh.transformPoint(r,n,s),s}(t,n.x,n.y,r);return a},Jh=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 Kh(t,e,n,a,r)},qh={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===Ih&&(Ih={}),s=Ih),s.x=(t-i.drawX)/i.scaleX,s.y=(e-i.drawY)/i.scaleY,0!==i.rotation&&Wh(s,0,0,-i.rotation),s}(t,e,this,!0);return Fh(this).contains(i.x,i.y)},getWorldPosition:function(t,e,i){return Jh(this.parent,this,t,e,i)}};Object.assign(qh,zh);const Zh=Phaser.Math.DegToRad,Qh=Phaser.Math.RadToDeg,to=Phaser.Utils.Objects.GetValue;class eo extends Bh{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 Qh(this._rotation)}set angle(t){this.rotation=Zh(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=to(t,"width",void 0),i=to(t,"height",void 0),s=to(t,"scaleX",void 0),r=to(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(eo.prototype,qh);const io=Phaser.Utils.String.Pad;var so=function(t,e,i){if(null==t)return t;switch(typeof t){case"string":default:return t;case"number":return`#${io(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}},ro=function(t,e,i){return e.hasOwnProperty(t)?e[t]:i[t]};const no=Phaser.Utils.Objects.GetValue;let ao=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=no(t,"x",0),i=no(t,"y",0));var s=this.cornerRadius;s.tl=ho(no(t,"tl",void 0),e,i),s.tr=ho(no(t,"tr",void 0),e,i),s.bl=ho(no(t,"bl",void 0),e,i),s.br=ho(no(t,"br",void 0),e,i)}get radiusTL(){var t=this.cornerRadius.tl;return Math.max(t.x,t.y)}set radiusTL(t){oo(this.cornerRadius.tl,t)}get radiusTR(){var t=this.cornerRadius.tr;return Math.max(t.x,t.y)}set radiusTR(t){oo(this.cornerRadius.tr,t)}get radiusBL(){var t=this.cornerRadius.bl;return Math.max(t.x,t.y)}set radiusBL(t){oo(this.cornerRadius.bl,t)}get radiusBR(){var t=this.cornerRadius.br;return Math.max(t.x,t.y)}set radiusBR(t){oo(this.cornerRadius.br,t)}};var ho=function(t,e,i){return void 0===t?t={x:e,y:i}:"number"==typeof t&&(t={x:t,y:t}),lo(t),t},oo=function(t,e){"number"==typeof e?(t.x=e,t.y=e):(t.x=no(e,"x",0),t.y=no(e,"y",0)),lo(t)},lo=function(t){t.convex=t.x>=0||t.y>=0,t.x=Math.abs(t.x),t.y=Math.abs(t.y)};const co=Phaser.Math.DegToRad;var uo=function(t){return!t.hasOwnProperty("convex")||t.convex},po=function(t){return t.x>0&&t.y>0},vo=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,po(h)?(o=h.x*g,l=h.y*f,uo(h)?vo(t,o,l,o,l,180,270,!1,a):vo(t,0,0,o,l,90,0,!0,a),d=0,c=l):(t.lineTo(0,0),d=0,c=0),h=m.tr,po(h)?(o=h.x*g,l=h.y*f,uo(h)?vo(t,s-o,l,o,l,270,360,!1,a):vo(t,s,0,o,l,180,90,!0,a)):t.lineTo(s,0),h=m.br,po(h)?(o=h.x*g,l=h.y*f,uo(h)?vo(t,s-o,r-l,o,l,0,90,!1,a):vo(t,s,r,o,l,270,180,!0,a)):t.lineTo(s,r),h=m.bl,po(h)?(o=h.x*g,l=h.y*f,uo(h)?vo(t,o,r-l,o,l,90,180,!1,a):vo(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())},fo=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),go(t.canvas,t.context,d,d,o,l,r,e,i,s,n,a,h)}};const mo=Phaser.Utils.Objects.GetValue;class yo extends eo{constructor(t,e){super(t,"background"),this.setScrollFactor(0),this.setColor(mo(e,"color",null),mo(e,"color2",null),mo(e,"horizontalGradient",!0)),this.setStroke(mo(e,"stroke",null),mo(e,"strokeThickness",2)),this.setCornerRadius(mo(e,"cornerRadius",0),mo(e,"cornerIteration",null))}set color(t){t=so(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=so(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=so(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,ro("color2",t,this),ro("horizontalGradient",t,this)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,ro("strokeThickness",t,this)),t.hasOwnProperty("cornerRadius")&&this.setCornerRadius(t.cornerRadius,ro("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(){fo(this.parent,this.color,this.stroke,this.strokeThickness,this.cornerRadius,this.color2,this.horizontalGradient,this.cornerIteration)}}const bo=Phaser.Utils.Objects.GetValue;class xo extends eo{constructor(t,e){super(t,"innerbounds"),this.setScrollFactor(0),this.setColor(bo(e,"color",null),bo(e,"color2",null),bo(e,"horizontalGradient",!0)),this.setStroke(bo(e,"stroke",null),bo(e,"strokeThickness",2))}set color(t){t=so(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=so(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=so(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,bo(t,"color2",null),bo(t,"horizontalGradient",!0)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,bo(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 Co=Phaser.Utils.Objects.GetValue;let wo=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(Co(t,"bold",!1)),this.setItalic(Co(t,"italic",!1)),this.setFontSize(Co(t,"fontSize","16px")),this.setFontFamily(Co(t,"fontFamily","Courier")),this.setColor(Co(t,"color","#fff")),this.setStrokeStyle(Co(t,"stroke",null),Co(t,"strokeThickness",0)),this.setShadow(Co(t,"shadowColor",null),Co(t,"shadowOffsetX",0),Co(t,"shadowOffsetY",0),Co(t,"shadowBlur",0)),this.setOffset(Co(t,"offsetX",0),Co(t,"offsetY",0)),this.setSpace(Co(t,"leftSpace",0),Co(t,"rightSpace",0)),this.setAlign(Co(t,"align",void 0)),this.setBackgroundColor(Co(t,"backgroundColor",null)),this.setBackgroundHeight(Co(t,"backgroundHeight",void 0)),this.setBackgroundBottomY(Co(t,"backgroundBottomY",void 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(ro("stroke",t,this),ro("strokeThickness",t,this)),t.hasOwnProperty("shadowColor")&&this.setShadowColor(t.shadowColor),(t.hasOwnProperty("shadowOffsetX")||t.hasOwnProperty("shadowOffsetY"))&&this.setShadowOffset(ro("shadowOffsetX",t,this),ro("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),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=so(t),this}get hasFill(){return null!=this.color}setStrokeStyle(t,e){return this.stroke=so(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=so(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=so(t),this}get hasBackgroundColor(){return null!=this.backgroundColor}setBackgroundHeight(t){return this.backgroundHeight=t,this}setBackgroundBottomY(t){return this.backgroundBottomY=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,ko=Phaser.Utils.Array.Remove,Oo="text",Po="image",To="drawer",_o="space",Mo="command";var Eo=function(t){return t.type===Oo&&"\n"===t.text},Ro=function(t){return t.type===Oo&&"\f"===t.text},Lo=function(t){return t.type===Oo};class Do extends eo{constructor(t,e,i){super(t,Oo),this.updateTextFlag=!1,this.style=new wo(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,s=this.drawTRX-i+1,r=e.backgroundBottomY;null==r&&(r=this.drawBLY);var n=e.backgroundHeight;null==n&&(n=r-this.drawTLY);var a=r-n;t.fillRect(i,a,s,n)}var h=e.hasFill,o=e.hasStroke;(h||o)&&(e.syncFont(t).syncStyle(t),o&&(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 Ao=function(t,e){var i=this.createCharChildren(t,e);return this.addChild(i),this};const Bo=Phaser.Display.Canvas.CanvasPool;var zo=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=Bo.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),Bo.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 Wo extends eo{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(){zo(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 Io extends eo{constructor(t,e,i,s){super(t,To),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 jo extends eo{constructor(t,e){super(t,_o),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 Yo extends Bh{constructor(t,e,i,s,r){super(t,Mo),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 Fo(t){if(null===t||"object"!=typeof t)return t;if(Array.isArray(t))return t.map((t=>Fo(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}var Xo=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 Ho={none:0,word:1,char:2,character:2,mix:3};var Vo=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=$o.call(this)).height,a=l.ascent,i=Math.floor((o-a)/n))}else{var l;n=(l=$o.call(this)).height,a=l.ascent}}else this.fixedHeight>0?void 0===(i=Jo(t,"maxLines"))&&(o=this.fixedHeight-s,i=Math.floor(o/n)):i=Jo(t,"maxLines",0);void 0===a&&(a=n);var d=0===i,c=Jo(t,"wrapMode");void 0===c&&(c=Jo(t,"charWrap",!1)?"char":"word"),"string"==typeof c&&(c=Ho[c]);var u=Jo(t,"wrapWidth",void 0);void 0===u&&(this.fixedWidth>0?u=this.fixedWidth-r:(u=1/0,c=0));for(var p=Jo(t,"letterSpacing",0),v=Jo(t,"hAlign",0),g=Jo(t,"vAlign",0),f=Jo(t,"justifyPercentage",.25),m=Xo({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&&(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 Y=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,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=Qo(t,"maxLines",void 0))){var a=this.fixedWidth-r;i=Math.floor(a/n)+1}}else i=Qo(t,"maxLines",0);var h=0===i,o=Qo(t,"fixedCharacterHeight",void 0);if(void 0===o){var l=Qo(t,"charPerLine",void 0);if(void 0!==l){var d=this.fixedHeight-s;o=Math.floor(d/l)}}var c=Qo(t,"wrapHeight",void 0);void 0===c&&(c=this.fixedHeight>0?this.fixedHeight-s:1/0);for(var u=Qo(t,"letterSpacing",0),p=Qo(t,"rtl",!0),v=Qo(t,"hAlign",p?2:0),g=Qo(t,"vAlign",0),f=Xo({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: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,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 Ee(i,t,e),this.dirty=this.dirty||s!=i.left||r!=i.right||n!=i.top||a!=i.bottom,this},getPadding:function(t){return Me(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 ko(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(Oo);return null===i?i=new Do(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)),Jh(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 kl=Phaser.Utils.Objects.GetFastValue;var Ol={};class Pl{constructor(t){this.pools=kl(t,"pools",Ol)}free(t){if(!this.pools)return this;var e=t.type;return this.pools.hasOwnProperty(e)||(this.pools[e]=new Sl),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=Al(t,r,e,i,n),h=0;h<=Rl&&0!==a;h++){if((r+=a)<0){r=0;break}a=Al(t,r,e,i,n)}return h===Rl&&console.warn("FontSizeFit: Test count exceeds 65535"),t.setFontSize(r),Bl(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]},Al=function(t,e,i,s,r){var n,a=Dl(t,e,r),h=Dl(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)},Bl=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 zl=Phaser.Utils.Objects.GetValue,Wl=Phaser.Utils.Objects.GetValue;class Il extends Qa{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexLabel";var i,s=Wl(e,"background",void 0),r=Wl(e,"icon",void 0),n=Wl(e,"iconMask",void 0),a=Wl(e,"text",void 0),h=Wl(e,"action",void 0),o=Wl(e,"actionMask",void 0),l=Wl(e,"align",void 0);if(s&&this.addBackground(s),r){0===this.orientation?(a||h)&&(i={right:Wl(e,"space.icon",0),top:Wl(e,"space.iconTop",0),bottom:Wl(e,"space.iconBottom",0),left:Wl(e,"space.iconLeft",0)}):(a||h)&&(i={bottom:Wl(e,"space.icon",0),left:Wl(e,"space.iconLeft",0),right:Wl(e,"space.iconRight",0),top:Wl(e,"space.iconTop",0)});var d=Wl(e,"squareFitIcon",!1)?1:0;if(this.add(r,{proportion:0,padding:i,fitRatio:d}),n&&(n=nh.call(this,r,r,1)),!d){var c=Wl(e,"iconSize",void 0);this.setIconSize(Wl(e,"iconWidth",c),Wl(e,"iconHeight",c))}}if(a){var u=Wl(e,"wrapText",!1),p=Wl(e,"adjustTextFontSize",!1);u?(!0===u&&(u="word"),function(t,e){switch(dh(t)){case 0:switch("string"==typeof e&&(e=wh[e]||0),t.style.wrapMode=e,e){case 2:case 3:t.style.wordWrapCallback=ph;break;default:t.style.wordWrapCallback=null}break;case 1:"string"==typeof e&&(e=wh[e]||0),t.style.wrapMode=e}}(a,u),e.expandTextWidth=!0,El(a)):p&&(e.expandTextWidth=!0,e.expandTextHeight=!0,function(t,e){"number"==typeof e&&(e={minWidth:e});var i=zl(e,"minWidth",0),s=zl(e,"minHeight",0),r=zl(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})}(a,{fitHeight:!0}));var v,g,f=Wl(e,"space.text",0),m=Wl(e,"expandTextWidth",!1),y=Wl(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:Wl(e,"space.actionTop",0),bottom:Wl(e,"space.actionBottom",0),right:Wl(e,"space.actionRight",0)}:{left:Wl(e,"space.actionLeft",0),right:Wl(e,"space.actionRight",0),bottom:Wl(e,"space.actionBottom",0)},d=Wl(e,"squareFitAction",!1)?1:0,this.add(h,{proportion:0,padding:i,fitRatio:d}),o&&(o=nh.call(this,h,h,1)),!d)){var b=Wl(e,"actionSize");this.setActionSize(Wl(e,"actionWidth",b),Wl(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 jl=Phaser.Renderer.WebGL.Utils,Yl=function(t,e,i,s,r,n){for(var a=jl.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+")"},Gl=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 Ul=Phaser.Renderer.Canvas.SetTransform;var Nl={renderWebGL:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.pipelines.set(e.pipeline),n=Hl(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&&Yl(r,a,e,l,h,o),e.isStroked&&Xl(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(Ul(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(Kl.prototype,Nl);var Jl=function(t){return t.x>0&&t.y>0},ql=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 Zl=Phaser.Math.DegToRad;var Ql=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=tc(t,"tl",0),this.radiusTR=tc(t,"tr",0),this.radiusBL=tc(t,"bl",0),this.radiusBR=tc(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?Ql(e,e,e,e,180,270,!1,r,t):Ql(0,0,e,e,90,0,!0,r,t):ql(0,0,t),(e=this.radiusTR)>0?this._convexTR?Ql(i-e,e,e,e,270,360,!1,r,t):Ql(i,0,e,e,180,90,!0,r,t):ql(i,0,t),(e=this.radiusBR)>0?this._convexBR?Ql(i-e,s-e,e,e,0,90,!1,r,t):Ql(i,s,e,e,270,180,!0,r,t):ql(i,s,t),(e=this.radiusBL)>0?this._convexBL?Ql(e,s-e,e,e,90,180,!1,r,t):Ql(0,s,e,e,360,270,!0,r,t):ql(0,s,t),t.push(t[0],t[1]),Wd(this.x,this.y,t),super.updateData(),this}}Phaser.Renderer.WebGL.Utils.getTintAppendFloatAlpha;var ic=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 sc=Phaser.Utils.Objects.GetValue,rc=Phaser.Utils.Objects.IsPlainObject;class nc extends(Td(bd)){constructor(t,e,i,s,r,n,a,h){rc(e)?(e=(h=e).x,i=h.y,s=h.width,r=h.height,n=h.barColor,a=h.value):rc(s)?(s=(h=s).width,r=h.height,n=h.barColor,a=h.value):rc(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 Qd).setName("trackFill")).addShape((new Qd).setName("bar")).addShape((new Qd).setName("trackStroke")),this.setTrackColor(sc(h,"trackColor",void 0)),this.setBarColor(n),this.setTrackStroke(sc(h,"trackStrokeThickness",2),sc(h,"trackStrokeColor",void 0)),this.setSkewX(sc(h,"skewX",0)),this.setRTL(sc(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 ac={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&&ic(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),ic(a,r,0,n,i,t));var h=this.getShape("trackStroke");h.lineStyle(this.trackStrokeThickness,this.trackStrokeColor),h.isStroked&&ic(h,0,0,e,i,t)}};Object.assign(nc.prototype,ac);var hc=function(t){return null==t||""===t||0===t.length},oc=function(t,e,i,s){if(void 0===s&&(s="."),"object"==typeof t){if(hc(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(hc(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=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),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 S=i.length;o0?0:f),f>=1&&g>=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,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(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 Pc(t)?(this.stretchMode.edge=_c(Tc(t,"edge",0)),this.stretchMode.internal=_c(Tc(t,"internal",0))):(t=_c(t),this.stretchMode.edge=t,this.stretchMode.internal=t),this},getStretchMode:function(t,e){return Ec.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,Ac=Phaser.GameObjects;var Bc=void 0,zc=function(t,e){if(Bc||(Bc={},Ze(t).events.once("destroy",(function(){for(var t in Bc)Bc[t].destroy();Bc=void 0}))),!Bc.hasOwnProperty(e)){var i=Ze(t).scene.systemScene;(t=new Ac[e](i)).setOrigin(0),Bc[e]=t}return Bc[e]};const Wc=Phaser.GameObjects.RenderTexture;class Ic extends(function(t,e){class i extends t{constructor(t,i,s,r,n,a,h,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),a=Dc(d,"key",void 0),h=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),a=Dc(d,"key",void 0),h=Dc(d,"baseFrame",void 0),o=Dc(d,"columns",void 0),l=Dc(d,"rows",void 0)):Lc(a)?(a=Dc(d=a,"key",void 0),h=Dc(d,"baseFrame",void 0),o=Dc(d,"columns",void 0),l=Dc(d,"rows",void 0)):Lc(h)?(h=Dc(d=h,"baseFrame",void 0),o=Dc(d,"columns",void 0),l=Dc(d,"rows",void 0)):Array.isArray(h)?(d=l,l=o,o=h,h=Dc(d,"baseFrame",void 0)):Lc(o)&&(o=Dc(d=o,"columns",void 0),l=Dc(d,"rows",void 0)),void 0===h&&(h=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(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,Rc),i}(Wc,"rexNinePatch")){}var jc={_drawImage:function(t,e,i,s,r,n){var a=zc(this,"Image").setTexture(t,e).setDisplaySize(r,n);this.draw(a,i,s)},_drawTileSprite:function(t,e,i,s,r,n){var a=zc(this,"TileSprite").setTexture(t,e).setSize(r,n);this.draw(a,i,s)}};Object.assign(Ic.prototype,jc);let Yc=class extends ti{constructor(t,e){return super(t),new Proxy(this,this)}get(t,e){if(cc(t,e))return t[e];var i=t.parent;return cc(i,e)?i[e]:void 0}set(t,e,i){return cc(t,e)?t[e]=i:cc(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 Xc extends Ic{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexStatesNinePatch";var i=Fc(e,"effects",!0);i&&fc(this,i),this.style=new Yc(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign(Xc.prototype,cd);const Hc=["alpha","tint","flipX","flipY"];var Vc=function(t,e){if(!e)return t;for(var i=0,s=Hc.length;i * @copyright 2018 Photon Storm Ltd. @@ -8,4 +8,4 @@ var t,e;t=void 0,e=function(){var t=!1,e=function(e){t||(void 0===e&&(e=60),pars * @author Richard Davey * @copyright 2019 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} - */var Fg=function(t,e){var i=mt(t);for(var s in e)i.hasOwnProperty(s)||(i[s]=e[s]);return i},Xg=function(t,e,i){return Gc(t,Fg(e,i))};class Hg extends Ys{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 Vg={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}},Gg=function(t,e){Ai.popUp.call(t,e,this.expandDirection)},Ug=function(t,e){Ai.scaleDown.call(t,e,this.expandDirection)},Ng={setTransitionDuration(t){return this.transitionDuration=t,this.childTransition.setTransitInTime(t).setTransitOutTime(t),this},setExpandCallback(t){return void 0===t&&(t=Gg.bind(this)),this.childTransition.setTransitInCallback(t),this},setCollapseCallback(t){return void 0===t&&(t=Ug.bind(this)),this.childTransition.setTransitOutCallback(t),this}};const $g=Phaser.Utils.Objects.GetValue;let Kg=class extends Ma{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=$g(e,"space"),a=1===this.orientation?"left":"top",h=$g(e,"align.title",a),o=$g(e,"expand.title",!0);this.add(s,{proportion:0,align:h,expand:o,padding:{left:$g(n,"titleLeft",0),right:$g(n,"titleRight",0),top:$g(n,"titleTop",0),bottom:$g(n,"titleBottom",0)}});var l=$g(e,"toggleByTarget",void 0),d=$g(e,"toggleClickConfig");if(void 0===l&&(l=s),l&&wr.onClick.call(l,(function(){this.toggle()}),this,d),this.childTransition=new Hg(r),!$g(e,"customChildOrigin",!1)){var c=this.rtl?1:0;r.setOrigin(c)}h=$g(e,"align.child","left");var u=(o=$g(e,"expand.child",!0))?1:0;this.add(r,{proportion:u,align:h,expand:o,padding:{left:$g(n,"childLeft",0),right:$g(n,"childRight",0),top:$g(n,"childTop",0),bottom:$g(n,"childBottom",0)}}),this.addChildrenMap("title",s),this.addChildrenMap("child",r),this.addChildrenMap("background",i);var p=e.transition;this.setTransitionDuration($g(p,"duration",200)),this.setExpandCallback($g(p,"expandCallback",void 0)),this.setCollapseCallback($g(p,"collapseCallback",void 0)),this.reLayoutTarget=$g(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=$g(e,"expanded",void 0);void 0!==y&&this.setExpandedState(y)}};Object.assign(Kg.prototype,Vg,Ng);var Jg={setBindingTarget(t){return this.childrenMap.child.setBindingTarget(t),this}},qg={getMaxInputRowTitleWidth(){return this.childrenMap.child.getMaxInputRowTitleWidth()+this.getInnerPadding("left")},setInputRowTitleWidth(t){return t-=this.getInnerPadding("left"),this.childrenMap.child.setInputRowTitleWidth(t),this}};class Zg extends Kg{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(Zg.prototype,Jg,qg);const Qg=Phaser.Utils.Objects.GetValue,tf=Phaser.Utils.Objects.GetValue,ef=Ma.prototype.add,sf=Ma.prototype.addSpace;var rf=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)&&sf.call(this),ef.call(this,t,{proportion:i,expand:!0});var s=!this.buttonsExpand&&"center"===this.buttonsAlign;s&&sf.call(this),this.hasTailSpace=s}else ef.call(this,t,{proportion:i,expand:!0}),this.hasTailSpace=!1;else if(this.hasTailSpace){var r=this.sizerChildren.length-1;ef.call(this,t,{index:r,proportion:i,expand:!0})}else ef.call(this,t,{proportion:i,expand:!0});return e&&this.buttonGroup.add(t),this},nf={addButton(t){if(dr(t))for(var e=t,i=0,s=e.length;i=0;i--)of.call(this,e[i],t);return this}},df=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)}},cf=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,df.call(e,t,i,s)}},enumerable:!0,configurable:!0}),t.selected=!1},uf={add(t){return this.buttons.push(t),t._click||(t._click=new xr(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`),cf.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&&kf.addNewLine(this)}else for(n=0,a=t.length;n=0;i--)Mf.call(this,e[i],t);return this}};const Rf=Phaser.Utils.Objects.GetValue;class Lf extends Ua{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 bf({parent:this,eventEmitter:Rf(e,"eventEmitter",this),groupName:Rf(e,"groupName",void 0),clickConfig:Rf(e,"click",void 0)}).setButtonsType(e);var s=Rf(e,"background",void 0),r=Rf(e,"buttons",void 0);this.buttonsAlign=Rf(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(Lf.prototype,Pf,Ef,yf,Cf);var Df=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=Af[i])}void 0===s?s={}:!0===s&&(s=Bf);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 Af={fit:0,FIT:0,envelop:1,ENVELOP:1};var Bf={},zf={},Wf={};const If=Phaser.Utils.Objects.IsPlainObject,jf=Phaser.Utils.Objects.GetValue,Yf=Phaser.Display.Align.CENTER,Ff=Phaser.Utils.String.UUID;var Xf={add:function(t,e,i,s,r,n,a,h,o,l){ge.call(this,t),If(e)&&(e=jf(d=e,"key",void 0),i=jf(d,"align",Yf),s=jf(d,"padding",0),r=jf(d,"expand",!0),t.isRexSizer||(n=jf(d,"minWidth",t._minWidth),a=jf(d,"minHeight",t._minHeighted)),h=jf(d,"offsetX",0),o=jf(d,"offsetY",0),l=jf(d,"aspectRatio",0));var d,c=void 0!==e;return c||(e=Ff()),"string"==typeof i&&(i=zt[i]),void 0===i&&(i=Yf),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===l?l=0:!0===l&&(l=Q(t)/tt(t)),l>0&&(r=!0,void 0===n&&(n=0),void 0===a&&(a=0)),(d=this.getSizerConfig(t)).align=i,d.padding=pe(s),If(r)?(d.expandWidth=jf(r,"width",!1),d.expandHeight=jf(r,"height",!1)):(d.expandWidth=r,d.expandHeight=r),t.isRexSizer||(d.expandWidth&&(t.minWidth=void 0===n?Q(t):n),d.expandHeight&&(t.minHeight=void 0===a?tt(t):a)),d.alignOffsetX=h,d.alignOffsetY=o,d.aspectRatio=l,this.sizerChildren.hasOwnProperty(e)&&this.sizerChildren[e].destroy(),this.sizerChildren[e]=t,c&&this.addChildrenMap(e,t),this}},Hf={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]),we.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 fa.call(this,t),this}},Vf={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=this.innerLeft,c=this.innerTop,u=this.innerWidth,p=this.innerHeight,v=this.sizerChildren;for(var g in v)(t=v[g]).rexSizer.hidden||(i=(e=t.rexSizer).padding,gr.call(this,t),h=this.getExpandedChildWidth(t),o=this.getExpandedChildHeight(t),e.aspectRatio>0&&(zf.width=e.aspectRatio,zf.height=1,Wf.width=h,Wf.height=o,h=(l=Df(zf,Wf,"FIT",!0)).width,o=l.height),t.isRexSizer?(t.runLayout(this,h,o),sa(t,this)):Xe(t,h,o),s=d+i.left*this.scaleX,n=u-(i.left+i.right)*this.scaleX,r=c+i.top*this.scaleY,a=p-(i.top+i.bottom)*this.scaleY,fr.call(this,t,s,r,n,a,e.align,e.alignOffsetX,e.alignOffsetY))}};Object.assign(Vf,Xf,Hf);const Gf=Phaser.Utils.Objects.IsPlainObject,Uf=Phaser.Utils.Objects.GetValue;class Nf extends ia{constructor(t,e,i,s,r,n){Gf(e)?(e=Uf(n=e,"x",0),i=Uf(n,"y",0),s=Uf(n,"width",void 0),r=Uf(n,"height",void 0)):Gf(s)&&(s=Uf(n=s,"width",void 0),r=Uf(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(Nf.prototype,Vf);const $f=Nf.prototype.add;var Kf=function(t,e,i,s,r,n,a,h,o){return t.setVisible(!1),$f.call(this,t,e,i,s,r,n,a,h,o),this},Jf={add:Kf,addPage:Kf};const qf=Mt.prototype.setChildVisible;var Zf={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?(qf.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&&(qf.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(Zf,Jf);const Qf=Phaser.Utils.Objects.GetValue;class tm extends Nf{constructor(t,e){super(t,e),this.type="rexPages",this.childrenMap=this.sizerChildren,this._previousKey=void 0,this._currentKey=void 0,this.setSwapMode(Qf(e,"swapMode",0)),this.setFadeInDuration(Qf(e,"fadeIn",0))}setSwapMode(t){return"string"==typeof t&&(t=em[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(tm.prototype,Zf);const em={invisible:0,destroy:1},im=Phaser.Utils.Objects.IsPlainObject,sm=Phaser.Utils.Objects.GetValue,rm=Phaser.Utils.String.UUID;var nm={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}},am={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}},hm={top:1,left:3,right:5,bottom:7},om={top:"bottom",left:"right",right:"left",bottom:"top"},lm={setTabsPadding(t,e){return this.childrenMap.tabs.setOuterPadding(t,e),this},getTabsPadding(t){return this.childrenMap.tabs.getOuterPadding(t)}},dm={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 _m=Phaser.Utils.Objects.GetValue;class Mm extends Ma{constructor(t,e){void 0===e&&(e={}),e.orientation="y",super(t,e),this.type="rexTweaker.Wrap";var i=_m(e,"background",void 0),s=_m(e,"title",void 0);i&&this.addBackground(i),s&&this.add(s,{expand:!0,space:{bottom:_m(e,"space.title",0)}});var r=_m(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(Mm.prototype,Pm,Tm);const Em=Phaser.Utils.Objects.GetValue,Rm=Phaser.Utils.Objects.GetValue;var Lm=function(t){return t.hasOwnProperty("geometryMask")?t.geometryMask:t.bitmapMask};const Dm=Phaser.Geom.Intersects.RectangleToRectangle,Am=Phaser.Geom.Rectangle.Overlaps;var Bm=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}},zm=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},Wm=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))},Im=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))},jm=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 Ym=Phaser.Utils.Objects.GetValue,Fm={update:0,everyTick:1};var Xm={setupChildrenMask(t){return!1===t||(this.setMaskUpdateMode(Ym(t,"updateMode",0)),this.enableChildrenMask(Ym(t,"padding",0)),this.setMaskLayer(Ym(t,"layer",void 0)),this.onMaskGameObjectVisible=Ym(t,"onVisivle"),this.onMaskGameObjectInvisible=Ym(t,"onInvisible"),this.maskGameObjectCallbackScope=Ym(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=Fm[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=nh.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=Lm(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(Nm.prototype,Hm);const $m=["top","bottom","centerY","center"],Km=["left","right","centerX","center"];var Jm=function(t,e,i){var s,r="Y"===(e=e.toUpperCase()),n=this.childrenMap.child;if(r){if(i)for(var a=0,h=$m.length;a=0?0:Math.abs(l)<=Math.abs(d)?l:d}}else{if(i)for(a=0,h=Km.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 qm=Phaser.Utils.Objects.GetValue;class Zm extends sg{constructor(t,e){void 0===e&&(e={});var i=Bp(e),s=qm(e,"panel",void 0);void 0===s&&(s={}),s.scrollMode=i,s.clampChildOY=qm(e,"clampChildOY",!1),s.clampChildOX=qm(e,"clampChildOX",!1);var r,n,a=new Nm(t,s);switch(t.add.existing(a),i){case 0:r=qm(e,"expand.panel",!0),n=!0;break;case 1:r=!0,n=qm(e,"expand.panel",!0);break;default:r=!0,n=!0}e.type="rexScrollablePanel",e.child={gameObject:a,expandWidth:r,expandHeight:n,align:qm(e,"align.panel","center")};var h=qm(e,"space",void 0);h&&(h.child=qm(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]),Qn(this.childrenMap.child,t),this}}var Qm={scrollToChild:function(t,e){if(!this.hasChild(t))return this;switch(this.scrollMode){case 0:Jm.call(this,t,"y",e);break;case 1:Jm.call(this,t,"x",e);break;default:Jm.call(this,t,"y",e),Jm.call(this,t,"x",e)}return this}};Object.assign(Zm.prototype,Qm);var ty={setBindingTarget(t){return this.childrenMap.panel.setBindingTarget(t),this}},ey={getMaxInputRowTitleWidth(){return this.childrenMap.panel.getMaxInputRowTitleWidth()+this.getInnerPadding("left")},setInputRowTitleWidth(t){return t-=this.getInnerPadding("left"),this.childrenMap.panel.setInputRowTitleWidth(t),this}};class iy extends Zm{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(iy.prototype,ty,ey);const sy=Phaser.Utils.Objects.GetValue,ry=Phaser.Utils.Objects.GetValue,ny=Phaser.Utils.Objects.GetValue;var ay={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=ny(t,"onGetValue"),this.onSetValue=ny(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}},hy={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)}}},oy={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 ly=Phaser.Utils.Objects.GetValue;class dy extends Ma{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=ly(e,"proportion.title",0),h=ly(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=ly(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(dy.prototype,ay,hy,oy);var cy=function(t,e,i){var s=new Pg(t,i);return t.add.existing(s),s},uy=function(t){return void 0===t&&(t=Ma),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}}},py=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=by(this.styles,"inputRow")||{},r=yy(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 Gc(t,Fg(e,i))}(this.scene,t,xy(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),Cy(this,Fo(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)):(Vy(this),Gy(this)),this}setNumberInput(){return this.onUpdateCallback=Hy,this}setSelectAllWhenFocusEnable(t){return void 0===t&&(t=!0),this.selectAllWhenFocus=t,this}setRequestCursorPosition(t){return this.isOpened?(this.requestCursorPosition=t,this):this}}const $y=Phaser.Utils.Objects.GetValue,Ky=["inputType","onOpen","clickOutSideTarget","onFocus","onClose","onBlur","onUpdate","enterClose","readOnly","maxLength","minLength","selectAll"];var Jy=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}sb.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(rb(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 nb=new sb,ab=/^[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,hb=/\S/,ob=new sb;ob.equals=function(t,e){return this.options.ignoreCase&&(t=t.toLowerCase(),e=e.toLowerCase()),t===e||this.options.ignoreWhitespace&&!hb.test(t)&&!hb.test(e)},ob.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(ub(t,null,null,i),i," ")},cb.equals=function(t,e){return sb.prototype.equals.call(cb,t.replace(/,([\r\n])/g,"$1"),e.replace(/,([\r\n])/g,"$1"))};const pb=new sb;pb.tokenize=function(t){return t.slice()},pb.join=pb.removeEmpty=function(t){return t};const vb=Phaser.Utils.Array.Remove;var gb=function(t,e){var i=t.text;if(e!==i){if(null==i&&(i=""),vb(t.children,t.lastInsertCursor),""===e)t.removeChildren();else for(var s=(o=i,l=e,nb.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},xb={cursorMoveLeft(){if(!this.isOpened)return this;var t=mb(this.cursorPosition-1,0,this.inputText.length);return this.setCursorPosition(t),this},cursorMoveRight(){if(!this.isOpened)return this;var t=mb(this.cursorPosition+1,0,this.inputText.length);return this.setCursorPosition(t),this},cursorMoveUp(){if(!this.isOpened)return this;var t=yb(this.characterCountOfLines,this.cursorPosition);t.lineIndex-=1;var e=mb(bb(this.characterCountOfLines,t),0,this.inputText.length);return this.setCursorPosition(e),this},cursorMoveDown(){if(!this.isOpened)return this;var t=yb(this.characterCountOfLines,this.cursorPosition);t.lineIndex+=1;var e=mb(bb(this.characterCountOfLines,t),0,this.inputText.length);return this.setCursorPosition(e),this}};const Cb=Phaser.Utils.Objects.IsPlainObject;class wb extends Ml{constructor(t,e,i,s,r,n){Cb(e)?n=e:Cb(s)&&(n=s),void 0===n&&(n={}),function(t,e){var i=!e.textArea;if(Jy(e,"wrap.vAlign")||oc(e,"wrap.vAlign",s=i?"center":"top"),Jy(e,"wrap.wrapMode")||oc(e,"wrap.wrapMode","char"),Jy(e,"wrap.maxLines")||oc(e,"wrap.maxLines",s=i?1:void 0),i&&oc(e,"wrap.wrapWidth",1/0),Jy(e,"wrap.useDefaultTextHeight")||oc(e,"wrap.useDefaultTextHeight",!0),e.edit||(e.edit={}),!Jy(e.edit,"inputType")){var s=i?"text":"textarea";oc(e.edit,"inputType",s)}if(!0===e.clickOutSideTarget){var r=new Zy(t);t.add.existing(r),e.clickOutSideTarget=r}}(t,n);var a=n.text;a&&delete n.text;var h=nd(n.background,"focus"),o=nd(n.style,"cursor");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=$y(e,"edit");return void 0===i&&(i={}),Ty(e,i,Ky),new Ny(t,i)}(this,n),Qy.call(this),n.focusStyle&&Object.assign(h,n.focusStyle),ib.call(this,h),n.cursorStyle&&Object.assign(o,n.cursorStyle),eb.call(this,o);var l=n.onAddChar;l&&this.on("addchar",l);var d=n.onCursorOut;d&&this.on("cursorout",d);var c=n.onCursorIn;c&&this.on("cursorin",c);var u,p=n.onMoveCursor;p&&this.on("movecursor",p),this.setParseTextCallback(n.parseTextCallback),this.lastInsertCursor=((u=this.createCharChild("|")).text="",u),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=kb(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))}},Pb={setText(t){return this.childrenMap.child.setText(t),this},appendText(t){return this.setText(this.text+t),this}},Tb={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 _b=Phaser.Utils.Objects.GetValue;class Mb extends sg{constructor(t,e){void 0===e&&(e={});var i,s=_b(e,"text");bt(s)?i=s:(void 0===s&&(s={}),s.textArea=!0,i=new wb(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=_b(e,"space",void 0);o&&(o.child=_b(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=_b(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(Mb.prototype,Pb,Tb);var Eb={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?Fo(e):{}:e||(e={});var s=new Mb(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()}},Rb={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=kb(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 Lb=Phaser.Utils.Objects.GetValue,Db=Phaser.Math.Linear,Ab=Phaser.Math.Snap.Floor;var Bb={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=Lb(s,r),a=function(t,e){var i=new Tv(t,e);return t.add.existing(i),i}(i,s),h=e.defaultExpandWidth?2:0,o=Lb(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=kb(i,d).setNumberInput();h=e.defaultExpandWidth?1:0,o=Lb(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=Db(t.minValue,t.maxValue,a.value);t.step&&(e=Ab(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))}},zb=function(t,e){var i=new Sf(t,e);return t.add.existing(i),i};const Wb=Phaser.Utils.Objects.GetValue;var Ib={name:"RangeInput",accept:t=>!!t.hasOwnProperty("view")&&"incdec"===t.view,build(t,e){var i=t.scene;t.type="rexTweaker.IncDecInput";var s=Wb(e,"incDec")||{},r={text:null,action:null},n=zb(i,{expand:!1}),a=e.defaultExpandWidth?1:0;t.add(n,{proportion:a,expand:!0});var h=e.inputNumber||e.inputText,o=kb(i,h).setNumberInput();o.on("close",(function(){t.setValue(o.value)}));var l=Object.assign(Fo(r),s.incButton||{}),d=mm(i,l),c=Object.assign(Fo(r),s.decButton||{}),u=mm(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 Rx(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 Dx=Phaser.Utils.Objects.GetValue;var Ax=function(t,e){var i=Dx(e,"expandDirection",void 0);"string"==typeof i&&(i=Bx[i]);var s,r,n,a,h,o,l,d=(n="alignTargetX",Jy(s=e,r="alignTarget")?Ts(s,r):n&&Jy(s,n)?Ts(s,n):a&&Jy(s,a)?Ts(s,a):h),c=Dx(e,"alignTargetY",d),u=Dx(e,"alignOffsetX",0),p=Dx(e,"alignOffsetY",0),v=Dx(e,"alignSide","").includes("right"),g=Dx(e,"bounds"),f=0===i,m=!(f||1===i),y=v?1:0,b=f||m?0:1;t.setOrigin(y,b),o=v?d.getTopRight().x:d.getTopLeft().x,l=c.getBottomLeft().y,t.setPosition(o+u,l+p);var x=g;x||(x=Dt(t.scene)),m&&t.getBottomLeft().y>x.bottom&&(l=c.getTopLeft().y,t.setOrigin(0,1).setPosition(o+u,l+p))};const Bx={down:0,up:1},zx=Phaser.Utils.Objects.GetValue;class Wx extends Ys{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=function(t,e){_i(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 Pi(t,n):r.resetFromJSON(n),r.restart()}(t,e,"y","Linear")}),e.manualClose=!0,e.clickOutsideClose=!0,e.destroy=!0,super(t,e),Ax(t,e),t.isRexSizer&&t.layout();var i=zx(e,"touchOutsideClose",!1),s=zx(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&&Qs(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 Ix={openColorPicker:function(){if(!this.colorPicker){var t=Lx.call(this).layout(),e=new Wx(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(Ix,Zb);const jx=Phaser.Utils.Objects.GetValue;class Yx extends qb{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(jx(i,"width",160),jx(i,"height",170));var n=jx(i,"background");r=n?function(t){return Gc(t,n)}:jx(i,"createBackgroundCallback"),this.setCreateColorPickerBackgroundCallback(r),this.setColorPickerHPalettePosition(jx(i,"hPalettePosition",0)),this.setColorPickerExpandDirection(jx(i,"expandDirection")),this.setColorPickerEaseInDuration(jx(i,"easeIn",200)),this.setColorPickerEaseOutDuration(jx(i,"easeOut",200)),this.setColorPickerTransitInCallback(jx(i,"transitIn")),this.setColorPickerTransitOutCallback(jx(i,"transitOut")),this.setColorPickerBounds(jx(i,"bounds"));var a=jx(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(jx(h,"height",30)),this.setColorComponentsFormatLabelConfig(jx(h,"formatLabel"));var o=jx(h,"inputText");o||(o=jx(e,"inputText")),this.setColorComponentsInputTextConfig(o);var l=jx(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(Yx.prototype,Ix);var Fx={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?Fo(e):{}:e||(e={});var s=new Yx(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)}},Xx={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}},Hx={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}},Vx={buildShapes(){this.addShape((new ec).setName("box")).addShape((new Qd).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,v=1*p,g=2*p,f=3*p;l.startAt(v,g).lineTo(g,f).lineTo(f,v).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)}},Gx={setCheckerAnimationDuration(t){return void 0===t&&(t=0),this.checkerAnimDuration=t,this},playCheckerAnimation(){return void 0===this.checkerAnimProgressTask&&(this.checkerAnimProgressTask=new cs(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}},Ux={};Object.assign(Ux,Xx,Hx,Vx,Gx);const Nx=23730,$x=Phaser.Utils.Objects.GetValue,Kx=Phaser.Utils.Objects.IsPlainObject;class Jx extends bd{constructor(t,e,i,s,r,n,a){Kx(e)?(e=$x(a=e,"x",0),i=$x(a,"y",0),s=$x(a,"width",2),r=$x(a,"height",2),n=$x(a,"color",Nx)):Kx(n)&&(n=$x(a=n,"color",Nx)),super(t,e,i,s,r),this.type="rexCheckbox",void 0===n&&(n=Nx),this.setBoxShape($x(a,"circleBox",!1)),this.setBoxFillStyle(n,$x(a,"boxFillAlpha",1)),this.setUncheckedBoxFillStyle($x(a,"uncheckedColor",null),$x(a,"uncheckedBoxFillAlpha",1)),this.setBoxStrokeStyle($x(a,"boxLineWidth",4),$x(a,"boxStrokeColor",n),$x(a,"boxStrokeAlpha",1)),this.setUncheckedBoxStrokeStyle(this.boxLineWidth,$x(a,"uncheckedBoxStrokeColor",this.boxStrokeColor),$x(a,"uncheckedBoxStrokeAlpha",this.boxStrokeAlpha)),this.setCheckerStyle($x(a,"checkerColor",16777215),$x(a,"checkerAlpha",1)),this.setBoxSize($x(a,"boxSize",1)),this.setCheckerSize($x(a,"checkerSize",1)),this.setCheckerAnimationDuration($x(a,"animationDuration",150)),this.buildShapes();var h=$x(a,"checked");void 0===h&&(h=$x(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(Jx.prototype,Ux);const qx=Phaser.Utils.Objects.GetValue,Zx=Phaser.Utils.Objects.IsPlainObject;class Qx extends Jx{constructor(t,e,i,s,r,n,a){Zx(e)?(e=qx(a=e,"x",0),i=qx(a,"y",0),s=qx(a,"width",2),r=qx(a,"height",2),n=qx(a,"color",Nx)):Zx(n)&&(n=qx(a=n,"color",Nx)),super(t,e,i,s,r,n,a),this._click=new xr(this,qx(a,"click")),this._click.on("click",(function(){this.toggleValue()}),this),this.setReadOnly(qx(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 tC={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 Qx(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)}},eC={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}},iC={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}},sC={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}},rC=function(t,e,i){return(e-t)*i+t},nC=function(t){return t>>16&255},aC=function(t){return t>>8&255},hC=function(t){return 255&t};const oC=Phaser.Math.Linear;var lC={buildShapes(){this.addShape((new ec).setName("track")).addShape((new ec).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&rC(nC(l),nC(d),c))<<16|(255&rC(aC(l),aC(d),c))<<8|255&rC(hC(l),hC(d),c)),p=oC(this.falseValueTrackFillAlpha,this.trackFillAlpha,i);s.fillStyle(u,p);var v=this.getShape("thumb");if(this.isSizeChanged){var g=t*this.thumbWidth,f=e*this.thumbHeight,m=e*this.thumbRadius;v.setSize(g,f).setRadius(m)}var y=oC(this.thumbLeftX,this.thumbRightX,i)*t;this.rtl&&(y=t-y);var b=e/2;v.setCenterPosition(y,b),v.fillStyle(this.thumbColor,this.thumbAlpha)}},dC={setToggleAnimationDuration(t){return void 0===t&&(t=0),this.toggleAnimDuration=t,this},playToggleAnimation(){return void 0===this.toggleAnimProgressTask&&(this.toggleAnimProgressTask=new cs(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}},cC={};Object.assign(cC,eC,iC,sC,lC,dC);const uC=Phaser.Utils.Objects.GetValue,pC=Phaser.Utils.Objects.IsPlainObject,vC=23730;class gC extends bd{constructor(t,e,i,s,r,n,a){pC(e)?(e=uC(a=e,"x",0),i=uC(a,"y",0),s=uC(a,"width",2),r=uC(a,"height",2),n=uC(a,"color",vC)):pC(n)&&(n=uC(a=n,"color",vC)),super(t,e,i,s,r),this.type="rexToggleSwitch",void 0===n&&(n=vC),this.setTrackFillStyle(n,uC(a,"trackFillAlpha",1)),this.setFalseValueTrackFillStyle(uC(a,"falseValueTrackColor",function(t){var e=.3*nC(t)+.59*aC(t)+.11*hC(t);return(255&e)<<16|(255&e)<<8|255&e}(n)),uC(a,"falseValueTrackFillAlpha",1)),this.setThumbStyle(uC(a,"thumbColor",16777215),uC(a,"thumbAlpha",1)),this.setTrackSize(uC(a,"trackWidth",.9),uC(a,"trackHeight",.5)),this.setTrackRadius(uC(a,"trackRadius",.5*this.trackHeight));var h=uC(a,"thumbHeight",void 0),o=uC(a,"thumbWidth",h);void 0===o&&(o=.9*this.trackHeight),this.setThumbSize(o,h),this.setThumbRadius(uC(a,"thumbRadius",.5*this.thumbHeight)),this.setThumbPosition(uC(a,"thumbLeft",.3),uC(a,"thumbRight",void 0)),this.setRTL(uC(a,"rtl",!1)),this.setToggleAnimationDuration(uC(a,"animationDuration",150)),this.buildShapes(),this.setValue(uC(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(gC.prototype,cC);const fC=Phaser.Utils.Objects.GetValue;class mC extends gC{constructor(t,e,i,s,r,n,a){super(t,e,i,s,r,n,a),this._click=new xr(this,fC(a,"click")),this._click.on("click",(function(){this.toggleValue()}),this),this.setReadOnly(fC(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 yC={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 mC(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)}},bC={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=xC[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 xC={down:0,up:1},CC=Phaser.Utils.Objects.GetValue;var wC=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=SC(e,u),this.listMaxHeight>0&&(s.layout(),s.height<=this.listMaxHeight&&(d=s)),!d){0===c&&(c=this.listMaxHeight);var p=kC(e,this.listCreateSliderTrackCallback),v=kC(e,this.listCreateSliderThumbCallback);d=new Zm(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:CC(this.listSpace,"panel",0)}}),e.add.existing(d)}}else u.height=c,s=SC(e,u),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},SC=function(t,e,i){var s;return i?(e.orientation="x",s=new Lf(t,e)):(e.orientation="y",s=new Sf(t,e)),t.add.existing(s),s},kC=function(t,e,i){var s;return e&&(s=e.call(i,t),t.add.existing(s)),s},OC={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}},PC={openListPanel:function(){if(this.listPanel)return this;if(0===this.options.length)return this;var t,e=wC.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 Wx(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(PC,bC,OC);const TC=Phaser.Utils.Objects.GetValue;class _C extends Il{constructor(t,e){super(t,e),this.type="rexDropDownList",this.timer=void 0,this.listPanel=void 0,this.currentOverIndex=void 0,this.setOptions(TC(e,"options"));var i=TC(e,"list");this.setWrapEnable(TC(i,"wrap",!1)),this.setCreateButtonCallback(TC(i,"createButtonCallback")),this.setCreateListBackgroundCallback(TC(i,"createBackgroundCallback")),this.setCreateListSliderTrackCallback(TC(i,"createTrackCallback")),this.setCreateListSliderThumbCallback(TC(i,"createThumbCallback")),this.setListSliderAdaptThumbSizeEnable(TC(i,"sliderAdaptThumbSize",!1)),this.setListScrollerConfig(TC(i,"scroller")),this.setListMouseWheelScrollerConfig(TC(i,"mouseWheelScroller")),this.setButtonClickCallback(TC(i,"onButtonClick")),this.setButtonOverCallback(TC(i,"onButtonOver")),this.setButtonOutCallback(TC(i,"onButtonOut")),this.setListExpandDirection(TC(i,"expandDirection")),this.setListEaseInDuration(TC(i,"easeIn",500)),this.setListEaseOutDuration(TC(i,"easeOut",100)),this.setListTransitInCallback(TC(i,"transitIn")),this.settListTransitOutCallback(TC(i,"transitOut")),this.setListMaxHeight(TC(i,"maxHeight",0)),this.setListSize(TC(i,"width"),TC(i,"height",0)),this.setListAlignmentMode(TC(i,"alignParent","text")),this.setListAlignmentSide(TC(i,"alignSide","")),this.setListBounds(TC(i,"bounds")),this.setListSpace(TC(i,"space")),this.setListDraggable(TC(i,"draggable",!1)),this.setValueChangeCallback(TC(e,"setValueCallback"),TC(e,"setValueCallbackScope")),this.setValue(TC(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(_C.prototype,PC);var MC=function(t,e){e=function(t,e,i){void 0===i&&(i={});var s=(e=e?Fo(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=Og(t,s,n);h.list=e.list||{},h.list.createButtonCallback=function(t,e){var i=mm(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 Gc(t,o)},delete e.track);var l=e.thumb;return l&&(h.list.createThumbCallback=function(t){return Gc(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 _C(t,e);return t.add.existing(i),i},EC=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=MC(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=EC(t,e);if(null!=i)return t[i]}(i.options,e);i.resetDisplayContent(s).setMinSize(i.width,i.height).layout().setMinSize(0,0)}};const LC=Phaser.Utils.Objects.GetValue;var DC={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?Fo(e.button):{},r=LC(s,"expand",!0);r&&(s.align="center"),delete s.expand;var n=zb(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--)of.call(this,e[i],t);return this}},df=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)}},cf=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,df.call(e,t,i,s)}},enumerable:!0,configurable:!0}),t.selected=!1},uf={add(t){return this.buttons.push(t),t._click||(t._click=new xr(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`),cf.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&&kf.addNewLine(this)}else for(n=0,a=t.length;n=0;i--)Mf.call(this,e[i],t);return this}};const Rf=Phaser.Utils.Objects.GetValue;class Lf extends Ua{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 bf({parent:this,eventEmitter:Rf(e,"eventEmitter",this),groupName:Rf(e,"groupName",void 0),clickConfig:Rf(e,"click",void 0)}).setButtonsType(e);var s=Rf(e,"background",void 0),r=Rf(e,"buttons",void 0);this.buttonsAlign=Rf(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(Lf.prototype,Pf,Ef,yf,Cf);var Df=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=Af[i])}void 0===s?s={}:!0===s&&(s=Bf);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 Af={fit:0,FIT:0,envelop:1,ENVELOP:1};var Bf={},zf={},Wf={};const If=Phaser.Utils.Objects.IsPlainObject,jf=Phaser.Utils.Objects.GetValue,Yf=Phaser.Display.Align.CENTER,Ff=Phaser.Utils.String.UUID;var Xf={add:function(t,e,i,s,r,n,a,h,o,l){ge.call(this,t),If(e)&&(e=jf(d=e,"key",void 0),i=jf(d,"align",Yf),s=jf(d,"padding",0),r=jf(d,"expand",!0),t.isRexSizer||(n=jf(d,"minWidth",t._minWidth),a=jf(d,"minHeight",t._minHeighted)),h=jf(d,"offsetX",0),o=jf(d,"offsetY",0),l=jf(d,"aspectRatio",0));var d,c=void 0!==e;return c||(e=Ff()),"string"==typeof i&&(i=zt[i]),void 0===i&&(i=Yf),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===l?l=0:!0===l&&(l=Q(t)/tt(t)),l>0&&(r=!0,void 0===n&&(n=0),void 0===a&&(a=0)),(d=this.getSizerConfig(t)).align=i,d.padding=pe(s),If(r)?(d.expandWidth=jf(r,"width",!1),d.expandHeight=jf(r,"height",!1)):(d.expandWidth=r,d.expandHeight=r),t.isRexSizer||(d.expandWidth&&(t.minWidth=void 0===n?Q(t):n),d.expandHeight&&(t.minHeight=void 0===a?tt(t):a)),d.alignOffsetX=h,d.alignOffsetY=o,d.aspectRatio=l,this.sizerChildren.hasOwnProperty(e)&&this.sizerChildren[e].destroy(),this.sizerChildren[e]=t,c&&this.addChildrenMap(e,t),this}},Hf={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]),we.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 fa.call(this,t),this}},Vf={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=this.innerLeft,c=this.innerTop,u=this.innerWidth,p=this.innerHeight,v=this.sizerChildren;for(var g in v)(t=v[g]).rexSizer.hidden||(i=(e=t.rexSizer).padding,gr.call(this,t),h=this.getExpandedChildWidth(t),o=this.getExpandedChildHeight(t),e.aspectRatio>0&&(zf.width=e.aspectRatio,zf.height=1,Wf.width=h,Wf.height=o,h=(l=Df(zf,Wf,"FIT",!0)).width,o=l.height),t.isRexSizer?(t.runLayout(this,h,o),sa(t,this)):Xe(t,h,o),s=d+i.left*this.scaleX,n=u-(i.left+i.right)*this.scaleX,r=c+i.top*this.scaleY,a=p-(i.top+i.bottom)*this.scaleY,fr.call(this,t,s,r,n,a,e.align,e.alignOffsetX,e.alignOffsetY))}};Object.assign(Vf,Xf,Hf);const Gf=Phaser.Utils.Objects.IsPlainObject,Uf=Phaser.Utils.Objects.GetValue;class Nf extends ia{constructor(t,e,i,s,r,n){Gf(e)?(e=Uf(n=e,"x",0),i=Uf(n,"y",0),s=Uf(n,"width",void 0),r=Uf(n,"height",void 0)):Gf(s)&&(s=Uf(n=s,"width",void 0),r=Uf(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(Nf.prototype,Vf);const $f=Nf.prototype.add;var Kf=function(t,e,i,s,r,n,a,h,o){return t.setVisible(!1),$f.call(this,t,e,i,s,r,n,a,h,o),this},Jf={add:Kf,addPage:Kf};const qf=Mt.prototype.setChildVisible;var Zf={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?(qf.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&&(qf.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(Zf,Jf);const Qf=Phaser.Utils.Objects.GetValue;class tm extends Nf{constructor(t,e){super(t,e),this.type="rexPages",this.childrenMap=this.sizerChildren,this._previousKey=void 0,this._currentKey=void 0,this.setSwapMode(Qf(e,"swapMode",0)),this.setFadeInDuration(Qf(e,"fadeIn",0))}setSwapMode(t){return"string"==typeof t&&(t=em[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(tm.prototype,Zf);const em={invisible:0,destroy:1},im=Phaser.Utils.Objects.IsPlainObject,sm=Phaser.Utils.Objects.GetValue,rm=Phaser.Utils.String.UUID;var nm={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}},am={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}},hm={top:1,left:3,right:5,bottom:7},om={top:"bottom",left:"right",right:"left",bottom:"top"},lm={setTabsPadding(t,e){return this.childrenMap.tabs.setOuterPadding(t,e),this},getTabsPadding(t){return this.childrenMap.tabs.getOuterPadding(t)}},dm={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 _m=Phaser.Utils.Objects.GetValue;class Mm extends Ma{constructor(t,e){void 0===e&&(e={}),e.orientation="y",super(t,e),this.type="rexTweaker.Wrap";var i=_m(e,"background",void 0),s=_m(e,"title",void 0);i&&this.addBackground(i),s&&this.add(s,{expand:!0,space:{bottom:_m(e,"space.title",0)}});var r=_m(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(Mm.prototype,Pm,Tm);const Em=Phaser.Utils.Objects.GetValue,Rm=Phaser.Utils.Objects.GetValue;var Lm=function(t){return t.hasOwnProperty("geometryMask")?t.geometryMask:t.bitmapMask};const Dm=Phaser.Geom.Intersects.RectangleToRectangle,Am=Phaser.Geom.Rectangle.Overlaps;var Bm=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}},zm=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},Wm=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))},Im=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))},jm=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 Ym=Phaser.Utils.Objects.GetValue,Fm={update:0,everyTick:1};var Xm={setupChildrenMask(t){return!1===t||(this.setMaskUpdateMode(Ym(t,"updateMode",0)),this.enableChildrenMask(Ym(t,"padding",0)),this.setMaskLayer(Ym(t,"layer",void 0)),this.onMaskGameObjectVisible=Ym(t,"onVisivle"),this.onMaskGameObjectInvisible=Ym(t,"onInvisible"),this.maskGameObjectCallbackScope=Ym(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=Fm[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=nh.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=Lm(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(Nm.prototype,Hm);const $m=["top","bottom","centerY","center"],Km=["left","right","centerX","center"];var Jm=function(t,e,i){var s,r="Y"===(e=e.toUpperCase()),n=this.childrenMap.child;if(r){if(i)for(var a=0,h=$m.length;a=0?0:Math.abs(l)<=Math.abs(d)?l:d}}else{if(i)for(a=0,h=Km.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 qm=Phaser.Utils.Objects.GetValue;class Zm extends sg{constructor(t,e){void 0===e&&(e={});var i=Bp(e),s=qm(e,"panel",void 0);void 0===s&&(s={}),s.scrollMode=i,s.clampChildOY=qm(e,"clampChildOY",!1),s.clampChildOX=qm(e,"clampChildOX",!1);var r,n,a=new Nm(t,s);switch(t.add.existing(a),i){case 0:r=qm(e,"expand.panel",!0),n=!0;break;case 1:r=!0,n=qm(e,"expand.panel",!0);break;default:r=!0,n=!0}e.type="rexScrollablePanel",e.child={gameObject:a,expandWidth:r,expandHeight:n,align:qm(e,"align.panel","center")};var h=qm(e,"space",void 0);h&&(h.child=qm(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]),Qn(this.childrenMap.child,t),this}}var Qm={scrollToChild:function(t,e){if(!this.hasChild(t))return this;switch(this.scrollMode){case 0:Jm.call(this,t,"y",e);break;case 1:Jm.call(this,t,"x",e);break;default:Jm.call(this,t,"y",e),Jm.call(this,t,"x",e)}return this}};Object.assign(Zm.prototype,Qm);var ty={setBindingTarget(t){return this.childrenMap.panel.setBindingTarget(t),this}},ey={getMaxInputRowTitleWidth(){return this.childrenMap.panel.getMaxInputRowTitleWidth()+this.getInnerPadding("left")},setInputRowTitleWidth(t){return t-=this.getInnerPadding("left"),this.childrenMap.panel.setInputRowTitleWidth(t),this}};class iy extends Zm{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(iy.prototype,ty,ey);const sy=Phaser.Utils.Objects.GetValue,ry=Phaser.Utils.Objects.GetValue,ny=Phaser.Utils.Objects.GetValue;var ay={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=ny(t,"onGetValue"),this.onSetValue=ny(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}},hy={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)}}},oy={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 ly=Phaser.Utils.Objects.GetValue;class dy extends Ma{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=ly(e,"proportion.title",0),h=ly(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=ly(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(dy.prototype,ay,hy,oy);var cy=function(t,e,i){var s=new Pg(t,i);return t.add.existing(s),s},uy=function(t){return void 0===t&&(t=Ma),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}}},py=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=by(this.styles,"inputRow")||{},r=yy(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 Gc(t,Fg(e,i))}(this.scene,t,xy(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),Cy(this,Fo(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)):(Vy(this),Gy(this)),this}setNumberInput(){return this.onUpdateCallback=Hy,this}setSelectAllWhenFocusEnable(t){return void 0===t&&(t=!0),this.selectAllWhenFocus=t,this}setRequestCursorPosition(t){return this.isOpened?(this.requestCursorPosition=t,this):this}}const $y=Phaser.Utils.Objects.GetValue,Ky=["inputType","onOpen","clickOutSideTarget","onFocus","onClose","onBlur","onUpdate","enterClose","readOnly","maxLength","minLength","selectAll"];var Jy=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}sb.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(rb(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 nb=new sb,ab=/^[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,hb=/\S/,ob=new sb;ob.equals=function(t,e){return this.options.ignoreCase&&(t=t.toLowerCase(),e=e.toLowerCase()),t===e||this.options.ignoreWhitespace&&!hb.test(t)&&!hb.test(e)},ob.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(ub(t,null,null,i),i," ")},cb.equals=function(t,e){return sb.prototype.equals.call(cb,t.replace(/,([\r\n])/g,"$1"),e.replace(/,([\r\n])/g,"$1"))};const pb=new sb;pb.tokenize=function(t){return t.slice()},pb.join=pb.removeEmpty=function(t){return t};const vb=Phaser.Utils.Array.Remove;var gb=function(t,e){var i=t.text;if(e!==i){if(null==i&&(i=""),vb(t.children,t.lastInsertCursor),""===e)t.removeChildren();else for(var s=(o=i,l=e,nb.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},xb={cursorMoveLeft(){if(!this.isOpened)return this;var t=mb(this.cursorPosition-1,0,this.inputText.length);return this.setCursorPosition(t),this},cursorMoveRight(){if(!this.isOpened)return this;var t=mb(this.cursorPosition+1,0,this.inputText.length);return this.setCursorPosition(t),this},cursorMoveUp(){if(!this.isOpened)return this;var t=yb(this.characterCountOfLines,this.cursorPosition);t.lineIndex-=1;var e=mb(bb(this.characterCountOfLines,t),0,this.inputText.length);return this.setCursorPosition(e),this},cursorMoveDown(){if(!this.isOpened)return this;var t=yb(this.characterCountOfLines,this.cursorPosition);t.lineIndex+=1;var e=mb(bb(this.characterCountOfLines,t),0,this.inputText.length);return this.setCursorPosition(e),this}};const Cb=Phaser.Utils.Objects.IsPlainObject;class wb extends Ml{constructor(t,e,i,s,r,n){Cb(e)?n=e:Cb(s)&&(n=s),void 0===n&&(n={}),function(t,e){var i=!e.textArea;if(Jy(e,"wrap.vAlign")||oc(e,"wrap.vAlign",s=i?"center":"top"),Jy(e,"wrap.wrapMode")||oc(e,"wrap.wrapMode","char"),Jy(e,"wrap.maxLines")||oc(e,"wrap.maxLines",s=i?1:void 0),i&&oc(e,"wrap.wrapWidth",1/0),Jy(e,"wrap.useDefaultTextHeight")||oc(e,"wrap.useDefaultTextHeight",!0),e.edit||(e.edit={}),!Jy(e.edit,"inputType")){var s=i?"text":"textarea";oc(e.edit,"inputType",s)}if(!0===e.clickOutSideTarget){var r=new Zy(t);t.add.existing(r),e.clickOutSideTarget=r}}(t,n);var a=n.text;a&&delete n.text;var h=nd(n.background,"focus"),o=nd(n.style,"cursor");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=$y(e,"edit");return void 0===i&&(i={}),Ty(e,i,Ky),new Ny(t,i)}(this,n),Qy.call(this),n.focusStyle&&Object.assign(h,n.focusStyle),ib.call(this,h),n.cursorStyle&&Object.assign(o,n.cursorStyle),eb.call(this,o);var l=n.onAddChar;l&&this.on("addchar",l);var d=n.onCursorOut;d&&this.on("cursorout",d);var c=n.onCursorIn;c&&this.on("cursorin",c);var u,p=n.onMoveCursor;p&&this.on("movecursor",p),this.setParseTextCallback(n.parseTextCallback),this.lastInsertCursor=((u=this.createCharChild("|")).text="",u),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=kb(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))}},Pb={setText(t){return this.childrenMap.child.setText(t),this},appendText(t){return this.setText(this.text+t),this}},Tb={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 _b=Phaser.Utils.Objects.GetValue;class Mb extends sg{constructor(t,e){void 0===e&&(e={});var i,s=_b(e,"text");bt(s)?i=s:(void 0===s&&(s={}),s.textArea=!0,i=new wb(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=_b(e,"space",void 0);o&&(o.child=_b(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=_b(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(Mb.prototype,Pb,Tb);var Eb={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?Fo(e):{}:e||(e={});var s=new Mb(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()}},Rb={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=kb(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 Lb=Phaser.Utils.Objects.GetValue,Db=Phaser.Math.Linear,Ab=Phaser.Math.Snap.Floor;var Bb={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=Lb(s,r),a=function(t,e){var i=new Tv(t,e);return t.add.existing(i),i}(i,s),h=e.defaultExpandWidth?2:0,o=Lb(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=kb(i,d).setNumberInput();h=e.defaultExpandWidth?1:0,o=Lb(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=Db(t.minValue,t.maxValue,a.value);t.step&&(e=Ab(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))}},zb=function(t,e){var i=new Sf(t,e);return t.add.existing(i),i};const Wb=Phaser.Utils.Objects.GetValue;var Ib={name:"RangeInput",accept:t=>!!t.hasOwnProperty("view")&&"incdec"===t.view,build(t,e){var i=t.scene;t.type="rexTweaker.IncDecInput";var s=Wb(e,"incDec")||{},r={text:null,action:null},n=zb(i,{expand:!1}),a=e.defaultExpandWidth?1:0;t.add(n,{proportion:a,expand:!0});var h=e.inputNumber||e.inputText,o=kb(i,h).setNumberInput();o.on("close",(function(){t.setValue(o.value)}));var l=Object.assign(Fo(r),s.incButton||{}),d=mm(i,l),c=Object.assign(Fo(r),s.decButton||{}),u=mm(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 Rx(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 Dx=Phaser.Utils.Objects.GetValue;var Ax=function(t,e){var i=Dx(e,"expandDirection",void 0);"string"==typeof i&&(i=Bx[i]);var s,r,n,a,h,o,l,d=(n="alignTargetX",Jy(s=e,r="alignTarget")?Ts(s,r):n&&Jy(s,n)?Ts(s,n):a&&Jy(s,a)?Ts(s,a):h),c=Dx(e,"alignTargetY",d),u=Dx(e,"alignOffsetX",0),p=Dx(e,"alignOffsetY",0),v=Dx(e,"alignSide","").includes("right"),g=Dx(e,"bounds"),f=0===i,m=!(f||1===i),y=v?1:0,b=f||m?0:1;t.setOrigin(y,b),o=v?d.getTopRight().x:d.getTopLeft().x,l=c.getBottomLeft().y,t.setPosition(o+u,l+p);var x=g;x||(x=Dt(t.scene)),m&&t.getBottomLeft().y>x.bottom&&(l=c.getTopLeft().y,t.setOrigin(0,1).setPosition(o+u,l+p))};const Bx={down:0,up:1},zx=Phaser.Utils.Objects.GetValue;class Wx extends Ys{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=function(t,e){_i(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 Pi(t,n):r.resetFromJSON(n),r.restart()}(t,e,"y","Linear")}),e.manualClose=!0,e.clickOutsideClose=!0,e.destroy=!0,super(t,e),Ax(t,e),t.isRexSizer&&t.layout();var i=zx(e,"touchOutsideClose",!1),s=zx(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&&Qs(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 Ix={openColorPicker:function(){if(!this.colorPicker){var t=Lx.call(this).layout(),e=new Wx(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(Ix,Zb);const jx=Phaser.Utils.Objects.GetValue;class Yx extends qb{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(jx(i,"width",160),jx(i,"height",170));var n=jx(i,"background");r=n?function(t){return Gc(t,n)}:jx(i,"createBackgroundCallback"),this.setCreateColorPickerBackgroundCallback(r),this.setColorPickerHPalettePosition(jx(i,"hPalettePosition",0)),this.setColorPickerExpandDirection(jx(i,"expandDirection")),this.setColorPickerEaseInDuration(jx(i,"easeIn",200)),this.setColorPickerEaseOutDuration(jx(i,"easeOut",200)),this.setColorPickerTransitInCallback(jx(i,"transitIn")),this.setColorPickerTransitOutCallback(jx(i,"transitOut")),this.setColorPickerBounds(jx(i,"bounds"));var a=jx(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(jx(h,"height",30)),this.setColorComponentsFormatLabelConfig(jx(h,"formatLabel"));var o=jx(h,"inputText");o||(o=jx(e,"inputText")),this.setColorComponentsInputTextConfig(o);var l=jx(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(Yx.prototype,Ix);var Fx={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?Fo(e):{}:e||(e={});var s=new Yx(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)}},Xx={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}},Hx={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}},Vx={buildShapes(){this.addShape((new ec).setName("box")).addShape((new Qd).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,v=1*p,g=2*p,f=3*p;l.startAt(v,g).lineTo(g,f).lineTo(f,v).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)}},Gx={setCheckerAnimationDuration(t){return void 0===t&&(t=0),this.checkerAnimDuration=t,this},playCheckerAnimation(){return void 0===this.checkerAnimProgressTask&&(this.checkerAnimProgressTask=new cs(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}},Ux={};Object.assign(Ux,Xx,Hx,Vx,Gx);const Nx=23730,$x=Phaser.Utils.Objects.GetValue,Kx=Phaser.Utils.Objects.IsPlainObject;class Jx extends bd{constructor(t,e,i,s,r,n,a){Kx(e)?(e=$x(a=e,"x",0),i=$x(a,"y",0),s=$x(a,"width",2),r=$x(a,"height",2),n=$x(a,"color",Nx)):Kx(n)&&(n=$x(a=n,"color",Nx)),super(t,e,i,s,r),this.type="rexCheckbox",void 0===n&&(n=Nx),this.setBoxShape($x(a,"circleBox",!1)),this.setBoxFillStyle(n,$x(a,"boxFillAlpha",1)),this.setUncheckedBoxFillStyle($x(a,"uncheckedColor",null),$x(a,"uncheckedBoxFillAlpha",1)),this.setBoxStrokeStyle($x(a,"boxLineWidth",4),$x(a,"boxStrokeColor",n),$x(a,"boxStrokeAlpha",1)),this.setUncheckedBoxStrokeStyle(this.boxLineWidth,$x(a,"uncheckedBoxStrokeColor",this.boxStrokeColor),$x(a,"uncheckedBoxStrokeAlpha",this.boxStrokeAlpha)),this.setCheckerStyle($x(a,"checkerColor",16777215),$x(a,"checkerAlpha",1)),this.setBoxSize($x(a,"boxSize",1)),this.setCheckerSize($x(a,"checkerSize",1)),this.setCheckerAnimationDuration($x(a,"animationDuration",150)),this.buildShapes();var h=$x(a,"checked");void 0===h&&(h=$x(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(Jx.prototype,Ux);const qx=Phaser.Utils.Objects.GetValue,Zx=Phaser.Utils.Objects.IsPlainObject;class Qx extends Jx{constructor(t,e,i,s,r,n,a){Zx(e)?(e=qx(a=e,"x",0),i=qx(a,"y",0),s=qx(a,"width",2),r=qx(a,"height",2),n=qx(a,"color",Nx)):Zx(n)&&(n=qx(a=n,"color",Nx)),super(t,e,i,s,r,n,a),this._click=new xr(this,qx(a,"click")),this._click.on("click",(function(){this.toggleValue()}),this),this.setReadOnly(qx(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 tC={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 Qx(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)}},eC={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}},iC={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}},sC={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}},rC=function(t,e,i){return(e-t)*i+t},nC=function(t){return t>>16&255},aC=function(t){return t>>8&255},hC=function(t){return 255&t};const oC=Phaser.Math.Linear;var lC={buildShapes(){this.addShape((new ec).setName("track")).addShape((new ec).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&rC(nC(l),nC(d),c))<<16|(255&rC(aC(l),aC(d),c))<<8|255&rC(hC(l),hC(d),c)),p=oC(this.falseValueTrackFillAlpha,this.trackFillAlpha,i);s.fillStyle(u,p);var v=this.getShape("thumb");if(this.isSizeChanged){var g=t*this.thumbWidth,f=e*this.thumbHeight,m=e*this.thumbRadius;v.setSize(g,f).setRadius(m)}var y=oC(this.thumbLeftX,this.thumbRightX,i)*t;this.rtl&&(y=t-y);var b=e/2;v.setCenterPosition(y,b),v.fillStyle(this.thumbColor,this.thumbAlpha)}},dC={setToggleAnimationDuration(t){return void 0===t&&(t=0),this.toggleAnimDuration=t,this},playToggleAnimation(){return void 0===this.toggleAnimProgressTask&&(this.toggleAnimProgressTask=new cs(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}},cC={};Object.assign(cC,eC,iC,sC,lC,dC);const uC=Phaser.Utils.Objects.GetValue,pC=Phaser.Utils.Objects.IsPlainObject,vC=23730;class gC extends bd{constructor(t,e,i,s,r,n,a){pC(e)?(e=uC(a=e,"x",0),i=uC(a,"y",0),s=uC(a,"width",2),r=uC(a,"height",2),n=uC(a,"color",vC)):pC(n)&&(n=uC(a=n,"color",vC)),super(t,e,i,s,r),this.type="rexToggleSwitch",void 0===n&&(n=vC),this.setTrackFillStyle(n,uC(a,"trackFillAlpha",1)),this.setFalseValueTrackFillStyle(uC(a,"falseValueTrackColor",function(t){var e=.3*nC(t)+.59*aC(t)+.11*hC(t);return(255&e)<<16|(255&e)<<8|255&e}(n)),uC(a,"falseValueTrackFillAlpha",1)),this.setThumbStyle(uC(a,"thumbColor",16777215),uC(a,"thumbAlpha",1)),this.setTrackSize(uC(a,"trackWidth",.9),uC(a,"trackHeight",.5)),this.setTrackRadius(uC(a,"trackRadius",.5*this.trackHeight));var h=uC(a,"thumbHeight",void 0),o=uC(a,"thumbWidth",h);void 0===o&&(o=.9*this.trackHeight),this.setThumbSize(o,h),this.setThumbRadius(uC(a,"thumbRadius",.5*this.thumbHeight)),this.setThumbPosition(uC(a,"thumbLeft",.3),uC(a,"thumbRight",void 0)),this.setRTL(uC(a,"rtl",!1)),this.setToggleAnimationDuration(uC(a,"animationDuration",150)),this.buildShapes(),this.setValue(uC(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(gC.prototype,cC);const fC=Phaser.Utils.Objects.GetValue;class mC extends gC{constructor(t,e,i,s,r,n,a){super(t,e,i,s,r,n,a),this._click=new xr(this,fC(a,"click")),this._click.on("click",(function(){this.toggleValue()}),this),this.setReadOnly(fC(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 yC={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 mC(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)}},bC={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=xC[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 xC={down:0,up:1},CC=Phaser.Utils.Objects.GetValue;var wC=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=SC(e,u),this.listMaxHeight>0&&(s.layout(),s.height<=this.listMaxHeight&&(d=s)),!d){0===c&&(c=this.listMaxHeight);var p=kC(e,this.listCreateSliderTrackCallback),v=kC(e,this.listCreateSliderThumbCallback);d=new Zm(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:CC(this.listSpace,"panel",0)}}),e.add.existing(d)}}else u.height=c,s=SC(e,u),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},SC=function(t,e,i){var s;return i?(e.orientation="x",s=new Lf(t,e)):(e.orientation="y",s=new Sf(t,e)),t.add.existing(s),s},kC=function(t,e,i){var s;return e&&(s=e.call(i,t),t.add.existing(s)),s},OC={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}},PC={openListPanel:function(){if(this.listPanel)return this;if(0===this.options.length)return this;var t,e=wC.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 Wx(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(PC,bC,OC);const TC=Phaser.Utils.Objects.GetValue;class _C extends Il{constructor(t,e){super(t,e),this.type="rexDropDownList",this.timer=void 0,this.listPanel=void 0,this.currentOverIndex=void 0,this.setOptions(TC(e,"options"));var i=TC(e,"list");this.setWrapEnable(TC(i,"wrap",!1)),this.setCreateButtonCallback(TC(i,"createButtonCallback")),this.setCreateListBackgroundCallback(TC(i,"createBackgroundCallback")),this.setCreateListSliderTrackCallback(TC(i,"createTrackCallback")),this.setCreateListSliderThumbCallback(TC(i,"createThumbCallback")),this.setListSliderAdaptThumbSizeEnable(TC(i,"sliderAdaptThumbSize",!1)),this.setListScrollerConfig(TC(i,"scroller")),this.setListMouseWheelScrollerConfig(TC(i,"mouseWheelScroller")),this.setButtonClickCallback(TC(i,"onButtonClick")),this.setButtonOverCallback(TC(i,"onButtonOver")),this.setButtonOutCallback(TC(i,"onButtonOut")),this.setListExpandDirection(TC(i,"expandDirection")),this.setListEaseInDuration(TC(i,"easeIn",500)),this.setListEaseOutDuration(TC(i,"easeOut",100)),this.setListTransitInCallback(TC(i,"transitIn")),this.settListTransitOutCallback(TC(i,"transitOut")),this.setListMaxHeight(TC(i,"maxHeight",0)),this.setListSize(TC(i,"width"),TC(i,"height",0)),this.setListAlignmentMode(TC(i,"alignParent","text")),this.setListAlignmentSide(TC(i,"alignSide","")),this.setListBounds(TC(i,"bounds")),this.setListSpace(TC(i,"space")),this.setListDraggable(TC(i,"draggable",!1)),this.setValueChangeCallback(TC(e,"setValueCallback"),TC(e,"setValueCallbackScope")),this.setValue(TC(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(_C.prototype,PC);var MC=function(t,e){e=function(t,e,i){void 0===i&&(i={});var s=(e=e?Fo(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=Og(t,s,n);h.list=e.list||{},h.list.createButtonCallback=function(t,e){var i=mm(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 Gc(t,o)},delete e.track);var l=e.thumb;return l&&(h.list.createThumbCallback=function(t){return Gc(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 _C(t,e);return t.add.existing(i),i},EC=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=MC(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=EC(t,e);if(null!=i)return t[i]}(i.options,e);i.resetDisplayContent(s).setMinSize(i.width,i.height).layout().setMinSize(0,0)}};const LC=Phaser.Utils.Objects.GetValue;var DC={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?Fo(e.button):{},r=LC(s,"expand",!0);r&&(s.align="center"),delete s.expand;var n=zb(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) && (radius.y > 0)); + }; + var LineTo = function (x, y, pathData) { var cnt = pathData.length; if (cnt >= 2) { @@ -2523,8 +2527,7 @@ geom.setTo(0, 0, width, height, radius); } - var iteration = GetValue$3P(radiusConfig, 'iteration', undefined); - this.setIteration(iteration); + this.setIteration(GetValue$3P(radiusConfig, 'iteration', undefined)); this.setPosition(x, y); this.setFillStyle(fillColor, fillAlpha); @@ -2777,10 +2780,6 @@ }; - var IsArcCorner$1 = function (radius) { - return ((radius.x > 0) && (radius.y > 0)); - }; - const ShapeTypeMap = { rectangle: 0, circle: 1 @@ -29967,6 +29966,7 @@ var skewX = this.skewX; var width = this.width - Math.abs(skewX); var height = this.height; + var trackFill = this.getShape('trackFill'); trackFill.fillStyle(this.trackColor); if (trackFill.isFilled) { @@ -29975,8 +29975,7 @@ 0, 0, // x0, y0 width, height, // x1, y1 skewX // skewX - ) - .close(); + ); } var bar = this.getShape('bar'); @@ -29996,8 +29995,7 @@ barX0, 0, // x0, y0 barX1, height, // x1, y1 skewX // skew - ) - .close(); + ); } var trackStroke = this.getShape('trackStroke'); @@ -30008,8 +30006,7 @@ 0, 0, // x0, y0 width, height, // x1, y1 skewX // skewX - ) - .end(); + ); } }; @@ -30029,6 +30026,8 @@ .lineTo(x0, y0).lineTo(startX, y0); } + lines.close(); + return lines; }; @@ -30039,24 +30038,33 @@ constructor(scene, x, y, width, height, barColor, value, config) { if (IsPlainObject$F(x)) { config = x; - x = GetValue$2W(config, 'x', 0); - y = GetValue$2W(config, 'y', 0); - width = GetValue$2W(config, 'width', 2); - height = GetValue$2W(config, 'height', 2); - barColor = GetValue$2W(config, 'barColor', undefined); - value = GetValue$2W(config, 'value', 0); + + x = config.x; + y = config.y; + width = config.width; + height = config.height; + barColor = config.barColor; + value = config.value; } else if (IsPlainObject$F(width)) { config = width; - width = GetValue$2W(config, 'width', 2); - height = GetValue$2W(config, 'height', 2); - barColor = GetValue$2W(config, 'barColor', undefined); - value = GetValue$2W(config, 'value', 0); + + width = config.width; + height = config.height; + barColor = config.barColor; + value = config.value; } else if (IsPlainObject$F(barColor)) { config = barColor; - barColor = GetValue$2W(config, 'barColor', undefined); - value = GetValue$2W(config, 'value', 0); + + barColor = config.barColor; + value = config.value; } + if (x === undefined) { x = 0; } + if (y === undefined) { y = 0; } + if (width === undefined) { width = 2; } + if (height === undefined) { height = width; } + if (value === undefined) { value = 0; } + super(scene, x, y, width, height, config); this.type = 'rexLineProgress'; diff --git a/dist/rexuiplugin.min.js b/dist/rexuiplugin.min.js index 8d2c3ef701..09aaacf639 100644 --- a/dist/rexuiplugin.min.js +++ b/dist/rexuiplugin.min.js @@ -1,11 +1,11 @@ -var t,e;t=void 0,e=function(){class t{constructor(t){this.scene=t,t.events.once("destroy",this.destroy,this)}destroy(){this.scene=null}static register(e,i){t.prototype[e]=i}}var e=function(t,e,i){return"__BASE"===i?`${t},${e}`:`${i}:${t},${e}`};function i(t){if(null===t||"object"!=typeof t)return t;if(Array.isArray(t))return t.map((t=>i(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 s in t)t.hasOwnProperty(s)&&(e[s]=i(t[s]));return e}const s=Phaser.Utils.Objects.IsPlainObject,r=Phaser.Utils.Objects.GetValue;var n=function(t){return"string"==typeof t&&(t=a[t]),t};const a={scale:0,repeat:1};var o=function(t,e){return 0===t||t===this.columns.count-1||0===e||e===this.rows.count-1},h=function(){},l={_beginDraw:h,_drawImage:h,_drawTileSprite:h,_endDraw:h,setGetFrameNameCallback:function(t){return void 0===t&&(t=e),this.getFrameNameCallback=t,this},setBaseTexture:function(t,e,s,r){Array.isArray(e)&&(r=s,s=e,e=void 0),null==e&&(e="__BASE"),"number"==typeof s&&arguments.length>=6?(s=[arguments[2],void 0,arguments[3]],r=[arguments[4],void 0,arguments[5]]):void 0===s&&void 0===r&&void 0!==this.columns.data&&void 0!==this.rows.data?(s=this.columns.data,r=this.rows.data):(s=i(s),r=i(r)),this.textureKey=t,this.baseFrameName=e,this.columns.data=s,this.columns.count=s?s.length:0,this.columns.stretch=0,this.columns.minWidth=0,this.columns.scale=1,this.rows.data=r,this.rows.count=r?r.length:0,this.rows.stretch=0,this.rows.minHeight=0,this.rows.scale=1;var n=this.scene.sys.textures.get(t);if(!n)return this.clear(),this;if(!s||!r)return this.clear(),this;for(var a=n.get(e),o=a.width,h=0,l=0,d=s.length;l0?o/h:0,u=a.height,p=0;for(l=0,d=r.length;l0?0:f,x=0,l=0;for(var S=s.length;l0?0:m),m>=1&&f>=1){var P=typeof(y=this.getFrameNameCallback(l,k,e));"string"!==P&&"number"!==P||n.add(y,0,x+a.cutX,C+a.cutY,m,f)}x+=m}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,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 s(t)?(this.stretchMode.edge=n(r(t,"edge",0)),this.stretchMode.internal=n(r(t,"internal",0))):(t=n(t),this.stretchMode.edge=t,this.stretchMode.internal=t),this},getStretchMode:function(t,e){return o.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 d=Phaser.Utils.Objects.IsPlainObject,c=Phaser.Utils.Objects.GetValue;var u=function(t,e){class i extends t{constructor(t,i,s,r,n,a,o,h,l,u){if(d(i)?(i=c(u=i,"x",0),s=c(u,"y",0),r=c(u,"width",1),n=c(u,"height",1),a=c(u,"key",void 0),o=c(u,"baseFrame",void 0),h=c(u,"columns",void 0),l=c(u,"rows",void 0)):d(r)?(r=c(u=r,"width",1),n=c(u,"height",1),a=c(u,"key",void 0),o=c(u,"baseFrame",void 0),h=c(u,"columns",void 0),l=c(u,"rows",void 0)):d(a)?(a=c(u=a,"key",void 0),o=c(u,"baseFrame",void 0),h=c(u,"columns",void 0),l=c(u,"rows",void 0)):d(o)?(o=c(u=o,"baseFrame",void 0),h=c(u,"columns",void 0),l=c(u,"rows",void 0)):Array.isArray(o)?(u=l,l=h,h=o,o=c(u,"baseFrame",void 0)):d(h)&&(h=c(u=h,"columns",void 0),l=c(u,"rows",void 0)),void 0===o&&(o=c(u,"frame",void 0)),void 0===h){var p=c(u,"leftWidth",void 0),g=c(u,"rightWidth",void 0);void 0!==p&&void 0!==g&&(h=[p,void 0,g])}if(void 0===l){var v=c(u,"topHeight",void 0),f=c(u,"bottomHeight",void 0);void 0!==v&&void 0!==f&&(l=[v,void 0,f])}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(c(u,"getFrameNameCallback",void 0)),this.setStretchMode(c(u,"stretchMode",0)),this.setPreserveRatio(c(u,"preserveRatio",!0));var m=c(u,"maxFixedPartScale",1),y=c(u,"maxFixedPartScaleX",m),b=c(u,"maxFixedPartScaleY",void 0);this.setMaxFixedPartScale(y,b),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,l),i};const p=Phaser.Game;var g=function(t){return t instanceof p};const v=Phaser.Scene;var f=function(t){return t instanceof v},m=function(t){return null==t||"object"!=typeof t?null:g(t)?t:g(t.game)?t.game:f(t)?t.sys.game:f(t.scene)?t.scene.sys.game:void 0};const y=Phaser.GameObjects;var b=void 0,x=function(t,e){if(b||(b={},m(t).events.once("destroy",(function(){for(var t in b)b[t].destroy();b=void 0}))),!b.hasOwnProperty(e)){var i=m(t).scene.systemScene;(t=new y[e](i)).setOrigin(0),b[e]=t}return b[e]};const C=Phaser.GameObjects.RenderTexture;let k=class extends(u(C,"rexNinePatch")){};var w={_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(k.prototype,w);var S=function(t){return null==t||""===t||0===t.length},P=function(t,e,i,s){if(void 0===s&&(s="."),"object"==typeof t){if(S(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(S(e));else{var r;"string"==typeof e&&(e=e.split("."));for(var n=0,a=e.length;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 D=Phaser.Utils.Objects.GetValue;var j={};let A=class{constructor(t){this.pools=D(t,"pools",j)}destroy(){this.pools=void 0}free(t){if(!this.pools)return this;var e=t.type;return this.pools.hasOwnProperty(e)||(this.pools[e]=new I),this.pools[e].push(t),t.onFree(),this}freeMultiple(t){if(!this.pools)return this;for(var e=0,i=t.length;e0},N=function(t,e){return t._depth-e._depth};const $=Phaser.GameObjects.Components;Phaser.Class.mixin(H,[$.Alpha,$.BlendMode,$.ComputedSize,$.Depth,$.GetBounds,$.Mask,$.Origin,$.Pipeline,$.PostPipeline,$.ScrollFactor,$.Transform,$.Visible,M,B]);const K="image";var J=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,n=i,a=0;a0&&!ot(t)&&(t=this.parent.texture.get(t)),this.frame=t,this._width=t?t.width:0,this._height=t?t.height:0,this}setFlipX(t){return void 0===t&&(t=!0),this.flipX=t,this}setFlipY(t){return void 0===t&&(t=!0),this.flipY=t,this}resetFlip(){return this.flipX=!1,this.flipY=!1,this}get tint(){return void 0===this._tint?this.parent.tint:this._tint}set tint(t){this._tint=t}setTint(t){return this.tint=t,this.tintFill=!1,this}setTintFill(t){return this.tint=t,this.tintFill=!0,this}clearTint(){return this.setTint(16777215),this}resetTint(){return this.tint=void 0,this.tintFill=void 0,this}get tintFill(){return void 0===this._tintFill?this.parent.tintFill:this._tintFill}set tintFill(t){this._tintFill=t}reset(){return super.reset(),this.resetFlip().resetTint().setFrame(),this}modifyPorperties(t){return t?(t.hasOwnProperty("width")&&(t.displayWidth=t.width,delete t.width),t.hasOwnProperty("height")&&(t.displayHeight=t.height,delete t.height),t.hasOwnProperty("frame")&&this.setFrame(t.frame),super.modifyPorperties(t),t.hasOwnProperty("flipX")&&this.setFlipX(t.flipX),t.hasOwnProperty("flipY")&&this.setFlipY(t.flipY),t.hasOwnProperty("tint")&&this.setTint(t.tint),t.hasOwnProperty("tintFill")&&this.setTintFill(t.tintFill),this):this}};var lt={webglRender:function(t,e,i,s,r,n,a,o){var h=this._width,l=this._height,d=h*this.originX,c=l*this.originY,u=this.x-s,p=this.y-r,g=1,v=1;this.flipX&&(u+=h-2*d,g=-1),this.flipY&&(p+=l-2*c,v=-1),at.applyITRS(u,p,this.rotation,this.scaleX*g,this.scaleY*v),e.multiply(at,at);var f=-d,m=-c,y=f+h,b=m+l,x=at.setQuad(f,m,y,b,o),C=this.frame.u0,k=this.frame.v0,w=this.frame.u1,S=this.frame.v1,P=nt(this.tint,this.alpha*i);t.batchQuad(this.parent,x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],C,k,w,S,P,P,P,P,this.tintFill,n,a)},canvasRender:function(t,e,i,s){t.save();var r=this._width,n=this._height,a=r*this.originX,o=n*this.originY,h=this.x-a,l=this.y-o,d=1,c=1;this.flipX&&(h+=r,d=-1),this.flipY&&(l+=n,c=-1),s&&(h=Math.round(h),l=Math.round(l)),t.translate(h,l),t.rotate(this.rotation),t.scale(this.scaleX*d,this.scaleY*c);var u=this.frame;t.drawImage(u.source.image,u.cutX,u.cutY,r,n,0,0,r,n),t.restore()}};Object.assign(ht.prototype,lt);var dt=function(t,e){"string"==typeof e&&(e={frame:e});var i=t.poolManager?t.poolManager.allocate(K):null;return null===i?i=new ht(t):i.setParent(t).setActive(),i.modifyPorperties(e),t.addChild(i),i},ct={_drawImage:function(t,e,i,s,r,n){dt(this,{frame:e,x:i,y:s,width:r,height:n})},_drawTileSprite:function(t,e,i,s,r,n){var a=this.texture.get(e),o=a.width,h=a.height,l=Math.floor(r/o),d=Math.floor(n/h);i+=(r-l*o)/2,s+=(n-d*h)/2;for(var c=0;c>>16,o=(65280&r)>>>8,h=255&r;t.fillStyle="rgba("+a+","+o+","+h+","+n+")"},bt=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 xt=Phaser.Renderer.Canvas.SetTransform;var Ct={renderWebGL:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.pipelines.set(e.pipeline),n=mt(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&>(r,a,e,l,o,h),e.isStroked&&ft(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(xt(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(wt.prototype,Ct);const St=Phaser.Utils.Objects.GetValue;let Pt=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=St(t,"x",0),i=St(t,"y",0));var s=this.cornerRadius;s.tl=Tt(St(t,"tl",void 0),e,i),s.tr=Tt(St(t,"tr",void 0),e,i),s.bl=Tt(St(t,"bl",void 0),e,i),s.br=Tt(St(t,"br",void 0),e,i)}get radiusTL(){var t=this.cornerRadius.tl;return Math.max(t.x,t.y)}set radiusTL(t){Ot(this.cornerRadius.tl,t)}get radiusTR(){var t=this.cornerRadius.tr;return Math.max(t.x,t.y)}set radiusTR(t){Ot(this.cornerRadius.tr,t)}get radiusBL(){var t=this.cornerRadius.bl;return Math.max(t.x,t.y)}set radiusBL(t){Ot(this.cornerRadius.bl,t)}get radiusBR(){var t=this.cornerRadius.br;return Math.max(t.x,t.y)}set radiusBR(t){Ot(this.cornerRadius.br,t)}};var Tt=function(t,e,i){return void 0===t?t={x:e,y:i}:"number"==typeof t&&(t={x:t,y:t}),Mt(t),t},Ot=function(t,e){"number"==typeof e?(t.x=e,t.y=e):(t.x=St(e,"x",0),t.y=St(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)},Et=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 _t=Phaser.Math.DegToRad;var Rt=function(t,e,i,s,r,n,a,o,h){a&&n>r?n-=360:!a&&n0&&t.y>0};const At={rectangle:0,circle:1};t.register("roundRectangle",(function(t,e,i,s,r,n,a){var o=new Dt(this.scene,t,e,i,s,r,n,a);return this.scene.add.existing(o),o})),P(window,"RexPlugins.UI.RoundRectangle",Dt);const zt=Phaser.Renderer.WebGL.Utils;var Ft={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=zt.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 Yt=Phaser.Display.Color;var Xt={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 Yt);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}},Wt=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)},Vt={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,Wt(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}};F();const Gt=Phaser.Display.Canvas.CanvasPool,Ht=Phaser.GameObjects.GameObject,Ut=Phaser.Utils.String.UUID;let Nt=class extends Ht{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=Gt.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=Ut(),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(){Gt.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 $t=Phaser.GameObjects.Components;Phaser.Class.mixin(Nt,[$t.Alpha,$t.BlendMode,$t.Crop,$t.Depth,$t.Flip,$t.GetBounds,$t.Mask,$t.Origin,$t.Pipeline,$t.PostPipeline,$t.ScrollFactor,$t.Tint,$t.Transform,$t.Visible,Ft,Xt,Vt]);const Kt=Phaser.Utils.String.Pad;var Jt=function(t,e,i){if(null==t)return t;switch(typeof t){case"string":default:return t;case"number":return`#${Kt(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}};const qt=Phaser.Math.DegToRad;var Zt=function(t,e,i,s,r,n,a){var o,h,l,d,c,u=new Pt(e,i,s,r,n),p=u.minWidth,g=u.minHeight,v=s>=p?1:s/p,f=r>=g?1:r/g,m=u.cornerRadius;t.save(),t.beginPath(),t.translate(e,i),o=m.tl,te(o)?(h=o.x*v,l=o.y*f,Qt(o)?ee(t,h,l,h,l,180,270,!1,a):ee(t,0,0,h,l,90,0,!0,a),d=0,c=l):(t.lineTo(0,0),d=0,c=0),o=m.tr,te(o)?(h=o.x*v,l=o.y*f,Qt(o)?ee(t,s-h,l,h,l,270,360,!1,a):ee(t,s,0,h,l,180,90,!0,a)):t.lineTo(s,0),o=m.br,te(o)?(h=o.x*v,l=o.y*f,Qt(o)?ee(t,s-h,r-l,h,l,0,90,!1,a):ee(t,s,r,h,l,270,180,!0,a)):t.lineTo(s,r),o=m.bl,te(o)?(h=o.x*v,l=o.y*f,Qt(o)?ee(t,h,r-l,h,l,90,180,!1,a):ee(t,0,r,h,l,360,270,!0,a)):t.lineTo(0,r),t.lineTo(d,c),t.closePath(),t.restore()},Qt=function(t){return!t.hasOwnProperty("convex")||t.convex},te=function(t){return t.x>0&&t.y>0},ee=function(t,e,i,s,r,n,a,o,h){if(o&&a>n?a-=360:!o&&a0&&(e.strokeStyle=h,e.lineWidth=l,e.stroke())}(t.canvas,t.context,d,d,h,l,r,e,i,s,n,a,o)}},se=function(){ie(this,this.fillStyle,this.strokeStyle,this.lineWidth,this.radius,this.fillColor2,this.isHorizontalGradient,this.iteration)};const re=Phaser.Utils.Objects.GetValue;let ne=class extends Nt{constructor(t,e,i,s,r,n,a,o,h,l,d,c){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=1),super(t,e,i,s,r,c),this.type="rexRoundRectangleCanvas";var u=re(n,"radius",n),p=re(n,"iteration",void 0);this.setRadius(u),this.setIteration(p),this.setFillStyle(a,l,d),this.setStrokeStyle(o,h)}get radius(){return this._radius}set radius(t){this.dirty|=this._radius!=t,this._radius=t}setRadius(t){return this.radius=t,this}get iteration(){return this._iteration}set iteration(t){this.dirty|=this._iteration!=t,this._iteration=t}setIteration(t){return this.iteration=t,this}get fillStyle(){return this._fillStyle}set fillStyle(t){t=Jt(t,this.canvas,this.context),this.dirty|=this._fillStyle!=t,this._fillStyle=t}get fillColor2(){return this._fillColor2}set fillColor2(t){t=Jt(t,this.canvas,this.context),this.dirty|=this._fillColor2!=t,this._fillColor2=t}get isHorizontalGradient(){return this._isHorizontalGradient}set isHorizontalGradient(t){this.dirty|=this._isHorizontalGradient!=t,this._isHorizontalGradient=t}setFillStyle(t,e,i){return void 0===i&&(i=!0),this.fillStyle=t,this.fillColor2=e,this.isHorizontalGradient=i,this}get strokeStyle(){return this._strokeStyle}set strokeStyle(t){t=Jt(t,this.canvas,this.context),this.dirty|=this._strokeStyle!=t,this._strokeStyle=t}get lineWidth(){return this._lineWidth}set lineWidth(t){this.dirty|=this._lineWidth!=t,this._lineWidth=t}setStrokeStyle(t,e){return this.strokeStyle=t,this.lineWidth=e,this}updateTexture(){return super.updateTexture((function(){this.clear(),se.call(this)}),this),this}};t.register("roundRectangleCanvas",(function(t,e,i,s,r,n,a,o,h,l){var d=new ne(this.scene,t,e,i,s,r,n,a,o,h,l);return this.scene.add.existing(d),d})),P(window,"RexPlugins.UI.RoundRectangleCanvas",ne);var ae=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},oe=function(t,e,i){e&&!ae(t,`${e}X`)&&(Object.defineProperty(t,`${e}X`,{get:function(){return i.x},set:function(e){i.x=e,t.dirty=!0}}),Object.defineProperty(t,`${e}Y`,{get:function(){return i.y},set:function(e){i.y=e,t.dirty=!0}}),Object.defineProperty(t,`${e}T`,{get:function(){return i.t},set:function(e){i.t=e,t.dirty=!0}}))},he={setTLPosition(t,e){return this.geom.setTLPosition(t,e),this.dirty=!0,this},setTRPosition(t,e){return this.geom.setTRPosition(t,e),this.dirty=!0,this},setBLPosition(t,e){return this.geom.setBLPosition(t,e),this.dirty=!0,this},setBRPosition(t,e){return this.geom.setBRPosition(t,e),this.dirty=!0,this},resetCornerPosition(){return this.geom.resetCornerPosition(),this.dirty=!0,this},insertTopSidePoint(t,e,i,s){var r=this.geom.topSidePoints;if(Array.isArray(t))for(var n,a=0,o=(r=t).length;a=0;f--)y=g[f],b=pe(d,h,y.t)+y.x,x=pe(c,l,y.t)+y.y,Et(b,x,e);for(Et(d,c,e),fe(v),f=v.length-1;f>=0;f--)y=v[f],b=pe(r,d,y.t)+y.x,x=pe(n,c,y.t)+y.y,Et(b,x,e);return e.push(e[0],e[1]),this.pathIndexes=ge(e),this}get tlx(){return this.geom.tlx}set tlx(t){this.geom.tlx=t,this.dirty=!0}get tly(){return this.geom.tly}set tly(t){this.geom.tly=t,this.dirty=!0}get trx(){return this.geom.trx}set trx(t){this.geom.trx=t,this.dirty=!0}get try(){return this.geom.try}set try(t){this.geom.try=t,this.dirty=!0}get blx(){return this.geom.blx}set blx(t){this.geom.blx=t,this.dirty=!0}get bly(){return this.geom.bly}set bly(t){this.geom.bly=t,this.dirty=!0}get brx(){return this.geom.brx}set brx(t){this.geom.brx=t,this.dirty=!0}get bry(){return this.geom.bry}set bry(t){this.geom.bry=t,this.dirty=!0}get leftSidePoints(){return this.geom.leftSidePoints}get topSidePoints(){return this.geom.topSidePoints}get bottomSidePoints(){return this.geom.bottomSidePoints}get rightSidePoints(){return this.geom.rightSidePoints}}var fe=function(t){t.length<=1||t.sort((function(t,e){return t.t-e.t}))};Object.assign(ve.prototype,he),t.register("QuadShape",(function(t,e,i,s,r,n){var a=new ve(this.scene,t,e,i,s,r,n);return this.scene.add.existing(a),a})),P(window,"RexPlugins.UI.QuadShape",ve);var me=Phaser.Renderer.WebGL.Utils,ye={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,o=me.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.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,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){0!==e.width&&0!==e.height&&(i.addToRenderList(e),t.batchSprite(e,e.frame,i,s))}};const be=Phaser.Display.Canvas.CanvasPool;F();const xe=Phaser.GameObjects.GameObject;class Ce extends xe{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=be.create(this),r=s.getContext("2d",{willReadFrequently:!0});t.syncFont(s,r);var n=r.measureText(e),a=Math.ceil(n.width*t.baselineX),o=a,h=2*o;if(o=o*t.baselineY|0,s.width=a,s.height=h,r.fillStyle="#f00",r.fillRect(0,0,a,h),r.font=t._font,r.textBaseline="alphabetic",r.fillStyle="#000",r.fillText(t.testString,0,o),i.left=0,0===a||0===h||!r.getImageData(0,0,a,h))return be.remove(s),i;for(var l=r.getImageData(0,0,a,h).data,d=!1,c=0;ci(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 s in t)t.hasOwnProperty(s)&&(e[s]=i(t[s]));return e}const s=Phaser.Utils.Objects.IsPlainObject,r=Phaser.Utils.Objects.GetValue;var n=function(t){return"string"==typeof t&&(t=a[t]),t};const a={scale:0,repeat:1};var o=function(t,e){return 0===t||t===this.columns.count-1||0===e||e===this.rows.count-1},h=function(){},l={_beginDraw:h,_drawImage:h,_drawTileSprite:h,_endDraw:h,setGetFrameNameCallback:function(t){return void 0===t&&(t=e),this.getFrameNameCallback=t,this},setBaseTexture:function(t,e,s,r){Array.isArray(e)&&(r=s,s=e,e=void 0),null==e&&(e="__BASE"),"number"==typeof s&&arguments.length>=6?(s=[arguments[2],void 0,arguments[3]],r=[arguments[4],void 0,arguments[5]]):void 0===s&&void 0===r&&void 0!==this.columns.data&&void 0!==this.rows.data?(s=this.columns.data,r=this.rows.data):(s=i(s),r=i(r)),this.textureKey=t,this.baseFrameName=e,this.columns.data=s,this.columns.count=s?s.length:0,this.columns.stretch=0,this.columns.minWidth=0,this.columns.scale=1,this.rows.data=r,this.rows.count=r?r.length:0,this.rows.stretch=0,this.rows.minHeight=0,this.rows.scale=1;var n=this.scene.sys.textures.get(t);if(!n)return this.clear(),this;if(!s||!r)return this.clear(),this;for(var a=n.get(e),o=a.width,h=0,l=0,d=s.length;l0?o/h:0,u=a.height,p=0;for(l=0,d=r.length;l0?0:f,x=0,l=0;for(var S=s.length;l0?0:m),m>=1&&f>=1){var P=typeof(y=this.getFrameNameCallback(l,k,e));"string"!==P&&"number"!==P||n.add(y,0,x+a.cutX,C+a.cutY,m,f)}x+=m}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,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 s(t)?(this.stretchMode.edge=n(r(t,"edge",0)),this.stretchMode.internal=n(r(t,"internal",0))):(t=n(t),this.stretchMode.edge=t,this.stretchMode.internal=t),this},getStretchMode:function(t,e){return o.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 d=Phaser.Utils.Objects.IsPlainObject,c=Phaser.Utils.Objects.GetValue;var u=function(t,e){class i extends t{constructor(t,i,s,r,n,a,o,h,l,u){if(d(i)?(i=c(u=i,"x",0),s=c(u,"y",0),r=c(u,"width",1),n=c(u,"height",1),a=c(u,"key",void 0),o=c(u,"baseFrame",void 0),h=c(u,"columns",void 0),l=c(u,"rows",void 0)):d(r)?(r=c(u=r,"width",1),n=c(u,"height",1),a=c(u,"key",void 0),o=c(u,"baseFrame",void 0),h=c(u,"columns",void 0),l=c(u,"rows",void 0)):d(a)?(a=c(u=a,"key",void 0),o=c(u,"baseFrame",void 0),h=c(u,"columns",void 0),l=c(u,"rows",void 0)):d(o)?(o=c(u=o,"baseFrame",void 0),h=c(u,"columns",void 0),l=c(u,"rows",void 0)):Array.isArray(o)?(u=l,l=h,h=o,o=c(u,"baseFrame",void 0)):d(h)&&(h=c(u=h,"columns",void 0),l=c(u,"rows",void 0)),void 0===o&&(o=c(u,"frame",void 0)),void 0===h){var p=c(u,"leftWidth",void 0),g=c(u,"rightWidth",void 0);void 0!==p&&void 0!==g&&(h=[p,void 0,g])}if(void 0===l){var v=c(u,"topHeight",void 0),f=c(u,"bottomHeight",void 0);void 0!==v&&void 0!==f&&(l=[v,void 0,f])}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(c(u,"getFrameNameCallback",void 0)),this.setStretchMode(c(u,"stretchMode",0)),this.setPreserveRatio(c(u,"preserveRatio",!0));var m=c(u,"maxFixedPartScale",1),y=c(u,"maxFixedPartScaleX",m),b=c(u,"maxFixedPartScaleY",void 0);this.setMaxFixedPartScale(y,b),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,l),i};const p=Phaser.Game;var g=function(t){return t instanceof p};const v=Phaser.Scene;var f=function(t){return t instanceof v},m=function(t){return null==t||"object"!=typeof t?null:g(t)?t:g(t.game)?t.game:f(t)?t.sys.game:f(t.scene)?t.scene.sys.game:void 0};const y=Phaser.GameObjects;var b=void 0,x=function(t,e){if(b||(b={},m(t).events.once("destroy",(function(){for(var t in b)b[t].destroy();b=void 0}))),!b.hasOwnProperty(e)){var i=m(t).scene.systemScene;(t=new y[e](i)).setOrigin(0),b[e]=t}return b[e]};const C=Phaser.GameObjects.RenderTexture;let k=class extends(u(C,"rexNinePatch")){};var w={_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(k.prototype,w);var S=function(t){return null==t||""===t||0===t.length},P=function(t,e,i,s){if(void 0===s&&(s="."),"object"==typeof t){if(S(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(S(e));else{var r;"string"==typeof e&&(e=e.split("."));for(var n=0,a=e.length;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 D=Phaser.Utils.Objects.GetValue;var j={};let A=class{constructor(t){this.pools=D(t,"pools",j)}destroy(){this.pools=void 0}free(t){if(!this.pools)return this;var e=t.type;return this.pools.hasOwnProperty(e)||(this.pools[e]=new I),this.pools[e].push(t),t.onFree(),this}freeMultiple(t){if(!this.pools)return this;for(var e=0,i=t.length;e0},N=function(t,e){return t._depth-e._depth};const $=Phaser.GameObjects.Components;Phaser.Class.mixin(H,[$.Alpha,$.BlendMode,$.ComputedSize,$.Depth,$.GetBounds,$.Mask,$.Origin,$.Pipeline,$.PostPipeline,$.ScrollFactor,$.Transform,$.Visible,M,B]);const K="image";var J=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,n=i,a=0;a0&&!ot(t)&&(t=this.parent.texture.get(t)),this.frame=t,this._width=t?t.width:0,this._height=t?t.height:0,this}setFlipX(t){return void 0===t&&(t=!0),this.flipX=t,this}setFlipY(t){return void 0===t&&(t=!0),this.flipY=t,this}resetFlip(){return this.flipX=!1,this.flipY=!1,this}get tint(){return void 0===this._tint?this.parent.tint:this._tint}set tint(t){this._tint=t}setTint(t){return this.tint=t,this.tintFill=!1,this}setTintFill(t){return this.tint=t,this.tintFill=!0,this}clearTint(){return this.setTint(16777215),this}resetTint(){return this.tint=void 0,this.tintFill=void 0,this}get tintFill(){return void 0===this._tintFill?this.parent.tintFill:this._tintFill}set tintFill(t){this._tintFill=t}reset(){return super.reset(),this.resetFlip().resetTint().setFrame(),this}modifyPorperties(t){return t?(t.hasOwnProperty("width")&&(t.displayWidth=t.width,delete t.width),t.hasOwnProperty("height")&&(t.displayHeight=t.height,delete t.height),t.hasOwnProperty("frame")&&this.setFrame(t.frame),super.modifyPorperties(t),t.hasOwnProperty("flipX")&&this.setFlipX(t.flipX),t.hasOwnProperty("flipY")&&this.setFlipY(t.flipY),t.hasOwnProperty("tint")&&this.setTint(t.tint),t.hasOwnProperty("tintFill")&&this.setTintFill(t.tintFill),this):this}};var lt={webglRender:function(t,e,i,s,r,n,a,o){var h=this._width,l=this._height,d=h*this.originX,c=l*this.originY,u=this.x-s,p=this.y-r,g=1,v=1;this.flipX&&(u+=h-2*d,g=-1),this.flipY&&(p+=l-2*c,v=-1),at.applyITRS(u,p,this.rotation,this.scaleX*g,this.scaleY*v),e.multiply(at,at);var f=-d,m=-c,y=f+h,b=m+l,x=at.setQuad(f,m,y,b,o),C=this.frame.u0,k=this.frame.v0,w=this.frame.u1,S=this.frame.v1,P=nt(this.tint,this.alpha*i);t.batchQuad(this.parent,x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],C,k,w,S,P,P,P,P,this.tintFill,n,a)},canvasRender:function(t,e,i,s){t.save();var r=this._width,n=this._height,a=r*this.originX,o=n*this.originY,h=this.x-a,l=this.y-o,d=1,c=1;this.flipX&&(h+=r,d=-1),this.flipY&&(l+=n,c=-1),s&&(h=Math.round(h),l=Math.round(l)),t.translate(h,l),t.rotate(this.rotation),t.scale(this.scaleX*d,this.scaleY*c);var u=this.frame;t.drawImage(u.source.image,u.cutX,u.cutY,r,n,0,0,r,n),t.restore()}};Object.assign(ht.prototype,lt);var dt=function(t,e){"string"==typeof e&&(e={frame:e});var i=t.poolManager?t.poolManager.allocate(K):null;return null===i?i=new ht(t):i.setParent(t).setActive(),i.modifyPorperties(e),t.addChild(i),i},ct={_drawImage:function(t,e,i,s,r,n){dt(this,{frame:e,x:i,y:s,width:r,height:n})},_drawTileSprite:function(t,e,i,s,r,n){var a=this.texture.get(e),o=a.width,h=a.height,l=Math.floor(r/o),d=Math.floor(n/h);i+=(r-l*o)/2,s+=(n-d*h)/2;for(var c=0;c>>16,o=(65280&r)>>>8,h=255&r;t.fillStyle="rgba("+a+","+o+","+h+","+n+")"},bt=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 xt=Phaser.Renderer.Canvas.SetTransform;var Ct={renderWebGL:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.pipelines.set(e.pipeline),n=mt(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&>(r,a,e,l,o,h),e.isStroked&&ft(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(xt(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(wt.prototype,Ct);const St=Phaser.Utils.Objects.GetValue;let Pt=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=St(t,"x",0),i=St(t,"y",0));var s=this.cornerRadius;s.tl=Tt(St(t,"tl",void 0),e,i),s.tr=Tt(St(t,"tr",void 0),e,i),s.bl=Tt(St(t,"bl",void 0),e,i),s.br=Tt(St(t,"br",void 0),e,i)}get radiusTL(){var t=this.cornerRadius.tl;return Math.max(t.x,t.y)}set radiusTL(t){Ot(this.cornerRadius.tl,t)}get radiusTR(){var t=this.cornerRadius.tr;return Math.max(t.x,t.y)}set radiusTR(t){Ot(this.cornerRadius.tr,t)}get radiusBL(){var t=this.cornerRadius.bl;return Math.max(t.x,t.y)}set radiusBL(t){Ot(this.cornerRadius.bl,t)}get radiusBR(){var t=this.cornerRadius.br;return Math.max(t.x,t.y)}set radiusBR(t){Ot(this.cornerRadius.br,t)}};var Tt=function(t,e,i){return void 0===t?t={x:e,y:i}:"number"==typeof t&&(t={x:t,y:t}),Mt(t),t},Ot=function(t,e){"number"==typeof e?(t.x=e,t.y=e):(t.x=St(e,"x",0),t.y=St(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)},Et=function(t){return t.x>0&&t.y>0},_t=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 Rt=Phaser.Math.DegToRad;var Lt=function(t,e,i,s,r,n,a,o,h){a&&n>r?n-=360:!a&&n=p?1:s/p,f=r>=g?1:r/g,m=u.cornerRadius;t.save(),t.beginPath(),t.translate(e,i),o=m.tl,te(o)?(h=o.x*v,l=o.y*f,Qt(o)?ee(t,h,l,h,l,180,270,!1,a):ee(t,0,0,h,l,90,0,!0,a),d=0,c=l):(t.lineTo(0,0),d=0,c=0),o=m.tr,te(o)?(h=o.x*v,l=o.y*f,Qt(o)?ee(t,s-h,l,h,l,270,360,!1,a):ee(t,s,0,h,l,180,90,!0,a)):t.lineTo(s,0),o=m.br,te(o)?(h=o.x*v,l=o.y*f,Qt(o)?ee(t,s-h,r-l,h,l,0,90,!1,a):ee(t,s,r,h,l,270,180,!0,a)):t.lineTo(s,r),o=m.bl,te(o)?(h=o.x*v,l=o.y*f,Qt(o)?ee(t,h,r-l,h,l,90,180,!1,a):ee(t,0,r,h,l,360,270,!0,a)):t.lineTo(0,r),t.lineTo(d,c),t.closePath(),t.restore()},Qt=function(t){return!t.hasOwnProperty("convex")||t.convex},te=function(t){return t.x>0&&t.y>0},ee=function(t,e,i,s,r,n,a,o,h){if(o&&a>n?a-=360:!o&&a0&&(e.strokeStyle=h,e.lineWidth=l,e.stroke())}(t.canvas,t.context,d,d,h,l,r,e,i,s,n,a,o)}},se=function(){ie(this,this.fillStyle,this.strokeStyle,this.lineWidth,this.radius,this.fillColor2,this.isHorizontalGradient,this.iteration)};const re=Phaser.Utils.Objects.GetValue;let ne=class extends Nt{constructor(t,e,i,s,r,n,a,o,h,l,d,c){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=1),super(t,e,i,s,r,c),this.type="rexRoundRectangleCanvas";var u=re(n,"radius",n),p=re(n,"iteration",void 0);this.setRadius(u),this.setIteration(p),this.setFillStyle(a,l,d),this.setStrokeStyle(o,h)}get radius(){return this._radius}set radius(t){this.dirty|=this._radius!=t,this._radius=t}setRadius(t){return this.radius=t,this}get iteration(){return this._iteration}set iteration(t){this.dirty|=this._iteration!=t,this._iteration=t}setIteration(t){return this.iteration=t,this}get fillStyle(){return this._fillStyle}set fillStyle(t){t=Jt(t,this.canvas,this.context),this.dirty|=this._fillStyle!=t,this._fillStyle=t}get fillColor2(){return this._fillColor2}set fillColor2(t){t=Jt(t,this.canvas,this.context),this.dirty|=this._fillColor2!=t,this._fillColor2=t}get isHorizontalGradient(){return this._isHorizontalGradient}set isHorizontalGradient(t){this.dirty|=this._isHorizontalGradient!=t,this._isHorizontalGradient=t}setFillStyle(t,e,i){return void 0===i&&(i=!0),this.fillStyle=t,this.fillColor2=e,this.isHorizontalGradient=i,this}get strokeStyle(){return this._strokeStyle}set strokeStyle(t){t=Jt(t,this.canvas,this.context),this.dirty|=this._strokeStyle!=t,this._strokeStyle=t}get lineWidth(){return this._lineWidth}set lineWidth(t){this.dirty|=this._lineWidth!=t,this._lineWidth=t}setStrokeStyle(t,e){return this.strokeStyle=t,this.lineWidth=e,this}updateTexture(){return super.updateTexture((function(){this.clear(),se.call(this)}),this),this}};t.register("roundRectangleCanvas",(function(t,e,i,s,r,n,a,o,h,l){var d=new ne(this.scene,t,e,i,s,r,n,a,o,h,l);return this.scene.add.existing(d),d})),P(window,"RexPlugins.UI.RoundRectangleCanvas",ne);var ae=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},oe=function(t,e,i){e&&!ae(t,`${e}X`)&&(Object.defineProperty(t,`${e}X`,{get:function(){return i.x},set:function(e){i.x=e,t.dirty=!0}}),Object.defineProperty(t,`${e}Y`,{get:function(){return i.y},set:function(e){i.y=e,t.dirty=!0}}),Object.defineProperty(t,`${e}T`,{get:function(){return i.t},set:function(e){i.t=e,t.dirty=!0}}))},he={setTLPosition(t,e){return this.geom.setTLPosition(t,e),this.dirty=!0,this},setTRPosition(t,e){return this.geom.setTRPosition(t,e),this.dirty=!0,this},setBLPosition(t,e){return this.geom.setBLPosition(t,e),this.dirty=!0,this},setBRPosition(t,e){return this.geom.setBRPosition(t,e),this.dirty=!0,this},resetCornerPosition(){return this.geom.resetCornerPosition(),this.dirty=!0,this},insertTopSidePoint(t,e,i,s){var r=this.geom.topSidePoints;if(Array.isArray(t))for(var n,a=0,o=(r=t).length;a=0;f--)y=g[f],b=pe(d,h,y.t)+y.x,x=pe(c,l,y.t)+y.y,_t(b,x,e);for(_t(d,c,e),fe(v),f=v.length-1;f>=0;f--)y=v[f],b=pe(r,d,y.t)+y.x,x=pe(n,c,y.t)+y.y,_t(b,x,e);return e.push(e[0],e[1]),this.pathIndexes=ge(e),this}get tlx(){return this.geom.tlx}set tlx(t){this.geom.tlx=t,this.dirty=!0}get tly(){return this.geom.tly}set tly(t){this.geom.tly=t,this.dirty=!0}get trx(){return this.geom.trx}set trx(t){this.geom.trx=t,this.dirty=!0}get try(){return this.geom.try}set try(t){this.geom.try=t,this.dirty=!0}get blx(){return this.geom.blx}set blx(t){this.geom.blx=t,this.dirty=!0}get bly(){return this.geom.bly}set bly(t){this.geom.bly=t,this.dirty=!0}get brx(){return this.geom.brx}set brx(t){this.geom.brx=t,this.dirty=!0}get bry(){return this.geom.bry}set bry(t){this.geom.bry=t,this.dirty=!0}get leftSidePoints(){return this.geom.leftSidePoints}get topSidePoints(){return this.geom.topSidePoints}get bottomSidePoints(){return this.geom.bottomSidePoints}get rightSidePoints(){return this.geom.rightSidePoints}}var fe=function(t){t.length<=1||t.sort((function(t,e){return t.t-e.t}))};Object.assign(ve.prototype,he),t.register("QuadShape",(function(t,e,i,s,r,n){var a=new ve(this.scene,t,e,i,s,r,n);return this.scene.add.existing(a),a})),P(window,"RexPlugins.UI.QuadShape",ve);var me=Phaser.Renderer.WebGL.Utils,ye={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,o=me.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.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,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){0!==e.width&&0!==e.height&&(i.addToRenderList(e),t.batchSprite(e,e.frame,i,s))}};const be=Phaser.Display.Canvas.CanvasPool;F();const xe=Phaser.GameObjects.GameObject;class Ce extends xe{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=be.create(this),r=s.getContext("2d",{willReadFrequently:!0});t.syncFont(s,r);var n=r.measureText(e),a=Math.ceil(n.width*t.baselineX),o=a,h=2*o;if(o=o*t.baselineY|0,s.width=a,s.height=h,r.fillStyle="#f00",r.fillRect(0,0,a,h),r.font=t._font,r.textBaseline="alphabetic",r.fillStyle="#000",r.fillText(t.testString,0,o),i.left=0,0===a||0===h||!r.getImageData(0,0,a,h))return be.remove(s),i;for(var l=r.getImageData(0,0,a,h).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 Se=Phaser.Display.Canvas.CanvasPool;var Pe=function(t){var e=Se.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 Se.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,Se.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!==Ee&&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=Be[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]=De(t,l,d);else{var u=Ie(t,l,d);c&&(u=c(u)),this[o]=u}}var p=De(t,"font",null);this._font=null===p?this.fontStyle+" "+this.fontSize+" "+this.fontFamily:p;var g=De(t,"fill",null);null!==g&&(this.color=Jt(g));var v=De(t,"metrics",!1);return v?this.metrics={ascent:De(v,"ascent",0),descent:De(v,"descent",0),fontSize:De(v,"fontSize",0)}:!e&&this.metrics||(this.metrics=Pe(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=Pe(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=De(t,"fontFamily","Courier"),this.fontSize=De(t,"fontSize","16px"),this.fontStyle=De(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=Jt(t,this.parent.canvas,this.parent.context),this.backgroundColor2=Jt(e,this.parent.canvas,this.parent.context),this.backgroundHorizontalGradient=i,this.update(!1)}setBackgroundStrokeColor(t,e){return this.backgroundStrokeColor=Jt(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=Jt(t,this.parent.canvas,this.parent.context),this.update(!1)}setColor(t){return this.color=Jt(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=Jt(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=Jt(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=Jt(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=Jt(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=Jt(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=Jt(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=Jt(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=Be[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=De(e,"fontFamily",this.fontFamily),this.fontSize=De(e,"fontSize",this.fontSize),this.fontStyle=De(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 Ae=function(t){return null==t?t="":Array.isArray(t)?t=t.join("\n"):"number"==typeof t&&(t=t.toString()),t},ze={draw(t,e,i,s){var r=this.penManager;this.hitAreaManager.clear();var n=this.context;n.save();var a=this.defaultStyle;this.clear(),ie(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 Fe=Phaser.Utils.Objects.GetValue,Ye=Te,Xe=Oe;class We{constructor(t){this.prop={},this.resetFromJSON(t)}resetFromJSON(t){this.text=Fe(t,"text",""),this.x=Fe(t,"x",0),this.y=Fe(t,"y",0),this.width=Fe(t,"width",0);var e=Fe(t,"prop",null);null===e&&(e={}),this.prop=e,this.newLineMode=Fe(t,"newLineMode",0),this.startIndex=Fe(t,"startIndex",0)}get plainText(){var t=this.text;return this.newLineMode===Xe&&(t+="\n"),t}get wrapText(){var t=this.text;return this.newLineMode!==Ye&&(t+="\n"),t}get rawTextLength(){var t=this.text.length;return this.newLineMode===Xe&&(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 Ve=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 $e={};const Ke=Phaser.Geom.Rectangle;var Je=new I;class qe{constructor(){this.hitAreas=[]}destroy(){this.clear()}clear(){for(var t=0,e=this.hitAreas.length;ts&&pi(v)){""!==b?a.push(n.getLine(b,x,ai)):0===C&&r>0&&a.push(n.getLine("",0,ai)),a.push(...ci(v,e,li,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,ai)),b=v,x=f,h=s):(b+=v,x=m),C===k-1&&a.push(n.getLine(b,x,l))}return a},ui=function(t,e){var i;switch(e){case hi:i=[];for(var s=0,r=(t=t.split(" ")).length;s0&&e!==vi&&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 Ne({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 gs=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},vs=function(t){return 0===(t=t.replace(Cs,"")).length},fs=/<\s*class=["|']([^"|']+)["|']\s*\>([\s\S]*?)<\s*\/class\s*\>|<\s*style=["|']([^"|']+)["|']\s*\>([\s\S]*?)<\s*\/style\s*\>/g,ms=/<\s*class=/i,ys=/<\s*class=["|']([^"|']+)["|']\s*\>([\s\S]*?)<\s*\/class\s*\>/,bs=/<\s*style=/i,xs=/<\s*style=["|']([^"|']+)["|']\s*\>([\s\S]*?)<\s*\/style\s*\>/,Cs=/^\s+|\s+$/;const ks=Phaser.Utils.Objects.GetValue;class ws extends Yi{constructor(t,e,i,s,r){var n=ks(r,"tags",void 0);super(t,e,i,s,r,"rexTagText",new ps(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 ws(this.scene,t,e,i,s);return this.scene.add.existing(r),r})),P(window,"RexPlugins.UI.TagText",ws);const Ss=Phaser.Utils.Objects.GetValue;var Ps=function(t,e){return void 0===e?t:t[e]},Ts=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=Ss(e,"left",0),t.right=Ss(e,"right",0),t.top=Ss(e,"top",0),t.bottom=Ss(e,"bottom",0)),t};let Os=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(Os.prototype,Z);var Ms={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 Es=Phaser.Math.RotateAround;var _s;const Rs=Phaser.Geom.Rectangle;var Ls,Bs=function(t){void 0===Ls&&(Ls=new Rs);var e=t.drawTLX,i=t.drawTLY;return Ls.setTo(e,i,t.drawTRX-e,t.drawBLY-i),Ls};const Is=Phaser.Math.RotateAround;var Ds,js=function(t,e,i,s){return void 0===s?s={}:!0===s&&(void 0===Ds&&(Ds={}),s=Ds),s.x=e,s.y=i,0!==t.rotation&&Is(s,0,0,t.rotation),s.x=s.x*t.scaleX+t.drawX,s.y=s.y*t.scaleY+t.drawY,s};const As=Phaser.GameObjects.Components.TransformMatrix;var zs,Fs,Ys={},Xs=function(t,e,i,s,r){var n=js(e,i,s,!0),a=function(t,e,i,s){void 0===s?s={}:!0===s&&(s=Ys);var r=e-t.width*t.originX,n=i-t.height*t.originY;return void 0===zs&&(zs=new As,Fs=new As),t.parentContainer?t.getWorldTransformMatrix(zs,Fs):zs.applyITRS(t.x,t.y,t.rotation,t.scaleX,t.scaleY),zs.transformPoint(r,n,s),s}(t,n.x,n.y,r);return a},Ws=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 Xs(t,e,n,a,r)},Vs={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===_s&&(_s={}),s=_s),s.x=(t-i.drawX)/i.scaleX,s.y=(e-i.drawY)/i.scaleY,0!==i.rotation&&Es(s,0,0,-i.rotation),s}(t,e,this,!0);return Bs(this).contains(i.x,i.y)},getWorldPosition:function(t,e,i){return Ws(this.parent,this,t,e,i)}};Object.assign(Vs,Ms);const Gs=Phaser.Math.DegToRad,Hs=Phaser.Math.RadToDeg,Us=Phaser.Utils.Objects.GetValue;class Ns extends Os{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 Hs(this._rotation)}set angle(t){this.rotation=Gs(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=Us(t,"width",void 0),i=Us(t,"height",void 0),s=Us(t,"scaleX",void 0),r=Us(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(Ns.prototype,Vs);var $s=function(t,e,i){return e.hasOwnProperty(t)?e[t]:i[t]};const Ks=Phaser.Utils.Objects.GetValue;class Js extends Ns{constructor(t,e){super(t,"background"),this.setScrollFactor(0),this.setColor(Ks(e,"color",null),Ks(e,"color2",null),Ks(e,"horizontalGradient",!0)),this.setStroke(Ks(e,"stroke",null),Ks(e,"strokeThickness",2)),this.setCornerRadius(Ks(e,"cornerRadius",0),Ks(e,"cornerIteration",null))}set color(t){t=Jt(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=Jt(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=Jt(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,$s("color2",t,this),$s("horizontalGradient",t,this)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,$s("strokeThickness",t,this)),t.hasOwnProperty("cornerRadius")&&this.setCornerRadius(t.cornerRadius,$s("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(){ie(this.parent,this.color,this.stroke,this.strokeThickness,this.cornerRadius,this.color2,this.horizontalGradient,this.cornerIteration)}}const qs=Phaser.Utils.Objects.GetValue;class Zs extends Ns{constructor(t,e){super(t,"innerbounds"),this.setScrollFactor(0),this.setColor(qs(e,"color",null),qs(e,"color2",null),qs(e,"horizontalGradient",!0)),this.setStroke(qs(e,"stroke",null),qs(e,"strokeThickness",2))}set color(t){t=Jt(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=Jt(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=Jt(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,qs(t,"color2",null),qs(t,"horizontalGradient",!0)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,qs(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 Qs=Phaser.Utils.Objects.GetValue;class tr{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(Qs(t,"bold",!1)),this.setItalic(Qs(t,"italic",!1)),this.setFontSize(Qs(t,"fontSize","16px")),this.setFontFamily(Qs(t,"fontFamily","Courier")),this.setColor(Qs(t,"color","#fff")),this.setStrokeStyle(Qs(t,"stroke",null),Qs(t,"strokeThickness",0)),this.setShadow(Qs(t,"shadowColor",null),Qs(t,"shadowOffsetX",0),Qs(t,"shadowOffsetY",0),Qs(t,"shadowBlur",0)),this.setOffset(Qs(t,"offsetX",0),Qs(t,"offsetY",0)),this.setSpace(Qs(t,"leftSpace",0),Qs(t,"rightSpace",0)),this.setAlign(Qs(t,"align",void 0)),this.setBackgroundColor(Qs(t,"backgroundColor",null)),this.setBackgroundHeight(Qs(t,"backgroundHeight",void 0)),this.setBackgroundBottomY(Qs(t,"backgroundBottomY",void 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($s("stroke",t,this),$s("strokeThickness",t,this)),t.hasOwnProperty("shadowColor")&&this.setShadowColor(t.shadowColor),(t.hasOwnProperty("shadowOffsetX")||t.hasOwnProperty("shadowOffsetY"))&&this.setShadowOffset($s("shadowOffsetX",t,this),$s("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),this}setUpdateTextFlag(){return this.parent&&(this.parent.updateTextFlag=!0),this}clone(){return new tr(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=Jt(t),this}get hasFill(){return null!=this.color}setStrokeStyle(t,e){return this.stroke=Jt(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=Jt(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=Jt(t),this}get hasBackgroundColor(){return null!=this.backgroundColor}setBackgroundHeight(t){return this.backgroundHeight=t,this}setBackgroundBottomY(t){return this.backgroundBottomY=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 er=Phaser.Utils.Array.Remove,ir=Phaser.Utils.Array.Remove,sr="text",rr="image",nr="drawer",ar="space",or="command";var hr=function(t){return t.type===sr&&"\n"===t.text},lr=function(t){return t.type===sr&&"\f"===t.text},dr=function(t){return t.type===sr},cr=function(t){return t.type===or};class ur extends Ns{constructor(t,e,i){super(t,sr),this.updateTextFlag=!1,this.style=new tr(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,s=this.drawTRX-i+1,r=e.backgroundBottomY;null==r&&(r=this.drawBLY);var n=e.backgroundHeight;null==n&&(n=r-this.drawTLY);var a=r-n;t.fillRect(i,a,s,n)}var o=e.hasFill,h=e.hasStroke;(o||h)&&(e.syncFont(t).syncStyle(t),h&&(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 pr=function(t,e){var i=this.createCharChildren(t,e);return this.addChild(i),this};Phaser.Display.Canvas.CanvasPool;class gr extends Ns{constructor(t,e,i){super(t,rr),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(){Pi(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 vr=function(t,e,i){var s=this.createImageChild(t,e,i);return this.addChild(s),this};class fr extends Ns{constructor(t,e,i,s){super(t,nr),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 mr=class extends Ns{constructor(t,e){super(t,ar),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 yr=function(t){var e=this.createSpaceChild(t);return this.addChild(e),this};class br extends Os{constructor(t,e,i,s,r){super(t,or),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 xr=function(t,e,i,s){var r=this.createCommandChild(t,e,i,s);return this.addChild(r),this},Cr=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 kr={none:0,word:1,char:2,character:2,mix:3};var wr=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=Or.call(this)).height,a=l.ascent,i=Math.floor((h-a)/n))}else{var l;n=(l=Or.call(this)).height,a=l.ascent}}else this.fixedHeight>0?void 0===(i=Er(t,"maxLines"))&&(h=this.fixedHeight-s,i=Math.floor(h/n)):i=Er(t,"maxLines",0);void 0===a&&(a=n);var d=0===i,c=Er(t,"wrapMode");void 0===c&&(c=Er(t,"charWrap",!1)?"char":"word"),"string"==typeof c&&(c=kr[c]);var u=Er(t,"wrapWidth",void 0);void 0===u&&(this.fixedWidth>0?u=this.fixedWidth-r:(u=1/0,c=0));for(var p=Er(t,"letterSpacing",0),g=Er(t,"hAlign",0),v=Er(t,"vAlign",0),f=Er(t,"justifyPercentage",.25),m=Cr({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=Lr(t,"maxLines",void 0))){var a=this.fixedWidth-r;i=Math.floor(a/n)+1}}else i=Lr(t,"maxLines",0);var o=0===i,h=Lr(t,"fixedCharacterHeight",void 0);if(void 0===h){var l=Lr(t,"charPerLine",void 0);if(void 0!==l){var d=this.fixedHeight-s;h=Math.floor(d/l)}}var c=Lr(t,"wrapHeight",void 0);void 0===c&&(c=this.fixedHeight>0?this.fixedHeight-s:1/0);for(var u=Lr(t,"letterSpacing",0),p=Lr(t,"rtl",!0),g=Lr(t,"hAlign",p?2:0),v=Lr(t,"vAlign",0),f=Cr({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 Ts(i,t,e),this.dirty=this.dirty||s!=i.left||r!=i.right||n!=i.top||a!=i.bottom,this},getPadding:function(t){return Ps(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),er(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 ir(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(sr);return null===i?i=new ur(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)),Ws(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},yn=function(t){return t>>8&255},bn=function(t){return 255&t};const xn=Phaser.Events.EventEmitter;var Cn=function(t,e,i,s,r,n){return void 0===n?n={}:!0===n&&(n=kn),"number"!=typeof i&&(i=0,s=0),n.x=r.x+r.width*t+i,n.y=r.y+r.height*e+s,n},kn={},wn=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=Cn),function(t){if(t.events)return t;var e=new xn,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()},Sn=function(t){return t.preFX?t.preFX:t.postFX?t.postFX:null},Pn=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(Mn(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}},An=function(t){return void 0!==t.displayWidth?t.displayWidth:t.width},zn=function(t){return void 0!==t.displayHeight?t.displayHeight:t.height};const Fn=Phaser.Geom.Rectangle,Yn=Phaser.Math.Vector2,Xn=Phaser.Math.RotateAround;var Wn=function(t,e){if(void 0===e?e=new Fn:!0===e&&(void 0===Vn&&(Vn=new Fn),e=Vn),t.getBounds)return t.getBounds(e);var i,s,r,n,a,o,h,l;if(t.parentContainer){var d=t.parentContainer.getBoundsTransformMatrix();Gn(t,e),d.transformPoint(e.x,e.y,e),i=e.x,s=e.y,Hn(t,e),d.transformPoint(e.x,e.y,e),r=e.x,n=e.y,Un(t,e),d.transformPoint(e.x,e.y,e),a=e.x,o=e.y,Nn(t,e),d.transformPoint(e.x,e.y,e),h=e.x,l=e.y}else Gn(t,e),i=e.x,s=e.y,Hn(t,e),r=e.x,n=e.y,Un(t,e),a=e.x,o=e.y,Nn(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},Vn=void 0,Gn=function(t,e,i){return void 0===e?e=new Yn:!0===e&&(void 0===Kn&&(Kn=new Yn),e=Kn),t.getTopLeft?t.getTopLeft(e):(e.x=t.x-An(t)*t.originX,e.y=t.y-zn(t)*t.originY,Jn(t,e,i))},Hn=function(t,e,i){return void 0===e?e=new Yn:!0===e&&(void 0===Kn&&(Kn=new Yn),e=Kn),t.getTopRight?t.getTopRight(e):(e.x=t.x-An(t)*t.originX+An(t),e.y=t.y-zn(t)*t.originY,Jn(t,e,i))},Un=function(t,e,i){return void 0===e?e=new Yn:!0===e&&(void 0===Kn&&(Kn=new Yn),e=Kn),t.getBottomLeft?t.getBottomLeft(e):(e.x=t.x-An(t)*t.originX,e.y=t.y-zn(t)*t.originY+zn(t),Jn(t,e,i))},Nn=function(t,e,i){return void 0===e?e=new Yn:!0===e&&(void 0===Kn&&(Kn=new Yn),e=Kn),t.getBottomRight?t.getBottomRight(e):(e.x=t.x-An(t)*t.originX+An(t),e.y=t.y-zn(t)*t.originY+zn(t),Jn(t,e,i))},$n=function(t,e,i){void 0===e?e=new Yn:!0===e&&(void 0===Kn&&(Kn=new Yn),e=Kn);var s=An(t),r=zn(t);return e.x=t.x+s*(.5-t.originX),e.y=t.y+r*(.5-t.originY),Jn(t,e,i)},Kn=void 0,Jn=function(t,e,i){return void 0===i&&(i=!1),0!==t.rotation&&Xn(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 Zn=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?Va:Wa,this.repeatCounter=0,this}stop(){return this.state=Xa,this}update(t,e){this.state!==Xa&&this.state!==Ha&&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=Ga)):(this.nowTime=this.duration,this.state=Ha):this.nowTime>=0&&(this.state=Va))}get t(){var t;switch(this.state){case Xa:case Wa:case Ga:t=0;break;case Va:t=this.nowTime/this.duration;break;case Ha:t=1}return Fa(t,0,1)}set t(t){(t=Fa(t,-1,1))<0?(this.state=Wa,this.nowTime=-this.delay*t):(this.state=Va,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===Xa}get isDelay(){return this.state===Wa}get isCountDown(){return this.state===Va}get isRunning(){return this.state===Wa||this.state===Va}get isDone(){return this.state===Ha}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}};const Xa=0,Wa=1,Va=2,Ga=3,Ha=-1;class Ua extends ja{constructor(t,e){super(t,e),this.timer=new Ya}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 Na=Phaser.Utils.Objects.GetValue,$a=Phaser.Utils.Objects.GetAdvancedValue,Ka=Phaser.Tweens.Builders.GetEaseFunction;class Ja extends Ua{resetFromJSON(t){return this.timer.resetFromJSON(Na(t,"timer")),this.setEnable(Na(t,"enable",!0)),this.setTarget(Na(t,"target",this.parent)),this.setDelay($a(t,"delay",0)),this.setDuration($a(t,"duration",1e3)),this.setEase(Na(t,"ease","Linear")),this.setRepeat(Na(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=Ka(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 Za=function(t){return t instanceof qa};const Qa=Phaser.Utils.Objects.GetValue,to=Phaser.Utils.Objects.GetAdvancedValue,eo=Phaser.Math.Linear;let io=class extends Ja{constructor(t,e,i){Za(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(Qa(t,"mode",0)),this.setEnable(Qa(t,"enable",!0)),this.setVolumeRange(to(t,"volume.start",this.parent.volume),to(t,"volume.end",0)),this}setMode(t){return"string"==typeof t&&(t=so[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=eo(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 so={stop:1,destroy:2};var ro=function(t,e,i,s,r){Za(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 io(t,e,a),e._fade=n),n.start(),e.isPlaying||e.setVolume(r).play(),e},no=function(t,e,i,s){Za(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 io(t,e,n),e._fade=r),r.start(),e.isPlaying||e.play(),e};const ao=Phaser.Utils.Objects.GetValue;var oo={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:ao(e,"loop",this.backgroundMusicLoop),mute:ao(e,"mute",this.backgroundMusicMute),volume:ao(e,"volume",this.backgroundMusicVolume),detune:ao(e,"detune",0),rate:ao(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&&ro(this.backgroundMusic,t,this.backgroundMusicVolume,0),this},fadeOutBackgroundMusic(t,e){return this.backgroundMusic&&no(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 ho=Phaser.Utils.Objects.GetValue;var lo={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:ho(e,"loop",this.backgroundMusicLoop),mute:ho(e,"mute",this.backgroundMusic2Mute),volume:ho(e,"volume",this.backgroundMusic2Volume),detune:ho(e,"detune",0),rate:ho(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&&ro(this.backgroundMusic2,t,this.backgroundMusic2Volume,0),this},fadeOutBackgroundMusic2(t,e){return this.backgroundMusic2&&no(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 co=Phaser.Utils.Array.Remove,uo=Phaser.Utils.Objects.GetValue;var po={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:uo(e,"mute",this.soundEffectsMute),volume:uo(e,"volume",this.soundEffectsVolume),detune:uo(e,"detune",0),rate:uo(e,"rate",1)});return this.soundEffects.push(i),i.once("complete",(function(){i.destroy(),this.sound&&co(this.soundEffects,i)}),this).once("destroy",(function(){this.sound&&co(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&&ro(e,t,this.soundEffectsVolume,0),this},fadeOutSoundEffect(t,e){var i=this.getLastSoundEffect();return i&&no(i,t,e),this},fadeOutAllSoundEffects(t,e){for(var i=this.soundEffects.length-1;i>=0;i--)no(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&&ro(e,t,this.soundEffects2Volume,0),this},fadeOutSoundEffect2(t,e){var i=this.getLastSoundEffect2();return i&&no(i,t,e),this},fadeOutAllSoundEffects2(t,e){for(var i=this.soundEffects2.length-1;i>=0;i--)no(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=qi(this.delimiterLeft),e=qi(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=Qo),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=eh),this.tagExpression=t,this}setValueExpression(t){return t||(t=eh),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!==eh||this.valueExpression!==eh){var s=`${this.tagExpression}(=${this.valueExpression})?`,r=`/${this.tagExpression}`;t=qi(this.delimiterLeft),e=qi(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:al,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===sr&&" "===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,ol.call(t,i.remainder)}});break}}else cr(s)&&s.exec()}this.minSizeEnable&&this.textPlayer.setToMinSize(),this.inTypingProcessLoop=!1},hl=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}},ll=function(t,e){var i=e.split(".");return t.gameObjectManagers.hasOwnProperty(i[0])},dl=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 cl=Phaser.Input.Keyboard.KeyCodes;var ul=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)},Ol=function(t){var e,i;[e,...i]=t,this.getGameObjectManager(e).stopAnimation(...i)},Ml=function(t){var e,i;[e,...i]=t,this.getGameObjectManager(e).pauseAnimation(...i)},El=function(t){var e,i;[e,...i]=t,this.getGameObjectManager(e).chainAnimation(...i)};const _l=[function(t,e,i){var s=i.name;e.on("+",(function(i,...r){if(!e.skipEventFlag){var n,a=i.split(".");Pl(a,s)&&(n=a[1],xr.call(t,`${s}.play`,Tl,[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],xr.call(t,`${s}.stop`,Ol,[s,r],t),e.skipEvent())}})).on("-",(function(i){if(!e.skipEventFlag){var r,n=i.split(".");Pl(n,s)&&(r=n[1],xr.call(t,`${s}.stop`,Ol,[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],xr.call(t,`${s}.pause`,Ml,[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);xr.call(t,`${s}.chain`,El,[s,r,a],t),e.skipEvent()}}}))}];var Rl=function(t){void 0===t&&(t={}),t.name="sprite",t.parseCallbacks=_l,t.createGameObject=Cl(t.createGameObject),this.addGameObjectManager(t,Sl)},Ll=function(t,e){return 2===t.length&&t[0]===e},Bl=function(t){var e,i;[e,...i]=t,this.getGameObjectManager(e).add(...i)},Il=function(t){var e,i;[e,...i]=t,this.getGameObjectManager(e).remove(...i)},Dl=function(t){this.getGameObjectManager(t).removeAll()},jl=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])}},Al={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},zl=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 Fl=[function(t,e,i){var s=i.name;e.on("+",(function(i,...r){if(!e.skipEventFlag){var n,a=i.split(".");Ll(a,s)&&(n=a[1],xr.call(t,`${s}.add`,Bl,[s,n,...r],t),e.skipEvent())}})).on("-",(function(i){if(!e.skipEventFlag){var r,n=i.split(".");Ll(n,s)&&(r=n[1],xr.call(t,`${s}.remove`,Il,[s,r],t),e.skipEvent())}}))},function(t,e,i){var s=i.name;e.on("-",(function(i){e.skipEventFlag||i===s&&(xr.call(t,`${s}.removeall`,Dl,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],xr.call(t,`${s}.call`,jl,[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&&Al[t[3]]})(c,s)&&(h=c[1],l=c[2],d=c[3],"number"==typeof a&&(o=a,a=void 0),xr.call(t,`${s}.ease`,zl,[s,h,l,r,n,a,o,d],t),e.skipEvent())}}))}],Yl=Wo.addGameObjectManager;var Xl={addGameObjectManager(t,e){(t=t?Ve(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},Yl.call(this,t,e);for(var n=t.parseCallbacks,a=0,o=(n=n?[...n,...Fl]:Fl).length;a0)return nd.length=0,!0;return nd.length=0,!1},nd=[],ad=void 0;const od=Phaser.Utils.Objects.GetValue;var hd=function(t,e,i){var s,r;for(var n in void 0===i&&(i={}),t)s=t[n],void 0!==(r=od(e,n,s[1]))&&(i[s[0]]=r);return i},ld=function(t){t.addEventListener("touchstart",dd,!1),t.addEventListener("touchmove",dd,!1),t.addEventListener("touchend",dd,!1),t.addEventListener("mousedown",dd,!1),t.addEventListener("mouseup",dd,!1),t.addEventListener("mousemove",dd,!1)},dd=function(t){t.stopPropagation()},cd=function(){return this.close(),this.emit("keydown-ENTER",this.parent,this),this},ud=function(){this.isOpened=!0,this.initText(),this.enterCloseEnable&&this.scene.input.keyboard.once("keydown-ENTER",cd,this),this.scene.sys.events.on("postupdate",this.updateText,this),this.clickOutSideTarget?(xa.call(this.clickOutSideTarget,this.parent),ba.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)},pd=function(){this.isOpened=!1,this.updateText(),this.enterCloseEnable&&this.scene.input.keyboard.off("keydown-ENTER",cd,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 gd=Phaser.Utils.Objects.GetValue;var vd=function(t,e){var i,s=gd(e,"inputType",void 0);void 0===s&&(s=gd(e,"type","text")),"textarea"===s?(i=document.createElement("textarea")).style.resize="none":(i=document.createElement("input")).type=s;var r=gd(e,"style",void 0),n=i.style;hd(ed,r,n),n.position="absolute",n.opacity=0,n.pointerEvents="none",n.zIndex=0,n.transform="scale(0)",hd(td,e,i),ld(i);var a=t.scene.sys.scale;return(a.isFullscreen?a.fullscreenTarget:document.body).appendChild(i),i.addEventListener("focus",(function(e){ud.call(t)})),i.addEventListener("blur",(function(e){pd.call(t)})),i},fd={open:function(){return this.isOpened||this.readOnly||((t=this)!==ad&&(void 0!==ad&&ad.close(),ad=t),this.node||(this.node=vd(this,this.nodeConfig)),this.setFocus()),this;var t},close:function(){return this.isOpened?(this===ad&&(ad=void 0),this.setBlur(),this):this}};const md=Phaser.Utils.Objects.GetValue;class yd extends Ra{constructor(t,e){super(t);var i=md(e,"inputType",void 0);void 0===i&&(i=md(e,"type","text")),this.setEnterCloseEnable(md(e,"enterClose","textarea"!==i));var s=md(e,"onOpen",void 0);s||(s=md(e,"onFocus",void 0)),this.onOpenCallback=s,this.clickOutSideTarget=md(e,"clickOutSideTarget",void 0);var r=md(e,"onClose",void 0);r||(r=md(e,"onBlur",void 0)),this.onCloseCallback=r,this.onUpdateCallback=md(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 id(t,e,"inputType"),id(t,e,"type"),id(t,e,"style"),id(t,e,ed),id(t,e,td),e}(e),this.node=void 0}destroy(){this.close(),this.clickOutSideTarget&&this.clickOutSideTarget.destroy(),super.destroy()}onClickOutside(t){sd(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(yd.prototype,fd);var bd=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},xd=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)):(xd(this),Cd(this)),this}setNumberInput(){return this.onUpdateCallback=bd,this}setSelectAllWhenFocusEnable(t){return void 0===t&&(t=!0),this.selectAllWhenFocus=t,this}setRequestCursorPosition(t){return this.isOpened?(this.requestCursorPosition=t,this):this}};const Sd=Phaser.Utils.Objects.GetValue,Pd=["inputType","onOpen","clickOutSideTarget","onFocus","onClose","onBlur","onUpdate","enterClose","readOnly","maxLength","minLength","selectAll"];var Td=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 Ed=Phaser.GameObjects.Zone;let _d=class extends Ed{constructor(t){super(t,0,0,2,2),this.fullWindow=new Md(this)}};var Rd=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},Ld=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)},Bd=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}Ad.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(zd(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 Fd=new Ad,Yd=/^[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,Xd=/\S/,Wd=new Ad;Wd.equals=function(t,e){return this.options.ignoreCase&&(t=t.toLowerCase(),e=e.toLowerCase()),t===e||this.options.ignoreWhitespace&&!Xd.test(t)&&!Xd.test(e)},Wd.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(Ud(t,null,null,i),i," ")},Hd.equals=function(t,e){return Ad.prototype.equals.call(Hd,t.replace(/,([\r\n])/g,"$1"),e.replace(/,([\r\n])/g,"$1"))};const Nd=new Ad;Nd.tokenize=function(t){return t.slice()},Nd.join=Nd.removeEmpty=function(t){return t};const $d=Phaser.Utils.Array.Remove;var Kd=function(t,e){var i=t.text;if(e!==i){if(null==i&&(i=""),$d(t.children,t.lastInsertCursor),""===e)t.removeChildren();else for(var s=(h=i,l=e,Fd.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},tc={cursorMoveLeft(){if(!this.isOpened)return this;var t=qd(this.cursorPosition-1,0,this.inputText.length);return this.setCursorPosition(t),this},cursorMoveRight(){if(!this.isOpened)return this;var t=qd(this.cursorPosition+1,0,this.inputText.length);return this.setCursorPosition(t),this},cursorMoveUp(){if(!this.isOpened)return this;var t=Zd(this.characterCountOfLines,this.cursorPosition);t.lineIndex-=1;var e=qd(Qd(this.characterCountOfLines,t),0,this.inputText.length);return this.setCursorPosition(e),this},cursorMoveDown(){if(!this.isOpened)return this;var t=Zd(this.characterCountOfLines,this.cursorPosition);t.lineIndex+=1;var e=qd(Qd(this.characterCountOfLines,t),0,this.inputText.length);return this.setCursorPosition(e),this}};const ec=Phaser.Utils.Objects.IsPlainObject;class ic extends hn{constructor(t,e,i,s,r,n){ec(e)?n=e:ec(s)&&(n=s),void 0===n&&(n={}),function(t,e){var i=!e.textArea;if(Td(e,"wrap.vAlign")||P(e,"wrap.vAlign",s=i?"center":"top"),Td(e,"wrap.wrapMode")||P(e,"wrap.wrapMode","char"),Td(e,"wrap.maxLines")||P(e,"wrap.maxLines",s=i?1:void 0),i&&P(e,"wrap.wrapWidth",1/0),Td(e,"wrap.useDefaultTextHeight")||P(e,"wrap.useDefaultTextHeight",!0),e.edit||(e.edit={}),!Td(e.edit,"inputType")){var s=i?"text":"textarea";P(e.edit,"inputType",s)}if(!0===e.clickOutSideTarget){var r=new _d(t);t.add.existing(r),e.clickOutSideTarget=r}}(t,n);var a=n.text;a&&delete n.text;var o=Rd(n.background,"focus"),h=Rd(n.style,"cursor");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=Sd(e,"edit");return void 0===i&&(i={}),id(e,i,Pd),new wd(t,i)}(this,n),Ld.call(this),n.focusStyle&&Object.assign(o,n.focusStyle),jd.call(this,o),n.cursorStyle&&Object.assign(h,n.cursorStyle),Dd.call(this,h);var l=n.onAddChar;l&&this.on("addchar",l);var d=n.onCursorOut;d&&this.on("cursorout",d);var c=n.onCursorIn;c&&this.on("cursorin",c);var u,p=n.onMoveCursor;p&&this.on("movecursor",p),this.setParseTextCallback(n.parseTextCallback),this.lastInsertCursor=((u=this.createCharChild("|")).text="",u),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=$c(t,"tl",0),this.radiusTR=$c(t,"tr",0),this.radiusBL=$c(t,"bl",0),this.radiusBR=$c(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?Rt(e,e,e,e,180,270,!1,r,t):Rt(0,0,e,e,90,0,!0,r,t):Et(0,0,t),(e=this.radiusTR)>0?this._convexTR?Rt(i-e,e,e,e,270,360,!1,r,t):Rt(i,0,e,e,180,90,!0,r,t):Et(i,0,t),(e=this.radiusBR)>0?this._convexBR?Rt(i-e,s-e,e,e,0,90,!1,r,t):Rt(i,s,e,e,270,180,!0,r,t):Et(i,s,t),(e=this.radiusBL)>0?this._convexBL?Rt(e,s-e,e,e,90,180,!1,r,t):Rt(0,s,e,e,360,270,!0,r,t):Et(0,s,t),t.push(t[0],t[1]),Ec(this.x,this.y,t),super.updateData(),this}}const Jc=Phaser.Renderer.WebGL.Utils.getTintAppendFloatAlpha;var qc={buildShapes(){this.addShape((new Kc).setName("box")).addShape((new Uc).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 Zc=Phaser.Utils.Objects.GetValue,Qc=Phaser.Math.Linear;class tu extends Ja{constructor(t,e){super(t,e),this.resetFromJSON(),this.boot()}start(t){if(this.timer.isRunning)return this;var e=this.target;this.propertyKey=Zc(t,"key","value");var i=e[this.propertyKey];return this.fromValue=Zc(t,"from",i),this.toValue=Zc(t,"to",i),this.setEase(Zc(t,"ease",this.ease)),this.setDuration(Zc(t,"duration",this.duration)),this.setRepeat(Zc(t,"repeat",0)),this.setDelay(Zc(t,"delay",0)),this.setRepeatDelay(Zc(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]=Qc(this.fromValue,this.toValue,i)}}var eu={setCheckerAnimationDuration(t){return void 0===t&&(t=0),this.checkerAnimDuration=t,this},playCheckerAnimation(){return void 0===this.checkerAnimProgressTask&&(this.checkerAnimProgressTask=new tu(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}},iu={};Object.assign(iu,gc,vc,qc,eu);const su=23730,ru=Phaser.Utils.Objects.GetValue,nu=Phaser.Utils.Objects.IsPlainObject;class au extends pc{constructor(t,e,i,s,r,n,a){nu(e)?(e=ru(a=e,"x",0),i=ru(a,"y",0),s=ru(a,"width",2),r=ru(a,"height",2),n=ru(a,"color",su)):nu(n)&&(n=ru(a=n,"color",su)),super(t,e,i,s,r),this.type="rexCheckbox",void 0===n&&(n=su),this.setBoxShape(ru(a,"circleBox",!1)),this.setBoxFillStyle(n,ru(a,"boxFillAlpha",1)),this.setUncheckedBoxFillStyle(ru(a,"uncheckedColor",null),ru(a,"uncheckedBoxFillAlpha",1)),this.setBoxStrokeStyle(ru(a,"boxLineWidth",4),ru(a,"boxStrokeColor",n),ru(a,"boxStrokeAlpha",1)),this.setUncheckedBoxStrokeStyle(this.boxLineWidth,ru(a,"uncheckedBoxStrokeColor",this.boxStrokeColor),ru(a,"uncheckedBoxStrokeAlpha",this.boxStrokeAlpha)),this.setCheckerStyle(ru(a,"checkerColor",16777215),ru(a,"checkerAlpha",1)),this.setBoxSize(ru(a,"boxSize",1)),this.setCheckerSize(ru(a,"checkerSize",1)),this.setCheckerAnimationDuration(ru(a,"animationDuration",150)),this.buildShapes();var o=ru(a,"checked");void 0===o&&(o=ru(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(au.prototype,iu);const ou=Phaser.Utils.Objects.GetValue;class hu extends Ra{constructor(t,e){super(t,e),this._enable=void 0,t.setInteractive(ou(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(ou(t,"enable",!0)),this.setMode(ou(t,"mode",1)),this.setClickInterval(ou(t,"clickInterval",100)),this.setDragThreshold(ou(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=lu[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 lu={press:0,pointerdown:0,release:1,pointerup:1},du=Phaser.Utils.Objects.GetValue,cu=Phaser.Utils.Objects.IsPlainObject;class uu extends au{constructor(t,e,i,s,r,n,a){cu(e)?(e=du(a=e,"x",0),i=du(a,"y",0),s=du(a,"width",2),r=du(a,"height",2),n=du(a,"color",su)):cu(n)&&(n=du(a=n,"color",su)),super(t,e,i,s,r,n,a),this._click=new hu(this,du(a,"click")),this._click.on("click",(function(){this.toggleValue()}),this),this.setReadOnly(du(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 uu(this.scene,t,e,i,s,r,n);return this.scene.add.existing(a),a})),P(window,"RexPlugins.UI.Checkbox",uu);var pu={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}},gu={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}},vu={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}},fu=function(t,e,i){return(e-t)*i+t};const mu=Phaser.Math.Linear;var yu={buildShapes(){this.addShape((new Kc).setName("track")).addShape((new Kc).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&fu(mn(l),mn(d),c))<<16|(255&fu(yn(l),yn(d),c))<<8|255&fu(bn(l),bn(d),c)),p=mu(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=mu(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)}},bu={setToggleAnimationDuration(t){return void 0===t&&(t=0),this.toggleAnimDuration=t,this},playToggleAnimation(){return void 0===this.toggleAnimProgressTask&&(this.toggleAnimProgressTask=new tu(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}},xu={};Object.assign(xu,pu,gu,vu,yu,bu);const Cu=Phaser.Utils.Objects.GetValue,ku=Phaser.Utils.Objects.IsPlainObject,wu=23730;class Su extends pc{constructor(t,e,i,s,r,n,a){ku(e)?(e=Cu(a=e,"x",0),i=Cu(a,"y",0),s=Cu(a,"width",2),r=Cu(a,"height",2),n=Cu(a,"color",wu)):ku(n)&&(n=Cu(a=n,"color",wu)),super(t,e,i,s,r),this.type="rexToggleSwitch",void 0===n&&(n=wu),this.setTrackFillStyle(n,Cu(a,"trackFillAlpha",1)),this.setFalseValueTrackFillStyle(Cu(a,"falseValueTrackColor",function(t){var e=.3*mn(t)+.59*yn(t)+.11*bn(t);return(255&e)<<16|(255&e)<<8|255&e}(n)),Cu(a,"falseValueTrackFillAlpha",1)),this.setThumbStyle(Cu(a,"thumbColor",16777215),Cu(a,"thumbAlpha",1)),this.setTrackSize(Cu(a,"trackWidth",.9),Cu(a,"trackHeight",.5)),this.setTrackRadius(Cu(a,"trackRadius",.5*this.trackHeight));var o=Cu(a,"thumbHeight",void 0),h=Cu(a,"thumbWidth",o);void 0===h&&(h=.9*this.trackHeight),this.setThumbSize(h,o),this.setThumbRadius(Cu(a,"thumbRadius",.5*this.thumbHeight)),this.setThumbPosition(Cu(a,"thumbLeft",.3),Cu(a,"thumbRight",void 0)),this.setRTL(Cu(a,"rtl",!1)),this.setToggleAnimationDuration(Cu(a,"animationDuration",150)),this.buildShapes(),this.setValue(Cu(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(Su.prototype,xu);const Pu=Phaser.Utils.Objects.GetValue;class Tu extends Su{constructor(t,e,i,s,r,n,a){super(t,e,i,s,r,n,a),this._click=new hu(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("toggleSwitch",(function(t,e,i,s,r,n){var a=new Tu(this.scene,t,e,i,s,r,n);return this.scene.add.existing(a),a})),P(window,"RexPlugins.UI.ToggleSwitch",Tu);var Ou={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 Mu extends Nt{}Object.assign(Mu.prototype,Ou),t.register("canvas",(function(t,e,i,s){var r=new Mu(this.scene,t,e,i,s);return this.scene.add.existing(r),r})),P(window,"RexPlugins.UI.Canvas",Mu);const Eu=Phaser.Utils.Objects.GetValue;class _u extends Nt{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=Eu(i,"maskType",0),r=Eu(i,"backgroundColor",void 0),n=Eu(i,"strokeColor",void 0),a=Eu(i,"strokeWidth",null!=n?10:0);if(void 0===s?s=0:"string"==typeof s&&(s=Ru[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=Eu(i,"radius",0),f=Eu(i,"iteration",void 0);Zt(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 Ru={circle:0,ellipse:1,roundRectangle:2};t.register("circleMaskImage",(function(t,e,i,s,r){var n=new _u(this.scene,t,e,i,s,r);return this.scene.add.existing(n),n})),P(window,"RexPlugins.UI.CircleMaskImage",_u);const Lu=Phaser.Utils.Objects.GetValue;class Bu extends Nt{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=Lu(i,"mask.key"),r=Lu(i,"mask.frame"),n=Lu(i,"mask.invertAlpha",!1),a=Lu(i,"mask.scale"),o=Lu(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 Bu(this.scene,t,e,i,s,r);return this.scene.add.existing(n),n})),P(window,"RexPlugins.UI.AlphaMaskImage",Bu);const Iu=Phaser.Math.Linear,Du=Phaser.Math.Percent;var ju={setValue(t,e,i){return null==t||(void 0!==e&&(t=Du(t,e,i)),this.value=t),this},addValue(t,e,i){return void 0!==e&&(t=Du(t,e,i)),this.value+=t,this},getValue(t,e){var i=this.value;return void 0!==t&&(i=Iu(t,e,i)),i}};const Au=Phaser.Math.Percent;var zu={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=Au(t,e,i)),void 0===this.easeValueTask&&(this.easeValueTask=new tu(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 tu(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 Fu=Phaser.Utils.Objects.GetValue,Yu=Phaser.Math.Clamp;function Xu(t){class e extends t{bootProgressBase(t){this.eventEmitter=Fu(t,"eventEmitter",this);var e=Fu(t,"valuechangeCallback",null);if(null!==e){var i=Fu(t,"valuechangeCallbackScope",void 0);this.eventEmitter.on("valuechange",e,i)}return this.setEaseValuePropName("value").setEaseValueDuration(Fu(t,"easeValue.duration",0)).setEaseValueFunction(Fu(t,"easeValue.ease","Linear")),this}get value(){return this._value}set value(t){t=Yu(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,ju,zu),e}const Wu=Phaser.Math.RadToDeg,Vu=Phaser.Math.DegToRad;var Gu=function(t,e,i,s,r,n,a,o){var h=360===Math.abs(a-n),l=Vu(n),d=Vu(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},Hu={buildShapes(){var t=this.iterations;this.addShape((new Uc).setIterations(t).setName("track")).addShape((new Uc).setIterations(t).setName("bar")).addShape((new kc).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),Gu(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=Wu(this.startAngle),o=360*(n?1-this.value:this.value)+a),h.fillStyle(this.barColor),Gu(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 Uu=Phaser.Utils.Objects.GetValue,Nu=Phaser.Utils.Objects.IsPlainObject,$u=Phaser.Math.Clamp,Ku=Phaser.Math.DegToRad(270);let Ju=class extends(Xu(pc)){constructor(t,e,i,s,r,n,a){Nu(e)&&(e=Uu(a=e,"x",0),i=Uu(a,"y",0),s=Uu(a,"radius",1),r=Uu(a,"barColor",void 0),n=Uu(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(Uu(a,"trackColor",void 0)),this.setBarColor(r),this.setCenterColor(Uu(a,"centerColor",void 0)),this.setThickness(Uu(a,"thickness",.2)),this.setStartAngle(Uu(a,"startAngle",Ku)),this.setAnticlockwise(Uu(a,"anticlockwise",!1)),this.iterations=Uu(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=$u(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(Ju.prototype,Hu),t.register("circularProgress",(function(t,e,i,s,r,n){var a=new Ju(this.scene,t,e,i,s,r,n);return this.scene.add.existing(a),a})),P(window,"RexPlugins.UI.CircularProgress",Ju);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 Zu=Phaser.Math.PI2;var Qu=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+Zu)%Zu:(o+l*this.value)%Zu,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 tp=Phaser.Utils.Objects.GetValue,ep=Phaser.Utils.Objects.IsPlainObject,ip=Phaser.Math.Clamp,sp=Phaser.Math.DegToRad(270),rp=Phaser.Math.PI2;class np extends(Xu(Nt)){constructor(t,e,i,s,r,n,a){ep(e)&&(e=tp(a=e,"x",0),i=tp(a,"y",0),s=tp(a,"radius",1),r=tp(a,"barColor",void 0),n=tp(a,"value",0));var o=2*s;super(t,e,i,o,o,tp(a,"resolution",1)),this.type="rexCircularProgressCanvas",this.bootProgressBase(a),this.setRadius(s),this.setTrackColor(tp(a,"trackColor",void 0)),this.setBarColor(r),this.setBarColor2(tp(a,"barColor2",void 0)),this.setCenterColor(tp(a,"centerColor",void 0)),this.setThickness(tp(a,"thickness",.2)),this.setStartAngle(tp(a,"startAngle",sp)),this.setEndAngle(tp(a,"endAngle",this.startAngle+rp)),this.setAnticlockwise(tp(a,"anticlockwise",!1)),this.setTextColor(tp(a,"textColor",void 0)),this.setTextStrokeColor(tp(a,"textStrokeColor",void 0),tp(a,"textStrokeThickness",void 0));var h=tp(a,"textFont",void 0);h?this.setTextFont(h):this.setTextFont(tp(a,"textSize","16px"),tp(a,"textFamily","Courier"),tp(a,"textStyle","")),this.setTextFormatCallback(tp(a,"textFormatCallback",void 0),tp(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=Jt(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=Jt(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=Jt(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=ap(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=ap(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=ap(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=ip(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=Jt(t,this.canvas,this.context),this.dirty=this.dirty||this._centerColor!=t,this._centerColor=t}get centerColor2(){return this._centerColor2}set centerColor2(t){t=Jt(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=Jt(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=Jt(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(),Qu.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 ap=function(t,e,i){return i?t<=e?rp+t-e:t-e:t>=e?rp+e-t:e-t};t.register("circularProgressCanvas",(function(t,e,i,s,r,n){var a=new np(this.scene,t,e,i,s,r,n);return this.scene.add.existing(a),a})),P(window,"RexPlugins.UI.CircularProgressCanvas",np);var op=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};const hp=Phaser.Utils.Objects.GetValue,lp=Phaser.Utils.Objects.IsPlainObject;let dp=class extends(Xu(pc)){constructor(t,e,i,s,r,n,a,o){lp(e)?(e=hp(o=e,"x",0),i=hp(o,"y",0),s=hp(o,"width",2),r=hp(o,"height",2),n=hp(o,"barColor",void 0),a=hp(o,"value",0)):lp(s)?(s=hp(o=s,"width",2),r=hp(o,"height",2),n=hp(o,"barColor",void 0),a=hp(o,"value",0)):lp(n)&&(n=hp(o=n,"barColor",void 0),a=hp(o,"value",0)),super(t,e,i,s,r,o),this.type="rexLineProgress",this.bootProgressBase(o),this.addShape((new Uc).setName("trackFill")).addShape((new Uc).setName("bar")).addShape((new Uc).setName("trackStroke")),this.setTrackColor(hp(o,"trackColor",void 0)),this.setBarColor(n),this.setTrackStroke(hp(o,"trackStrokeThickness",2),hp(o,"trackStrokeColor",void 0)),this.setSkewX(hp(o,"skewX",0)),this.setRTL(hp(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 cp={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&&op(s,0,0,e,i,t).close();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),op(a,r,0,n,i,t).close());var o=this.getShape("trackStroke");o.lineStyle(this.trackStrokeThickness,this.trackStrokeColor),o.isStroked&&op(o,0,0,e,i,t).end()}};Object.assign(dp.prototype,cp),t.register("lineProgress",(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.LineProgress",dp);var up=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(),up(0,n,this.trackPoints,void 0,this.trackStrokeColor,this.trackStrokeThickness),n.restore())},gp=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 vp=Phaser.Utils.Objects.GetValue,fp=Phaser.Utils.Objects.IsPlainObject;class mp extends(Xu(Nt)){constructor(t,e,i,s,r,n,a,o){fp(e)?(e=vp(o=e,"x",0),i=vp(o,"y",0),s=vp(o,"width",2),r=vp(o,"height",2),n=vp(o,"barColor",void 0),a=vp(o,"value",0)):fp(s)?(s=vp(o=s,"width",2),r=vp(o,"height",2),n=vp(o,"barColor",void 0),a=vp(o,"value",0)):fp(n)&&(n=vp(o=n,"barColor",void 0),a=vp(o,"value",0)),super(t,e,i,s,r,vp(o,"resolution",1)),this.type="rexLineProgressCanvas",this.trackPoints=[],this.barPoints=[],this.bootProgressBase(o),this.setTrackColor(vp(o,"trackColor",void 0)),this.setBarColor(n,vp(o,"barColor2",void 0),vp(o,"isHorizontalGradient",void 0)),this.setTrackStroke(vp(o,"trackStrokeThickness",2),vp(o,"trackStrokeColor",void 0)),this.setSkewX(vp(o,"skewX",0)),this.setRTL(vp(o,"rtl",!1)),this.setValue(a)}get trackColor(){return this._trackColor}set trackColor(t){t=Jt(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=Jt(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=Jt(t,this.canvas,this.context),this.dirty=this.dirty||this._barColor!=t,this._barColor=t}get barColor2(){return this._barColor2}set barColor2(t){t=Jt(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(),pp.call(this)}),this),this}}t.register("circularProgressCanvas",(function(t,e,i,s,r,n,a){var o=new mp(this.scene,t,e,i,s,r,n,a);return this.scene.add.existing(o),o})),P(window,"RexPlugins.UI.LineProgressCanvas",mp),Phaser.Math.Wrap;const yp=Phaser.Math.Linear;var bp=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=yp(b.a.x,x.a.x,C),e=yp(b.a.y,x.a.y,C),i=yp(b.b.x,x.b.x,C),s=yp(b.b.y,x.b.y,C),r=yp(b.c.x,x.c.x,C),n=yp(b.c.y,x.c.y,C)}a.startAt(t,e).lineTo(i,s).lineTo(r,n),this.arrowOnly?a.end():a.close()};const xp=(0,Phaser.Math.DegToRad)(120);var Cp=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+xp),i+s*Math.sin(r+xp)).lineTo(e+s*Math.cos(r),i+s*Math.sin(r)).lineTo(e+s*Math.cos(r-xp),i+s*Math.sin(r-xp)),this.arrowOnly?t.end():t.close()},kp={buildShapes(){this.addShape((new Uc).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?bp.call(this):Cp.call(this)}},wp={setEaseDuration(t){return void 0===t&&(t=0),this.easeDuration=t,this},playEaseDirectionation(){return void 0===this.easeDirectionProgressTask&&(this.easeDirectionProgressTask=new tu(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 Sp=Phaser.Utils.Objects.GetValue,Pp=Phaser.Utils.Objects.IsPlainObject,Tp=Phaser.Math.DegToRad,Op=Phaser.Math.RadToDeg;class Mp extends pc{constructor(t,e,i,s,r,n,a){var o,h,l,d,c,u,p,g;if(Pp(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=Sp(r,"x",null);null!==n?(t=n,i=n):(t=Sp(r,"left",0),i=Sp(r,"right",t));var a=Sp(r,"y",null);null!==a?(e=a,s=a):(e=Sp(r,"top",0),s=Sp(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 Op(this.verticeRotation)}set verticeAngle(t){this.verticeRotation=Tp(t)}setVerticeAngle(t){return this.verticeAngle=t,this}}const Ep={right:0,down:1,left:2,up:3};var _p=function(t){return"string"==typeof t&&(t=Ep[t]),t%=4};Object.assign(Mp.prototype,kp,wp),t.register("triangle",(function(t,e,i,s,r,n){var a=new Mp(this.scene,t,e,i,s,r,n);return this.scene.add.existing(a),a})),P(window,"RexPlugins.UI.Triangle",Mp),F();const Rp=Phaser.GameObjects.Zone,Lp=Phaser.Utils.Array.Add,Bp=Phaser.Utils.Array.Remove;let Ip=class extends Rp{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 Lp(this.children,t,0,(function(t){t.once("destroy",e.onChildDestroy,e)}),this),this}remove(t,e){var i=this;return Bp(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;iYp(t),resetChildState(t){return this.resetChildPositionState(t).resetChildVisibleState(t).resetChildAlphaState(t).resetChildActiveState(t),this},resetChildrenState(t){for(var e=0,i=t.length;eYp(t).x,getChildLocalY:t=>Yp(t).y};const ig=Phaser.Math.DegToRad;var sg={updateChildRotation(t){var e=Yp(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=Yp(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 Yp(t).rotation=e,this.updateChildRotation(t),this},setChildLocalAngle(t,e){return Yp(t).rotation=ig(e),this.updateChildRotation(t),this},resetLocalRotationState(){var t=Yp(this).parent;return t&&t.resetChildRotationState(this),this},getChildLocalRotation:t=>Yp(t).rotation},rg={updateChildScale(t){var e=Yp(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=Yp(t),i=e.parent;return e.scaleX=tg(t.scaleX,i.scaleX),e.scaleY=tg(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=Yp(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=Yp(this).parent;return t&&t.resetChildScaleState(this),this},getChildLocalScaleX:t=>Yp(t).scaleX,getChildLocalScaleY:t=>Yp(t).scaleY},ng={updateChildVisible(t){var e=Yp(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=Yp(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),Yp(t).visible=e,this.updateChildVisible(t),this},setChildMaskVisible(t,e){return void 0===e&&(e=!0),Yp(t).maskVisible=e,this.updateChildVisible(t),this},resetLocalVisibleState(){var t=Yp(this).parent;return t&&t.resetChildVisibleState(this),this},getChildLocalVisible:t=>Yp(t).visible},ag={updateChildAlpha(t){var e=Yp(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=Yp(t),i=e.parent;return e.alpha=tg(t.alpha,i.alpha),this},setChildAlpha(t,e){return t.alpha=e,this.resetChildAlphaState(t),this},setChildLocalAlpha(t,e){return Yp(t).alpha=e,this.updateChildAlpha(t),this},resetLocalAlphaState(){var t=Yp(this).parent;return t&&t.resetChildAlphaState(this),this},getChildLocalAlpha:t=>Yp(t).alpha},og={updateChildActive(t){var e=Yp(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 Yp(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),Yp(t).active=e,this.updateChildActive(t),this},resetLocalActiveState(){var t=Yp(this).parent;return t&&t.resetChildActiveState(this),this},getChildLocalActive:t=>Yp(t).active},hg={updateChildScrollFactor(t){var e=Yp(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}},lg={updateCameraFilter(t){var e=Yp(t),i=e.parent;return e.syncCameraFilter&&(t.cameraFilter=i.cameraFilter),this},syncCameraFilter(){return this.syncChildrenEnable&&this.children.forEach(this.updateCameraFilter,this),this}},dg={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}},cg=function(t){return t.filter((function(t){return!!t.displayList||!!t.parentContainer||void 0}))},ug={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}},pg=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 vg=Phaser.Utils.Array;var fg={getChildren(t){if(t)for(var e=0,i=this.children.length;e=0;e--)this.remove(this.backgroundChildren[e],t);return this}},Ov=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 Mv=/(\S+)\[(\d+)\]/i;var Ev={getInnerPadding(t){return Ps(this.space,t)},setInnerPadding(t,e){return Ts(this.space,t,e),this},getOuterPadding(t){return Ps(this.getSizerConfig(this).padding,t)},setOuterPadding(t,e){return Ts(this.getSizerConfig(this).padding,t,e),this},getChildOuterPadding(t,e){return"string"==typeof t&&(t=this.getElement(t)),Ps(this.getSizerConfig(t).padding,e)},setChildOuterPadding(t,e,i){return"string"==typeof t&&(t=this.getElement(t)),Ts(this.getSizerConfig(t).padding,e,i),this}},_v=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}},Rv=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},Lv=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},Bv=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}},Iv=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},Dv=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},jv={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}},Av=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 Jf={delayCall(t,e,i){return this.delayCallTimer=function(t,e,i,s,r){var n=Ea(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}},qf={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}},Zf={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}},Qf={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}},tm={};Object.assign(tm,Jf,qf,Zf,Qf);const em=Phaser.Utils.Objects.GetValue;class im extends Ra{constructor(t,e){super(t,e),this.setTransitInTime(em(e,"duration.in",200)),this.setTransitOutTime(em(e,"duration.out",200)),this.setTransitInCallback(em(e,"transitIn")),this.setTransitOutCallback(em(e,"transitOut")),this.oneShotMode=em(e,"destroy",!1),this.delayCallTimer=void 0,this._state=new Kf(this,{eventEmitter:!1,initState:em(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(im.prototype,tm);const sm=Phaser.GameObjects.Rectangle;class rm extends sm{constructor(t,e,i){super(t,0,0,2,2,e,1),this.fullWindow=new Md(this),this.setAlpha(i)}get tint(){return this.fillColor}set tint(t){this.setFillStyle(t,this.fillAlpha)}}const nm=Phaser.Utils.Objects.GetValue;class am extends Ra{constructor(t,e){super(t,{eventEmitter:!1}),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setHitAreaMode(nm(t,"hitAreaMode",0)),this.setEnable(nm(t,"enable",!0)),this.setStopMode(nm(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 hm=Phaser.Utils.Objects.GetValue;class lm extends rm{constructor(t,e){super(t,hm(e,"color",0),hm(e,"alpha",.8)),this.touchEventStop=new am(this,{hitAreaMode:1})}}var dm={popUp(t,e){void 0!==t._modalScaleSave?(t.scaleX=t._modalScaleSave,t.scaleY=t._modalScaleSave):t._modalScaleSave=t.scaleX,Zv(t,e)},scaleDown(t,e){Qv(t,e,void 0,void 0,!1)},fadeIn(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,df(t,e)},fadeOut(t,e){cf(t,e,!1)}},cm=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,df(t,e,t.alpha)},um=function(t,e){cf(t,e,!1)},pm=function(t,e,i,s,r){return!(!t||s&&!s(t,e,i)||!Wn(t,!0).contains(e,i)||r&&!r(t,e,i))};const gm=Phaser.Utils.Objects.GetValue;let vm=class extends im{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=fm.popUp),null==e.transitOut&&(e.transitOut=fm.scaleDown),e.destroy=gm(e,"destroy",!0),super(t,e);var i=gm(e,"cover");this.cover=!1!==i?function(t,e){var i=t.scene,s=new lm(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(gm(i,"transitIn",cm)),this.setCoverTransitOutCallback(gm(i,"transitOut",um)));var s=gm(e,"touchOutsideClose",!1),r=gm(e,"duration.hold",-1),n=gm(e,"timeOutClose",r>=0),a=gm(e,"anyTouchClose",!1);gm(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),gm(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&&pm(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=fm[t]),t){case fm.popUp:t=dm.popUp;break;case fm.fadeIn:t=dm.fadeIn}return super.setTransitInCallback(t),this}setTransitOutCallback(t){switch("string"==typeof t&&(t=fm[t]),t){case fm.scaleDown:t=dm.scaleDown;break;case fm.fadeOut:t=dm.fadeOut}return super.setTransitOutCallback(t),this}setCoverTransitInCallback(t){return this.coverTransitInCallback=t,this}setCoverTransitOutCallback(t){return this.coverTransitOutCallback=t,this}};const fm={popUp:0,fadeIn:1,scaleDown:0,fadeOut:1};var mm=function(t,e){var i=new vm(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},ym=function(t,e){t.emit("modal.requestClose",e)},bm=function(t){return t&&"function"==typeof t},xm={modal(t,e){return bm(t)&&(e=t,t=void 0),void 0===this._modalBehavior&&(this.onCreateModalBehavior&&this.onCreateModalBehavior(this,t),this._modalBehavior=mm(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 ym(this,t),this}},Cm=function(t,e,i,s,r){bm(e)&&(r=s,s=i,i=e,e=this);var n=this.scene.events;return this.bindEvent(e,n,t,i,s,r),this},km={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 Cm.call(this,"preupdate",t,e,i,s),this},bindSceneUpdateEvent(t,e,i,s){return Cm.call(this,"update",t,e,i,s),this},bindScenePostupdateEvent(t,e,i,s){return Cm.call(this,"postupdate",t,e,i,s),this},bindSceneRenderEvent(t,e,i,s){return Cm.call(this,"render",t,e,i,s),this},bindScenePauseEvent(t,e,i,s){return Cm.call(this,"pause",t,e,i,s),this},bindSceneResumeEvent(t,e,i,s){return Cm.call(this,"resume",t,e,i,s),this},bindSceneSleepEvent(t,e,i,s){return Cm.call(this,"sleep",t,e,i,s),this},bindSceneWakeEvent(t,e,i,s){return Cm.call(this,"wake",t,e,i,s),this},bindSceneShutdownEvent(t,e,i,s){return Cm.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=Sm),s===e?(i.x=t.worldX,i.y=t.worldY):s.getWorldPoint(t.x,t.y,i),i):null},Sm={},Pm=function(t,e,i,s){var r,n=t.scene.sys.cameras.main,a=0===t.scrollFactorX&&0===t.scrollFactorY;if(e)return a?pm(t,e.x,e.y,i,s):!!(r=wm(e,n,!0))&&pm(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 zm={press:0,pointerdown:0,release:1,pointerup:1};var Fm={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 Am(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 Ym extends $f{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 Xm=Phaser.Utils.Objects.GetValue;class Wm extends Ra{constructor(t,e){super(t,e),this._enable=void 0,this.cooldown=new Ym,this.parent.setInteractive(Xm(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.prevIsInTouch=!1,this.isInTouching=!1,this.setEnable(Xm(t,"enable",!0)),this.setCooldown(Xm(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 Vm={isPointerInBounds(t){return void 0===t?t=this:"string"==typeof t&&(t=this.getElement(t)),!!t&&Pm(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 Wm(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 Wm(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}},Gm={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}},Hm=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===hy&&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=ly,this}isPointerInGameObject(t,e,i){var s=this.lastPointer;return!!s&&Pm(t,s,e,i)}}const oy=0,hy=1,ly="IDLE",dy=Phaser.Utils.Objects.GetValue,cy=Phaser.Math.Distance.Between;class uy extends ay{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=py},eventEmitter:!1};this.setRecongizedStateObject(new $f(s))}resetFromJSON(t){super.resetFromJSON(t),this.setHoldTime(dy(t,"time",250)),this.setTapInterval(dy(t,"tapInterval",200)),this.setDragThreshold(dy(t,"threshold",9)),this.setTapOffset(dy(t,"tapOffset",10));var e=dy(t,"taps",void 0);return void 0!==e?this.setTaps(e):(this.setMaxTaps(dy(t,"maxTaps",void 0)),this.setMinTaps(dy(t,"minTaps",void 0))),this}onDragStart(){switch(this.state){case py:this.state=gy;break;case gy:var t=this.lastPointer;cy(t.upX,t.upY,t.x,t.y)>this.tapOffset&&(this.state=vy,this.state=gy);break;case vy:this.state=gy}}onDragEnd(){this.state===gy&&(this.tapsCount++,this.emit("tapping",this,this.gameObject,this.lastPointer),void 0!==this.maxTaps&&this.tapsCount===this.maxTaps&&(this.state=vy))}onDrag(){this.state!==py&&this.pointer.getDistance()>this.dragThreshold&&(this.state=py)}preUpdate(t,e){if(this.isRunning&&this.enable&&this.state===gy){var i=this.lastPointer;i.isDown?t-i.downTime>this.holdTime&&(this.state=py):t-i.upTime>this.tapInterval&&(void 0===this.minTaps||this.tapsCount>=this.minTaps?this.state=vy:this.state=py)}}postUpdate(t,e){this.isRunning&&this.enable&&this.state===vy&&(this.state=py)}get isTapped(){return this.state===vy}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 py="IDLE",gy="BEGIN",vy="RECOGNIZED",fy=Phaser.Utils.Objects.GetValue;class my extends ay{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=yy},eventEmitter:!1};this.setRecongizedStateObject(new $f(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(fy(t,"threshold",9)),this.setHoldTime(fy(t,"time",251)),this}onDragStart(){this.state=by,0===this.holdTime&&(this.state=xy)}onDragEnd(){this.state=yy}onDrag(){this.state!==yy&&this.pointer.getDistance()>this.dragThreshold&&(this.state=yy)}preUpdate(t,e){this.isRunning&&this.enable&&this.state===by&&t-this.pointer.downTime>=this.holdTime&&(this.state=xy)}get isPressed(){return this.state===xy}setHoldTime(t){return this.holdTime=t,this}setDragThreshold(t){return this.dragThreshold=t,this}}const yy="IDLE",by="BEGIN",xy="RECOGNIZED",Cy=Phaser.Utils.Objects.GetValue;class ky extends ay{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 $f(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(Cy(t,"threshold",10)),this}onDragStart(){this.state=Sy,0===this.dragThreshold&&(this.state=Py)}onDragEnd(){this.state=wy}onDrag(){switch(this.state){case Sy:if(this.pointer.getDistance()>=this.dragThreshold){this.state=Py,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 Py: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===Py}setDragThreshold(t){return this.dragThreshold=t,this}}const wy="IDLE",Sy="BEGIN",Py="RECOGNIZED",Ty=Phaser.Math.Distance.Between,Oy=Phaser.Math.Angle.Between;var My={getDt:function(){return rc(this.scene)},getVelocity:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Ty(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 Oy(e.x,e.y,t.x,t.y)}},Ey={"up&down":0,"left&right":1,"4dir":2,"8dir":3},_y={};const Ry=Phaser.Utils.Objects.GetValue,Ly=Phaser.Math.RadToDeg;class By extends ay{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=Iy},eventEmitter:!1};this.setRecongizedStateObject(new $f(s)),this.clearDirectionStates()}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(Ry(t,"threshold",10)),this.setVelocityThreshold(Ry(t,"velocityThreshold",1e3)),this.setDirectionMode(Ry(t,"dir","8dir")),this}onDragStart(){this.state=Dy}onDragEnd(){this.state=Iy}onDrag(){this.state===Dy&&(this.validDrag||(this.validDrag=0===this.dragThreshold||this.pointer.getDistance()>=this.dragThreshold),this.validDrag&&this.dragVelocity>this.velocityThreshold&&(this.state=jy))}postUpdate(t,e){this.isRunning&&this.enable&&this.state===jy&&(this.state=Iy)}get isSwiped(){return this.state===jy}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=Ey[t]),this.dirMode=t,this}updateDirectionStates(){return function(t,e,i){switch(void 0===i?i={}:!0===i&&(i=_y),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}}(Ly(this.getVelocityAngle()),this.dirMode,this),this}clearDirectionStates(){return this.left=!1,this.right=!1,this.up=!1,this.down=!1,this}}Object.assign(By.prototype,My);const Iy="IDLE",Dy="BEGIN",jy="RECOGNIZED",Ay=Phaser.Utils.Objects.GetValue,zy=Phaser.Utils.Array.SpliceOne,Fy=Phaser.Math.Distance.Between,Yy=Phaser.Math.Angle.Between;class Xy{constructor(t,e){var i=Ea(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(Ay(e,"inputConfig",void 0)),this.setEventEmitter(Ay(e,"eventEmitter",void 0)),this._enable=void 0,this.pointers=[],this.movedState={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setEnable(Ay(t,"enable",!0)),this.bounds=Ay(t,"bounds",void 0),this.tracerState=Vy,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 Vy:this.tracerState=Gy,this.onDrag1Start();break;case Gy:this.tracerState=Hy,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],zy(this.pointers,e),this.tracerState){case Gy:this.tracerState=Vy,this.onDrag1End();break;case Hy:this.tracerState=Gy,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 Gy:this.onDrag1();break;case Hy:this.onDrag2()}}}dragCancel(){return this.tracerState===Hy&&this.onDrag2End(),this.pointers.length=0,q(this.movedState),this.tracerState=Vy,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!==Hy)return 0;var t=this.pointers[0],e=this.pointers[1];return Fy(t.x,t.y,e.x,e.y)}get angleBetween(){if(this.tracerState!==Hy)return 0;var t=this.pointers[0],e=this.pointers[1];return Yy(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;Wy.x=e.x-i.x,Wy.y=e.y-i.y}else Wy.x=0,Wy.y=0;return Wy}get centerX(){if(this.tracerState!==Hy)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.x+e.x)/2}get centerY(){if(this.tracerState!==Hy)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.y+e.y)/2}get prevCenterX(){if(this.tracerState!==Hy)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!==Hy)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=Uy,this}isPointer0InGameObject(t,e,i){var s=this.pointers[0];return!!s&&Pm(t,s,e,i)}isPointer1InGameObject(t,e,i){var s=this.pointers[1];return!!s&&Pm(t,s,e,i)}}Object.assign(Xy.prototype,ln);var Wy={};const Vy=0,Gy=1,Hy=2,Uy="IDLE",Ny=Phaser.Utils.Objects.GetValue;class $y extends Xy{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=Ky},eventEmitter:!1};this.setRecongizedStateObject(new $f(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(Ny(t,"threshold",0)),this}onDrag2Start(){this.scaleFactor=1,this.prevDistance=this.distanceBetween,this.state=Jy,0===this.dragThreshold&&(this.state=qy)}onDrag2End(){this.state=Ky}onDrag2(){switch(this.state){case Jy: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=qy}break;case qy:t=this.distanceBetween,this.scaleFactor=t/this.prevDistance,this.emit("pinch",this),this.prevDistance=t}}get isPinched(){return this.state===qy}setDragThreshold(t){return this.dragThreshold=t,this}}const Ky="IDLE",Jy="BEGIN",qy="RECOGNIZED",Zy=Phaser.Math.RotateAround;var Qy=function(t,e,i,s){return Zy(t,e,i,s),t.rotation+=s,t},tb={};const eb=Phaser.Utils.Objects.GetValue,ib=Phaser.Math.Angle.WrapDegrees,sb=Phaser.Math.Angle.ShortestBetween,rb=Phaser.Math.RadToDeg,nb=Phaser.Math.DegToRad;class ab extends Xy{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=hb},eventEmitter:!1};this.setRecongizedStateObject(new $f(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(eb(t,"threshold",0)),this}onDrag2Start(){this.prevAngle=ib(rb(this.angleBetween)),this.state=lb,0===this.dragThreshold&&(this.state=db)}onDrag2End(){this.state=hb}onDrag2(){switch(this.state){case lb:if(this.pointers[0].getDistance()>=this.dragThreshold&&this.pointers[1].getDistance()>=this.dragThreshold){var t=ib(rb(this.angleBetween));this.angle=sb(this.prevAngle,t),this.prevAngle=t,this.state=db}break;case db:t=ib(rb(this.angleBetween)),this.angle=sb(this.prevAngle,t),this.prevAngle=t,this.emit("rotate",this)}}get isRotated(){return this.state===db}get rotation(){return nb(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=tb),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)),(d=this.getSizerConfig(t)).align=i,d.padding=gv(s),Mb(r)?(d.expandWidth=Eb(r,"width",!1),d.expandHeight=Eb(r,"height",!1)):(d.expandWidth=r,d.expandHeight=r),t.isRexSizer||(d.expandWidth&&(t.minWidth=void 0===n?An(t):n),d.expandHeight&&(t.minHeight=void 0===a?zn(t):a)),d.alignOffsetX=o,d.alignOffsetY=h,d.aspectRatio=l,this.sizerChildren.hasOwnProperty(e)&&this.sizerChildren[e].destroy(),this.sizerChildren[e]=t,c&&this.addChildrenMap(e,t),this}};const Bb=Dg.prototype.clear;var Ib=function(t){this.backgroundChildren&&(this.backgroundChildren.length=0);var e,i=!t&&this.sizerEventsEnable;if(i&&(e=this.getChildren([])),Bb.call(this,t),i)for(var s,r=0,n=e.length;r0&&(Tb.width=e.aspectRatio,Tb.height=1,Ob.width=o,Ob.height=h,o=(l=kb(Tb,Ob,"FIT",!0)).width,h=l.height),t.isRexSizer?(t.runLayout(this,o,h),Pb(t,this)):Yv(t,o,h),s=d+i.left*this.scaleX,n=u-(i.left+i.right)*this.scaleX,r=c+i.top*this.scaleY,a=p-(i.top+i.bottom)*this.scaleY,Lm.call(this,t,s,r,n,a,e.align,e.alignOffsetX,e.alignOffsetY))}};Object.assign(jb,Lb,Db);var Ab=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 zb=Phaser.Utils.Objects.IsPlainObject,Fb=Phaser.Utils.Objects.GetValue;class Yb extends Cb{constructor(t,e,i,s,r,n){zb(e)?(e=Fb(n=e,"x",0),i=Fb(n,"y",0),s=Fb(n,"width",void 0),r=Fb(n,"height",void 0)):zb(s)&&(s=Fb(n=s,"width",void 0),r=Fb(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 Ab(this.sizerChildren,t);var e=t;return this.sizerChildren.hasOwnPropery(e)?e:null}}Object.assign(Yb.prototype,jb);var Xb=Phaser.Math.Distance.Between,Wb=function(t,e,i){var s=t.width/2;return Xb(s,s,e,i)<=s};const Vb=Phaser.Math.Angle.Between,Gb=Phaser.Math.Angle.Normalize;var Hb=function(t,e,i){if(this.enable&&t.isDown){var s=this.sizerChildren.knob;if(Wb(s,e,i)){var r=s.width/2,n=s.startAngle,a=Vb(r,r,e,i),o=s.anticlockwise?n-a:a-n,h=Gb(o)/(2*Math.PI);this.stopEaseValue(),0===this.easeValueDuration||Math.abs(this.value-h)<.1?this.value=h:this.easeValueTo(h)}}},Ub=function(){this.sizerChildren.knob.on("pointerdown",Hb,this).on("pointermove",Hb,this).setInteractive()};const Nb=Phaser.Math.Angle.Between,$b=Phaser.Math.Angle.Wrap;var Kb=function(t,e,i){if(this.enable&&!this.panPointer){var s=this.sizerChildren.knob;Wb(s,e,i)&&Zb.call(this,t)}},Jb=function(t,e,i){if(this.enable&&t.isDown){var s=this.sizerChildren.knob;switch(this.panState){case ex:Wb(s,e,i)&&Zb.call(this,t);break;case ix:Wb(s,e,i)?tx.call(this):Qb.call(this)}}},qb=function(t,e,i){this.enable&&this.panPointer===t&&Qb.call(this)},Zb=function(t){this.panPointer=t,this.panState=ix},Qb=function(){this.panPointer=void 0,this.panState=ex},tx=function(){var t=this.panPointer.prevPosition,e=this.panPointer.position,i=this.sizerChildren.knob,s=Nb(i.x,i.y,t.x,t.y),r=Nb(i.x,i.y,e.x,e.y),n=i.anticlockwise?s-r:r-s,a=$b(n)/(2*Math.PI);this.stopEaseValue(),this.value+=a};const ex=0,ix=1;var sx=function(){this.sizerChildren.knob.on("pointerdown",Kb,this).on("pointermove",Jb,this).on("pointerup",qb,this).setInteractive(),this.panPointer=void 0,this.panState=ex},rx=function(t){return void 0===t&&(t=this.value),this.textFormatCallbackScope?this.textFormatCallback(t):this.textFormatCallback.call(this.textFormatCallbackScope,t)},nx={setTextFormatCallback:function(t,e){return this.textFormatCallback=t,this.textFormatCallbackScope=e,this},getFormatText:rx,updateText:function(t){var e=this.sizerChildren.text;return e&&this.textFormatCallback&&(e.setText(rx.call(this,t)),e.layout&&e.layout()),this}};const ax=Phaser.Utils.Objects.GetValue,ox=Phaser.Math.Snap.To;class hx extends(Xu(Yb)){constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexKnob",this.bootProgressBase(e);var i=ax(e,"background",void 0),s=ax(e,"text",void 0);i&&this.addBackground(i),s&&(e.textColor=void 0,e.textStrokeColor=void 0,this.setTextFormatCallback(ax(e,"textFormatCallback",void 0),ax(e,"textFormatCallbackScope",void 0)),e.textFormatCallback=void 0,e.textFormatCallbackScope=void 0);var r=new np(t,e);r.setDepth(ax(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(ax(e,"enable",void 0)),this.setGap(ax(e,"gap",void 0)),this.setValue(ax(e,"value",0),ax(e,"min",void 0),ax(e,"max",void 0));var n=ax(e,"input",0);switch("string"==typeof n&&(n=lx[n]),n){case 0:sx.call(this);break;case 1:Ub.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 lx={pan:0,drag:0,click:1,none:-1};Object.assign(hx.prototype,nx),t.register("knob",(function(t){var e=new hx(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.Knob",hx);const dx={arc:Cc,circle:kc,curve:class extends bc{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),HC(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(ek.prototype,$C);const sk={fit:1,FIT:1,envelop:2,ENVELOP:2};t.register("transitionImage",(function(t,e,i,s,r){var n=new ek(this.scene,t,e,i,s,r);return this.scene.add.existing(n),n})),P(window,"RexPlugins.UI.TransitionImage",ek);const rk=Phaser.Renderer.WebGL.Pipelines.PostFXPipeline,nk=Phaser.Utils.Objects.GetValue,ak=Phaser.Math.Clamp;class ok extends rk{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(nk(t,"progress",0)),this.setTransitionTargetTexture(nk(t,"toTexture","__DEFAULT"),nk(t,"toFrame",void 0),nk(t,"resizeMode",1)),this.setNoise(nk(t,"noiseX",void 0),nk(t,"noiseY",void 0),nk(t,"noiseZ",void 0)),this.setFromEdge(nk(t,"fromEdgeStart",.01),nk(t,"fromEdgeWidth",.05)),this.setToEdge(nk(t,"toEdgeStart",.01),nk(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=ak(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=hk[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 hk={stretch:0,contain:1,cover:2};const lk=Phaser.Utils.Array.SpliceOne,dk=.1,ck=[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-wo(s),t.setChildLocalScale(e,r,r)):(e.visible&&t.setChildVisible(e,!1),r=1-wo(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=wo(s),r=Math.floor(255*(1-s)),e.tint=(r<<16)+(r<<8)+r):(e.visible&&t.setChildVisible(e,!1),s=wo(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 Px(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=wo(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=wo(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 Px(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=wo(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=wo(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 Px(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 Px(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,ok),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(dk,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(dk,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(dk,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(dk,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 uk extends ek{constructor(t,e,i,s,r,n){super(t,e,i,s,r,n);for(var a=0,o=ck.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(Jk.prototype,Hk),t.register("fileDropZone",(function(t){var e=new Jk(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.FileDropZone",Jk);const qk=Phaser.Math.Wrap;var Zk=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 iw=Phaser.Utils.Objects.IsPlainObject,sw=Phaser.Utils.Objects.GetValue,rw=Phaser.Display.Align.CENTER,nw={min:0,full:-1};var aw=function(t,e,i,s,r,n,a,o,h,l){fv.call(this,t);var d=t.isRexSpace,c=typeof e;if(null===e)return this;if("number"===c);else if("string"===c)e=nw[e];else if(iw(e)){var u;e=sw(u=e,"proportion",void 0),i=sw(u,"align",rw),s=sw(u,"padding",0),r=sw(u,"expand",!1),n=sw(u,"key",void 0),a=sw(u,"index",void 0),t.isRexSizer||(o=sw(u,"minWidth",void 0),h=sw(u,"minHeight",void 0)),l=sw(u,"fitRatio",0)}return"string"==typeof i&&(i=zg[i]),void 0===e&&(e=d?1:0),void 0===i&&(i=rw),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===o&&(d?o=0:t.isRexSizer||(o=t._minWidth)),void 0===h&&(d?h=0:t.isRexSizer||(h=t._minHeight)),void 0===l||!1===l?l=0:!0===l&&(l=An(t)/zn(t)),(u=this.getSizerConfig(t)).proportion=e,u.align=i,u.padding=gv(s),u.expand=r,u.fitRatio=0===e?l:0,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?An(t):o:t.minHeight=void 0===h?zn(t):h),r&&(0===this.orientation?t.minHeight=h:t.minWidth=o)),void 0!==n&&this.addChildrenMap(n,t),this},ow={add:aw,addSpace(t){return this.insertSpace(void 0,t),this},insertSpace(t,e){return void 0===e&&(e=1),aw.call(this,new tw(this.scene),{proportion:e,minWidth:0,minHeight:0,index:t}),this},insert(t,e,i,s,r,n,a,o){return iw(i)&&(i.index=t),aw.call(this,e,i,s,r,n,a,t,o),this},insertAtPosition(t,e,i,s,r,n,a,o,h){var l=ew.call(this,t,e);return-1===l&&(l=void 0),this.insert(l,i,s,r,n,a,o,h),this}};const hw=Phaser.Utils.Array.Remove;var lw={remove(t,e){return this.getParentSizer(t)!==this||(hw(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,Ib.call(this,t),this}},dw={getChildAlign(t){return this.getSizerConfig(t).align},setChildAlign(t,e){return"string"==typeof e&&(e=zg[e]),this.getSizerConfig(t).align=e,this}},cw={getChildProportion(t){return this.getSizerConfig(t).proportion},setChildProportion(t,e){return this.getSizerConfig(t).proportion=e,this}},uw={getChildExpand(t){return this.getSizerConfig(t).expand},setChildExpand(t,e){return this.getSizerConfig(t).expand=e,this}},pw={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}},gw={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&&(Yv(t,0,0),e.resolved=!1,this.hasRatioFitChild=!0);return this._childrenProportion=void 0,this.hasProportion0Child=!1,this.proportionLength=void 0,Av.call(this),this},layoutChildren:function(){for(var t,e,i,s,r,n,a,o,h,l,d=this.sizerChildren,c=this.innerLeft,u=this.innerTop,p=this.innerWidth,g=this.innerHeight,v=c,f=u,m=this.startChildIndex,y=0,b=d.length;y0?(e=t-this.getChildrenWidth(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},resolveHeight:function(t){if(void 0!==(t=Bv.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)||Rv.call(this)},runWidthWrap:function(t){this.wrapResult||(1===this.orientation&&Zk.call(this,t,void 0),Lv.call(this,t))},hasHeightWrap:function(){return!(!this.hasRatioFitChild||0!==this.orientation)||Iv.call(this)},runHeightWrap:function(t){this.wrapResult||(0===this.orientation&&Zk.call(this,void 0,t),Dv.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(gw,ow,lw,dw,cw,uw,pw);var vw=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},fw={x:0,h:0,horizontal:0,"left-to-right":0,y:1,v:1,vertical:1,"top-to-bottom":1},mw=function(t){return"string"==typeof t&&(t=fw[t]),t};const yw=Phaser.Utils.Objects.IsPlainObject,bw=Phaser.Utils.Objects.GetValue;class xw extends Cb{constructor(t,e,i,s,r,n,a){yw(e)?(e=bw(a=e,"x",0),i=bw(a,"y",0),s=bw(a,"width",void 0),r=bw(a,"height",void 0),n=bw(a,"orientation",0)):yw(s)?(s=bw(a=s,"width",void 0),r=bw(a,"height",void 0),n=bw(a,"orientation",0)):yw(n)&&(n=bw(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(bw(a,"space.item",0)),this.setStartChildIndex(bw(a,"startChildIndex",0)),this.setRTL(bw(a,"rtl",!1)),this.addChildrenMap("items",this.sizerChildren)}setOrientation(t){return this.orientation=mw(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=vw.call(this)),this._childrenProportion}}Object.assign(xw.prototype,gw);var Cw=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}},kw={appendText:Mi,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 ww 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&&(Cw(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&&(Cw(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&&Cw(t,this.iconWidth,this.iconHeight);var e=this.childrenMap.action;e&&void 0!==this.actionWidth&&void 0!==this.actionHeight&&Cw(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(ww.prototype,kw);var Sw=function(t,e,i,s){var r=new FC(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 Pw=Phaser.GameObjects.Text;var Tw=function(t){return t instanceof Pw};const Ow=Phaser.GameObjects.BitmapText;var Mw=function(t){return t instanceof Ow},Ew=function(t){return Mw(t)?2:Tw(t)?0:1},_w=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},Lw=function(t,e){switch(Ew(t)){case 0:switch("string"==typeof e&&(e=Be[e]||0),t.style.wrapMode=e,e){case 2:case 3:t.style.wordWrapCallback=_w;break;default:t.style.wordWrapCallback=null}break;case 1:"string"==typeof e&&(e=Be[e]||0),t.style.wrapMode=e}},Bw=function(t,e){return void 0===e&&(e=0),t._minWidth=e,t.runWidthWrap=function(t){return t instanceof hn}(t)?function(t){return function(e){return t.setFixedSize(e,0).runWordWrap(),t.minHeight=t.height,t}}(t):Mw(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 Tw(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 Iw=65535;var Dw=function(t,e,i){if(null==e)return t;if(0===e)return zw(t,0,i),t;var s=t.text.length;if(0===s)return zw(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=Aw(t,r,e,i,n),o=0;o<=Iw&&0!==a;o++){if((r+=a)<0){r=0;break}a=Aw(t,r,e,i,n)}return o===Iw&&console.warn("FontSizeFit: Test count exceeds 65535"),t.setFontSize(r),zw(t,e,i),t},jw=function(t,e,i){return void 0===i[e]&&(t.setFontSize(e),i[e]={width:t.width,height:t.height}),i[e]},Aw=function(t,e,i,s,r){var n,a=jw(t,e,r),o=jw(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)},zw=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 Fw=Phaser.Utils.Objects.GetValue;var Yw=function(t,e){"number"==typeof e&&(e={minWidth:e});var i=Fw(e,"minWidth",0),s=Fw(e,"minHeight",0),r=Fw(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 Dw(t,e,i),t}):(t.runWidthWrap=function(e){return t.setFixedSize&&t.setFixedSize(0,0),Dw(t,e,void 0),t},t.resize=function(e,i){return t.width===e&&t.height===i||t.setFixedSize(e,i),t}),t};const Xw=Phaser.Utils.Objects.GetValue;class Ww extends ww{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexLabel";var i,s=Xw(e,"background",void 0),r=Xw(e,"icon",void 0),n=Xw(e,"iconMask",void 0),a=Xw(e,"text",void 0),o=Xw(e,"action",void 0),h=Xw(e,"actionMask",void 0),l=Xw(e,"align",void 0);if(s&&this.addBackground(s),r){0===this.orientation?(a||o)&&(i={right:Xw(e,"space.icon",0),top:Xw(e,"space.iconTop",0),bottom:Xw(e,"space.iconBottom",0),left:Xw(e,"space.iconLeft",0)}):(a||o)&&(i={bottom:Xw(e,"space.icon",0),left:Xw(e,"space.iconLeft",0),right:Xw(e,"space.iconRight",0),top:Xw(e,"space.iconTop",0)});var d=Xw(e,"squareFitIcon",!1)?1:0;if(this.add(r,{proportion:0,padding:i,fitRatio:d}),n&&(n=Sw.call(this,r,r,1)),!d){var c=Xw(e,"iconSize",void 0);this.setIconSize(Xw(e,"iconWidth",c),Xw(e,"iconHeight",c))}}if(a){var u=Xw(e,"wrapText",!1),p=Xw(e,"adjustTextFontSize",!1);u?(!0===u&&(u="word"),Lw(a,u),e.expandTextWidth=!0,Bw(a)):p&&(e.expandTextWidth=!0,e.expandTextHeight=!0,Yw(a,{fitHeight:!0}));var g,v,f=Xw(e,"space.text",0),m=Xw(e,"expandTextWidth",!1),y=Xw(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:Xw(e,"space.actionTop",0),bottom:Xw(e,"space.actionBottom",0),right:Xw(e,"space.actionRight",0)}:{left:Xw(e,"space.actionLeft",0),right:Xw(e,"space.actionRight",0),bottom:Xw(e,"space.actionBottom",0)},d=Xw(e,"squareFitAction",!1)?1:0,this.add(o,{proportion:0,padding:i,fitRatio:d}),h&&(h=Sw.call(this,o,o,1)),!d)){var b=Xw(e,"actionSize");this.setActionSize(Xw(e,"actionWidth",b),Xw(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 Vw=Phaser.Utils.Objects.GetValue;var Gw=function(t,e){var i=Vw(e,"canvas"),s=Vw(i,"width",128),r=Vw(i,"height",128),n=new Mu(t,0,0,s,r);t.add.existing(n);var a=Vw(i,"key"),o=Vw(i,"frame"),h=Vw(i,"fill");return void 0!==h?n.fill(h):void 0!==a&&n.loadTexture(a,o),n.setTexture=n.loadTexture.bind(n),n};const Hw=Phaser.Utils.Objects.GetValue;var Uw=function(t,e){var i=Hw(e,"clickTarget",this);return"string"==typeof i&&(i=t.getElement(i)),i};const Nw=Phaser.Utils.Objects.GetValue,$w={accept:"image/*",multiple:!1};var Kw=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)}))}},Jw={async openPromise(){var t=this;return Ik(this.scene.game,$w).then((function(e){return Kw(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}},qw={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(qw,Jw);const Zw=Phaser.Utils.Objects.GetValue;class Qw extends Ww{constructor(t,e){var i=function(t,e){var i=new mk(t,{scaleUp:Vw(e,"scaleUpIcon",!1),background:Vw(e,"iconBackground"),image:Gw(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=Uw(this,e),this.clickTarget&&(Zw(e,"domButton",!0)?this.fileChooser=function(t){var e=t.scene,i=new Xk(e,$w);return e.add.existing(i),t.pin(i),i.on("change",(function(){Kw(t,i.files)})),i}(this):this.clickBehavior=function(t,e){var i=Uw(t,e);if(i){var s=Nw(e,"click"),r=new hu(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(Qw.prototype,qw),t.register("imageInputLabel",(function(t){var e=new Qw(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.ImageInputLabel",Qw);let tS=class extends Ra{constructor(t,e){return super(t),new Proxy(this,this)}get(t,e){if(ae(t,e))return t[e];var i=t.parent;return ae(i,e)?i[e]:void 0}set(t,e,i){return ae(t,e)?t[e]=i:ae(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 eS=Phaser.Utils.Objects.GetValue;class iS extends Ra{constructor(t,e){super(t,e),this.style=eS(e,"style",this);var i=eS(e,"propertiesMap");this.activeStyle=sS(e,"active",i),this.hoverStyle=sS(e,"hover",i),this.disableStyle=sS(e,"disable",i),this.onModifyStyle=eS(e,"onModifyStyle")}getStyle(t){return Bd(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 Id(e,t)?void 0:(this.modifyStyle(t),e)}}setActiveState(t){return rS.call(this,"active",t),this}setHoverState(t){return rS.call(this,"hover",t),this}setDisableState(t){return rS.call(this,"disable",t),this}}var sS=function(t,e,i){var s=Rd(t,e);if(i)for(var r in s)i.hasOwnProperty(r)&&(s[i[r]]=s[r],delete s[r]);return s},rS=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))},nS={addStyleManager(t){return this.styleManager=new iS(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 aS=Phaser.GameObjects.Image,oS=Phaser.Utils.Objects.GetValue;class hS extends aS{constructor(t,e){void 0===e&&(e={}),super(t,oS(e,"x",0),oS(e,"y",0),oS(e,"key",""),oS(e,"frame",void 0)),this.type="rexStatesImage";var i=oS(e,"effects",!0);i&&Mn(this,i),this.style=new tS(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign(hS.prototype,nS),t.register("statesImage",(function(t){var e=new hS(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.StatesImage",hS);class lS extends Dt{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexStatesRoundRectangleShape",e.style=this,e.propertiesMap=dS,this.addStyleManager(e),delete e.style,delete e.propertiesMap}}const dS={color:"fillColor",alpha:"fillAlpha",strokeWidth:"lineWidth"};Object.assign(lS.prototype,nS),t.register("statesRoundRectangle",(function(t){var e=new lS(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.StatesRoundRectangle",lS);let cS=class extends Ra{constructor(t,e){return super(t),new Proxy(this,this)}get(t,e){if(ae(t,e))return t[e];var i=t.parent;return ae(i,e)?i[e]:void 0}set(t,e,i){return ae(t,e)?t[e]=i:ae(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 uS=Phaser.GameObjects.NineSlice,pS=Phaser.Utils.Objects.GetValue;class gS extends uS{constructor(t,e){void 0===e&&(e={}),super(t,pS(e,"x",0),pS(e,"y",0),pS(e,"key",null),pS(e,"frame",null),pS(e,"width",0),pS(e,"height",0),pS(e,"leftWidth",0),pS(e,"rightWidth",0),pS(e,"topHeight",0),pS(e,"bottomHeight",0)),this.type="rexStatesNineSlice";var i=pS(e,"effects",!0);i&&Mn(this,i),this.style=new cS(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign(gS.prototype,nS),t.register("statesNineSlice",(function(t){var e=new gS(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.StatesNineSlice",gS);let vS=class extends Ra{constructor(t,e){return super(t),new Proxy(this,this)}get(t,e){if(ae(t,e))return t[e];var i=t.parent;return ae(i,e)?i[e]:void 0}set(t,e,i){return ae(t,e)?t[e]=i:ae(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 fS=Phaser.Utils.Objects.GetValue;class mS extends k{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexStatesNinePatch";var i=fS(e,"effects",!0);i&&Mn(this,i),this.style=new vS(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign(mS.prototype,nS),t.register("statesNinePatch",(function(t){var e=new mS(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.StatesNinePatch",mS);const yS=Phaser.GameObjects.Text,bS=Phaser.Utils.Objects.GetValue;class xS extends yS{constructor(t,e){void 0===e&&(e={}),super(t,bS(e,"x",0),bS(e,"y",0),bS(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,nS),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 CS extends Ra{constructor(t,e){return super(t),new Proxy(this,this)}get(t,e){if(ae(t,e))return t[e];var i=t.parent;return ae(i,e)?i[e]:void 0}set(t,e,i){return ae(t,e)?t[e]=i:ae(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 kS=Phaser.GameObjects.BitmapText,wS=Phaser.Utils.Objects.GetValue;class SS extends kS{constructor(t,e){void 0===e&&(e={});var i=wS(e,"x",0),s=wS(e,"y",0),r=wS(e,"font",""),n=wS(e,"fontSize",!1),a=wS(e,"align",0),o=wS(e,"tint");super(t,i,s,r,"",n,a),this.type="rexStatesBitmapText",void 0!==o&&this.setTint(o);var h=wS(e,"effects",!0);h&&Mn(this,h),this.style=new CS(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign(SS.prototype,nS),t.register("statesBitmapText",(function(t){var e=new SS(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.StatesBitmapText",SS);class PS extends dp{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=TS,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 TS={color:"trackColor",strokeColor:"trackStrokeColor",strokeWidth:"trackStrokeThickness"};Object.assign(PS.prototype,nS),t.register("statesBarRectangle",(function(t){var e=new PS(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.StatesBarRectangle",PS);var OS=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 MS=class extends Mu{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 ES={setChart:function(t){return window.Chart?(this.chart&&this.chart.destroy(),this.chart=new Chart(this.context,OS(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 AS(this.sizerChildren,null),Ib.call(this,t),this}},FS={setColumnSpace(t){if(this.space.column||(this.space.column=[]),this.space.column.length=this.columnCount-1,"number"==typeof t)AS(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},VS={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=Bv.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===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,AS(this.sizerChildren,null),this.columnProportions=[],this.columnProportions.length=t,"number"==typeof i)AS(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 US=Phaser.Utils.Objects.IsPlainObject,NS=Phaser.Utils.Objects.GetValue;class $S extends Cb{constructor(t,e,i,s,r,n,a,o,h,l){US(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)):US(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)):US(n)?(n=NS(l=n,"column",l.col||0),a=NS(l,"row",0),o=NS(l,"columnProportions",0),h=NS(l,"rowProportions",0)):US(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=GS.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($S.prototype,VS),t.register("gridSizer",(function(t,e,i,s,r,n,a,o,h){var l=new $S(this.scene,t,e,i,s,r,n,a,o,h);return this.scene.add.existing(l),l})),P(window,"RexPlugins.UI.GridSizer",$S);var KS=function(t,e,i,s){return e/t<=i?e/(s-1):0},JS=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=qS(o.left,o.centerY,t,e))&&(r=h,s=n);var h,l=i[n+1];l&&l.y===o.y||r>(h=qS(o.right,o.centerY,t,e))&&(r=h,s=n+1)}}return s};const QS=Phaser.Utils.Objects.IsPlainObject,tP=Phaser.Utils.Objects.GetValue,eP=Phaser.Display.Align.CENTER;var iP=function(t,e,i,s){return"\n"===t?(this.addNewLine(),this):(fv.call(this,t),QS(e)&&(e=tP(r=e,"padding",0),i=tP(r,"key",void 0),s=tP(r,"index",void 0)),void 0===e&&(e=0),(r=this.getSizerConfig(t)).align=eP,r.padding=gv(e),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},sP={add(t,e,i){if(Tm(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,Ib.call(this,t),this}},aP={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 JP=Phaser.Utils.Objects.GetValue,qP=Phaser.Math.Distance.Between;class ZP extends Ra{constructor(t,e){super(t,e),this._enable=void 0,this.rectBoundsInteractive=JP(e,"rectBoundsInteractive",!1),this.rectBoundsInteractive||t.setInteractive(JP(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(JP(t,"enable",!0)),this.holdThreshold=JP(t,"holdThreshold",50),this.pointerOutReleaseEnable=JP(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 rc(this.scene)}get speed(){return this.x===this.preX&&this.y===this.preY?0:qP(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&&!Pm(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&&!Pm(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 QP=Phaser.Utils.Objects.GetValue;class tT{constructor(t){this.resetFromJSON(t)}resetFromJSON(t){return this.setValue(QP(t,"value",0)),this.setSpeed(QP(t,"speed",0)),this.setAcceleration(QP(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 eT{constructor(){this.value,this.dir,this.movement=new tT}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 nT={y:0,v:0,vertical:0,x:1,h:1,horizontal:1},aT=Phaser.Utils.Objects.GetValue;class oT extends Ra{constructor(t,e){switch(super(t,e),this.parent!==this.scene?this.focusMode=aT(e,"focus",!0):this.focusMode=!1,"boolean"==typeof this.focusMode&&(this.focusMode=this.focusMode?1:0),this.setSpeed(aT(e,"speed",.1)),this.setEnable(aT(e,"enable",!0)),this.focusMode){case 0:case 2:this.scene.input.on("wheel",this.onSceneScroll,this);break;default:t.setInteractive(aT(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||Pm(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 hT=Phaser.Utils.Objects.GetValue;var lT=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)?hT(s,l,void 0):hT(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=Ve(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 $P(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);var p=hT(r,"position",0);"string"==typeof p&&(p=dT[p]);var g,v,f=hT(s,`space.slider${i}`,void 0);void 0===f&&void 0===(f=hT(s,"space.slider",void 0))&&(o?f=0:g=hT(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:hT(g,"right",g)}):(d=0,c=1,u=void 0===g?v?{right:f}:f:{right:hT(g,"left",g)}):0===p?(d=1,c=2,u=void 0===g?v?{top:f}:f:{top:hT(g,"bottom",g)}):(d=1,c=0,u=void 0===g?v?{bottom:f}:f:{bottom:hT(g,"top",g)}),e.add(n,{column:d,row:c,align:"center",padding:u,expand:!0}),t[`hideUnscrollableSlider${i}`]=hT(r,"hideUnscrollableSlider",!1),t[`adaptThumb${i}SizeMode`]=hT(r,"adaptThumbSize",!1),t[`minThumb${i}Size`]=hT(r,"minThumbSize",void 0)}else t[`hideUnscrollableSlider${i}`]=!1,t[`adaptThumb${i}SizeMode`]=!1,t[`minThumb${i}Size`]=void 0;var m,y,b=hT(s,"scrollDetectionMode");"string"==typeof b&&(b=cT[b]);var x=`scroller${i}`;(m=o||s.hasOwnProperty(x)?hT(s,x,!0):hT(s,"scroller",!0))&&h&&(!0===m&&(m={}),m.orientation=a?0:1,void 0!==b&&(m.rectBoundsInteractive=1===b),y=new rT(h,m),h.isRexContainerLite&&h.sendChildToBack(h));var C,k,w,S,P,T=hT(s,o?`mouseWheelScroller${i}`:"mouseWheelScroller",!1);T&&h&&(void 0!==b&&(T.focus=1===b?2:0),C=new oT(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.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 dT={right:0,left:1,bottom:0,top:1},cT={gameObject:0,rectBounds:1},uT=Phaser.Utils.Objects.GetValue;var pT=function(t,e){var i=t.scene,s=[0,1,0],r=[0,1,0],n=uT(e,"width"),a=uT(e,"height");n||uT(e,"child.expandWidth",!0)||(s[1]=0),a||uT(e,"child.expandHeight",!0)||(r[1]=0);var o=new $S(i,{column:3,row:3,columnProportions:s,rowProportions:r});switch(function(t,e,i){var s=bP(i,"child"),r=bP(s,"gameObject",void 0);if(r){var n=bP(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=bP(n,"top",0),a.bottom=bP(n,"bottom",0),o.left=bP(n,"left",0),o.right=bP(n,"right",0);break;case 1:a.top=bP(n,"left",0),a.bottom=bP(n,"right",0),o.top=bP(n,"top",0),o.bottom=bP(n,"bottom",0);break;default:a.top=bP(n,"top",0),a.bottom=bP(n,"bottom",0),a.left=bP(n,"left",0),a.right=bP(n,"right",0)}e.add(r,{column:1,row:1,align:bP(s,"align","center"),padding:o,expand:{width:bP(s,"expandWidth",!0),height:bP(s,"expandHeight",!0)}})}t.addChildrenMap("child",r)}(t,o,e),t.scrollMode){case 0:lT(t,o,"y",e);break;case 1:lT(t,o,"x",e);break;default:lT(t,o,"y",e),lT(t,o,"x",e)}return o},gT=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}`]}if(s){var n="Y"===t?this.scaleY:this.scaleX;s.setBounds(e,i*n)}r&&r.setEnable(e!==i)},vT=function(t){switch(this.scrollMode){case 0:case 1:(e=this.childrenMap.slider)&&this.hideUnscrollableSlider&&this.setChildVisible(e,this.isOverflow);break;default:t=t.toUpperCase();var e=this.childrenMap[`slider${t}`],i=this[`hideUnscrollableSlider${t}`],s=this[`isOverflow${t}`];e&&i&&this.setChildVisible(e,s)}},fT=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},wT=function(t){return(t-this.textLineSpacing)/(this.textLineHeight+this.textLineSpacing)},ST=function(t){return t*(this.textLineHeight+this.textLineSpacing)-this.textLineSpacing},PT=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},TT=function(t,e){switch(Ew(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}},OT=function(){var t=this.textObject.rexSizer;this.textObject.y+=t.offsetY-t.preOffsetY,t.preOffsetY=t.offsetY,this.resetChildPositionState(this.textObject),this.textCropEnable&&MT.call(this)},MT=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)}},ET=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()}},_T={setText:function(t){return void 0!==t&&(this.text=t),this.lines=kT(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(wT.call(this,-this.textOY)),0),e=ST.call(this,t)+this.textOY,i=PT.call(this,t);return TT(this.textObject,i),this.textObject.rexSizer.offsetY=e,OT.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,Av.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,ET.call(this,t,n,a),hv(t,s,r,n,a,e.align),e.preOffsetY=0,OT.call(this),this.textMask&&(this.textMask.setPosition().resize(),this.resetChildPositionState(this.textMask)))}};const RT=Phaser.Utils.Objects.IsPlainObject,LT=Phaser.Utils.Objects.GetValue,BT=Phaser.Display.Align.TOP_LEFT;class IT extends Cb{constructor(t,e,i,s,r,n){RT(e)?(e=LT(n=e,"x",0),i=LT(n,"y",0),s=LT(n,"width",void 0),r=LT(n,"height",void 0)):RT(s)&&(s=LT(n=s,"width",void 0),r=LT(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=LT(n,"content",""),this._textOY=0,this.execeedTopState=!1,this.execeedBottomState=!1,this.setClampMode(LT(n,"clampTextOY",!0)),this.alwaysScrollable=LT(n,"alwaysScrollable",!1);var a=LT(n,"background",void 0),o=LT(n,"text",void 0);void 0===o&&(o=DT(t)),this.textCropEnable=LT(n,"textCrop",!!o.setCrop);var h=LT(n,"textMask",!this.textCropEnable);a&&this.addBackground(a),this.add(o),this.sizerChildren=[o];var l=this.getSizerConfig(o);l.align=BT,l.padding=gv(0),l.expand=!0,this.textObject=o,this.textObjectType=Ew(o),l.preOffsetY=0,l.offsetY=0,h&&(this.textMask=Sw.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(wT.call(this,this._textObjectRealHeight))),this._visibleLinesCount}get topTextOY(){return 0}get bottomTextOY(){return-this.textVisibleHeight}get textHeight(){return void 0===this._textHeight&&(this._textHeight=ST.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 DT=function(t){return t.add.text(0,0,"")};Object.assign(IT.prototype,_T);var jT={setText(t){return this.childrenMap.child.setText(t),this.resizeController(),this},appendText(t){return this.setText(this.text+t),this}},AT={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 zT=Phaser.Utils.Objects.GetValue;class FT extends xT{constructor(t,e){void 0===e&&(e={});var i=zT(e,"text",void 0),s=zT(e,"textWidth",void 0),r=zT(e,"textHeight",void 0),n=zT(e,"textCrop",!!i.setCrop),a=zT(e,"textMask",!n),o=zT(e,"content",""),h=new IT(t,{width:s,height:r,text:i,textMask:a,textCrop:n&&!a,content:o,clampTextOY:zT(e,"clampChildOY",!1),alwaysScrollable:zT(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=zT(e,"space",void 0);l&&(l.child=zT(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(FT.prototype,jT,AT);const YT=Phaser.Utils.Objects.GetValue;var XT=function(t,e,s){e=e?i(e):{};var r=YT(s,"background",vP),n=YT(s,"text",WT),a=YT(s,"track",vP),o=YT(s,"thumb",vP);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 FT(t,e);return t.add.existing(l),l},WT=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 SS(t,e);break;case"bbcodetext":case"bbcode":s=new ds(t,0,0,"",e);break;case"label":s=new UT(t,e);break;case"textarea":s=XT(t,e);break;default:s=new xS(t,e)}return gP(s,e),t.add.existing(s),s},VT=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 mS(t,e):new gS(t,e);break;case"roundRectangle":s=new lS(t,e);break;default:s=new hS(t,e)}return gP(s,e),t.add.existing(s),s};const GT=Phaser.Utils.Objects.GetValue;var HT=function(t,e,s){e=e?i(e):{};var r=GT(s,"background",vP),n=GT(s,"text",WT),a=GT(s,"icon",VT),o=GT(s,"action",VT);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 UT extends Ww{constructor(t,e,i){super(t,e=HT(t,e,i)),this.type="rexSimpleLabel"}setActiveState(t){return NT(this.getChildren(),"setActiveState",t),this}setHoverState(t){return NT(this.getChildren(),"setHoverState",t),this}setDisableState(t){return NT(this.getChildren(),"setDisableState",t),this}}var NT=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=cO(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(Tm(s)||(s=Bc(fO,i,1)),cO(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=mO[t]),this.timeUnit=t,this}}var fO=[];const mO={ms:0,s:1,sec:1},yO={abs:0,absolute:0,inc:1,increment:1};var bO=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 CO=Phaser.Utils.Objects.GetValue;class kO extends lO{constructor(t,e){super(t,e),this.type="rexExpBar",this.setTotalEaseDuration(CO(e,"easeDuration",1e3)),this.levelCounter=new dO(CO(e,"levelCounter")),this.player=new vO(this,{scope:this,dtMode:1}),this.levelCounter.on("levelup",bO,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(kO.prototype,xO),t.register("expBar",(function(t){var e=new kO(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.ExpBar",kO);const wO=xw.prototype.add,SO=xw.prototype.addSpace;var PO=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)&&SO.call(this),wO.call(this,t,{proportion:i,expand:!0});var s=!this.buttonsExpand&&"center"===this.buttonsAlign;s&&SO.call(this),this.hasTailSpace=s}else wO.call(this,t,{proportion:i,expand:!0}),this.hasTailSpace=!1;else if(this.hasTailSpace){var r=this.sizerChildren.length-1;wO.call(this,t,{index:r,proportion:i,expand:!0})}else wO.call(this,t,{proportion:i,expand:!0});return e&&this.buttonGroup.add(t),this},TO={addButton(t){if(Tm(t))for(var e=t,i=0,s=e.length;i=0;i--)EO.call(this,e[i],t);return this}},RO=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)}},LO=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,RO.call(e,t,i,s)}},enumerable:!0,configurable:!0}),t.selected=!1},BO={add(t){return this.buttons.push(t),t._click||(t._click=new hu(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`),LO.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--)KO.call(this,e[i],t);return this}};const qO=Phaser.Utils.Objects.GetValue;class ZO extends $S{constructor(t,e){void 0===e&&(e={});var i=qO(e,"row",0),s=qO(e,"column",e.col||0),r=qO(e,"createCellContainerCallback"),n=qO(e,"buttons",void 0),a=qO(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&&QO.addNewLine(this)}else for(n=0,a=t.length;n=0;i--)rM.call(this,e[i],t);return this}};const aM=Phaser.Utils.Objects.GetValue;class oM extends cP{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 YO({parent:this,eventEmitter:aM(e,"eventEmitter",this),groupName:aM(e,"groupName",void 0),clickConfig:aM(e,"click",void 0)}).setButtonsType(e);var s=aM(e,"background",void 0),r=aM(e,"buttons",void 0);this.buttonsAlign=aM(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(oM.prototype,eM,nM,FO,WO),t.register("fixWidthButtons",(function(t){var e=new oM(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.FixWidthButtons",oM);var hM={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 lM=Phaser.Utils.Objects.GetValue;class dM extends Ww{constructor(t,e){super(t,e),this.type="rexFileSelectorButton";var i=new Xk(t);t.add.existing(i),this.addBackground(i),this.addChildrenMap("fileChooser",i),this.setAccept(lM(e,"accept","")),this.setMultiple(lM(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(dM.prototype,hM),t.register("fileSelectorButton",(function(t){var e=new dM(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.FileSelectorButton",dM);var cM={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()}},uM={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,xm.modal.call(this,t,e),this}},pM={};Object.assign(pM,cM,uM);const gM=Phaser.Utils.Objects.GetValue;class vM extends xw{constructor(t,e){void 0===e&&(e={}),e.orientation=1,super(t,e),this.type="rexDialog",this.eventEmitter=gM(e,"eventEmitter",this);var i,s,r,n,a=gM(e,"background",void 0),o=gM(e,"title",void 0),h=gM(e,"toolbar",void 0),l=gM(e,"toolbarBackground",void 0),d=gM(e,"leftToolbar",void 0),c=gM(e,"leftToolbarBackground",void 0),u=gM(e,"content",void 0),p=gM(e,"description",void 0),g=gM(e,"choices",void 0),v=gM(e,"choicesBackground",void 0),f=gM(e,"actions",void 0),m=gM(e,"actionsBackground",void 0),y=gM(e,"click",void 0);if(a&&this.addBackground(a),h&&(r=new GO(t,{groupName:"toolbar",background:l,buttons:h,orientation:0,space:{item:gM(e,"space.toolbarItem",0)},click:y,eventEmitter:this.eventEmitter}),t.add.existing(r)),d&&(n=new GO(t,{groupName:"leftToolbar",background:c,buttons:d,orientation:0,space:{item:gM(e,"space.leftToolbarItem",0)},click:y,eventEmitter:this.eventEmitter}),t.add.existing(n)),o||h||d){var b,x=!!o&&gM(e,"expand.title",!0),C=gM(e,"align.title","center"),k=!(o&&!x&&"center"===C||!o&&(h||d));b=k?new xw(t,{orientation:0}):new Yb(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:gM(e,"space.titleLeft",0),right:gM(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:gM(e,"space.title",0),top:gM(e,"space.titleTop",0)}),P=gM(e,"proportion.title",0),this.add(b,{padding:S,proportion:P,expand:!0})}if(u){var T=gM(e,"align.content","center"),O=gM(e,"space.content",0),M=(S={left:gM(e,"space.contentLeft",0),right:gM(e,"space.contentRight",0),bottom:p||g||f?O:0},P=gM(e,"proportion.content",0),gM(e,"expand.content",!0));this.add(u,{align:T,padding:S,proportion:P,expand:M})}if(p){T=gM(e,"align.description","center");var E=gM(e,"space.description",0);S={left:gM(e,"space.descriptionLeft",0),right:gM(e,"space.descriptionRight",0),bottom:g||f?E:0},P=gM(e,"proportion.description",0),M=gM(e,"expand.description",!0),this.add(p,{align:T,padding:S,proportion:P,expand:M})}if(g){var _=gM(e,"choicesType","").split("-"),R=fM(_,"wrap")?oM:fM(_,"grid")?ZO:GO,L=fM(_,"radio")?"radio":fM(_,"checkboxes")?"checkboxes":void 0,B={left:gM(e,"space.choicesBackgroundLeft",0),right:gM(e,"space.choicesBackgroundRight",0),top:gM(e,"space.choicesBackgroundTop",0),bottom:gM(e,"space.choicesBackgroundBottom",0)},I=gM(e,"space.choice",0);R===GO?B.item=I:R===oM?(B.item=I,B.line=gM(e,"space.choiceLine",I)):(B.column=gM(e,"space.choiceColumn",I),B.row=gM(e,"space.choiceRow",I));var D={width:gM(e,"choicesWidth",void 0),height:gM(e,"choicesHeight",void 0),groupName:"choices",buttonsType:L,background:v,buttons:g,space:B,click:y,eventEmitter:this.eventEmitter,setValueCallback:gM(e,"choicesSetValueCallback",void 0),setValueCallbackScope:gM(e,"choicesSetValueCallbackScope",void 0)};R===GO&&(D.orientation=fM(_,"x")?0:1),i=new R(t,D),t.add.existing(i);var j=gM(e,"space.choices",0);S={left:gM(e,"space.choicesLeft",0),right:gM(e,"space.choicesRight",0),bottom:f?j:0},T=gM(e,"align.choices","center"),P=gM(e,"proportion.choices",0),M=gM(e,"expand.choices",!0),this.add(i,{align:T,padding:S,proportion:P,expand:M}),this.buttonsType=L}f&&(s=new GO(t,{groupName:"actions",background:m,buttons:f,orientation:0,space:{item:gM(e,"space.action",0)},expand:gM(e,"expand.actions",!1),align:gM(e,"align.actions","center"),click:y,eventEmitter:this.eventEmitter}),t.add.existing(s),S={left:gM(e,"space.actionsLeft",0),right:gM(e,"space.actionsRight",0),bottom:gM(e,"space.actionsBottom",0)},P=gM(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 fM=function(t,e){return-1!==t.indexOf(e)},mM={actions:"action",choices:"choice",toolbar:"toolbar",leftToolbar:"leftToolbar"},yM=function(t,e){t.on(`button.${e}`,(function(i,s,r,n,a){mM.hasOwnProperty(s)&&t.emit(`${mM[s]}.${e}`,i,r,n,a)}))};Object.assign(vM.prototype,pM),t.register("dialog",(function(t){var e=new vM(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.Dialog",vM);var bM=function(t,e,i){var s=new UT(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))},CM=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)}},kM=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=_E(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(w_.prototype,b_);const S_=["top","bottom","centerY","center"],P_=["left","right","centerX","center"];var T_=function(t,e,i){var s,r="Y"===(e=e.toUpperCase()),n=this.childrenMap.child;if(r){if(i)for(var a=0,o=S_.length;a=0?0:Math.abs(l)<=Math.abs(d)?l:d}}else{if(i)for(a=0,o=P_.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 O_=Phaser.Utils.Objects.GetValue;class M_ extends xT{constructor(t,e){void 0===e&&(e={});var i=mP(e),s=O_(e,"panel",void 0);void 0===s&&(s={}),s.scrollMode=i,s.clampChildOY=O_(e,"clampChildOY",!1),s.clampChildOX=O_(e,"clampChildOX",!1);var r,n,a=new w_(t,s);switch(t.add.existing(a),i){case 0:r=O_(e,"expand.panel",!0),n=!0;break;case 1:r=!0,n=O_(e,"expand.panel",!0);break;default:r=!0,n=!0}e.type="rexScrollablePanel",e.child={gameObject:a,expandWidth:r,expandHeight:n,align:O_(e,"align.panel","center")};var o=O_(e,"space",void 0);o&&(o.child=O_(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]),yb(this.childrenMap.child,t),this}}var E_={scrollToChild:function(t,e){if(!this.hasChild(t))return this;switch(this.scrollMode){case 0:T_.call(this,t,"y",e);break;case 1:T_.call(this,t,"x",e);break;default:T_.call(this,t,"y",e),T_.call(this,t,"x",e)}return this}};Object.assign(M_.prototype,E_);const __=Phaser.Utils.Objects.GetValue;var R_=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=L_(e,u),this.listMaxHeight>0&&(s.layout(),s.height<=this.listMaxHeight&&(d=s)),!d){0===c&&(c=this.listMaxHeight);var p=B_(e,this.listCreateSliderTrackCallback),g=B_(e,this.listCreateSliderThumbCallback);d=new M_(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:__(this.listSpace,"panel",0)}}),e.add.existing(d)}}else u.height=c,s=L_(e,u),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},L_=function(t,e,i){var s;return i?(e.orientation="x",s=new oM(t,e)):(e.orientation="y",s=new GO(t,e)),t.add.existing(s),s},B_=function(t,e,i){var s;return e&&(s=e.call(i,t),t.add.existing(s)),s};const I_=Phaser.Utils.Objects.GetValue;var D_=function(t,e){var i=I_(e,"expandDirection",void 0);"string"==typeof i&&(i=j_[i]);var s,r,n,a,o,h,l,d=(n="alignTargetX",Td(s=e,r="alignTarget")?J(s,r):n&&Td(s,n)?J(s,n):a&&Td(s,a)?J(s,a):o),c=I_(e,"alignTargetY",d),u=I_(e,"alignOffsetX",0),p=I_(e,"alignOffsetY",0),g=I_(e,"alignSide","").includes("right"),v=I_(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=aa(t.scene)),m&&t.getBottomLeft().y>x.bottom&&(l=c.getTopLeft().y,t.setOrigin(0,1).setPosition(h+u,l+p))};const j_={down:0,up:1},A_=Phaser.Utils.Objects.GetValue;class z_ extends im{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=function(t,e){Zv(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 Jv(t,n):r.resetFromJSON(n),r.restart()}(t,e,"y","Linear")}),e.manualClose=!0,e.clickOutsideClose=!0,e.destroy=!0,super(t,e),D_(t,e),t.isRexSizer&&t.layout();var i=A_(e,"touchOutsideClose",!1),s=A_(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&&pm(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 F_={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}},Y_={openListPanel:function(){if(this.listPanel)return this;if(0===this.options.length)return this;var t,e=R_.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 z_(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(Y_,m_,F_);const X_=Phaser.Utils.Objects.GetValue;class W_ extends Ww{constructor(t,e){super(t,e),this.type="rexDropDownList",this.timer=void 0,this.listPanel=void 0,this.currentOverIndex=void 0,this.setOptions(X_(e,"options"));var i=X_(e,"list");this.setWrapEnable(X_(i,"wrap",!1)),this.setCreateButtonCallback(X_(i,"createButtonCallback")),this.setCreateListBackgroundCallback(X_(i,"createBackgroundCallback")),this.setCreateListSliderTrackCallback(X_(i,"createTrackCallback")),this.setCreateListSliderThumbCallback(X_(i,"createThumbCallback")),this.setListSliderAdaptThumbSizeEnable(X_(i,"sliderAdaptThumbSize",!1)),this.setListScrollerConfig(X_(i,"scroller")),this.setListMouseWheelScrollerConfig(X_(i,"mouseWheelScroller")),this.setButtonClickCallback(X_(i,"onButtonClick")),this.setButtonOverCallback(X_(i,"onButtonOver")),this.setButtonOutCallback(X_(i,"onButtonOut")),this.setListExpandDirection(X_(i,"expandDirection")),this.setListEaseInDuration(X_(i,"easeIn",500)),this.setListEaseOutDuration(X_(i,"easeOut",100)),this.setListTransitInCallback(X_(i,"transitIn")),this.settListTransitOutCallback(X_(i,"transitOut")),this.setListMaxHeight(X_(i,"maxHeight",0)),this.setListSize(X_(i,"width"),X_(i,"height",0)),this.setListAlignmentMode(X_(i,"alignParent","text")),this.setListAlignmentSide(X_(i,"alignSide","")),this.setListBounds(X_(i,"bounds")),this.setListSpace(X_(i,"space")),this.setListDraggable(X_(i,"draggable",!1)),this.setValueChangeCallback(X_(e,"setValueCallback"),X_(e,"setValueCallbackScope")),this.setValue(X_(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(W_.prototype,Y_),t.register("dropDownList",(function(t){var e=new W_(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.DropDownList",W_);var V_=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=HT(t,r,a);h.list=e.list||{},h.list.createButtonCallback=function(t,e){var i=bM(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 vP(t,l)},delete e.track);var d=e.thumb;return d&&(h.list.createThumbCallback=function(t){return vP(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 G_ extends W_{constructor(t,e,i){super(t,e=V_(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(K_,H_,N_,$_);const J_=Phaser.Utils.Objects.GetValue;Phaser.Math.Clamp;class q_ extends Ra{constructor(t,e){super(t,{eventEmitter:!1}),this.textObjectType=Ew(this.parent),this.pageStartIndexes=[],this.lines=kT(this.parent,""),this.sections=[],this.resetFromJSON(e)}resetFromJSON(t){this.setMaxLines(J_(t,"maxLines",void 0)),this.setPageBreak(J_(t,"pageBreak","\f\n")),this.setText(J_(t,"text","")),this.startLineIndex=J_(t,"start",-1),this.endLineIndex=J_(t,"end",void 0);var e=J_(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(Ew(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(q_.prototype,K_);var Z_={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?TT(this.parent,t):this.parent.setText(t)},appendText(t){var e=this.text.concat(Ae(t));return this.isTyping?this.setTypingContent(e):this.start(e,void 0,this.textLength),this}},Q_=function(t,e){return t.getPlainText&&(e=t.getPlainText(e)),e},tR=function(t,e){for(var i=void 0,s=0;s0?eR(n,t,a=(o=i)-d,o):"";var c,u=e-d;u>0?(o=(a=0)+u,this.insertIndex=o,c=eR(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=Q_(this.parent,t);n=tR(a,e)+s}return this.start(t,i,n,r)},stop:function(t){if(this.getTimer()&&this.freeTimer(),t){for(;!this.isLastChar;)iR.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,Z_);const rR=Phaser.Utils.Objects.GetFastValue,nR=Phaser.Utils.Objects.GetValue;class aR extends Ra{constructor(t,e){super(t,e),this.timer=null,this.resetFromJSON(e)}resetFromJSON(t){this.setTextWrapEnable(nR(t,"wrap",!1)),this.setTypeMode(nR(t,"typeMode",0)),this.setTypingSpeed(nR(t,"speed",333)),this.setTextCallback=rR(t,"setTextCallback",null),this.setTextCallbackScope=rR(t,"setTextCallbackScope",null),this.setTypingContent(rR(t,"text","")),this.typingIndex=rR(t,"typingIndex",0),this.insertIndex=null,this.insertChar=null;var e=rR(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=oR[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=Ae(t);this.textWrapEnable&&(e=function(t,e){switch(Ew(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=Q_(this.parent,this.text).length,this}onTyping(){var t=iR.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?TT(this.parent,t):this.parent.setText(t)}}const oR={"left-to-right":0,"right-to-left":1,"middle-to-sides":2,"sides-to-middle":3};Object.assign(aR.prototype,sR);const hR=Phaser.Utils.Objects.GetValue,lR={page:0,line:1};class dR 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=hR(i,"expandTextWidth",!1),n=hR(i,"expandTextHeight",!1);if(r||n){var a=Ew(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(hR(i,"typingMode","page")),this.page=new q_(s,hR(i,"page",void 0)),this.typing=new aR(s,hR(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=lR[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()}}}(ZT)){constructor(t,e){void 0===e&&(e={}),e.hasOwnProperty("layoutMode")||(e.layoutMode=1),super(t,e)}}t.register("textBox",(function(t){var e=new dR(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.TextBox",dR);class cR extends dR{constructor(t,e,i){super(t,e=tO(t,e,i))}}t.register("simpleTextBox",(function(t){var e=new cR(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.SimpleTextBox",cR);const uR=Phaser.Utils.Objects.GetValue;class pR extends xw{constructor(t,e){super(t,e),this.type="rexNumberBar";var i,s,r,n=uR(e,"background",void 0),a=uR(e,"icon",void 0),o=uR(e,"iconMask",void 0),h=uR(e,"slider",void 0),l=uR(e,"text",void 0),d=uR(e,"space.icon",0),c=uR(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=Sw.call(this,a,a,1))),h)&&(h.orientation=this.orientation,h.eventEmitter=this,h.value=null,h.hasOwnProperty("input")||(h.input=-1),i=new GP(t,h),t.add.existing(i),0===this.orientation?l&&(s={right:c}):l&&(s={bottom:c}),r=0===this.orientation?void 0===uR(h,"width",void 0)?1:0:void 0===uR(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=uR(e,"valuechangeCallback",null);if(null!==u){var p=uR(e,"valuechangeCallbackScope",void 0);this.on("valuechange",u,p)}this.setEnable(uR(e,"enable",void 0)),this.setValue(uR(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 pR(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.NumberBar",pR),t.register("scrollBar",(function(t){var e=new $P(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.ScrollBar",$P);const gR=Phaser.Utils.Objects.GetValue,vR={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 fR extends Yb{constructor(t,e){super(t,e),this.type="rexBadge";var i=gR(e,"background",void 0);i&&this.addBackground(i),this.addChildrenMap("background",i);var s=gR(e,"main",void 0);for(var r in s&&this.add(s,{key:"main",align:"center",expand:!1}),this.addChildrenMap("main",s),vR){var n=gR(e,r,void 0);n&&(this.add(n,{key:r,align:vR[r],expand:!1}),this.addChildrenMap(r,n))}}}t.register("badgeLabel",(function(t){var e=new fR(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.BadgeLabel",fR);const mR=Yb.prototype.add;var yR=function(t,e,i,s,r,n,a,o,h){return t.setVisible(!1),mR.call(this,t,e,i,s,r,n,a,o,h),this},bR={add:yR,addPage:yR};const xR=Dg.prototype.setChildVisible;var CR={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(CR,bR);const kR=Phaser.Utils.Objects.GetValue;class wR extends Yb{constructor(t,e){super(t,e),this.type="rexPages",this.childrenMap=this.sizerChildren,this._previousKey=void 0,this._currentKey=void 0,this.setSwapMode(kR(e,"swapMode",0)),this.setFadeInDuration(kR(e,"fadeIn",0))}setSwapMode(t){return"string"==typeof t&&(t=SR[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(wR.prototype,CR);const SR={invisible:0,destroy:1};t.register("pages",(function(t){var e=new wR(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.Pages",wR);const PR=Phaser.GameObjects.Mesh;class TR extends PR{get tint(){return 0===this.vertices.length?16777215:this.vertices[0].color}forceUpdate(){return this.dirtyCache[10]=1,this}}const OR=Phaser.Math.Vector3,MR=Phaser.Math.Matrix4;var ER=new OR,_R=new OR,RR=new MR;const LR=Phaser.Utils.Objects.IsPlainObject,BR=Phaser.Utils.Objects.GetValue,IR=Phaser.Geom.Mesh.GenerateGridVerts,DR=Phaser.Math.RadToDeg,jR=Phaser.Math.DegToRad,AR=1+1/Math.sin(jR(45));let zR=class extends TR{constructor(t,e,i,s,r,n){LR(e)&&(e=BR(n=e,"x",0),i=BR(n,"y",0),s=BR(n,"key",null),r=BR(n,"frame",null)),super(t,e,i,s,r),this.type="rexPerspectiveImage",this.setSizeToFrame(),this.resetPerspective(),this.panZ(AR),this.hideCCW=BR(n,"hideCCW",!0);var a=BR(n,"gridWidth",0),o=BR(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,IR({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 DR(this.rotationX)}set angleX(t){this.rotationX=jR(t)}get rotationY(){return this.modelRotation.y}set rotationY(t){this.modelRotation.y=t}get angleY(){return DR(this.rotationY)}set angleY(t){this.rotationY=jR(t)}get rotationZ(){return this.modelRotation.z}set rotationZ(t){this.modelRotation.z=t}get angleZ(){return DR(this.rotationZ)}set angleZ(t){this.rotationZ=jR(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),ER.set(e,i,s),_R.set(r,n,a),RR.fromRotationXYTranslation(_R,ER,!0);for(var o=0,h=t.vertices.length;o=0;i--)this.removePage(e[i].name,t);return this}},SL={top:1,left:3,right:5,bottom:7},PL={top:"bottom",left:"right",right:"left",bottom:"top"},TL={setTabsPadding(t,e){return this.childrenMap.tabs.setOuterPadding(t,e),this},getTabsPadding(t){return this.childrenMap.tabs.getOuterPadding(t)}},OL={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}MB.call(r,s,a.x,a.y)}}(t,s,r,i),t.transitInCallback(e,i,t)},RB={showMessage(t){var e=function(t,e,i){var s=e(t.scene,i,t);if(TB.call(s,(function(){t.removeMessage(s)})),t.displayTime){var r=t.transitInTime+t.displayTime+10;OB.call(s,r,(function(){t.removeMessage(s)}))}return s}(this,this.createMessageLabelCallback,t);return _B(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),OB.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 TI(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},MI={openColorPicker:function(){if(!this.colorPicker){var t=OI.call(this).layout(),e=new z_(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(MI,KB);const EI=Phaser.Utils.Objects.GetValue;class _I extends $B{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(EI(i,"width",160),EI(i,"height",170));var n=EI(i,"background");r=n?function(t){return vP(t,n)}:EI(i,"createBackgroundCallback"),this.setCreateColorPickerBackgroundCallback(r),this.setColorPickerHPalettePosition(EI(i,"hPalettePosition",0)),this.setColorPickerExpandDirection(EI(i,"expandDirection")),this.setColorPickerEaseInDuration(EI(i,"easeIn",200)),this.setColorPickerEaseOutDuration(EI(i,"easeOut",200)),this.setColorPickerTransitInCallback(EI(i,"transitIn")),this.setColorPickerTransitOutCallback(EI(i,"transitOut")),this.setColorPickerBounds(EI(i,"bounds"));var a=EI(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(EI(o,"height",30)),this.setColorComponentsFormatLabelConfig(EI(o,"formatLabel"));var h=EI(o,"inputText");h||(h=EI(e,"inputText")),this.setColorComponentsInputTextConfig(h);var l=EI(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(_I.prototype,MI),t.register("colorInput",(function(t){var e=new _I(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.ColorInput",_I),t.register("colorInputLite",(function(t){var e=new $B(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.ColorInputBase",$B),t.register("colorPicker",(function(t){var e=new mI(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.ColorPicker",mI),t.register("colorComponents",(function(t){var e=new SI(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.ColorComponents",SI);var RI=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!==Ee&&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=Be[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]=De(t,l,d);else{var u=Ie(t,l,d);c&&(u=c(u)),this[o]=u}}var p=De(t,"font",null);this._font=null===p?this.fontStyle+" "+this.fontSize+" "+this.fontFamily:p;var g=De(t,"fill",null);null!==g&&(this.color=Jt(g));var v=De(t,"metrics",!1);return v?this.metrics={ascent:De(v,"ascent",0),descent:De(v,"descent",0),fontSize:De(v,"fontSize",0)}:!e&&this.metrics||(this.metrics=Pe(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=Pe(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=De(t,"fontFamily","Courier"),this.fontSize=De(t,"fontSize","16px"),this.fontStyle=De(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=Jt(t,this.parent.canvas,this.parent.context),this.backgroundColor2=Jt(e,this.parent.canvas,this.parent.context),this.backgroundHorizontalGradient=i,this.update(!1)}setBackgroundStrokeColor(t,e){return this.backgroundStrokeColor=Jt(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=Jt(t,this.parent.canvas,this.parent.context),this.update(!1)}setColor(t){return this.color=Jt(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=Jt(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=Jt(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=Jt(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=Jt(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=Jt(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=Jt(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=Jt(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=Be[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=De(e,"fontFamily",this.fontFamily),this.fontSize=De(e,"fontSize",this.fontSize),this.fontStyle=De(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 Ae=function(t){return null==t?t="":Array.isArray(t)?t=t.join("\n"):"number"==typeof t&&(t=t.toString()),t},ze={draw(t,e,i,s){var r=this.penManager;this.hitAreaManager.clear();var n=this.context;n.save();var a=this.defaultStyle;this.clear(),ie(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 Fe=Phaser.Utils.Objects.GetValue,Ye=Te,Xe=Oe;class We{constructor(t){this.prop={},this.resetFromJSON(t)}resetFromJSON(t){this.text=Fe(t,"text",""),this.x=Fe(t,"x",0),this.y=Fe(t,"y",0),this.width=Fe(t,"width",0);var e=Fe(t,"prop",null);null===e&&(e={}),this.prop=e,this.newLineMode=Fe(t,"newLineMode",0),this.startIndex=Fe(t,"startIndex",0)}get plainText(){var t=this.text;return this.newLineMode===Xe&&(t+="\n"),t}get wrapText(){var t=this.text;return this.newLineMode!==Ye&&(t+="\n"),t}get rawTextLength(){var t=this.text.length;return this.newLineMode===Xe&&(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 Ve=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 $e={};const Ke=Phaser.Geom.Rectangle;var Je=new I;class qe{constructor(){this.hitAreas=[]}destroy(){this.clear()}clear(){for(var t=0,e=this.hitAreas.length;ts&&pi(v)){""!==b?a.push(n.getLine(b,x,ai)):0===C&&r>0&&a.push(n.getLine("",0,ai)),a.push(...ci(v,e,li,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,ai)),b=v,x=f,h=s):(b+=v,x=m),C===k-1&&a.push(n.getLine(b,x,l))}return a},ui=function(t,e){var i;switch(e){case hi:i=[];for(var s=0,r=(t=t.split(" ")).length;s0&&e!==vi&&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 Ne({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 gs=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},vs=function(t){return 0===(t=t.replace(Cs,"")).length},fs=/<\s*class=["|']([^"|']+)["|']\s*\>([\s\S]*?)<\s*\/class\s*\>|<\s*style=["|']([^"|']+)["|']\s*\>([\s\S]*?)<\s*\/style\s*\>/g,ms=/<\s*class=/i,ys=/<\s*class=["|']([^"|']+)["|']\s*\>([\s\S]*?)<\s*\/class\s*\>/,bs=/<\s*style=/i,xs=/<\s*style=["|']([^"|']+)["|']\s*\>([\s\S]*?)<\s*\/style\s*\>/,Cs=/^\s+|\s+$/;const ks=Phaser.Utils.Objects.GetValue;class ws extends Yi{constructor(t,e,i,s,r){var n=ks(r,"tags",void 0);super(t,e,i,s,r,"rexTagText",new ps(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 ws(this.scene,t,e,i,s);return this.scene.add.existing(r),r})),P(window,"RexPlugins.UI.TagText",ws);const Ss=Phaser.Utils.Objects.GetValue;var Ps=function(t,e){return void 0===e?t:t[e]},Ts=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=Ss(e,"left",0),t.right=Ss(e,"right",0),t.top=Ss(e,"top",0),t.bottom=Ss(e,"bottom",0)),t};let Os=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(Os.prototype,Z);var Ms={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 Es=Phaser.Math.RotateAround;var _s;const Rs=Phaser.Geom.Rectangle;var Ls,Bs=function(t){void 0===Ls&&(Ls=new Rs);var e=t.drawTLX,i=t.drawTLY;return Ls.setTo(e,i,t.drawTRX-e,t.drawBLY-i),Ls};const Is=Phaser.Math.RotateAround;var Ds,js=function(t,e,i,s){return void 0===s?s={}:!0===s&&(void 0===Ds&&(Ds={}),s=Ds),s.x=e,s.y=i,0!==t.rotation&&Is(s,0,0,t.rotation),s.x=s.x*t.scaleX+t.drawX,s.y=s.y*t.scaleY+t.drawY,s};const As=Phaser.GameObjects.Components.TransformMatrix;var zs,Fs,Ys={},Xs=function(t,e,i,s,r){var n=js(e,i,s,!0),a=function(t,e,i,s){void 0===s?s={}:!0===s&&(s=Ys);var r=e-t.width*t.originX,n=i-t.height*t.originY;return void 0===zs&&(zs=new As,Fs=new As),t.parentContainer?t.getWorldTransformMatrix(zs,Fs):zs.applyITRS(t.x,t.y,t.rotation,t.scaleX,t.scaleY),zs.transformPoint(r,n,s),s}(t,n.x,n.y,r);return a},Ws=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 Xs(t,e,n,a,r)},Vs={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===_s&&(_s={}),s=_s),s.x=(t-i.drawX)/i.scaleX,s.y=(e-i.drawY)/i.scaleY,0!==i.rotation&&Es(s,0,0,-i.rotation),s}(t,e,this,!0);return Bs(this).contains(i.x,i.y)},getWorldPosition:function(t,e,i){return Ws(this.parent,this,t,e,i)}};Object.assign(Vs,Ms);const Gs=Phaser.Math.DegToRad,Hs=Phaser.Math.RadToDeg,Us=Phaser.Utils.Objects.GetValue;class Ns extends Os{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 Hs(this._rotation)}set angle(t){this.rotation=Gs(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=Us(t,"width",void 0),i=Us(t,"height",void 0),s=Us(t,"scaleX",void 0),r=Us(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(Ns.prototype,Vs);var $s=function(t,e,i){return e.hasOwnProperty(t)?e[t]:i[t]};const Ks=Phaser.Utils.Objects.GetValue;class Js extends Ns{constructor(t,e){super(t,"background"),this.setScrollFactor(0),this.setColor(Ks(e,"color",null),Ks(e,"color2",null),Ks(e,"horizontalGradient",!0)),this.setStroke(Ks(e,"stroke",null),Ks(e,"strokeThickness",2)),this.setCornerRadius(Ks(e,"cornerRadius",0),Ks(e,"cornerIteration",null))}set color(t){t=Jt(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=Jt(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=Jt(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,$s("color2",t,this),$s("horizontalGradient",t,this)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,$s("strokeThickness",t,this)),t.hasOwnProperty("cornerRadius")&&this.setCornerRadius(t.cornerRadius,$s("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(){ie(this.parent,this.color,this.stroke,this.strokeThickness,this.cornerRadius,this.color2,this.horizontalGradient,this.cornerIteration)}}const qs=Phaser.Utils.Objects.GetValue;class Zs extends Ns{constructor(t,e){super(t,"innerbounds"),this.setScrollFactor(0),this.setColor(qs(e,"color",null),qs(e,"color2",null),qs(e,"horizontalGradient",!0)),this.setStroke(qs(e,"stroke",null),qs(e,"strokeThickness",2))}set color(t){t=Jt(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=Jt(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=Jt(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,qs(t,"color2",null),qs(t,"horizontalGradient",!0)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,qs(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 Qs=Phaser.Utils.Objects.GetValue;class tr{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(Qs(t,"bold",!1)),this.setItalic(Qs(t,"italic",!1)),this.setFontSize(Qs(t,"fontSize","16px")),this.setFontFamily(Qs(t,"fontFamily","Courier")),this.setColor(Qs(t,"color","#fff")),this.setStrokeStyle(Qs(t,"stroke",null),Qs(t,"strokeThickness",0)),this.setShadow(Qs(t,"shadowColor",null),Qs(t,"shadowOffsetX",0),Qs(t,"shadowOffsetY",0),Qs(t,"shadowBlur",0)),this.setOffset(Qs(t,"offsetX",0),Qs(t,"offsetY",0)),this.setSpace(Qs(t,"leftSpace",0),Qs(t,"rightSpace",0)),this.setAlign(Qs(t,"align",void 0)),this.setBackgroundColor(Qs(t,"backgroundColor",null)),this.setBackgroundHeight(Qs(t,"backgroundHeight",void 0)),this.setBackgroundBottomY(Qs(t,"backgroundBottomY",void 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($s("stroke",t,this),$s("strokeThickness",t,this)),t.hasOwnProperty("shadowColor")&&this.setShadowColor(t.shadowColor),(t.hasOwnProperty("shadowOffsetX")||t.hasOwnProperty("shadowOffsetY"))&&this.setShadowOffset($s("shadowOffsetX",t,this),$s("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),this}setUpdateTextFlag(){return this.parent&&(this.parent.updateTextFlag=!0),this}clone(){return new tr(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=Jt(t),this}get hasFill(){return null!=this.color}setStrokeStyle(t,e){return this.stroke=Jt(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=Jt(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=Jt(t),this}get hasBackgroundColor(){return null!=this.backgroundColor}setBackgroundHeight(t){return this.backgroundHeight=t,this}setBackgroundBottomY(t){return this.backgroundBottomY=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 er=Phaser.Utils.Array.Remove,ir=Phaser.Utils.Array.Remove,sr="text",rr="image",nr="drawer",ar="space",or="command";var hr=function(t){return t.type===sr&&"\n"===t.text},lr=function(t){return t.type===sr&&"\f"===t.text},dr=function(t){return t.type===sr},cr=function(t){return t.type===or};class ur extends Ns{constructor(t,e,i){super(t,sr),this.updateTextFlag=!1,this.style=new tr(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,s=this.drawTRX-i+1,r=e.backgroundBottomY;null==r&&(r=this.drawBLY);var n=e.backgroundHeight;null==n&&(n=r-this.drawTLY);var a=r-n;t.fillRect(i,a,s,n)}var o=e.hasFill,h=e.hasStroke;(o||h)&&(e.syncFont(t).syncStyle(t),h&&(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 pr=function(t,e){var i=this.createCharChildren(t,e);return this.addChild(i),this};Phaser.Display.Canvas.CanvasPool;class gr extends Ns{constructor(t,e,i){super(t,rr),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(){Pi(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 vr=function(t,e,i){var s=this.createImageChild(t,e,i);return this.addChild(s),this};class fr extends Ns{constructor(t,e,i,s){super(t,nr),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 mr=class extends Ns{constructor(t,e){super(t,ar),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 yr=function(t){var e=this.createSpaceChild(t);return this.addChild(e),this};class br extends Os{constructor(t,e,i,s,r){super(t,or),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 xr=function(t,e,i,s){var r=this.createCommandChild(t,e,i,s);return this.addChild(r),this},Cr=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 kr={none:0,word:1,char:2,character:2,mix:3};var wr=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=Or.call(this)).height,a=l.ascent,i=Math.floor((h-a)/n))}else{var l;n=(l=Or.call(this)).height,a=l.ascent}}else this.fixedHeight>0?void 0===(i=Er(t,"maxLines"))&&(h=this.fixedHeight-s,i=Math.floor(h/n)):i=Er(t,"maxLines",0);void 0===a&&(a=n);var d=0===i,c=Er(t,"wrapMode");void 0===c&&(c=Er(t,"charWrap",!1)?"char":"word"),"string"==typeof c&&(c=kr[c]);var u=Er(t,"wrapWidth",void 0);void 0===u&&(this.fixedWidth>0?u=this.fixedWidth-r:(u=1/0,c=0));for(var p=Er(t,"letterSpacing",0),g=Er(t,"hAlign",0),v=Er(t,"vAlign",0),f=Er(t,"justifyPercentage",.25),m=Cr({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=Lr(t,"maxLines",void 0))){var a=this.fixedWidth-r;i=Math.floor(a/n)+1}}else i=Lr(t,"maxLines",0);var o=0===i,h=Lr(t,"fixedCharacterHeight",void 0);if(void 0===h){var l=Lr(t,"charPerLine",void 0);if(void 0!==l){var d=this.fixedHeight-s;h=Math.floor(d/l)}}var c=Lr(t,"wrapHeight",void 0);void 0===c&&(c=this.fixedHeight>0?this.fixedHeight-s:1/0);for(var u=Lr(t,"letterSpacing",0),p=Lr(t,"rtl",!0),g=Lr(t,"hAlign",p?2:0),v=Lr(t,"vAlign",0),f=Cr({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 Ts(i,t,e),this.dirty=this.dirty||s!=i.left||r!=i.right||n!=i.top||a!=i.bottom,this},getPadding:function(t){return Ps(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),er(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 ir(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(sr);return null===i?i=new ur(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)),Ws(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},yn=function(t){return t>>8&255},bn=function(t){return 255&t};const xn=Phaser.Events.EventEmitter;var Cn=function(t,e,i,s,r,n){return void 0===n?n={}:!0===n&&(n=kn),"number"!=typeof i&&(i=0,s=0),n.x=r.x+r.width*t+i,n.y=r.y+r.height*e+s,n},kn={},wn=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=Cn),function(t){if(t.events)return t;var e=new xn,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()},Sn=function(t){return t.preFX?t.preFX:t.postFX?t.postFX:null},Pn=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(Mn(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}},An=function(t){return void 0!==t.displayWidth?t.displayWidth:t.width},zn=function(t){return void 0!==t.displayHeight?t.displayHeight:t.height};const Fn=Phaser.Geom.Rectangle,Yn=Phaser.Math.Vector2,Xn=Phaser.Math.RotateAround;var Wn=function(t,e){if(void 0===e?e=new Fn:!0===e&&(void 0===Vn&&(Vn=new Fn),e=Vn),t.getBounds)return t.getBounds(e);var i,s,r,n,a,o,h,l;if(t.parentContainer){var d=t.parentContainer.getBoundsTransformMatrix();Gn(t,e),d.transformPoint(e.x,e.y,e),i=e.x,s=e.y,Hn(t,e),d.transformPoint(e.x,e.y,e),r=e.x,n=e.y,Un(t,e),d.transformPoint(e.x,e.y,e),a=e.x,o=e.y,Nn(t,e),d.transformPoint(e.x,e.y,e),h=e.x,l=e.y}else Gn(t,e),i=e.x,s=e.y,Hn(t,e),r=e.x,n=e.y,Un(t,e),a=e.x,o=e.y,Nn(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},Vn=void 0,Gn=function(t,e,i){return void 0===e?e=new Yn:!0===e&&(void 0===Kn&&(Kn=new Yn),e=Kn),t.getTopLeft?t.getTopLeft(e):(e.x=t.x-An(t)*t.originX,e.y=t.y-zn(t)*t.originY,Jn(t,e,i))},Hn=function(t,e,i){return void 0===e?e=new Yn:!0===e&&(void 0===Kn&&(Kn=new Yn),e=Kn),t.getTopRight?t.getTopRight(e):(e.x=t.x-An(t)*t.originX+An(t),e.y=t.y-zn(t)*t.originY,Jn(t,e,i))},Un=function(t,e,i){return void 0===e?e=new Yn:!0===e&&(void 0===Kn&&(Kn=new Yn),e=Kn),t.getBottomLeft?t.getBottomLeft(e):(e.x=t.x-An(t)*t.originX,e.y=t.y-zn(t)*t.originY+zn(t),Jn(t,e,i))},Nn=function(t,e,i){return void 0===e?e=new Yn:!0===e&&(void 0===Kn&&(Kn=new Yn),e=Kn),t.getBottomRight?t.getBottomRight(e):(e.x=t.x-An(t)*t.originX+An(t),e.y=t.y-zn(t)*t.originY+zn(t),Jn(t,e,i))},$n=function(t,e,i){void 0===e?e=new Yn:!0===e&&(void 0===Kn&&(Kn=new Yn),e=Kn);var s=An(t),r=zn(t);return e.x=t.x+s*(.5-t.originX),e.y=t.y+r*(.5-t.originY),Jn(t,e,i)},Kn=void 0,Jn=function(t,e,i){return void 0===i&&(i=!1),0!==t.rotation&&Xn(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 Zn=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?Va:Wa,this.repeatCounter=0,this}stop(){return this.state=Xa,this}update(t,e){this.state!==Xa&&this.state!==Ha&&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=Ga)):(this.nowTime=this.duration,this.state=Ha):this.nowTime>=0&&(this.state=Va))}get t(){var t;switch(this.state){case Xa:case Wa:case Ga:t=0;break;case Va:t=this.nowTime/this.duration;break;case Ha:t=1}return Fa(t,0,1)}set t(t){(t=Fa(t,-1,1))<0?(this.state=Wa,this.nowTime=-this.delay*t):(this.state=Va,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===Xa}get isDelay(){return this.state===Wa}get isCountDown(){return this.state===Va}get isRunning(){return this.state===Wa||this.state===Va}get isDone(){return this.state===Ha}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}};const Xa=0,Wa=1,Va=2,Ga=3,Ha=-1;class Ua extends ja{constructor(t,e){super(t,e),this.timer=new Ya}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 Na=Phaser.Utils.Objects.GetValue,$a=Phaser.Utils.Objects.GetAdvancedValue,Ka=Phaser.Tweens.Builders.GetEaseFunction;class Ja extends Ua{resetFromJSON(t){return this.timer.resetFromJSON(Na(t,"timer")),this.setEnable(Na(t,"enable",!0)),this.setTarget(Na(t,"target",this.parent)),this.setDelay($a(t,"delay",0)),this.setDuration($a(t,"duration",1e3)),this.setEase(Na(t,"ease","Linear")),this.setRepeat(Na(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=Ka(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 Za=function(t){return t instanceof qa};const Qa=Phaser.Utils.Objects.GetValue,to=Phaser.Utils.Objects.GetAdvancedValue,eo=Phaser.Math.Linear;let io=class extends Ja{constructor(t,e,i){Za(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(Qa(t,"mode",0)),this.setEnable(Qa(t,"enable",!0)),this.setVolumeRange(to(t,"volume.start",this.parent.volume),to(t,"volume.end",0)),this}setMode(t){return"string"==typeof t&&(t=so[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=eo(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 so={stop:1,destroy:2};var ro=function(t,e,i,s,r){Za(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 io(t,e,a),e._fade=n),n.start(),e.isPlaying||e.setVolume(r).play(),e},no=function(t,e,i,s){Za(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 io(t,e,n),e._fade=r),r.start(),e.isPlaying||e.play(),e};const ao=Phaser.Utils.Objects.GetValue;var oo={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:ao(e,"loop",this.backgroundMusicLoop),mute:ao(e,"mute",this.backgroundMusicMute),volume:ao(e,"volume",this.backgroundMusicVolume),detune:ao(e,"detune",0),rate:ao(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&&ro(this.backgroundMusic,t,this.backgroundMusicVolume,0),this},fadeOutBackgroundMusic(t,e){return this.backgroundMusic&&no(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 ho=Phaser.Utils.Objects.GetValue;var lo={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:ho(e,"loop",this.backgroundMusicLoop),mute:ho(e,"mute",this.backgroundMusic2Mute),volume:ho(e,"volume",this.backgroundMusic2Volume),detune:ho(e,"detune",0),rate:ho(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&&ro(this.backgroundMusic2,t,this.backgroundMusic2Volume,0),this},fadeOutBackgroundMusic2(t,e){return this.backgroundMusic2&&no(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 co=Phaser.Utils.Array.Remove,uo=Phaser.Utils.Objects.GetValue;var po={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:uo(e,"mute",this.soundEffectsMute),volume:uo(e,"volume",this.soundEffectsVolume),detune:uo(e,"detune",0),rate:uo(e,"rate",1)});return this.soundEffects.push(i),i.once("complete",(function(){i.destroy(),this.sound&&co(this.soundEffects,i)}),this).once("destroy",(function(){this.sound&&co(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&&ro(e,t,this.soundEffectsVolume,0),this},fadeOutSoundEffect(t,e){var i=this.getLastSoundEffect();return i&&no(i,t,e),this},fadeOutAllSoundEffects(t,e){for(var i=this.soundEffects.length-1;i>=0;i--)no(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&&ro(e,t,this.soundEffects2Volume,0),this},fadeOutSoundEffect2(t,e){var i=this.getLastSoundEffect2();return i&&no(i,t,e),this},fadeOutAllSoundEffects2(t,e){for(var i=this.soundEffects2.length-1;i>=0;i--)no(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=qi(this.delimiterLeft),e=qi(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=Qo),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=eh),this.tagExpression=t,this}setValueExpression(t){return t||(t=eh),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!==eh||this.valueExpression!==eh){var s=`${this.tagExpression}(=${this.valueExpression})?`,r=`/${this.tagExpression}`;t=qi(this.delimiterLeft),e=qi(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:al,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===sr&&" "===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,ol.call(t,i.remainder)}});break}}else cr(s)&&s.exec()}this.minSizeEnable&&this.textPlayer.setToMinSize(),this.inTypingProcessLoop=!1},hl=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}},ll=function(t,e){var i=e.split(".");return t.gameObjectManagers.hasOwnProperty(i[0])},dl=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 cl=Phaser.Input.Keyboard.KeyCodes;var ul=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)},Ol=function(t){var e,i;[e,...i]=t,this.getGameObjectManager(e).stopAnimation(...i)},Ml=function(t){var e,i;[e,...i]=t,this.getGameObjectManager(e).pauseAnimation(...i)},El=function(t){var e,i;[e,...i]=t,this.getGameObjectManager(e).chainAnimation(...i)};const _l=[function(t,e,i){var s=i.name;e.on("+",(function(i,...r){if(!e.skipEventFlag){var n,a=i.split(".");Pl(a,s)&&(n=a[1],xr.call(t,`${s}.play`,Tl,[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],xr.call(t,`${s}.stop`,Ol,[s,r],t),e.skipEvent())}})).on("-",(function(i){if(!e.skipEventFlag){var r,n=i.split(".");Pl(n,s)&&(r=n[1],xr.call(t,`${s}.stop`,Ol,[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],xr.call(t,`${s}.pause`,Ml,[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);xr.call(t,`${s}.chain`,El,[s,r,a],t),e.skipEvent()}}}))}];var Rl=function(t){void 0===t&&(t={}),t.name="sprite",t.parseCallbacks=_l,t.createGameObject=Cl(t.createGameObject),this.addGameObjectManager(t,Sl)},Ll=function(t,e){return 2===t.length&&t[0]===e},Bl=function(t){var e,i;[e,...i]=t,this.getGameObjectManager(e).add(...i)},Il=function(t){var e,i;[e,...i]=t,this.getGameObjectManager(e).remove(...i)},Dl=function(t){this.getGameObjectManager(t).removeAll()},jl=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])}},Al={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},zl=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 Fl=[function(t,e,i){var s=i.name;e.on("+",(function(i,...r){if(!e.skipEventFlag){var n,a=i.split(".");Ll(a,s)&&(n=a[1],xr.call(t,`${s}.add`,Bl,[s,n,...r],t),e.skipEvent())}})).on("-",(function(i){if(!e.skipEventFlag){var r,n=i.split(".");Ll(n,s)&&(r=n[1],xr.call(t,`${s}.remove`,Il,[s,r],t),e.skipEvent())}}))},function(t,e,i){var s=i.name;e.on("-",(function(i){e.skipEventFlag||i===s&&(xr.call(t,`${s}.removeall`,Dl,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],xr.call(t,`${s}.call`,jl,[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&&Al[t[3]]})(c,s)&&(h=c[1],l=c[2],d=c[3],"number"==typeof a&&(o=a,a=void 0),xr.call(t,`${s}.ease`,zl,[s,h,l,r,n,a,o,d],t),e.skipEvent())}}))}],Yl=Wo.addGameObjectManager;var Xl={addGameObjectManager(t,e){(t=t?Ve(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},Yl.call(this,t,e);for(var n=t.parseCallbacks,a=0,o=(n=n?[...n,...Fl]:Fl).length;a0)return nd.length=0,!0;return nd.length=0,!1},nd=[],ad=void 0;const od=Phaser.Utils.Objects.GetValue;var hd=function(t,e,i){var s,r;for(var n in void 0===i&&(i={}),t)s=t[n],void 0!==(r=od(e,n,s[1]))&&(i[s[0]]=r);return i},ld=function(t){t.addEventListener("touchstart",dd,!1),t.addEventListener("touchmove",dd,!1),t.addEventListener("touchend",dd,!1),t.addEventListener("mousedown",dd,!1),t.addEventListener("mouseup",dd,!1),t.addEventListener("mousemove",dd,!1)},dd=function(t){t.stopPropagation()},cd=function(){return this.close(),this.emit("keydown-ENTER",this.parent,this),this},ud=function(){this.isOpened=!0,this.initText(),this.enterCloseEnable&&this.scene.input.keyboard.once("keydown-ENTER",cd,this),this.scene.sys.events.on("postupdate",this.updateText,this),this.clickOutSideTarget?(xa.call(this.clickOutSideTarget,this.parent),ba.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)},pd=function(){this.isOpened=!1,this.updateText(),this.enterCloseEnable&&this.scene.input.keyboard.off("keydown-ENTER",cd,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 gd=Phaser.Utils.Objects.GetValue;var vd=function(t,e){var i,s=gd(e,"inputType",void 0);void 0===s&&(s=gd(e,"type","text")),"textarea"===s?(i=document.createElement("textarea")).style.resize="none":(i=document.createElement("input")).type=s;var r=gd(e,"style",void 0),n=i.style;hd(ed,r,n),n.position="absolute",n.opacity=0,n.pointerEvents="none",n.zIndex=0,n.transform="scale(0)",hd(td,e,i),ld(i);var a=t.scene.sys.scale;return(a.isFullscreen?a.fullscreenTarget:document.body).appendChild(i),i.addEventListener("focus",(function(e){ud.call(t)})),i.addEventListener("blur",(function(e){pd.call(t)})),i},fd={open:function(){return this.isOpened||this.readOnly||((t=this)!==ad&&(void 0!==ad&&ad.close(),ad=t),this.node||(this.node=vd(this,this.nodeConfig)),this.setFocus()),this;var t},close:function(){return this.isOpened?(this===ad&&(ad=void 0),this.setBlur(),this):this}};const md=Phaser.Utils.Objects.GetValue;class yd extends Ra{constructor(t,e){super(t);var i=md(e,"inputType",void 0);void 0===i&&(i=md(e,"type","text")),this.setEnterCloseEnable(md(e,"enterClose","textarea"!==i));var s=md(e,"onOpen",void 0);s||(s=md(e,"onFocus",void 0)),this.onOpenCallback=s,this.clickOutSideTarget=md(e,"clickOutSideTarget",void 0);var r=md(e,"onClose",void 0);r||(r=md(e,"onBlur",void 0)),this.onCloseCallback=r,this.onUpdateCallback=md(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 id(t,e,"inputType"),id(t,e,"type"),id(t,e,"style"),id(t,e,ed),id(t,e,td),e}(e),this.node=void 0}destroy(){this.close(),this.clickOutSideTarget&&this.clickOutSideTarget.destroy(),super.destroy()}onClickOutside(t){sd(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(yd.prototype,fd);var bd=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},xd=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)):(xd(this),Cd(this)),this}setNumberInput(){return this.onUpdateCallback=bd,this}setSelectAllWhenFocusEnable(t){return void 0===t&&(t=!0),this.selectAllWhenFocus=t,this}setRequestCursorPosition(t){return this.isOpened?(this.requestCursorPosition=t,this):this}};const Sd=Phaser.Utils.Objects.GetValue,Pd=["inputType","onOpen","clickOutSideTarget","onFocus","onClose","onBlur","onUpdate","enterClose","readOnly","maxLength","minLength","selectAll"];var Td=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 Ed=Phaser.GameObjects.Zone;let _d=class extends Ed{constructor(t){super(t,0,0,2,2),this.fullWindow=new Md(this)}};var Rd=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},Ld=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)},Bd=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}Ad.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(zd(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 Fd=new Ad,Yd=/^[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,Xd=/\S/,Wd=new Ad;Wd.equals=function(t,e){return this.options.ignoreCase&&(t=t.toLowerCase(),e=e.toLowerCase()),t===e||this.options.ignoreWhitespace&&!Xd.test(t)&&!Xd.test(e)},Wd.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(Ud(t,null,null,i),i," ")},Hd.equals=function(t,e){return Ad.prototype.equals.call(Hd,t.replace(/,([\r\n])/g,"$1"),e.replace(/,([\r\n])/g,"$1"))};const Nd=new Ad;Nd.tokenize=function(t){return t.slice()},Nd.join=Nd.removeEmpty=function(t){return t};const $d=Phaser.Utils.Array.Remove;var Kd=function(t,e){var i=t.text;if(e!==i){if(null==i&&(i=""),$d(t.children,t.lastInsertCursor),""===e)t.removeChildren();else for(var s=(h=i,l=e,Fd.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},tc={cursorMoveLeft(){if(!this.isOpened)return this;var t=qd(this.cursorPosition-1,0,this.inputText.length);return this.setCursorPosition(t),this},cursorMoveRight(){if(!this.isOpened)return this;var t=qd(this.cursorPosition+1,0,this.inputText.length);return this.setCursorPosition(t),this},cursorMoveUp(){if(!this.isOpened)return this;var t=Zd(this.characterCountOfLines,this.cursorPosition);t.lineIndex-=1;var e=qd(Qd(this.characterCountOfLines,t),0,this.inputText.length);return this.setCursorPosition(e),this},cursorMoveDown(){if(!this.isOpened)return this;var t=Zd(this.characterCountOfLines,this.cursorPosition);t.lineIndex+=1;var e=qd(Qd(this.characterCountOfLines,t),0,this.inputText.length);return this.setCursorPosition(e),this}};const ec=Phaser.Utils.Objects.IsPlainObject;class ic extends hn{constructor(t,e,i,s,r,n){ec(e)?n=e:ec(s)&&(n=s),void 0===n&&(n={}),function(t,e){var i=!e.textArea;if(Td(e,"wrap.vAlign")||P(e,"wrap.vAlign",s=i?"center":"top"),Td(e,"wrap.wrapMode")||P(e,"wrap.wrapMode","char"),Td(e,"wrap.maxLines")||P(e,"wrap.maxLines",s=i?1:void 0),i&&P(e,"wrap.wrapWidth",1/0),Td(e,"wrap.useDefaultTextHeight")||P(e,"wrap.useDefaultTextHeight",!0),e.edit||(e.edit={}),!Td(e.edit,"inputType")){var s=i?"text":"textarea";P(e.edit,"inputType",s)}if(!0===e.clickOutSideTarget){var r=new _d(t);t.add.existing(r),e.clickOutSideTarget=r}}(t,n);var a=n.text;a&&delete n.text;var o=Rd(n.background,"focus"),h=Rd(n.style,"cursor");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=Sd(e,"edit");return void 0===i&&(i={}),id(e,i,Pd),new wd(t,i)}(this,n),Ld.call(this),n.focusStyle&&Object.assign(o,n.focusStyle),jd.call(this,o),n.cursorStyle&&Object.assign(h,n.cursorStyle),Dd.call(this,h);var l=n.onAddChar;l&&this.on("addchar",l);var d=n.onCursorOut;d&&this.on("cursorout",d);var c=n.onCursorIn;c&&this.on("cursorin",c);var u,p=n.onMoveCursor;p&&this.on("movecursor",p),this.setParseTextCallback(n.parseTextCallback),this.lastInsertCursor=((u=this.createCharChild("|")).text="",u),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=$c(t,"tl",0),this.radiusTR=$c(t,"tr",0),this.radiusBL=$c(t,"bl",0),this.radiusBR=$c(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?Lt(e,e,e,e,180,270,!1,r,t):Lt(0,0,e,e,90,0,!0,r,t):_t(0,0,t),(e=this.radiusTR)>0?this._convexTR?Lt(i-e,e,e,e,270,360,!1,r,t):Lt(i,0,e,e,180,90,!0,r,t):_t(i,0,t),(e=this.radiusBR)>0?this._convexBR?Lt(i-e,s-e,e,e,0,90,!1,r,t):Lt(i,s,e,e,270,180,!0,r,t):_t(i,s,t),(e=this.radiusBL)>0?this._convexBL?Lt(e,s-e,e,e,90,180,!1,r,t):Lt(0,s,e,e,360,270,!0,r,t):_t(0,s,t),t.push(t[0],t[1]),Ec(this.x,this.y,t),super.updateData(),this}}const Jc=Phaser.Renderer.WebGL.Utils.getTintAppendFloatAlpha;var qc={buildShapes(){this.addShape((new Kc).setName("box")).addShape((new Uc).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 Zc=Phaser.Utils.Objects.GetValue,Qc=Phaser.Math.Linear;class tu extends Ja{constructor(t,e){super(t,e),this.resetFromJSON(),this.boot()}start(t){if(this.timer.isRunning)return this;var e=this.target;this.propertyKey=Zc(t,"key","value");var i=e[this.propertyKey];return this.fromValue=Zc(t,"from",i),this.toValue=Zc(t,"to",i),this.setEase(Zc(t,"ease",this.ease)),this.setDuration(Zc(t,"duration",this.duration)),this.setRepeat(Zc(t,"repeat",0)),this.setDelay(Zc(t,"delay",0)),this.setRepeatDelay(Zc(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]=Qc(this.fromValue,this.toValue,i)}}var eu={setCheckerAnimationDuration(t){return void 0===t&&(t=0),this.checkerAnimDuration=t,this},playCheckerAnimation(){return void 0===this.checkerAnimProgressTask&&(this.checkerAnimProgressTask=new tu(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}},iu={};Object.assign(iu,gc,vc,qc,eu);const su=23730,ru=Phaser.Utils.Objects.GetValue,nu=Phaser.Utils.Objects.IsPlainObject;class au extends pc{constructor(t,e,i,s,r,n,a){nu(e)?(e=ru(a=e,"x",0),i=ru(a,"y",0),s=ru(a,"width",2),r=ru(a,"height",2),n=ru(a,"color",su)):nu(n)&&(n=ru(a=n,"color",su)),super(t,e,i,s,r),this.type="rexCheckbox",void 0===n&&(n=su),this.setBoxShape(ru(a,"circleBox",!1)),this.setBoxFillStyle(n,ru(a,"boxFillAlpha",1)),this.setUncheckedBoxFillStyle(ru(a,"uncheckedColor",null),ru(a,"uncheckedBoxFillAlpha",1)),this.setBoxStrokeStyle(ru(a,"boxLineWidth",4),ru(a,"boxStrokeColor",n),ru(a,"boxStrokeAlpha",1)),this.setUncheckedBoxStrokeStyle(this.boxLineWidth,ru(a,"uncheckedBoxStrokeColor",this.boxStrokeColor),ru(a,"uncheckedBoxStrokeAlpha",this.boxStrokeAlpha)),this.setCheckerStyle(ru(a,"checkerColor",16777215),ru(a,"checkerAlpha",1)),this.setBoxSize(ru(a,"boxSize",1)),this.setCheckerSize(ru(a,"checkerSize",1)),this.setCheckerAnimationDuration(ru(a,"animationDuration",150)),this.buildShapes();var o=ru(a,"checked");void 0===o&&(o=ru(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(au.prototype,iu);const ou=Phaser.Utils.Objects.GetValue;class hu extends Ra{constructor(t,e){super(t,e),this._enable=void 0,t.setInteractive(ou(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(ou(t,"enable",!0)),this.setMode(ou(t,"mode",1)),this.setClickInterval(ou(t,"clickInterval",100)),this.setDragThreshold(ou(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=lu[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 lu={press:0,pointerdown:0,release:1,pointerup:1},du=Phaser.Utils.Objects.GetValue,cu=Phaser.Utils.Objects.IsPlainObject;class uu extends au{constructor(t,e,i,s,r,n,a){cu(e)?(e=du(a=e,"x",0),i=du(a,"y",0),s=du(a,"width",2),r=du(a,"height",2),n=du(a,"color",su)):cu(n)&&(n=du(a=n,"color",su)),super(t,e,i,s,r,n,a),this._click=new hu(this,du(a,"click")),this._click.on("click",(function(){this.toggleValue()}),this),this.setReadOnly(du(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 uu(this.scene,t,e,i,s,r,n);return this.scene.add.existing(a),a})),P(window,"RexPlugins.UI.Checkbox",uu);var pu={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}},gu={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}},vu={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}},fu=function(t,e,i){return(e-t)*i+t};const mu=Phaser.Math.Linear;var yu={buildShapes(){this.addShape((new Kc).setName("track")).addShape((new Kc).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&fu(mn(l),mn(d),c))<<16|(255&fu(yn(l),yn(d),c))<<8|255&fu(bn(l),bn(d),c)),p=mu(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=mu(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)}},bu={setToggleAnimationDuration(t){return void 0===t&&(t=0),this.toggleAnimDuration=t,this},playToggleAnimation(){return void 0===this.toggleAnimProgressTask&&(this.toggleAnimProgressTask=new tu(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}},xu={};Object.assign(xu,pu,gu,vu,yu,bu);const Cu=Phaser.Utils.Objects.GetValue,ku=Phaser.Utils.Objects.IsPlainObject,wu=23730;class Su extends pc{constructor(t,e,i,s,r,n,a){ku(e)?(e=Cu(a=e,"x",0),i=Cu(a,"y",0),s=Cu(a,"width",2),r=Cu(a,"height",2),n=Cu(a,"color",wu)):ku(n)&&(n=Cu(a=n,"color",wu)),super(t,e,i,s,r),this.type="rexToggleSwitch",void 0===n&&(n=wu),this.setTrackFillStyle(n,Cu(a,"trackFillAlpha",1)),this.setFalseValueTrackFillStyle(Cu(a,"falseValueTrackColor",function(t){var e=.3*mn(t)+.59*yn(t)+.11*bn(t);return(255&e)<<16|(255&e)<<8|255&e}(n)),Cu(a,"falseValueTrackFillAlpha",1)),this.setThumbStyle(Cu(a,"thumbColor",16777215),Cu(a,"thumbAlpha",1)),this.setTrackSize(Cu(a,"trackWidth",.9),Cu(a,"trackHeight",.5)),this.setTrackRadius(Cu(a,"trackRadius",.5*this.trackHeight));var o=Cu(a,"thumbHeight",void 0),h=Cu(a,"thumbWidth",o);void 0===h&&(h=.9*this.trackHeight),this.setThumbSize(h,o),this.setThumbRadius(Cu(a,"thumbRadius",.5*this.thumbHeight)),this.setThumbPosition(Cu(a,"thumbLeft",.3),Cu(a,"thumbRight",void 0)),this.setRTL(Cu(a,"rtl",!1)),this.setToggleAnimationDuration(Cu(a,"animationDuration",150)),this.buildShapes(),this.setValue(Cu(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(Su.prototype,xu);const Pu=Phaser.Utils.Objects.GetValue;class Tu extends Su{constructor(t,e,i,s,r,n,a){super(t,e,i,s,r,n,a),this._click=new hu(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("toggleSwitch",(function(t,e,i,s,r,n){var a=new Tu(this.scene,t,e,i,s,r,n);return this.scene.add.existing(a),a})),P(window,"RexPlugins.UI.ToggleSwitch",Tu);var Ou={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 Mu extends Nt{}Object.assign(Mu.prototype,Ou),t.register("canvas",(function(t,e,i,s){var r=new Mu(this.scene,t,e,i,s);return this.scene.add.existing(r),r})),P(window,"RexPlugins.UI.Canvas",Mu);const Eu=Phaser.Utils.Objects.GetValue;class _u extends Nt{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=Eu(i,"maskType",0),r=Eu(i,"backgroundColor",void 0),n=Eu(i,"strokeColor",void 0),a=Eu(i,"strokeWidth",null!=n?10:0);if(void 0===s?s=0:"string"==typeof s&&(s=Ru[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=Eu(i,"radius",0),f=Eu(i,"iteration",void 0);Zt(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 Ru={circle:0,ellipse:1,roundRectangle:2};t.register("circleMaskImage",(function(t,e,i,s,r){var n=new _u(this.scene,t,e,i,s,r);return this.scene.add.existing(n),n})),P(window,"RexPlugins.UI.CircleMaskImage",_u);const Lu=Phaser.Utils.Objects.GetValue;class Bu extends Nt{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=Lu(i,"mask.key"),r=Lu(i,"mask.frame"),n=Lu(i,"mask.invertAlpha",!1),a=Lu(i,"mask.scale"),o=Lu(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 Bu(this.scene,t,e,i,s,r);return this.scene.add.existing(n),n})),P(window,"RexPlugins.UI.AlphaMaskImage",Bu);const Iu=Phaser.Math.Linear,Du=Phaser.Math.Percent;var ju={setValue(t,e,i){return null==t||(void 0!==e&&(t=Du(t,e,i)),this.value=t),this},addValue(t,e,i){return void 0!==e&&(t=Du(t,e,i)),this.value+=t,this},getValue(t,e){var i=this.value;return void 0!==t&&(i=Iu(t,e,i)),i}};const Au=Phaser.Math.Percent;var zu={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=Au(t,e,i)),void 0===this.easeValueTask&&(this.easeValueTask=new tu(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 tu(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 Fu=Phaser.Utils.Objects.GetValue,Yu=Phaser.Math.Clamp;function Xu(t){class e extends t{bootProgressBase(t){this.eventEmitter=Fu(t,"eventEmitter",this);var e=Fu(t,"valuechangeCallback",null);if(null!==e){var i=Fu(t,"valuechangeCallbackScope",void 0);this.eventEmitter.on("valuechange",e,i)}return this.setEaseValuePropName("value").setEaseValueDuration(Fu(t,"easeValue.duration",0)).setEaseValueFunction(Fu(t,"easeValue.ease","Linear")),this}get value(){return this._value}set value(t){t=Yu(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,ju,zu),e}const Wu=Phaser.Math.RadToDeg,Vu=Phaser.Math.DegToRad;var Gu=function(t,e,i,s,r,n,a,o){var h=360===Math.abs(a-n),l=Vu(n),d=Vu(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},Hu={buildShapes(){var t=this.iterations;this.addShape((new Uc).setIterations(t).setName("track")).addShape((new Uc).setIterations(t).setName("bar")).addShape((new kc).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),Gu(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=Wu(this.startAngle),o=360*(n?1-this.value:this.value)+a),h.fillStyle(this.barColor),Gu(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 Uu=Phaser.Utils.Objects.GetValue,Nu=Phaser.Utils.Objects.IsPlainObject,$u=Phaser.Math.Clamp,Ku=Phaser.Math.DegToRad(270);let Ju=class extends(Xu(pc)){constructor(t,e,i,s,r,n,a){Nu(e)&&(e=Uu(a=e,"x",0),i=Uu(a,"y",0),s=Uu(a,"radius",1),r=Uu(a,"barColor",void 0),n=Uu(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(Uu(a,"trackColor",void 0)),this.setBarColor(r),this.setCenterColor(Uu(a,"centerColor",void 0)),this.setThickness(Uu(a,"thickness",.2)),this.setStartAngle(Uu(a,"startAngle",Ku)),this.setAnticlockwise(Uu(a,"anticlockwise",!1)),this.iterations=Uu(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=$u(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(Ju.prototype,Hu),t.register("circularProgress",(function(t,e,i,s,r,n){var a=new Ju(this.scene,t,e,i,s,r,n);return this.scene.add.existing(a),a})),P(window,"RexPlugins.UI.CircularProgress",Ju);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 Zu=Phaser.Math.PI2;var Qu=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+Zu)%Zu:(o+l*this.value)%Zu,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 tp=Phaser.Utils.Objects.GetValue,ep=Phaser.Utils.Objects.IsPlainObject,ip=Phaser.Math.Clamp,sp=Phaser.Math.DegToRad(270),rp=Phaser.Math.PI2;class np extends(Xu(Nt)){constructor(t,e,i,s,r,n,a){ep(e)&&(e=tp(a=e,"x",0),i=tp(a,"y",0),s=tp(a,"radius",1),r=tp(a,"barColor",void 0),n=tp(a,"value",0));var o=2*s;super(t,e,i,o,o,tp(a,"resolution",1)),this.type="rexCircularProgressCanvas",this.bootProgressBase(a),this.setRadius(s),this.setTrackColor(tp(a,"trackColor",void 0)),this.setBarColor(r),this.setBarColor2(tp(a,"barColor2",void 0)),this.setCenterColor(tp(a,"centerColor",void 0)),this.setThickness(tp(a,"thickness",.2)),this.setStartAngle(tp(a,"startAngle",sp)),this.setEndAngle(tp(a,"endAngle",this.startAngle+rp)),this.setAnticlockwise(tp(a,"anticlockwise",!1)),this.setTextColor(tp(a,"textColor",void 0)),this.setTextStrokeColor(tp(a,"textStrokeColor",void 0),tp(a,"textStrokeThickness",void 0));var h=tp(a,"textFont",void 0);h?this.setTextFont(h):this.setTextFont(tp(a,"textSize","16px"),tp(a,"textFamily","Courier"),tp(a,"textStyle","")),this.setTextFormatCallback(tp(a,"textFormatCallback",void 0),tp(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=Jt(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=Jt(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=Jt(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=ap(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=ap(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=ap(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=ip(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=Jt(t,this.canvas,this.context),this.dirty=this.dirty||this._centerColor!=t,this._centerColor=t}get centerColor2(){return this._centerColor2}set centerColor2(t){t=Jt(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=Jt(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=Jt(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(),Qu.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 ap=function(t,e,i){return i?t<=e?rp+t-e:t-e:t>=e?rp+e-t:e-t};t.register("circularProgressCanvas",(function(t,e,i,s,r,n){var a=new np(this.scene,t,e,i,s,r,n);return this.scene.add.existing(a),a})),P(window,"RexPlugins.UI.CircularProgressCanvas",np);var op=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 hp=Phaser.Utils.Objects.GetValue,lp=Phaser.Utils.Objects.IsPlainObject;let dp=class extends(Xu(pc)){constructor(t,e,i,s,r,n,a,o){lp(e)?(e=(o=e).x,i=o.y,s=o.width,r=o.height,n=o.barColor,a=o.value):lp(s)?(s=(o=s).width,r=o.height,n=o.barColor,a=o.value):lp(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 Uc).setName("trackFill")).addShape((new Uc).setName("bar")).addShape((new Uc).setName("trackStroke")),this.setTrackColor(hp(o,"trackColor",void 0)),this.setBarColor(n),this.setTrackStroke(hp(o,"trackStrokeThickness",2),hp(o,"trackStrokeColor",void 0)),this.setSkewX(hp(o,"skewX",0)),this.setRTL(hp(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 cp={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&&op(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),op(a,r,0,n,i,t));var o=this.getShape("trackStroke");o.lineStyle(this.trackStrokeThickness,this.trackStrokeColor),o.isStroked&&op(o,0,0,e,i,t)}};Object.assign(dp.prototype,cp),t.register("lineProgress",(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.LineProgress",dp);var up=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(),up(0,n,this.trackPoints,void 0,this.trackStrokeColor,this.trackStrokeThickness),n.restore())},gp=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 vp=Phaser.Utils.Objects.GetValue,fp=Phaser.Utils.Objects.IsPlainObject;class mp extends(Xu(Nt)){constructor(t,e,i,s,r,n,a,o){fp(e)?(e=vp(o=e,"x",0),i=vp(o,"y",0),s=vp(o,"width",2),r=vp(o,"height",2),n=vp(o,"barColor",void 0),a=vp(o,"value",0)):fp(s)?(s=vp(o=s,"width",2),r=vp(o,"height",2),n=vp(o,"barColor",void 0),a=vp(o,"value",0)):fp(n)&&(n=vp(o=n,"barColor",void 0),a=vp(o,"value",0)),super(t,e,i,s,r,vp(o,"resolution",1)),this.type="rexLineProgressCanvas",this.trackPoints=[],this.barPoints=[],this.bootProgressBase(o),this.setTrackColor(vp(o,"trackColor",void 0)),this.setBarColor(n,vp(o,"barColor2",void 0),vp(o,"isHorizontalGradient",void 0)),this.setTrackStroke(vp(o,"trackStrokeThickness",2),vp(o,"trackStrokeColor",void 0)),this.setSkewX(vp(o,"skewX",0)),this.setRTL(vp(o,"rtl",!1)),this.setValue(a)}get trackColor(){return this._trackColor}set trackColor(t){t=Jt(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=Jt(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=Jt(t,this.canvas,this.context),this.dirty=this.dirty||this._barColor!=t,this._barColor=t}get barColor2(){return this._barColor2}set barColor2(t){t=Jt(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(),pp.call(this)}),this),this}}t.register("circularProgressCanvas",(function(t,e,i,s,r,n,a){var o=new mp(this.scene,t,e,i,s,r,n,a);return this.scene.add.existing(o),o})),P(window,"RexPlugins.UI.LineProgressCanvas",mp),Phaser.Math.Wrap;const yp=Phaser.Math.Linear;var bp=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=yp(b.a.x,x.a.x,C),e=yp(b.a.y,x.a.y,C),i=yp(b.b.x,x.b.x,C),s=yp(b.b.y,x.b.y,C),r=yp(b.c.x,x.c.x,C),n=yp(b.c.y,x.c.y,C)}a.startAt(t,e).lineTo(i,s).lineTo(r,n),this.arrowOnly?a.end():a.close()};const xp=(0,Phaser.Math.DegToRad)(120);var Cp=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+xp),i+s*Math.sin(r+xp)).lineTo(e+s*Math.cos(r),i+s*Math.sin(r)).lineTo(e+s*Math.cos(r-xp),i+s*Math.sin(r-xp)),this.arrowOnly?t.end():t.close()},kp={buildShapes(){this.addShape((new Uc).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?bp.call(this):Cp.call(this)}},wp={setEaseDuration(t){return void 0===t&&(t=0),this.easeDuration=t,this},playEaseDirectionation(){return void 0===this.easeDirectionProgressTask&&(this.easeDirectionProgressTask=new tu(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 Sp=Phaser.Utils.Objects.GetValue,Pp=Phaser.Utils.Objects.IsPlainObject,Tp=Phaser.Math.DegToRad,Op=Phaser.Math.RadToDeg;class Mp extends pc{constructor(t,e,i,s,r,n,a){var o,h,l,d,c,u,p,g;if(Pp(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=Sp(r,"x",null);null!==n?(t=n,i=n):(t=Sp(r,"left",0),i=Sp(r,"right",t));var a=Sp(r,"y",null);null!==a?(e=a,s=a):(e=Sp(r,"top",0),s=Sp(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 Op(this.verticeRotation)}set verticeAngle(t){this.verticeRotation=Tp(t)}setVerticeAngle(t){return this.verticeAngle=t,this}}const Ep={right:0,down:1,left:2,up:3};var _p=function(t){return"string"==typeof t&&(t=Ep[t]),t%=4};Object.assign(Mp.prototype,kp,wp),t.register("triangle",(function(t,e,i,s,r,n){var a=new Mp(this.scene,t,e,i,s,r,n);return this.scene.add.existing(a),a})),P(window,"RexPlugins.UI.Triangle",Mp),F();const Rp=Phaser.GameObjects.Zone,Lp=Phaser.Utils.Array.Add,Bp=Phaser.Utils.Array.Remove;let Ip=class extends Rp{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 Lp(this.children,t,0,(function(t){t.once("destroy",e.onChildDestroy,e)}),this),this}remove(t,e){var i=this;return Bp(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;iYp(t),resetChildState(t){return this.resetChildPositionState(t).resetChildVisibleState(t).resetChildAlphaState(t).resetChildActiveState(t),this},resetChildrenState(t){for(var e=0,i=t.length;eYp(t).x,getChildLocalY:t=>Yp(t).y};const ig=Phaser.Math.DegToRad;var sg={updateChildRotation(t){var e=Yp(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=Yp(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 Yp(t).rotation=e,this.updateChildRotation(t),this},setChildLocalAngle(t,e){return Yp(t).rotation=ig(e),this.updateChildRotation(t),this},resetLocalRotationState(){var t=Yp(this).parent;return t&&t.resetChildRotationState(this),this},getChildLocalRotation:t=>Yp(t).rotation},rg={updateChildScale(t){var e=Yp(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=Yp(t),i=e.parent;return e.scaleX=tg(t.scaleX,i.scaleX),e.scaleY=tg(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=Yp(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=Yp(this).parent;return t&&t.resetChildScaleState(this),this},getChildLocalScaleX:t=>Yp(t).scaleX,getChildLocalScaleY:t=>Yp(t).scaleY},ng={updateChildVisible(t){var e=Yp(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=Yp(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),Yp(t).visible=e,this.updateChildVisible(t),this},setChildMaskVisible(t,e){return void 0===e&&(e=!0),Yp(t).maskVisible=e,this.updateChildVisible(t),this},resetLocalVisibleState(){var t=Yp(this).parent;return t&&t.resetChildVisibleState(this),this},getChildLocalVisible:t=>Yp(t).visible},ag={updateChildAlpha(t){var e=Yp(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=Yp(t),i=e.parent;return e.alpha=tg(t.alpha,i.alpha),this},setChildAlpha(t,e){return t.alpha=e,this.resetChildAlphaState(t),this},setChildLocalAlpha(t,e){return Yp(t).alpha=e,this.updateChildAlpha(t),this},resetLocalAlphaState(){var t=Yp(this).parent;return t&&t.resetChildAlphaState(this),this},getChildLocalAlpha:t=>Yp(t).alpha},og={updateChildActive(t){var e=Yp(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 Yp(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),Yp(t).active=e,this.updateChildActive(t),this},resetLocalActiveState(){var t=Yp(this).parent;return t&&t.resetChildActiveState(this),this},getChildLocalActive:t=>Yp(t).active},hg={updateChildScrollFactor(t){var e=Yp(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}},lg={updateCameraFilter(t){var e=Yp(t),i=e.parent;return e.syncCameraFilter&&(t.cameraFilter=i.cameraFilter),this},syncCameraFilter(){return this.syncChildrenEnable&&this.children.forEach(this.updateCameraFilter,this),this}},dg={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}},cg=function(t){return t.filter((function(t){return!!t.displayList||!!t.parentContainer||void 0}))},ug={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}},pg=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 vg=Phaser.Utils.Array;var fg={getChildren(t){if(t)for(var e=0,i=this.children.length;e=0;e--)this.remove(this.backgroundChildren[e],t);return this}},Ov=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 Mv=/(\S+)\[(\d+)\]/i;var Ev={getInnerPadding(t){return Ps(this.space,t)},setInnerPadding(t,e){return Ts(this.space,t,e),this},getOuterPadding(t){return Ps(this.getSizerConfig(this).padding,t)},setOuterPadding(t,e){return Ts(this.getSizerConfig(this).padding,t,e),this},getChildOuterPadding(t,e){return"string"==typeof t&&(t=this.getElement(t)),Ps(this.getSizerConfig(t).padding,e)},setChildOuterPadding(t,e,i){return"string"==typeof t&&(t=this.getElement(t)),Ts(this.getSizerConfig(t).padding,e,i),this}},_v=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}},Rv=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},Lv=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},Bv=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}},Iv=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},Dv=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},jv={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}},Av=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 Jf={delayCall(t,e,i){return this.delayCallTimer=function(t,e,i,s,r){var n=Ea(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}},qf={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}},Zf={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}},Qf={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}},tm={};Object.assign(tm,Jf,qf,Zf,Qf);const em=Phaser.Utils.Objects.GetValue;class im extends Ra{constructor(t,e){super(t,e),this.setTransitInTime(em(e,"duration.in",200)),this.setTransitOutTime(em(e,"duration.out",200)),this.setTransitInCallback(em(e,"transitIn")),this.setTransitOutCallback(em(e,"transitOut")),this.oneShotMode=em(e,"destroy",!1),this.delayCallTimer=void 0,this._state=new Kf(this,{eventEmitter:!1,initState:em(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(im.prototype,tm);const sm=Phaser.GameObjects.Rectangle;class rm extends sm{constructor(t,e,i){super(t,0,0,2,2,e,1),this.fullWindow=new Md(this),this.setAlpha(i)}get tint(){return this.fillColor}set tint(t){this.setFillStyle(t,this.fillAlpha)}}const nm=Phaser.Utils.Objects.GetValue;class am extends Ra{constructor(t,e){super(t,{eventEmitter:!1}),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setHitAreaMode(nm(t,"hitAreaMode",0)),this.setEnable(nm(t,"enable",!0)),this.setStopMode(nm(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 hm=Phaser.Utils.Objects.GetValue;class lm extends rm{constructor(t,e){super(t,hm(e,"color",0),hm(e,"alpha",.8)),this.touchEventStop=new am(this,{hitAreaMode:1})}}var dm={popUp(t,e){void 0!==t._modalScaleSave?(t.scaleX=t._modalScaleSave,t.scaleY=t._modalScaleSave):t._modalScaleSave=t.scaleX,Zv(t,e)},scaleDown(t,e){Qv(t,e,void 0,void 0,!1)},fadeIn(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,df(t,e)},fadeOut(t,e){cf(t,e,!1)}},cm=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,df(t,e,t.alpha)},um=function(t,e){cf(t,e,!1)},pm=function(t,e,i,s,r){return!(!t||s&&!s(t,e,i)||!Wn(t,!0).contains(e,i)||r&&!r(t,e,i))};const gm=Phaser.Utils.Objects.GetValue;let vm=class extends im{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=fm.popUp),null==e.transitOut&&(e.transitOut=fm.scaleDown),e.destroy=gm(e,"destroy",!0),super(t,e);var i=gm(e,"cover");this.cover=!1!==i?function(t,e){var i=t.scene,s=new lm(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(gm(i,"transitIn",cm)),this.setCoverTransitOutCallback(gm(i,"transitOut",um)));var s=gm(e,"touchOutsideClose",!1),r=gm(e,"duration.hold",-1),n=gm(e,"timeOutClose",r>=0),a=gm(e,"anyTouchClose",!1);gm(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),gm(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&&pm(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=fm[t]),t){case fm.popUp:t=dm.popUp;break;case fm.fadeIn:t=dm.fadeIn}return super.setTransitInCallback(t),this}setTransitOutCallback(t){switch("string"==typeof t&&(t=fm[t]),t){case fm.scaleDown:t=dm.scaleDown;break;case fm.fadeOut:t=dm.fadeOut}return super.setTransitOutCallback(t),this}setCoverTransitInCallback(t){return this.coverTransitInCallback=t,this}setCoverTransitOutCallback(t){return this.coverTransitOutCallback=t,this}};const fm={popUp:0,fadeIn:1,scaleDown:0,fadeOut:1};var mm=function(t,e){var i=new vm(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},ym=function(t,e){t.emit("modal.requestClose",e)},bm=function(t){return t&&"function"==typeof t},xm={modal(t,e){return bm(t)&&(e=t,t=void 0),void 0===this._modalBehavior&&(this.onCreateModalBehavior&&this.onCreateModalBehavior(this,t),this._modalBehavior=mm(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 ym(this,t),this}},Cm=function(t,e,i,s,r){bm(e)&&(r=s,s=i,i=e,e=this);var n=this.scene.events;return this.bindEvent(e,n,t,i,s,r),this},km={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 Cm.call(this,"preupdate",t,e,i,s),this},bindSceneUpdateEvent(t,e,i,s){return Cm.call(this,"update",t,e,i,s),this},bindScenePostupdateEvent(t,e,i,s){return Cm.call(this,"postupdate",t,e,i,s),this},bindSceneRenderEvent(t,e,i,s){return Cm.call(this,"render",t,e,i,s),this},bindScenePauseEvent(t,e,i,s){return Cm.call(this,"pause",t,e,i,s),this},bindSceneResumeEvent(t,e,i,s){return Cm.call(this,"resume",t,e,i,s),this},bindSceneSleepEvent(t,e,i,s){return Cm.call(this,"sleep",t,e,i,s),this},bindSceneWakeEvent(t,e,i,s){return Cm.call(this,"wake",t,e,i,s),this},bindSceneShutdownEvent(t,e,i,s){return Cm.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=Sm),s===e?(i.x=t.worldX,i.y=t.worldY):s.getWorldPoint(t.x,t.y,i),i):null},Sm={},Pm=function(t,e,i,s){var r,n=t.scene.sys.cameras.main,a=0===t.scrollFactorX&&0===t.scrollFactorY;if(e)return a?pm(t,e.x,e.y,i,s):!!(r=wm(e,n,!0))&&pm(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 zm={press:0,pointerdown:0,release:1,pointerup:1};var Fm={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 Am(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 Ym extends $f{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 Xm=Phaser.Utils.Objects.GetValue;class Wm extends Ra{constructor(t,e){super(t,e),this._enable=void 0,this.cooldown=new Ym,this.parent.setInteractive(Xm(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.prevIsInTouch=!1,this.isInTouching=!1,this.setEnable(Xm(t,"enable",!0)),this.setCooldown(Xm(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 Vm={isPointerInBounds(t){return void 0===t?t=this:"string"==typeof t&&(t=this.getElement(t)),!!t&&Pm(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 Wm(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 Wm(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}},Gm={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}},Hm=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===hy&&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=ly,this}isPointerInGameObject(t,e,i){var s=this.lastPointer;return!!s&&Pm(t,s,e,i)}}const oy=0,hy=1,ly="IDLE",dy=Phaser.Utils.Objects.GetValue,cy=Phaser.Math.Distance.Between;class uy extends ay{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=py},eventEmitter:!1};this.setRecongizedStateObject(new $f(s))}resetFromJSON(t){super.resetFromJSON(t),this.setHoldTime(dy(t,"time",250)),this.setTapInterval(dy(t,"tapInterval",200)),this.setDragThreshold(dy(t,"threshold",9)),this.setTapOffset(dy(t,"tapOffset",10));var e=dy(t,"taps",void 0);return void 0!==e?this.setTaps(e):(this.setMaxTaps(dy(t,"maxTaps",void 0)),this.setMinTaps(dy(t,"minTaps",void 0))),this}onDragStart(){switch(this.state){case py:this.state=gy;break;case gy:var t=this.lastPointer;cy(t.upX,t.upY,t.x,t.y)>this.tapOffset&&(this.state=vy,this.state=gy);break;case vy:this.state=gy}}onDragEnd(){this.state===gy&&(this.tapsCount++,this.emit("tapping",this,this.gameObject,this.lastPointer),void 0!==this.maxTaps&&this.tapsCount===this.maxTaps&&(this.state=vy))}onDrag(){this.state!==py&&this.pointer.getDistance()>this.dragThreshold&&(this.state=py)}preUpdate(t,e){if(this.isRunning&&this.enable&&this.state===gy){var i=this.lastPointer;i.isDown?t-i.downTime>this.holdTime&&(this.state=py):t-i.upTime>this.tapInterval&&(void 0===this.minTaps||this.tapsCount>=this.minTaps?this.state=vy:this.state=py)}}postUpdate(t,e){this.isRunning&&this.enable&&this.state===vy&&(this.state=py)}get isTapped(){return this.state===vy}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 py="IDLE",gy="BEGIN",vy="RECOGNIZED",fy=Phaser.Utils.Objects.GetValue;class my extends ay{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=yy},eventEmitter:!1};this.setRecongizedStateObject(new $f(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(fy(t,"threshold",9)),this.setHoldTime(fy(t,"time",251)),this}onDragStart(){this.state=by,0===this.holdTime&&(this.state=xy)}onDragEnd(){this.state=yy}onDrag(){this.state!==yy&&this.pointer.getDistance()>this.dragThreshold&&(this.state=yy)}preUpdate(t,e){this.isRunning&&this.enable&&this.state===by&&t-this.pointer.downTime>=this.holdTime&&(this.state=xy)}get isPressed(){return this.state===xy}setHoldTime(t){return this.holdTime=t,this}setDragThreshold(t){return this.dragThreshold=t,this}}const yy="IDLE",by="BEGIN",xy="RECOGNIZED",Cy=Phaser.Utils.Objects.GetValue;class ky extends ay{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 $f(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(Cy(t,"threshold",10)),this}onDragStart(){this.state=Sy,0===this.dragThreshold&&(this.state=Py)}onDragEnd(){this.state=wy}onDrag(){switch(this.state){case Sy:if(this.pointer.getDistance()>=this.dragThreshold){this.state=Py,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 Py: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===Py}setDragThreshold(t){return this.dragThreshold=t,this}}const wy="IDLE",Sy="BEGIN",Py="RECOGNIZED",Ty=Phaser.Math.Distance.Between,Oy=Phaser.Math.Angle.Between;var My={getDt:function(){return rc(this.scene)},getVelocity:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Ty(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 Oy(e.x,e.y,t.x,t.y)}},Ey={"up&down":0,"left&right":1,"4dir":2,"8dir":3},_y={};const Ry=Phaser.Utils.Objects.GetValue,Ly=Phaser.Math.RadToDeg;class By extends ay{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=Iy},eventEmitter:!1};this.setRecongizedStateObject(new $f(s)),this.clearDirectionStates()}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(Ry(t,"threshold",10)),this.setVelocityThreshold(Ry(t,"velocityThreshold",1e3)),this.setDirectionMode(Ry(t,"dir","8dir")),this}onDragStart(){this.state=Dy}onDragEnd(){this.state=Iy}onDrag(){this.state===Dy&&(this.validDrag||(this.validDrag=0===this.dragThreshold||this.pointer.getDistance()>=this.dragThreshold),this.validDrag&&this.dragVelocity>this.velocityThreshold&&(this.state=jy))}postUpdate(t,e){this.isRunning&&this.enable&&this.state===jy&&(this.state=Iy)}get isSwiped(){return this.state===jy}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=Ey[t]),this.dirMode=t,this}updateDirectionStates(){return function(t,e,i){switch(void 0===i?i={}:!0===i&&(i=_y),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}}(Ly(this.getVelocityAngle()),this.dirMode,this),this}clearDirectionStates(){return this.left=!1,this.right=!1,this.up=!1,this.down=!1,this}}Object.assign(By.prototype,My);const Iy="IDLE",Dy="BEGIN",jy="RECOGNIZED",Ay=Phaser.Utils.Objects.GetValue,zy=Phaser.Utils.Array.SpliceOne,Fy=Phaser.Math.Distance.Between,Yy=Phaser.Math.Angle.Between;class Xy{constructor(t,e){var i=Ea(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(Ay(e,"inputConfig",void 0)),this.setEventEmitter(Ay(e,"eventEmitter",void 0)),this._enable=void 0,this.pointers=[],this.movedState={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setEnable(Ay(t,"enable",!0)),this.bounds=Ay(t,"bounds",void 0),this.tracerState=Vy,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 Vy:this.tracerState=Gy,this.onDrag1Start();break;case Gy:this.tracerState=Hy,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],zy(this.pointers,e),this.tracerState){case Gy:this.tracerState=Vy,this.onDrag1End();break;case Hy:this.tracerState=Gy,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 Gy:this.onDrag1();break;case Hy:this.onDrag2()}}}dragCancel(){return this.tracerState===Hy&&this.onDrag2End(),this.pointers.length=0,q(this.movedState),this.tracerState=Vy,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!==Hy)return 0;var t=this.pointers[0],e=this.pointers[1];return Fy(t.x,t.y,e.x,e.y)}get angleBetween(){if(this.tracerState!==Hy)return 0;var t=this.pointers[0],e=this.pointers[1];return Yy(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;Wy.x=e.x-i.x,Wy.y=e.y-i.y}else Wy.x=0,Wy.y=0;return Wy}get centerX(){if(this.tracerState!==Hy)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.x+e.x)/2}get centerY(){if(this.tracerState!==Hy)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.y+e.y)/2}get prevCenterX(){if(this.tracerState!==Hy)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!==Hy)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=Uy,this}isPointer0InGameObject(t,e,i){var s=this.pointers[0];return!!s&&Pm(t,s,e,i)}isPointer1InGameObject(t,e,i){var s=this.pointers[1];return!!s&&Pm(t,s,e,i)}}Object.assign(Xy.prototype,ln);var Wy={};const Vy=0,Gy=1,Hy=2,Uy="IDLE",Ny=Phaser.Utils.Objects.GetValue;class $y extends Xy{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=Ky},eventEmitter:!1};this.setRecongizedStateObject(new $f(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(Ny(t,"threshold",0)),this}onDrag2Start(){this.scaleFactor=1,this.prevDistance=this.distanceBetween,this.state=Jy,0===this.dragThreshold&&(this.state=qy)}onDrag2End(){this.state=Ky}onDrag2(){switch(this.state){case Jy: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=qy}break;case qy:t=this.distanceBetween,this.scaleFactor=t/this.prevDistance,this.emit("pinch",this),this.prevDistance=t}}get isPinched(){return this.state===qy}setDragThreshold(t){return this.dragThreshold=t,this}}const Ky="IDLE",Jy="BEGIN",qy="RECOGNIZED",Zy=Phaser.Math.RotateAround;var Qy=function(t,e,i,s){return Zy(t,e,i,s),t.rotation+=s,t},tb={};const eb=Phaser.Utils.Objects.GetValue,ib=Phaser.Math.Angle.WrapDegrees,sb=Phaser.Math.Angle.ShortestBetween,rb=Phaser.Math.RadToDeg,nb=Phaser.Math.DegToRad;class ab extends Xy{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=hb},eventEmitter:!1};this.setRecongizedStateObject(new $f(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(eb(t,"threshold",0)),this}onDrag2Start(){this.prevAngle=ib(rb(this.angleBetween)),this.state=lb,0===this.dragThreshold&&(this.state=db)}onDrag2End(){this.state=hb}onDrag2(){switch(this.state){case lb:if(this.pointers[0].getDistance()>=this.dragThreshold&&this.pointers[1].getDistance()>=this.dragThreshold){var t=ib(rb(this.angleBetween));this.angle=sb(this.prevAngle,t),this.prevAngle=t,this.state=db}break;case db:t=ib(rb(this.angleBetween)),this.angle=sb(this.prevAngle,t),this.prevAngle=t,this.emit("rotate",this)}}get isRotated(){return this.state===db}get rotation(){return nb(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=tb),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)),(d=this.getSizerConfig(t)).align=i,d.padding=gv(s),Mb(r)?(d.expandWidth=Eb(r,"width",!1),d.expandHeight=Eb(r,"height",!1)):(d.expandWidth=r,d.expandHeight=r),t.isRexSizer||(d.expandWidth&&(t.minWidth=void 0===n?An(t):n),d.expandHeight&&(t.minHeight=void 0===a?zn(t):a)),d.alignOffsetX=o,d.alignOffsetY=h,d.aspectRatio=l,this.sizerChildren.hasOwnProperty(e)&&this.sizerChildren[e].destroy(),this.sizerChildren[e]=t,c&&this.addChildrenMap(e,t),this}};const Bb=Dg.prototype.clear;var Ib=function(t){this.backgroundChildren&&(this.backgroundChildren.length=0);var e,i=!t&&this.sizerEventsEnable;if(i&&(e=this.getChildren([])),Bb.call(this,t),i)for(var s,r=0,n=e.length;r0&&(Tb.width=e.aspectRatio,Tb.height=1,Ob.width=o,Ob.height=h,o=(l=kb(Tb,Ob,"FIT",!0)).width,h=l.height),t.isRexSizer?(t.runLayout(this,o,h),Pb(t,this)):Yv(t,o,h),s=d+i.left*this.scaleX,n=u-(i.left+i.right)*this.scaleX,r=c+i.top*this.scaleY,a=p-(i.top+i.bottom)*this.scaleY,Lm.call(this,t,s,r,n,a,e.align,e.alignOffsetX,e.alignOffsetY))}};Object.assign(jb,Lb,Db);var Ab=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 zb=Phaser.Utils.Objects.IsPlainObject,Fb=Phaser.Utils.Objects.GetValue;class Yb extends Cb{constructor(t,e,i,s,r,n){zb(e)?(e=Fb(n=e,"x",0),i=Fb(n,"y",0),s=Fb(n,"width",void 0),r=Fb(n,"height",void 0)):zb(s)&&(s=Fb(n=s,"width",void 0),r=Fb(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 Ab(this.sizerChildren,t);var e=t;return this.sizerChildren.hasOwnPropery(e)?e:null}}Object.assign(Yb.prototype,jb);var Xb=Phaser.Math.Distance.Between,Wb=function(t,e,i){var s=t.width/2;return Xb(s,s,e,i)<=s};const Vb=Phaser.Math.Angle.Between,Gb=Phaser.Math.Angle.Normalize;var Hb=function(t,e,i){if(this.enable&&t.isDown){var s=this.sizerChildren.knob;if(Wb(s,e,i)){var r=s.width/2,n=s.startAngle,a=Vb(r,r,e,i),o=s.anticlockwise?n-a:a-n,h=Gb(o)/(2*Math.PI);this.stopEaseValue(),0===this.easeValueDuration||Math.abs(this.value-h)<.1?this.value=h:this.easeValueTo(h)}}},Ub=function(){this.sizerChildren.knob.on("pointerdown",Hb,this).on("pointermove",Hb,this).setInteractive()};const Nb=Phaser.Math.Angle.Between,$b=Phaser.Math.Angle.Wrap;var Kb=function(t,e,i){if(this.enable&&!this.panPointer){var s=this.sizerChildren.knob;Wb(s,e,i)&&Zb.call(this,t)}},Jb=function(t,e,i){if(this.enable&&t.isDown){var s=this.sizerChildren.knob;switch(this.panState){case ex:Wb(s,e,i)&&Zb.call(this,t);break;case ix:Wb(s,e,i)?tx.call(this):Qb.call(this)}}},qb=function(t,e,i){this.enable&&this.panPointer===t&&Qb.call(this)},Zb=function(t){this.panPointer=t,this.panState=ix},Qb=function(){this.panPointer=void 0,this.panState=ex},tx=function(){var t=this.panPointer.prevPosition,e=this.panPointer.position,i=this.sizerChildren.knob,s=Nb(i.x,i.y,t.x,t.y),r=Nb(i.x,i.y,e.x,e.y),n=i.anticlockwise?s-r:r-s,a=$b(n)/(2*Math.PI);this.stopEaseValue(),this.value+=a};const ex=0,ix=1;var sx=function(){this.sizerChildren.knob.on("pointerdown",Kb,this).on("pointermove",Jb,this).on("pointerup",qb,this).setInteractive(),this.panPointer=void 0,this.panState=ex},rx=function(t){return void 0===t&&(t=this.value),this.textFormatCallbackScope?this.textFormatCallback(t):this.textFormatCallback.call(this.textFormatCallbackScope,t)},nx={setTextFormatCallback:function(t,e){return this.textFormatCallback=t,this.textFormatCallbackScope=e,this},getFormatText:rx,updateText:function(t){var e=this.sizerChildren.text;return e&&this.textFormatCallback&&(e.setText(rx.call(this,t)),e.layout&&e.layout()),this}};const ax=Phaser.Utils.Objects.GetValue,ox=Phaser.Math.Snap.To;class hx extends(Xu(Yb)){constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexKnob",this.bootProgressBase(e);var i=ax(e,"background",void 0),s=ax(e,"text",void 0);i&&this.addBackground(i),s&&(e.textColor=void 0,e.textStrokeColor=void 0,this.setTextFormatCallback(ax(e,"textFormatCallback",void 0),ax(e,"textFormatCallbackScope",void 0)),e.textFormatCallback=void 0,e.textFormatCallbackScope=void 0);var r=new np(t,e);r.setDepth(ax(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(ax(e,"enable",void 0)),this.setGap(ax(e,"gap",void 0)),this.setValue(ax(e,"value",0),ax(e,"min",void 0),ax(e,"max",void 0));var n=ax(e,"input",0);switch("string"==typeof n&&(n=lx[n]),n){case 0:sx.call(this);break;case 1:Ub.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 lx={pan:0,drag:0,click:1,none:-1};Object.assign(hx.prototype,nx),t.register("knob",(function(t){var e=new hx(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.Knob",hx);const dx={arc:Cc,circle:kc,curve:class extends bc{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),HC(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(ek.prototype,$C);const sk={fit:1,FIT:1,envelop:2,ENVELOP:2};t.register("transitionImage",(function(t,e,i,s,r){var n=new ek(this.scene,t,e,i,s,r);return this.scene.add.existing(n),n})),P(window,"RexPlugins.UI.TransitionImage",ek);const rk=Phaser.Renderer.WebGL.Pipelines.PostFXPipeline,nk=Phaser.Utils.Objects.GetValue,ak=Phaser.Math.Clamp;class ok extends rk{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(nk(t,"progress",0)),this.setTransitionTargetTexture(nk(t,"toTexture","__DEFAULT"),nk(t,"toFrame",void 0),nk(t,"resizeMode",1)),this.setNoise(nk(t,"noiseX",void 0),nk(t,"noiseY",void 0),nk(t,"noiseZ",void 0)),this.setFromEdge(nk(t,"fromEdgeStart",.01),nk(t,"fromEdgeWidth",.05)),this.setToEdge(nk(t,"toEdgeStart",.01),nk(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=ak(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=hk[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 hk={stretch:0,contain:1,cover:2};const lk=Phaser.Utils.Array.SpliceOne,dk=.1,ck=[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-wo(s),t.setChildLocalScale(e,r,r)):(e.visible&&t.setChildVisible(e,!1),r=1-wo(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=wo(s),r=Math.floor(255*(1-s)),e.tint=(r<<16)+(r<<8)+r):(e.visible&&t.setChildVisible(e,!1),s=wo(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 Px(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=wo(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=wo(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 Px(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=wo(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=wo(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 Px(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 Px(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,ok),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(dk,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(dk,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(dk,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(dk,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 uk extends ek{constructor(t,e,i,s,r,n){super(t,e,i,s,r,n);for(var a=0,o=ck.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(Jk.prototype,Hk),t.register("fileDropZone",(function(t){var e=new Jk(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.FileDropZone",Jk);const qk=Phaser.Math.Wrap;var Zk=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 iw=Phaser.Utils.Objects.IsPlainObject,sw=Phaser.Utils.Objects.GetValue,rw=Phaser.Display.Align.CENTER,nw={min:0,full:-1};var aw=function(t,e,i,s,r,n,a,o,h,l){fv.call(this,t);var d=t.isRexSpace,c=typeof e;if(null===e)return this;if("number"===c);else if("string"===c)e=nw[e];else if(iw(e)){var u;e=sw(u=e,"proportion",void 0),i=sw(u,"align",rw),s=sw(u,"padding",0),r=sw(u,"expand",!1),n=sw(u,"key",void 0),a=sw(u,"index",void 0),t.isRexSizer||(o=sw(u,"minWidth",void 0),h=sw(u,"minHeight",void 0)),l=sw(u,"fitRatio",0)}return"string"==typeof i&&(i=zg[i]),void 0===e&&(e=d?1:0),void 0===i&&(i=rw),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===o&&(d?o=0:t.isRexSizer||(o=t._minWidth)),void 0===h&&(d?h=0:t.isRexSizer||(h=t._minHeight)),void 0===l||!1===l?l=0:!0===l&&(l=An(t)/zn(t)),(u=this.getSizerConfig(t)).proportion=e,u.align=i,u.padding=gv(s),u.expand=r,u.fitRatio=0===e?l:0,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?An(t):o:t.minHeight=void 0===h?zn(t):h),r&&(0===this.orientation?t.minHeight=h:t.minWidth=o)),void 0!==n&&this.addChildrenMap(n,t),this},ow={add:aw,addSpace(t){return this.insertSpace(void 0,t),this},insertSpace(t,e){return void 0===e&&(e=1),aw.call(this,new tw(this.scene),{proportion:e,minWidth:0,minHeight:0,index:t}),this},insert(t,e,i,s,r,n,a,o){return iw(i)&&(i.index=t),aw.call(this,e,i,s,r,n,a,t,o),this},insertAtPosition(t,e,i,s,r,n,a,o,h){var l=ew.call(this,t,e);return-1===l&&(l=void 0),this.insert(l,i,s,r,n,a,o,h),this}};const hw=Phaser.Utils.Array.Remove;var lw={remove(t,e){return this.getParentSizer(t)!==this||(hw(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,Ib.call(this,t),this}},dw={getChildAlign(t){return this.getSizerConfig(t).align},setChildAlign(t,e){return"string"==typeof e&&(e=zg[e]),this.getSizerConfig(t).align=e,this}},cw={getChildProportion(t){return this.getSizerConfig(t).proportion},setChildProportion(t,e){return this.getSizerConfig(t).proportion=e,this}},uw={getChildExpand(t){return this.getSizerConfig(t).expand},setChildExpand(t,e){return this.getSizerConfig(t).expand=e,this}},pw={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}},gw={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&&(Yv(t,0,0),e.resolved=!1,this.hasRatioFitChild=!0);return this._childrenProportion=void 0,this.hasProportion0Child=!1,this.proportionLength=void 0,Av.call(this),this},layoutChildren:function(){for(var t,e,i,s,r,n,a,o,h,l,d=this.sizerChildren,c=this.innerLeft,u=this.innerTop,p=this.innerWidth,g=this.innerHeight,v=c,f=u,m=this.startChildIndex,y=0,b=d.length;y0?(e=t-this.getChildrenWidth(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},resolveHeight:function(t){if(void 0!==(t=Bv.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)||Rv.call(this)},runWidthWrap:function(t){this.wrapResult||(1===this.orientation&&Zk.call(this,t,void 0),Lv.call(this,t))},hasHeightWrap:function(){return!(!this.hasRatioFitChild||0!==this.orientation)||Iv.call(this)},runHeightWrap:function(t){this.wrapResult||(0===this.orientation&&Zk.call(this,void 0,t),Dv.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(gw,ow,lw,dw,cw,uw,pw);var vw=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},fw={x:0,h:0,horizontal:0,"left-to-right":0,y:1,v:1,vertical:1,"top-to-bottom":1},mw=function(t){return"string"==typeof t&&(t=fw[t]),t};const yw=Phaser.Utils.Objects.IsPlainObject,bw=Phaser.Utils.Objects.GetValue;class xw extends Cb{constructor(t,e,i,s,r,n,a){yw(e)?(e=bw(a=e,"x",0),i=bw(a,"y",0),s=bw(a,"width",void 0),r=bw(a,"height",void 0),n=bw(a,"orientation",0)):yw(s)?(s=bw(a=s,"width",void 0),r=bw(a,"height",void 0),n=bw(a,"orientation",0)):yw(n)&&(n=bw(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(bw(a,"space.item",0)),this.setStartChildIndex(bw(a,"startChildIndex",0)),this.setRTL(bw(a,"rtl",!1)),this.addChildrenMap("items",this.sizerChildren)}setOrientation(t){return this.orientation=mw(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=vw.call(this)),this._childrenProportion}}Object.assign(xw.prototype,gw);var Cw=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}},kw={appendText:Mi,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 ww 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&&(Cw(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&&(Cw(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&&Cw(t,this.iconWidth,this.iconHeight);var e=this.childrenMap.action;e&&void 0!==this.actionWidth&&void 0!==this.actionHeight&&Cw(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(ww.prototype,kw);var Sw=function(t,e,i,s){var r=new FC(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 Pw=Phaser.GameObjects.Text;var Tw=function(t){return t instanceof Pw};const Ow=Phaser.GameObjects.BitmapText;var Mw=function(t){return t instanceof Ow},Ew=function(t){return Mw(t)?2:Tw(t)?0:1},_w=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},Lw=function(t,e){switch(Ew(t)){case 0:switch("string"==typeof e&&(e=Be[e]||0),t.style.wrapMode=e,e){case 2:case 3:t.style.wordWrapCallback=_w;break;default:t.style.wordWrapCallback=null}break;case 1:"string"==typeof e&&(e=Be[e]||0),t.style.wrapMode=e}},Bw=function(t,e){return void 0===e&&(e=0),t._minWidth=e,t.runWidthWrap=function(t){return t instanceof hn}(t)?function(t){return function(e){return t.setFixedSize(e,0).runWordWrap(),t.minHeight=t.height,t}}(t):Mw(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 Tw(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 Iw=65535;var Dw=function(t,e,i){if(null==e)return t;if(0===e)return zw(t,0,i),t;var s=t.text.length;if(0===s)return zw(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=Aw(t,r,e,i,n),o=0;o<=Iw&&0!==a;o++){if((r+=a)<0){r=0;break}a=Aw(t,r,e,i,n)}return o===Iw&&console.warn("FontSizeFit: Test count exceeds 65535"),t.setFontSize(r),zw(t,e,i),t},jw=function(t,e,i){return void 0===i[e]&&(t.setFontSize(e),i[e]={width:t.width,height:t.height}),i[e]},Aw=function(t,e,i,s,r){var n,a=jw(t,e,r),o=jw(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)},zw=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 Fw=Phaser.Utils.Objects.GetValue;var Yw=function(t,e){"number"==typeof e&&(e={minWidth:e});var i=Fw(e,"minWidth",0),s=Fw(e,"minHeight",0),r=Fw(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 Dw(t,e,i),t}):(t.runWidthWrap=function(e){return t.setFixedSize&&t.setFixedSize(0,0),Dw(t,e,void 0),t},t.resize=function(e,i){return t.width===e&&t.height===i||t.setFixedSize(e,i),t}),t};const Xw=Phaser.Utils.Objects.GetValue;class Ww extends ww{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexLabel";var i,s=Xw(e,"background",void 0),r=Xw(e,"icon",void 0),n=Xw(e,"iconMask",void 0),a=Xw(e,"text",void 0),o=Xw(e,"action",void 0),h=Xw(e,"actionMask",void 0),l=Xw(e,"align",void 0);if(s&&this.addBackground(s),r){0===this.orientation?(a||o)&&(i={right:Xw(e,"space.icon",0),top:Xw(e,"space.iconTop",0),bottom:Xw(e,"space.iconBottom",0),left:Xw(e,"space.iconLeft",0)}):(a||o)&&(i={bottom:Xw(e,"space.icon",0),left:Xw(e,"space.iconLeft",0),right:Xw(e,"space.iconRight",0),top:Xw(e,"space.iconTop",0)});var d=Xw(e,"squareFitIcon",!1)?1:0;if(this.add(r,{proportion:0,padding:i,fitRatio:d}),n&&(n=Sw.call(this,r,r,1)),!d){var c=Xw(e,"iconSize",void 0);this.setIconSize(Xw(e,"iconWidth",c),Xw(e,"iconHeight",c))}}if(a){var u=Xw(e,"wrapText",!1),p=Xw(e,"adjustTextFontSize",!1);u?(!0===u&&(u="word"),Lw(a,u),e.expandTextWidth=!0,Bw(a)):p&&(e.expandTextWidth=!0,e.expandTextHeight=!0,Yw(a,{fitHeight:!0}));var g,v,f=Xw(e,"space.text",0),m=Xw(e,"expandTextWidth",!1),y=Xw(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:Xw(e,"space.actionTop",0),bottom:Xw(e,"space.actionBottom",0),right:Xw(e,"space.actionRight",0)}:{left:Xw(e,"space.actionLeft",0),right:Xw(e,"space.actionRight",0),bottom:Xw(e,"space.actionBottom",0)},d=Xw(e,"squareFitAction",!1)?1:0,this.add(o,{proportion:0,padding:i,fitRatio:d}),h&&(h=Sw.call(this,o,o,1)),!d)){var b=Xw(e,"actionSize");this.setActionSize(Xw(e,"actionWidth",b),Xw(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 Vw=Phaser.Utils.Objects.GetValue;var Gw=function(t,e){var i=Vw(e,"canvas"),s=Vw(i,"width",128),r=Vw(i,"height",128),n=new Mu(t,0,0,s,r);t.add.existing(n);var a=Vw(i,"key"),o=Vw(i,"frame"),h=Vw(i,"fill");return void 0!==h?n.fill(h):void 0!==a&&n.loadTexture(a,o),n.setTexture=n.loadTexture.bind(n),n};const Hw=Phaser.Utils.Objects.GetValue;var Uw=function(t,e){var i=Hw(e,"clickTarget",this);return"string"==typeof i&&(i=t.getElement(i)),i};const Nw=Phaser.Utils.Objects.GetValue,$w={accept:"image/*",multiple:!1};var Kw=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)}))}},Jw={async openPromise(){var t=this;return Ik(this.scene.game,$w).then((function(e){return Kw(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}},qw={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(qw,Jw);const Zw=Phaser.Utils.Objects.GetValue;class Qw extends Ww{constructor(t,e){var i=function(t,e){var i=new mk(t,{scaleUp:Vw(e,"scaleUpIcon",!1),background:Vw(e,"iconBackground"),image:Gw(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=Uw(this,e),this.clickTarget&&(Zw(e,"domButton",!0)?this.fileChooser=function(t){var e=t.scene,i=new Xk(e,$w);return e.add.existing(i),t.pin(i),i.on("change",(function(){Kw(t,i.files)})),i}(this):this.clickBehavior=function(t,e){var i=Uw(t,e);if(i){var s=Nw(e,"click"),r=new hu(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(Qw.prototype,qw),t.register("imageInputLabel",(function(t){var e=new Qw(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.ImageInputLabel",Qw);let tS=class extends Ra{constructor(t,e){return super(t),new Proxy(this,this)}get(t,e){if(ae(t,e))return t[e];var i=t.parent;return ae(i,e)?i[e]:void 0}set(t,e,i){return ae(t,e)?t[e]=i:ae(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 eS=Phaser.Utils.Objects.GetValue;class iS extends Ra{constructor(t,e){super(t,e),this.style=eS(e,"style",this);var i=eS(e,"propertiesMap");this.activeStyle=sS(e,"active",i),this.hoverStyle=sS(e,"hover",i),this.disableStyle=sS(e,"disable",i),this.onModifyStyle=eS(e,"onModifyStyle")}getStyle(t){return Bd(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 Id(e,t)?void 0:(this.modifyStyle(t),e)}}setActiveState(t){return rS.call(this,"active",t),this}setHoverState(t){return rS.call(this,"hover",t),this}setDisableState(t){return rS.call(this,"disable",t),this}}var sS=function(t,e,i){var s=Rd(t,e);if(i)for(var r in s)i.hasOwnProperty(r)&&(s[i[r]]=s[r],delete s[r]);return s},rS=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))},nS={addStyleManager(t){return this.styleManager=new iS(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 aS=Phaser.GameObjects.Image,oS=Phaser.Utils.Objects.GetValue;class hS extends aS{constructor(t,e){void 0===e&&(e={}),super(t,oS(e,"x",0),oS(e,"y",0),oS(e,"key",""),oS(e,"frame",void 0)),this.type="rexStatesImage";var i=oS(e,"effects",!0);i&&Mn(this,i),this.style=new tS(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign(hS.prototype,nS),t.register("statesImage",(function(t){var e=new hS(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.StatesImage",hS);class lS extends jt{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexStatesRoundRectangleShape",e.style=this,e.propertiesMap=dS,this.addStyleManager(e),delete e.style,delete e.propertiesMap}}const dS={color:"fillColor",alpha:"fillAlpha",strokeWidth:"lineWidth"};Object.assign(lS.prototype,nS),t.register("statesRoundRectangle",(function(t){var e=new lS(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.StatesRoundRectangle",lS);let cS=class extends Ra{constructor(t,e){return super(t),new Proxy(this,this)}get(t,e){if(ae(t,e))return t[e];var i=t.parent;return ae(i,e)?i[e]:void 0}set(t,e,i){return ae(t,e)?t[e]=i:ae(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 uS=Phaser.GameObjects.NineSlice,pS=Phaser.Utils.Objects.GetValue;class gS extends uS{constructor(t,e){void 0===e&&(e={}),super(t,pS(e,"x",0),pS(e,"y",0),pS(e,"key",null),pS(e,"frame",null),pS(e,"width",0),pS(e,"height",0),pS(e,"leftWidth",0),pS(e,"rightWidth",0),pS(e,"topHeight",0),pS(e,"bottomHeight",0)),this.type="rexStatesNineSlice";var i=pS(e,"effects",!0);i&&Mn(this,i),this.style=new cS(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign(gS.prototype,nS),t.register("statesNineSlice",(function(t){var e=new gS(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.StatesNineSlice",gS);let vS=class extends Ra{constructor(t,e){return super(t),new Proxy(this,this)}get(t,e){if(ae(t,e))return t[e];var i=t.parent;return ae(i,e)?i[e]:void 0}set(t,e,i){return ae(t,e)?t[e]=i:ae(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 fS=Phaser.Utils.Objects.GetValue;class mS extends k{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexStatesNinePatch";var i=fS(e,"effects",!0);i&&Mn(this,i),this.style=new vS(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign(mS.prototype,nS),t.register("statesNinePatch",(function(t){var e=new mS(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.StatesNinePatch",mS);const yS=Phaser.GameObjects.Text,bS=Phaser.Utils.Objects.GetValue;class xS extends yS{constructor(t,e){void 0===e&&(e={}),super(t,bS(e,"x",0),bS(e,"y",0),bS(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,nS),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 CS extends Ra{constructor(t,e){return super(t),new Proxy(this,this)}get(t,e){if(ae(t,e))return t[e];var i=t.parent;return ae(i,e)?i[e]:void 0}set(t,e,i){return ae(t,e)?t[e]=i:ae(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 kS=Phaser.GameObjects.BitmapText,wS=Phaser.Utils.Objects.GetValue;class SS extends kS{constructor(t,e){void 0===e&&(e={});var i=wS(e,"x",0),s=wS(e,"y",0),r=wS(e,"font",""),n=wS(e,"fontSize",!1),a=wS(e,"align",0),o=wS(e,"tint");super(t,i,s,r,"",n,a),this.type="rexStatesBitmapText",void 0!==o&&this.setTint(o);var h=wS(e,"effects",!0);h&&Mn(this,h),this.style=new CS(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign(SS.prototype,nS),t.register("statesBitmapText",(function(t){var e=new SS(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.StatesBitmapText",SS);class PS extends dp{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=TS,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 TS={color:"trackColor",strokeColor:"trackStrokeColor",strokeWidth:"trackStrokeThickness"};Object.assign(PS.prototype,nS),t.register("statesBarRectangle",(function(t){var e=new PS(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.StatesBarRectangle",PS);var OS=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 MS=class extends Mu{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 ES={setChart:function(t){return window.Chart?(this.chart&&this.chart.destroy(),this.chart=new Chart(this.context,OS(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 AS(this.sizerChildren,null),Ib.call(this,t),this}},FS={setColumnSpace(t){if(this.space.column||(this.space.column=[]),this.space.column.length=this.columnCount-1,"number"==typeof t)AS(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},VS={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=Bv.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===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,AS(this.sizerChildren,null),this.columnProportions=[],this.columnProportions.length=t,"number"==typeof i)AS(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 US=Phaser.Utils.Objects.IsPlainObject,NS=Phaser.Utils.Objects.GetValue;class $S extends Cb{constructor(t,e,i,s,r,n,a,o,h,l){US(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)):US(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)):US(n)?(n=NS(l=n,"column",l.col||0),a=NS(l,"row",0),o=NS(l,"columnProportions",0),h=NS(l,"rowProportions",0)):US(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=GS.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($S.prototype,VS),t.register("gridSizer",(function(t,e,i,s,r,n,a,o,h){var l=new $S(this.scene,t,e,i,s,r,n,a,o,h);return this.scene.add.existing(l),l})),P(window,"RexPlugins.UI.GridSizer",$S);var KS=function(t,e,i,s){return e/t<=i?e/(s-1):0},JS=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=qS(o.left,o.centerY,t,e))&&(r=h,s=n);var h,l=i[n+1];l&&l.y===o.y||r>(h=qS(o.right,o.centerY,t,e))&&(r=h,s=n+1)}}return s};const QS=Phaser.Utils.Objects.IsPlainObject,tP=Phaser.Utils.Objects.GetValue,eP=Phaser.Display.Align.CENTER;var iP=function(t,e,i,s){return"\n"===t?(this.addNewLine(),this):(fv.call(this,t),QS(e)&&(e=tP(r=e,"padding",0),i=tP(r,"key",void 0),s=tP(r,"index",void 0)),void 0===e&&(e=0),(r=this.getSizerConfig(t)).align=eP,r.padding=gv(e),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},sP={add(t,e,i){if(Tm(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,Ib.call(this,t),this}},aP={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 JP=Phaser.Utils.Objects.GetValue,qP=Phaser.Math.Distance.Between;class ZP extends Ra{constructor(t,e){super(t,e),this._enable=void 0,this.rectBoundsInteractive=JP(e,"rectBoundsInteractive",!1),this.rectBoundsInteractive||t.setInteractive(JP(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(JP(t,"enable",!0)),this.holdThreshold=JP(t,"holdThreshold",50),this.pointerOutReleaseEnable=JP(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 rc(this.scene)}get speed(){return this.x===this.preX&&this.y===this.preY?0:qP(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&&!Pm(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&&!Pm(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 QP=Phaser.Utils.Objects.GetValue;class tT{constructor(t){this.resetFromJSON(t)}resetFromJSON(t){return this.setValue(QP(t,"value",0)),this.setSpeed(QP(t,"speed",0)),this.setAcceleration(QP(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 eT{constructor(){this.value,this.dir,this.movement=new tT}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 nT={y:0,v:0,vertical:0,x:1,h:1,horizontal:1},aT=Phaser.Utils.Objects.GetValue;class oT extends Ra{constructor(t,e){switch(super(t,e),this.parent!==this.scene?this.focusMode=aT(e,"focus",!0):this.focusMode=!1,"boolean"==typeof this.focusMode&&(this.focusMode=this.focusMode?1:0),this.setSpeed(aT(e,"speed",.1)),this.setEnable(aT(e,"enable",!0)),this.focusMode){case 0:case 2:this.scene.input.on("wheel",this.onSceneScroll,this);break;default:t.setInteractive(aT(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||Pm(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 hT=Phaser.Utils.Objects.GetValue;var lT=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)?hT(s,l,void 0):hT(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=Ve(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 $P(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);var p=hT(r,"position",0);"string"==typeof p&&(p=dT[p]);var g,v,f=hT(s,`space.slider${i}`,void 0);void 0===f&&void 0===(f=hT(s,"space.slider",void 0))&&(o?f=0:g=hT(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:hT(g,"right",g)}):(d=0,c=1,u=void 0===g?v?{right:f}:f:{right:hT(g,"left",g)}):0===p?(d=1,c=2,u=void 0===g?v?{top:f}:f:{top:hT(g,"bottom",g)}):(d=1,c=0,u=void 0===g?v?{bottom:f}:f:{bottom:hT(g,"top",g)}),e.add(n,{column:d,row:c,align:"center",padding:u,expand:!0}),t[`hideUnscrollableSlider${i}`]=hT(r,"hideUnscrollableSlider",!1),t[`adaptThumb${i}SizeMode`]=hT(r,"adaptThumbSize",!1),t[`minThumb${i}Size`]=hT(r,"minThumbSize",void 0)}else t[`hideUnscrollableSlider${i}`]=!1,t[`adaptThumb${i}SizeMode`]=!1,t[`minThumb${i}Size`]=void 0;var m,y,b=hT(s,"scrollDetectionMode");"string"==typeof b&&(b=cT[b]);var x=`scroller${i}`;(m=o||s.hasOwnProperty(x)?hT(s,x,!0):hT(s,"scroller",!0))&&h&&(!0===m&&(m={}),m.orientation=a?0:1,void 0!==b&&(m.rectBoundsInteractive=1===b),y=new rT(h,m),h.isRexContainerLite&&h.sendChildToBack(h));var C,k,w,S,P,T=hT(s,o?`mouseWheelScroller${i}`:"mouseWheelScroller",!1);T&&h&&(void 0!==b&&(T.focus=1===b?2:0),C=new oT(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.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 dT={right:0,left:1,bottom:0,top:1},cT={gameObject:0,rectBounds:1},uT=Phaser.Utils.Objects.GetValue;var pT=function(t,e){var i=t.scene,s=[0,1,0],r=[0,1,0],n=uT(e,"width"),a=uT(e,"height");n||uT(e,"child.expandWidth",!0)||(s[1]=0),a||uT(e,"child.expandHeight",!0)||(r[1]=0);var o=new $S(i,{column:3,row:3,columnProportions:s,rowProportions:r});switch(function(t,e,i){var s=bP(i,"child"),r=bP(s,"gameObject",void 0);if(r){var n=bP(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=bP(n,"top",0),a.bottom=bP(n,"bottom",0),o.left=bP(n,"left",0),o.right=bP(n,"right",0);break;case 1:a.top=bP(n,"left",0),a.bottom=bP(n,"right",0),o.top=bP(n,"top",0),o.bottom=bP(n,"bottom",0);break;default:a.top=bP(n,"top",0),a.bottom=bP(n,"bottom",0),a.left=bP(n,"left",0),a.right=bP(n,"right",0)}e.add(r,{column:1,row:1,align:bP(s,"align","center"),padding:o,expand:{width:bP(s,"expandWidth",!0),height:bP(s,"expandHeight",!0)}})}t.addChildrenMap("child",r)}(t,o,e),t.scrollMode){case 0:lT(t,o,"y",e);break;case 1:lT(t,o,"x",e);break;default:lT(t,o,"y",e),lT(t,o,"x",e)}return o},gT=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}`]}if(s){var n="Y"===t?this.scaleY:this.scaleX;s.setBounds(e,i*n)}r&&r.setEnable(e!==i)},vT=function(t){switch(this.scrollMode){case 0:case 1:(e=this.childrenMap.slider)&&this.hideUnscrollableSlider&&this.setChildVisible(e,this.isOverflow);break;default:t=t.toUpperCase();var e=this.childrenMap[`slider${t}`],i=this[`hideUnscrollableSlider${t}`],s=this[`isOverflow${t}`];e&&i&&this.setChildVisible(e,s)}},fT=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},wT=function(t){return(t-this.textLineSpacing)/(this.textLineHeight+this.textLineSpacing)},ST=function(t){return t*(this.textLineHeight+this.textLineSpacing)-this.textLineSpacing},PT=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},TT=function(t,e){switch(Ew(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}},OT=function(){var t=this.textObject.rexSizer;this.textObject.y+=t.offsetY-t.preOffsetY,t.preOffsetY=t.offsetY,this.resetChildPositionState(this.textObject),this.textCropEnable&&MT.call(this)},MT=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)}},ET=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()}},_T={setText:function(t){return void 0!==t&&(this.text=t),this.lines=kT(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(wT.call(this,-this.textOY)),0),e=ST.call(this,t)+this.textOY,i=PT.call(this,t);return TT(this.textObject,i),this.textObject.rexSizer.offsetY=e,OT.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,Av.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,ET.call(this,t,n,a),hv(t,s,r,n,a,e.align),e.preOffsetY=0,OT.call(this),this.textMask&&(this.textMask.setPosition().resize(),this.resetChildPositionState(this.textMask)))}};const RT=Phaser.Utils.Objects.IsPlainObject,LT=Phaser.Utils.Objects.GetValue,BT=Phaser.Display.Align.TOP_LEFT;class IT extends Cb{constructor(t,e,i,s,r,n){RT(e)?(e=LT(n=e,"x",0),i=LT(n,"y",0),s=LT(n,"width",void 0),r=LT(n,"height",void 0)):RT(s)&&(s=LT(n=s,"width",void 0),r=LT(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=LT(n,"content",""),this._textOY=0,this.execeedTopState=!1,this.execeedBottomState=!1,this.setClampMode(LT(n,"clampTextOY",!0)),this.alwaysScrollable=LT(n,"alwaysScrollable",!1);var a=LT(n,"background",void 0),o=LT(n,"text",void 0);void 0===o&&(o=DT(t)),this.textCropEnable=LT(n,"textCrop",!!o.setCrop);var h=LT(n,"textMask",!this.textCropEnable);a&&this.addBackground(a),this.add(o),this.sizerChildren=[o];var l=this.getSizerConfig(o);l.align=BT,l.padding=gv(0),l.expand=!0,this.textObject=o,this.textObjectType=Ew(o),l.preOffsetY=0,l.offsetY=0,h&&(this.textMask=Sw.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(wT.call(this,this._textObjectRealHeight))),this._visibleLinesCount}get topTextOY(){return 0}get bottomTextOY(){return-this.textVisibleHeight}get textHeight(){return void 0===this._textHeight&&(this._textHeight=ST.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 DT=function(t){return t.add.text(0,0,"")};Object.assign(IT.prototype,_T);var jT={setText(t){return this.childrenMap.child.setText(t),this.resizeController(),this},appendText(t){return this.setText(this.text+t),this}},AT={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 zT=Phaser.Utils.Objects.GetValue;class FT extends xT{constructor(t,e){void 0===e&&(e={});var i=zT(e,"text",void 0),s=zT(e,"textWidth",void 0),r=zT(e,"textHeight",void 0),n=zT(e,"textCrop",!!i.setCrop),a=zT(e,"textMask",!n),o=zT(e,"content",""),h=new IT(t,{width:s,height:r,text:i,textMask:a,textCrop:n&&!a,content:o,clampTextOY:zT(e,"clampChildOY",!1),alwaysScrollable:zT(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=zT(e,"space",void 0);l&&(l.child=zT(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(FT.prototype,jT,AT);const YT=Phaser.Utils.Objects.GetValue;var XT=function(t,e,s){e=e?i(e):{};var r=YT(s,"background",vP),n=YT(s,"text",WT),a=YT(s,"track",vP),o=YT(s,"thumb",vP);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 FT(t,e);return t.add.existing(l),l},WT=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 SS(t,e);break;case"bbcodetext":case"bbcode":s=new ds(t,0,0,"",e);break;case"label":s=new UT(t,e);break;case"textarea":s=XT(t,e);break;default:s=new xS(t,e)}return gP(s,e),t.add.existing(s),s},VT=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 mS(t,e):new gS(t,e);break;case"roundRectangle":s=new lS(t,e);break;default:s=new hS(t,e)}return gP(s,e),t.add.existing(s),s};const GT=Phaser.Utils.Objects.GetValue;var HT=function(t,e,s){e=e?i(e):{};var r=GT(s,"background",vP),n=GT(s,"text",WT),a=GT(s,"icon",VT),o=GT(s,"action",VT);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 UT extends Ww{constructor(t,e,i){super(t,e=HT(t,e,i)),this.type="rexSimpleLabel"}setActiveState(t){return NT(this.getChildren(),"setActiveState",t),this}setHoverState(t){return NT(this.getChildren(),"setHoverState",t),this}setDisableState(t){return NT(this.getChildren(),"setDisableState",t),this}}var NT=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=cO(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(Tm(s)||(s=Bc(fO,i,1)),cO(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=mO[t]),this.timeUnit=t,this}}var fO=[];const mO={ms:0,s:1,sec:1},yO={abs:0,absolute:0,inc:1,increment:1};var bO=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 CO=Phaser.Utils.Objects.GetValue;class kO extends lO{constructor(t,e){super(t,e),this.type="rexExpBar",this.setTotalEaseDuration(CO(e,"easeDuration",1e3)),this.levelCounter=new dO(CO(e,"levelCounter")),this.player=new vO(this,{scope:this,dtMode:1}),this.levelCounter.on("levelup",bO,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(kO.prototype,xO),t.register("expBar",(function(t){var e=new kO(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.ExpBar",kO);const wO=xw.prototype.add,SO=xw.prototype.addSpace;var PO=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)&&SO.call(this),wO.call(this,t,{proportion:i,expand:!0});var s=!this.buttonsExpand&&"center"===this.buttonsAlign;s&&SO.call(this),this.hasTailSpace=s}else wO.call(this,t,{proportion:i,expand:!0}),this.hasTailSpace=!1;else if(this.hasTailSpace){var r=this.sizerChildren.length-1;wO.call(this,t,{index:r,proportion:i,expand:!0})}else wO.call(this,t,{proportion:i,expand:!0});return e&&this.buttonGroup.add(t),this},TO={addButton(t){if(Tm(t))for(var e=t,i=0,s=e.length;i=0;i--)EO.call(this,e[i],t);return this}},RO=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)}},LO=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,RO.call(e,t,i,s)}},enumerable:!0,configurable:!0}),t.selected=!1},BO={add(t){return this.buttons.push(t),t._click||(t._click=new hu(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`),LO.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--)KO.call(this,e[i],t);return this}};const qO=Phaser.Utils.Objects.GetValue;class ZO extends $S{constructor(t,e){void 0===e&&(e={});var i=qO(e,"row",0),s=qO(e,"column",e.col||0),r=qO(e,"createCellContainerCallback"),n=qO(e,"buttons",void 0),a=qO(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&&QO.addNewLine(this)}else for(n=0,a=t.length;n=0;i--)rM.call(this,e[i],t);return this}};const aM=Phaser.Utils.Objects.GetValue;class oM extends cP{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 YO({parent:this,eventEmitter:aM(e,"eventEmitter",this),groupName:aM(e,"groupName",void 0),clickConfig:aM(e,"click",void 0)}).setButtonsType(e);var s=aM(e,"background",void 0),r=aM(e,"buttons",void 0);this.buttonsAlign=aM(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(oM.prototype,eM,nM,FO,WO),t.register("fixWidthButtons",(function(t){var e=new oM(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.FixWidthButtons",oM);var hM={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 lM=Phaser.Utils.Objects.GetValue;class dM extends Ww{constructor(t,e){super(t,e),this.type="rexFileSelectorButton";var i=new Xk(t);t.add.existing(i),this.addBackground(i),this.addChildrenMap("fileChooser",i),this.setAccept(lM(e,"accept","")),this.setMultiple(lM(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(dM.prototype,hM),t.register("fileSelectorButton",(function(t){var e=new dM(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.FileSelectorButton",dM);var cM={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()}},uM={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,xm.modal.call(this,t,e),this}},pM={};Object.assign(pM,cM,uM);const gM=Phaser.Utils.Objects.GetValue;class vM extends xw{constructor(t,e){void 0===e&&(e={}),e.orientation=1,super(t,e),this.type="rexDialog",this.eventEmitter=gM(e,"eventEmitter",this);var i,s,r,n,a=gM(e,"background",void 0),o=gM(e,"title",void 0),h=gM(e,"toolbar",void 0),l=gM(e,"toolbarBackground",void 0),d=gM(e,"leftToolbar",void 0),c=gM(e,"leftToolbarBackground",void 0),u=gM(e,"content",void 0),p=gM(e,"description",void 0),g=gM(e,"choices",void 0),v=gM(e,"choicesBackground",void 0),f=gM(e,"actions",void 0),m=gM(e,"actionsBackground",void 0),y=gM(e,"click",void 0);if(a&&this.addBackground(a),h&&(r=new GO(t,{groupName:"toolbar",background:l,buttons:h,orientation:0,space:{item:gM(e,"space.toolbarItem",0)},click:y,eventEmitter:this.eventEmitter}),t.add.existing(r)),d&&(n=new GO(t,{groupName:"leftToolbar",background:c,buttons:d,orientation:0,space:{item:gM(e,"space.leftToolbarItem",0)},click:y,eventEmitter:this.eventEmitter}),t.add.existing(n)),o||h||d){var b,x=!!o&&gM(e,"expand.title",!0),C=gM(e,"align.title","center"),k=!(o&&!x&&"center"===C||!o&&(h||d));b=k?new xw(t,{orientation:0}):new Yb(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:gM(e,"space.titleLeft",0),right:gM(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:gM(e,"space.title",0),top:gM(e,"space.titleTop",0)}),P=gM(e,"proportion.title",0),this.add(b,{padding:S,proportion:P,expand:!0})}if(u){var T=gM(e,"align.content","center"),O=gM(e,"space.content",0),M=(S={left:gM(e,"space.contentLeft",0),right:gM(e,"space.contentRight",0),bottom:p||g||f?O:0},P=gM(e,"proportion.content",0),gM(e,"expand.content",!0));this.add(u,{align:T,padding:S,proportion:P,expand:M})}if(p){T=gM(e,"align.description","center");var E=gM(e,"space.description",0);S={left:gM(e,"space.descriptionLeft",0),right:gM(e,"space.descriptionRight",0),bottom:g||f?E:0},P=gM(e,"proportion.description",0),M=gM(e,"expand.description",!0),this.add(p,{align:T,padding:S,proportion:P,expand:M})}if(g){var _=gM(e,"choicesType","").split("-"),R=fM(_,"wrap")?oM:fM(_,"grid")?ZO:GO,L=fM(_,"radio")?"radio":fM(_,"checkboxes")?"checkboxes":void 0,B={left:gM(e,"space.choicesBackgroundLeft",0),right:gM(e,"space.choicesBackgroundRight",0),top:gM(e,"space.choicesBackgroundTop",0),bottom:gM(e,"space.choicesBackgroundBottom",0)},I=gM(e,"space.choice",0);R===GO?B.item=I:R===oM?(B.item=I,B.line=gM(e,"space.choiceLine",I)):(B.column=gM(e,"space.choiceColumn",I),B.row=gM(e,"space.choiceRow",I));var D={width:gM(e,"choicesWidth",void 0),height:gM(e,"choicesHeight",void 0),groupName:"choices",buttonsType:L,background:v,buttons:g,space:B,click:y,eventEmitter:this.eventEmitter,setValueCallback:gM(e,"choicesSetValueCallback",void 0),setValueCallbackScope:gM(e,"choicesSetValueCallbackScope",void 0)};R===GO&&(D.orientation=fM(_,"x")?0:1),i=new R(t,D),t.add.existing(i);var j=gM(e,"space.choices",0);S={left:gM(e,"space.choicesLeft",0),right:gM(e,"space.choicesRight",0),bottom:f?j:0},T=gM(e,"align.choices","center"),P=gM(e,"proportion.choices",0),M=gM(e,"expand.choices",!0),this.add(i,{align:T,padding:S,proportion:P,expand:M}),this.buttonsType=L}f&&(s=new GO(t,{groupName:"actions",background:m,buttons:f,orientation:0,space:{item:gM(e,"space.action",0)},expand:gM(e,"expand.actions",!1),align:gM(e,"align.actions","center"),click:y,eventEmitter:this.eventEmitter}),t.add.existing(s),S={left:gM(e,"space.actionsLeft",0),right:gM(e,"space.actionsRight",0),bottom:gM(e,"space.actionsBottom",0)},P=gM(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 fM=function(t,e){return-1!==t.indexOf(e)},mM={actions:"action",choices:"choice",toolbar:"toolbar",leftToolbar:"leftToolbar"},yM=function(t,e){t.on(`button.${e}`,(function(i,s,r,n,a){mM.hasOwnProperty(s)&&t.emit(`${mM[s]}.${e}`,i,r,n,a)}))};Object.assign(vM.prototype,pM),t.register("dialog",(function(t){var e=new vM(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.Dialog",vM);var bM=function(t,e,i){var s=new UT(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))},CM=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)}},kM=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=_E(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(w_.prototype,b_);const S_=["top","bottom","centerY","center"],P_=["left","right","centerX","center"];var T_=function(t,e,i){var s,r="Y"===(e=e.toUpperCase()),n=this.childrenMap.child;if(r){if(i)for(var a=0,o=S_.length;a=0?0:Math.abs(l)<=Math.abs(d)?l:d}}else{if(i)for(a=0,o=P_.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 O_=Phaser.Utils.Objects.GetValue;class M_ extends xT{constructor(t,e){void 0===e&&(e={});var i=mP(e),s=O_(e,"panel",void 0);void 0===s&&(s={}),s.scrollMode=i,s.clampChildOY=O_(e,"clampChildOY",!1),s.clampChildOX=O_(e,"clampChildOX",!1);var r,n,a=new w_(t,s);switch(t.add.existing(a),i){case 0:r=O_(e,"expand.panel",!0),n=!0;break;case 1:r=!0,n=O_(e,"expand.panel",!0);break;default:r=!0,n=!0}e.type="rexScrollablePanel",e.child={gameObject:a,expandWidth:r,expandHeight:n,align:O_(e,"align.panel","center")};var o=O_(e,"space",void 0);o&&(o.child=O_(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]),yb(this.childrenMap.child,t),this}}var E_={scrollToChild:function(t,e){if(!this.hasChild(t))return this;switch(this.scrollMode){case 0:T_.call(this,t,"y",e);break;case 1:T_.call(this,t,"x",e);break;default:T_.call(this,t,"y",e),T_.call(this,t,"x",e)}return this}};Object.assign(M_.prototype,E_);const __=Phaser.Utils.Objects.GetValue;var R_=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=L_(e,u),this.listMaxHeight>0&&(s.layout(),s.height<=this.listMaxHeight&&(d=s)),!d){0===c&&(c=this.listMaxHeight);var p=B_(e,this.listCreateSliderTrackCallback),g=B_(e,this.listCreateSliderThumbCallback);d=new M_(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:__(this.listSpace,"panel",0)}}),e.add.existing(d)}}else u.height=c,s=L_(e,u),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},L_=function(t,e,i){var s;return i?(e.orientation="x",s=new oM(t,e)):(e.orientation="y",s=new GO(t,e)),t.add.existing(s),s},B_=function(t,e,i){var s;return e&&(s=e.call(i,t),t.add.existing(s)),s};const I_=Phaser.Utils.Objects.GetValue;var D_=function(t,e){var i=I_(e,"expandDirection",void 0);"string"==typeof i&&(i=j_[i]);var s,r,n,a,o,h,l,d=(n="alignTargetX",Td(s=e,r="alignTarget")?J(s,r):n&&Td(s,n)?J(s,n):a&&Td(s,a)?J(s,a):o),c=I_(e,"alignTargetY",d),u=I_(e,"alignOffsetX",0),p=I_(e,"alignOffsetY",0),g=I_(e,"alignSide","").includes("right"),v=I_(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=aa(t.scene)),m&&t.getBottomLeft().y>x.bottom&&(l=c.getTopLeft().y,t.setOrigin(0,1).setPosition(h+u,l+p))};const j_={down:0,up:1},A_=Phaser.Utils.Objects.GetValue;class z_ extends im{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=function(t,e){Zv(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 Jv(t,n):r.resetFromJSON(n),r.restart()}(t,e,"y","Linear")}),e.manualClose=!0,e.clickOutsideClose=!0,e.destroy=!0,super(t,e),D_(t,e),t.isRexSizer&&t.layout();var i=A_(e,"touchOutsideClose",!1),s=A_(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&&pm(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 F_={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}},Y_={openListPanel:function(){if(this.listPanel)return this;if(0===this.options.length)return this;var t,e=R_.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 z_(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(Y_,m_,F_);const X_=Phaser.Utils.Objects.GetValue;class W_ extends Ww{constructor(t,e){super(t,e),this.type="rexDropDownList",this.timer=void 0,this.listPanel=void 0,this.currentOverIndex=void 0,this.setOptions(X_(e,"options"));var i=X_(e,"list");this.setWrapEnable(X_(i,"wrap",!1)),this.setCreateButtonCallback(X_(i,"createButtonCallback")),this.setCreateListBackgroundCallback(X_(i,"createBackgroundCallback")),this.setCreateListSliderTrackCallback(X_(i,"createTrackCallback")),this.setCreateListSliderThumbCallback(X_(i,"createThumbCallback")),this.setListSliderAdaptThumbSizeEnable(X_(i,"sliderAdaptThumbSize",!1)),this.setListScrollerConfig(X_(i,"scroller")),this.setListMouseWheelScrollerConfig(X_(i,"mouseWheelScroller")),this.setButtonClickCallback(X_(i,"onButtonClick")),this.setButtonOverCallback(X_(i,"onButtonOver")),this.setButtonOutCallback(X_(i,"onButtonOut")),this.setListExpandDirection(X_(i,"expandDirection")),this.setListEaseInDuration(X_(i,"easeIn",500)),this.setListEaseOutDuration(X_(i,"easeOut",100)),this.setListTransitInCallback(X_(i,"transitIn")),this.settListTransitOutCallback(X_(i,"transitOut")),this.setListMaxHeight(X_(i,"maxHeight",0)),this.setListSize(X_(i,"width"),X_(i,"height",0)),this.setListAlignmentMode(X_(i,"alignParent","text")),this.setListAlignmentSide(X_(i,"alignSide","")),this.setListBounds(X_(i,"bounds")),this.setListSpace(X_(i,"space")),this.setListDraggable(X_(i,"draggable",!1)),this.setValueChangeCallback(X_(e,"setValueCallback"),X_(e,"setValueCallbackScope")),this.setValue(X_(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(W_.prototype,Y_),t.register("dropDownList",(function(t){var e=new W_(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.DropDownList",W_);var V_=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=HT(t,r,a);h.list=e.list||{},h.list.createButtonCallback=function(t,e){var i=bM(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 vP(t,l)},delete e.track);var d=e.thumb;return d&&(h.list.createThumbCallback=function(t){return vP(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 G_ extends W_{constructor(t,e,i){super(t,e=V_(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(K_,H_,N_,$_);const J_=Phaser.Utils.Objects.GetValue;Phaser.Math.Clamp;class q_ extends Ra{constructor(t,e){super(t,{eventEmitter:!1}),this.textObjectType=Ew(this.parent),this.pageStartIndexes=[],this.lines=kT(this.parent,""),this.sections=[],this.resetFromJSON(e)}resetFromJSON(t){this.setMaxLines(J_(t,"maxLines",void 0)),this.setPageBreak(J_(t,"pageBreak","\f\n")),this.setText(J_(t,"text","")),this.startLineIndex=J_(t,"start",-1),this.endLineIndex=J_(t,"end",void 0);var e=J_(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(Ew(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(q_.prototype,K_);var Z_={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?TT(this.parent,t):this.parent.setText(t)},appendText(t){var e=this.text.concat(Ae(t));return this.isTyping?this.setTypingContent(e):this.start(e,void 0,this.textLength),this}},Q_=function(t,e){return t.getPlainText&&(e=t.getPlainText(e)),e},tR=function(t,e){for(var i=void 0,s=0;s0?eR(n,t,a=(o=i)-d,o):"";var c,u=e-d;u>0?(o=(a=0)+u,this.insertIndex=o,c=eR(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=Q_(this.parent,t);n=tR(a,e)+s}return this.start(t,i,n,r)},stop:function(t){if(this.getTimer()&&this.freeTimer(),t){for(;!this.isLastChar;)iR.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,Z_);const rR=Phaser.Utils.Objects.GetFastValue,nR=Phaser.Utils.Objects.GetValue;class aR extends Ra{constructor(t,e){super(t,e),this.timer=null,this.resetFromJSON(e)}resetFromJSON(t){this.setTextWrapEnable(nR(t,"wrap",!1)),this.setTypeMode(nR(t,"typeMode",0)),this.setTypingSpeed(nR(t,"speed",333)),this.setTextCallback=rR(t,"setTextCallback",null),this.setTextCallbackScope=rR(t,"setTextCallbackScope",null),this.setTypingContent(rR(t,"text","")),this.typingIndex=rR(t,"typingIndex",0),this.insertIndex=null,this.insertChar=null;var e=rR(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=oR[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=Ae(t);this.textWrapEnable&&(e=function(t,e){switch(Ew(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=Q_(this.parent,this.text).length,this}onTyping(){var t=iR.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?TT(this.parent,t):this.parent.setText(t)}}const oR={"left-to-right":0,"right-to-left":1,"middle-to-sides":2,"sides-to-middle":3};Object.assign(aR.prototype,sR);const hR=Phaser.Utils.Objects.GetValue,lR={page:0,line:1};class dR 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=hR(i,"expandTextWidth",!1),n=hR(i,"expandTextHeight",!1);if(r||n){var a=Ew(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(hR(i,"typingMode","page")),this.page=new q_(s,hR(i,"page",void 0)),this.typing=new aR(s,hR(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=lR[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()}}}(ZT)){constructor(t,e){void 0===e&&(e={}),e.hasOwnProperty("layoutMode")||(e.layoutMode=1),super(t,e)}}t.register("textBox",(function(t){var e=new dR(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.TextBox",dR);class cR extends dR{constructor(t,e,i){super(t,e=tO(t,e,i))}}t.register("simpleTextBox",(function(t){var e=new cR(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.SimpleTextBox",cR);const uR=Phaser.Utils.Objects.GetValue;class pR extends xw{constructor(t,e){super(t,e),this.type="rexNumberBar";var i,s,r,n=uR(e,"background",void 0),a=uR(e,"icon",void 0),o=uR(e,"iconMask",void 0),h=uR(e,"slider",void 0),l=uR(e,"text",void 0),d=uR(e,"space.icon",0),c=uR(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=Sw.call(this,a,a,1))),h)&&(h.orientation=this.orientation,h.eventEmitter=this,h.value=null,h.hasOwnProperty("input")||(h.input=-1),i=new GP(t,h),t.add.existing(i),0===this.orientation?l&&(s={right:c}):l&&(s={bottom:c}),r=0===this.orientation?void 0===uR(h,"width",void 0)?1:0:void 0===uR(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=uR(e,"valuechangeCallback",null);if(null!==u){var p=uR(e,"valuechangeCallbackScope",void 0);this.on("valuechange",u,p)}this.setEnable(uR(e,"enable",void 0)),this.setValue(uR(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 pR(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.NumberBar",pR),t.register("scrollBar",(function(t){var e=new $P(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.ScrollBar",$P);const gR=Phaser.Utils.Objects.GetValue,vR={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 fR extends Yb{constructor(t,e){super(t,e),this.type="rexBadge";var i=gR(e,"background",void 0);i&&this.addBackground(i),this.addChildrenMap("background",i);var s=gR(e,"main",void 0);for(var r in s&&this.add(s,{key:"main",align:"center",expand:!1}),this.addChildrenMap("main",s),vR){var n=gR(e,r,void 0);n&&(this.add(n,{key:r,align:vR[r],expand:!1}),this.addChildrenMap(r,n))}}}t.register("badgeLabel",(function(t){var e=new fR(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.BadgeLabel",fR);const mR=Yb.prototype.add;var yR=function(t,e,i,s,r,n,a,o,h){return t.setVisible(!1),mR.call(this,t,e,i,s,r,n,a,o,h),this},bR={add:yR,addPage:yR};const xR=Dg.prototype.setChildVisible;var CR={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(CR,bR);const kR=Phaser.Utils.Objects.GetValue;class wR extends Yb{constructor(t,e){super(t,e),this.type="rexPages",this.childrenMap=this.sizerChildren,this._previousKey=void 0,this._currentKey=void 0,this.setSwapMode(kR(e,"swapMode",0)),this.setFadeInDuration(kR(e,"fadeIn",0))}setSwapMode(t){return"string"==typeof t&&(t=SR[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(wR.prototype,CR);const SR={invisible:0,destroy:1};t.register("pages",(function(t){var e=new wR(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.Pages",wR);const PR=Phaser.GameObjects.Mesh;class TR extends PR{get tint(){return 0===this.vertices.length?16777215:this.vertices[0].color}forceUpdate(){return this.dirtyCache[10]=1,this}}const OR=Phaser.Math.Vector3,MR=Phaser.Math.Matrix4;var ER=new OR,_R=new OR,RR=new MR;const LR=Phaser.Utils.Objects.IsPlainObject,BR=Phaser.Utils.Objects.GetValue,IR=Phaser.Geom.Mesh.GenerateGridVerts,DR=Phaser.Math.RadToDeg,jR=Phaser.Math.DegToRad,AR=1+1/Math.sin(jR(45));let zR=class extends TR{constructor(t,e,i,s,r,n){LR(e)&&(e=BR(n=e,"x",0),i=BR(n,"y",0),s=BR(n,"key",null),r=BR(n,"frame",null)),super(t,e,i,s,r),this.type="rexPerspectiveImage",this.setSizeToFrame(),this.resetPerspective(),this.panZ(AR),this.hideCCW=BR(n,"hideCCW",!0);var a=BR(n,"gridWidth",0),o=BR(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,IR({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 DR(this.rotationX)}set angleX(t){this.rotationX=jR(t)}get rotationY(){return this.modelRotation.y}set rotationY(t){this.modelRotation.y=t}get angleY(){return DR(this.rotationY)}set angleY(t){this.rotationY=jR(t)}get rotationZ(){return this.modelRotation.z}set rotationZ(t){this.modelRotation.z=t}get angleZ(){return DR(this.rotationZ)}set angleZ(t){this.rotationZ=jR(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),ER.set(e,i,s),_R.set(r,n,a),RR.fromRotationXYTranslation(_R,ER,!0);for(var o=0,h=t.vertices.length;o=0;i--)this.removePage(e[i].name,t);return this}},SL={top:1,left:3,right:5,bottom:7},PL={top:"bottom",left:"right",right:"left",bottom:"top"},TL={setTabsPadding(t,e){return this.childrenMap.tabs.setOuterPadding(t,e),this},getTabsPadding(t){return this.childrenMap.tabs.getOuterPadding(t)}},OL={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}MB.call(r,s,a.x,a.y)}}(t,s,r,i),t.transitInCallback(e,i,t)},RB={showMessage(t){var e=function(t,e,i){var s=e(t.scene,i,t);if(TB.call(s,(function(){t.removeMessage(s)})),t.displayTime){var r=t.transitInTime+t.displayTime+10;OB.call(s,r,(function(){t.removeMessage(s)}))}return s}(this,this.createMessageLabelCallback,t);return _B(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),OB.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 TI(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},MI={openColorPicker:function(){if(!this.colorPicker){var t=OI.call(this).layout(),e=new z_(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(MI,KB);const EI=Phaser.Utils.Objects.GetValue;class _I extends $B{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(EI(i,"width",160),EI(i,"height",170));var n=EI(i,"background");r=n?function(t){return vP(t,n)}:EI(i,"createBackgroundCallback"),this.setCreateColorPickerBackgroundCallback(r),this.setColorPickerHPalettePosition(EI(i,"hPalettePosition",0)),this.setColorPickerExpandDirection(EI(i,"expandDirection")),this.setColorPickerEaseInDuration(EI(i,"easeIn",200)),this.setColorPickerEaseOutDuration(EI(i,"easeOut",200)),this.setColorPickerTransitInCallback(EI(i,"transitIn")),this.setColorPickerTransitOutCallback(EI(i,"transitOut")),this.setColorPickerBounds(EI(i,"bounds"));var a=EI(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(EI(o,"height",30)),this.setColorComponentsFormatLabelConfig(EI(o,"formatLabel"));var h=EI(o,"inputText");h||(h=EI(e,"inputText")),this.setColorComponentsInputTextConfig(h);var l=EI(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(_I.prototype,MI),t.register("colorInput",(function(t){var e=new _I(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.ColorInput",_I),t.register("colorInputLite",(function(t){var e=new $B(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.ColorInputBase",$B),t.register("colorPicker",(function(t){var e=new mI(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.ColorPicker",mI),t.register("colorComponents",(function(t){var e=new SI(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.ColorComponents",SI);var RI=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 iD=function(t,e){var i=Ve(t);for(var s in e)i.hasOwnProperty(s)||(i[s]=e[s]);return i},sD=function(t,e,i){return vP(t,iD(e,i))},rD={setBindingTarget(t){return this.childrenMap.child.setBindingTarget(t),this}},nD={getMaxInputRowTitleWidth(){return this.childrenMap.child.getMaxInputRowTitleWidth()+this.getInnerPadding("left")},setInputRowTitleWidth(t){return t-=this.getInnerPadding("left"),this.childrenMap.child.setInputRowTitleWidth(t),this}};class aD extends AL{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(aD.prototype,rD,nD);const oD=Phaser.Utils.Objects.GetValue,hD=Phaser.Utils.Objects.GetValue;var lD={setBindingTarget(t){for(var e=this.childrenMap.pages.children,i=0,s=e.length;i0,setInputRowTitleWidth(t){return this}};const kD=Phaser.Utils.Objects.GetValue;class wD extends xw{constructor(t,e){void 0===e&&(e={}),e.orientation="y",super(t,e),this.type="rexTweaker.Wrap";var i=kD(e,"background",void 0),s=kD(e,"title",void 0);i&&this.addBackground(i),s&&this.add(s,{expand:!0,space:{bottom:kD(e,"space.title",0)}});var r=kD(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(wD.prototype,xD,CD);const SD=Phaser.Utils.Objects.GetValue,PD=Phaser.Utils.Objects.GetValue;var TD={setBindingTarget(t){return this.childrenMap.panel.setBindingTarget(t),this}},OD={getMaxInputRowTitleWidth(){return this.childrenMap.panel.getMaxInputRowTitleWidth()+this.getInnerPadding("left")},setInputRowTitleWidth(t){return t-=this.getInnerPadding("left"),this.childrenMap.panel.setInputRowTitleWidth(t),this}};class MD extends M_{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(MD.prototype,TD,OD);const ED=Phaser.Utils.Objects.GetValue,_D=Phaser.Utils.Objects.GetValue,RD=Phaser.Utils.Objects.GetValue;var LD={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=RD(t,"onGetValue"),this.onSetValue=RD(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}},BD={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)}}},ID={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 DD=Phaser.Utils.Objects.GetValue;class jD 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=DD(e,"proportion.title",0),o=DD(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=DD(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(jD.prototype,LD,BD,ID);var AD=function(t,e,i){var s=new tD(t,i);return t.add.existing(s),s},zD=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}}},FD=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=HD(this.styles,"inputRow")||{},r=GD(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,iD(e,i))}(this.scene,t,UD(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),ND(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=GM(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))}},ZD={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 gB(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()}},QD={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=GM(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 tj=Phaser.Utils.Objects.GetValue,ej=Phaser.Math.Linear,ij=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=tj(s,r),a=function(t,e){var i=new GP(t,e);return t.add.existing(i),i}(i,s),o=e.defaultExpandWidth?2:0,h=tj(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=GM(i,d).setNumberInput();o=e.defaultExpandWidth?1:0,h=tj(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=ej(t.minValue,t.maxValue,a.value);t.step&&(e=ij(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))}},rj=function(t,e){var i=new GO(t,e);return t.add.existing(i),i};const nj=Phaser.Utils.Objects.GetValue;var aj={name:"RangeInput",accept:t=>!!t.hasOwnProperty("view")&&"incdec"===t.view,build(t,e){var s=t.scene;t.type="rexTweaker.IncDecInput";var r=nj(e,"incDec")||{},n={text:null,action:null},a=rj(s,{expand:!1}),o=e.defaultExpandWidth?1:0;t.add(a,{proportion:o,expand:!0});var h=e.inputNumber||e.inputText,l=GM(s,h).setNumberInput();l.on("close",(function(){t.setValue(l.value)}));var d=Object.assign(i(n),r.incButton||{}),c=bM(s,d),u=Object.assign(i(n),r.decButton||{}),p=bM(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 _I(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)}},hj={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 uu(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)}},lj={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 Tu(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)}},dj=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=V_(t,e);var i=new W_(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=dj(t,e);if(null!=i)return t[i]}(i.options,e);i.resetDisplayContent(s).setMinSize(i.width,i.height).layout().setMinSize(0,0)}};const uj=Phaser.Utils.Objects.GetValue;var pj={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=uj(r,"expand",!0);n&&(r.align="center"),delete r.expand;var a=rj(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 zj=Phaser.Utils.Objects.IsPlainObject,Fj=Phaser.Utils.Objects.GetValue,Yj=Phaser.Math.DegToRad,Xj=Phaser.Math.RadToDeg;class Wj extends jj{constructor(t,e,i,s,r){if(zj(e)){var n=e;e=Fj(n,"x",0),i=Fj(n,"y",0),s=Fj(n,"key",null),r=Fj(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,Aj(this,this._skewX,this._skewY)}get skewXDeg(){return Xj(this._skewX)}set skewXDeg(t){this.skewX=Yj(t)}get skewY(){return this._skewY}set skewY(t){this._skewY=t,Aj(this,this._skewX,this._skewY)}get skewYDeg(){return Xj(this._skewY)}set skewYDeg(t){this.skewY=Yj(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 Vj=Phaser.Utils.Objects.IsPlainObject,Gj=Phaser.Utils.Objects.GetValue;class Hj extends Wj{constructor(t,e,i,s,r){if(Vj(e)){var n=e;e=Gj(n,"x",0),i=Gj(n,"y",0),s=Gj(n,"width",32),r=Gj(n,"height",32)}super(t,e,i,YR(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 Uj extends(cL(Hj)){get skewState(){return this.isRunning}}t.register("skew",(function(t,e){return new Uj(t,e)})),P(window,"RexPlugins.UI.Skew",Uj),t.register("anchor",(function(t,e){return new Uv(t,e)})),P(window,"RexPlugins.UI.Anchor",Uv),t.register("textTyping",(function(t,e){return new aR(t,e)})),P(window,"RexPlugins.UI.TextTyping",aR),t.register("textPage",(function(t,e){return new q_(t,e)})),P(window,"RexPlugins.UI.TextPage",q_);var Nj=void 0;const $j=Phaser.Utils.Objects.GetValue,Kj=Phaser.Utils.Objects.Clone;var Jj=function(t){return t.hasOwnProperty("align")?t.align:t.hasOwnProperty("halign")?t.halign:"left"};const qj=Phaser.Utils.Objects.GetValue,Zj=Phaser.Utils.Objects.Merge;var Qj={open:function(t,e){var i;void 0===t&&(t={}),t=Zj(t,this.openConfig),(i=this)!==Nj&&(void 0!==Nj&&Nj.close(),Nj=i),bm(t)&&(e=t,t=void 0);var s=qj(t,"inputType",void 0);void 0===s&&(s=qj(t,"type","text")),void 0===e&&(e=qj(t,"onClose",void 0));var r=qj(t,"onOpen",void 0),n=qj(t,"onTextChanged",void 0);return this.inputText=function(t,e){void 0===e&&(e={}),e=Kj(e);var i=t.scene,s=t.style,r=$j(e,"backgroundColor",s.backgroundColor);null===r&&(r="transparent"),e.text=$j(e,"text",t.text),e.fontFamily=$j(e,"fontFamily",s.fontFamily),e.fontSize=$j(e,"fontSize",s.fontSize),e.color=$j(e,"color",s.color),e.backgroundColor=r,e.direction=$j(e,"rtl",s.rtl)?"rtl":"ltr",e.align=$j(e,"align",Jj(s)),"rtl"===e.direction&&Tw(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=$j(e,"borderRadius",`${s.backgroundCornerRadius}px`));var a=new Ok(i,t.x,t.y,$j(e,"width",t.width),$j(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,qj(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===Nj&&(Nj=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 tA=Phaser.Utils.Objects.GetValue;class eA extends Ra{constructor(t,e){super(t),this.inputText=void 0,this.onClose=void 0,this.delayCall=void 0,this.setOpenConfig(e),tA(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(eA.prototype,Qj),t.register("textEdit",(function(t,e){return new eA(t,e)})),P(window,"RexPlugins.UI.TextEdit",eA),t.register("layerManager",(function(t){return new Oa(this.scene,t)})),P(window,"RexPlugins.UI.LayerManager",Oa);class iA 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&&Pm(t,e,i,s)}get viewport(){return aa(this.scene,this.scene.cameras.main,!0)}}var sA={getParentSizer:jp,getTopmostSizer:Ap,removeFromParent:$M,hide:Yf,show:Ff,isShown:Xf,confirmAction:AM,edit:function(t,e,i){return t._edit||(t._edit=new eA(t,{clickEnable:!1})),t._edit.open(e,i),t._edit},wrapExpandText:Bw,fontSizeExpandText:Yw,fontSizeResize:Dw,setFontSizeToFitWidth:Dw,waitEvent:rl,waitComplete:nl,delayPromise:_k,setChildrenInteractive:yb,fadeIn:df,fadeOutDestroy:cf,easeMoveTo:Cf,easeMoveFrom:kf,modal:mm,modalPromise:function(t,e){var i=mm(t,e);return new Promise((function(t,e){i.once("close",(function(e){t(e)}))}))},modalClose:ym,requestDrag:RI,openFileChooser:Ik};return Object.assign(iA.prototype,sA),iA},"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 iD=function(t,e){var i=Ve(t);for(var s in e)i.hasOwnProperty(s)||(i[s]=e[s]);return i},sD=function(t,e,i){return vP(t,iD(e,i))},rD={setBindingTarget(t){return this.childrenMap.child.setBindingTarget(t),this}},nD={getMaxInputRowTitleWidth(){return this.childrenMap.child.getMaxInputRowTitleWidth()+this.getInnerPadding("left")},setInputRowTitleWidth(t){return t-=this.getInnerPadding("left"),this.childrenMap.child.setInputRowTitleWidth(t),this}};class aD extends AL{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(aD.prototype,rD,nD);const oD=Phaser.Utils.Objects.GetValue,hD=Phaser.Utils.Objects.GetValue;var lD={setBindingTarget(t){for(var e=this.childrenMap.pages.children,i=0,s=e.length;i0,setInputRowTitleWidth(t){return this}};const kD=Phaser.Utils.Objects.GetValue;class wD extends xw{constructor(t,e){void 0===e&&(e={}),e.orientation="y",super(t,e),this.type="rexTweaker.Wrap";var i=kD(e,"background",void 0),s=kD(e,"title",void 0);i&&this.addBackground(i),s&&this.add(s,{expand:!0,space:{bottom:kD(e,"space.title",0)}});var r=kD(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(wD.prototype,xD,CD);const SD=Phaser.Utils.Objects.GetValue,PD=Phaser.Utils.Objects.GetValue;var TD={setBindingTarget(t){return this.childrenMap.panel.setBindingTarget(t),this}},OD={getMaxInputRowTitleWidth(){return this.childrenMap.panel.getMaxInputRowTitleWidth()+this.getInnerPadding("left")},setInputRowTitleWidth(t){return t-=this.getInnerPadding("left"),this.childrenMap.panel.setInputRowTitleWidth(t),this}};class MD extends M_{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(MD.prototype,TD,OD);const ED=Phaser.Utils.Objects.GetValue,_D=Phaser.Utils.Objects.GetValue,RD=Phaser.Utils.Objects.GetValue;var LD={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=RD(t,"onGetValue"),this.onSetValue=RD(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}},BD={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)}}},ID={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 DD=Phaser.Utils.Objects.GetValue;class jD 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=DD(e,"proportion.title",0),o=DD(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=DD(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(jD.prototype,LD,BD,ID);var AD=function(t,e,i){var s=new tD(t,i);return t.add.existing(s),s},zD=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}}},FD=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=HD(this.styles,"inputRow")||{},r=GD(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,iD(e,i))}(this.scene,t,UD(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),ND(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=GM(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))}},ZD={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 gB(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()}},QD={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=GM(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 tj=Phaser.Utils.Objects.GetValue,ej=Phaser.Math.Linear,ij=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=tj(s,r),a=function(t,e){var i=new GP(t,e);return t.add.existing(i),i}(i,s),o=e.defaultExpandWidth?2:0,h=tj(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=GM(i,d).setNumberInput();o=e.defaultExpandWidth?1:0,h=tj(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=ej(t.minValue,t.maxValue,a.value);t.step&&(e=ij(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))}},rj=function(t,e){var i=new GO(t,e);return t.add.existing(i),i};const nj=Phaser.Utils.Objects.GetValue;var aj={name:"RangeInput",accept:t=>!!t.hasOwnProperty("view")&&"incdec"===t.view,build(t,e){var s=t.scene;t.type="rexTweaker.IncDecInput";var r=nj(e,"incDec")||{},n={text:null,action:null},a=rj(s,{expand:!1}),o=e.defaultExpandWidth?1:0;t.add(a,{proportion:o,expand:!0});var h=e.inputNumber||e.inputText,l=GM(s,h).setNumberInput();l.on("close",(function(){t.setValue(l.value)}));var d=Object.assign(i(n),r.incButton||{}),c=bM(s,d),u=Object.assign(i(n),r.decButton||{}),p=bM(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 _I(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)}},hj={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 uu(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)}},lj={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 Tu(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)}},dj=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=V_(t,e);var i=new W_(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=dj(t,e);if(null!=i)return t[i]}(i.options,e);i.resetDisplayContent(s).setMinSize(i.width,i.height).layout().setMinSize(0,0)}};const uj=Phaser.Utils.Objects.GetValue;var pj={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=uj(r,"expand",!0);n&&(r.align="center"),delete r.expand;var a=rj(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 zj=Phaser.Utils.Objects.IsPlainObject,Fj=Phaser.Utils.Objects.GetValue,Yj=Phaser.Math.DegToRad,Xj=Phaser.Math.RadToDeg;class Wj extends jj{constructor(t,e,i,s,r){if(zj(e)){var n=e;e=Fj(n,"x",0),i=Fj(n,"y",0),s=Fj(n,"key",null),r=Fj(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,Aj(this,this._skewX,this._skewY)}get skewXDeg(){return Xj(this._skewX)}set skewXDeg(t){this.skewX=Yj(t)}get skewY(){return this._skewY}set skewY(t){this._skewY=t,Aj(this,this._skewX,this._skewY)}get skewYDeg(){return Xj(this._skewY)}set skewYDeg(t){this.skewY=Yj(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 Vj=Phaser.Utils.Objects.IsPlainObject,Gj=Phaser.Utils.Objects.GetValue;class Hj extends Wj{constructor(t,e,i,s,r){if(Vj(e)){var n=e;e=Gj(n,"x",0),i=Gj(n,"y",0),s=Gj(n,"width",32),r=Gj(n,"height",32)}super(t,e,i,YR(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 Uj extends(cL(Hj)){get skewState(){return this.isRunning}}t.register("skew",(function(t,e){return new Uj(t,e)})),P(window,"RexPlugins.UI.Skew",Uj),t.register("anchor",(function(t,e){return new Uv(t,e)})),P(window,"RexPlugins.UI.Anchor",Uv),t.register("textTyping",(function(t,e){return new aR(t,e)})),P(window,"RexPlugins.UI.TextTyping",aR),t.register("textPage",(function(t,e){return new q_(t,e)})),P(window,"RexPlugins.UI.TextPage",q_);var Nj=void 0;const $j=Phaser.Utils.Objects.GetValue,Kj=Phaser.Utils.Objects.Clone;var Jj=function(t){return t.hasOwnProperty("align")?t.align:t.hasOwnProperty("halign")?t.halign:"left"};const qj=Phaser.Utils.Objects.GetValue,Zj=Phaser.Utils.Objects.Merge;var Qj={open:function(t,e){var i;void 0===t&&(t={}),t=Zj(t,this.openConfig),(i=this)!==Nj&&(void 0!==Nj&&Nj.close(),Nj=i),bm(t)&&(e=t,t=void 0);var s=qj(t,"inputType",void 0);void 0===s&&(s=qj(t,"type","text")),void 0===e&&(e=qj(t,"onClose",void 0));var r=qj(t,"onOpen",void 0),n=qj(t,"onTextChanged",void 0);return this.inputText=function(t,e){void 0===e&&(e={}),e=Kj(e);var i=t.scene,s=t.style,r=$j(e,"backgroundColor",s.backgroundColor);null===r&&(r="transparent"),e.text=$j(e,"text",t.text),e.fontFamily=$j(e,"fontFamily",s.fontFamily),e.fontSize=$j(e,"fontSize",s.fontSize),e.color=$j(e,"color",s.color),e.backgroundColor=r,e.direction=$j(e,"rtl",s.rtl)?"rtl":"ltr",e.align=$j(e,"align",Jj(s)),"rtl"===e.direction&&Tw(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=$j(e,"borderRadius",`${s.backgroundCornerRadius}px`));var a=new Ok(i,t.x,t.y,$j(e,"width",t.width),$j(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,qj(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===Nj&&(Nj=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 tA=Phaser.Utils.Objects.GetValue;class eA extends Ra{constructor(t,e){super(t),this.inputText=void 0,this.onClose=void 0,this.delayCall=void 0,this.setOpenConfig(e),tA(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(eA.prototype,Qj),t.register("textEdit",(function(t,e){return new eA(t,e)})),P(window,"RexPlugins.UI.TextEdit",eA),t.register("layerManager",(function(t){return new Oa(this.scene,t)})),P(window,"RexPlugins.UI.LayerManager",Oa);class iA 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&&Pm(t,e,i,s)}get viewport(){return aa(this.scene,this.scene.cameras.main,!0)}}var sA={getParentSizer:jp,getTopmostSizer:Ap,removeFromParent:$M,hide:Yf,show:Ff,isShown:Xf,confirmAction:AM,edit:function(t,e,i){return t._edit||(t._edit=new eA(t,{clickEnable:!1})),t._edit.open(e,i),t._edit},wrapExpandText:Bw,fontSizeExpandText:Yw,fontSizeResize:Dw,setFontSizeToFitWidth:Dw,waitEvent:rl,waitComplete:nl,delayPromise:_k,setChildrenInteractive:yb,fadeIn:df,fadeOutDestroy:cf,easeMoveTo:Cf,easeMoveFrom:kf,modal:mm,modalPromise:function(t,e){var i=mm(t,e);return new Promise((function(t,e){i.once("close",(function(e){t(e)}))}))},modalClose:ym,requestDrag:RI,openFileChooser:Ik};return Object.assign(iA.prototype,sA),iA},"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..64ac89f22e 100644 --- a/plugin-list.js +++ b/plugin-list.js @@ -259,7 +259,6 @@ module.exports = { 'circularprogress': './templates/ui/circularprogress/CircularProgress.js', 'circularprogresscanvas': './templates/ui/circularprogresscanvas/CircularProgressCanvas.js', 'lineprogress': './templates/ui/lineprogress/LineProgress.js', - 'roundrectangleprogress': './templates/ui/roundrectangleprogress/RoundRectangleProgress.js', 'lineprogresscanvas': './templates/ui/lineprogresscanvas/LineProgressCanvas.js', 'knob': './templates/ui/knob/Knob.js', 'customshapes': './templates/ui/customshapes/CustomShapes.js',