From ebbc2c8fad626c83aedc5f3c3113affcb5d4f336 Mon Sep 17 00:00:00 2001 From: Rex Date: Tue, 29 Aug 2023 12:28:39 +0800 Subject: [PATCH] Export plugins --- dist/rexcanvasinputplugin.js | 160 ++++++++++++++++++++++------- dist/rexcanvasinputplugin.min.js | 2 +- dist/rexcolorcomponents.js | 160 ++++++++++++++++++++++------- dist/rexcolorcomponents.min.js | 4 +- dist/rexcolorinput.js | 160 ++++++++++++++++++++++------- dist/rexcolorinput.min.js | 6 +- dist/rexconfirmdialog.js | 33 +----- dist/rexconfirmdialog.min.js | 4 +- dist/rexdynamictext.js | 32 +----- dist/rexdynamictext.min.js | 2 +- dist/rexdynamictextplugin.js | 32 +----- dist/rexdynamictextplugin.min.js | 2 +- dist/rexsimpledropdownlist.js | 32 +----- dist/rexsimpledropdownlist.min.js | 2 +- dist/rexsimplelabel.js | 32 +----- dist/rexsimplelabel.min.js | 4 +- dist/rextextarea.js | 1 - dist/rextextarea.min.js | 2 +- dist/rextextplayer.js | 32 +----- dist/rextextplayer.min.js | 2 +- dist/rextextplayerplugin.js | 32 +----- dist/rextextplayerplugin.min.js | 2 +- dist/rextweaker.js | 160 ++++++++++++++++++++++------- dist/rextweaker.min.js | 2 +- dist/rexuimaker.js | 1 - dist/rexuimaker.min.js | 2 +- dist/rexuiplugin.js | 161 +++++++++++++++++++++++------- dist/rexuiplugin.min.js | 8 +- 28 files changed, 654 insertions(+), 418 deletions(-) diff --git a/dist/rexcanvasinputplugin.js b/dist/rexcanvasinputplugin.js index 767a502c75..32b642d7a0 100644 --- a/dist/rexcanvasinputplugin.js +++ b/dist/rexcanvasinputplugin.js @@ -991,36 +991,9 @@ return GetBobWorldPosition(this.parent, this, offsetX, offsetY, out); }; - var ScrollTo = function ScrollTo() { - var textObject = this.parent; - var dx, dy; - var childLeftX = this.drawX + this.drawTLX; - var childRightX = childLeftX + this.width; - if (childLeftX < 0) { - dx = 0 - childLeftX; - } else if (childRightX > textObject.width) { - dx = textObject.width - childRightX; - } else { - dx = 0; - } - var childTopY = this.drawY + this.drawTLY; - var childBottomY = childTopY + this.height; - if (childTopY < 0) { - dy = 0 - childTopY; - } else if (childBottomY > textObject.height) { - dy = textObject.height - childBottomY; - } else { - dy = 0; - } - textObject._textOX += dx; - textObject._textOY += dy; - return this; - }; - var Methods$2 = { contains: Contains, - getWorldPosition: GetWorldPosition, - scrollTo: ScrollTo + getWorldPosition: GetWorldPosition }; Object.assign(Methods$2, RenderMethods); @@ -4054,13 +4027,12 @@ } }; - var SetTextOXYMethods = { + var SetTextOXYMethods$1 = { setTextOX: function setTextOX(ox) { if (ox === this._textOX) { return this; } this._textOX = ox; - this.updateTexture(); return this; }, setTextOY: function setTextOY(oy) { @@ -4068,7 +4040,6 @@ return this; } this._textOY = oy; - this.updateTexture(); return this; }, setTextOXY: function setTextOXY(ox, oy) { @@ -4077,7 +4048,6 @@ } this._textOX = ox; this._textOY = oy; - this.updateTexture(); return this; }, addTextOX: function addTextOX(incX) { @@ -4538,7 +4508,7 @@ setChildrenInteractiveEnable: SetChildrenInteractiveEnable, setInteractive: SetInteractive }; - Object.assign(Methods$1, MoveChildMethods, BackgroundMethods, InnerBoundsMethods, SetAlignMethods, SetTextOXYMethods); + Object.assign(Methods$1, MoveChildMethods, BackgroundMethods, InnerBoundsMethods, SetAlignMethods, SetTextOXYMethods$1); var Stack = /*#__PURE__*/function () { function Stack() { @@ -5589,6 +5559,38 @@ hiddenTextEdit.prevSelectionEnd = selectionEnd; }; + var ScrollToBob = function ScrollToBob(bob) { + var textObject = bob.parent; + var textObjectLeftX = 0, + textObjectRightX = textObject.width, + textObjectTopY = 0, + textObjectBottomY = textObject.height; + var childX = bob.drawX, + childY = bob.drawY; + var childLeftX = childX + bob.drawTLX, + childRightX = childX + bob.drawTRX, + childTopY = childY + bob.drawTLY, + childBottomY = childY + bob.drawBLY; + var dx; + if (childLeftX < textObjectLeftX) { + dx = textObjectLeftX - childLeftX; + } else if (childRightX > textObjectRightX) { + dx = textObjectRightX - childRightX; + } else { + dx = 0; + } + var dy; + if (childTopY < textObjectTopY) { + dy = textObjectTopY - childTopY; + } else if (childBottomY > textObjectBottomY) { + dy = textObjectBottomY - childBottomY; + } else { + dy = 0; + } + textObject._textOX += dx; + textObject._textOY += dy; + }; + var MoveCursor = function MoveCursor(hiddenTextEdit) { var textObject = hiddenTextEdit.parent; var text = textObject.text; @@ -5618,7 +5620,7 @@ if (child.text === '\n') { child.copyTextSize(textObject.lastInsertCursor); } - child.scrollTo(); + ScrollToBob(child); textObject.emit('cursorin', child, cursorPosition, textObject); } } @@ -6438,7 +6440,35 @@ // Push back lastInsertCursor directly textObject.children.push(textObject.lastInsertCursor); - textObject.runWordWrap(); + var result = textObject.runWordWrap(); + textObject.contentWidth = result.maxLineWidth; + textObject.contentHeight = result.linesHeight; + textObject.linesCount = result.lines.length; + }; + + var SetTextOXYMethods = { + setTextOYByPercentage: function setTextOYByPercentage(percentage) { + this.setTextOY(-this.textVisibleHeight * percentage); + return this; + }, + getTextOYPercentage: function getTextOYPercentage() { + var textVisibleHeight = this.textVisibleHeight; + if (textVisibleHeight === 0) { + return 0; + } + return this._textOY / -textVisibleHeight; + }, + setTextOXByPercentage: function setTextOXByPercentage(percentage) { + this.setTextOX(-this.textVisibleWidth * percentage); + return this; + }, + getTextOXPercentage: function getTextOXPercentage() { + var textVisibleWidth = this.textVisibleWidth; + if (textVisibleWidth === 0) { + return 0; + } + return this._textOX / -textVisibleWidth; + } }; var IsPlainObject = Phaser.Utils.Objects.IsPlainObject; @@ -6467,6 +6497,11 @@ var cursorStyle = ExtractByPrefix(config.style, 'cursor'); _this = _super.call(this, scene, x, y, fixedWidth, fixedHeight, config); _this.type = 'rexCanvasInput'; + + // readonly + _this.contentWidth = undefined; + _this.contentHeight = undefined; + _this.linesCount = undefined; _this._text; _this.textEdit = CreateHiddenTextEdit(_assertThisInitialized(_this), config); if (config.focusStyle) { @@ -6698,12 +6733,67 @@ this.minLength = value; return this; } + }, { + key: "topTextOY", + get: function get() { + return 0; + } + }, { + key: "bottomTextOY", + get: function get() { + return -this.tableVisibleHeight; + } + }, { + key: "leftTextOX", + get: function get() { + return 0; + } + }, { + key: "rightTextOX", + get: function get() { + return -this.textVisibleWidth; + } + }, { + key: "textVisibleHeight", + get: function get() { + var h = this.contentHeight - this.height; + if (h < 0) { + h = 0; + } + return h; + } + }, { + key: "textVisibleWidth", + get: function get() { + var w = this.contentWidth - this.width; + if (w < 0) { + w = 0; + } + return w; + } + }, { + key: "t", + get: function get() { + return this.getTextOYPercentage(); + }, + set: function set(value) { + this.setTextOYByPercentage(value).updateTexture(); + } + }, { + key: "s", + get: function get() { + return this.getTextOXPercentage(); + }, + set: function set(value) { + this.setTextOXByPercentage(value).updateTexture(); + } }]); return CanvasInput; }(DynamicText); var DefaultParseTextCallback = function DefaultParseTextCallback(text) { return text; }; + Object.assign(CanvasInput.prototype, SetTextOXYMethods); function CanvasInputFactory (x, y, width, height, config) { var gameObject = new CanvasInput(this.scene, x, y, width, height, config); diff --git a/dist/rexcanvasinputplugin.min.js b/dist/rexcanvasinputplugin.min.js index a71060887f..112c672102 100644 --- a/dist/rexcanvasinputplugin.min.js +++ b/dist/rexcanvasinputplugin.min.js @@ -1 +1 @@ -!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).rexcanvasinputplugin=e();}(undefined,(function(){function t(e){return t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},t(e)}function e(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){for(var i=0;it.length)&&(e=t.length);for(var i=0,n=new Array(e);ii.width?i.width-r:0;var s=this.drawY+this.drawTLY,o=s+this.height;return e=s<0?0-s:o>i.height?i.height-o:0,i._textOX+=t,i._textOY+=e,this}};Object.assign(U,B);var V=Phaser.Math.DegToRad,N=Phaser.Math.RadToDeg,q=Phaser.Utils.Objects.GetValue,J=function(t){r(s,t);var i=a(s);function s(t,n){var r;return e(this,s),(r=i.call(this,t,n)).renderable=!0,r.scrollFactorX=1,r.scrollFactorY=1,r.toLocalPosition=!0,r.originX=0,r.offsetX=0,r.offsetY=0,r}return n(s,[{key:"visible",get:function(){return this._visible},set:function(t){this.setDirty(this._visible!=t),this._visible=t;}},{key:"setVisible",value:function(t){return void 0===t&&(t=!0),this.visible=t,this}},{key:"alpha",get:function(){return this._alpha},set:function(t){this.setDirty(this._alpha!=t),this._alpha=t;}},{key:"setAlpha",value:function(t){return this.alpha=t,this}},{key:"x",get:function(){return this._x},set:function(t){this.setDirty(this._x!=t),this._x=t;}},{key:"setX",value:function(t){return this.x=t,this}},{key:"y",get:function(){return this._y},set:function(t){this.setDirty(this._y!=t),this._y=t;}},{key:"setY",value:function(t){return this.y=t,this}},{key:"setPosition",value:function(t,e){return this.x=t,this.y=e,this}},{key:"setInitialPosition",value:function(t,e){return this.x0=t,this.y0=e,this}},{key:"setScrollFactorX",value:function(t){return this.scrollFactorX=t,this}},{key:"setScrollFactorY",value:function(t){return this.scrollFactorY=t,this}},{key:"setScrollFactor",value:function(t,e){return void 0===e&&(e=t),this.scrollFactorX=t,this.scrollFactorY=e,this}},{key:"rotation",get:function(){return this._rotation},set:function(t){this.setDirty(this._rotation!=t),this._rotation=t;}},{key:"setRotation",value:function(t){return this.rotation=t,this}},{key:"angle",get:function(){return N(this._rotation)},set:function(t){this.rotation=V(t);}},{key:"setAngle",value:function(t){return this.angle=t,this}},{key:"scaleX",get:function(){return this._scaleX},set:function(t){this.setDirty(this._scaleX!==t),this._scaleX=t;}},{key:"setScaleX",value:function(t){return this.scaleX=t,this}},{key:"width",get:function(){return 0},set:function(t){}},{key:"setWidth",value:function(t,e){return void 0===e&&(e=!1),this.width=t,e&&(this.scaleY=this.scaleX),this}},{key:"leftSpace",get:function(){return this._leftSpace},set:function(t){this.setDirty(this._leftSpace!==t),this._leftSpace=t;}},{key:"setLeftSpace",value:function(t){return this.leftSpace=t,this}},{key:"rightSpace",get:function(){return this._rightSpace},set:function(t){this.setDirty(this._rightSpace!==t),this._rightSpace=t;}},{key:"setRightSpace",value:function(t){return this.rightSpace=t,this}},{key:"outerWidth",get:function(){return this.width+this.leftSpace+this.rightSpace}},{key:"scaleY",get:function(){return this._scaleY},set:function(t){this.setDirty(this._scaleY!==t),this._scaleY=t;}},{key:"setScaleY",value:function(t){return this.scaleY=t,this}},{key:"height",get:function(){return 0},set:function(t){}},{key:"setHeight",value:function(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}},{key:"setScale",value:function(t,e){return void 0===e&&(e=t),this.scaleX=t,this.scaleY=e,this}},{key:"setOrigin",value:function(t){return this.originX=t,this}},{key:"setAlign",value:function(t){return this.align=t,this}},{key:"modifyPorperties",value:function(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=q(t,"width",void 0),i=q(t,"height",void 0),n=q(t,"scaleX",void 0),r=q(t,"scaleY",void 0);return void 0!==e?void 0===i&&void 0===r?this.setWidth(e,!0):this.setWidth(e):void 0!==n&&this.setScaleX(n),void 0!==i?void 0===e&&void 0===n?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}},{key:"setDrawBelowCallback",value:function(t){return this.drawBelowCallback=t,this}},{key:"setDrawAboveCallback",value:function(t){return this.drawAboveCallback=t,this}},{key:"reset",value:function(){return this.setVisible().setAlpha(1).setPosition(0,0).setRotation(0).setScale(1,1).setLeftSpace(0).setRightSpace(0).setOrigin(0).setAlign().setDrawBelowCallback().setDrawAboveCallback(),this}},{key:"willRender",get:function(){return this.visible&&this.alpha>0}},{key:"drawX",get:function(){var t=this.x+this.leftSpace+this.offsetX-this.originX*this.width;return this.parent._textOX*this.scrollFactorX+t}},{key:"drawY",get:function(){var t=this.y+this.offsetY;return this.parent._textOY*this.scrollFactorY+t}},{key:"drawTLX",get:function(){return 0}},{key:"drawTLY",get:function(){return 0}},{key:"drawBLX",get:function(){return 0}},{key:"drawBLY",get:function(){return 0}},{key:"drawTRX",get:function(){return 0}},{key:"drawTRY",get:function(){return 0}},{key:"drawBRX",get:function(){return 0}},{key:"drawBRY",get:function(){return 0}},{key:"drawCenterX",get:function(){return (this.drawTRX+this.drawTLX)/2}},{key:"drawCenterY",get:function(){return (this.drawBLY+this.drawTLY)/2}}]),s}(E);Object.assign(J.prototype,U);var $=Phaser.Utils.String.Pad,Z=function(e,i,n){if(null==e)return e;switch(t(e)){case"string":default:return e;case"number":return "#".concat($(Math.floor(e).toString(16),6,"0",1));case"function":return e(i,n);case"object":return e.hasOwnProperty("r")?e.hasOwnProperty("a")?"rgba(".concat(e.r,",").concat(e.g,",").concat(e.b,",").concat(e.a,")"):"rgb(".concat(e.r,",").concat(e.g,",").concat(e.b,")"):e.hasOwnProperty("h")?e.hasOwnProperty("a")?"hsla(".concat(e.h,",").concat(e.s,",").concat(e.l,",").concat(e.a,")"):"hsl(".concat(e.h,",").concat(e.s,",").concat(e.l,")"):e}},K=function(t,e,i){return e.hasOwnProperty(t)?e[t]:i[t]},Q=Phaser.Utils.Objects.GetValue,tt=function(){function t(i,n,r,s,o){e(this,t),void 0===i&&(i=0),void 0===n&&(n=i),void 0===r&&(r=0),void 0===s&&(s=0),void 0===o&&(o=0),this.cornerRadius={},this._width=0,this._height=0,this.setTo(i,n,r,s,o);}return n(t,[{key:"setTo",value:function(t,e,i,n,r){return this.setPosition(t,e),this.setRadius(r),this.setSize(i,n),this}},{key:"setPosition",value:function(t,e){return this.x=t,this.y=e,this}},{key:"setRadius",value:function(t){return void 0===t&&(t=0),this.radius=t,this}},{key:"setSize",value:function(t,e){return this.width=t,this.height=e,this}},{key:"minWidth",get:function(){var t=this.cornerRadius;return Math.max(t.tl.x+t.tr.x,t.bl.x+t.br.x)}},{key:"minHeight",get:function(){var t=this.cornerRadius;return Math.max(t.tl.y+t.bl.y,t.tr.y+t.br.y)}},{key:"width",get:function(){return this._width},set:function(t){null==t&&(t=0),this._width=Math.max(t,this.minWidth);}},{key:"height",get:function(){return this._height},set:function(t){null==t&&(t=0),this._height=Math.max(t,this.minHeight);}},{key:"radius",get:function(){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:function(t){var e,i;"number"==typeof t?(e=t,i=t):(e=Q(t,"x",0),i=Q(t,"y",0));var n=this.cornerRadius;n.tl=et(Q(t,"tl",void 0),e,i),n.tr=et(Q(t,"tr",void 0),e,i),n.bl=et(Q(t,"bl",void 0),e,i),n.br=et(Q(t,"br",void 0),e,i);}},{key:"radiusTL",get:function(){var t=this.cornerRadius.tl;return Math.max(t.x,t.y)},set:function(t){it(this.cornerRadius.tl,t);}},{key:"radiusTR",get:function(){var t=this.cornerRadius.tr;return Math.max(t.x,t.y)},set:function(t){it(this.cornerRadius.tr,t);}},{key:"radiusBL",get:function(){var t=this.cornerRadius.bl;return Math.max(t.x,t.y)},set:function(t){it(this.cornerRadius.bl,t);}},{key:"radiusBR",get:function(){var t=this.cornerRadius.br;return Math.max(t.x,t.y)},set:function(t){it(this.cornerRadius.br,t);}}]),t}(),et=function(t,e,i){return void 0===t?t={x:e,y:i}:"number"==typeof t&&(t={x:t,y:t}),nt(t),t},it=function(t,e){"number"==typeof e?(t.x=e,t.y=e):(t.x=Q(e,"x",0),t.y=Q(e,"y",0)),nt(t);},nt=function(t){t.convex=t.x>=0||t.y>=0,t.x=Math.abs(t.x),t.y=Math.abs(t.y);},rt=Phaser.Math.DegToRad,st=function(t){return !t.hasOwnProperty("convex")||t.convex},ot=function(t){return t.x>0&&t.y>0},ht=function(t,e,i,n,r,s,o,h,a){if(h&&o>s?o-=360:!h&&o=f?1:n/f,y=r>=v?1:r/v,g=d.cornerRadius;t.save(),t.beginPath(),t.translate(e,i),h=g.tl,ot(h)?(a=h.x*p,u=h.y*y,st(h)?ht(t,a,u,a,u,180,270,!1,o):ht(t,0,0,a,u,90,0,!0,o),l=0,c=u):(t.lineTo(0,0),l=0,c=0),h=g.tr,ot(h)?(a=h.x*p,u=h.y*y,st(h)?ht(t,n-a,u,a,u,270,360,!1,o):ht(t,n,0,a,u,180,90,!0,o)):t.lineTo(n,0),h=g.br,ot(h)?(a=h.x*p,u=h.y*y,st(h)?ht(t,n-a,r-u,a,u,0,90,!1,o):ht(t,n,r,a,u,270,180,!0,o)):t.lineTo(n,r),h=g.bl,ot(h)?(a=h.x*p,u=h.y*y,st(h)?ht(t,a,r-u,a,u,90,180,!1,o):ht(t,0,r,a,u,360,270,!0,o)):t.lineTo(0,r),t.lineTo(l,c),t.closePath(),t.restore();}(e,i,n,r,s,o,d),null!=h){var f;if(null!=l)(f=c?e.createLinearGradient(0,0,r,0):e.createLinearGradient(0,0,0,s)).addColorStop(0,h),f.addColorStop(1,l),h=f;e.fillStyle=h,e.fill();}null!=a&&u>0&&(e.strokeStyle=a,e.lineWidth=u,e.stroke());},ut=Phaser.Utils.Objects.GetValue,lt=function(t){r(o,t);var i=a(o);function o(t,n){var r;return e(this,o),(r=i.call(this,t,"background")).setScrollFactor(0),r.setColor(ut(n,"color",null),ut(n,"color2",null),ut(n,"horizontalGradient",!0)),r.setStroke(ut(n,"stroke",null),ut(n,"strokeThickness",2)),r.setCornerRadius(ut(n,"cornerRadius",0),ut(n,"cornerIteration",null)),r}return n(o,[{key:"color",get:function(){return this._color},set:function(t){t=Z(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t;}},{key:"color2",get:function(){return this._color2},set:function(t){t=Z(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t;}},{key:"horizontalGradient",get:function(){return this._horizontalGradient},set:function(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t;}},{key:"setColor",value:function(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}},{key:"stroke",get:function(){return this._stroke},set:function(t){t=Z(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t;}},{key:"strokeThickness",get:function(){return this._strokeThickness},set:function(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t;}},{key:"setStroke",value:function(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}},{key:"cornerRadius",get:function(){return this._cornerRadius},set:function(t){this.setDirty(this._cornerRadius!=t),this._cornerRadius=t;}},{key:"cornerIteration",get:function(){return this._cornerIteration},set:function(t){this.setDirty(this._cornerIteration!=t),this._cornerIteration=t;}},{key:"modifyStyle",value:function(t){return t.hasOwnProperty("color")&&this.setColor(t.color,K("color2",t,this),K("horizontalGradient",t,this)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,K("strokeThickness",t,this)),t.hasOwnProperty("cornerRadius")&&this.setCornerRadius(t.cornerRadius,K("cornerIteration",t,this)),this}},{key:"modifyPorperties",value:function(t){return l(s(o.prototype),"modifyPorperties",this).call(this,t),this.modifyStyle(t),this}},{key:"setCornerRadius",value:function(t,e){return this.cornerRadius=t,this.cornerIteration=e,this}},{key:"renderContent",value:function(){!function(t,e,i,n,r,s,o,h){if(null!=e||null!=i){var a=t.canvas.width,u=t.canvas.height;null==i&&(n=0);var l=n/2;a=Math.max(1,a-n),u=Math.max(1,u-n),at(t.canvas,t.context,l,l,a,u,r,e,i,n,s,o,h);}}(this.parent,this.color,this.stroke,this.strokeThickness,this.cornerRadius,this.color2,this.horizontalGradient,this.cornerIteration);}}]),o}(J),ct=Phaser.Utils.Objects.GetValue,dt=function(t){r(o,t);var i=a(o);function o(t,n){var r;return e(this,o),(r=i.call(this,t,"innerbounds")).setScrollFactor(0),r.setColor(ct(n,"color",null),ct(n,"color2",null),ct(n,"horizontalGradient",!0)),r.setStroke(ct(n,"stroke",null),ct(n,"strokeThickness",2)),r}return n(o,[{key:"color",get:function(){return this._color},set:function(t){t=Z(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t;}},{key:"color2",get:function(){return this._color2},set:function(t){t=Z(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t;}},{key:"horizontalGradient",get:function(){return this._horizontalGradient},set:function(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t;}},{key:"setColor",value:function(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}},{key:"stroke",get:function(){return this._stroke},set:function(t){t=Z(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t;}},{key:"strokeThickness",get:function(){return this._strokeThickness},set:function(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t;}},{key:"setStroke",value:function(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}},{key:"modifyPorperties",value:function(t){l(s(o.prototype),"modifyPorperties",this).call(this,t),t.hasOwnProperty("color")&&this.setColor(t.color,ct(t,"color2",null),ct(t,"horizontalGradient",!0)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,ct(t,"strokeThickness",2));}},{key:"renderContent",value:function(){var t=this.parent.padding,e=t.left,i=t.top,n=this.parent.width-t.left-t.right,r=this.parent.height-t.top-t.bottom,s=this.context;if(null!=this.color){var o,h;if(null!=this.color2)(h=this.horizontalGradient?s.createLinearGradient(0,0,n,0):s.createLinearGradient(0,0,0,r)).addColorStop(0,this.color),h.addColorStop(1,this.color2),o=h;else o=this.color;s.fillStyle=o,s.fillRect(e,i,n,r);}null!=this.stroke&&this.strokeThickness>0&&(s.strokeStyle=this.stroke,s.lineWidth=this.strokeThickness,s.strokeRect(e,i,n,r));}}]),o}(J),ft=Phaser.Utils.Objects.GetValue,vt=function(){function t(i,n){e(this,t),this.parent=i,this.set(n);}return n(t,[{key:"toJSON",value:function(){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}}},{key:"set",value:function(t){return this.setBold(ft(t,"bold",!1)),this.setItalic(ft(t,"italic",!1)),this.setFontSize(ft(t,"fontSize","16px")),this.setFontFamily(ft(t,"fontFamily","Courier")),this.setColor(ft(t,"color","#fff")),this.setStrokeStyle(ft(t,"stroke",null),ft(t,"strokeThickness",0)),this.setShadow(ft(t,"shadowColor",null),ft(t,"shadowOffsetX",0),ft(t,"shadowOffsetY",0),ft(t,"shadowBlur",0)),this.setOffset(ft(t,"offsetX",0),ft(t,"offsetY",0)),this.setSpace(ft(t,"leftSpace",0),ft(t,"rightSpace",0)),this.setAlign(ft(t,"align",void 0)),this.setBackgroundColor(ft(t,"backgroundColor",null)),this.setBackgroundHeight(ft(t,"backgroundHeight",void 0)),this.setBackgroundBottomY(ft(t,"backgroundBottomY",void 0)),this}},{key:"modify",value:function(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(K("stroke",t,this),K("strokeThickness",t,this)),t.hasOwnProperty("shadowColor")&&this.setShadowColor(t.shadowColor),(t.hasOwnProperty("shadowOffsetX")||t.hasOwnProperty("shadowOffsetY"))&&this.setShadowOffset(K("shadowOffsetX",t,this),K("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}},{key:"setUpdateTextFlag",value:function(){return this.parent&&(this.parent.updateTextFlag=!0),this}},{key:"clone",value:function(){return new t(null,this.toJSON())}},{key:"copyFrom",value:function(t){return this.set(t.toJSON()),this}},{key:"copyTo",value:function(t){return t.set(this.toJSON()),this}},{key:"setBold",value:function(t){return void 0===t&&(t=!0),this.bold=t,this.setUpdateTextFlag(),this}},{key:"setItalic",value:function(t){return void 0===t&&(t=!0),this.italic=t,this.setUpdateTextFlag(),this}},{key:"fontStyle",get:function(){return this.bold&&this.italic?"bold italic":this.bold?"bold":this.italic?"italic":""}},{key:"setFontSize",value:function(t){return "number"==typeof t&&(t="".concat(t,"px")),this.fontSize=t,this.setUpdateTextFlag(),this}},{key:"setFontFamily",value:function(t){return this.fontFamily=t,this.setUpdateTextFlag(),this}},{key:"font",get:function(){return "".concat(this.fontStyle," ").concat(this.fontSize," ").concat(this.fontFamily)}},{key:"setColor",value:function(t){return this.color=Z(t),this}},{key:"hasFill",get:function(){return null!=this.color}},{key:"setStrokeStyle",value:function(t,e){return this.stroke=Z(t),void 0!==e&&(this.strokeThickness=e),this}},{key:"setStrokeThickness",value:function(t){return this.strokeThickness=t,this}},{key:"hasStroke",get:function(){return null!=this.stroke&&this.strokeThickness>0}},{key:"setShadowColor",value:function(t){return this.shadowColor=Z(t),this}},{key:"setShadowOffset",value:function(t,e){return void 0===t&&(t=0),void 0===e&&(e=0),this.shadowOffsetX=t,this.shadowOffsetY=e,this}},{key:"setShadowBlur",value:function(t){return void 0===t&&(t=0),this.shaodwBlur=t,this}},{key:"setShadow",value:function(t,e,i,n){return this.setShadowColor(t).setShadowOffset(e,i).setShadowBlur(n),this}},{key:"setBackgroundColor",value:function(t){return this.backgroundColor=Z(t),this}},{key:"hasBackgroundColor",get:function(){return null!=this.backgroundColor}},{key:"setBackgroundHeight",value:function(t){return this.backgroundHeight=t,this}},{key:"setBackgroundBottomY",value:function(t){return this.backgroundBottomY=t,this}},{key:"setOffsetX",value:function(t){return void 0===t&&(t=0),this.offsetX=t,this}},{key:"setOffsetY",value:function(t){return void 0===t&&(t=0),this.offsetY=t,this}},{key:"setOffset",value:function(t,e){return this.setOffsetX(t).setOffsetY(e),this}},{key:"setLeftSpace",value:function(t){return void 0===t&&(t=0),this.leftSpace=t,this}},{key:"setRightSpace",value:function(t){return void 0===t&&(t=0),this.rightSpace=t,this}},{key:"setSpace",value:function(t,e){return this.setLeftSpace(t).setRightSpace(e),this}},{key:"setAlign",value:function(t){return this.align=t,this}},{key:"syncFont",value:function(t){return t.font=this.font,this}},{key:"syncStyle",value:function(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}},{key:"syncShadow",value:function(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);}},{key:"getTextMetrics",value:function(t,e){return this.syncFont(t).syncStyle(t),t.measureText(e)}}]),t}(),pt=Phaser.Utils.Array.Remove,yt=Phaser.Utils.Array.Remove,gt="text",kt="image",xt="drawer",mt="space",wt="command",bt=function(t){return t.type===gt&&"\n"===t.text},Ct=function(t){return t.type===gt&&"\f"===t.text},St=function(t){return t.type===gt},Ot=function(t){r(o,t);var i=a(o);function o(t,n,r){var s;return e(this,o),(s=i.call(this,t,gt)).updateTextFlag=!1,s.style=new vt(h(s),r),s.setText(n),s}return n(o,[{key:"autoRound",get:function(){return this.parent.autoRound}},{key:"offsetX",get:function(){return this.style.offsetX},set:function(t){this.style&&(this.style.offsetX=t);}},{key:"offsetY",get:function(){return this.style.offsetY},set:function(t){this.style&&(this.style.offsetY=t);}},{key:"leftSpace",get:function(){return this.style.leftSpace*this.scaleX},set:function(t){this.style&&(this.style.leftSpace=t),d(s(o.prototype),"leftSpace",t,this,!0);}},{key:"rightSpace",get:function(){return this.style.rightSpace*this.scaleX},set:function(t){this.style&&(this.style.rightSpace=t),d(s(o.prototype),"rightSpace",t,this,!0);}},{key:"align",get:function(){return this.style.align},set:function(t){this.style&&(this.style.align=t);}},{key:"modifyStyle",value:function(t){return this.setDirty(!0),this.style.modify(t),this.updateTextFlag&&this.updateTextSize(),this}},{key:"modifyPorperties",value:function(t){return t?(this.modifyStyle(t),l(s(o.prototype),"modifyPorperties",this).call(this,t),this):this}},{key:"setText",value:function(t){return this.setDirty(this.text!=t),this.text=t,this.updateTextSize(),this}},{key:"updateTextSize",value:function(){var t=this.text;if("\n"===t||"\f"===t||""===t)this.clearTextSize();else {var e,i,n=this.style.getTextMetrics(this.context,this.text);this.textWidth=n.width,"actualBoundingBoxAscent"in n?(e=n.actualBoundingBoxAscent,i=n.actualBoundingBoxDescent):(e=0,i=0),this.textHeight=e+i,this.ascent=e,this.descent=i;}return this.updateTextFlag=!1,this}},{key:"clearTextSize",value:function(){return this.textWidth=0,this.textHeight=0,this.ascent=0,this.descent=0,this}},{key:"copyTextSize",value:function(t){return this.textWidth=t.textWidth,this.textHeight=t.textHeight,this.ascent=t.ascent,this.descent=t.descent,this}},{key:"width",get:function(){return this.textWidth*this.scaleX},set:function(t){this.textWidth>0?this.scaleX=t/this.textWidth:this.scaleX=1;}},{key:"height",get:function(){return this.textHeight*this.scaleY},set:function(t){this.textHeight>0?this.scaleY=t/this.textHeight:this.scaleY=1;}},{key:"willRender",get:function(){return 0!==this.textWidth&&l(s(o.prototype),"willRender",this)}},{key:"renderContent",value:function(){var t=this.context,e=this.style;if(e.hasBackgroundColor){t.fillStyle=e.backgroundColor;var i=this.drawTLX,n=this.drawTRX-i,r=e.backgroundBottomY;null==r&&(r=this.drawBLY);var s=e.backgroundHeight;null==s&&(s=r-this.drawTLY);var o=r-s;t.fillRect(i,o,n,s);}var h=e.hasFill,a=e.hasStroke;(h||a)&&(e.syncFont(t).syncStyle(t),a&&(e.syncShadow(t),t.strokeText(this.text,0,0)),h&&(e.syncShadow(t),t.fillText(this.text,0,0)));}},{key:"drawTLX",get:function(){return -this.leftSpace}},{key:"drawTLY",get:function(){return -this.ascent}},{key:"drawBLX",get:function(){return -this.leftSpace}},{key:"drawBLY",get:function(){return this.descent}},{key:"drawTRX",get:function(){return this.textWidth+this.rightSpace}},{key:"drawTRY",get:function(){return -this.ascent}},{key:"drawBRX",get:function(){return this.textWidth+this.rightSpace}},{key:"drawBRY",get:function(){return this.descent}}]),o}(J),Pt=function(t,e){var i=this.createCharChildren(t,e);return this.addChild(i),this},Tt=function(t){r(s,t);var i=a(s);function s(t,n,r){var o;return e(this,s),(o=i.call(this,t,kt)).setTexture(n,r),o}return n(s,[{key:"frameWidth",get:function(){return this.frameObj?this.frameObj.cutWidth:0}},{key:"frameHeight",get:function(){return this.frameObj?this.frameObj.cutHeight:0}},{key:"offsetY",get:function(){return -this.height},set:function(t){}},{key:"key",get:function(){return this._key},set:function(t){this.setDirty(this._key!=t),this._key=t;}},{key:"frame",get:function(){return this._frame},set:function(t){this.setDirty(this._frame!=t),this._frame=t;}},{key:"setTexture",value:function(t,e){return this.key=t,this.frame=e,this.frameObj=this.scene.sys.textures.getFrame(t,e),this}},{key:"width",get:function(){return this.frameWidth*this.scaleX},set:function(t){this.setDirty(this.width!==t),this.scaleX=t/this.frameWidth;}},{key:"height",get:function(){return this.frameHeight*this.scaleY},set:function(t){this.setDirty(this.height!==t),this.scaleY=t/this.frameHeight;}},{key:"setHeight",value:function(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}},{key:"renderContent",value:function(){var t=this.context,e=this.frameObj,i=this.frameWidth,n=this.frameHeight;t.drawImage(e.source.image,e.cutX,e.cutY,i,n,0,0,i,n);}},{key:"drawTLX",get:function(){return -this.leftSpace}},{key:"drawTLY",get:function(){return 0}},{key:"drawBLX",get:function(){return -this.leftSpace}},{key:"drawBLY",get:function(){return this.frameHeight}},{key:"drawTRX",get:function(){return this.frameWidth+this.rightSpace}},{key:"drawTRY",get:function(){return 0}},{key:"drawBRX",get:function(){return this.frameWidth+this.rightSpace}},{key:"drawBRY",get:function(){return this.frameHeight}}]),s}(J),_t=function(t){r(o,t);var i=a(o);function o(t,n,r,s){var h;return e(this,o),(h=i.call(this,t,xt)).setRenderCallback(n),h.setDrawerSize(r,s),h}return n(o,[{key:"setRenderCallback",value:function(t){return t?this.renderContent=t.bind(this):delete this.renderContent,this}},{key:"setDrawerSize",value:function(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}},{key:"onFree",value:function(){l(s(o.prototype),"onFree",this).call(this),this.setRenderCallback();}},{key:"width",get:function(){return this.drawerWidth*this.scaleX},set:function(t){this.setDirty(this.width!==t),this.scaleX=this.drawerWidth>0?t/this.drawerWidth:1;}},{key:"height",get:function(){return this.drawerHeight*this.scaleY},set:function(t){this.setDirty(this.height!==t),this.scaleY=this.drawerHeight>0?t/this.drawerHeight:1;}},{key:"offsetY",get:function(){return -this.height},set:function(t){}},{key:"drawTLX",get:function(){return -this.leftSpace}},{key:"drawTLY",get:function(){return 0}},{key:"drawBLX",get:function(){return -this.leftSpace}},{key:"drawBLY",get:function(){return this.drawerHeight}},{key:"drawTRX",get:function(){return this.drawerWidth+this.rightSpace}},{key:"drawTRY",get:function(){return 0}},{key:"drawBRX",get:function(){return this.drawerWidth+this.rightSpace}},{key:"drawBRY",get:function(){return this.drawerHeight}}]),o}(J),Et=function(t){r(s,t);var i=a(s);function s(t,n){var r;return e(this,s),(r=i.call(this,t,mt)).setSpaceWidth(n),r}return n(s,[{key:"width",get:function(){return this.spaceWidth*this.scaleX},set:function(t){this.spaceWidth>0?this.scaleX=t/this.spaceWidth:this.scaleX=1;}},{key:"setSpaceWidth",value:function(t){return this.spaceWidth=t,this}}]),s}(J),At=function(t){r(o,t);var i=a(o);function o(t,n,r,s,h){var a;return e(this,o),(a=i.call(this,t,wt)).setName(n).setParameter(s).setCallback(r,h),a}return n(o,[{key:"setName",value:function(t){return this.name=t,this}},{key:"setParameter",value:function(t){return this.param=t,this}},{key:"setCallback",value:function(t,e){return this.callback=t,this.scope=e,this}},{key:"exec",value:function(){return this.scope?this.callback.call(this.scope,this.param,this.name):this.callback(this.param,this.name)}},{key:"onFree",value:function(){l(s(o.prototype),"onFree",this).call(this),this.setName().setCallback().setParameter();}}]),o}(E),Lt=function e(i){var n,r,s;if(null==i||"object"!==t(i))return i;if(n=Array.isArray(i)?[]:{},function(e){if("object"!==t(e)||e.nodeType||e===e.window)return !1;try{if(e.constructor&&!{}.hasOwnProperty.call(e.constructor.prototype,"isPrototypeOf"))return !1}catch(t){return !1}return !0}(i))for(s in i)r=i[s],n[s]=e(r);else n=i;return n},Rt=function(t,e,i,n){void 0===n&&(n={word:[],width:0}),n.word.length=0;for(var r=t.length,s=e,o=n.word,h=0;s0&&!h){var a=this.fixedHeight-n;if(i>0)s=a/i;else s=(u=Bt.call(this)).height,o=u.ascent,i=Math.floor((a-o)/s);}else {var u;s=(u=Bt.call(this)).height,o=u.ascent;}}else if(this.fixedHeight>0){if(void 0===(i=Dt(t,"maxLines"))){a=this.fixedHeight-n;i=Math.floor(a/s);}}else i=Dt(t,"maxLines",0);void 0===o&&(o=s);var l=0===i,c=Dt(t,"wrapWidth",void 0);void 0===c&&(c=this.fixedWidth>0?this.fixedWidth-r:1/0);for(var d=Dt(t,"letterSpacing",0),f=Dt(t,"hAlign",0),v=Dt(t,"vAlign",0),p=Dt(t,"charWrap",!1),y={callback:"runWordWrap",start:e,isLastPage:!1,padding:this.wrapPadding,ascent:o,lineHeight:s,maxLines:i,wrapWidth:c,letterSpacing:d,hAlign:f,vAlign:v,charWrap:p,children:[],lines:[],maxLineWidth:0,linesHeight:0},g=this.children,k=0,x=g.length;k0&&(E.push({children:A,width:L}),R=Math.max(R,L)),y.start+=_.length,y.isLastPage=!Y&&y.start===P,y.maxLineWidth=R,y.linesHeight=E.length*s;var M=this.fixedWidth>0?this.fixedWidth:y.maxLineWidth+r,z=this.fixedHeight>0?this.fixedHeight:y.linesHeight+n;!function(t,e,i){var n,r,s=t.hAlign,o=t.vAlign,h=t.linesHeight;switch(o){case 1:case"center":r=(i-h)/2;break;case 2:case"bottom":r=i-h;break;default:r=0;}for(var a=t.lines,u=0,l=a.length;u0?(o=this.fixedWidth-r)/i:0;else if(this.fixedWidth>0){if(void 0===(i=Mt(t,"maxLines",void 0))){var o=this.fixedWidth-r;i=Math.floor(o/s)+1;}}else i=Mt(t,"maxLines",0);var h=0===i,a=Mt(t,"fixedChildHeight",void 0);if(void 0===a){var u=Mt(t,"charPerLine",void 0);if(void 0!==u){var l=this.fixedHeight-n;a=Math.floor(l/u);}}var c=Mt(t,"wrapHeight",void 0);void 0===c&&(c=this.fixedHeight>0?this.fixedHeight-n:1/0);for(var d=Mt(t,"letterSpacing",0),f=Mt(t,"rtl",!0),v=Mt(t,"hAlign",f?2:0),p=Mt(t,"vAlign",0),y={callback:"runVerticalWrap",start:e,isLastPage:!1,padding:this.wrapPadding,lineWidth:s,maxLines:i,fixedChildHeight:a,wrapHeight:c,letterSpacing:d,hAlign:v,vAlign:p,rtl:f,children:[],lines:[],maxLineHeight:0,linesWidth:0},g=this.children,k=0,x=g.length;k0&&(E.push({children:A,height:L}),R=Math.max(R,L)),y.start+=_.length,y.isLastPage=y.start===P,y.maxLineHeight=R,y.linesWidth=E.length*s;var j=this.fixedWidth>0?this.fixedWidth:y.linesWidth+r,F=this.fixedHeight>0?this.fixedHeight:y.maxLineHeight+n;!function(t,e,i){var n,r,s=t.hAlign,o=t.vAlign,h=t.rtl,a=t.lines,u=t.lineWidth,l=t.linesWidth;switch(s){case 1:case"center":n=(e-l)/2;break;case 2:case"right":n=e-l;break;default:n=0;}h&&(n+=u);for(var c=0,d=a.length;c0?t:this.width,e>0?e:this.height),this):this},setPadding:function(t,e){var i=this.padding,n=i.left,r=i.right,s=i.top,o=i.bottom;return T(i,t,e),this.dirty=this.dirty||n!=i.left||r!=i.right||s!=i.top||o!=i.bottom,this},getPadding:function(t){return function(t,e){return void 0===e?t:t[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),pt(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 yt(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,n,r,s=Array.isArray(t);void 0===e||e===this.children.length?s?(i=this.children).push.apply(i,f(t)):this.children.push(t):s?(n=this.children).splice.apply(n,[e,0].concat(f(t))):this.children.splice(e,0,t);(this.lastAppendedChildren.length=0,s)?(r=this.lastAppendedChildren).push.apply(r,f(t)):this.lastAppendedChildren.push(t);return this},createCharChild:function(t,e){e&&this.textStyle.modify(e);var i=this.poolManager.allocate(gt);return null===i?i=new Ot(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=[],n=0,r=t.length;ne&&(n=e,r=t);})),r},getCharWorldPosition:function(t,e,i,n){return "number"==typeof t&&(t=this.getCharChild(t,!0)),G(this,t,e,i,n)},setToMinSize:function(){for(var t=this.children,e=0,i=0,n=0,r=t.length;n=i.length&&(t=i.length);for(var n=0,r=0;r0?this.items.pop():null}},{key:"push",value:function(t){return this.items.push(t),this}},{key:"pushMultiple",value:function(t){return this.items.push.apply(this.items,t),t.length=0,this}},{key:"clear",value:function(){return this.items.length=0,this}}]),t}(),he=Phaser.Utils.Objects.GetFastValue,ae={},ue=function(){function t(i){e(this,t),this.pools=he(i,"pools",ae);}return n(t,[{key:"free",value:function(t){if(!this.pools)return this;var e=t.type;return this.pools.hasOwnProperty(e)||(this.pools[e]=new oe),this.pools[e].push(t),t.onFree(),this}},{key:"freeMultiple",value:function(t){if(!this.pools)return this;for(var e=0,i=t.length;e0)return Se.length=0,!0;return Se.length=0,!1},Se=[],Oe=void 0,Pe=Phaser.Utils.Objects.GetValue,Te=function(t,e,i){var n,r;for(var s in void 0===i&&(i={}),t)n=t[s],void 0!==(r=Pe(e,s,n[1]))&&(i[n[0]]=r);return i},_e=function(t){t.stopPropagation();},Ee=Phaser.Utils.Objects.GetValue,Ae=function(t,e){var i,n=Ee(e,"inputType",void 0);void 0===n&&(n=Ee(e,"type","text")),"textarea"===n?(i=document.createElement("textarea")).style.resize="none":(i=document.createElement("input")).type=n;var r=Ee(e,"style",void 0),s=i.style;Te(we,r,s),s.position="absolute",s.opacity=0,s.pointerEvents="none",s.zIndex=0,s.transform="scale(0)",Te(me,e,i),function(t){t.addEventListener("touchstart",_e,!1),t.addEventListener("touchmove",_e,!1),t.addEventListener("touchend",_e,!1),t.addEventListener("mousedown",_e,!1),t.addEventListener("mouseup",_e,!1),t.addEventListener("mousemove",_e,!1);}(i);var o=t.scene.sys.scale;return (o.isFullscreen?o.fullscreenTarget:document.body).appendChild(i),i},Le={open:function(){return this.isOpened||this.readOnly||((t=this)!==Oe&&(void 0!==Oe&&Oe.close(),Oe=t),this.isOpened=!0,this.node||(this.node=Ae(this,this.nodeConfig)),this.setFocus(),this.initText(),this.enterCloseEnable&&this.scene.input.keyboard.once("keydown-ENTER",this.close,this),this.scene.sys.events.on("postupdate",this.updateText,this),this.scene.input.on("pointerdown",this.onClickOutside,this),this.onOpenCallback&&this.onOpenCallback(this.parent,this),this.emit("open",this)),this;var t;},close:function(){return this.isOpened?(this===Oe&&(Oe=void 0),this.setBlur(),this.isOpened=!1,this.updateText(),this.scene.sys.events.off("postupdate",this.updateText,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),this):this}},Re=Phaser.Utils.Objects.GetValue,Ye=function(t){r(o,t);var i=a(o);function o(t,n){var r;e(this,o),r=i.call(this,t);var s=Re(n,"inputType",void 0);void 0===s&&(s=Re(n,"type","text")),r.setEnterCloseEnable(Re(n,"enterClose","textarea"!==s));var a=Re(n,"onOpen",void 0);a||(a=Re(n,"onFocus",void 0)),r.onOpenCallback=a;var u=Re(n,"onClose",void 0);return u||(u=Re(n,"onBlur",void 0)),r.onCloseCallback=u,r.onUpdateCallback=Re(n,"onUpdate",void 0),r.isOpened=!1,t.on("pointerdown",(function(){this.open();}),h(r)).setInteractive(),r.nodeConfig=function(t){void 0===t&&(t={});var e={};return be(t,e,"inputType"),be(t,e,"type"),be(t,e,"style"),be(t,e,we),be(t,e,me),e}(n),r.node=void 0,r}return n(o,[{key:"destroy",value:function(){this.close(),l(s(o.prototype),"destroy",this).call(this);}},{key:"onClickOutside",value:function(t){(function(t,e,i,n){if(e)return !(i&&!i(t,e)||!Ce(t,e)||n&&!n(t,e));for(var r=t.scene.input.manager,s=r.pointersTotal,o=r.pointers,h=0;h=r&&a=i&&ai.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!=n&&(r=e.getCharChild(n))&&("\n"===r.text&&r.copyTextSize(e.lastInsertCursor),r.scrollTo(),e.emit("cursorin",r,n,e)),e.emit("movecursor",n,t.prevCursorPosition,e),t.prevCursorPosition=n;}}(this)):(Be(this),We(this)),this}},{key:"setNumberInput",value:function(){return this.onUpdateCallback=Xe,this}},{key:"setSelectAllWhenFocusEnable",value:function(t){return void 0===t&&(t=!0),this.selectAllWhenFocus=t,this}}]),s}(Ye),Fe=Phaser.Utils.Objects.GetValue,Me=["inputType","onOpen","onFocus","onClose","onBlur","onUpdate","enterClose","readOnly","maxLength","minLength","selectAll"],ze=function(t,e){if(t&&"number"!=typeof t){if(t.hasOwnProperty(e))return !0;if(-1!==e.indexOf(".")){for(var i=e.split("."),n=t,r=0;rt.length?i:t})),u.value=t.join(c);}else u.value=t.join(i.slice(h,h+u.count));h+=u.count,u.added||(a+=u.count);}}var d=e[o-1];return o>1&&"string"==typeof d.value&&(d.added||d.removed)&&t.equals("",d.value)&&(e[o-2].value+=d.value,e.pop()),e}$e.prototype={diff:function(t,e){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=i.callback;"function"==typeof i&&(n=i,i={}),this.options=i;var r=this;function s(t){return n?(setTimeout((function(){n(void 0,t);}),0),!0):t}t=this.castInput(t),e=this.castInput(e),t=this.removeEmpty(this.tokenize(t));var o=(e=this.removeEmpty(this.tokenize(e))).length,h=t.length,a=1,u=o+h;i.maxEditLength&&(u=Math.min(u,i.maxEditLength));var l=[{newPos:-1,components:[]}],c=this.extractCommon(l[0],e,t,0);if(l[0].newPos+1>=o&&c+1>=h)return s([{value:this.join(e),count:e.length}]);function d(){for(var i=-1*a;i<=a;i+=2){var n=void 0,u=l[i-1],c=l[i+1],d=(c?c.newPos:0)-i;u&&(l[i-1]=void 0);var f=u&&u.newPos+1=o&&d+1>=h)return s(Ze(r,n.components,e,t,r.useLongestToken));l[i]=n;}else l[i]=void 0;}var p;a++;}if(n)!function t(){setTimeout((function(){if(a>u)return n();d()||t();}),0);}();else for(;a<=u;){var f=d();if(f)return f}},pushComponent:function(t,e,i){var n=t[t.length-1];n&&n.added===e&&n.removed===i?t[t.length-1]={count:n.count+1,added:e,removed:i}:t.push({count:1,added:e,removed:i});},extractCommon:function(t,e,i,n){for(var r=e.length,s=i.length,o=t.newPos,h=o-n,a=0;o+1t.length)&&(e=t.length);for(var i=0,n=new Array(e);i0}},{key:"drawX",get:function(){var t=this.x+this.leftSpace+this.offsetX-this.originX*this.width;return this.parent._textOX*this.scrollFactorX+t}},{key:"drawY",get:function(){var t=this.y+this.offsetY;return this.parent._textOY*this.scrollFactorY+t}},{key:"drawTLX",get:function(){return 0}},{key:"drawTLY",get:function(){return 0}},{key:"drawBLX",get:function(){return 0}},{key:"drawBLY",get:function(){return 0}},{key:"drawTRX",get:function(){return 0}},{key:"drawTRY",get:function(){return 0}},{key:"drawBRX",get:function(){return 0}},{key:"drawBRY",get:function(){return 0}},{key:"drawCenterX",get:function(){return (this.drawTRX+this.drawTLX)/2}},{key:"drawCenterY",get:function(){return (this.drawBLY+this.drawTLY)/2}}]),s}(E);Object.assign(J.prototype,U);var $=Phaser.Utils.String.Pad,Z=function(e,i,n){if(null==e)return e;switch(t(e)){case"string":default:return e;case"number":return "#".concat($(Math.floor(e).toString(16),6,"0",1));case"function":return e(i,n);case"object":return e.hasOwnProperty("r")?e.hasOwnProperty("a")?"rgba(".concat(e.r,",").concat(e.g,",").concat(e.b,",").concat(e.a,")"):"rgb(".concat(e.r,",").concat(e.g,",").concat(e.b,")"):e.hasOwnProperty("h")?e.hasOwnProperty("a")?"hsla(".concat(e.h,",").concat(e.s,",").concat(e.l,",").concat(e.a,")"):"hsl(".concat(e.h,",").concat(e.s,",").concat(e.l,")"):e}},K=function(t,e,i){return e.hasOwnProperty(t)?e[t]:i[t]},Q=Phaser.Utils.Objects.GetValue,tt=function(){function t(i,n,r,s,o){e(this,t),void 0===i&&(i=0),void 0===n&&(n=i),void 0===r&&(r=0),void 0===s&&(s=0),void 0===o&&(o=0),this.cornerRadius={},this._width=0,this._height=0,this.setTo(i,n,r,s,o);}return n(t,[{key:"setTo",value:function(t,e,i,n,r){return this.setPosition(t,e),this.setRadius(r),this.setSize(i,n),this}},{key:"setPosition",value:function(t,e){return this.x=t,this.y=e,this}},{key:"setRadius",value:function(t){return void 0===t&&(t=0),this.radius=t,this}},{key:"setSize",value:function(t,e){return this.width=t,this.height=e,this}},{key:"minWidth",get:function(){var t=this.cornerRadius;return Math.max(t.tl.x+t.tr.x,t.bl.x+t.br.x)}},{key:"minHeight",get:function(){var t=this.cornerRadius;return Math.max(t.tl.y+t.bl.y,t.tr.y+t.br.y)}},{key:"width",get:function(){return this._width},set:function(t){null==t&&(t=0),this._width=Math.max(t,this.minWidth);}},{key:"height",get:function(){return this._height},set:function(t){null==t&&(t=0),this._height=Math.max(t,this.minHeight);}},{key:"radius",get:function(){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:function(t){var e,i;"number"==typeof t?(e=t,i=t):(e=Q(t,"x",0),i=Q(t,"y",0));var n=this.cornerRadius;n.tl=et(Q(t,"tl",void 0),e,i),n.tr=et(Q(t,"tr",void 0),e,i),n.bl=et(Q(t,"bl",void 0),e,i),n.br=et(Q(t,"br",void 0),e,i);}},{key:"radiusTL",get:function(){var t=this.cornerRadius.tl;return Math.max(t.x,t.y)},set:function(t){it(this.cornerRadius.tl,t);}},{key:"radiusTR",get:function(){var t=this.cornerRadius.tr;return Math.max(t.x,t.y)},set:function(t){it(this.cornerRadius.tr,t);}},{key:"radiusBL",get:function(){var t=this.cornerRadius.bl;return Math.max(t.x,t.y)},set:function(t){it(this.cornerRadius.bl,t);}},{key:"radiusBR",get:function(){var t=this.cornerRadius.br;return Math.max(t.x,t.y)},set:function(t){it(this.cornerRadius.br,t);}}]),t}(),et=function(t,e,i){return void 0===t?t={x:e,y:i}:"number"==typeof t&&(t={x:t,y:t}),nt(t),t},it=function(t,e){"number"==typeof e?(t.x=e,t.y=e):(t.x=Q(e,"x",0),t.y=Q(e,"y",0)),nt(t);},nt=function(t){t.convex=t.x>=0||t.y>=0,t.x=Math.abs(t.x),t.y=Math.abs(t.y);},rt=Phaser.Math.DegToRad,st=function(t){return !t.hasOwnProperty("convex")||t.convex},ot=function(t){return t.x>0&&t.y>0},ht=function(t,e,i,n,r,s,o,h,a){if(h&&o>s?o-=360:!h&&o=f?1:n/f,y=r>=v?1:r/v,g=d.cornerRadius;t.save(),t.beginPath(),t.translate(e,i),h=g.tl,ot(h)?(a=h.x*p,u=h.y*y,st(h)?ht(t,a,u,a,u,180,270,!1,o):ht(t,0,0,a,u,90,0,!0,o),l=0,c=u):(t.lineTo(0,0),l=0,c=0),h=g.tr,ot(h)?(a=h.x*p,u=h.y*y,st(h)?ht(t,n-a,u,a,u,270,360,!1,o):ht(t,n,0,a,u,180,90,!0,o)):t.lineTo(n,0),h=g.br,ot(h)?(a=h.x*p,u=h.y*y,st(h)?ht(t,n-a,r-u,a,u,0,90,!1,o):ht(t,n,r,a,u,270,180,!0,o)):t.lineTo(n,r),h=g.bl,ot(h)?(a=h.x*p,u=h.y*y,st(h)?ht(t,a,r-u,a,u,90,180,!1,o):ht(t,0,r,a,u,360,270,!0,o)):t.lineTo(0,r),t.lineTo(l,c),t.closePath(),t.restore();}(e,i,n,r,s,o,d),null!=h){var f;if(null!=l)(f=c?e.createLinearGradient(0,0,r,0):e.createLinearGradient(0,0,0,s)).addColorStop(0,h),f.addColorStop(1,l),h=f;e.fillStyle=h,e.fill();}null!=a&&u>0&&(e.strokeStyle=a,e.lineWidth=u,e.stroke());},ut=Phaser.Utils.Objects.GetValue,lt=function(t){r(o,t);var i=a(o);function o(t,n){var r;return e(this,o),(r=i.call(this,t,"background")).setScrollFactor(0),r.setColor(ut(n,"color",null),ut(n,"color2",null),ut(n,"horizontalGradient",!0)),r.setStroke(ut(n,"stroke",null),ut(n,"strokeThickness",2)),r.setCornerRadius(ut(n,"cornerRadius",0),ut(n,"cornerIteration",null)),r}return n(o,[{key:"color",get:function(){return this._color},set:function(t){t=Z(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t;}},{key:"color2",get:function(){return this._color2},set:function(t){t=Z(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t;}},{key:"horizontalGradient",get:function(){return this._horizontalGradient},set:function(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t;}},{key:"setColor",value:function(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}},{key:"stroke",get:function(){return this._stroke},set:function(t){t=Z(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t;}},{key:"strokeThickness",get:function(){return this._strokeThickness},set:function(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t;}},{key:"setStroke",value:function(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}},{key:"cornerRadius",get:function(){return this._cornerRadius},set:function(t){this.setDirty(this._cornerRadius!=t),this._cornerRadius=t;}},{key:"cornerIteration",get:function(){return this._cornerIteration},set:function(t){this.setDirty(this._cornerIteration!=t),this._cornerIteration=t;}},{key:"modifyStyle",value:function(t){return t.hasOwnProperty("color")&&this.setColor(t.color,K("color2",t,this),K("horizontalGradient",t,this)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,K("strokeThickness",t,this)),t.hasOwnProperty("cornerRadius")&&this.setCornerRadius(t.cornerRadius,K("cornerIteration",t,this)),this}},{key:"modifyPorperties",value:function(t){return l(s(o.prototype),"modifyPorperties",this).call(this,t),this.modifyStyle(t),this}},{key:"setCornerRadius",value:function(t,e){return this.cornerRadius=t,this.cornerIteration=e,this}},{key:"renderContent",value:function(){!function(t,e,i,n,r,s,o,h){if(null!=e||null!=i){var a=t.canvas.width,u=t.canvas.height;null==i&&(n=0);var l=n/2;a=Math.max(1,a-n),u=Math.max(1,u-n),at(t.canvas,t.context,l,l,a,u,r,e,i,n,s,o,h);}}(this.parent,this.color,this.stroke,this.strokeThickness,this.cornerRadius,this.color2,this.horizontalGradient,this.cornerIteration);}}]),o}(J),ct=Phaser.Utils.Objects.GetValue,dt=function(t){r(o,t);var i=a(o);function o(t,n){var r;return e(this,o),(r=i.call(this,t,"innerbounds")).setScrollFactor(0),r.setColor(ct(n,"color",null),ct(n,"color2",null),ct(n,"horizontalGradient",!0)),r.setStroke(ct(n,"stroke",null),ct(n,"strokeThickness",2)),r}return n(o,[{key:"color",get:function(){return this._color},set:function(t){t=Z(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t;}},{key:"color2",get:function(){return this._color2},set:function(t){t=Z(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t;}},{key:"horizontalGradient",get:function(){return this._horizontalGradient},set:function(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t;}},{key:"setColor",value:function(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}},{key:"stroke",get:function(){return this._stroke},set:function(t){t=Z(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t;}},{key:"strokeThickness",get:function(){return this._strokeThickness},set:function(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t;}},{key:"setStroke",value:function(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}},{key:"modifyPorperties",value:function(t){l(s(o.prototype),"modifyPorperties",this).call(this,t),t.hasOwnProperty("color")&&this.setColor(t.color,ct(t,"color2",null),ct(t,"horizontalGradient",!0)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,ct(t,"strokeThickness",2));}},{key:"renderContent",value:function(){var t=this.parent.padding,e=t.left,i=t.top,n=this.parent.width-t.left-t.right,r=this.parent.height-t.top-t.bottom,s=this.context;if(null!=this.color){var o,h;if(null!=this.color2)(h=this.horizontalGradient?s.createLinearGradient(0,0,n,0):s.createLinearGradient(0,0,0,r)).addColorStop(0,this.color),h.addColorStop(1,this.color2),o=h;else o=this.color;s.fillStyle=o,s.fillRect(e,i,n,r);}null!=this.stroke&&this.strokeThickness>0&&(s.strokeStyle=this.stroke,s.lineWidth=this.strokeThickness,s.strokeRect(e,i,n,r));}}]),o}(J),ft=Phaser.Utils.Objects.GetValue,vt=function(){function t(i,n){e(this,t),this.parent=i,this.set(n);}return n(t,[{key:"toJSON",value:function(){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}}},{key:"set",value:function(t){return this.setBold(ft(t,"bold",!1)),this.setItalic(ft(t,"italic",!1)),this.setFontSize(ft(t,"fontSize","16px")),this.setFontFamily(ft(t,"fontFamily","Courier")),this.setColor(ft(t,"color","#fff")),this.setStrokeStyle(ft(t,"stroke",null),ft(t,"strokeThickness",0)),this.setShadow(ft(t,"shadowColor",null),ft(t,"shadowOffsetX",0),ft(t,"shadowOffsetY",0),ft(t,"shadowBlur",0)),this.setOffset(ft(t,"offsetX",0),ft(t,"offsetY",0)),this.setSpace(ft(t,"leftSpace",0),ft(t,"rightSpace",0)),this.setAlign(ft(t,"align",void 0)),this.setBackgroundColor(ft(t,"backgroundColor",null)),this.setBackgroundHeight(ft(t,"backgroundHeight",void 0)),this.setBackgroundBottomY(ft(t,"backgroundBottomY",void 0)),this}},{key:"modify",value:function(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(K("stroke",t,this),K("strokeThickness",t,this)),t.hasOwnProperty("shadowColor")&&this.setShadowColor(t.shadowColor),(t.hasOwnProperty("shadowOffsetX")||t.hasOwnProperty("shadowOffsetY"))&&this.setShadowOffset(K("shadowOffsetX",t,this),K("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}},{key:"setUpdateTextFlag",value:function(){return this.parent&&(this.parent.updateTextFlag=!0),this}},{key:"clone",value:function(){return new t(null,this.toJSON())}},{key:"copyFrom",value:function(t){return this.set(t.toJSON()),this}},{key:"copyTo",value:function(t){return t.set(this.toJSON()),this}},{key:"setBold",value:function(t){return void 0===t&&(t=!0),this.bold=t,this.setUpdateTextFlag(),this}},{key:"setItalic",value:function(t){return void 0===t&&(t=!0),this.italic=t,this.setUpdateTextFlag(),this}},{key:"fontStyle",get:function(){return this.bold&&this.italic?"bold italic":this.bold?"bold":this.italic?"italic":""}},{key:"setFontSize",value:function(t){return "number"==typeof t&&(t="".concat(t,"px")),this.fontSize=t,this.setUpdateTextFlag(),this}},{key:"setFontFamily",value:function(t){return this.fontFamily=t,this.setUpdateTextFlag(),this}},{key:"font",get:function(){return "".concat(this.fontStyle," ").concat(this.fontSize," ").concat(this.fontFamily)}},{key:"setColor",value:function(t){return this.color=Z(t),this}},{key:"hasFill",get:function(){return null!=this.color}},{key:"setStrokeStyle",value:function(t,e){return this.stroke=Z(t),void 0!==e&&(this.strokeThickness=e),this}},{key:"setStrokeThickness",value:function(t){return this.strokeThickness=t,this}},{key:"hasStroke",get:function(){return null!=this.stroke&&this.strokeThickness>0}},{key:"setShadowColor",value:function(t){return this.shadowColor=Z(t),this}},{key:"setShadowOffset",value:function(t,e){return void 0===t&&(t=0),void 0===e&&(e=0),this.shadowOffsetX=t,this.shadowOffsetY=e,this}},{key:"setShadowBlur",value:function(t){return void 0===t&&(t=0),this.shaodwBlur=t,this}},{key:"setShadow",value:function(t,e,i,n){return this.setShadowColor(t).setShadowOffset(e,i).setShadowBlur(n),this}},{key:"setBackgroundColor",value:function(t){return this.backgroundColor=Z(t),this}},{key:"hasBackgroundColor",get:function(){return null!=this.backgroundColor}},{key:"setBackgroundHeight",value:function(t){return this.backgroundHeight=t,this}},{key:"setBackgroundBottomY",value:function(t){return this.backgroundBottomY=t,this}},{key:"setOffsetX",value:function(t){return void 0===t&&(t=0),this.offsetX=t,this}},{key:"setOffsetY",value:function(t){return void 0===t&&(t=0),this.offsetY=t,this}},{key:"setOffset",value:function(t,e){return this.setOffsetX(t).setOffsetY(e),this}},{key:"setLeftSpace",value:function(t){return void 0===t&&(t=0),this.leftSpace=t,this}},{key:"setRightSpace",value:function(t){return void 0===t&&(t=0),this.rightSpace=t,this}},{key:"setSpace",value:function(t,e){return this.setLeftSpace(t).setRightSpace(e),this}},{key:"setAlign",value:function(t){return this.align=t,this}},{key:"syncFont",value:function(t){return t.font=this.font,this}},{key:"syncStyle",value:function(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}},{key:"syncShadow",value:function(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);}},{key:"getTextMetrics",value:function(t,e){return this.syncFont(t).syncStyle(t),t.measureText(e)}}]),t}(),pt=Phaser.Utils.Array.Remove,yt=Phaser.Utils.Array.Remove,gt="text",kt="image",xt="drawer",mt="space",wt="command",bt=function(t){return t.type===gt&&"\n"===t.text},Ct=function(t){return t.type===gt&&"\f"===t.text},St=function(t){return t.type===gt},Ot=function(t){r(o,t);var i=a(o);function o(t,n,r){var s;return e(this,o),(s=i.call(this,t,gt)).updateTextFlag=!1,s.style=new vt(h(s),r),s.setText(n),s}return n(o,[{key:"autoRound",get:function(){return this.parent.autoRound}},{key:"offsetX",get:function(){return this.style.offsetX},set:function(t){this.style&&(this.style.offsetX=t);}},{key:"offsetY",get:function(){return this.style.offsetY},set:function(t){this.style&&(this.style.offsetY=t);}},{key:"leftSpace",get:function(){return this.style.leftSpace*this.scaleX},set:function(t){this.style&&(this.style.leftSpace=t),d(s(o.prototype),"leftSpace",t,this,!0);}},{key:"rightSpace",get:function(){return this.style.rightSpace*this.scaleX},set:function(t){this.style&&(this.style.rightSpace=t),d(s(o.prototype),"rightSpace",t,this,!0);}},{key:"align",get:function(){return this.style.align},set:function(t){this.style&&(this.style.align=t);}},{key:"modifyStyle",value:function(t){return this.setDirty(!0),this.style.modify(t),this.updateTextFlag&&this.updateTextSize(),this}},{key:"modifyPorperties",value:function(t){return t?(this.modifyStyle(t),l(s(o.prototype),"modifyPorperties",this).call(this,t),this):this}},{key:"setText",value:function(t){return this.setDirty(this.text!=t),this.text=t,this.updateTextSize(),this}},{key:"updateTextSize",value:function(){var t=this.text;if("\n"===t||"\f"===t||""===t)this.clearTextSize();else {var e,i,n=this.style.getTextMetrics(this.context,this.text);this.textWidth=n.width,"actualBoundingBoxAscent"in n?(e=n.actualBoundingBoxAscent,i=n.actualBoundingBoxDescent):(e=0,i=0),this.textHeight=e+i,this.ascent=e,this.descent=i;}return this.updateTextFlag=!1,this}},{key:"clearTextSize",value:function(){return this.textWidth=0,this.textHeight=0,this.ascent=0,this.descent=0,this}},{key:"copyTextSize",value:function(t){return this.textWidth=t.textWidth,this.textHeight=t.textHeight,this.ascent=t.ascent,this.descent=t.descent,this}},{key:"width",get:function(){return this.textWidth*this.scaleX},set:function(t){this.textWidth>0?this.scaleX=t/this.textWidth:this.scaleX=1;}},{key:"height",get:function(){return this.textHeight*this.scaleY},set:function(t){this.textHeight>0?this.scaleY=t/this.textHeight:this.scaleY=1;}},{key:"willRender",get:function(){return 0!==this.textWidth&&l(s(o.prototype),"willRender",this)}},{key:"renderContent",value:function(){var t=this.context,e=this.style;if(e.hasBackgroundColor){t.fillStyle=e.backgroundColor;var i=this.drawTLX,n=this.drawTRX-i,r=e.backgroundBottomY;null==r&&(r=this.drawBLY);var s=e.backgroundHeight;null==s&&(s=r-this.drawTLY);var o=r-s;t.fillRect(i,o,n,s);}var h=e.hasFill,a=e.hasStroke;(h||a)&&(e.syncFont(t).syncStyle(t),a&&(e.syncShadow(t),t.strokeText(this.text,0,0)),h&&(e.syncShadow(t),t.fillText(this.text,0,0)));}},{key:"drawTLX",get:function(){return -this.leftSpace}},{key:"drawTLY",get:function(){return -this.ascent}},{key:"drawBLX",get:function(){return -this.leftSpace}},{key:"drawBLY",get:function(){return this.descent}},{key:"drawTRX",get:function(){return this.textWidth+this.rightSpace}},{key:"drawTRY",get:function(){return -this.ascent}},{key:"drawBRX",get:function(){return this.textWidth+this.rightSpace}},{key:"drawBRY",get:function(){return this.descent}}]),o}(J),Tt=function(t,e){var i=this.createCharChildren(t,e);return this.addChild(i),this},Pt=function(t){r(s,t);var i=a(s);function s(t,n,r){var o;return e(this,s),(o=i.call(this,t,kt)).setTexture(n,r),o}return n(s,[{key:"frameWidth",get:function(){return this.frameObj?this.frameObj.cutWidth:0}},{key:"frameHeight",get:function(){return this.frameObj?this.frameObj.cutHeight:0}},{key:"offsetY",get:function(){return -this.height},set:function(t){}},{key:"key",get:function(){return this._key},set:function(t){this.setDirty(this._key!=t),this._key=t;}},{key:"frame",get:function(){return this._frame},set:function(t){this.setDirty(this._frame!=t),this._frame=t;}},{key:"setTexture",value:function(t,e){return this.key=t,this.frame=e,this.frameObj=this.scene.sys.textures.getFrame(t,e),this}},{key:"width",get:function(){return this.frameWidth*this.scaleX},set:function(t){this.setDirty(this.width!==t),this.scaleX=t/this.frameWidth;}},{key:"height",get:function(){return this.frameHeight*this.scaleY},set:function(t){this.setDirty(this.height!==t),this.scaleY=t/this.frameHeight;}},{key:"setHeight",value:function(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}},{key:"renderContent",value:function(){var t=this.context,e=this.frameObj,i=this.frameWidth,n=this.frameHeight;t.drawImage(e.source.image,e.cutX,e.cutY,i,n,0,0,i,n);}},{key:"drawTLX",get:function(){return -this.leftSpace}},{key:"drawTLY",get:function(){return 0}},{key:"drawBLX",get:function(){return -this.leftSpace}},{key:"drawBLY",get:function(){return this.frameHeight}},{key:"drawTRX",get:function(){return this.frameWidth+this.rightSpace}},{key:"drawTRY",get:function(){return 0}},{key:"drawBRX",get:function(){return this.frameWidth+this.rightSpace}},{key:"drawBRY",get:function(){return this.frameHeight}}]),s}(J),_t=function(t){r(o,t);var i=a(o);function o(t,n,r,s){var h;return e(this,o),(h=i.call(this,t,xt)).setRenderCallback(n),h.setDrawerSize(r,s),h}return n(o,[{key:"setRenderCallback",value:function(t){return t?this.renderContent=t.bind(this):delete this.renderContent,this}},{key:"setDrawerSize",value:function(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}},{key:"onFree",value:function(){l(s(o.prototype),"onFree",this).call(this),this.setRenderCallback();}},{key:"width",get:function(){return this.drawerWidth*this.scaleX},set:function(t){this.setDirty(this.width!==t),this.scaleX=this.drawerWidth>0?t/this.drawerWidth:1;}},{key:"height",get:function(){return this.drawerHeight*this.scaleY},set:function(t){this.setDirty(this.height!==t),this.scaleY=this.drawerHeight>0?t/this.drawerHeight:1;}},{key:"offsetY",get:function(){return -this.height},set:function(t){}},{key:"drawTLX",get:function(){return -this.leftSpace}},{key:"drawTLY",get:function(){return 0}},{key:"drawBLX",get:function(){return -this.leftSpace}},{key:"drawBLY",get:function(){return this.drawerHeight}},{key:"drawTRX",get:function(){return this.drawerWidth+this.rightSpace}},{key:"drawTRY",get:function(){return 0}},{key:"drawBRX",get:function(){return this.drawerWidth+this.rightSpace}},{key:"drawBRY",get:function(){return this.drawerHeight}}]),o}(J),Et=function(t){r(s,t);var i=a(s);function s(t,n){var r;return e(this,s),(r=i.call(this,t,mt)).setSpaceWidth(n),r}return n(s,[{key:"width",get:function(){return this.spaceWidth*this.scaleX},set:function(t){this.spaceWidth>0?this.scaleX=t/this.spaceWidth:this.scaleX=1;}},{key:"setSpaceWidth",value:function(t){return this.spaceWidth=t,this}}]),s}(J),Yt=function(t){r(o,t);var i=a(o);function o(t,n,r,s,h){var a;return e(this,o),(a=i.call(this,t,wt)).setName(n).setParameter(s).setCallback(r,h),a}return n(o,[{key:"setName",value:function(t){return this.name=t,this}},{key:"setParameter",value:function(t){return this.param=t,this}},{key:"setCallback",value:function(t,e){return this.callback=t,this.scope=e,this}},{key:"exec",value:function(){return this.scope?this.callback.call(this.scope,this.param,this.name):this.callback(this.param,this.name)}},{key:"onFree",value:function(){l(s(o.prototype),"onFree",this).call(this),this.setName().setCallback().setParameter();}}]),o}(E),Xt=function e(i){var n,r,s;if(null==i||"object"!==t(i))return i;if(n=Array.isArray(i)?[]:{},function(e){if("object"!==t(e)||e.nodeType||e===e.window)return !1;try{if(e.constructor&&!{}.hasOwnProperty.call(e.constructor.prototype,"isPrototypeOf"))return !1}catch(t){return !1}return !0}(i))for(s in i)r=i[s],n[s]=e(r);else n=i;return n},At=function(t,e,i,n){void 0===n&&(n={word:[],width:0}),n.word.length=0;for(var r=t.length,s=e,o=n.word,h=0;s0&&!h){var a=this.fixedHeight-n;if(i>0)s=a/i;else s=(u=Bt.call(this)).height,o=u.ascent,i=Math.floor((a-o)/s);}else {var u;s=(u=Bt.call(this)).height,o=u.ascent;}}else if(this.fixedHeight>0){if(void 0===(i=Dt(t,"maxLines"))){a=this.fixedHeight-n;i=Math.floor(a/s);}}else i=Dt(t,"maxLines",0);void 0===o&&(o=s);var l=0===i,c=Dt(t,"wrapWidth",void 0);void 0===c&&(c=this.fixedWidth>0?this.fixedWidth-r:1/0);for(var d=Dt(t,"letterSpacing",0),f=Dt(t,"hAlign",0),v=Dt(t,"vAlign",0),p=Dt(t,"charWrap",!1),y={callback:"runWordWrap",start:e,isLastPage:!1,padding:this.wrapPadding,ascent:o,lineHeight:s,maxLines:i,wrapWidth:c,letterSpacing:d,hAlign:f,vAlign:v,charWrap:p,children:[],lines:[],maxLineWidth:0,linesHeight:0},g=this.children,k=0,x=g.length;k0&&(E.push({children:Y,width:X}),A=Math.max(A,X)),y.start+=_.length,y.isLastPage=!L&&y.start===T,y.maxLineWidth=A,y.linesHeight=E.length*s;var M=this.fixedWidth>0?this.fixedWidth:y.maxLineWidth+r,H=this.fixedHeight>0?this.fixedHeight:y.linesHeight+n;!function(t,e,i){var n,r,s=t.hAlign,o=t.vAlign,h=t.linesHeight;switch(o){case 1:case"center":r=(i-h)/2;break;case 2:case"bottom":r=i-h;break;default:r=0;}for(var a=t.lines,u=0,l=a.length;u0?(o=this.fixedWidth-r)/i:0;else if(this.fixedWidth>0){if(void 0===(i=Mt(t,"maxLines",void 0))){var o=this.fixedWidth-r;i=Math.floor(o/s)+1;}}else i=Mt(t,"maxLines",0);var h=0===i,a=Mt(t,"fixedChildHeight",void 0);if(void 0===a){var u=Mt(t,"charPerLine",void 0);if(void 0!==u){var l=this.fixedHeight-n;a=Math.floor(l/u);}}var c=Mt(t,"wrapHeight",void 0);void 0===c&&(c=this.fixedHeight>0?this.fixedHeight-n:1/0);for(var d=Mt(t,"letterSpacing",0),f=Mt(t,"rtl",!0),v=Mt(t,"hAlign",f?2:0),p=Mt(t,"vAlign",0),y={callback:"runVerticalWrap",start:e,isLastPage:!1,padding:this.wrapPadding,lineWidth:s,maxLines:i,fixedChildHeight:a,wrapHeight:c,letterSpacing:d,hAlign:v,vAlign:p,rtl:f,children:[],lines:[],maxLineHeight:0,linesWidth:0},g=this.children,k=0,x=g.length;k0&&(E.push({children:Y,height:X}),A=Math.max(A,X)),y.start+=_.length,y.isLastPage=y.start===T,y.maxLineHeight=A,y.linesWidth=E.length*s;var j=this.fixedWidth>0?this.fixedWidth:y.linesWidth+r,F=this.fixedHeight>0?this.fixedHeight:y.maxLineHeight+n;!function(t,e,i){var n,r,s=t.hAlign,o=t.vAlign,h=t.rtl,a=t.lines,u=t.lineWidth,l=t.linesWidth;switch(s){case 1:case"center":n=(e-l)/2;break;case 2:case"right":n=e-l;break;default:n=0;}h&&(n+=u);for(var c=0,d=a.length;c0?t:this.width,e>0?e:this.height),this):this},setPadding:function(t,e){var i=this.padding,n=i.left,r=i.right,s=i.top,o=i.bottom;return P(i,t,e),this.dirty=this.dirty||n!=i.left||r!=i.right||s!=i.top||o!=i.bottom,this},getPadding:function(t){return function(t,e){return void 0===e?t:t[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),pt(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 yt(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,n,r,s=Array.isArray(t);void 0===e||e===this.children.length?s?(i=this.children).push.apply(i,f(t)):this.children.push(t):s?(n=this.children).splice.apply(n,[e,0].concat(f(t))):this.children.splice(e,0,t);(this.lastAppendedChildren.length=0,s)?(r=this.lastAppendedChildren).push.apply(r,f(t)):this.lastAppendedChildren.push(t);return this},createCharChild:function(t,e){e&&this.textStyle.modify(e);var i=this.poolManager.allocate(gt);return null===i?i=new Ot(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=[],n=0,r=t.length;ne&&(n=e,r=t);})),r},getCharWorldPosition:function(t,e,i,n){return "number"==typeof t&&(t=this.getCharChild(t,!0)),G(this,t,e,i,n)},setToMinSize:function(){for(var t=this.children,e=0,i=0,n=0,r=t.length;n=i.length&&(t=i.length);for(var n=0,r=0;r0?this.items.pop():null}},{key:"push",value:function(t){return this.items.push(t),this}},{key:"pushMultiple",value:function(t){return this.items.push.apply(this.items,t),t.length=0,this}},{key:"clear",value:function(){return this.items.length=0,this}}]),t}(),he=Phaser.Utils.Objects.GetFastValue,ae={},ue=function(){function t(i){e(this,t),this.pools=he(i,"pools",ae);}return n(t,[{key:"free",value:function(t){if(!this.pools)return this;var e=t.type;return this.pools.hasOwnProperty(e)||(this.pools[e]=new oe),this.pools[e].push(t),t.onFree(),this}},{key:"freeMultiple",value:function(t){if(!this.pools)return this;for(var e=0,i=t.length;e0)return Se.length=0,!0;return Se.length=0,!1},Se=[],Oe=void 0,Te=Phaser.Utils.Objects.GetValue,Pe=function(t,e,i){var n,r;for(var s in void 0===i&&(i={}),t)n=t[s],void 0!==(r=Te(e,s,n[1]))&&(i[n[0]]=r);return i},_e=function(t){t.stopPropagation();},Ee=Phaser.Utils.Objects.GetValue,Ye=function(t,e){var i,n=Ee(e,"inputType",void 0);void 0===n&&(n=Ee(e,"type","text")),"textarea"===n?(i=document.createElement("textarea")).style.resize="none":(i=document.createElement("input")).type=n;var r=Ee(e,"style",void 0),s=i.style;Pe(we,r,s),s.position="absolute",s.opacity=0,s.pointerEvents="none",s.zIndex=0,s.transform="scale(0)",Pe(me,e,i),function(t){t.addEventListener("touchstart",_e,!1),t.addEventListener("touchmove",_e,!1),t.addEventListener("touchend",_e,!1),t.addEventListener("mousedown",_e,!1),t.addEventListener("mouseup",_e,!1),t.addEventListener("mousemove",_e,!1);}(i);var o=t.scene.sys.scale;return (o.isFullscreen?o.fullscreenTarget:document.body).appendChild(i),i},Xe={open:function(){return this.isOpened||this.readOnly||((t=this)!==Oe&&(void 0!==Oe&&Oe.close(),Oe=t),this.isOpened=!0,this.node||(this.node=Ye(this,this.nodeConfig)),this.setFocus(),this.initText(),this.enterCloseEnable&&this.scene.input.keyboard.once("keydown-ENTER",this.close,this),this.scene.sys.events.on("postupdate",this.updateText,this),this.scene.input.on("pointerdown",this.onClickOutside,this),this.onOpenCallback&&this.onOpenCallback(this.parent,this),this.emit("open",this)),this;var t;},close:function(){return this.isOpened?(this===Oe&&(Oe=void 0),this.setBlur(),this.isOpened=!1,this.updateText(),this.scene.sys.events.off("postupdate",this.updateText,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),this):this}},Ae=Phaser.Utils.Objects.GetValue,Le=function(t){r(o,t);var i=a(o);function o(t,n){var r;e(this,o),r=i.call(this,t);var s=Ae(n,"inputType",void 0);void 0===s&&(s=Ae(n,"type","text")),r.setEnterCloseEnable(Ae(n,"enterClose","textarea"!==s));var a=Ae(n,"onOpen",void 0);a||(a=Ae(n,"onFocus",void 0)),r.onOpenCallback=a;var u=Ae(n,"onClose",void 0);return u||(u=Ae(n,"onBlur",void 0)),r.onCloseCallback=u,r.onUpdateCallback=Ae(n,"onUpdate",void 0),r.isOpened=!1,t.on("pointerdown",(function(){this.open();}),h(r)).setInteractive(),r.nodeConfig=function(t){void 0===t&&(t={});var e={};return be(t,e,"inputType"),be(t,e,"type"),be(t,e,"style"),be(t,e,we),be(t,e,me),e}(n),r.node=void 0,r}return n(o,[{key:"destroy",value:function(){this.close(),l(s(o.prototype),"destroy",this).call(this);}},{key:"onClickOutside",value:function(t){(function(t,e,i,n){if(e)return !(i&&!i(t,e)||!Ce(t,e)||n&&!n(t,e));for(var r=t.scene.input.manager,s=r.pointersTotal,o=r.pointers,h=0;h=r&&a=i&&ai.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!=n&&(r=e.getCharChild(n))&&("\n"===r.text&&r.copyTextSize(e.lastInsertCursor),function(t){var e,i,n=t.parent,r=n.width,s=n.height,o=t.drawX,h=t.drawY,a=o+t.drawTLX,u=o+t.drawTRX,l=h+t.drawTLY,c=h+t.drawBLY;e=a<0?0-a:u>r?r-u:0,i=l<0?0-l:c>s?s-c:0,n._textOX+=e,n._textOY+=i;}(r),e.emit("cursorin",r,n,e)),e.emit("movecursor",n,t.prevCursorPosition,e),t.prevCursorPosition=n;}}(this)):(Be(this),We(this)),this}},{key:"setNumberInput",value:function(){return this.onUpdateCallback=Re,this}},{key:"setSelectAllWhenFocusEnable",value:function(t){return void 0===t&&(t=!0),this.selectAllWhenFocus=t,this}}]),s}(Le),Fe=Phaser.Utils.Objects.GetValue,Me=["inputType","onOpen","onFocus","onClose","onBlur","onUpdate","enterClose","readOnly","maxLength","minLength","selectAll"],He=function(t,e){if(t&&"number"!=typeof t){if(t.hasOwnProperty(e))return !0;if(-1!==e.indexOf(".")){for(var i=e.split("."),n=t,r=0;rt.length?i:t})),u.value=t.join(c);}else u.value=t.join(i.slice(h,h+u.count));h+=u.count,u.added||(a+=u.count);}}var d=e[o-1];return o>1&&"string"==typeof d.value&&(d.added||d.removed)&&t.equals("",d.value)&&(e[o-2].value+=d.value,e.pop()),e}$e.prototype={diff:function(t,e){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=i.callback;"function"==typeof i&&(n=i,i={}),this.options=i;var r=this;function s(t){return n?(setTimeout((function(){n(void 0,t);}),0),!0):t}t=this.castInput(t),e=this.castInput(e),t=this.removeEmpty(this.tokenize(t));var o=(e=this.removeEmpty(this.tokenize(e))).length,h=t.length,a=1,u=o+h;i.maxEditLength&&(u=Math.min(u,i.maxEditLength));var l=[{newPos:-1,components:[]}],c=this.extractCommon(l[0],e,t,0);if(l[0].newPos+1>=o&&c+1>=h)return s([{value:this.join(e),count:e.length}]);function d(){for(var i=-1*a;i<=a;i+=2){var n=void 0,u=l[i-1],c=l[i+1],d=(c?c.newPos:0)-i;u&&(l[i-1]=void 0);var f=u&&u.newPos+1=o&&d+1>=h)return s(Ze(r,n.components,e,t,r.useLongestToken));l[i]=n;}else l[i]=void 0;}var p;a++;}if(n)!function t(){setTimeout((function(){if(a>u)return n();d()||t();}),0);}();else for(;a<=u;){var f=d();if(f)return f}},pushComponent:function(t,e,i){var n=t[t.length-1];n&&n.added===e&&n.removed===i?t[t.length-1]={count:n.count+1,added:e,removed:i}:t.push({count:1,added:e,removed:i});},extractCommon:function(t,e,i,n){for(var r=e.length,s=i.length,o=t.newPos,h=o-n,a=0;o+1 textObject.width) { - dx = textObject.width - childRightX; - } else { - dx = 0; - } - var childTopY = this.drawY + this.drawTLY; - var childBottomY = childTopY + this.height; - if (childTopY < 0) { - dy = 0 - childTopY; - } else if (childBottomY > textObject.height) { - dy = textObject.height - childBottomY; - } else { - dy = 0; - } - textObject._textOX += dx; - textObject._textOY += dy; - return this; - }; - var Methods$2 = { contains: Contains, - getWorldPosition: GetWorldPosition, - scrollTo: ScrollTo + getWorldPosition: GetWorldPosition }; Object.assign(Methods$2, RenderMethods); @@ -22422,13 +22395,12 @@ } }; - var SetTextOXYMethods = { + var SetTextOXYMethods$1 = { setTextOX: function setTextOX(ox) { if (ox === this._textOX) { return this; } this._textOX = ox; - this.updateTexture(); return this; }, setTextOY: function setTextOY(oy) { @@ -22436,7 +22408,6 @@ return this; } this._textOY = oy; - this.updateTexture(); return this; }, setTextOXY: function setTextOXY(ox, oy) { @@ -22445,7 +22416,6 @@ } this._textOX = ox; this._textOY = oy; - this.updateTexture(); return this; }, addTextOX: function addTextOX(incX) { @@ -22906,7 +22876,7 @@ setChildrenInteractiveEnable: SetChildrenInteractiveEnable, setInteractive: SetInteractive }; - Object.assign(Methods$1, MoveChildMethods, BackgroundMethods, InnerBoundsMethods, SetAlignMethods, SetTextOXYMethods); + Object.assign(Methods$1, MoveChildMethods, BackgroundMethods, InnerBoundsMethods, SetAlignMethods, SetTextOXYMethods$1); var GetFastValue = Phaser.Utils.Objects.GetFastValue; var Pools = {}; @@ -23819,6 +23789,38 @@ hiddenTextEdit.prevSelectionEnd = selectionEnd; }; + var ScrollToBob = function ScrollToBob(bob) { + var textObject = bob.parent; + var textObjectLeftX = 0, + textObjectRightX = textObject.width, + textObjectTopY = 0, + textObjectBottomY = textObject.height; + var childX = bob.drawX, + childY = bob.drawY; + var childLeftX = childX + bob.drawTLX, + childRightX = childX + bob.drawTRX, + childTopY = childY + bob.drawTLY, + childBottomY = childY + bob.drawBLY; + var dx; + if (childLeftX < textObjectLeftX) { + dx = textObjectLeftX - childLeftX; + } else if (childRightX > textObjectRightX) { + dx = textObjectRightX - childRightX; + } else { + dx = 0; + } + var dy; + if (childTopY < textObjectTopY) { + dy = textObjectTopY - childTopY; + } else if (childBottomY > textObjectBottomY) { + dy = textObjectBottomY - childBottomY; + } else { + dy = 0; + } + textObject._textOX += dx; + textObject._textOY += dy; + }; + var MoveCursor = function MoveCursor(hiddenTextEdit) { var textObject = hiddenTextEdit.parent; var text = textObject.text; @@ -23848,7 +23850,7 @@ if (child.text === '\n') { child.copyTextSize(textObject.lastInsertCursor); } - child.scrollTo(); + ScrollToBob(child); textObject.emit('cursorin', child, cursorPosition, textObject); } } @@ -24549,7 +24551,35 @@ // Push back lastInsertCursor directly textObject.children.push(textObject.lastInsertCursor); - textObject.runWordWrap(); + var result = textObject.runWordWrap(); + textObject.contentWidth = result.maxLineWidth; + textObject.contentHeight = result.linesHeight; + textObject.linesCount = result.lines.length; + }; + + var SetTextOXYMethods = { + setTextOYByPercentage: function setTextOYByPercentage(percentage) { + this.setTextOY(-this.textVisibleHeight * percentage); + return this; + }, + getTextOYPercentage: function getTextOYPercentage() { + var textVisibleHeight = this.textVisibleHeight; + if (textVisibleHeight === 0) { + return 0; + } + return this._textOY / -textVisibleHeight; + }, + setTextOXByPercentage: function setTextOXByPercentage(percentage) { + this.setTextOX(-this.textVisibleWidth * percentage); + return this; + }, + getTextOXPercentage: function getTextOXPercentage() { + var textVisibleWidth = this.textVisibleWidth; + if (textVisibleWidth === 0) { + return 0; + } + return this._textOX / -textVisibleWidth; + } }; var IsPlainObject = Phaser.Utils.Objects.IsPlainObject; @@ -24578,6 +24608,11 @@ var cursorStyle = ExtractByPrefix(config.style, 'cursor'); _this = _super.call(this, scene, x, y, fixedWidth, fixedHeight, config); _this.type = 'rexCanvasInput'; + + // readonly + _this.contentWidth = undefined; + _this.contentHeight = undefined; + _this.linesCount = undefined; _this._text; _this.textEdit = CreateHiddenTextEdit(_assertThisInitialized(_this), config); if (config.focusStyle) { @@ -24809,12 +24844,67 @@ this.minLength = value; return this; } + }, { + key: "topTextOY", + get: function get() { + return 0; + } + }, { + key: "bottomTextOY", + get: function get() { + return -this.tableVisibleHeight; + } + }, { + key: "leftTextOX", + get: function get() { + return 0; + } + }, { + key: "rightTextOX", + get: function get() { + return -this.textVisibleWidth; + } + }, { + key: "textVisibleHeight", + get: function get() { + var h = this.contentHeight - this.height; + if (h < 0) { + h = 0; + } + return h; + } + }, { + key: "textVisibleWidth", + get: function get() { + var w = this.contentWidth - this.width; + if (w < 0) { + w = 0; + } + return w; + } + }, { + key: "t", + get: function get() { + return this.getTextOYPercentage(); + }, + set: function set(value) { + this.setTextOYByPercentage(value).updateTexture(); + } + }, { + key: "s", + get: function get() { + return this.getTextOXPercentage(); + }, + set: function set(value) { + this.setTextOXByPercentage(value).updateTexture(); + } }]); return CanvasInput; }(DynamicText); var DefaultParseTextCallback = function DefaultParseTextCallback(text) { return text; }; + Object.assign(CanvasInput.prototype, SetTextOXYMethods); var CreateInputText = function CreateInputText(scene, config, deepCloneConfig) { if (deepCloneConfig === undefined) { diff --git a/dist/rexcolorcomponents.min.js b/dist/rexcolorcomponents.min.js index 1860c35a82..a883080ad6 100644 --- a/dist/rexcolorcomponents.min.js +++ b/dist/rexcolorcomponents.min.js @@ -1,7 +1,7 @@ -!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).rexcolorcomponents=e();}(undefined,(function(){function t(e){return t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},t(e)}function e(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){for(var i=0;it.length)&&(e=t.length);for(var i=0,n=new Array(e);i=0;i--)(e=this.children[i]).parentContainer||e.displayList||e.destroy(t);this.clear(!t),c(s(o.prototype),"destroy",this).call(this,t);}}},{key:"contains",value:function(t){return -1!==this.children.indexOf(t)}},{key:"add",value:function(t){var e=this;return x(this.children,t,0,(function(t){t.once("destroy",e.onChildDestroy,e);}),this),this}},{key:"remove",value:function(t,e){var i=this;return b(this.children,t,(function(t){t.off("destroy",i.onChildDestroy,i),e&&t.destroy();})),this}},{key:"onChildDestroy",value:function(t,e){this.remove(t,!1);}},{key:"clear",value:function(t){for(var e,i=0,n=this.children.length;i0;){var n=i.shift();!e(n)&&n.isRexContainerLite&&i.push.apply(i,v(n.children));}},it=Phaser.Utils.Array,nt={getChildren:function(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},Xe=/(\S+)\[(\d+)\]/i,Ye=Phaser.Utils.Objects.GetValue,Be=function(t,e){return void 0===e?t:t[e]},Ne=function(e,i,n){void 0===e&&(e={}),void 0===i&&(i=0);var r=t(i);return "string"===r?e[i]=n:"number"===r?(e.left=i,e.right=i,e.top=i,e.bottom=i):(e.left=Ye(i,"left",0),e.right=Ye(i,"right",0),e.top=Ye(i,"top",0),e.bottom=Ye(i,"bottom",0)),e},He={getInnerPadding:function(t){return Be(this.space,t)},setInnerPadding:function(t,e){return Ne(this.space,t,e),this},getOuterPadding:function(t){return Be(this.getSizerConfig(this).padding,t)},setOuterPadding:function(t,e){return Ne(this.getSizerConfig(this).padding,t,e),this},getChildOuterPadding:function(t,e){return "string"==typeof t&&(t=this.getElement(t)),Be(this.getSizerConfig(t).padding,e)},setChildOuterPadding:function(t,e,i){return "string"==typeof t&&(t=this.getElement(t)),Ne(this.getSizerConfig(t).padding,e,i),this}},Ge=function(t){var e=this.childrenWidth,i=void 0!==this.minWidth?this.minWidth:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn("Layout width warn: ".concat(this.constructor.name,"'s minWidth (").concat(i,") < childrenWidth (").concat(e,")"))):this.layoutWarnEnable&&(i>t||e>t)&&console.warn("Layout width warn: ".concat(this.constructor.name,"'s minWidth (").concat(i,") or childrenWidth (").concat(e," > targetWidth ").concat(t,")")),t},Ue=function(t){var e=this.childrenHeight,i=void 0!==this.minHeight?this.minHeight:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn("Layout height warn: ".concat(this.constructor.name,"'s minHeight (").concat(i,") < childrenHeight (").concat(e,")"))):this.layoutWarnEnable&&(i>t||e>t)&&console.warn("Layout height warn: ".concat(this.constructor.name,"'s minHeight (").concat(i,") or childrenHeight (").concat(e,") > targetHeight (").concat(t,")")),t},Ve={getShownChildren:function(t){void 0===t&&(t=[]);for(var e,i=this.children,n=0,r=i.length;n0;){var i=e.shift();i.rexSizer&&i.rexSizer.hidden||(i!==this&&t.push(i),i.isRexContainerLite&&e.push.apply(e,v(i.children)));}return t}},Je=function(){this._childrenWidth=void 0,this._childrenHeight=void 0;for(var t,e=this.getChildrenSizers(),i=0,n=e.length;i0?-this.delay:0,this.state=this.nowTime>=0?gi:pi,this.repeatCounter=0,this}},{key:"stop",value:function(){return this.state=vi,this}},{key:"update",value:function(t,e){this.state!==vi&&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=yi)):(this.nowTime=this.duration,this.state=mi):this.nowTime>=0&&(this.state=gi));}},{key:"t",get:function(){var t;switch(this.state){case vi:case pi:case yi:t=0;break;case gi:t=this.nowTime/this.duration;break;case mi:t=1;}return di(t,0,1)},set:function(t){(t=di(t,-1,1))<0?(this.state=pi,this.nowTime=-this.delay*t):(this.state=gi,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++);}},{key:"setT",value:function(t){return this.t=t,this}},{key:"isIdle",get:function(){return this.state===vi}},{key:"isDelay",get:function(){return this.state===pi}},{key:"isCountDown",get:function(){return this.state===gi}},{key:"isRunning",get:function(){return this.state===pi||this.state===gi}},{key:"isDone",get:function(){return this.state===mi}},{key:"isOddIteration",get:function(){return 1==(1&this.repeatCounter)}},{key:"isEvenIteration",get:function(){return 0==(1&this.repeatCounter)}}]),t}(),vi=0,pi=1,gi=2,yi=3,mi=-1,ki=function(t){r(o,t);var i=l(o);function o(t,n){var r;return e(this,o),(r=i.call(this,t,n)).timer=new fi,r}return n(o,[{key:"shutdown",value:function(t){this.isShutdown||(c(s(o.prototype),"shutdown",this).call(this,t),this.timer.destroy(),this.timer=void 0);}},{key:"start",value:function(){return this.timer.start(),c(s(o.prototype),"start",this).call(this),this}},{key:"stop",value:function(){return this.timer.stop(),c(s(o.prototype),"stop",this).call(this),this}},{key:"complete",value:function(){return this.timer.stop(),c(s(o.prototype),"complete",this).call(this),this}}]),o}(li),xi=Phaser.Utils.Objects.GetValue,bi=Phaser.Utils.Objects.GetAdvancedValue,wi=Phaser.Tweens.Builders.GetEaseFunction,Si=function(t){r(o,t);var i=l(o);function o(){return e(this,o),i.apply(this,arguments)}return n(o,[{key:"resetFromJSON",value:function(t){return this.timer.resetFromJSON(xi(t,"timer")),this.setEnable(xi(t,"enable",!0)),this.setTarget(xi(t,"target",this.parent)),this.setDelay(bi(t,"delay",0)),this.setDuration(bi(t,"duration",1e3)),this.setEase(xi(t,"ease","Linear")),this.setRepeat(xi(t,"repeat",0)),this}},{key:"setEnable",value:function(t){return null==t&&(t=!0),this.enable=t,this}},{key:"setTarget",value:function(t){return void 0===t&&(t=this.parent),this.target=t,this}},{key:"setDelay",value:function(t){return this.delay=t,this}},{key:"setDuration",value:function(t){return this.duration=t,this}},{key:"setRepeat",value:function(t){return this.repeat=t,this}},{key:"setRepeatDelay",value:function(t){return this.repeatDelay=t,this}},{key:"setEase",value:function(t){return void 0===t&&(t="Linear"),this.ease=t,this.easeFn=wi(t),this}},{key:"start",value:function(){return this.timer.isRunning||c(s(o.prototype),"start",this).call(this),this}},{key:"restart",value:function(){return this.timer.stop(),this.start.apply(this,arguments),this}},{key:"stop",value:function(t){return void 0===t&&(t=!1),c(s(o.prototype),"stop",this).call(this),t&&(this.timer.setT(1),this.updateGameObject(this.target,this.timer),this.complete()),this}},{key:"update",value:function(t,e){if(!this.isRunning||!this.enable||!this.parent.active)return this;var i=this.target,n=this.timer;return n.update(t,e),n.isDelay||this.updateGameObject(i,n),this.emit("update",i,this),n.isDone&&this.complete(),this}},{key:"updateGameObject",value:function(t,e){}}]),o}(ki),Ci=Phaser.Utils.Objects.GetValue,Oi=Phaser.Utils.Objects.GetAdvancedValue,_i=Phaser.Math.Linear,Pi=function(t){r(o,t);var i=l(o);function o(t,n){var r;return e(this,o),(r=i.call(this,t,n)).scaleStart={},r.scaleEnd={},r.resetFromJSON(n),r.boot(),r}return n(o,[{key:"resetFromJSON",value:function(t){return c(s(o.prototype),"resetFromJSON",this).call(this,t),this.setMode(Ci(t,"mode",0)),this.setScaleRange(Oi(t,"start",void 0),Oi(t,"end",0)),this}},{key:"setMode",value:function(t){return "string"==typeof t&&(t=Ti[t]),this.mode=t,this}},{key:"setScaleRange",value:function(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}},{key:"start",value:function(){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),c(s(o.prototype),"start",this).call(this),this}},{key:"updateGameObject",value:function(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));}},{key:"complete",value:function(){return c(s(o.prototype),"complete",this).call(this),1===this.mode&&this.parent.destroy(),this}}]),o}(Si),Ti={stop:0,destroy:1,yoyo:2},Ei=function(t,e,i,n,r){var s,o;switch(void 0===n&&(n="Cubic"),i){case 0:case"x":s={x:0},o={x:t.scaleX};break;case 1:case"y":s={y:0},o={y:t.scaleY};break;default:s=0,o=t.scale;}var a={mode:0,start:s,end:o,duration:e,ease:n};return void 0===r?r=new Pi(t,a):r.resetFromJSON(a),r.restart(),r},Ri=function(t,e,i,n,r,s){void 0===n&&(n="Linear"),r instanceof Pi&&(s=r,r=void 0),void 0===r&&(r=!0);var o={};switch(o.mode=r?1:0,i){case 0:case"x":o.end={x:0};break;case 1:case"y":o.end={y:0};break;default:o.end=0;}return o.duration=e,o.ease=n,void 0===s?s=new Pi(t,o):s.resetFromJSON(o),s.restart(),s},Li=function(t,e){return new Promise((function(i,n){t.once(e,(function(){i();}));}))},Mi=function(t){return Li(t,"complete")},Ai=Phaser.Utils.Objects.IsPlainObject,Di=function(t,e){e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0);})),e.on("update",(function(){var e=ze.getParentSizer(t);e&&e.resetChildPositionState(t);}));},ji={popUp:function(t,e,i){if(Ai(t)){var n=t;t=n.duration,e=n.orientation,i=n.ease;}var r=void 0===this._scaleBehavior;return this._scaleBehavior=Ei(this,t,e,i,this._scaleBehavior),r&&Di(this,this._scaleBehavior),this._scaleBehavior.completeEventName="popup.complete",this},popUpPromise:function(t,e,i){return this.popUp(t,e,i),Mi(this._scaleBehavior)},scaleDownDestroy:function(t,e,i,n){if(Ai(t)){var r=t;t=r.duration,e=r.orientation,i=r.ease,n=r.destroy;}var s=void 0===this._scaleBehavior;return this._scaleBehavior=Ri(this,t,e,i,n,this._scaleBehavior),s&&Di(this,this._scaleBehavior),this._scaleBehavior.completeEventName="scaledown.complete",this},scaleDownDestroyPromise:function(t,e,i,n){return this.scaleDownDestroy(t,e,i,n),Mi(this._scaleBehavior)},scaleDown:function(t,e,i){return this.scaleDownDestroy(t,e,i,!1),this},scaleDownPromise:function(t,e,i){return this.scaleDown(t,e,i),Mi(this._scaleBehavior)},scaleYoyo:function(t,e,i,n,r){if(Ai(t)){var s=t;t=s.duration,e=s.peakValue,i=s.repeat,n=s.orientation,r=s.ease;}var o=void 0===this._scaleBehavior;return this._scaleBehavior=function(t,e,i,n,r,s,o){var a,h;switch(void 0===i&&(i=1.2),void 0===n&&(n=0),void 0===s&&(s="Cubic"),r){case 0:case"x":a={x:t.scaleX},h={x:i};break;case 1:case"y":a={y:t.scaleX},h={y:i};break;default:a=t.scaleX,h=i;}var l={mode:2,start:a,end:h,duration:e/2,ease:s,repeat:n};return void 0===o?o=new Pi(t,l):o.resetFromJSON(l),o.restart(),o}(this,t,e,i,n,r,this._scaleBehavior),o&&Di(this,this._scaleBehavior),this._scaleBehavior.completeEventName="scaleyoyo.complete",this},scaleYoyoPromise:function(t,e,i,n,r){return this.scaleYoyo(t,e,i,n,r),Mi(this._scaleBehavior)}},zi=Phaser.Utils.Objects.GetValue,Fi=Phaser.Utils.Objects.GetAdvancedValue,Ii=Phaser.Math.Linear,Wi=function(t){r(o,t);var i=l(o);function o(t,n){var r;return e(this,o),(r=i.call(this,t,n)).resetFromJSON(n),r.boot(),r}return n(o,[{key:"resetFromJSON",value:function(t){return c(s(o.prototype),"resetFromJSON",this).call(this,t),this.setMode(zi(t,"mode",0)),this.setAlphaRange(Fi(t,"start",this.parent.alpha),Fi(t,"end",0)),this}},{key:"setMode",value:function(t){return "string"==typeof t&&(t=Xi[t]),this.mode=t,this}},{key:"setAlphaRange",value:function(t,e){return this.alphaStart=t,this.alphaEnd=e,this}},{key:"start",value:function(){return this.timer.isRunning||(this.parent.setAlpha(this.alphaStart),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),c(s(o.prototype),"start",this).call(this)),this}},{key:"updateGameObject",value:function(t,e){var i=e.t;e.isOddIteration&&(i=1-i),t.alpha=Ii(this.alphaStart,this.alphaEnd,i);}},{key:"complete",value:function(){return c(s(o.prototype),"complete",this).call(this),1===this.mode&&this.parent.destroy(),this}}]),o}(Si),Xi={stop:0,destroy:1,yoyo:2},Yi=Phaser.Utils.Objects.IsPlainObject,Bi=function(t,e,i,n){var r,s;Yi(i)?(r=i.start,s=i.end):s=i,void 0===r&&(r=0),void 0===s&&(s=1);var o={mode:0,start:r,end:s,duration:e};return void 0===n?n=new Wi(t,o):n.resetFromJSON(o),n.restart(),n},Ni=function(t,e,i,n){i instanceof Wi&&(n=i,i=void 0),void 0===i&&(i=!0);var r={mode:i?1:0,end:0,duration:e};return void 0===n?n=new Wi(t,r):n.resetFromJSON(r),n.restart(),n},Hi=Phaser.Utils.Objects.IsPlainObject,Gi=function(t,e){e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0);})),e.on("update",(function(){var e=ze.getParentSizer(t);e&&e.resetChildAlphaState(t);}));},Ui={fadeIn:function(t,e){if(Hi(t)){var i=t;t=i.duration,e=i.alpha;}var n=void 0===this._fade;return this._fade=Bi(this,t,e,this._fade),n&&Gi(this,this._fade),this._fade.completeEventName="fadein.complete",this},fadeInPromise:function(t,e){return this.fadeIn(t,e),Mi(this._fade)},fadeOutDestroy:function(t,e){if(Hi(t)){var i=t;t=i.duration,e=i.destroy;}var n=void 0===this._fade;return this._fade=Ni(this,t,e,this._fade),n&&Gi(this,this._fade),this._fade.completeEventName="fadeout.complete",this},fadeOutDestroyPromise:function(t,e){return this.fadeOutDestroy(t,e),Mi(this._fade)},fadeOut:function(t){return this.fadeOutDestroy(t,!1),this},fadeOutPromise:function(t){return this.fadeOut(t),Mi(this._fade)}},Vi=Phaser.Utils.Objects.GetValue,Ji=Phaser.Utils.Objects.GetAdvancedValue,Ki=Phaser.Math.Linear,qi=function(t){r(o,t);var i=l(o);function o(t,n){var r;return e(this,o),(r=i.call(this,t,n)).resetFromJSON(n),r.boot(),r}return n(o,[{key:"resetFromJSON",value:function(t){if(c(s(o.prototype),"resetFromJSON",this).call(this,t),this.setMode(Vi(t,"mode",0)),t&&(t.hasOwnProperty("x")||t.hasOwnProperty("y"))){var e=Ji(t,"x",void 0),i=Ji(t,"y",void 0);this.setTargetPosition(e,i);}else this.setTargetPosition(t);return this}},{key:"setMode",value:function(t){return "string"==typeof t&&(t=Zi[t]),this.mode=t,this}},{key:"setTargetPosition",value:function(t,e){if("number"==typeof t||"number"==typeof e)this.startX=this.parent.x,this.startY=this.parent.y,this.endX=t,this.endY=e;else {var i=t;this.startX=Ji(i,"startX",void 0),this.startY=Ji(i,"startY",void 0),this.endX=Ji(i,"endX",void 0),this.endY=Ji(i,"endY",void 0);}return this.hasMoveX=void 0!==this.startX&&void 0!==this.endX,this.hasMoveY=void 0!==this.startY&&void 0!==this.endY,this}},{key:"start",value:function(){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),c(s(o.prototype),"start",this).call(this),this}},{key:"updateGameObject",value:function(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasMoveX&&(t.x=Ki(this.startX,this.endX,i)),this.hasMoveY&&(t.y=Ki(this.startY,this.endY,i));}},{key:"complete",value:function(){return c(s(o.prototype),"complete",this).call(this),1===this.mode&&this.parent.destroy(),this}}]),o}(Si),Zi={stop:0,destroy:1,yoyo:2},$i=function(t,e){if("number"==typeof t)return t;var i=t[0],n=parseFloat(t.substr(2));switch(i){case"+":return e+n;case"-":return e-n;case"*":return e*n;case"/":return e/n}},Qi=Phaser.Utils.Objects.IsPlainObject,tn=Phaser.Math.Distance.Between,en=function(t,e){e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0);})),e.on("update",(function(){var e=ze.getParentSizer(t);e&&e.resetChildPositionState(t);}));},nn={moveFrom:function(t,e,i,n,r){if(Qi(t)){var s=t;e=s.x,i=s.y,t=s.hasOwnProperty("speed")?1e3*tn(e,i,this.x,this.y)/s.speed:s.duration,n=s.ease;}var o=void 0===this._easeMove;return this._easeMove=function(t,e,i,n,r,s,o){s instanceof qi&&(o=s,s=void 0),void 0===s&&(s=!1);var a={};return a.mode=s?1:0,void 0!==i&&(a.startX=$i(i,t.x),a.endX=t.x),void 0!==n&&(a.startY=$i(n,t.y),a.endY=t.y),a.duration=e,a.ease=void 0===r?"Linear":r,void 0===o?o=new qi(t,a):o.resetFromJSON(a),o.restart(),o}(this,t,e,i,n,r,this._easeMove),o&&en(this,this._easeMove),this._easeMove.completeEventName="movefrom.complete",this},moveFromPromise:function(t,e,i,n,r){return this.moveFrom(t,e,i,n,r),Mi(this._easeMove)},moveFromDestroy:function(t,e,i,n){return this.moveFrom(t,e,i,n,!0),this},moveFromDestroyPromise:function(t,e,i,n){return this.moveFromDestroy(t,e,i,n),Mi(this._easeMove)},moveTo:function(t,e,i,n,r){if(Qi(t)){var s=t;e=s.x,i=s.y,t=s.hasOwnProperty("speed")?1e3*tn(e,i,this.x,this.y)/s.speed:s.duration,n=s.ease;}var o=void 0===this._easeMove;return this._easeMove=function(t,e,i,n,r,s,o){s instanceof qi&&(o=s,s=void 0),void 0===s&&(s=!1);var a={};return a.mode=s?1:0,void 0!==i&&(a.startX=t.x,a.endX=$i(i,t.x)),void 0!==n&&(a.startY=t.y,a.endY=$i(n,t.y)),a.duration=e,a.ease=void 0===r?"Linear":r,void 0===o?o=new qi(t,a):o.resetFromJSON(a),o.restart(),o}(this,t,e,i,n,r,this._easeMove),o&&en(this,this._easeMove),this._easeMove.completeEventName="moveto.complete",this},moveToPromise:function(t,e,i,n,r){return this.moveTo(t,e,i,n,r),Mi(this._easeMove)},moveToDestroy:function(t,e,i,n){return this.moveTo(t,e,i,n,!0),this},moveToDestroyPromise:function(t,e,i,n){return this.moveToDestroy(t,e,i,n,!0),Mi(this._easeMove)},moveStop:function(t){return this._easeMove?(this._easeMove.stop(t),this):this}},rn=Phaser.Utils.Objects.GetValue,sn=function(t){r(o,t);var i=l(o);function o(t,n){var r;return e(this,o),(r=i.call(this,t,n)).timer=new fi,r.resetFromJSON(n),r.boot(),r}return n(o,[{key:"resetFromJSON",value:function(t){return this.timer.resetFromJSON(rn(t,"timer")),this.setEnable(rn(t,"enable",!0)),this.setMode(rn(t,"mode",1)),this.isRunning=rn(t,"isRunning",!1),this.setMagnitudeMode(rn(t,"magnitudeMode",1)),this.setAxisMode(rn(t,"axis",0)),this.setDuration(rn(t,"duration",500)),this.setMagnitude(rn(t,"magnitude",10)),this.ox=rn(t,"ox",void 0),this.oy=rn(t,"oy",void 0),this}},{key:"toJSON",value:function(){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}}},{key:"shutdown",value:function(t){this.isShutdown||(c(s(o.prototype),"shutdown",this).call(this,t),this.timer.destroy(),this.timer=void 0);}},{key:"startTicking",value:function(){c(s(o.prototype),"startTicking",this).call(this),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);}},{key:"stopTicking",value:function(){c(s(o.prototype),"stopTicking",this).call(this),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));}},{key:"setEnable",value:function(t){return null==t&&(t=!0),this.enable=t,this}},{key:"setMode",value:function(t){return "string"==typeof t&&(t=on[t]),this.mode=t,this}},{key:"setMagnitudeMode",value:function(t){return "string"==typeof t&&(t=hn[t]),this.magnitudeMode=t,this}},{key:"setAxisMode",value:function(t){return "string"==typeof t&&(t=an[t]),this.axisMode=t,this}},{key:"setDuration",value:function(t){return this.duration=t,this}},{key:"setMagnitude",value:function(t){return this.magnitude=t,this}},{key:"start",value:function(t,e){if("number"!=typeof t){var i=t;e=rn(i,"magnitude",void 0),t=rn(i,"duration",void 0);}return void 0!==e&&this.setMagnitude(e),void 0!==t&&this.setDuration(t),this.timer.setDuration(this.duration).start(),c(s(o.prototype),"start",this).call(this),this}},{key:"shake",value:function(t,e){return this.start(t,e),this}},{key:"update",value:function(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 n=this.magnitude;1===this.magnitudeMode&&(n*=1-this.timer.t);var r=Math.random()*Math.PI*2,s=this.ox+Math.cos(r)*n,o=this.oy+Math.sin(r)*n;switch(this.axisMode){case 1:i.x=s;break;case 2:i.y=o;break;default:i.x=s,i.y=o;}}return this}},{key:"backToOrigin",value:function(){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}}]),o}(oi),on={effect:0,behavior:1},an={both:0,"h&v":0,"x&y":0,horizontal:1,h:1,x:1,vertical:2,v:2,y:2},hn={constant:0,decay:1},ln=Phaser.Utils.Objects.IsPlainObject,un={shake:function(t,e,i){if(ln(t)){var n=t;t=n.duration,e=n.magnitude,i=n.magnitudeMode;}return void 0===this._shake&&(this._shake=new sn(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:function(t,e){return this.shake(t,e),Mi(this._shake)}},cn=Phaser.Utils.Objects.GetValue,dn=Phaser.Math.Linear,fn=function(t){r(o,t);var i=l(o);function o(t,n){var r;return e(this,o),(r=i.call(this,t,n)).resetFromJSON(),r.boot(),r}return n(o,[{key:"start",value:function(t){if(this.timer.isRunning)return this;var e=this.target;this.propertyKey=cn(t,"key","value");var i=e[this.propertyKey];return this.fromValue=cn(t,"from",i),this.toValue=cn(t,"to",i),this.setEase(cn(t,"ease",this.ease)),this.setDuration(cn(t,"duration",this.duration)),this.setRepeat(cn(t,"repeat",0)),this.setDelay(cn(t,"delay",0)),this.setRepeatDelay(cn(t,"repeatDelay",0)),this.timer.setDuration(this.duration).setRepeat(this.repeat).setDelay(this.delay).setRepeatDelay(this.repeatDelay),e[this.propertyKey]=this.fromValue,c(s(o.prototype),"start",this).call(this),this}},{key:"updateGameObject",value:function(t,e){var i=e.t;i=this.easeFn(i),t[this.propertyKey]=dn(this.fromValue,this.toValue,i);}}]),o}(Si),vn=Phaser.Utils.Objects.IsPlainObject,pn=function(t){r(s,t);var i=l(s);function s(t,n){var r;return e(this,s),(r=i.call(this,t,n)).parent.setDataEnabled(),r.easeTasks={},r}return n(s,[{key:"complete",value:function(t){this.emit("complete-".concat(t),this.parent,this),this.emit("complete",t,this.parent,this);}},{key:"getEaseTask",value:function(t){var e=this.easeTasks[t];return void 0===e&&(e=new fn(this.parent),this.easeTasks[t]=e,e.setTarget(this.parent.data.values).on("complete",(function(){this.complete(t);}),this)),e}},{key:"easeTo",value:function(t,e,i,n){if(vn(t)){var r=t;t=r.key,e=r.value,i=r.duration,n=r.ease;var s=r.speed;void 0===i&&void 0!==s&&(i=Math.abs(e-this.parent.data.values[t])/s*1e3);}return void 0===i&&(i=1e3),void 0===n&&(n="Linear"),this.getEaseTask(t).restart({key:t,to:e,duration:i,ease:n}),this}},{key:"easeFrom",value:function(t,e,i,n){if(vn(t)){var r=t;t=r.key,e=r.value,i=r.duration,n=r.ease;var s=r.speed;void 0===i&&void 0!==s&&(i=Math.abs(e-this.parent.data.values[t])/s*1e3);}return void 0===i&&(i=1e3),void 0===n&&(n="Linear"),this.getEaseTask(t).restart({key:t,from:e,duration:i,ease:n}),this}},{key:"stopEase",value:function(t,e){void 0===e&&(e=!0);var i=this.easeTasks[t];return i&&i.stop(e),this}},{key:"stopAll",value:function(t){for(var e in void 0===t&&(t=!0),this.easeTasks)this.stopEase(e,t);return this}}]),s}(ni),gn={easeDataTo:function(t,e,i,n){return this._easeData||(this._easeData=new pn(this),function(t,e){e.on("complete",(function(e){t.emit("easedata.".concat(e,".complete"),t),t.emit("easedata.complete",e,t);}));}(this,this._easeData)),this._easeData.easeTo(t,e,i,n),this},easeDataToPromise:function(t,e,i,n){return this.easeDataTo(t,e,i,n),Li(this._easeData,"complete-".concat(t))},stopEaseData:function(t,e){return this._easeData?(this._easeData.stopEase(t,e),this):this},stopAllEaseData:function(t){return this._easeData?(this._easeData.stopAll(t),this):this}},yn=function(t,e){if(t){Ut(t).hidden=e;var i=O(t);i?i.setChildVisible(t,!e):t.setVisible(!e);}},mn={show:function(t){return void 0===t&&(t=this),function(t){yn(t,!1);}(t),this},hide:function(t){return void 0===t&&(t=this),function(t){yn(t,!0);}(t),this},isShow:function(t){return void 0===t&&(t=this),function(t){return !!t&&!Ut(t).hidden}(t)}};function kn(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var xn={exports:{}};!function(t){var e=Object.prototype.hasOwnProperty,i="~";function n(){}function r(t,e,i){this.fn=t,this.context=e,this.once=i||!1;}function s(t,e,n,s,o){if("function"!=typeof n)throw new TypeError("The listener must be a function");var a=new r(n,s||t,o),h=i?i+e:e;return t._events[h]?t._events[h].fn?t._events[h]=[t._events[h],a]:t._events[h].push(a):(t._events[h]=a,t._eventsCount++),t}function o(t,e){0==--t._eventsCount?t._events=new n:delete t._events[e];}function a(){this._events=new n,this._eventsCount=0;}Object.create&&(n.prototype=Object.create(null),(new n).__proto__||(i=!1)),a.prototype.eventNames=function(){var t,n,r=[];if(0===this._eventsCount)return r;for(n in t=this._events)e.call(t,n)&&r.push(i?n.slice(1):n);return Object.getOwnPropertySymbols?r.concat(Object.getOwnPropertySymbols(t)):r},a.prototype.listeners=function(t){var e=i?i+t:t,n=this._events[e];if(!n)return [];if(n.fn)return [n.fn];for(var r=0,s=n.length,o=new Array(s);r0){var e=t.runTransitionInCallback();t.delayCall(e,this.next,this);}else this.next();}},{key:"exit_TRANS_OPNE",value:function(){this.parent.removeDelayCall();}},{key:"next_OPEN",value:function(){return "TRANS_CLOSE"}},{key:"enter_OPEN",value:function(){this.parent.onOpen();}},{key:"exit_OPEN",value:function(){this.parent.removeDelayCall();}},{key:"next_TRANS_CLOSE",value:function(){return "CLOSE"}},{key:"enter_TRANS_CLOSE",value:function(){var t=this.parent;if(t.transitOutTime>0){var e=t.runTransitionOutCallback();t.delayCall(e,this.next,this);}else this.next();}},{key:"exit_TRANS_CLOSE",value:function(){this.parent.removeDelayCall();}},{key:"next_CLOSE",value:function(){return "TRANS_OPNE"}},{key:"enter_CLOSE",value:function(){this.parent.onClose();}},{key:"exit_CLOSE",value:function(){}},{key:"canOpen",value:function(){return "IDLE"===this.state||"CLOSE"===this.state}},{key:"canClose",value:function(){return "IDLE"===this.state||"OPEN"===this.state}}]),s}(Tn),Rn={delayCall:function(t,e,i){return this.delayCallTimer=function(t,e,i,n,r){var s=$e(t);return s.time.delayedCall(e,(function(){s.game.events.once("poststep",(function(){i.call(n,r);}));}))}(this,t,e,i),this},removeDelayCall:function(){return this.delayCallTimer&&(this.delayCallTimer.remove(!1),this.delayCallTimer=void 0),this}},Ln={setTransitInTime:function(t){return this.transitInTime=t,this},setTransitOutTime:function(t){return this.transitOutTime=t,this},setTransitInCallback:function(t){return t||(t=Qt),this.transitInCallback=t,this},setTransitOutCallback:function(t){return t||(t=Qt),this.transitOutCallback=t,this}},Mn={runTransitionInCallback:function(){return this.transitInCallback(this.parent,this.transitInTime),this.transitInTime},onOpen:function(){},requestOpen:function(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}},An={runTransitionOutCallback:function(){return this.transitOutCallback(this.parent,this.transitOutTime),this.transitOutTime},onClose:function(){this.oneShotMode&&this.parent.destroy();},requestClose:function(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}},Dn={};Object.assign(Dn,Rn,Ln,Mn,An);var jn=Phaser.Utils.Objects.GetValue,zn=function(t){r(o,t);var i=l(o);function o(t,n){var r;return e(this,o),(r=i.call(this,t,n)).setTransitInTime(jn(n,"duration.in",200)),r.setTransitOutTime(jn(n,"duration.out",200)),r.setTransitInCallback(jn(n,"transitIn")),r.setTransitOutCallback(jn(n,"transitOut")),r.oneShotMode=jn(n,"destroy",!1),r.delayCallTimer=void 0,r._state=new En(a(r),{eventEmitter:!1,initState:jn(n,"initState","IDLE")}),r.openEventData=void 0,r.closeEventData=void 0,r}return n(o,[{key:"state",get:function(){return this._state.state}},{key:"shutdown",value:function(t){this.isShutdown||(this.transitInCallback=void 0,this.transitOutCallback=void 0,this.openEventData=void 0,this.closeEventData=void 0,this.removeDelayCall(),c(s(o.prototype),"shutdown",this).call(this,t));}}]),o}(ni);Object.assign(zn.prototype,Dn);var Fn=function(t){r(o,t);var i=l(o);function o(t,n,r){var s;return e(this,o),(s=i.call(this,t,0,0,2,2,n,1)).setAlpha(r),s.setScrollFactor(0),s.boot(),s}return n(o,[{key:"boot",value:function(){this.scene.sys.events.on("prerender",this.resize,this);}},{key:"destroy",value:function(t){this.scene&&!this.ignoreDestroy&&(this.scene.sys.events.off("prerender",this.resize,this),c(s(o.prototype),"destroy",this).call(this,t));}},{key:"tint",get:function(){return this.fillColor},set:function(t){this.setFillStyle(t,this.fillAlpha);}},{key:"resize",value:function(){var t=this.scene,e=t.sys.scale.gameSize,i=t.sys.cameras.main,n=e.width,r=e.height,s=1/i.zoom,o=n/2,a=r/2,h=n*s,l=r*s;this.x===o&&this.y===a||this.setPosition(o,a),this.width===h&&this.height===l||this.setSize(h,l).setOrigin(.5);}}]),o}(Phaser.GameObjects.Rectangle),In=Phaser.Utils.Objects.GetValue,Wn=function(t){r(s,t);var i=l(s);function s(t,n){var r;return e(this,s),(r=i.call(this,t,{eventEmitter:!1})).resetFromJSON(n),r.boot(),r}return n(s,[{key:"resetFromJSON",value:function(t){return this.setHitAreaMode(In(t,"hitAreaMode",0)),this.setEnable(In(t,"enable",!0)),this.setStopMode(In(t,"stopAllLevels",!0)),this}},{key:"boot",value:function(){this.parent.on("pointerdown",(function(t,e,i,n){this.stopAllLevels&&n.stopPropagation();}),this).on("pointerup",(function(t,e,i,n){this.stopAllLevels&&n.stopPropagation();}),this).on("pointermove",(function(t,e,i,n){this.stopAllLevels&&n.stopPropagation();}),this).on("pointerover",(function(t,e,i,n){this.stopAllLevels&&n.stopPropagation();}),this).on("pointerout",(function(t,e){this.stopAllLevels&&e.stopPropagation();}),this);}},{key:"setHitAreaMode",value:function(t){"string"==typeof t&&(t=Xn[t]);var e=this.parent;return e.input&&e.removeInteractive(),0===t?e.setInteractive():e.setInteractive({hitArea:{},hitAreaCallback:function(){return !0}}),this}},{key:"setEnable",value:function(t){return void 0===t&&(t=!0),t?this.parent.setInteractive():this.parent.disableInteractive(),this.enable=t,this}},{key:"setStopMode",value:function(t){return void 0===t&&(t=!0),this.stopAllLevels=t,this}},{key:"toggleEnable",value:function(){return this.setEnable(!this.enable),this}}]),s}(ni),Xn={default:0,fullWindow:1},Yn=Phaser.Utils.Objects.GetValue,Bn=function(t){r(s,t);var i=l(s);function s(t,n){var r;e(this,s);var o=Yn(n,"color",0),h=Yn(n,"alpha",.8);return (r=i.call(this,t,o,h)).touchEventStop=new Wn(a(r),{hitAreaMode:1}),r}return n(s)}(Fn),Nn=function(t,e){void 0!==t._modalScaleSave?(t.scaleX=t._modalScaleSave,t.scaleY=t._modalScaleSave):t._modalScaleSave=t.scaleX,Ei(t,e);},Hn=function(t,e){Ri(t,e,void 0,void 0,!1);},Gn=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Bi(t,e);},Un=function(t,e){Ni(t,e,!1);},Vn=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Bi(t,e,t.alpha);},Jn=function(t,e){Ni(t,e,!1);},Kn=function(t,e,i,n,r){return !!t&&(!(n&&!n(t,e,i))&&(!!xt(t,!0).contains(e,i)&&!(r&&!r(t,e,i))))},qn=Phaser.Utils.Objects.GetValue,Zn=function(t){r(o,t);var i=l(o);function o(t,n){var r;e(this,o),void 0===n&&(n={}),null==n.transitIn&&(n.transitIn=$n.popUp),null==n.transitOut&&(n.transitOut=$n.scaleDown),n.destroy=qn(n,"destroy",!0),r=i.call(this,t,n);var s=qn(n,"cover");r.cover=!1!==s?function(t,e){var i=t.scene,n=new Bn(i,e);return i.add.existing(n),t.isRexContainerLite?(t.pin(n,{syncPosition:!1,syncRotation:!1,syncScale:!1,syncAlpha:!1,syncScrollFactor:!1}),t.moveDepthBelow(n)):i.children.moveBelow(n,t),n}(t,s):void 0,r.cover&&(r.setCoverTransitInCallback(qn(s,"transitIn",Vn)),r.setCoverTransitOutCallback(qn(s,"transitOut",Jn)));var h=qn(n,"touchOutsideClose",!1),l=qn(n,"duration.hold",-1),u=qn(n,"timeOutClose",l>=0),c=qn(n,"anyTouchClose",!1);return qn(n,"manualClose",!1)&&(h=!1,c=!1,u=!1),c&&(h=!1),u?r.setDisplayTime(l):r.setDisplayTime(-1),c?r.once("open",r.anyTouchClose,a(r)):h&&r.once("open",r.touchOutsideClose,a(r)),qn(n,"openOnStart",!0)&&r.delayCall(0,r.requestOpen,a(r)),r}return n(o,[{key:"shutdown",value:function(t){this.isShutdown||(this.cover||this.scene.input.off("pointerup",this.touchCloseCallback,this),this.cover&&!t&&(this.cover.destroy(),this.cover=void 0),c(s(o.prototype),"shutdown",this).call(this,t));}},{key:"touchOutsideClose",value:function(){return this.cover?this.cover.on("pointerup",this.touchCloseCallback,this):this.scene.input.on("pointerup",this.touchCloseCallback,this),this.clickOutsideTest=!0,this}},{key:"anyTouchClose",value:function(){return this.cover?this.cover.once("pointerup",this.touchCloseCallback,this):this.scene.input.once("pointerup",this.touchCloseCallback,this),this}},{key:"touchCloseCallback",value:function(t){this.clickOutsideTest&&Kn(this.parent,t.worldX,t.worldY)||this.requestClose();}},{key:"runTransitionInCallback",value:function(){var t=c(s(o.prototype),"runTransitionInCallback",this).call(this),e=this.cover;return e&&this.coverTransitInCallback&&this.coverTransitInCallback(e,t),t}},{key:"runTransitionOutCallback",value:function(){var t=c(s(o.prototype),"runTransitionOutCallback",this).call(this),e=this.cover;return e&&this.coverTransitOutCallback&&this.coverTransitOutCallback(e,t),t}},{key:"onOpen",value:function(){var t=this.displayTime;t>=0&&this.delayCall(t,this.requestClose,this),this.emit("open",this.parent,this),c(s(o.prototype),"onOpen",this).call(this);}},{key:"onClose",value:function(){this.emit("close",this.closeEventData),c(s(o.prototype),"onClose",this).call(this);}},{key:"setDisplayTime",value:function(t){return this.displayTime=t,this}},{key:"setTransitInCallback",value:function(t){switch("string"==typeof t&&(t=$n[t]),t){case $n.popUp:t=Nn;break;case $n.fadeIn:t=Gn;}return c(s(o.prototype),"setTransitInCallback",this).call(this,t),this}},{key:"setTransitOutCallback",value:function(t){switch("string"==typeof t&&(t=$n[t]),t){case $n.scaleDown:t=Hn;break;case $n.fadeOut:t=Un;}return c(s(o.prototype),"setTransitOutCallback",this).call(this,t),this}},{key:"setCoverTransitInCallback",value:function(t){return this.coverTransitInCallback=t,this}},{key:"setCoverTransitOutCallback",value:function(t){return this.coverTransitOutCallback=t,this}}]),o}(zn),$n={popUp:0,fadeIn:1,scaleDown:0,fadeOut:1},Qn=function(t){return t&&"function"==typeof t},tr={modal:function(t,e){return Qn(t)&&(e=t,t=void 0),void 0===this._modalBehavior&&(this.onCreateModalBehavior&&this.onCreateModalBehavior(this,t),this._modalBehavior=function(t,e){var i=new Zn(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:function(t){var e=this;return new Promise((function(i,n){e.modal(t,i);}))},modalClose:function(t){return function(t,e){t.emit("modal.requestClose",e);}(this,t),this}},er=function(t,e,i,n){if(e)return Kn(t,e.worldX,e.worldY,i,n);for(var r=t.scene.input.manager,s=r.pointersTotal,o=r.pointers,a=0;a=this.dragThreshold&&this.cancel();}},{key:"click",value:function(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 n=this.lastClickTime;return void 0!==n&&t-n<=this.clickInterval||(this.lastClickTime=t,this.emit("click",this,this.parent,e,i)),this}},{key:"cancel",value:function(){return this.pointer=void 0,this}},{key:"onOver",value:function(t,e,i,n){return this.enable?(this.emit("over",this,this.parent,t,n),this):this}},{key:"onOut",value:function(t,e){return this.enable?(this.emit("out",this,this.parent,t,e),this):this}}]),o}(ni),pr={press:0,pointerdown:0,release:1,pointerup:1},gr={onClick:function(t,e,i,n){return t?("function"==typeof t&&(n=i,i=e,e=t,t=this),void 0===t._click&&(t._click=new vr(t,n)),t._click.on("click",e,i),this):this},offClick:function(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:function(e,i){return e&&"object"!==t(e)&&(i=e,e=this),void 0===e._click||e._click.setEnable(i),this},disableClick:function(e){return e&&"object"!==t(e)&&(e=this),void 0===e._click||e._click.setEnable(!1),this}},yr=function(t,e,i,n){if(e)return !(i&&!i(t,e))&&(!!mr(t,e)&&!(n&&!n(t,e)));for(var r=t.scene.input.manager,s=r.pointersTotal,o=r.pointers,a=0;a0)return kr.length=0,!0;return kr.length=0,!1},kr=[],xr=Phaser.Utils.Objects.GetValue,br=function(t){r(o,t);var i=l(o);function o(t,n){var r;e(this,o),(r=i.call(this,t,n))._enable=void 0;var s=xr(n,"inputConfig",void 0);return s&&t.setInteractive(s),r.resetFromJSON(n),r.boot(),r}return n(o,[{key:"resetFromJSON",value:function(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}},{key:"boot",value:function(){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);}},{key:"shutdown",value:function(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,c(s(o.prototype),"shutdown",this).call(this,t);}}},{key:"enable",get:function(){return this._enable},set:function(t){if(this._enable!==t){t||this.cancel(),this._enable=t;var e=t?"enable":"disable";this.emit(e,this,this.parent);}}},{key:"setEnable",value:function(t){return void 0===t&&(t=!0),this.enable=t,this}},{key:"toggleEnable",value:function(){return this.setEnable(!this.enable),this}},{key:"setMode",value:function(t){return "string"==typeof t&&(t=wr[t]),this.mode=t,this}},{key:"setClickInterval",value:function(t){return this.clickInterval=t,this}},{key:"setDragThreshold",value:function(t){return this.dragThreshold=t,this}},{key:"isPointerInside",value:function(t){var e=this.parent;return (e.input?yr:er)(e,t)}},{key:"onPress",value:function(t){this.parent.willRender(t.camera)&&void 0===this.pointer&&(this.pointer=t,0===this.mode&&(this.isPointerInside(t)||this.click(t.downTime,t)));}},{key:"onRelease",value:function(t){this.parent.willRender(t.camera)&&this.pointer===t&&(1===this.mode&&(this.isPointerInside(t)||this.click(t.upTime,t)),this.pointer=void 0);}},{key:"onMove",value:function(t,e,i,n){this.pointer===t&&void 0!==this.dragThreshold&&1===this.mode&&(t.getDistance()>=this.dragThreshold||this.isPointerInside(t))&&this.cancel();}},{key:"click",value:function(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}},{key:"cancel",value:function(){return this.pointer=void 0,this}}]),o}(ni),wr={press:0,pointerdown:0,release:1,pointerup:1},Sr={onClickOutside:function(t,e,i,n){return t?("function"==typeof t&&(n=i,i=e,e=t,t=this),void 0===t._clickOutside&&(t._clickOutside=new br(t,n)),t._clickOutside.on("clickoutside",e,i),this):this},offClickOutside:function(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:function(e,i){return e&&"object"!==t(e)&&(i=e,e=this),void 0===e._clickOutside||e._clickOutside.setEnable(i),this},disableClickOutside:function(e){return e&&"object"!==t(e)&&(e=this),void 0===e._clickOutside||e._clickOutside.setEnable(!1),this}},Cr=function(t){r(s,t);var i=l(s);function s(){var t;return e(this,s),(t=i.call(this,{eventEmitter:!1})).goto("IDLE"),t}return n(s,[{key:"setCooldownTime",value:function(t){return this.cooldownTime=t,this.cooldownMode=void 0!==t,this}},{key:"request",value:function(){return this.runMethod("request")}},{key:"update_IDLE",value:function(){this.compensationTime=0;}},{key:"request_IDLE",value:function(){return this.next(),!0}},{key:"next_IDLE",value:function(){if(this.cooldownMode)return "COOLDOWN"}},{key:"enter_COOLDOWN",value:function(){this.remainderTime=this.cooldownTime+this.compensationTime;}},{key:"update_COOLDOWN",value:function(t,e){this.remainderTime-=e,this.remainderTime<0&&(this.compensationTime=this.cooldownTime>e?-this.remainderTime:0,this.goto("IDLE"));}},{key:"request_COOLDOWN",value:function(){return !1}}]),s}(Tn),Or=Phaser.Utils.Objects.GetValue,_r=function(t){r(o,t);var i=l(o);function o(t,n){var r;return e(this,o),(r=i.call(this,t,n))._enable=void 0,r.cooldown=new Cr,r.parent.setInteractive(Or(n,"inputConfig",void 0)),r.resetFromJSON(n),r.boot(),r}return n(o,[{key:"resetFromJSON",value:function(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}},{key:"boot",value:function(){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);}},{key:"shutdown",value:function(t){this.isShutdown||(this.scene.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,c(s(o.prototype),"shutdown",this).call(this,t));}},{key:"enable",get:function(){return this._enable},set:function(t){if(this._enable!==t)return t||(this.prevIsInTouch=!1,this.isInTouching=!1,this.pointer=void 0),this._enable=t,this}},{key:"setEnable",value:function(t){return void 0===t&&(t=!0),this.enable=t,this}},{key:"cooldownTime",get:function(){return this.cooldown.cooldownTime},set:function(t){this.cooldown.setCooldownTime(t);}},{key:"setCooldown",value:function(t){return this.cooldownTime=t,this}},{key:"toggleEnable",value:function(){return this.setEnable(!this.enable),this}},{key:"onPointIn",value:function(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.pointer=t,this.isInTouching=!0);}},{key:"onPointOut",value:function(t){this.enable&&this.pointer===t&&(this.pointer=void 0,this.isInTouching=!1);}},{key:"preupdate",value:function(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;}}]),o}(ni),Pr={isPointerInBounds:function(t){return void 0===t?t=this:"string"==typeof t&&(t=this.getElement(t)),!!t&&er(t)},onTouching:function(t,e,i,n){return t?("function"==typeof t&&(n=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new _r(t,n)),t._inTouching.on("intouch",e,i),this):this},offTouching:function(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:function(t,e,i,n){return t?("function"==typeof t&&(n=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new _r(t,n)),t._inTouching.on("touchend",e,i),this):this},offTouchingEnd:function(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:function(e,i){return e&&"object"!==t(e)&&(i=e,e=this),void 0===e._inTouching||e._inTouching.setEnable(i),this},disableTouching:function(e){return e&&"object"!==t(e)&&(e=this),void 0===e._inTouching||e._inTouching.setEnable(!1),this}},Tr=function(t,e,i){for(var n,r=0,s=t.length;r0),this.onDragStart()));}},{key:"onPointerUp",value:function(t){this.enable&&((!this.bounds||this.bounds.contains(t.x,t.y))&&this.pointer===t&&(this.pointer=void 0,this.movedState=!1,this.tracerState=Hr,this.onDragEnd()));}},{key:"onPointerMove",value:function(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()));}}},{key:"dragCancel",value:function(){return this.tracerState===Gr&&this.onDragEnd(),this.pointer=void 0,this.tracerState=Hr,this}},{key:"onDragStart",value:function(){this.emit("dragstart",this);}},{key:"onDragEnd",value:function(){this.emit("dragend",this);}},{key:"onDrag",value:function(){this.emit("drag",this);}},{key:"preUpdate",value:function(t,e){}},{key:"postUpdate",value:function(t,e){}},{key:"startTicking",value:function(){c(s(o.prototype),"startTicking",this).call(this),this.scene.sys.events.on("preupdate",this.preUpdate,this),this.scene.sys.events.on("postupdate",this.postUpdate,this);}},{key:"stopTicking",value:function(){c(s(o.prototype),"stopTicking",this).call(this),this.scene&&(this.scene.sys.events.off("preupdate",this.preUpdate,this),this.scene.sys.events.off("postupdate",this.postUpdate,this));}},{key:"setRecongizedStateObject",value:function(t){return this.recongizedState=t,this}},{key:"state",get:function(){return this.recongizedState.state},set:function(t){this.recongizedState.state=t;}},{key:"cancel",value:function(){return this.state=Ur,this}}]),o}(oi),Hr=0,Gr=1,Ur="IDLE",Vr=Phaser.Utils.Objects.GetValue,Jr=Phaser.Math.Distance.Between,Kr=function(t){r(o,t);var i=l(o);function o(t,n){var r;e(this,o);var s=a(r=i.call(this,t,n)),h={states:{IDLE:{enter:function(){s.stop(),s.tapsCount=0,s.x=0,s.y=0,s.worldX=0,s.worldY=0;},exit:function(){var t=s.lastPointer;s.x=t.x,s.y=t.y,s.worldX=t.worldX,s.worldY=t.worldY;}},BEGIN:{enter:function(){s.start(),s.tapsCount=0,s.emit("tappingstart",s,s.gameObject,s.lastPointer);}},RECOGNIZED:{enter:function(){s.start(),s.emit("tap",s,s.gameObject,s.lastPointer),s.emit("".concat(s.tapsCount,"tap"),s,s.gameObject,s.lastPointer);}}},init:function(){this.state=qr;},eventEmitter:!1};return r.setRecongizedStateObject(new Tn(h)),r}return n(o,[{key:"resetFromJSON",value:function(t){c(s(o.prototype),"resetFromJSON",this).call(this,t),this.setHoldTime(Vr(t,"time",250)),this.setTapInterval(Vr(t,"tapInterval",200)),this.setDragThreshold(Vr(t,"threshold",9)),this.setTapOffset(Vr(t,"tapOffset",10));var e=Vr(t,"taps",void 0);return void 0!==e?this.setTaps(e):(this.setMaxTaps(Vr(t,"maxTaps",void 0)),this.setMinTaps(Vr(t,"minTaps",void 0))),this}},{key:"onDragStart",value:function(){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=$r,this.state=Zr);break;case $r:this.state=Zr;}}},{key:"onDragEnd",value:function(){this.state===Zr&&(this.tapsCount++,this.emit("tapping",this,this.gameObject,this.lastPointer),void 0!==this.maxTaps&&this.tapsCount===this.maxTaps&&(this.state=$r));}},{key:"onDrag",value:function(){this.state!==qr&&this.pointer.getDistance()>this.dragThreshold&&(this.state=qr);}},{key:"preUpdate",value:function(t,e){if(this.isRunning&&this.enable&&this.state===Zr){var i=this.lastPointer;if(i.isDown)t-i.downTime>this.holdTime&&(this.state=qr);else t-i.upTime>this.tapInterval&&(void 0===this.minTaps||this.tapsCount>=this.minTaps?this.state=$r:this.state=qr);}}},{key:"postUpdate",value:function(t,e){this.isRunning&&this.enable&&this.state===$r&&(this.state=qr);}},{key:"isTapped",get:function(){return this.state===$r}},{key:"setHoldTime",value:function(t){return this.holdTime=t,this}},{key:"setTapInterval",value:function(t){return this.tapInterval=t,this}},{key:"setDragThreshold",value:function(t){return this.dragThreshold=t,this}},{key:"setTapOffset",value:function(t){return this.tapOffset=t,this}},{key:"setMaxTaps",value:function(t){return this.maxTaps=t,this}},{key:"setMinTaps",value:function(t){return this.minTaps=t,this}},{key:"setTaps",value:function(t,e){return void 0===e&&(e=t),this.setMinTaps(t).setMaxTaps(e),this}}]),o}(Nr),qr="IDLE",Zr="BEGIN",$r="RECOGNIZED",Qr=Phaser.Utils.Objects.GetValue,ts=function(t){r(o,t);var i=l(o);function o(t,n){var r;e(this,o);var s=a(r=i.call(this,t,n)),h={states:{IDLE:{enter:function(){s.x=0,s.y=0,s.worldX=0,s.worldY=0;},exit:function(){var t=s.lastPointer;s.x=t.x,s.y=t.y,s.worldX=t.worldX,s.worldY=t.worldY;}},BEGIN:{enter:function(){s.start();},exit:function(){s.stop();}},RECOGNIZED:{enter:function(){s.emit("pressstart",s,s.gameObject,s.lastPointer);},exit:function(){s.emit("pressend",s,s.gameObject,s.lastPointer);}}},init:function(){this.state=es;},eventEmitter:!1};return r.setRecongizedStateObject(new Tn(h)),r}return n(o,[{key:"resetFromJSON",value:function(t){return c(s(o.prototype),"resetFromJSON",this).call(this,t),this.setDragThreshold(Qr(t,"threshold",9)),this.setHoldTime(Qr(t,"time",251)),this}},{key:"onDragStart",value:function(){this.state=is,0===this.holdTime&&(this.state=ns);}},{key:"onDragEnd",value:function(){this.state=es;}},{key:"onDrag",value:function(){this.state!==es&&this.pointer.getDistance()>this.dragThreshold&&(this.state=es);}},{key:"preUpdate",value:function(t,e){this.isRunning&&this.enable&&(this.state===is&&t-this.pointer.downTime>=this.holdTime&&(this.state=ns));}},{key:"isPressed",get:function(){return this.state===ns}},{key:"setHoldTime",value:function(t){return this.holdTime=t,this}},{key:"setDragThreshold",value:function(t){return this.dragThreshold=t,this}}]),o}(Nr),es="IDLE",is="BEGIN",ns="RECOGNIZED";Phaser.Utils.Objects.GetValue;var rs=Phaser.Math.Distance.Between,ss=Phaser.Math.Angle.Between,os={getDt:function(){var t;return t=this.scene,ei(t).loop.delta},getVelocity:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return rs(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 ss(e.x,e.y,t.x,t.y)}},as={"up&down":0,"left&right":1,"4dir":2,"8dir":3},hs={},ls=Phaser.Utils.Objects.GetValue,us=Phaser.Math.RadToDeg,cs=function(t){r(o,t);var i=l(o);function o(t,n){var r;e(this,o);var s=a(r=i.call(this,t,n)),h={states:{IDLE:{enter:function(){s.x=0,s.y=0,s.worldX=0,s.worldY=0;},exit:function(){var t=s.lastPointer;s.x=t.x,s.y=t.y,s.worldX=t.worldX,s.worldY=t.worldY;}},BEGIN:{enter:function(){s.validDrag=!1;}},RECOGNIZED:{enter:function(){s.start(),s.updateDirectionStates(),s.emit("swipe",s,s.gameObject,s.lastPointer);},exit:function(){s.stop(),s.clearDirectionStates();}}},init:function(){this.state=ds;},eventEmitter:!1};return r.setRecongizedStateObject(new Tn(h)),r.clearDirectionStates(),r}return n(o,[{key:"resetFromJSON",value:function(t){return c(s(o.prototype),"resetFromJSON",this).call(this,t),this.setDragThreshold(ls(t,"threshold",10)),this.setVelocityThreshold(ls(t,"velocityThreshold",1e3)),this.setDirectionMode(ls(t,"dir","8dir")),this}},{key:"onDragStart",value:function(){this.state=fs;}},{key:"onDragEnd",value:function(){this.state=ds;}},{key:"onDrag",value:function(){this.state===fs&&(this.validDrag||(this.validDrag=0===this.dragThreshold||this.pointer.getDistance()>=this.dragThreshold),this.validDrag&&this.dragVelocity>this.velocityThreshold&&(this.state=vs));}},{key:"postUpdate",value:function(t,e){this.isRunning&&this.enable&&this.state===vs&&(this.state=ds);}},{key:"isSwiped",get:function(){return this.state===vs}},{key:"dragVelocity",get:function(){var t;switch(this.dirMode){case 0:t=this.getVelocityY();break;case 1:t=this.getVelocityX();break;default:t=this.getVelocity();}return t}},{key:"setDragThreshold",value:function(t){return this.dragThreshold=t,this}},{key:"setVelocityThreshold",value:function(t){return this.velocityThreshold=t,this}},{key:"setDirectionMode",value:function(t){return "string"==typeof t&&(t=as[t]),this.dirMode=t,this}},{key:"updateDirectionStates",value:function(){return function(t,e,i){switch(void 0===i?i={}:!0===i&&(i=hs),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;}}(us(this.getVelocityAngle()),this.dirMode,this),this}},{key:"clearDirectionStates",value:function(){return this.left=!1,this.right=!1,this.up=!1,this.down=!1,this}}]),o}(Nr);Object.assign(cs.prototype,os);var ds="IDLE",fs="BEGIN",vs="RECOGNIZED",ps=Phaser.Utils.Objects.GetValue,gs=Phaser.Utils.Array.SpliceOne,ys=Phaser.Math.Distance.Between,ms=Phaser.Math.Angle.Between,ks=function(){function t(i,n){e(this,t);var r=i.input.manager.pointersTotal-1;r<2&&i.input.addPointer(2-r),this.scene=i,this.setEventEmitter(ps(n,"eventEmitter",void 0)),this._enable=void 0,this.pointers=[],this.movedState={},this.resetFromJSON(n),this.boot();}return n(t,[{key:"resetFromJSON",value:function(t){return this.setEnable(ps(t,"enable",!0)),this.bounds=ps(t,"bounds",void 0),this.tracerState=bs,this.pointers.length=0,Rt(this.movedState),this}},{key:"boot",value:function(){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);}},{key:"shutdown",value:function(){this.scene&&(this.destroyEventEmitter(),this.pointers.length=0,Rt(this.movedState),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);}},{key:"destroy",value:function(){this.shutdown();}},{key:"enable",get:function(){return this._enable},set:function(t){if(this._enable!==t)return t||this.dragCancel(),this._enable=t,this}},{key:"setEnable",value:function(t){return void 0===t&&(t=!0),this.enable=t,this}},{key:"toggleEnable",value:function(){return this.setEnable(!this.enable),this}},{key:"onPointerDown",value:function(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.tracerState){case bs:this.tracerState=ws,this.onDrag1Start();break;case ws:this.tracerState=Ss,this.onDrag2Start();}}},{key:"onPointerUp",value:function(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],gs(this.pointers,e),this.tracerState){case ws:this.tracerState=bs,this.onDrag1End();break;case Ss:this.tracerState=ws,this.onDrag2End(),this.onDrag1Start();}}}},{key:"onPointerMove",value:function(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 ws:this.onDrag1();break;case Ss:this.onDrag2();}}}},{key:"dragCancel",value:function(){return this.tracerState===Ss&&this.onDrag2End(),this.pointers.length=0,Rt(this.movedState),this.tracerState=bs,this}},{key:"onDrag1Start",value:function(){this.emit("drag1start",this);}},{key:"onDrag1End",value:function(){this.emit("drag1end",this);}},{key:"onDrag1",value:function(){this.emit("drag1",this);}},{key:"onDrag2Start",value:function(){this.emit("drag2start",this);}},{key:"onDrag2End",value:function(){this.emit("drag2end",this);}},{key:"onDrag2",value:function(){this.emit("drag2",this);}},{key:"distanceBetween",get:function(){if(this.tracerState!==Ss)return 0;var t=this.pointers[0],e=this.pointers[1];return ys(t.x,t.y,e.x,e.y)}},{key:"angleBetween",get:function(){if(this.tracerState!==Ss)return 0;var t=this.pointers[0],e=this.pointers[1];return ms(t.x,t.y,e.x,e.y)}},{key:"drag1Vector",get:function(){var t=this.pointers[0];if(t&&this.movedState[t.id]){var e=t.position,i=t.prevPosition;xs.x=e.x-i.x,xs.y=e.y-i.y;}else xs.x=0,xs.y=0;return xs}},{key:"centerX",get:function(){if(this.tracerState!==Ss)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return (t.x+e.x)/2}},{key:"centerY",get:function(){if(this.tracerState!==Ss)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return (t.y+e.y)/2}},{key:"prevCenterX",get:function(){if(this.tracerState!==Ss)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}},{key:"prevCenterY",get:function(){if(this.tracerState!==Ss)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}},{key:"movementCenterX",get:function(){return this.centerX-this.prevCenterX}},{key:"movementCenterY",get:function(){return this.centerY-this.prevCenterY}},{key:"setRecongizedStateObject",value:function(t){return this.recongizedState=t,this}},{key:"state",get:function(){return this.recongizedState.state},set:function(t){this.recongizedState.state=t;}},{key:"cancel",value:function(){return this.state=Cs,this}}]),t}();Object.assign(ks.prototype,Ke);var xs={},bs=0,ws=1,Ss=2,Cs="IDLE";Phaser.Utils.Objects.GetValue;var Os=Phaser.Math.RotateAround,_s=function(t,e,i,n){return Os(t,e,i,n),t.rotation+=n,t},Ps={},Ts=Phaser.Utils.Objects.GetValue,Es=Phaser.Math.Angle.WrapDegrees,Rs=Phaser.Math.Angle.ShortestBetween,Ls=Phaser.Math.RadToDeg,Ms=Phaser.Math.DegToRad,As=function(t){r(o,t);var i=l(o);function o(t,n){var r;e(this,o);var s=a(r=i.call(this,t,n)),h={states:{IDLE:{enter:function(){s.prevAngle=void 0,s.angle=0;}},BEGIN:{},RECOGNIZED:{enter:function(){s.emit("rotatestart",s);},exit:function(){s.emit("rotateend",s);}}},init:function(){this.state=js;},eventEmitter:!1};return r.setRecongizedStateObject(new Tn(h)),r}return n(o,[{key:"resetFromJSON",value:function(t){return c(s(o.prototype),"resetFromJSON",this).call(this,t),this.setDragThreshold(Ts(t,"threshold",0)),this}},{key:"onDrag2Start",value:function(){this.prevAngle=Es(Ls(this.angleBetween)),this.state=zs,0===this.dragThreshold&&(this.state=Fs);}},{key:"onDrag2End",value:function(){this.state=js;}},{key:"onDrag2",value:function(){switch(this.state){case zs:if(this.pointers[0].getDistance()>=this.dragThreshold&&this.pointers[1].getDistance()>=this.dragThreshold){var t=Es(Ls(this.angleBetween));this.angle=Rs(this.prevAngle,t),this.prevAngle=t,this.state=Fs;}break;case Fs:t=Es(Ls(this.angleBetween));this.angle=Rs(this.prevAngle,t),this.prevAngle=t,this.emit("rotate",this);}}},{key:"isRotated",get:function(){return this.state===Fs}},{key:"rotation",get:function(){return Ms(this.angle)}},{key:"setDragThreshold",value:function(t){return this.dragThreshold=t,this}}]),o}(ks),Ds={spinObject:function(t,e){if(!this.isRotation)return this;void 0===e&&(e=this.pointers[0].camera);var i=this.movementCenterX,n=this.movementCenterY,r=function(t,e,i,n){return void 0===n?n={}:!0===n&&(n=Ps),i.getWorldPoint(t,e,n),n}(this.centerX,this.centerY,e,!0),s=r.x,o=r.y,a=this.rotation;if(Array.isArray(t))for(var h=t,l=0,u=h.length;l=this.sizerChildren.length?this.sizerChildren.push(e):this.sizerChildren.splice(a,0,e),e.isRexSizer||(i>0&&(0===this.orientation?e.minWidth=void 0===h?pt(e):h:e.minHeight=void 0===l?gt(e):l),s&&(0===this.orientation?e.minHeight=l:e.minWidth=h)),void 0!==o&&this.addChildrenMap(o,e),this},ro={add:no,addSpace:function(t){return this.insertSpace(void 0,t),this},insertSpace:function(t,e){return void 0===e&&(e=1),no.call(this,new Zs(this.scene),{proportion:e,minWidth:0,minHeight:0,index:t}),this},insert:function(t,e,i,n,r,s,o,a){return Qs(i)&&(i.index=t),no.call(this,e,i,n,r,s,o,t,a),this},insertAtPosition:function(t,e,i,n,r,s,o,a,h){var l=$s.call(this,t,e);return -1===l&&(l=void 0),this.insert(l,i,n,r,s,o,a,h),this}},so=Gt.prototype.clear,oo=function(t){this.backgroundChildren&&(this.backgroundChildren.length=0);var e,i=!t&&this.sizerEventsEnable;if(i&&(e=this.getChildren([])),so.call(this,t),i)for(var n,r=0,s=e.length;r=0;e--)this.remove(this.sizerChildren[e],t);return this},clear:function(t){return this.sizerChildren.length=0,oo.call(this,t),this}},lo={getChildAlign:function(t){return this.getSizerConfig(t).align},setChildAlign:function(t,e){return "string"==typeof e&&(e=$t[e]),this.getSizerConfig(t).align=e,this}},uo={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,n,r=0,s=this.sizerChildren;if(0===this.orientation)for(var o=this.space.item,a=!0,h=0,l=s.length;h0&&this.proportionLength>0&&(i=n.proportion*this.proportionLength):n.expand&&(i=e-this.space.left-this.space.right-r.left-r.right);return i},getExpandedChildHeight:function(t,e){var i;void 0===e&&(e=this.height);var n=t.rexSizer,r=n.padding;0===this.orientation?n.expand&&(i=e-this.space.top-this.space.bottom-r.top-r.bottom):n.proportion>0&&this.proportionLength>0&&(i=n.proportion*this.proportionLength);return i},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,n=0,r=i.length;n0?(e=t-this.getChildrenWidth(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0;}return t},resolveHeight:function(t){t=Ue.call(this,t);if(void 0===this.proportionLength&&1===this.orientation){var e=t-this.childrenHeight;e>0?(e=t-this.getChildrenHeight(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0;}return t}};Object.assign(uo,ro,ho,lo,{getChildProportion:function(t){return this.getSizerConfig(t).proportion},setChildProportion:function(t,e){return this.getSizerConfig(t).proportion=e,this}},{getChildExpand:function(t){return this.getSizerConfig(t).expand},setChildExpand:function(t,e){return this.getSizerConfig(t).expand=e,this}});var co=function(){for(var t,e,i=0,n=this.sizerChildren,r=0,s=n.length;r0&&(i+=e);return i},fo={x:0,h:0,horizontal:0,"left-to-right":0,y:1,v:1,vertical:1,"top-to-bottom":1},vo=Phaser.Utils.Objects.IsPlainObject,po=Phaser.Utils.Objects.GetValue,go=function(t){r(s,t);var i=l(s);function s(t,n,r,o,a,h,l){var u;return e(this,s),vo(n)?(n=po(l=n,"x",0),r=po(l,"y",0),o=po(l,"width",void 0),a=po(l,"height",void 0),h=po(l,"orientation",0)):vo(o)?(o=po(l=o,"width",void 0),a=po(l,"height",void 0),h=po(l,"orientation",0)):vo(h)&&(h=po(l=h,"orientation",0)),void 0===h&&(h=0),(u=i.call(this,t,n,r,o,a,l)).type="rexSizer",u.sizerChildren=[],u.setOrientation(h),u.setItemSpacing(po(l,"space.item",0)),u.setStartChildIndex(po(l,"startChildIndex",0)),u.setRTL(po(l,"rtl",!1)),u.addChildrenMap("items",u.sizerChildren),u}return n(s,[{key:"setOrientation",value:function(t){return this.orientation=function(t){return "string"==typeof t&&(t=fo[t]),t}(t),this}},{key:"setItemSpacing",value:function(t){return this.space.item=t,this}},{key:"setStartChildIndex",value:function(t){return this.startChildIndex=t,this}},{key:"setRTL",value:function(t){return void 0===t&&(t=!0),this.rtl=t,this}},{key:"childrenProportion",get:function(){return void 0===this._childrenProportion&&(this._childrenProportion=co.call(this)),this._childrenProportion}}]),s}(Js);Object.assign(go.prototype,uo);var yo=function(t,e,i){if(t){var n=null==e,r=null==i;return n&&r||(n||(t.displayWidth=e),r||(t.displayHeight=i),n&&(t.scaleX=t.scaleY),r&&(t.scaleY=t.scaleX)),t}},mo=function(t,e){var i;return t||0===t||(t=""),void 0===e&&(e=!0),Array.isArray(t)&&(t=t.join("\n")),(i=e?"".concat(this.text,"\n").concat(t):"".concat(this.text).concat(t))!=this.text&&this.setText(i),this},ko={appendText:mo,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 n=t.iconSize;n&&(this.setChildDisplaySize(i,n,n),void 0!==this.iconWidth&&this.setIconSize(n)),!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 s=t.actionSize;s&&(this.setChildDisplaySize(r,s,s),void 0!==this.actionWidth&&this.setActionSize(s)),!0!==t.action&&this.setActionTexture(t.action,t.actionFrame);}return this}},xo=function(t){r(o,t);var i=l(o);function o(){return e(this,o),i.apply(this,arguments)}return n(o,[{key:"text",get:function(){var t=this.childrenMap.text;return t?t.text:""},set:function(t){var e=this.childrenMap.text;e&&e.setText(t);}},{key:"setText",value:function(t){return this.text=t,this}},{key:"setIconTexture",value:function(t,e){var i=this.childrenMap.icon;return i?(i.setTexture(t,e),void 0!==this.iconWidth&&(yo(i,this.iconWidth,this.iconHeight),this.resetChildScaleState(i)),this):this}},{key:"setTexture",value:function(t,e){return this.setIconTexture(t,e),this}},{key:"setIconSize",value:function(t,e){return void 0===e&&(e=t),this.iconWidth=t,this.iconHeight=e,this}},{key:"texture",get:function(){var t=this.childrenMap.icon;if(t)return t.texture}},{key:"frame",get:function(){var t=this.childrenMap.icon;if(t)return t.frame}},{key:"setActionTexture",value:function(t,e){var i=this.childrenMap.action;return void 0===i||(i.setTexture(t,e),void 0!==this.actionWidth&&(yo(i,this.actionWidth,this.actionHeight),this.resetChildScaleState(i))),this}},{key:"actionTexture",get:function(){var t=this.childrenMap.action;if(t)return t.texture}},{key:"actionFrame",get:function(){var t=this.childrenMap.action;if(t)return t.frame}},{key:"setActionSize",value:function(t,e){return void 0===e&&(e=t),this.actionWidth=t,this.actionHeight=e,this}},{key:"preLayout",value:function(){var t=this.childrenMap.icon;t&&void 0!==this.iconWidth&&yo(t,this.iconWidth,this.iconHeight);var e=this.childrenMap.action;e&&void 0!==this.actionWidth&&yo(e,this.actionWidth,this.actionHeight),c(s(o.prototype),"preLayout",this).call(this);}},{key:"runLayout",value:function(t,e,i){if(this.ignoreLayout)return this;c(s(o.prototype),"runLayout",this).call(this,t,e,i);var n=this.childrenMap.iconMask;n&&(n.setPosition(),this.resetChildPositionState(n));var r=this.childrenMap.actionMask;return r&&(r.setPosition(),this.resetChildPositionState(r)),this}},{key:"resize",value:function(t,e){c(s(o.prototype),"resize",this).call(this,t,e);var i=this.childrenMap.iconMask;i&&i.resize();var n=this.childrenMap.actionMask;return n&&n.resize(),this}}]),o}(go);Object.assign(xo.prototype,ko);var bo=function(t,e,i,n,r){if(this.clear().fillStyle(16777215),1===this.shapeType){i=i.left;var s=Math.min(t,e)/2;this.fillCircle(-t*(n-.5),-e*(r-.5),s+i);}else this.fillRect(-t*n-i.left,-e*r-i.top,t+i.left+i.right,e+i.top+i.bottom);},wo=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},So=function(t){r(o,t);var i=l(o);function o(t,n,r){var s;return e(this,o),void 0===n&&(n=0),"string"==typeof n&&(n=Co[n]),(s=i.call(this,t.scene)).parent=t,s.shapeType=n,s.padding=Te(r),s.setPosition().resize().setVisible(!1),s}return n(o,[{key:"destroy",value:function(){return this.parent=void 0,c(s(o.prototype),"destroy",this).call(this),this}},{key:"setPosition",value:function(t,e){var i=this.parent;return void 0===t&&(t=i.x),void 0===e&&(e=i.y),c(s(o.prototype),"setPosition",this).call(this,t,e),this}},{key:"resize",value:function(t,e,i){var n=this.parent;void 0===t&&(t=n.width),void 0===e&&(e=n.height),void 0===i?i=this.padding:"number"==typeof i&&(i=Te(i));var r=this.width!==t||this.height!==e,s=this.padding!==i&&!wo(this.padding,i);return r||s?(this.width=t,this.height=e,s&&Lt(i,this.padding),this.originX=n.originX,this.originY=n.originY,bo.call(this,t,e,i,n.originX,n.originY),this):this}},{key:"setOrigin",value:function(t,e){void 0===e&&(e=t);var i=this.parent;return void 0===t&&(t=i.originX),void 0===e&&(e=i.originY),this.originX===t&&this.originY===e||(this.originX=t,this.originY=e,bo.call(this,this.width,this.height,this.padding,t,e)),this}}]),o}(Phaser.GameObjects.Graphics),Co={rectangle:0,circle:1},Oo=function(t,e,i,n){var r=new So(e,i,n);if(t&&!t.isRexSizer){var s=r.createGeometryMask();t.setMask(s),this.once("destroy",(function(){t.setMask(),s.destroy();}));}return this.pin(r),r},_o=Phaser.Utils.Objects.GetValue,Po=function(t){r(s,t);var i=l(s);function s(t,n){var r;e(this,s),(r=i.call(this,t,n)).type="rexLabel";var o=_o(n,"background",void 0),h=_o(n,"icon",void 0),l=_o(n,"iconMask",void 0),u=_o(n,"text",void 0),c=_o(n,"action",void 0),d=_o(n,"actionMask",void 0),f=_o(n,"align",void 0);if(o&&r.addBackground(o),"right"!==f&&"bottom"!==f&&"center"!==f||r.addSpace(),h){0===r.orientation?(u||c)&&(b={right:_o(n,"space.icon",0),top:_o(n,"space.iconTop",0),bottom:_o(n,"space.iconBottom",0),left:_o(n,"space.iconLeft",0)}):(u||c)&&(b={bottom:_o(n,"space.icon",0),left:_o(n,"space.iconLeft",0),right:_o(n,"space.iconRight",0),top:_o(n,"space.iconTop",0)});var v=_o(n,"squareFitIcon",!1)?1:0;if(r.add(h,{proportion:0,padding:b,fitRatio:v}),l&&(l=Oo.call(a(r),h,h,1)),!v){var p=_o(n,"iconSize",void 0);r.setIconSize(_o(n,"iconWidth",p),_o(n,"iconHeight",p));}}if(u){var g,y,m=_o(n,"space.text",0),k=_o(n,"expandTextWidth",!1),x=_o(n,"expandTextHeight",!1);0===r.orientation?(g=k?1:0,c&&(b={right:m}),y=x):(g=x?1:0,c&&(b={bottom:m}),y=k),r.add(u,{proportion:g,expand:y,padding:b});}if(c){var b;b=0===r.orientation?{top:_o(n,"space.actionTop",0),bottom:_o(n,"space.actionBottom",0),right:_o(n,"space.actionRight",0)}:{left:_o(n,"space.actionLeft",0),right:_o(n,"space.actionRight",0),bottom:_o(n,"space.actionBottom",0)};v=_o(n,"squareFitAction",!1)?1:0;if(r.add(c,{proportion:0,padding:b,fitRatio:v}),d&&(d=Oo.call(a(r),c,c,1)),!v){var w=_o(n,"actionSize");r.setActionSize(_o(n,"actionWidth",w),_o(n,"actionHeight",w));}}return "center"===f&&r.addSpace(),r.addChildrenMap("background",o),r.addChildrenMap("icon",h),r.addChildrenMap("iconMask",l),r.addChildrenMap("text",u),r.addChildrenMap("action",c),r.addChildrenMap("actionMask",d),r}return n(s)}(xo),To=function e(i){var n,r,s;if(null==i||"object"!==t(i))return i;if(n=Array.isArray(i)?[]:{},function(e){if("object"!==t(e)||e.nodeType||e===e.window)return !1;try{if(e.constructor&&!{}.hasOwnProperty.call(e.constructor.prototype,"isPrototypeOf"))return !1}catch(t){return !1}return !0}(i))for(s in i)r=i[s],n[s]=e(r);else n=i;return n},Eo=function(t){return null==t||""===t||0===t.length},Ro=function(e,i,n,r){if(void 0===r&&(r="."),"object"===t(e)){if(Eo(i)){if(null==n)return;"object"===t(n)&&(e=n);}else {"string"==typeof i&&(i=i.split(r));var s=i.pop(),o=function(e,i,n){var r=e;if(Eo(i));else {var s;"string"==typeof i&&(i=i.split("."));for(var o=0,a=i.length;o=0||t.y>=0,t.x=Math.abs(t.x),t.y=Math.abs(t.y);},zo=function(t,e,i){var n=i.length;if(n>=2){var r=i[n-2],s=i[n-1];if(t===r&&e===s)return i}return i.push(t,e),i},Fo=Phaser.Math.DegToRad,Io=function(t,e,i,n,r,s,o,a,h){o&&s>r?s-=360:!o&&s>>16,a=(65280&r)>>>8,h=255&r;t.fillStyle="rgba("+o+","+a+","+h+","+s+")";}(r,e),r.fill()),e.isStroked&&(!function(t,e,i,n){var r=i||e.strokeColor,s=n||e.strokeAlpha,o=(16711680&r)>>>16,a=(65280&r)>>>8,h=255&r;t.strokeStyle="rgba("+o+","+a+","+h+","+s+")",t.lineWidth=e.lineWidth;}(r,e),r.stroke()),r.restore();}}},Ho=Phaser.GameObjects.Shape,Go=Phaser.Utils.Objects.IsPlainObject,Uo=Phaser.Utils.Objects.GetValue,Vo=Phaser.Geom.Polygon.Earcut,Jo=function(t){r(s,t);var i=l(s);function s(t,n,r,o,a,h,l,u){var c,d,f,v,p;if(e(this,s),Go(n)){var g=n;n=g.x,r=g.y,o=g.width,a=g.height,h=g.radius,l=g.color,u=g.alpha,d=g.strokeColor,f=g.strokeAlpha,v=g.strokeWidth,p=g.shape;}void 0===n&&(n=0),void 0===r&&(r=0),void 0===o&&(o=1),void 0===a&&(a=o),void 0===h&&(h=0),void 0===p&&(p=0);var y=new Mo;if((c=i.call(this,t,"rexRoundRectangleShape",y)).setShapeType(p),0===c.shapeType){var m=Uo(h,"radius",h);y.setTo(0,0,o,a,m);}else {m={x:o/2,y:a/2};y.setTo(0,0,o,a,m);}var k=Uo(h,"iteration",void 0);return c.setIteration(k),c.setPosition(n,r),c.setFillStyle(l,u),void 0!==d&&void 0===v&&(v=2),c.setStrokeStyle(v,d,f),c.updateDisplayOrigin(),c.dirty=!0,c}return n(s,[{key:"fillColor",get:function(){return this._fillColor},set:function(t){this._fillColor=t,this.isFilled=null!=t&&this._fillAlpha>0;}},{key:"fillAlpha",get:function(){return this._fillAlpha},set:function(t){this._fillAlpha=t,this.isFilled=t>0&&null!=this._fillColor;}},{key:"setFillStyle",value:function(t,e){return void 0===e&&(e=1),this.fillColor=t,this.fillAlpha=e,this}},{key:"strokeColor",get:function(){return this._strokeColor},set:function(t){this._strokeColor=t,this.isStroked=null!=t&&this._strokeAlpha>0&&this._lineWidth>0;}},{key:"strokeAlpha",get:function(){return this._strokeAlpha},set:function(t){this._strokeAlpha=t,this.isStroked=t>0&&null!=this._strokeColor&&this._lineWidth>0;}},{key:"lineWidth",get:function(){return this._lineWidth},set:function(t){this._lineWidth=t,this.isStroked=t>0&&null!=this._strokeColor;}},{key:"setStrokeStyle",value:function(t,e,i){return void 0===i&&(i=1),this.lineWidth=t,this.strokeColor=e,this.strokeAlpha=i,this}},{key:"updateData",value:function(){var t=this.geom,e=this.pathData;e.length=0;var i,n=t.width,r=t.height,s=t.cornerRadius,o=this.iteration+1;if(i=s.tl,Ko(i))if(i.convex){var a=i.x,h=i.y;Io(a,h,i.x,i.y,180,270,!1,o,e);}else {Io(a=0,h=0,i.x,i.y,90,0,!0,o,e);}else zo(0,0,e);if(i=s.tr,Ko(i))if(i.convex){a=n-i.x,h=i.y;Io(a,h,i.x,i.y,270,360,!1,o,e);}else {Io(a=n,h=0,i.x,i.y,180,90,!0,o,e);}else zo(n,0,e);if(i=s.br,Ko(i))if(i.convex){a=n-i.x,h=r-i.y;Io(a,h,i.x,i.y,0,90,!1,o,e);}else {Io(a=n,h=r,i.x,i.y,270,180,!0,o,e);}else zo(n,r,e);if(i=s.bl,Ko(i))if(i.convex){a=i.x,h=r-i.y;Io(a,h,i.x,i.y,90,180,!1,o,e);}else {Io(a=0,h=r,i.x,i.y,360,270,!0,o,e);}else zo(0,r,e);return e.push(e[0],e[1]),this.pathIndexes=Vo(e),this}},{key:"setShapeType",value:function(t){return "string"==typeof t&&(t=qo[t]),this.shapeType=t,this}},{key:"width",get:function(){return this.geom.width},set:function(t){this.resize(t,this.height);}},{key:"height",get:function(){return this.geom.height},set:function(t){this.resize(this.width,t);}},{key:"setSize",value:function(t,e){if(void 0===e&&(e=t),this.geom.width===t&&this.geom.height===e)return this;this.geom.setSize(t,e),1===this.shapeType&&this.setRadius({x:t/2,y:e/2}),this.updateDisplayOrigin(),this.dirty=!0;var i=this.input;return i&&!i.customHitArea&&(i.hitArea.width=t,i.hitArea.height=e),this}},{key:"resize",value:function(t,e){return this.setSize(t,e),this}},{key:"radius",get:function(){return this.geom.radius},set:function(t){this.geom.setRadius(t),this.updateDisplayOrigin(),this.dirty=!0;}},{key:"radiusTL",get:function(){return this.geom.radiusTL},set:function(t){this.geom.radiusTL=t,this.dirty=!0;}},{key:"radiusTR",get:function(){return this.geom.radiusTR},set:function(t){this.geom.radiusTR=t,this.dirty=!0;}},{key:"radiusBL",get:function(){return this.geom.radiusBL},set:function(t){this.geom.radiusBL=t,this.dirty=!0;}},{key:"radiusBR",get:function(){return this.geom.radiusBR},set:function(t){this.geom.radiusBR=t,this.dirty=!0;}},{key:"setRadius",value:function(t){return void 0===t&&(t=0),this.radius=t,this}},{key:"setRadiusTL",value:function(t){return void 0===t&&(t=0),this.radiusTL=t,this}},{key:"setRadiusTR",value:function(t){return void 0===t&&(t=0),this.radiusTR=t,this}},{key:"setRadiusBL",value:function(t){return void 0===t&&(t=0),this.radiusBL=t,this}},{key:"setRadiusBR",value:function(t){return void 0===t&&(t=0),this.radiusBR=t,this}},{key:"cornerRadius",get:function(){return this.geom.cornerRadius},set:function(t){this.radius=t;}},{key:"setCornerRadius",value:function(t){return this.setRadius(t)}},{key:"iteration",get:function(){return this._iteration},set:function(t){void 0!==this._iteration?this._iteration!==t&&(this._iteration=t,this.dirty=!0):this._iteration=t;}},{key:"setIteration",value:function(t){return void 0===t&&(t=6),this.iteration=t,this}}]),s}(Ho),Ko=function(t){return t.x>0&&t.y>0},qo={rectangle:0,circle:1};Object.assign(Jo.prototype,No);var Zo=function(t,e,i,n){if(void 0===i&&(i="."),void 0===n&&(n={}),!t)return n;if(e in t)return Object.assign(n,t[e]);for(var r in e+=i,t)r.startsWith(e)&&(n[r.replace(e,"")]=t[r]);return n},$o=function(t,e,i){if(void 0===i&&(i={}),Array.isArray(e))for(var n=0,r=e.length;n=6?(n=[arguments[2],void 0,arguments[3]],r=[arguments[4],void 0,arguments[5]]):(n=To(n),r=To(r)),this.textureKey=e,this.baseFrameName=i,this.columns.data=n,this.columns.count=n?n.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 s=this.scene.sys.textures.get(e);if(!s)return this.clear(),this;if(!n||!r)return this.clear(),this;for(var o=s.get(i),a=o.width,h=0,l=0,u=n.length;l0?0:g,x=0;l=0;for(var C=n.length;l0?0:y),y>=1&&g>=1){var O=t(m=this.getFrameNameCallback(l,w,i));"string"!==O&&"number"!==O||s.add(m,0,x+o.cutX,b+o.cutY,y,g);}x+=y;}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,n,r,s,o,a,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,f=c>=0?this.maxFixedPartScaleY:this.height/l;if(this.preserveRatio){var v=Math.min(d,f);if(d>v){var p=(d-v)*h;u>=0?u+=p:u=p,d=v;}if(f>v){var g=(f-v)*l;c>=0?c+=g:c=g,f=v;}}this.columns.scale=d,this.rows.scale=f,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 y=0,m=0;this._beginDraw();for(var k=0,x=this.rows.count;k0&&a>0&&(0===(0===s.stretch&&0===r.stretch||0===this.getStretchMode(b,k)?0:1)?this._drawImage(this.textureKey,n,y,m,o,a):this._drawTileSprite(this.textureKey,n,y,m,o,a)),y+=o;m+=a;}this._endDraw();},setStretchMode:function(t){return ba(t)?(this.stretchMode.edge=Sa(wa(t,"edge",0)),this.stretchMode.internal=Sa(wa(t,"internal",0))):(t=Sa(t),this.stretchMode.edge=t,this.stretchMode.internal=t),this},getStretchMode:function(t,e){return Oa.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}},Pa=Phaser.Utils.Objects.IsPlainObject,Ta=Phaser.Utils.Objects.GetValue,Ea=Phaser.GameObjects,Ra=void 0,La=function(t,e){if(Ra||(Ra={},ei(t).events.once("destroy",(function(){for(var t in Ra)Ra[t].destroy();Ra=void 0;}))),!Ra.hasOwnProperty(e)){var i=ei(t).scene.systemScene;(t=new Ea[e](i)).setOrigin(0),Ra[e]=t;}return Ra[e]},Ma=function(t){r(s,t);var i=l(s);function s(){return e(this,s),i.apply(this,arguments)}return n(s)}(function(t,i){var o=function(t){r(a,t);var o=l(a);function a(t,n,r,s,h,l,u,c,d,f){var v;if(e(this,a),Pa(n)?(n=Ta(f=n,"x",0),r=Ta(f,"y",0),s=Ta(f,"width",1),h=Ta(f,"height",1),l=Ta(f,"key",void 0),u=Ta(f,"baseFrame",void 0),c=Ta(f,"columns",void 0),d=Ta(f,"rows",void 0)):Pa(s)?(s=Ta(f=s,"width",1),h=Ta(f,"height",1),l=Ta(f,"key",void 0),u=Ta(f,"baseFrame",void 0),c=Ta(f,"columns",void 0),d=Ta(f,"rows",void 0)):Pa(l)?(l=Ta(f=l,"key",void 0),u=Ta(f,"baseFrame",void 0),c=Ta(f,"columns",void 0),d=Ta(f,"rows",void 0)):Pa(u)?(u=Ta(f=u,"baseFrame",void 0),c=Ta(f,"columns",void 0),d=Ta(f,"rows",void 0)):Array.isArray(u)?(f=d,d=c,c=u,u=Ta(f,"baseFrame",void 0)):Pa(c)&&(c=Ta(f=c,"columns",void 0),d=Ta(f,"rows",void 0)),void 0===c){var p=Ta(f,"leftWidth",void 0),g=Ta(f,"rightWidth",void 0);void 0!==p&&void 0!==g&&(c=[p,void 0,g]);}if(void 0===d){var y=Ta(f,"topHeight",void 0),m=Ta(f,"bottomHeight",void 0);void 0!==y&&void 0!==m&&(d=[y,void 0,m]);}(v=o.call(this,t)).type=i,v.setPosition(n,r).setSize(s,h).setOrigin(.5,.5),v.columns={},v.rows={},v.stretchMode={},v._tileSprite=void 0,v._image=void 0,v.setGetFrameNameCallback(Ta(f,"getFrameNameCallback",void 0)),v.setStretchMode(Ta(f,"stretchMode",0)),v.setPreserveRatio(Ta(f,"preserveRatio",!0));var k=Ta(f,"maxFixedPartScale",1),x=Ta(f,"maxFixedPartScaleX",k),b=Ta(f,"maxFixedPartScaleY",void 0);return v.setMaxFixedPartScale(x,b),v.setBaseTexture(l,u,c,d),v}return n(a,[{key:"minWidth",get:function(){return this.columns.minWidth}},{key:"minHeight",get:function(){return this.rows.minHeight}},{key:"fixedPartScaleX",get:function(){return this.columns.scale}},{key:"fixedPartScaleY",get:function(){return this.rows.scale}},{key:"resize",value:function(t,e){return this.width===t&&this.height===e||(c(s(a.prototype),"resize",this)?c(s(a.prototype),"resize",this).call(this,t,e):c(s(a.prototype),"setSize",this).call(this,t,e),this.updateTexture()),this}}]),a}(t);return Object.assign(o.prototype,_a),o}(Phaser.GameObjects.RenderTexture,"rexNinePatch")),Aa={_drawImage:function(t,e,i,n,r,s){var o=La(this,"Image").setTexture(t,e).setDisplaySize(r,s);this.draw(o,i,n);},_drawTileSprite:function(t,e,i,n,r,s){var o=La(this,"TileSprite").setTexture(t,e).setSize(r,s);this.draw(o,i,n);}};Object.assign(Ma.prototype,Aa);var Da=function(t,e){var i,n;switch(e&&(e.hasOwnProperty("type")?i=e.type:e.hasOwnProperty("leftWidth")?i="nineSlice":e.hasOwnProperty("key")&&(i="image")),i){case"image":n=new ka(t,e);break;case"nineSlice":n=e.hasOwnProperty("stretchMode")?new Ma(t,e):new pa(t,e);break;default:n=new ra(t,e);}return t.add.existing(n),n},ja=Phaser.GameObjects.Text,za=Phaser.Utils.Objects.GetValue,Fa=function(t){r(s,t);var i=l(s);function s(t,n){var r;e(this,s),void 0===n&&(n={});var o=za(n,"x",0),a=za(n,"y",0),h=za(n,"text","");return (r=i.call(this,t,o,a,h,n)).type="rexStatesText",n.style=r.style,n.onModifyStyle=function(t,e){var i=e.hasOwnProperty("fontStyle")||e.hasOwnProperty("fontSize")||e.hasOwnProperty("fontFamily");t.style.update(i);},r.addStyleManager(n),delete n.style,r}return n(s)}(ja);Object.assign(Fa.prototype,na); +!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).rexcolorcomponents=e();}(undefined,(function(){function t(e){return t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},t(e)}function e(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){for(var i=0;it.length)&&(e=t.length);for(var i=0,n=new Array(e);i=0;i--)(e=this.children[i]).parentContainer||e.displayList||e.destroy(t);this.clear(!t),c(s(o.prototype),"destroy",this).call(this,t);}}},{key:"contains",value:function(t){return -1!==this.children.indexOf(t)}},{key:"add",value:function(t){var e=this;return x(this.children,t,0,(function(t){t.once("destroy",e.onChildDestroy,e);}),this),this}},{key:"remove",value:function(t,e){var i=this;return b(this.children,t,(function(t){t.off("destroy",i.onChildDestroy,i),e&&t.destroy();})),this}},{key:"onChildDestroy",value:function(t,e){this.remove(t,!1);}},{key:"clear",value:function(t){for(var e,i=0,n=this.children.length;i0;){var n=i.shift();!e(n)&&n.isRexContainerLite&&i.push.apply(i,v(n.children));}},it=Phaser.Utils.Array,nt={getChildren:function(t){if(t)for(var e=0,i=this.children.length;e=0;e--)this.remove(this.backgroundChildren[e],t);return this}},Ie=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},Xe=/(\S+)\[(\d+)\]/i,Ye=Phaser.Utils.Objects.GetValue,Be=function(t,e){return void 0===e?t:t[e]},Ne=function(e,i,n){void 0===e&&(e={}),void 0===i&&(i=0);var r=t(i);return "string"===r?e[i]=n:"number"===r?(e.left=i,e.right=i,e.top=i,e.bottom=i):(e.left=Ye(i,"left",0),e.right=Ye(i,"right",0),e.top=Ye(i,"top",0),e.bottom=Ye(i,"bottom",0)),e},He={getInnerPadding:function(t){return Be(this.space,t)},setInnerPadding:function(t,e){return Ne(this.space,t,e),this},getOuterPadding:function(t){return Be(this.getSizerConfig(this).padding,t)},setOuterPadding:function(t,e){return Ne(this.getSizerConfig(this).padding,t,e),this},getChildOuterPadding:function(t,e){return "string"==typeof t&&(t=this.getElement(t)),Be(this.getSizerConfig(t).padding,e)},setChildOuterPadding:function(t,e,i){return "string"==typeof t&&(t=this.getElement(t)),Ne(this.getSizerConfig(t).padding,e,i),this}},Ge=function(t){var e=this.childrenWidth,i=void 0!==this.minWidth?this.minWidth:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn("Layout width warn: ".concat(this.constructor.name,"'s minWidth (").concat(i,") < childrenWidth (").concat(e,")"))):this.layoutWarnEnable&&(i>t||e>t)&&console.warn("Layout width warn: ".concat(this.constructor.name,"'s minWidth (").concat(i,") or childrenWidth (").concat(e," > targetWidth ").concat(t,")")),t},Ue=function(t){var e=this.childrenHeight,i=void 0!==this.minHeight?this.minHeight:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn("Layout height warn: ".concat(this.constructor.name,"'s minHeight (").concat(i,") < childrenHeight (").concat(e,")"))):this.layoutWarnEnable&&(i>t||e>t)&&console.warn("Layout height warn: ".concat(this.constructor.name,"'s minHeight (").concat(i,") or childrenHeight (").concat(e,") > targetHeight (").concat(t,")")),t},Ve={getShownChildren:function(t){void 0===t&&(t=[]);for(var e,i=this.children,n=0,r=i.length;n0;){var i=e.shift();i.rexSizer&&i.rexSizer.hidden||(i!==this&&t.push(i),i.isRexContainerLite&&e.push.apply(e,v(i.children)));}return t}},Je=function(){this._childrenWidth=void 0,this._childrenHeight=void 0;for(var t,e=this.getChildrenSizers(),i=0,n=e.length;i0?-this.delay:0,this.state=this.nowTime>=0?gi:pi,this.repeatCounter=0,this}},{key:"stop",value:function(){return this.state=vi,this}},{key:"update",value:function(t,e){this.state!==vi&&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=yi)):(this.nowTime=this.duration,this.state=mi):this.nowTime>=0&&(this.state=gi));}},{key:"t",get:function(){var t;switch(this.state){case vi:case pi:case yi:t=0;break;case gi:t=this.nowTime/this.duration;break;case mi:t=1;}return di(t,0,1)},set:function(t){(t=di(t,-1,1))<0?(this.state=pi,this.nowTime=-this.delay*t):(this.state=gi,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++);}},{key:"setT",value:function(t){return this.t=t,this}},{key:"isIdle",get:function(){return this.state===vi}},{key:"isDelay",get:function(){return this.state===pi}},{key:"isCountDown",get:function(){return this.state===gi}},{key:"isRunning",get:function(){return this.state===pi||this.state===gi}},{key:"isDone",get:function(){return this.state===mi}},{key:"isOddIteration",get:function(){return 1==(1&this.repeatCounter)}},{key:"isEvenIteration",get:function(){return 0==(1&this.repeatCounter)}}]),t}(),vi=0,pi=1,gi=2,yi=3,mi=-1,ki=function(t){r(o,t);var i=u(o);function o(t,n){var r;return e(this,o),(r=i.call(this,t,n)).timer=new fi,r}return n(o,[{key:"shutdown",value:function(t){this.isShutdown||(c(s(o.prototype),"shutdown",this).call(this,t),this.timer.destroy(),this.timer=void 0);}},{key:"start",value:function(){return this.timer.start(),c(s(o.prototype),"start",this).call(this),this}},{key:"stop",value:function(){return this.timer.stop(),c(s(o.prototype),"stop",this).call(this),this}},{key:"complete",value:function(){return this.timer.stop(),c(s(o.prototype),"complete",this).call(this),this}}]),o}(ui),xi=Phaser.Utils.Objects.GetValue,bi=Phaser.Utils.Objects.GetAdvancedValue,wi=Phaser.Tweens.Builders.GetEaseFunction,Si=function(t){r(o,t);var i=u(o);function o(){return e(this,o),i.apply(this,arguments)}return n(o,[{key:"resetFromJSON",value:function(t){return this.timer.resetFromJSON(xi(t,"timer")),this.setEnable(xi(t,"enable",!0)),this.setTarget(xi(t,"target",this.parent)),this.setDelay(bi(t,"delay",0)),this.setDuration(bi(t,"duration",1e3)),this.setEase(xi(t,"ease","Linear")),this.setRepeat(xi(t,"repeat",0)),this}},{key:"setEnable",value:function(t){return null==t&&(t=!0),this.enable=t,this}},{key:"setTarget",value:function(t){return void 0===t&&(t=this.parent),this.target=t,this}},{key:"setDelay",value:function(t){return this.delay=t,this}},{key:"setDuration",value:function(t){return this.duration=t,this}},{key:"setRepeat",value:function(t){return this.repeat=t,this}},{key:"setRepeatDelay",value:function(t){return this.repeatDelay=t,this}},{key:"setEase",value:function(t){return void 0===t&&(t="Linear"),this.ease=t,this.easeFn=wi(t),this}},{key:"start",value:function(){return this.timer.isRunning||c(s(o.prototype),"start",this).call(this),this}},{key:"restart",value:function(){return this.timer.stop(),this.start.apply(this,arguments),this}},{key:"stop",value:function(t){return void 0===t&&(t=!1),c(s(o.prototype),"stop",this).call(this),t&&(this.timer.setT(1),this.updateGameObject(this.target,this.timer),this.complete()),this}},{key:"update",value:function(t,e){if(!this.isRunning||!this.enable||!this.parent.active)return this;var i=this.target,n=this.timer;return n.update(t,e),n.isDelay||this.updateGameObject(i,n),this.emit("update",i,this),n.isDone&&this.complete(),this}},{key:"updateGameObject",value:function(t,e){}}]),o}(ki),Ci=Phaser.Utils.Objects.GetValue,Oi=Phaser.Utils.Objects.GetAdvancedValue,_i=Phaser.Math.Linear,Pi=function(t){r(o,t);var i=u(o);function o(t,n){var r;return e(this,o),(r=i.call(this,t,n)).scaleStart={},r.scaleEnd={},r.resetFromJSON(n),r.boot(),r}return n(o,[{key:"resetFromJSON",value:function(t){return c(s(o.prototype),"resetFromJSON",this).call(this,t),this.setMode(Ci(t,"mode",0)),this.setScaleRange(Oi(t,"start",void 0),Oi(t,"end",0)),this}},{key:"setMode",value:function(t){return "string"==typeof t&&(t=Ti[t]),this.mode=t,this}},{key:"setScaleRange",value:function(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}},{key:"start",value:function(){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),c(s(o.prototype),"start",this).call(this),this}},{key:"updateGameObject",value:function(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));}},{key:"complete",value:function(){return c(s(o.prototype),"complete",this).call(this),1===this.mode&&this.parent.destroy(),this}}]),o}(Si),Ti={stop:0,destroy:1,yoyo:2},Ei=function(t,e,i,n,r){var s,o;switch(void 0===n&&(n="Cubic"),i){case 0:case"x":s={x:0},o={x:t.scaleX};break;case 1:case"y":s={y:0},o={y:t.scaleY};break;default:s=0,o=t.scale;}var a={mode:0,start:s,end:o,duration:e,ease:n};return void 0===r?r=new Pi(t,a):r.resetFromJSON(a),r.restart(),r},Ri=function(t,e,i,n,r,s){void 0===n&&(n="Linear"),r instanceof Pi&&(s=r,r=void 0),void 0===r&&(r=!0);var o={};switch(o.mode=r?1:0,i){case 0:case"x":o.end={x:0};break;case 1:case"y":o.end={y:0};break;default:o.end=0;}return o.duration=e,o.ease=n,void 0===s?s=new Pi(t,o):s.resetFromJSON(o),s.restart(),s},Li=function(t,e){return new Promise((function(i,n){t.once(e,(function(){i();}));}))},Mi=function(t){return Li(t,"complete")},Ai=Phaser.Utils.Objects.IsPlainObject,Di=function(t,e){e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0);})),e.on("update",(function(){var e=ze.getParentSizer(t);e&&e.resetChildPositionState(t);}));},ji={popUp:function(t,e,i){if(Ai(t)){var n=t;t=n.duration,e=n.orientation,i=n.ease;}var r=void 0===this._scaleBehavior;return this._scaleBehavior=Ei(this,t,e,i,this._scaleBehavior),r&&Di(this,this._scaleBehavior),this._scaleBehavior.completeEventName="popup.complete",this},popUpPromise:function(t,e,i){return this.popUp(t,e,i),Mi(this._scaleBehavior)},scaleDownDestroy:function(t,e,i,n){if(Ai(t)){var r=t;t=r.duration,e=r.orientation,i=r.ease,n=r.destroy;}var s=void 0===this._scaleBehavior;return this._scaleBehavior=Ri(this,t,e,i,n,this._scaleBehavior),s&&Di(this,this._scaleBehavior),this._scaleBehavior.completeEventName="scaledown.complete",this},scaleDownDestroyPromise:function(t,e,i,n){return this.scaleDownDestroy(t,e,i,n),Mi(this._scaleBehavior)},scaleDown:function(t,e,i){return this.scaleDownDestroy(t,e,i,!1),this},scaleDownPromise:function(t,e,i){return this.scaleDown(t,e,i),Mi(this._scaleBehavior)},scaleYoyo:function(t,e,i,n,r){if(Ai(t)){var s=t;t=s.duration,e=s.peakValue,i=s.repeat,n=s.orientation,r=s.ease;}var o=void 0===this._scaleBehavior;return this._scaleBehavior=function(t,e,i,n,r,s,o){var a,h;switch(void 0===i&&(i=1.2),void 0===n&&(n=0),void 0===s&&(s="Cubic"),r){case 0:case"x":a={x:t.scaleX},h={x:i};break;case 1:case"y":a={y:t.scaleX},h={y:i};break;default:a=t.scaleX,h=i;}var u={mode:2,start:a,end:h,duration:e/2,ease:s,repeat:n};return void 0===o?o=new Pi(t,u):o.resetFromJSON(u),o.restart(),o}(this,t,e,i,n,r,this._scaleBehavior),o&&Di(this,this._scaleBehavior),this._scaleBehavior.completeEventName="scaleyoyo.complete",this},scaleYoyoPromise:function(t,e,i,n,r){return this.scaleYoyo(t,e,i,n,r),Mi(this._scaleBehavior)}},zi=Phaser.Utils.Objects.GetValue,Fi=Phaser.Utils.Objects.GetAdvancedValue,Wi=Phaser.Math.Linear,Ii=function(t){r(o,t);var i=u(o);function o(t,n){var r;return e(this,o),(r=i.call(this,t,n)).resetFromJSON(n),r.boot(),r}return n(o,[{key:"resetFromJSON",value:function(t){return c(s(o.prototype),"resetFromJSON",this).call(this,t),this.setMode(zi(t,"mode",0)),this.setAlphaRange(Fi(t,"start",this.parent.alpha),Fi(t,"end",0)),this}},{key:"setMode",value:function(t){return "string"==typeof t&&(t=Xi[t]),this.mode=t,this}},{key:"setAlphaRange",value:function(t,e){return this.alphaStart=t,this.alphaEnd=e,this}},{key:"start",value:function(){return this.timer.isRunning||(this.parent.setAlpha(this.alphaStart),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),c(s(o.prototype),"start",this).call(this)),this}},{key:"updateGameObject",value:function(t,e){var i=e.t;e.isOddIteration&&(i=1-i),t.alpha=Wi(this.alphaStart,this.alphaEnd,i);}},{key:"complete",value:function(){return c(s(o.prototype),"complete",this).call(this),1===this.mode&&this.parent.destroy(),this}}]),o}(Si),Xi={stop:0,destroy:1,yoyo:2},Yi=Phaser.Utils.Objects.IsPlainObject,Bi=function(t,e,i,n){var r,s;Yi(i)?(r=i.start,s=i.end):s=i,void 0===r&&(r=0),void 0===s&&(s=1);var o={mode:0,start:r,end:s,duration:e};return void 0===n?n=new Ii(t,o):n.resetFromJSON(o),n.restart(),n},Ni=function(t,e,i,n){i instanceof Ii&&(n=i,i=void 0),void 0===i&&(i=!0);var r={mode:i?1:0,end:0,duration:e};return void 0===n?n=new Ii(t,r):n.resetFromJSON(r),n.restart(),n},Hi=Phaser.Utils.Objects.IsPlainObject,Gi=function(t,e){e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0);})),e.on("update",(function(){var e=ze.getParentSizer(t);e&&e.resetChildAlphaState(t);}));},Ui={fadeIn:function(t,e){if(Hi(t)){var i=t;t=i.duration,e=i.alpha;}var n=void 0===this._fade;return this._fade=Bi(this,t,e,this._fade),n&&Gi(this,this._fade),this._fade.completeEventName="fadein.complete",this},fadeInPromise:function(t,e){return this.fadeIn(t,e),Mi(this._fade)},fadeOutDestroy:function(t,e){if(Hi(t)){var i=t;t=i.duration,e=i.destroy;}var n=void 0===this._fade;return this._fade=Ni(this,t,e,this._fade),n&&Gi(this,this._fade),this._fade.completeEventName="fadeout.complete",this},fadeOutDestroyPromise:function(t,e){return this.fadeOutDestroy(t,e),Mi(this._fade)},fadeOut:function(t){return this.fadeOutDestroy(t,!1),this},fadeOutPromise:function(t){return this.fadeOut(t),Mi(this._fade)}},Vi=Phaser.Utils.Objects.GetValue,Ji=Phaser.Utils.Objects.GetAdvancedValue,Ki=Phaser.Math.Linear,qi=function(t){r(o,t);var i=u(o);function o(t,n){var r;return e(this,o),(r=i.call(this,t,n)).resetFromJSON(n),r.boot(),r}return n(o,[{key:"resetFromJSON",value:function(t){if(c(s(o.prototype),"resetFromJSON",this).call(this,t),this.setMode(Vi(t,"mode",0)),t&&(t.hasOwnProperty("x")||t.hasOwnProperty("y"))){var e=Ji(t,"x",void 0),i=Ji(t,"y",void 0);this.setTargetPosition(e,i);}else this.setTargetPosition(t);return this}},{key:"setMode",value:function(t){return "string"==typeof t&&(t=Zi[t]),this.mode=t,this}},{key:"setTargetPosition",value:function(t,e){if("number"==typeof t||"number"==typeof e)this.startX=this.parent.x,this.startY=this.parent.y,this.endX=t,this.endY=e;else {var i=t;this.startX=Ji(i,"startX",void 0),this.startY=Ji(i,"startY",void 0),this.endX=Ji(i,"endX",void 0),this.endY=Ji(i,"endY",void 0);}return this.hasMoveX=void 0!==this.startX&&void 0!==this.endX,this.hasMoveY=void 0!==this.startY&&void 0!==this.endY,this}},{key:"start",value:function(){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),c(s(o.prototype),"start",this).call(this),this}},{key:"updateGameObject",value:function(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasMoveX&&(t.x=Ki(this.startX,this.endX,i)),this.hasMoveY&&(t.y=Ki(this.startY,this.endY,i));}},{key:"complete",value:function(){return c(s(o.prototype),"complete",this).call(this),1===this.mode&&this.parent.destroy(),this}}]),o}(Si),Zi={stop:0,destroy:1,yoyo:2},$i=function(t,e){if("number"==typeof t)return t;var i=t[0],n=parseFloat(t.substr(2));switch(i){case"+":return e+n;case"-":return e-n;case"*":return e*n;case"/":return e/n}},Qi=Phaser.Utils.Objects.IsPlainObject,tn=Phaser.Math.Distance.Between,en=function(t,e){e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0);})),e.on("update",(function(){var e=ze.getParentSizer(t);e&&e.resetChildPositionState(t);}));},nn={moveFrom:function(t,e,i,n,r){if(Qi(t)){var s=t;e=s.x,i=s.y,t=s.hasOwnProperty("speed")?1e3*tn(e,i,this.x,this.y)/s.speed:s.duration,n=s.ease;}var o=void 0===this._easeMove;return this._easeMove=function(t,e,i,n,r,s,o){s instanceof qi&&(o=s,s=void 0),void 0===s&&(s=!1);var a={};return a.mode=s?1:0,void 0!==i&&(a.startX=$i(i,t.x),a.endX=t.x),void 0!==n&&(a.startY=$i(n,t.y),a.endY=t.y),a.duration=e,a.ease=void 0===r?"Linear":r,void 0===o?o=new qi(t,a):o.resetFromJSON(a),o.restart(),o}(this,t,e,i,n,r,this._easeMove),o&&en(this,this._easeMove),this._easeMove.completeEventName="movefrom.complete",this},moveFromPromise:function(t,e,i,n,r){return this.moveFrom(t,e,i,n,r),Mi(this._easeMove)},moveFromDestroy:function(t,e,i,n){return this.moveFrom(t,e,i,n,!0),this},moveFromDestroyPromise:function(t,e,i,n){return this.moveFromDestroy(t,e,i,n),Mi(this._easeMove)},moveTo:function(t,e,i,n,r){if(Qi(t)){var s=t;e=s.x,i=s.y,t=s.hasOwnProperty("speed")?1e3*tn(e,i,this.x,this.y)/s.speed:s.duration,n=s.ease;}var o=void 0===this._easeMove;return this._easeMove=function(t,e,i,n,r,s,o){s instanceof qi&&(o=s,s=void 0),void 0===s&&(s=!1);var a={};return a.mode=s?1:0,void 0!==i&&(a.startX=t.x,a.endX=$i(i,t.x)),void 0!==n&&(a.startY=t.y,a.endY=$i(n,t.y)),a.duration=e,a.ease=void 0===r?"Linear":r,void 0===o?o=new qi(t,a):o.resetFromJSON(a),o.restart(),o}(this,t,e,i,n,r,this._easeMove),o&&en(this,this._easeMove),this._easeMove.completeEventName="moveto.complete",this},moveToPromise:function(t,e,i,n,r){return this.moveTo(t,e,i,n,r),Mi(this._easeMove)},moveToDestroy:function(t,e,i,n){return this.moveTo(t,e,i,n,!0),this},moveToDestroyPromise:function(t,e,i,n){return this.moveToDestroy(t,e,i,n,!0),Mi(this._easeMove)},moveStop:function(t){return this._easeMove?(this._easeMove.stop(t),this):this}},rn=Phaser.Utils.Objects.GetValue,sn=function(t){r(o,t);var i=u(o);function o(t,n){var r;return e(this,o),(r=i.call(this,t,n)).timer=new fi,r.resetFromJSON(n),r.boot(),r}return n(o,[{key:"resetFromJSON",value:function(t){return this.timer.resetFromJSON(rn(t,"timer")),this.setEnable(rn(t,"enable",!0)),this.setMode(rn(t,"mode",1)),this.isRunning=rn(t,"isRunning",!1),this.setMagnitudeMode(rn(t,"magnitudeMode",1)),this.setAxisMode(rn(t,"axis",0)),this.setDuration(rn(t,"duration",500)),this.setMagnitude(rn(t,"magnitude",10)),this.ox=rn(t,"ox",void 0),this.oy=rn(t,"oy",void 0),this}},{key:"toJSON",value:function(){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}}},{key:"shutdown",value:function(t){this.isShutdown||(c(s(o.prototype),"shutdown",this).call(this,t),this.timer.destroy(),this.timer=void 0);}},{key:"startTicking",value:function(){c(s(o.prototype),"startTicking",this).call(this),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);}},{key:"stopTicking",value:function(){c(s(o.prototype),"stopTicking",this).call(this),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));}},{key:"setEnable",value:function(t){return null==t&&(t=!0),this.enable=t,this}},{key:"setMode",value:function(t){return "string"==typeof t&&(t=on[t]),this.mode=t,this}},{key:"setMagnitudeMode",value:function(t){return "string"==typeof t&&(t=hn[t]),this.magnitudeMode=t,this}},{key:"setAxisMode",value:function(t){return "string"==typeof t&&(t=an[t]),this.axisMode=t,this}},{key:"setDuration",value:function(t){return this.duration=t,this}},{key:"setMagnitude",value:function(t){return this.magnitude=t,this}},{key:"start",value:function(t,e){if("number"!=typeof t){var i=t;e=rn(i,"magnitude",void 0),t=rn(i,"duration",void 0);}return void 0!==e&&this.setMagnitude(e),void 0!==t&&this.setDuration(t),this.timer.setDuration(this.duration).start(),c(s(o.prototype),"start",this).call(this),this}},{key:"shake",value:function(t,e){return this.start(t,e),this}},{key:"update",value:function(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 n=this.magnitude;1===this.magnitudeMode&&(n*=1-this.timer.t);var r=Math.random()*Math.PI*2,s=this.ox+Math.cos(r)*n,o=this.oy+Math.sin(r)*n;switch(this.axisMode){case 1:i.x=s;break;case 2:i.y=o;break;default:i.x=s,i.y=o;}}return this}},{key:"backToOrigin",value:function(){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}}]),o}(oi),on={effect:0,behavior:1},an={both:0,"h&v":0,"x&y":0,horizontal:1,h:1,x:1,vertical:2,v:2,y:2},hn={constant:0,decay:1},un=Phaser.Utils.Objects.IsPlainObject,ln={shake:function(t,e,i){if(un(t)){var n=t;t=n.duration,e=n.magnitude,i=n.magnitudeMode;}return void 0===this._shake&&(this._shake=new sn(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:function(t,e){return this.shake(t,e),Mi(this._shake)}},cn=Phaser.Utils.Objects.GetValue,dn=Phaser.Math.Linear,fn=function(t){r(o,t);var i=u(o);function o(t,n){var r;return e(this,o),(r=i.call(this,t,n)).resetFromJSON(),r.boot(),r}return n(o,[{key:"start",value:function(t){if(this.timer.isRunning)return this;var e=this.target;this.propertyKey=cn(t,"key","value");var i=e[this.propertyKey];return this.fromValue=cn(t,"from",i),this.toValue=cn(t,"to",i),this.setEase(cn(t,"ease",this.ease)),this.setDuration(cn(t,"duration",this.duration)),this.setRepeat(cn(t,"repeat",0)),this.setDelay(cn(t,"delay",0)),this.setRepeatDelay(cn(t,"repeatDelay",0)),this.timer.setDuration(this.duration).setRepeat(this.repeat).setDelay(this.delay).setRepeatDelay(this.repeatDelay),e[this.propertyKey]=this.fromValue,c(s(o.prototype),"start",this).call(this),this}},{key:"updateGameObject",value:function(t,e){var i=e.t;i=this.easeFn(i),t[this.propertyKey]=dn(this.fromValue,this.toValue,i);}}]),o}(Si),vn=Phaser.Utils.Objects.IsPlainObject,pn=function(t){r(s,t);var i=u(s);function s(t,n){var r;return e(this,s),(r=i.call(this,t,n)).parent.setDataEnabled(),r.easeTasks={},r}return n(s,[{key:"complete",value:function(t){this.emit("complete-".concat(t),this.parent,this),this.emit("complete",t,this.parent,this);}},{key:"getEaseTask",value:function(t){var e=this.easeTasks[t];return void 0===e&&(e=new fn(this.parent),this.easeTasks[t]=e,e.setTarget(this.parent.data.values).on("complete",(function(){this.complete(t);}),this)),e}},{key:"easeTo",value:function(t,e,i,n){if(vn(t)){var r=t;t=r.key,e=r.value,i=r.duration,n=r.ease;var s=r.speed;void 0===i&&void 0!==s&&(i=Math.abs(e-this.parent.data.values[t])/s*1e3);}return void 0===i&&(i=1e3),void 0===n&&(n="Linear"),this.getEaseTask(t).restart({key:t,to:e,duration:i,ease:n}),this}},{key:"easeFrom",value:function(t,e,i,n){if(vn(t)){var r=t;t=r.key,e=r.value,i=r.duration,n=r.ease;var s=r.speed;void 0===i&&void 0!==s&&(i=Math.abs(e-this.parent.data.values[t])/s*1e3);}return void 0===i&&(i=1e3),void 0===n&&(n="Linear"),this.getEaseTask(t).restart({key:t,from:e,duration:i,ease:n}),this}},{key:"stopEase",value:function(t,e){void 0===e&&(e=!0);var i=this.easeTasks[t];return i&&i.stop(e),this}},{key:"stopAll",value:function(t){for(var e in void 0===t&&(t=!0),this.easeTasks)this.stopEase(e,t);return this}}]),s}(ni),gn={easeDataTo:function(t,e,i,n){return this._easeData||(this._easeData=new pn(this),function(t,e){e.on("complete",(function(e){t.emit("easedata.".concat(e,".complete"),t),t.emit("easedata.complete",e,t);}));}(this,this._easeData)),this._easeData.easeTo(t,e,i,n),this},easeDataToPromise:function(t,e,i,n){return this.easeDataTo(t,e,i,n),Li(this._easeData,"complete-".concat(t))},stopEaseData:function(t,e){return this._easeData?(this._easeData.stopEase(t,e),this):this},stopAllEaseData:function(t){return this._easeData?(this._easeData.stopAll(t),this):this}},yn=function(t,e){if(t){Ut(t).hidden=e;var i=O(t);i?i.setChildVisible(t,!e):t.setVisible(!e);}},mn={show:function(t){return void 0===t&&(t=this),function(t){yn(t,!1);}(t),this},hide:function(t){return void 0===t&&(t=this),function(t){yn(t,!0);}(t),this},isShow:function(t){return void 0===t&&(t=this),function(t){return !!t&&!Ut(t).hidden}(t)}};function kn(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var xn={exports:{}};!function(t){var e=Object.prototype.hasOwnProperty,i="~";function n(){}function r(t,e,i){this.fn=t,this.context=e,this.once=i||!1;}function s(t,e,n,s,o){if("function"!=typeof n)throw new TypeError("The listener must be a function");var a=new r(n,s||t,o),h=i?i+e:e;return t._events[h]?t._events[h].fn?t._events[h]=[t._events[h],a]:t._events[h].push(a):(t._events[h]=a,t._eventsCount++),t}function o(t,e){0==--t._eventsCount?t._events=new n:delete t._events[e];}function a(){this._events=new n,this._eventsCount=0;}Object.create&&(n.prototype=Object.create(null),(new n).__proto__||(i=!1)),a.prototype.eventNames=function(){var t,n,r=[];if(0===this._eventsCount)return r;for(n in t=this._events)e.call(t,n)&&r.push(i?n.slice(1):n);return Object.getOwnPropertySymbols?r.concat(Object.getOwnPropertySymbols(t)):r},a.prototype.listeners=function(t){var e=i?i+t:t,n=this._events[e];if(!n)return [];if(n.fn)return [n.fn];for(var r=0,s=n.length,o=new Array(s);r0){var e=t.runTransitionInCallback();t.delayCall(e,this.next,this);}else this.next();}},{key:"exit_TRANS_OPNE",value:function(){this.parent.removeDelayCall();}},{key:"next_OPEN",value:function(){return "TRANS_CLOSE"}},{key:"enter_OPEN",value:function(){this.parent.onOpen();}},{key:"exit_OPEN",value:function(){this.parent.removeDelayCall();}},{key:"next_TRANS_CLOSE",value:function(){return "CLOSE"}},{key:"enter_TRANS_CLOSE",value:function(){var t=this.parent;if(t.transitOutTime>0){var e=t.runTransitionOutCallback();t.delayCall(e,this.next,this);}else this.next();}},{key:"exit_TRANS_CLOSE",value:function(){this.parent.removeDelayCall();}},{key:"next_CLOSE",value:function(){return "TRANS_OPNE"}},{key:"enter_CLOSE",value:function(){this.parent.onClose();}},{key:"exit_CLOSE",value:function(){}},{key:"canOpen",value:function(){return "IDLE"===this.state||"CLOSE"===this.state}},{key:"canClose",value:function(){return "IDLE"===this.state||"OPEN"===this.state}}]),s}(Tn),Rn={delayCall:function(t,e,i){return this.delayCallTimer=function(t,e,i,n,r){var s=$e(t);return s.time.delayedCall(e,(function(){s.game.events.once("poststep",(function(){i.call(n,r);}));}))}(this,t,e,i),this},removeDelayCall:function(){return this.delayCallTimer&&(this.delayCallTimer.remove(!1),this.delayCallTimer=void 0),this}},Ln={setTransitInTime:function(t){return this.transitInTime=t,this},setTransitOutTime:function(t){return this.transitOutTime=t,this},setTransitInCallback:function(t){return t||(t=Qt),this.transitInCallback=t,this},setTransitOutCallback:function(t){return t||(t=Qt),this.transitOutCallback=t,this}},Mn={runTransitionInCallback:function(){return this.transitInCallback(this.parent,this.transitInTime),this.transitInTime},onOpen:function(){},requestOpen:function(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}},An={runTransitionOutCallback:function(){return this.transitOutCallback(this.parent,this.transitOutTime),this.transitOutTime},onClose:function(){this.oneShotMode&&this.parent.destroy();},requestClose:function(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}},Dn={};Object.assign(Dn,Rn,Ln,Mn,An);var jn=Phaser.Utils.Objects.GetValue,zn=function(t){r(o,t);var i=u(o);function o(t,n){var r;return e(this,o),(r=i.call(this,t,n)).setTransitInTime(jn(n,"duration.in",200)),r.setTransitOutTime(jn(n,"duration.out",200)),r.setTransitInCallback(jn(n,"transitIn")),r.setTransitOutCallback(jn(n,"transitOut")),r.oneShotMode=jn(n,"destroy",!1),r.delayCallTimer=void 0,r._state=new En(a(r),{eventEmitter:!1,initState:jn(n,"initState","IDLE")}),r.openEventData=void 0,r.closeEventData=void 0,r}return n(o,[{key:"state",get:function(){return this._state.state}},{key:"shutdown",value:function(t){this.isShutdown||(this.transitInCallback=void 0,this.transitOutCallback=void 0,this.openEventData=void 0,this.closeEventData=void 0,this.removeDelayCall(),c(s(o.prototype),"shutdown",this).call(this,t));}}]),o}(ni);Object.assign(zn.prototype,Dn);var Fn=function(t){r(o,t);var i=u(o);function o(t,n,r){var s;return e(this,o),(s=i.call(this,t,0,0,2,2,n,1)).setAlpha(r),s.setScrollFactor(0),s.boot(),s}return n(o,[{key:"boot",value:function(){this.scene.sys.events.on("prerender",this.resize,this);}},{key:"destroy",value:function(t){this.scene&&!this.ignoreDestroy&&(this.scene.sys.events.off("prerender",this.resize,this),c(s(o.prototype),"destroy",this).call(this,t));}},{key:"tint",get:function(){return this.fillColor},set:function(t){this.setFillStyle(t,this.fillAlpha);}},{key:"resize",value:function(){var t=this.scene,e=t.sys.scale.gameSize,i=t.sys.cameras.main,n=e.width,r=e.height,s=1/i.zoom,o=n/2,a=r/2,h=n*s,u=r*s;this.x===o&&this.y===a||this.setPosition(o,a),this.width===h&&this.height===u||this.setSize(h,u).setOrigin(.5);}}]),o}(Phaser.GameObjects.Rectangle),Wn=Phaser.Utils.Objects.GetValue,In=function(t){r(s,t);var i=u(s);function s(t,n){var r;return e(this,s),(r=i.call(this,t,{eventEmitter:!1})).resetFromJSON(n),r.boot(),r}return n(s,[{key:"resetFromJSON",value:function(t){return this.setHitAreaMode(Wn(t,"hitAreaMode",0)),this.setEnable(Wn(t,"enable",!0)),this.setStopMode(Wn(t,"stopAllLevels",!0)),this}},{key:"boot",value:function(){this.parent.on("pointerdown",(function(t,e,i,n){this.stopAllLevels&&n.stopPropagation();}),this).on("pointerup",(function(t,e,i,n){this.stopAllLevels&&n.stopPropagation();}),this).on("pointermove",(function(t,e,i,n){this.stopAllLevels&&n.stopPropagation();}),this).on("pointerover",(function(t,e,i,n){this.stopAllLevels&&n.stopPropagation();}),this).on("pointerout",(function(t,e){this.stopAllLevels&&e.stopPropagation();}),this);}},{key:"setHitAreaMode",value:function(t){"string"==typeof t&&(t=Xn[t]);var e=this.parent;return e.input&&e.removeInteractive(),0===t?e.setInteractive():e.setInteractive({hitArea:{},hitAreaCallback:function(){return !0}}),this}},{key:"setEnable",value:function(t){return void 0===t&&(t=!0),t?this.parent.setInteractive():this.parent.disableInteractive(),this.enable=t,this}},{key:"setStopMode",value:function(t){return void 0===t&&(t=!0),this.stopAllLevels=t,this}},{key:"toggleEnable",value:function(){return this.setEnable(!this.enable),this}}]),s}(ni),Xn={default:0,fullWindow:1},Yn=Phaser.Utils.Objects.GetValue,Bn=function(t){r(s,t);var i=u(s);function s(t,n){var r;e(this,s);var o=Yn(n,"color",0),h=Yn(n,"alpha",.8);return (r=i.call(this,t,o,h)).touchEventStop=new In(a(r),{hitAreaMode:1}),r}return n(s)}(Fn),Nn=function(t,e){void 0!==t._modalScaleSave?(t.scaleX=t._modalScaleSave,t.scaleY=t._modalScaleSave):t._modalScaleSave=t.scaleX,Ei(t,e);},Hn=function(t,e){Ri(t,e,void 0,void 0,!1);},Gn=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Bi(t,e);},Un=function(t,e){Ni(t,e,!1);},Vn=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Bi(t,e,t.alpha);},Jn=function(t,e){Ni(t,e,!1);},Kn=function(t,e,i,n,r){return !!t&&(!(n&&!n(t,e,i))&&(!!xt(t,!0).contains(e,i)&&!(r&&!r(t,e,i))))},qn=Phaser.Utils.Objects.GetValue,Zn=function(t){r(o,t);var i=u(o);function o(t,n){var r;e(this,o),void 0===n&&(n={}),null==n.transitIn&&(n.transitIn=$n.popUp),null==n.transitOut&&(n.transitOut=$n.scaleDown),n.destroy=qn(n,"destroy",!0),r=i.call(this,t,n);var s=qn(n,"cover");r.cover=!1!==s?function(t,e){var i=t.scene,n=new Bn(i,e);return i.add.existing(n),t.isRexContainerLite?(t.pin(n,{syncPosition:!1,syncRotation:!1,syncScale:!1,syncAlpha:!1,syncScrollFactor:!1}),t.moveDepthBelow(n)):i.children.moveBelow(n,t),n}(t,s):void 0,r.cover&&(r.setCoverTransitInCallback(qn(s,"transitIn",Vn)),r.setCoverTransitOutCallback(qn(s,"transitOut",Jn)));var h=qn(n,"touchOutsideClose",!1),u=qn(n,"duration.hold",-1),l=qn(n,"timeOutClose",u>=0),c=qn(n,"anyTouchClose",!1);return qn(n,"manualClose",!1)&&(h=!1,c=!1,l=!1),c&&(h=!1),l?r.setDisplayTime(u):r.setDisplayTime(-1),c?r.once("open",r.anyTouchClose,a(r)):h&&r.once("open",r.touchOutsideClose,a(r)),qn(n,"openOnStart",!0)&&r.delayCall(0,r.requestOpen,a(r)),r}return n(o,[{key:"shutdown",value:function(t){this.isShutdown||(this.cover||this.scene.input.off("pointerup",this.touchCloseCallback,this),this.cover&&!t&&(this.cover.destroy(),this.cover=void 0),c(s(o.prototype),"shutdown",this).call(this,t));}},{key:"touchOutsideClose",value:function(){return this.cover?this.cover.on("pointerup",this.touchCloseCallback,this):this.scene.input.on("pointerup",this.touchCloseCallback,this),this.clickOutsideTest=!0,this}},{key:"anyTouchClose",value:function(){return this.cover?this.cover.once("pointerup",this.touchCloseCallback,this):this.scene.input.once("pointerup",this.touchCloseCallback,this),this}},{key:"touchCloseCallback",value:function(t){this.clickOutsideTest&&Kn(this.parent,t.worldX,t.worldY)||this.requestClose();}},{key:"runTransitionInCallback",value:function(){var t=c(s(o.prototype),"runTransitionInCallback",this).call(this),e=this.cover;return e&&this.coverTransitInCallback&&this.coverTransitInCallback(e,t),t}},{key:"runTransitionOutCallback",value:function(){var t=c(s(o.prototype),"runTransitionOutCallback",this).call(this),e=this.cover;return e&&this.coverTransitOutCallback&&this.coverTransitOutCallback(e,t),t}},{key:"onOpen",value:function(){var t=this.displayTime;t>=0&&this.delayCall(t,this.requestClose,this),this.emit("open",this.parent,this),c(s(o.prototype),"onOpen",this).call(this);}},{key:"onClose",value:function(){this.emit("close",this.closeEventData),c(s(o.prototype),"onClose",this).call(this);}},{key:"setDisplayTime",value:function(t){return this.displayTime=t,this}},{key:"setTransitInCallback",value:function(t){switch("string"==typeof t&&(t=$n[t]),t){case $n.popUp:t=Nn;break;case $n.fadeIn:t=Gn;}return c(s(o.prototype),"setTransitInCallback",this).call(this,t),this}},{key:"setTransitOutCallback",value:function(t){switch("string"==typeof t&&(t=$n[t]),t){case $n.scaleDown:t=Hn;break;case $n.fadeOut:t=Un;}return c(s(o.prototype),"setTransitOutCallback",this).call(this,t),this}},{key:"setCoverTransitInCallback",value:function(t){return this.coverTransitInCallback=t,this}},{key:"setCoverTransitOutCallback",value:function(t){return this.coverTransitOutCallback=t,this}}]),o}(zn),$n={popUp:0,fadeIn:1,scaleDown:0,fadeOut:1},Qn=function(t){return t&&"function"==typeof t},tr={modal:function(t,e){return Qn(t)&&(e=t,t=void 0),void 0===this._modalBehavior&&(this.onCreateModalBehavior&&this.onCreateModalBehavior(this,t),this._modalBehavior=function(t,e){var i=new Zn(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:function(t){var e=this;return new Promise((function(i,n){e.modal(t,i);}))},modalClose:function(t){return function(t,e){t.emit("modal.requestClose",e);}(this,t),this}},er=function(t,e,i,n){if(e)return Kn(t,e.worldX,e.worldY,i,n);for(var r=t.scene.input.manager,s=r.pointersTotal,o=r.pointers,a=0;a=this.dragThreshold&&this.cancel();}},{key:"click",value:function(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 n=this.lastClickTime;return void 0!==n&&t-n<=this.clickInterval||(this.lastClickTime=t,this.emit("click",this,this.parent,e,i)),this}},{key:"cancel",value:function(){return this.pointer=void 0,this}},{key:"onOver",value:function(t,e,i,n){return this.enable?(this.emit("over",this,this.parent,t,n),this):this}},{key:"onOut",value:function(t,e){return this.enable?(this.emit("out",this,this.parent,t,e),this):this}}]),o}(ni),pr={press:0,pointerdown:0,release:1,pointerup:1},gr={onClick:function(t,e,i,n){return t?("function"==typeof t&&(n=i,i=e,e=t,t=this),void 0===t._click&&(t._click=new vr(t,n)),t._click.on("click",e,i),this):this},offClick:function(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:function(e,i){return e&&"object"!==t(e)&&(i=e,e=this),void 0===e._click||e._click.setEnable(i),this},disableClick:function(e){return e&&"object"!==t(e)&&(e=this),void 0===e._click||e._click.setEnable(!1),this}},yr=function(t,e,i,n){if(e)return !(i&&!i(t,e))&&(!!mr(t,e)&&!(n&&!n(t,e)));for(var r=t.scene.input.manager,s=r.pointersTotal,o=r.pointers,a=0;a0)return kr.length=0,!0;return kr.length=0,!1},kr=[],xr=Phaser.Utils.Objects.GetValue,br=function(t){r(o,t);var i=u(o);function o(t,n){var r;e(this,o),(r=i.call(this,t,n))._enable=void 0;var s=xr(n,"inputConfig",void 0);return s&&t.setInteractive(s),r.resetFromJSON(n),r.boot(),r}return n(o,[{key:"resetFromJSON",value:function(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}},{key:"boot",value:function(){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);}},{key:"shutdown",value:function(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,c(s(o.prototype),"shutdown",this).call(this,t);}}},{key:"enable",get:function(){return this._enable},set:function(t){if(this._enable!==t){t||this.cancel(),this._enable=t;var e=t?"enable":"disable";this.emit(e,this,this.parent);}}},{key:"setEnable",value:function(t){return void 0===t&&(t=!0),this.enable=t,this}},{key:"toggleEnable",value:function(){return this.setEnable(!this.enable),this}},{key:"setMode",value:function(t){return "string"==typeof t&&(t=wr[t]),this.mode=t,this}},{key:"setClickInterval",value:function(t){return this.clickInterval=t,this}},{key:"setDragThreshold",value:function(t){return this.dragThreshold=t,this}},{key:"isPointerInside",value:function(t){var e=this.parent;return (e.input?yr:er)(e,t)}},{key:"onPress",value:function(t){this.parent.willRender(t.camera)&&void 0===this.pointer&&(this.pointer=t,0===this.mode&&(this.isPointerInside(t)||this.click(t.downTime,t)));}},{key:"onRelease",value:function(t){this.parent.willRender(t.camera)&&this.pointer===t&&(1===this.mode&&(this.isPointerInside(t)||this.click(t.upTime,t)),this.pointer=void 0);}},{key:"onMove",value:function(t,e,i,n){this.pointer===t&&void 0!==this.dragThreshold&&1===this.mode&&(t.getDistance()>=this.dragThreshold||this.isPointerInside(t))&&this.cancel();}},{key:"click",value:function(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}},{key:"cancel",value:function(){return this.pointer=void 0,this}}]),o}(ni),wr={press:0,pointerdown:0,release:1,pointerup:1},Sr={onClickOutside:function(t,e,i,n){return t?("function"==typeof t&&(n=i,i=e,e=t,t=this),void 0===t._clickOutside&&(t._clickOutside=new br(t,n)),t._clickOutside.on("clickoutside",e,i),this):this},offClickOutside:function(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:function(e,i){return e&&"object"!==t(e)&&(i=e,e=this),void 0===e._clickOutside||e._clickOutside.setEnable(i),this},disableClickOutside:function(e){return e&&"object"!==t(e)&&(e=this),void 0===e._clickOutside||e._clickOutside.setEnable(!1),this}},Cr=function(t){r(s,t);var i=u(s);function s(){var t;return e(this,s),(t=i.call(this,{eventEmitter:!1})).goto("IDLE"),t}return n(s,[{key:"setCooldownTime",value:function(t){return this.cooldownTime=t,this.cooldownMode=void 0!==t,this}},{key:"request",value:function(){return this.runMethod("request")}},{key:"update_IDLE",value:function(){this.compensationTime=0;}},{key:"request_IDLE",value:function(){return this.next(),!0}},{key:"next_IDLE",value:function(){if(this.cooldownMode)return "COOLDOWN"}},{key:"enter_COOLDOWN",value:function(){this.remainderTime=this.cooldownTime+this.compensationTime;}},{key:"update_COOLDOWN",value:function(t,e){this.remainderTime-=e,this.remainderTime<0&&(this.compensationTime=this.cooldownTime>e?-this.remainderTime:0,this.goto("IDLE"));}},{key:"request_COOLDOWN",value:function(){return !1}}]),s}(Tn),Or=Phaser.Utils.Objects.GetValue,_r=function(t){r(o,t);var i=u(o);function o(t,n){var r;return e(this,o),(r=i.call(this,t,n))._enable=void 0,r.cooldown=new Cr,r.parent.setInteractive(Or(n,"inputConfig",void 0)),r.resetFromJSON(n),r.boot(),r}return n(o,[{key:"resetFromJSON",value:function(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}},{key:"boot",value:function(){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);}},{key:"shutdown",value:function(t){this.isShutdown||(this.scene.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,c(s(o.prototype),"shutdown",this).call(this,t));}},{key:"enable",get:function(){return this._enable},set:function(t){if(this._enable!==t)return t||(this.prevIsInTouch=!1,this.isInTouching=!1,this.pointer=void 0),this._enable=t,this}},{key:"setEnable",value:function(t){return void 0===t&&(t=!0),this.enable=t,this}},{key:"cooldownTime",get:function(){return this.cooldown.cooldownTime},set:function(t){this.cooldown.setCooldownTime(t);}},{key:"setCooldown",value:function(t){return this.cooldownTime=t,this}},{key:"toggleEnable",value:function(){return this.setEnable(!this.enable),this}},{key:"onPointIn",value:function(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.pointer=t,this.isInTouching=!0);}},{key:"onPointOut",value:function(t){this.enable&&this.pointer===t&&(this.pointer=void 0,this.isInTouching=!1);}},{key:"preupdate",value:function(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;}}]),o}(ni),Pr={isPointerInBounds:function(t){return void 0===t?t=this:"string"==typeof t&&(t=this.getElement(t)),!!t&&er(t)},onTouching:function(t,e,i,n){return t?("function"==typeof t&&(n=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new _r(t,n)),t._inTouching.on("intouch",e,i),this):this},offTouching:function(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:function(t,e,i,n){return t?("function"==typeof t&&(n=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new _r(t,n)),t._inTouching.on("touchend",e,i),this):this},offTouchingEnd:function(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:function(e,i){return e&&"object"!==t(e)&&(i=e,e=this),void 0===e._inTouching||e._inTouching.setEnable(i),this},disableTouching:function(e){return e&&"object"!==t(e)&&(e=this),void 0===e._inTouching||e._inTouching.setEnable(!1),this}},Tr=function(t,e,i){for(var n,r=0,s=t.length;r0),this.onDragStart()));}},{key:"onPointerUp",value:function(t){this.enable&&((!this.bounds||this.bounds.contains(t.x,t.y))&&this.pointer===t&&(this.pointer=void 0,this.movedState=!1,this.tracerState=Hr,this.onDragEnd()));}},{key:"onPointerMove",value:function(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()));}}},{key:"dragCancel",value:function(){return this.tracerState===Gr&&this.onDragEnd(),this.pointer=void 0,this.tracerState=Hr,this}},{key:"onDragStart",value:function(){this.emit("dragstart",this);}},{key:"onDragEnd",value:function(){this.emit("dragend",this);}},{key:"onDrag",value:function(){this.emit("drag",this);}},{key:"preUpdate",value:function(t,e){}},{key:"postUpdate",value:function(t,e){}},{key:"startTicking",value:function(){c(s(o.prototype),"startTicking",this).call(this),this.scene.sys.events.on("preupdate",this.preUpdate,this),this.scene.sys.events.on("postupdate",this.postUpdate,this);}},{key:"stopTicking",value:function(){c(s(o.prototype),"stopTicking",this).call(this),this.scene&&(this.scene.sys.events.off("preupdate",this.preUpdate,this),this.scene.sys.events.off("postupdate",this.postUpdate,this));}},{key:"setRecongizedStateObject",value:function(t){return this.recongizedState=t,this}},{key:"state",get:function(){return this.recongizedState.state},set:function(t){this.recongizedState.state=t;}},{key:"cancel",value:function(){return this.state=Ur,this}}]),o}(oi),Hr=0,Gr=1,Ur="IDLE",Vr=Phaser.Utils.Objects.GetValue,Jr=Phaser.Math.Distance.Between,Kr=function(t){r(o,t);var i=u(o);function o(t,n){var r;e(this,o);var s=a(r=i.call(this,t,n)),h={states:{IDLE:{enter:function(){s.stop(),s.tapsCount=0,s.x=0,s.y=0,s.worldX=0,s.worldY=0;},exit:function(){var t=s.lastPointer;s.x=t.x,s.y=t.y,s.worldX=t.worldX,s.worldY=t.worldY;}},BEGIN:{enter:function(){s.start(),s.tapsCount=0,s.emit("tappingstart",s,s.gameObject,s.lastPointer);}},RECOGNIZED:{enter:function(){s.start(),s.emit("tap",s,s.gameObject,s.lastPointer),s.emit("".concat(s.tapsCount,"tap"),s,s.gameObject,s.lastPointer);}}},init:function(){this.state=qr;},eventEmitter:!1};return r.setRecongizedStateObject(new Tn(h)),r}return n(o,[{key:"resetFromJSON",value:function(t){c(s(o.prototype),"resetFromJSON",this).call(this,t),this.setHoldTime(Vr(t,"time",250)),this.setTapInterval(Vr(t,"tapInterval",200)),this.setDragThreshold(Vr(t,"threshold",9)),this.setTapOffset(Vr(t,"tapOffset",10));var e=Vr(t,"taps",void 0);return void 0!==e?this.setTaps(e):(this.setMaxTaps(Vr(t,"maxTaps",void 0)),this.setMinTaps(Vr(t,"minTaps",void 0))),this}},{key:"onDragStart",value:function(){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=$r,this.state=Zr);break;case $r:this.state=Zr;}}},{key:"onDragEnd",value:function(){this.state===Zr&&(this.tapsCount++,this.emit("tapping",this,this.gameObject,this.lastPointer),void 0!==this.maxTaps&&this.tapsCount===this.maxTaps&&(this.state=$r));}},{key:"onDrag",value:function(){this.state!==qr&&this.pointer.getDistance()>this.dragThreshold&&(this.state=qr);}},{key:"preUpdate",value:function(t,e){if(this.isRunning&&this.enable&&this.state===Zr){var i=this.lastPointer;if(i.isDown)t-i.downTime>this.holdTime&&(this.state=qr);else t-i.upTime>this.tapInterval&&(void 0===this.minTaps||this.tapsCount>=this.minTaps?this.state=$r:this.state=qr);}}},{key:"postUpdate",value:function(t,e){this.isRunning&&this.enable&&this.state===$r&&(this.state=qr);}},{key:"isTapped",get:function(){return this.state===$r}},{key:"setHoldTime",value:function(t){return this.holdTime=t,this}},{key:"setTapInterval",value:function(t){return this.tapInterval=t,this}},{key:"setDragThreshold",value:function(t){return this.dragThreshold=t,this}},{key:"setTapOffset",value:function(t){return this.tapOffset=t,this}},{key:"setMaxTaps",value:function(t){return this.maxTaps=t,this}},{key:"setMinTaps",value:function(t){return this.minTaps=t,this}},{key:"setTaps",value:function(t,e){return void 0===e&&(e=t),this.setMinTaps(t).setMaxTaps(e),this}}]),o}(Nr),qr="IDLE",Zr="BEGIN",$r="RECOGNIZED",Qr=Phaser.Utils.Objects.GetValue,ts=function(t){r(o,t);var i=u(o);function o(t,n){var r;e(this,o);var s=a(r=i.call(this,t,n)),h={states:{IDLE:{enter:function(){s.x=0,s.y=0,s.worldX=0,s.worldY=0;},exit:function(){var t=s.lastPointer;s.x=t.x,s.y=t.y,s.worldX=t.worldX,s.worldY=t.worldY;}},BEGIN:{enter:function(){s.start();},exit:function(){s.stop();}},RECOGNIZED:{enter:function(){s.emit("pressstart",s,s.gameObject,s.lastPointer);},exit:function(){s.emit("pressend",s,s.gameObject,s.lastPointer);}}},init:function(){this.state=es;},eventEmitter:!1};return r.setRecongizedStateObject(new Tn(h)),r}return n(o,[{key:"resetFromJSON",value:function(t){return c(s(o.prototype),"resetFromJSON",this).call(this,t),this.setDragThreshold(Qr(t,"threshold",9)),this.setHoldTime(Qr(t,"time",251)),this}},{key:"onDragStart",value:function(){this.state=is,0===this.holdTime&&(this.state=ns);}},{key:"onDragEnd",value:function(){this.state=es;}},{key:"onDrag",value:function(){this.state!==es&&this.pointer.getDistance()>this.dragThreshold&&(this.state=es);}},{key:"preUpdate",value:function(t,e){this.isRunning&&this.enable&&(this.state===is&&t-this.pointer.downTime>=this.holdTime&&(this.state=ns));}},{key:"isPressed",get:function(){return this.state===ns}},{key:"setHoldTime",value:function(t){return this.holdTime=t,this}},{key:"setDragThreshold",value:function(t){return this.dragThreshold=t,this}}]),o}(Nr),es="IDLE",is="BEGIN",ns="RECOGNIZED";Phaser.Utils.Objects.GetValue;var rs=Phaser.Math.Distance.Between,ss=Phaser.Math.Angle.Between,os={getDt:function(){var t;return t=this.scene,ei(t).loop.delta},getVelocity:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return rs(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 ss(e.x,e.y,t.x,t.y)}},as={"up&down":0,"left&right":1,"4dir":2,"8dir":3},hs={},us=Phaser.Utils.Objects.GetValue,ls=Phaser.Math.RadToDeg,cs=function(t){r(o,t);var i=u(o);function o(t,n){var r;e(this,o);var s=a(r=i.call(this,t,n)),h={states:{IDLE:{enter:function(){s.x=0,s.y=0,s.worldX=0,s.worldY=0;},exit:function(){var t=s.lastPointer;s.x=t.x,s.y=t.y,s.worldX=t.worldX,s.worldY=t.worldY;}},BEGIN:{enter:function(){s.validDrag=!1;}},RECOGNIZED:{enter:function(){s.start(),s.updateDirectionStates(),s.emit("swipe",s,s.gameObject,s.lastPointer);},exit:function(){s.stop(),s.clearDirectionStates();}}},init:function(){this.state=ds;},eventEmitter:!1};return r.setRecongizedStateObject(new Tn(h)),r.clearDirectionStates(),r}return n(o,[{key:"resetFromJSON",value:function(t){return c(s(o.prototype),"resetFromJSON",this).call(this,t),this.setDragThreshold(us(t,"threshold",10)),this.setVelocityThreshold(us(t,"velocityThreshold",1e3)),this.setDirectionMode(us(t,"dir","8dir")),this}},{key:"onDragStart",value:function(){this.state=fs;}},{key:"onDragEnd",value:function(){this.state=ds;}},{key:"onDrag",value:function(){this.state===fs&&(this.validDrag||(this.validDrag=0===this.dragThreshold||this.pointer.getDistance()>=this.dragThreshold),this.validDrag&&this.dragVelocity>this.velocityThreshold&&(this.state=vs));}},{key:"postUpdate",value:function(t,e){this.isRunning&&this.enable&&this.state===vs&&(this.state=ds);}},{key:"isSwiped",get:function(){return this.state===vs}},{key:"dragVelocity",get:function(){var t;switch(this.dirMode){case 0:t=this.getVelocityY();break;case 1:t=this.getVelocityX();break;default:t=this.getVelocity();}return t}},{key:"setDragThreshold",value:function(t){return this.dragThreshold=t,this}},{key:"setVelocityThreshold",value:function(t){return this.velocityThreshold=t,this}},{key:"setDirectionMode",value:function(t){return "string"==typeof t&&(t=as[t]),this.dirMode=t,this}},{key:"updateDirectionStates",value:function(){return function(t,e,i){switch(void 0===i?i={}:!0===i&&(i=hs),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;}}(ls(this.getVelocityAngle()),this.dirMode,this),this}},{key:"clearDirectionStates",value:function(){return this.left=!1,this.right=!1,this.up=!1,this.down=!1,this}}]),o}(Nr);Object.assign(cs.prototype,os);var ds="IDLE",fs="BEGIN",vs="RECOGNIZED",ps=Phaser.Utils.Objects.GetValue,gs=Phaser.Utils.Array.SpliceOne,ys=Phaser.Math.Distance.Between,ms=Phaser.Math.Angle.Between,ks=function(){function t(i,n){e(this,t);var r=i.input.manager.pointersTotal-1;r<2&&i.input.addPointer(2-r),this.scene=i,this.setEventEmitter(ps(n,"eventEmitter",void 0)),this._enable=void 0,this.pointers=[],this.movedState={},this.resetFromJSON(n),this.boot();}return n(t,[{key:"resetFromJSON",value:function(t){return this.setEnable(ps(t,"enable",!0)),this.bounds=ps(t,"bounds",void 0),this.tracerState=bs,this.pointers.length=0,Rt(this.movedState),this}},{key:"boot",value:function(){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);}},{key:"shutdown",value:function(){this.scene&&(this.destroyEventEmitter(),this.pointers.length=0,Rt(this.movedState),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);}},{key:"destroy",value:function(){this.shutdown();}},{key:"enable",get:function(){return this._enable},set:function(t){if(this._enable!==t)return t||this.dragCancel(),this._enable=t,this}},{key:"setEnable",value:function(t){return void 0===t&&(t=!0),this.enable=t,this}},{key:"toggleEnable",value:function(){return this.setEnable(!this.enable),this}},{key:"onPointerDown",value:function(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.tracerState){case bs:this.tracerState=ws,this.onDrag1Start();break;case ws:this.tracerState=Ss,this.onDrag2Start();}}},{key:"onPointerUp",value:function(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],gs(this.pointers,e),this.tracerState){case ws:this.tracerState=bs,this.onDrag1End();break;case Ss:this.tracerState=ws,this.onDrag2End(),this.onDrag1Start();}}}},{key:"onPointerMove",value:function(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 ws:this.onDrag1();break;case Ss:this.onDrag2();}}}},{key:"dragCancel",value:function(){return this.tracerState===Ss&&this.onDrag2End(),this.pointers.length=0,Rt(this.movedState),this.tracerState=bs,this}},{key:"onDrag1Start",value:function(){this.emit("drag1start",this);}},{key:"onDrag1End",value:function(){this.emit("drag1end",this);}},{key:"onDrag1",value:function(){this.emit("drag1",this);}},{key:"onDrag2Start",value:function(){this.emit("drag2start",this);}},{key:"onDrag2End",value:function(){this.emit("drag2end",this);}},{key:"onDrag2",value:function(){this.emit("drag2",this);}},{key:"distanceBetween",get:function(){if(this.tracerState!==Ss)return 0;var t=this.pointers[0],e=this.pointers[1];return ys(t.x,t.y,e.x,e.y)}},{key:"angleBetween",get:function(){if(this.tracerState!==Ss)return 0;var t=this.pointers[0],e=this.pointers[1];return ms(t.x,t.y,e.x,e.y)}},{key:"drag1Vector",get:function(){var t=this.pointers[0];if(t&&this.movedState[t.id]){var e=t.position,i=t.prevPosition;xs.x=e.x-i.x,xs.y=e.y-i.y;}else xs.x=0,xs.y=0;return xs}},{key:"centerX",get:function(){if(this.tracerState!==Ss)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return (t.x+e.x)/2}},{key:"centerY",get:function(){if(this.tracerState!==Ss)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return (t.y+e.y)/2}},{key:"prevCenterX",get:function(){if(this.tracerState!==Ss)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}},{key:"prevCenterY",get:function(){if(this.tracerState!==Ss)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}},{key:"movementCenterX",get:function(){return this.centerX-this.prevCenterX}},{key:"movementCenterY",get:function(){return this.centerY-this.prevCenterY}},{key:"setRecongizedStateObject",value:function(t){return this.recongizedState=t,this}},{key:"state",get:function(){return this.recongizedState.state},set:function(t){this.recongizedState.state=t;}},{key:"cancel",value:function(){return this.state=Cs,this}}]),t}();Object.assign(ks.prototype,Ke);var xs={},bs=0,ws=1,Ss=2,Cs="IDLE";Phaser.Utils.Objects.GetValue;var Os=Phaser.Math.RotateAround,_s=function(t,e,i,n){return Os(t,e,i,n),t.rotation+=n,t},Ps={},Ts=Phaser.Utils.Objects.GetValue,Es=Phaser.Math.Angle.WrapDegrees,Rs=Phaser.Math.Angle.ShortestBetween,Ls=Phaser.Math.RadToDeg,Ms=Phaser.Math.DegToRad,As=function(t){r(o,t);var i=u(o);function o(t,n){var r;e(this,o);var s=a(r=i.call(this,t,n)),h={states:{IDLE:{enter:function(){s.prevAngle=void 0,s.angle=0;}},BEGIN:{},RECOGNIZED:{enter:function(){s.emit("rotatestart",s);},exit:function(){s.emit("rotateend",s);}}},init:function(){this.state=js;},eventEmitter:!1};return r.setRecongizedStateObject(new Tn(h)),r}return n(o,[{key:"resetFromJSON",value:function(t){return c(s(o.prototype),"resetFromJSON",this).call(this,t),this.setDragThreshold(Ts(t,"threshold",0)),this}},{key:"onDrag2Start",value:function(){this.prevAngle=Es(Ls(this.angleBetween)),this.state=zs,0===this.dragThreshold&&(this.state=Fs);}},{key:"onDrag2End",value:function(){this.state=js;}},{key:"onDrag2",value:function(){switch(this.state){case zs:if(this.pointers[0].getDistance()>=this.dragThreshold&&this.pointers[1].getDistance()>=this.dragThreshold){var t=Es(Ls(this.angleBetween));this.angle=Rs(this.prevAngle,t),this.prevAngle=t,this.state=Fs;}break;case Fs:t=Es(Ls(this.angleBetween));this.angle=Rs(this.prevAngle,t),this.prevAngle=t,this.emit("rotate",this);}}},{key:"isRotated",get:function(){return this.state===Fs}},{key:"rotation",get:function(){return Ms(this.angle)}},{key:"setDragThreshold",value:function(t){return this.dragThreshold=t,this}}]),o}(ks),Ds={spinObject:function(t,e){if(!this.isRotation)return this;void 0===e&&(e=this.pointers[0].camera);var i=this.movementCenterX,n=this.movementCenterY,r=function(t,e,i,n){return void 0===n?n={}:!0===n&&(n=Ps),i.getWorldPoint(t,e,n),n}(this.centerX,this.centerY,e,!0),s=r.x,o=r.y,a=this.rotation;if(Array.isArray(t))for(var h=t,u=0,l=h.length;u=this.sizerChildren.length?this.sizerChildren.push(e):this.sizerChildren.splice(a,0,e),e.isRexSizer||(i>0&&(0===this.orientation?e.minWidth=void 0===h?pt(e):h:e.minHeight=void 0===u?gt(e):u),s&&(0===this.orientation?e.minHeight=u:e.minWidth=h)),void 0!==o&&this.addChildrenMap(o,e),this},ro={add:no,addSpace:function(t){return this.insertSpace(void 0,t),this},insertSpace:function(t,e){return void 0===e&&(e=1),no.call(this,new Zs(this.scene),{proportion:e,minWidth:0,minHeight:0,index:t}),this},insert:function(t,e,i,n,r,s,o,a){return Qs(i)&&(i.index=t),no.call(this,e,i,n,r,s,o,t,a),this},insertAtPosition:function(t,e,i,n,r,s,o,a,h){var u=$s.call(this,t,e);return -1===u&&(u=void 0),this.insert(u,i,n,r,s,o,a,h),this}},so=Gt.prototype.clear,oo=function(t){this.backgroundChildren&&(this.backgroundChildren.length=0);var e,i=!t&&this.sizerEventsEnable;if(i&&(e=this.getChildren([])),so.call(this,t),i)for(var n,r=0,s=e.length;r=0;e--)this.remove(this.sizerChildren[e],t);return this},clear:function(t){return this.sizerChildren.length=0,oo.call(this,t),this}},uo={getChildAlign:function(t){return this.getSizerConfig(t).align},setChildAlign:function(t,e){return "string"==typeof e&&(e=$t[e]),this.getSizerConfig(t).align=e,this}},lo={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,n,r=0,s=this.sizerChildren;if(0===this.orientation)for(var o=this.space.item,a=!0,h=0,u=s.length;h0&&this.proportionLength>0&&(i=n.proportion*this.proportionLength):n.expand&&(i=e-this.space.left-this.space.right-r.left-r.right);return i},getExpandedChildHeight:function(t,e){var i;void 0===e&&(e=this.height);var n=t.rexSizer,r=n.padding;0===this.orientation?n.expand&&(i=e-this.space.top-this.space.bottom-r.top-r.bottom):n.proportion>0&&this.proportionLength>0&&(i=n.proportion*this.proportionLength);return i},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,n=0,r=i.length;n0?(e=t-this.getChildrenWidth(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0;}return t},resolveHeight:function(t){t=Ue.call(this,t);if(void 0===this.proportionLength&&1===this.orientation){var e=t-this.childrenHeight;e>0?(e=t-this.getChildrenHeight(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0;}return t}};Object.assign(lo,ro,ho,uo,{getChildProportion:function(t){return this.getSizerConfig(t).proportion},setChildProportion:function(t,e){return this.getSizerConfig(t).proportion=e,this}},{getChildExpand:function(t){return this.getSizerConfig(t).expand},setChildExpand:function(t,e){return this.getSizerConfig(t).expand=e,this}});var co=function(){for(var t,e,i=0,n=this.sizerChildren,r=0,s=n.length;r0&&(i+=e);return i},fo={x:0,h:0,horizontal:0,"left-to-right":0,y:1,v:1,vertical:1,"top-to-bottom":1},vo=Phaser.Utils.Objects.IsPlainObject,po=Phaser.Utils.Objects.GetValue,go=function(t){r(s,t);var i=u(s);function s(t,n,r,o,a,h,u){var l;return e(this,s),vo(n)?(n=po(u=n,"x",0),r=po(u,"y",0),o=po(u,"width",void 0),a=po(u,"height",void 0),h=po(u,"orientation",0)):vo(o)?(o=po(u=o,"width",void 0),a=po(u,"height",void 0),h=po(u,"orientation",0)):vo(h)&&(h=po(u=h,"orientation",0)),void 0===h&&(h=0),(l=i.call(this,t,n,r,o,a,u)).type="rexSizer",l.sizerChildren=[],l.setOrientation(h),l.setItemSpacing(po(u,"space.item",0)),l.setStartChildIndex(po(u,"startChildIndex",0)),l.setRTL(po(u,"rtl",!1)),l.addChildrenMap("items",l.sizerChildren),l}return n(s,[{key:"setOrientation",value:function(t){return this.orientation=function(t){return "string"==typeof t&&(t=fo[t]),t}(t),this}},{key:"setItemSpacing",value:function(t){return this.space.item=t,this}},{key:"setStartChildIndex",value:function(t){return this.startChildIndex=t,this}},{key:"setRTL",value:function(t){return void 0===t&&(t=!0),this.rtl=t,this}},{key:"childrenProportion",get:function(){return void 0===this._childrenProportion&&(this._childrenProportion=co.call(this)),this._childrenProportion}}]),s}(Js);Object.assign(go.prototype,lo);var yo=function(t,e,i){if(t){var n=null==e,r=null==i;return n&&r||(n||(t.displayWidth=e),r||(t.displayHeight=i),n&&(t.scaleX=t.scaleY),r&&(t.scaleY=t.scaleX)),t}},mo=function(t,e){var i;return t||0===t||(t=""),void 0===e&&(e=!0),Array.isArray(t)&&(t=t.join("\n")),(i=e?"".concat(this.text,"\n").concat(t):"".concat(this.text).concat(t))!=this.text&&this.setText(i),this},ko={appendText:mo,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 n=t.iconSize;n&&(this.setChildDisplaySize(i,n,n),void 0!==this.iconWidth&&this.setIconSize(n)),!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 s=t.actionSize;s&&(this.setChildDisplaySize(r,s,s),void 0!==this.actionWidth&&this.setActionSize(s)),!0!==t.action&&this.setActionTexture(t.action,t.actionFrame);}return this}},xo=function(t){r(o,t);var i=u(o);function o(){return e(this,o),i.apply(this,arguments)}return n(o,[{key:"text",get:function(){var t=this.childrenMap.text;return t?t.text:""},set:function(t){var e=this.childrenMap.text;e&&e.setText(t);}},{key:"setText",value:function(t){return this.text=t,this}},{key:"setIconTexture",value:function(t,e){var i=this.childrenMap.icon;return i?(i.setTexture(t,e),void 0!==this.iconWidth&&(yo(i,this.iconWidth,this.iconHeight),this.resetChildScaleState(i)),this):this}},{key:"setTexture",value:function(t,e){return this.setIconTexture(t,e),this}},{key:"setIconSize",value:function(t,e){return void 0===e&&(e=t),this.iconWidth=t,this.iconHeight=e,this}},{key:"texture",get:function(){var t=this.childrenMap.icon;if(t)return t.texture}},{key:"frame",get:function(){var t=this.childrenMap.icon;if(t)return t.frame}},{key:"setActionTexture",value:function(t,e){var i=this.childrenMap.action;return void 0===i||(i.setTexture(t,e),void 0!==this.actionWidth&&(yo(i,this.actionWidth,this.actionHeight),this.resetChildScaleState(i))),this}},{key:"actionTexture",get:function(){var t=this.childrenMap.action;if(t)return t.texture}},{key:"actionFrame",get:function(){var t=this.childrenMap.action;if(t)return t.frame}},{key:"setActionSize",value:function(t,e){return void 0===e&&(e=t),this.actionWidth=t,this.actionHeight=e,this}},{key:"preLayout",value:function(){var t=this.childrenMap.icon;t&&void 0!==this.iconWidth&&yo(t,this.iconWidth,this.iconHeight);var e=this.childrenMap.action;e&&void 0!==this.actionWidth&&yo(e,this.actionWidth,this.actionHeight),c(s(o.prototype),"preLayout",this).call(this);}},{key:"runLayout",value:function(t,e,i){if(this.ignoreLayout)return this;c(s(o.prototype),"runLayout",this).call(this,t,e,i);var n=this.childrenMap.iconMask;n&&(n.setPosition(),this.resetChildPositionState(n));var r=this.childrenMap.actionMask;return r&&(r.setPosition(),this.resetChildPositionState(r)),this}},{key:"resize",value:function(t,e){c(s(o.prototype),"resize",this).call(this,t,e);var i=this.childrenMap.iconMask;i&&i.resize();var n=this.childrenMap.actionMask;return n&&n.resize(),this}}]),o}(go);Object.assign(xo.prototype,ko);var bo=function(t,e,i,n,r){if(this.clear().fillStyle(16777215),1===this.shapeType){i=i.left;var s=Math.min(t,e)/2;this.fillCircle(-t*(n-.5),-e*(r-.5),s+i);}else this.fillRect(-t*n-i.left,-e*r-i.top,t+i.left+i.right,e+i.top+i.bottom);},wo=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},So=function(t){r(o,t);var i=u(o);function o(t,n,r){var s;return e(this,o),void 0===n&&(n=0),"string"==typeof n&&(n=Co[n]),(s=i.call(this,t.scene)).parent=t,s.shapeType=n,s.padding=Te(r),s.setPosition().resize().setVisible(!1),s}return n(o,[{key:"destroy",value:function(){return this.parent=void 0,c(s(o.prototype),"destroy",this).call(this),this}},{key:"setPosition",value:function(t,e){var i=this.parent;return void 0===t&&(t=i.x),void 0===e&&(e=i.y),c(s(o.prototype),"setPosition",this).call(this,t,e),this}},{key:"resize",value:function(t,e,i){var n=this.parent;void 0===t&&(t=n.width),void 0===e&&(e=n.height),void 0===i?i=this.padding:"number"==typeof i&&(i=Te(i));var r=this.width!==t||this.height!==e,s=this.padding!==i&&!wo(this.padding,i);return r||s?(this.width=t,this.height=e,s&&Lt(i,this.padding),this.originX=n.originX,this.originY=n.originY,bo.call(this,t,e,i,n.originX,n.originY),this):this}},{key:"setOrigin",value:function(t,e){void 0===e&&(e=t);var i=this.parent;return void 0===t&&(t=i.originX),void 0===e&&(e=i.originY),this.originX===t&&this.originY===e||(this.originX=t,this.originY=e,bo.call(this,this.width,this.height,this.padding,t,e)),this}}]),o}(Phaser.GameObjects.Graphics),Co={rectangle:0,circle:1},Oo=function(t,e,i,n){var r=new So(e,i,n);if(t&&!t.isRexSizer){var s=r.createGeometryMask();t.setMask(s),this.once("destroy",(function(){t.setMask(),s.destroy();}));}return this.pin(r),r},_o=Phaser.Utils.Objects.GetValue,Po=function(t){r(s,t);var i=u(s);function s(t,n){var r;e(this,s),(r=i.call(this,t,n)).type="rexLabel";var o=_o(n,"background",void 0),h=_o(n,"icon",void 0),u=_o(n,"iconMask",void 0),l=_o(n,"text",void 0),c=_o(n,"action",void 0),d=_o(n,"actionMask",void 0),f=_o(n,"align",void 0);if(o&&r.addBackground(o),"right"!==f&&"bottom"!==f&&"center"!==f||r.addSpace(),h){0===r.orientation?(l||c)&&(b={right:_o(n,"space.icon",0),top:_o(n,"space.iconTop",0),bottom:_o(n,"space.iconBottom",0),left:_o(n,"space.iconLeft",0)}):(l||c)&&(b={bottom:_o(n,"space.icon",0),left:_o(n,"space.iconLeft",0),right:_o(n,"space.iconRight",0),top:_o(n,"space.iconTop",0)});var v=_o(n,"squareFitIcon",!1)?1:0;if(r.add(h,{proportion:0,padding:b,fitRatio:v}),u&&(u=Oo.call(a(r),h,h,1)),!v){var p=_o(n,"iconSize",void 0);r.setIconSize(_o(n,"iconWidth",p),_o(n,"iconHeight",p));}}if(l){var g,y,m=_o(n,"space.text",0),k=_o(n,"expandTextWidth",!1),x=_o(n,"expandTextHeight",!1);0===r.orientation?(g=k?1:0,c&&(b={right:m}),y=x):(g=x?1:0,c&&(b={bottom:m}),y=k),r.add(l,{proportion:g,expand:y,padding:b});}if(c){var b;b=0===r.orientation?{top:_o(n,"space.actionTop",0),bottom:_o(n,"space.actionBottom",0),right:_o(n,"space.actionRight",0)}:{left:_o(n,"space.actionLeft",0),right:_o(n,"space.actionRight",0),bottom:_o(n,"space.actionBottom",0)};v=_o(n,"squareFitAction",!1)?1:0;if(r.add(c,{proportion:0,padding:b,fitRatio:v}),d&&(d=Oo.call(a(r),c,c,1)),!v){var w=_o(n,"actionSize");r.setActionSize(_o(n,"actionWidth",w),_o(n,"actionHeight",w));}}return "center"===f&&r.addSpace(),r.addChildrenMap("background",o),r.addChildrenMap("icon",h),r.addChildrenMap("iconMask",u),r.addChildrenMap("text",l),r.addChildrenMap("action",c),r.addChildrenMap("actionMask",d),r}return n(s)}(xo),To=function e(i){var n,r,s;if(null==i||"object"!==t(i))return i;if(n=Array.isArray(i)?[]:{},function(e){if("object"!==t(e)||e.nodeType||e===e.window)return !1;try{if(e.constructor&&!{}.hasOwnProperty.call(e.constructor.prototype,"isPrototypeOf"))return !1}catch(t){return !1}return !0}(i))for(s in i)r=i[s],n[s]=e(r);else n=i;return n},Eo=function(t){return null==t||""===t||0===t.length},Ro=function(e,i,n,r){if(void 0===r&&(r="."),"object"===t(e)){if(Eo(i)){if(null==n)return;"object"===t(n)&&(e=n);}else {"string"==typeof i&&(i=i.split(r));var s=i.pop(),o=function(e,i,n){var r=e;if(Eo(i));else {var s;"string"==typeof i&&(i=i.split("."));for(var o=0,a=i.length;o=0||t.y>=0,t.x=Math.abs(t.x),t.y=Math.abs(t.y);},zo=function(t,e,i){var n=i.length;if(n>=2){var r=i[n-2],s=i[n-1];if(t===r&&e===s)return i}return i.push(t,e),i},Fo=Phaser.Math.DegToRad,Wo=function(t,e,i,n,r,s,o,a,h){o&&s>r?s-=360:!o&&s>>16,a=(65280&r)>>>8,h=255&r;t.fillStyle="rgba("+o+","+a+","+h+","+s+")";}(r,e),r.fill()),e.isStroked&&(!function(t,e,i,n){var r=i||e.strokeColor,s=n||e.strokeAlpha,o=(16711680&r)>>>16,a=(65280&r)>>>8,h=255&r;t.strokeStyle="rgba("+o+","+a+","+h+","+s+")",t.lineWidth=e.lineWidth;}(r,e),r.stroke()),r.restore();}}},Ho=Phaser.GameObjects.Shape,Go=Phaser.Utils.Objects.IsPlainObject,Uo=Phaser.Utils.Objects.GetValue,Vo=Phaser.Geom.Polygon.Earcut,Jo=function(t){r(s,t);var i=u(s);function s(t,n,r,o,a,h,u,l){var c,d,f,v,p;if(e(this,s),Go(n)){var g=n;n=g.x,r=g.y,o=g.width,a=g.height,h=g.radius,u=g.color,l=g.alpha,d=g.strokeColor,f=g.strokeAlpha,v=g.strokeWidth,p=g.shape;}void 0===n&&(n=0),void 0===r&&(r=0),void 0===o&&(o=1),void 0===a&&(a=o),void 0===h&&(h=0),void 0===p&&(p=0);var y=new Mo;if((c=i.call(this,t,"rexRoundRectangleShape",y)).setShapeType(p),0===c.shapeType){var m=Uo(h,"radius",h);y.setTo(0,0,o,a,m);}else {m={x:o/2,y:a/2};y.setTo(0,0,o,a,m);}var k=Uo(h,"iteration",void 0);return c.setIteration(k),c.setPosition(n,r),c.setFillStyle(u,l),void 0!==d&&void 0===v&&(v=2),c.setStrokeStyle(v,d,f),c.updateDisplayOrigin(),c.dirty=!0,c}return n(s,[{key:"fillColor",get:function(){return this._fillColor},set:function(t){this._fillColor=t,this.isFilled=null!=t&&this._fillAlpha>0;}},{key:"fillAlpha",get:function(){return this._fillAlpha},set:function(t){this._fillAlpha=t,this.isFilled=t>0&&null!=this._fillColor;}},{key:"setFillStyle",value:function(t,e){return void 0===e&&(e=1),this.fillColor=t,this.fillAlpha=e,this}},{key:"strokeColor",get:function(){return this._strokeColor},set:function(t){this._strokeColor=t,this.isStroked=null!=t&&this._strokeAlpha>0&&this._lineWidth>0;}},{key:"strokeAlpha",get:function(){return this._strokeAlpha},set:function(t){this._strokeAlpha=t,this.isStroked=t>0&&null!=this._strokeColor&&this._lineWidth>0;}},{key:"lineWidth",get:function(){return this._lineWidth},set:function(t){this._lineWidth=t,this.isStroked=t>0&&null!=this._strokeColor;}},{key:"setStrokeStyle",value:function(t,e,i){return void 0===i&&(i=1),this.lineWidth=t,this.strokeColor=e,this.strokeAlpha=i,this}},{key:"updateData",value:function(){var t=this.geom,e=this.pathData;e.length=0;var i,n=t.width,r=t.height,s=t.cornerRadius,o=this.iteration+1;if(i=s.tl,Ko(i))if(i.convex){var a=i.x,h=i.y;Wo(a,h,i.x,i.y,180,270,!1,o,e);}else {Wo(a=0,h=0,i.x,i.y,90,0,!0,o,e);}else zo(0,0,e);if(i=s.tr,Ko(i))if(i.convex){a=n-i.x,h=i.y;Wo(a,h,i.x,i.y,270,360,!1,o,e);}else {Wo(a=n,h=0,i.x,i.y,180,90,!0,o,e);}else zo(n,0,e);if(i=s.br,Ko(i))if(i.convex){a=n-i.x,h=r-i.y;Wo(a,h,i.x,i.y,0,90,!1,o,e);}else {Wo(a=n,h=r,i.x,i.y,270,180,!0,o,e);}else zo(n,r,e);if(i=s.bl,Ko(i))if(i.convex){a=i.x,h=r-i.y;Wo(a,h,i.x,i.y,90,180,!1,o,e);}else {Wo(a=0,h=r,i.x,i.y,360,270,!0,o,e);}else zo(0,r,e);return e.push(e[0],e[1]),this.pathIndexes=Vo(e),this}},{key:"setShapeType",value:function(t){return "string"==typeof t&&(t=qo[t]),this.shapeType=t,this}},{key:"width",get:function(){return this.geom.width},set:function(t){this.resize(t,this.height);}},{key:"height",get:function(){return this.geom.height},set:function(t){this.resize(this.width,t);}},{key:"setSize",value:function(t,e){if(void 0===e&&(e=t),this.geom.width===t&&this.geom.height===e)return this;this.geom.setSize(t,e),1===this.shapeType&&this.setRadius({x:t/2,y:e/2}),this.updateDisplayOrigin(),this.dirty=!0;var i=this.input;return i&&!i.customHitArea&&(i.hitArea.width=t,i.hitArea.height=e),this}},{key:"resize",value:function(t,e){return this.setSize(t,e),this}},{key:"radius",get:function(){return this.geom.radius},set:function(t){this.geom.setRadius(t),this.updateDisplayOrigin(),this.dirty=!0;}},{key:"radiusTL",get:function(){return this.geom.radiusTL},set:function(t){this.geom.radiusTL=t,this.dirty=!0;}},{key:"radiusTR",get:function(){return this.geom.radiusTR},set:function(t){this.geom.radiusTR=t,this.dirty=!0;}},{key:"radiusBL",get:function(){return this.geom.radiusBL},set:function(t){this.geom.radiusBL=t,this.dirty=!0;}},{key:"radiusBR",get:function(){return this.geom.radiusBR},set:function(t){this.geom.radiusBR=t,this.dirty=!0;}},{key:"setRadius",value:function(t){return void 0===t&&(t=0),this.radius=t,this}},{key:"setRadiusTL",value:function(t){return void 0===t&&(t=0),this.radiusTL=t,this}},{key:"setRadiusTR",value:function(t){return void 0===t&&(t=0),this.radiusTR=t,this}},{key:"setRadiusBL",value:function(t){return void 0===t&&(t=0),this.radiusBL=t,this}},{key:"setRadiusBR",value:function(t){return void 0===t&&(t=0),this.radiusBR=t,this}},{key:"cornerRadius",get:function(){return this.geom.cornerRadius},set:function(t){this.radius=t;}},{key:"setCornerRadius",value:function(t){return this.setRadius(t)}},{key:"iteration",get:function(){return this._iteration},set:function(t){void 0!==this._iteration?this._iteration!==t&&(this._iteration=t,this.dirty=!0):this._iteration=t;}},{key:"setIteration",value:function(t){return void 0===t&&(t=6),this.iteration=t,this}}]),s}(Ho),Ko=function(t){return t.x>0&&t.y>0},qo={rectangle:0,circle:1};Object.assign(Jo.prototype,No);var Zo=function(t,e,i,n){if(void 0===i&&(i="."),void 0===n&&(n={}),!t)return n;if(e in t)return Object.assign(n,t[e]);for(var r in e+=i,t)r.startsWith(e)&&(n[r.replace(e,"")]=t[r]);return n},$o=function(t,e,i){if(void 0===i&&(i={}),Array.isArray(e))for(var n=0,r=e.length;n=6?(n=[arguments[2],void 0,arguments[3]],r=[arguments[4],void 0,arguments[5]]):(n=To(n),r=To(r)),this.textureKey=e,this.baseFrameName=i,this.columns.data=n,this.columns.count=n?n.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 s=this.scene.sys.textures.get(e);if(!s)return this.clear(),this;if(!n||!r)return this.clear(),this;for(var o=s.get(i),a=o.width,h=0,u=0,l=n.length;u0?0:g,x=0;u=0;for(var C=n.length;u0?0:y),y>=1&&g>=1){var O=t(m=this.getFrameNameCallback(u,w,i));"string"!==O&&"number"!==O||s.add(m,0,x+o.cutX,b+o.cutY,y,g);}x+=y;}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,n,r,s,o,a,h=this.columns.minWidth*this.maxFixedPartScaleX,u=this.rows.minHeight*this.maxFixedPartScaleY,l=this.width-h,c=this.height-u,d=l>=0?this.maxFixedPartScaleX:this.width/h,f=c>=0?this.maxFixedPartScaleY:this.height/u;if(this.preserveRatio){var v=Math.min(d,f);if(d>v){var p=(d-v)*h;l>=0?l+=p:l=p,d=v;}if(f>v){var g=(f-v)*u;c>=0?c+=g:c=g,f=v;}}this.columns.scale=d,this.rows.scale=f,e=l>0&&this.columns.stretch>0?l/this.columns.stretch:0,i=c>0&&this.rows.stretch>0?c/this.rows.stretch:0;var y=0,m=0;this._beginDraw();for(var k=0,x=this.rows.count;k0&&a>0&&(0===(0===s.stretch&&0===r.stretch||0===this.getStretchMode(b,k)?0:1)?this._drawImage(this.textureKey,n,y,m,o,a):this._drawTileSprite(this.textureKey,n,y,m,o,a)),y+=o;m+=a;}this._endDraw();},setStretchMode:function(t){return ba(t)?(this.stretchMode.edge=Sa(wa(t,"edge",0)),this.stretchMode.internal=Sa(wa(t,"internal",0))):(t=Sa(t),this.stretchMode.edge=t,this.stretchMode.internal=t),this},getStretchMode:function(t,e){return Oa.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}},Pa=Phaser.Utils.Objects.IsPlainObject,Ta=Phaser.Utils.Objects.GetValue,Ea=Phaser.GameObjects,Ra=void 0,La=function(t,e){if(Ra||(Ra={},ei(t).events.once("destroy",(function(){for(var t in Ra)Ra[t].destroy();Ra=void 0;}))),!Ra.hasOwnProperty(e)){var i=ei(t).scene.systemScene;(t=new Ea[e](i)).setOrigin(0),Ra[e]=t;}return Ra[e]},Ma=function(t){r(s,t);var i=u(s);function s(){return e(this,s),i.apply(this,arguments)}return n(s)}(function(t,i){var o=function(t){r(a,t);var o=u(a);function a(t,n,r,s,h,u,l,c,d,f){var v;if(e(this,a),Pa(n)?(n=Ta(f=n,"x",0),r=Ta(f,"y",0),s=Ta(f,"width",1),h=Ta(f,"height",1),u=Ta(f,"key",void 0),l=Ta(f,"baseFrame",void 0),c=Ta(f,"columns",void 0),d=Ta(f,"rows",void 0)):Pa(s)?(s=Ta(f=s,"width",1),h=Ta(f,"height",1),u=Ta(f,"key",void 0),l=Ta(f,"baseFrame",void 0),c=Ta(f,"columns",void 0),d=Ta(f,"rows",void 0)):Pa(u)?(u=Ta(f=u,"key",void 0),l=Ta(f,"baseFrame",void 0),c=Ta(f,"columns",void 0),d=Ta(f,"rows",void 0)):Pa(l)?(l=Ta(f=l,"baseFrame",void 0),c=Ta(f,"columns",void 0),d=Ta(f,"rows",void 0)):Array.isArray(l)?(f=d,d=c,c=l,l=Ta(f,"baseFrame",void 0)):Pa(c)&&(c=Ta(f=c,"columns",void 0),d=Ta(f,"rows",void 0)),void 0===c){var p=Ta(f,"leftWidth",void 0),g=Ta(f,"rightWidth",void 0);void 0!==p&&void 0!==g&&(c=[p,void 0,g]);}if(void 0===d){var y=Ta(f,"topHeight",void 0),m=Ta(f,"bottomHeight",void 0);void 0!==y&&void 0!==m&&(d=[y,void 0,m]);}(v=o.call(this,t)).type=i,v.setPosition(n,r).setSize(s,h).setOrigin(.5,.5),v.columns={},v.rows={},v.stretchMode={},v._tileSprite=void 0,v._image=void 0,v.setGetFrameNameCallback(Ta(f,"getFrameNameCallback",void 0)),v.setStretchMode(Ta(f,"stretchMode",0)),v.setPreserveRatio(Ta(f,"preserveRatio",!0));var k=Ta(f,"maxFixedPartScale",1),x=Ta(f,"maxFixedPartScaleX",k),b=Ta(f,"maxFixedPartScaleY",void 0);return v.setMaxFixedPartScale(x,b),v.setBaseTexture(u,l,c,d),v}return n(a,[{key:"minWidth",get:function(){return this.columns.minWidth}},{key:"minHeight",get:function(){return this.rows.minHeight}},{key:"fixedPartScaleX",get:function(){return this.columns.scale}},{key:"fixedPartScaleY",get:function(){return this.rows.scale}},{key:"resize",value:function(t,e){return this.width===t&&this.height===e||(c(s(a.prototype),"resize",this)?c(s(a.prototype),"resize",this).call(this,t,e):c(s(a.prototype),"setSize",this).call(this,t,e),this.updateTexture()),this}}]),a}(t);return Object.assign(o.prototype,_a),o}(Phaser.GameObjects.RenderTexture,"rexNinePatch")),Aa={_drawImage:function(t,e,i,n,r,s){var o=La(this,"Image").setTexture(t,e).setDisplaySize(r,s);this.draw(o,i,n);},_drawTileSprite:function(t,e,i,n,r,s){var o=La(this,"TileSprite").setTexture(t,e).setSize(r,s);this.draw(o,i,n);}};Object.assign(Ma.prototype,Aa);var Da=function(t,e){var i,n;switch(e&&(e.hasOwnProperty("type")?i=e.type:e.hasOwnProperty("leftWidth")?i="nineSlice":e.hasOwnProperty("key")&&(i="image")),i){case"image":n=new ka(t,e);break;case"nineSlice":n=e.hasOwnProperty("stretchMode")?new Ma(t,e):new pa(t,e);break;default:n=new ra(t,e);}return t.add.existing(n),n},ja=Phaser.GameObjects.Text,za=Phaser.Utils.Objects.GetValue,Fa=function(t){r(s,t);var i=u(s);function s(t,n){var r;e(this,s),void 0===n&&(n={});var o=za(n,"x",0),a=za(n,"y",0),h=za(n,"text","");return (r=i.call(this,t,o,a,h,n)).type="rexStatesText",n.style=r.style,n.onModifyStyle=function(t,e){var i=e.hasOwnProperty("fontStyle")||e.hasOwnProperty("fontSize")||e.hasOwnProperty("fontFamily");t.style.update(i);},r.addStyleManager(n),delete n.style,r}return n(s)}(ja);Object.assign(Fa.prototype,na); /** * @author Richard Davey * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Ia=Phaser.Renderer.WebGL.Utils,Wa={renderWebGL:function(t,e,i,n){if(0!==e.width&&0!==e.height){i.addToRenderList(e);var r=e.frame,s=r.width,o=r.height,a=Ia.getTintAppendFloatAlpha,h=t.pipelines.set(e.pipeline,e),l=h.setTexture2D(r.glTexture,e);t.pipelines.preBatch(e),h.batchTexture(e,r.glTexture,s,o,e.x,e.y,s/e.style.resolution,o/e.style.resolution,e.scaleX,e.scaleY,e.rotation,e.flipX,e.flipY,e.scrollFactorX,e.scrollFactorY,e.displayOriginX,e.displayOriginY,0,0,s,o,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,n,!1,l),t.pipelines.postBatch(e);}},renderCanvas:function(t,e,i,n){0!==e.width&&0!==e.height&&(i.addToRenderList(e),t.batchSprite(e,e.frame,i,n));}},Xa=Phaser.Display.Canvas.CanvasPool;m();var Ya=function(t){r(s,t);var i=l(s);function s(){return e(this,s),i.apply(this,arguments)}return n(s,[{key:"setStyle",value:function(t){return this.style.setStyle(t)}},{key:"setFont",value:function(t){return this.style.setFont(t)}},{key:"setFontFamily",value:function(t){return this.style.setFontFamily(t)}},{key:"setFontSize",value:function(t){return this.style.setFontSize(t)}},{key:"setFontStyle",value:function(t){return this.style.setFontStyle(t)}},{key:"setTestString",value:function(t){return this.style.setTestString(t)}},{key:"setFixedSize",value:function(t,e){return this.style.setFixedSize(t,e)}},{key:"setBackgroundColor",value:function(t,e,i){return this.style.setBackgroundColor(t,e,i)}},{key:"setBackgroundStrokeColor",value:function(t,e){return this.style.setBackgroundStrokeColor(t,e)}},{key:"setBackgroundCornerRadius",value:function(t,e){return this.style.setBackgroundCornerRadius(t,e)}},{key:"setFill",value:function(t){return this.style.setFill(t)}},{key:"setColor",value:function(t){return this.style.setColor(t)}},{key:"setStroke",value:function(t,e){return this.style.setStroke(t,e)}},{key:"setShadow",value:function(t,e,i,n,r,s){return this.style.setShadow(t,e,i,n,r,s)}},{key:"setShadowOffset",value:function(t,e){return this.style.setShadowOffset(t,e)}},{key:"setShadowColor",value:function(t){return this.style.setShadowColor(t)}},{key:"setShadowBlur",value:function(t){return this.style.setShadowBlur(t)}},{key:"setShadowStroke",value:function(t){return this.style.setShadowStroke(t)}},{key:"setShadowFill",value:function(t){return this.style.setShadowFill(t)}},{key:"setWrapMode",value:function(t){return this.style.setWrapMode(t)}},{key:"setWrapWidth",value:function(t){return this.style.setWrapWidth(t)}},{key:"setWordWrapWidth",value:function(t){return this.style.setWrapWidth(t)}},{key:"setAlign",value:function(t){return this.style.setHAlign(t)}},{key:"setHAlign",value:function(t){return this.style.setHAlign(t)}},{key:"setVAlign",value:function(t){return this.style.setVAlign(t)}},{key:"setLineSpacing",value:function(t){return this.style.setLineSpacing(t)}},{key:"lineSpacing",get:function(){return this.style.lineSpacing},set:function(t){this.setLineSpacing(t);}},{key:"setXOffset",value:function(t){return this.style.setXOffset(t)}},{key:"setMaxLines",value:function(t){return this.style.setMaxLines(t)}},{key:"setResolution",value:function(t){return this.style.setResolution(t)}},{key:"getTextMetrics",value:function(){return this.style.getTextMetrics()}},{key:"setTextMetrics",value:function(t,e){return this.style.setTextMetrics(t,e)}},{key:"measureTextMargins",value:function(t,e){return function(t,e,i){void 0===i&&(i={});var n=Xa.create(this),r=n.getContext("2d",{willReadFrequently:!0});t.syncFont(n,r);var s=r.measureText(e),o=Math.ceil(s.width*t.baselineX),a=o,h=2*a;if(a=a*t.baselineY|0,n.width=o,n.height=h,r.fillStyle="#f00",r.fillRect(0,0,o,h),r.font=t._font,r.textBaseline="alphabetic",r.fillStyle="#000",r.fillText(t.testString,0,a),i.left=0,0===o||0===h||!r.getImageData(0,0,o,h))return Xa.remove(n),i;for(var l=r.getImageData(0,0,o,h).data,u=!1,c=0;ch;u--){for(c=0;c0&&this.wrapMode!==Za&&0===this.wrapWidth}},{key:"setStyle",value:function(t,e,i){if(void 0===e&&(e=!0),void 0===i&&(i=!1),t&&t.hasOwnProperty("wrap")){var n=t.wrap;if(n.hasOwnProperty("mode")){var r=n.mode;"string"==typeof r&&(n.mode=rh[r]);}else n.hasOwnProperty("width")&&(n.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 s=this.propertyMap;for(var o in s){var a=s[o],h=a[0],l=i?a[1]:this[o],u=a[2];if("wrapCallback"===o||"wrapCallbackScope"===o)this[o]=ih(t,h,l);else {var c=eh(t,h,l);u&&(c=u(c)),this[o]=c;}}var d=ih(t,"font",null);this._font=null===d?this.fontStyle+" "+this.fontSize+" "+this.fontFamily:d;var f=ih(t,"fill",null);null!==f&&(this.color=Ha(f));var v=ih(t,"metrics",!1);return v?this.metrics={ascent:ih(v,"ascent",0),descent:ih(v,"descent",0),fontSize:ih(v,"fontSize",0)}:!e&&this.metrics||(this.metrics=Va(this)),e?this.parent.updateText():this.parent}},{key:"syncFont",value:function(t,e){e.font=this._font;}},{key:"syncStyle",value:function(t,e){e.textBaseline="alphabetic",e.fillStyle=this.color,e.strokeStyle=this.stroke,e.lineWidth=this.strokeThickness,e.lineCap="round",e.lineJoin="round";}},{key:"syncShadow",value:function(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);}},{key:"update",value:function(t){return t&&(this._font="".concat(this.fontStyle," ").concat(this.fontSize," ").concat(this.fontFamily).trim(),this.metrics=Va(this)),this.parent.updateText(t)}},{key:"buildFont",value:function(){var t="".concat(this.fontStyle," ").concat(this.fontSize," ").concat(this.fontFamily).trim();return t!==this._font&&(this._font=t),this}},{key:"setFont",value:function(t){return "string"==typeof t?(this.fontFamily=t,this.fontSize="",this.fontStyle=""):(this.fontFamily=ih(t,"fontFamily","Courier"),this.fontSize=ih(t,"fontSize","16px"),this.fontStyle=ih(t,"fontStyle","")),this.update(!0)}},{key:"setFontFamily",value:function(t){return this.fontFamily=t,this.update(!0)}},{key:"setFontStyle",value:function(t){return this.fontStyle=t,this.update(!0)}},{key:"setFontSize",value:function(t){return "number"==typeof t&&(t=t.toString()+"px"),this.fontSize=t,this.update(!0)}},{key:"setTestString",value:function(t){return this.testString=t,this.update(!0)}},{key:"setFixedSize",value:function(t,e){return this.fixedWidth=t,this.fixedHeight=e,t&&(this.parent.width=t),e&&(this.parent.height=e),this.update(this.isWrapFitMode)}},{key:"setResolution",value:function(t){return this.resolution=t,this.update(!1)}},{key:"setLineSpacing",value:function(t){return this.lineSpacing=t,this.update(!1)}},{key:"setXOffset",value:function(t){return this.xOffset=t,this.update(!1)}},{key:"setBackgroundColor",value:function(t,e,i){return void 0===i&&(i=!0),this.backgroundColor=Ha(t,this.parent.canvas,this.parent.context),this.backgroundColor2=Ha(e,this.parent.canvas,this.parent.context),this.backgroundHorizontalGradient=i,this.update(!1)}},{key:"setBackgroundStrokeColor",value:function(t,e){return this.backgroundStrokeColor=Ha(t,this.parent.canvas,this.parent.context),this.backgroundStrokeLineWidth=e,this.update(!1)}},{key:"setBackgroundCornerRadius",value:function(t,e){return this.backgroundCornerRadius=t,this.backgroundCornerIteration=e,this.update(!1)}},{key:"setFill",value:function(t){return this.color=Ha(t,this.parent.canvas,this.parent.context),this.update(!1)}},{key:"setColor",value:function(t){return this.color=Ha(t,this.parent.canvas,this.parent.context),this.update(!1)}},{key:"setStroke",value:function(t,e){return void 0===t?this.strokeThickness=0:(void 0===e&&(e=this.strokeThickness),this.stroke=Ha(t,this.parent.canvas,this.parent.context),this.strokeThickness=e),this.update(!0)}},{key:"setShadow",value:function(t,e,i,n,r,s){return void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i="#000"),void 0===n&&(n=0),void 0===r&&(r=!1),void 0===s&&(s=!0),this.shadowOffsetX=t,this.shadowOffsetY=e,this.shadowColor=Ha(i,this.parent.canvas,this.parent.context),this.shadowBlur=n,this.shadowStroke=r,this.shadowFill=s,this.update(!1)}},{key:"setShadowOffset",value:function(t,e){return void 0===t&&(t=0),void 0===e&&(e=t),this.shadowOffsetX=t,this.shadowOffsetY=e,this.update(!1)}},{key:"setShadowColor",value:function(t){return void 0===t&&(t="#000"),this.shadowColor=Ha(t,this.parent.canvas,this.parent.context),this.update(!1)}},{key:"setShadowBlur",value:function(t){return void 0===t&&(t=0),this.shadowBlur=t,this.update(!1)}},{key:"setShadowStroke",value:function(t){return this.shadowStroke=t,this.update(!1)}},{key:"setShadowFill",value:function(t){return this.shadowFill=t,this.update(!1)}},{key:"setUnderline",value:function(t,e,i){return void 0===t&&(t="#000"),void 0===e&&(e=0),void 0===i&&(i=0),this.underlineColor=Ha(t,this.parent.canvas,this.parent.context),this.underlineThickness=e,this.underlineOffset=i,this.update(!1)}},{key:"setUnderlineColor",value:function(t){return void 0===t&&(t="#000"),this.underlineColor=Ha(t,this.parent.canvas,this.parent.context),this.update(!1)}},{key:"setUnderlineThickness",value:function(t){return void 0===t&&(t=0),this.underlineThickness=t,this.update(!1)}},{key:"setUnderlineOffset",value:function(t){return void 0===t&&(t=0),this.underlineOffset=t,this.update(!1)}},{key:"setStrikethrough",value:function(t,e,i){return void 0===t&&(t="#000"),void 0===e&&(e=0),void 0===i&&(i=0),this.strikethroughColor=Ha(t,this.parent.canvas,this.parent.context),this.strikethroughThickness=e,this.strikethroughOffset=i,this.update(!1)}},{key:"setStrikethroughColor",value:function(t){return void 0===t&&(t="#000"),this.strikethroughColor=Ha(t,this.parent.canvas,this.parent.context),this.update(!1)}},{key:"setStrikethroughThickness",value:function(t){return void 0===t&&(t=0),this.strikethroughThickness=t,this.update(!1)}},{key:"setStrikethroughOffset",value:function(t){return void 0===t&&(t=0),this.strikethroughOffset=t,this.update(!1)}},{key:"setWrapMode",value:function(t){return "string"==typeof t&&(t=rh[t.toLowerCase()]||0),this.wrapMode=t,this.update(!0)}},{key:"setWrapWidth",value:function(t){return this.wrapWidth=t,this.update(!1)}},{key:"setAlign",value:function(t,e){return void 0===t&&(t="left"),void 0===e&&(e="top"),this.halign=t,this.valign=e,this.update(!1)}},{key:"setHAlign",value:function(t){return void 0===t&&(t="left"),this.halign=t,this.update(!1)}},{key:"setVAlign",value:function(t){return void 0===t&&(t="top"),this.valign=t,this.update(!1)}},{key:"setMaxLines",value:function(t){return void 0===t&&(t=0),this.maxLines=t,this.update(!1)}},{key:"getTextMetrics",value:function(){var t=this.metrics;return {ascent:t.ascent,descent:t.descent,fontSize:t.fontSize}}},{key:"setTextMetrics",value:function(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=ih(e,"fontFamily",this.fontFamily),this.fontSize=ih(e,"fontSize",this.fontSize),this.fontStyle=ih(e,"fontStyle",this.fontStyle))),this.parent.updateText(!0)}},{key:"lineHeight",get:function(){return this.metrics.fontSize+this.strokeThickness+this.lineSpacing}},{key:"toJSON",value:function(){var t={},e=this.propertyMap;for(var i in e)t[i]=this[i];return t.metrics=this.getTextMetrics(),t}},{key:"destroy",value:function(){this.parent=void 0;}}]),t}(),rh={none:Za,word:$a,char:Qa,character:Qa},sh=Phaser.Math.DegToRad,oh=function(t){return !t.hasOwnProperty("convex")||t.convex},ah=function(t){return t.x>0&&t.y>0},hh=function(t,e,i,n,r,s,o,a,h){if(a&&o>s?o-=360:!a&&o=f?1:n/f,g=r>=v?1:r/v,y=d.cornerRadius;t.save(),t.beginPath(),t.translate(e,i),a=y.tl,ah(a)?(h=a.x*p,l=a.y*g,oh(a)?hh(t,h,l,h,l,180,270,!1,o):hh(t,0,0,h,l,90,0,!0,o),u=0,c=l):(t.lineTo(0,0),u=0,c=0),a=y.tr,ah(a)?(h=a.x*p,l=a.y*g,oh(a)?hh(t,n-h,l,h,l,270,360,!1,o):hh(t,n,0,h,l,180,90,!0,o)):t.lineTo(n,0),a=y.br,ah(a)?(h=a.x*p,l=a.y*g,oh(a)?hh(t,n-h,r-l,h,l,0,90,!1,o):hh(t,n,r,h,l,270,180,!0,o)):t.lineTo(n,r),a=y.bl,ah(a)?(h=a.x*p,l=a.y*g,oh(a)?hh(t,h,r-l,h,l,90,180,!1,o):hh(t,0,r,h,l,360,270,!0,o)):t.lineTo(0,r),t.lineTo(u,c),t.closePath(),t.restore();}(e,i,n,r,s,o,d),null!=a){var f;if(null!=u)(f=c?e.createLinearGradient(0,0,r,0):e.createLinearGradient(0,0,0,s)).addColorStop(0,a),f.addColorStop(1,u),a=f;e.fillStyle=a,e.fill();}null!=h&&l>0&&(e.strokeStyle=h,e.lineWidth=l,e.stroke());},uh=function(t,e,i,n,r,s,o,a){if(null!=e||null!=i){var h=t.canvas.width,l=t.canvas.height;null==i&&(n=0);var u=n/2;h=Math.max(1,h-n),l=Math.max(1,l-n),lh(t.canvas,t.context,u,u,h,l,r,e,i,n,s,o,a);}},ch={draw:function(t,e,i,n){var r=this.penManager;this.hitAreaManager.clear();var s=this.context;s.save();var o=this.defaultStyle;this.clear(),uh(this,o.backgroundColor,o.backgroundStrokeColor,o.backgroundStrokeLineWidth,o.backgroundCornerRadius,o.backgroundColor2,o.backgroundHorizontalGradient,o.backgroundCornerIteration),t+=this.startXOffset,e+=this.startYOffset;var a,h,l,u,c,d,f=o.halign,v=o.valign,p=o.lineHeight,g=r.lines,y=g.length,m=o.maxLines;m>0&&y>m?(h=m,l="center"===v?Math.floor((y-h)/2):"bottom"===v?y-h:0):(h=y,l=0),u=l+h;var k=this.rtl,x=k?this.parent.width:void 0;d="center"===v?Math.max((n-h*p)/2,0):"bottom"===v?Math.max(n-h*p-2,0):0,d+=e;for(var b=l;b0&&t.width>0){var a=i+o.underlineOffset-o.underlineThickness/2;this.drawLine(e,a,t.width,o.underlineThickness,o.underlineColor);}if(t.isTextPen&&this.drawText(e,i,t.text,o),t.isImagePen&&this.drawImage(e,i,t.prop.img,o),o.strikethroughThickness>0&&t.width>0){a=i+o.strikethroughOffset-o.strikethroughThickness/2;this.drawLine(e,a,t.width,o.strikethroughThickness,o.strikethroughColor);}if(s.restore(),t.hasAreaMarker&&t.width>0){var h,l=t.prop.area;if(l)h={key:l};else {var u=t.prop.url;h={key:"url:".concat(u),url:u};}this.hitAreaManager.add(e,i-this.startYOffset,t.width,this.defaultStyle.lineHeight,h);}},clear:function(){var t=this.canvas;this.context.clearRect(0,0,t.width,t.height);},drawLine:function(t,e,i,n,r){this.autoRound&&(t=Math.round(t),e=Math.round(e));var s=this.context,o=s.lineCap;s.lineCap="butt",s.strokeStyle=r,s.lineWidth=n,s.beginPath(),s.moveTo(t,e),s.lineTo(t+i,e),s.stroke(),s.lineCap=o;},drawText:function(t,e,i,n){this.autoRound&&(t=Math.round(t),e=Math.round(e));var r=this.context;n.stroke&&"none"!==n.stroke&&n.strokeThickness>0&&(n.syncShadow(r,n.shadowStroke),r.strokeText(i,t,e)),n.color&&"none"!==n.color&&(n.syncShadow(r,n.shadowFill),r.fillText(i,t,e));},drawImage:function(t,e,i,n){e-=this.startYOffset,this.parent.imageManager.draw(i,this.context,t,e,this.autoRound);}},dh=Phaser.Utils.Objects.GetValue,fh=Ja,vh=Ka,ph=function(){function t(i){e(this,t),this.prop={},this.resetFromJSON(i);}return n(t,[{key:"resetFromJSON",value:function(t){this.text=dh(t,"text",""),this.x=dh(t,"x",0),this.y=dh(t,"y",0),this.width=dh(t,"width",0);var e=dh(t,"prop",null);null===e&&(e={}),this.prop=e,this.newLineMode=dh(t,"newLineMode",0),this.startIndex=dh(t,"startIndex",0);}},{key:"plainText",get:function(){var t=this.text;return this.newLineMode===vh&&(t+="\n"),t}},{key:"wrapText",get:function(){var t=this.text;return this.newLineMode!==fh&&(t+="\n"),t}},{key:"rawTextLength",get:function(){var t=this.text.length;return this.newLineMode===vh&&(t+=1),t}},{key:"endIndex",get:function(){return this.startIndex+this.rawTextLength}},{key:"lastX",get:function(){return this.x+this.width}},{key:"isTextPen",get:function(){return ""!==this.text}},{key:"isImagePen",get:function(){return !!this.prop.img}},{key:"hasAreaMarker",get:function(){return !!this.prop.area||!!this.prop.url}}]),t}(),gh=Phaser.Utils.Objects.GetFastValue,yh=Ja,mh=qa,kh=function(){function t(i){e(this,t),this.pens=[],this.lines=[],this.maxLinesWidth=void 0,this.pensPool=i.pensPool,this.linesPool=i.linesPool,this.tagToText=gh(i,"tagToText",Qt),this.tagToTextScope=gh(i,"tagToTextScope",void 0);}return n(t,[{key:"destroy",value:function(){this.clear(),this.tagToText=void 0,this.tagToTextScope=void 0;}},{key:"clear",value:function(){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}},{key:"getLineEndIndex",value:function(t){t>=this.lines.length&&(t=this.lines.length-1);var e,i,n=!1;for(e=t;e>=0&&!(n=null!=(i=this.lines[e])&&i.length>0);e--);return n?i[i.length-1].endIndex:0}},{key:"getLineWidth",value:function(t){var e=this.lines[t];if(!e)return 0;var i=e[e.length-1];return null==i?0:i.lastX}},{key:"getMaxLineWidth",value:function(){if(void 0!==this.maxLinesWidth)return this.maxLinesWidth;for(var t,e=0,i=0,n=this.lines.length;ie&&(e=t);return this.maxLinesWidth=e,e}},{key:"getLineWidths",value:function(){for(var t=[],e=0,i=this.lines.length;e=t&&h<=e||(o=o.substring(t-a,e-a)),this.tagToTextScope?c+=this.tagToText.call(this.tagToTextScope,o,l,u):c+=this.tagToText(o,l,u),u=l,!(h>=e)));d++);return c}},{key:"length",get:function(){return this.lines.length},set:function(t){this.clear();}}]),t}(),xh={},bh=function(){function t(){e(this,t),this.items=[];}return n(t,[{key:"destroy",value:function(){this.clear(),this.items=void 0;}},{key:"pop",value:function(){return this.items.length>0?this.items.pop():null}},{key:"push",value:function(t){return this.items.push(t),this}},{key:"pushMultiple",value:function(t){return this.items.push.apply(this.items,t),t.length=0,this}},{key:"clear",value:function(){return this.items.length=0,this}}]),t}(),wh=Phaser.Geom.Rectangle,Sh=new bh,Ch=function(){function t(){e(this,t),this.hitAreas=[];}return n(t,[{key:"destroy",value:function(){this.clear();}},{key:"clear",value:function(){for(var t=0,e=this.hitAreas.length;tr){""!==C?a.push(o.getLine(C,O,Lh)):0===P&&s>0&&a.push(o.getLine("",0,Lh)),a.push.apply(a,v(t(x,i,Dh,r,0,o)));var E=a.pop();C=E.text,O=E.width,o.freeLine(E)," "===C&&(C="",O=0);}else (S=O+b)>l?(a.push(o.getLine(C,O,Lh)),C=x,O=b,l=r):(C+=x,O=S),w&&a.push(o.getLine(C,O,u));}return a},Fh=Phaser.Utils.Objects.GetValue,Ih=Za,Wh=Ja,Xh=function(){function t(i){e(this,t),this.parent=i.parent,this.scene=this.parent.scene,this.context=Fh(i,"context",null),this.canvas=this.context.canvas,this.parser=Fh(i,"parser",null),this.defaultStyle=Fh(i,"style",null),this.autoRound=!0,this.pensPool=i.pensPool,this.linesPool=i.linesPool,this.wrapTextLinesPool=i.wrapTextLinesPool,this.penManager=this.newPenManager(),this._tmpPenManager=null,this.hitAreaManager=new Ch,this.lastHitAreaKey=null,this.urlTagCursorStyle=null;var n=this.context;this.getTextWidth=function(t){return n.measureText(t).width};}return n(t,[{key:"destroy",value:function(){this.parent=void 0,this.scene=void 0,this.context=void 0,this.canvas=void 0,this.parser=void 0,this.defaultStyle=void 0,this.penManager&&(this.penManager.destroy(),this.penManager=void 0),this._tmpPenManager&&(this._tmpPenManager.destroy(),this._tmpPenManager=void 0),this.hitAreaManager&&(this.hitAreaManager.destroy(),this.hitAreaManager=void 0),this.pensPool=void 0,this.linesPool=void 0,this.wrapTextLinesPool=void 0;}},{key:"updatePenManager",value:function(t,e,i,n,r){if(void 0===r&&(r=this.penManager),r.clear(),""===t)return r;var s=this.parent.style;if(s.isWrapFitMode){var o=this.parent.padding;i=s.fixedWidth-o.left-o.right;}for(var a,h,l,u,c,d=this.canvas,f=this.context,v=function(t){return f.measureText(t).width},p=0,g=0,y=s.wrapCallback,m=s.wrapCallbackScope,k=!0,x=this.parser.splitText(t),b=this.wrapTextLinesPool,w=0,S=x.length;w0&&e!==Ih&&i0&&t>e&&(t=e),t}},{key:"linesWidth",get:function(){return Math.ceil(this.penManager.getMaxLineWidth())}},{key:"linesHeight",get:function(){var t=this.desplayLinesCount,e=this.defaultStyle.lineHeight*t;return t>0&&(e-=this.defaultStyle.lineSpacing),e}},{key:"imageManager",get:function(){return this.parent.imageManager}},{key:"rtl",get:function(){return this.parent.style.rtl}},{key:"newPenManager",value:function(){return new kh({pensPool:this.pensPool,linesPool:this.linesPool,tagToText:this.parser.propToTagText,tagToTextScope:this.parser})}},{key:"tmpPenManager",get:function(){return null===this._tmpPenManager&&(this._tmpPenManager=this.newPenManager()),this._tmpPenManager}},{key:"getPlainText",value:function(t,e,i){var n;if(null==t)n=this.penManager.plainText;else {var r=this.parser.splitText(t,1);n="";for(var s=0,o=r.length;si.width?i.width-r:0;var s=this.drawY+this.drawTLY,o=s+this.height;return e=s<0?0-s:o>i.height?i.height-o:0,i._textOX+=t,i._textOY+=e,this}};Object.assign(su,Kl);var ou=Phaser.Math.DegToRad,au=Phaser.Math.RadToDeg,hu=Phaser.Utils.Objects.GetValue,lu=function(t){r(s,t);var i=l(s);function s(t,n){var r;return e(this,s),(r=i.call(this,t,n)).renderable=!0,r.scrollFactorX=1,r.scrollFactorY=1,r.toLocalPosition=!0,r.originX=0,r.offsetX=0,r.offsetY=0,r}return n(s,[{key:"visible",get:function(){return this._visible},set:function(t){this.setDirty(this._visible!=t),this._visible=t;}},{key:"setVisible",value:function(t){return void 0===t&&(t=!0),this.visible=t,this}},{key:"alpha",get:function(){return this._alpha},set:function(t){this.setDirty(this._alpha!=t),this._alpha=t;}},{key:"setAlpha",value:function(t){return this.alpha=t,this}},{key:"x",get:function(){return this._x},set:function(t){this.setDirty(this._x!=t),this._x=t;}},{key:"setX",value:function(t){return this.x=t,this}},{key:"y",get:function(){return this._y},set:function(t){this.setDirty(this._y!=t),this._y=t;}},{key:"setY",value:function(t){return this.y=t,this}},{key:"setPosition",value:function(t,e){return this.x=t,this.y=e,this}},{key:"setInitialPosition",value:function(t,e){return this.x0=t,this.y0=e,this}},{key:"setScrollFactorX",value:function(t){return this.scrollFactorX=t,this}},{key:"setScrollFactorY",value:function(t){return this.scrollFactorY=t,this}},{key:"setScrollFactor",value:function(t,e){return void 0===e&&(e=t),this.scrollFactorX=t,this.scrollFactorY=e,this}},{key:"rotation",get:function(){return this._rotation},set:function(t){this.setDirty(this._rotation!=t),this._rotation=t;}},{key:"setRotation",value:function(t){return this.rotation=t,this}},{key:"angle",get:function(){return au(this._rotation)},set:function(t){this.rotation=ou(t);}},{key:"setAngle",value:function(t){return this.angle=t,this}},{key:"scaleX",get:function(){return this._scaleX},set:function(t){this.setDirty(this._scaleX!==t),this._scaleX=t;}},{key:"setScaleX",value:function(t){return this.scaleX=t,this}},{key:"width",get:function(){return 0},set:function(t){}},{key:"setWidth",value:function(t,e){return void 0===e&&(e=!1),this.width=t,e&&(this.scaleY=this.scaleX),this}},{key:"leftSpace",get:function(){return this._leftSpace},set:function(t){this.setDirty(this._leftSpace!==t),this._leftSpace=t;}},{key:"setLeftSpace",value:function(t){return this.leftSpace=t,this}},{key:"rightSpace",get:function(){return this._rightSpace},set:function(t){this.setDirty(this._rightSpace!==t),this._rightSpace=t;}},{key:"setRightSpace",value:function(t){return this.rightSpace=t,this}},{key:"outerWidth",get:function(){return this.width+this.leftSpace+this.rightSpace}},{key:"scaleY",get:function(){return this._scaleY},set:function(t){this.setDirty(this._scaleY!==t),this._scaleY=t;}},{key:"setScaleY",value:function(t){return this.scaleY=t,this}},{key:"height",get:function(){return 0},set:function(t){}},{key:"setHeight",value:function(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}},{key:"setScale",value:function(t,e){return void 0===e&&(e=t),this.scaleX=t,this.scaleY=e,this}},{key:"setOrigin",value:function(t){return this.originX=t,this}},{key:"setAlign",value:function(t){return this.align=t,this}},{key:"modifyPorperties",value:function(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=hu(t,"width",void 0),i=hu(t,"height",void 0),n=hu(t,"scaleX",void 0),r=hu(t,"scaleY",void 0);return void 0!==e?void 0===i&&void 0===r?this.setWidth(e,!0):this.setWidth(e):void 0!==n&&this.setScaleX(n),void 0!==i?void 0===e&&void 0===n?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}},{key:"setDrawBelowCallback",value:function(t){return this.drawBelowCallback=t,this}},{key:"setDrawAboveCallback",value:function(t){return this.drawAboveCallback=t,this}},{key:"reset",value:function(){return this.setVisible().setAlpha(1).setPosition(0,0).setRotation(0).setScale(1,1).setLeftSpace(0).setRightSpace(0).setOrigin(0).setAlign().setDrawBelowCallback().setDrawAboveCallback(),this}},{key:"willRender",get:function(){return this.visible&&this.alpha>0}},{key:"drawX",get:function(){var t=this.x+this.leftSpace+this.offsetX-this.originX*this.width;return this.parent._textOX*this.scrollFactorX+t}},{key:"drawY",get:function(){var t=this.y+this.offsetY;return this.parent._textOY*this.scrollFactorY+t}},{key:"drawTLX",get:function(){return 0}},{key:"drawTLY",get:function(){return 0}},{key:"drawBLX",get:function(){return 0}},{key:"drawBLY",get:function(){return 0}},{key:"drawTRX",get:function(){return 0}},{key:"drawTRY",get:function(){return 0}},{key:"drawBRX",get:function(){return 0}},{key:"drawBRY",get:function(){return 0}},{key:"drawCenterX",get:function(){return (this.drawTRX+this.drawTLX)/2}},{key:"drawCenterY",get:function(){return (this.drawBLY+this.drawTLY)/2}}]),s}(Nl);Object.assign(lu.prototype,su);var uu=function(t,e,i){return e.hasOwnProperty(t)?e[t]:i[t]},cu=Phaser.Utils.Objects.GetValue,du=function(t){r(o,t);var i=l(o);function o(t,n){var r;return e(this,o),(r=i.call(this,t,"background")).setScrollFactor(0),r.setColor(cu(n,"color",null),cu(n,"color2",null),cu(n,"horizontalGradient",!0)),r.setStroke(cu(n,"stroke",null),cu(n,"strokeThickness",2)),r.setCornerRadius(cu(n,"cornerRadius",0),cu(n,"cornerIteration",null)),r}return n(o,[{key:"color",get:function(){return this._color},set:function(t){t=Ha(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t;}},{key:"color2",get:function(){return this._color2},set:function(t){t=Ha(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t;}},{key:"horizontalGradient",get:function(){return this._horizontalGradient},set:function(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t;}},{key:"setColor",value:function(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}},{key:"stroke",get:function(){return this._stroke},set:function(t){t=Ha(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t;}},{key:"strokeThickness",get:function(){return this._strokeThickness},set:function(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t;}},{key:"setStroke",value:function(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}},{key:"cornerRadius",get:function(){return this._cornerRadius},set:function(t){this.setDirty(this._cornerRadius!=t),this._cornerRadius=t;}},{key:"cornerIteration",get:function(){return this._cornerIteration},set:function(t){this.setDirty(this._cornerIteration!=t),this._cornerIteration=t;}},{key:"modifyStyle",value:function(t){return t.hasOwnProperty("color")&&this.setColor(t.color,uu("color2",t,this),uu("horizontalGradient",t,this)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,uu("strokeThickness",t,this)),t.hasOwnProperty("cornerRadius")&&this.setCornerRadius(t.cornerRadius,uu("cornerIteration",t,this)),this}},{key:"modifyPorperties",value:function(t){return c(s(o.prototype),"modifyPorperties",this).call(this,t),this.modifyStyle(t),this}},{key:"setCornerRadius",value:function(t,e){return this.cornerRadius=t,this.cornerIteration=e,this}},{key:"renderContent",value:function(){uh(this.parent,this.color,this.stroke,this.strokeThickness,this.cornerRadius,this.color2,this.horizontalGradient,this.cornerIteration);}}]),o}(lu),fu=Phaser.Utils.Objects.GetValue,vu=function(t){r(o,t);var i=l(o);function o(t,n){var r;return e(this,o),(r=i.call(this,t,"innerbounds")).setScrollFactor(0),r.setColor(fu(n,"color",null),fu(n,"color2",null),fu(n,"horizontalGradient",!0)),r.setStroke(fu(n,"stroke",null),fu(n,"strokeThickness",2)),r}return n(o,[{key:"color",get:function(){return this._color},set:function(t){t=Ha(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t;}},{key:"color2",get:function(){return this._color2},set:function(t){t=Ha(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t;}},{key:"horizontalGradient",get:function(){return this._horizontalGradient},set:function(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t;}},{key:"setColor",value:function(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}},{key:"stroke",get:function(){return this._stroke},set:function(t){t=Ha(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t;}},{key:"strokeThickness",get:function(){return this._strokeThickness},set:function(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t;}},{key:"setStroke",value:function(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}},{key:"modifyPorperties",value:function(t){c(s(o.prototype),"modifyPorperties",this).call(this,t),t.hasOwnProperty("color")&&this.setColor(t.color,fu(t,"color2",null),fu(t,"horizontalGradient",!0)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,fu(t,"strokeThickness",2));}},{key:"renderContent",value:function(){var t=this.parent.padding,e=t.left,i=t.top,n=this.parent.width-t.left-t.right,r=this.parent.height-t.top-t.bottom,s=this.context;if(null!=this.color){var o,a;if(null!=this.color2)(a=this.horizontalGradient?s.createLinearGradient(0,0,n,0):s.createLinearGradient(0,0,0,r)).addColorStop(0,this.color),a.addColorStop(1,this.color2),o=a;else o=this.color;s.fillStyle=o,s.fillRect(e,i,n,r);}null!=this.stroke&&this.strokeThickness>0&&(s.strokeStyle=this.stroke,s.lineWidth=this.strokeThickness,s.strokeRect(e,i,n,r));}}]),o}(lu),pu=Phaser.Utils.Objects.GetValue,gu=function(){function t(i,n){e(this,t),this.parent=i,this.set(n);}return n(t,[{key:"toJSON",value:function(){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}}},{key:"set",value:function(t){return this.setBold(pu(t,"bold",!1)),this.setItalic(pu(t,"italic",!1)),this.setFontSize(pu(t,"fontSize","16px")),this.setFontFamily(pu(t,"fontFamily","Courier")),this.setColor(pu(t,"color","#fff")),this.setStrokeStyle(pu(t,"stroke",null),pu(t,"strokeThickness",0)),this.setShadow(pu(t,"shadowColor",null),pu(t,"shadowOffsetX",0),pu(t,"shadowOffsetY",0),pu(t,"shadowBlur",0)),this.setOffset(pu(t,"offsetX",0),pu(t,"offsetY",0)),this.setSpace(pu(t,"leftSpace",0),pu(t,"rightSpace",0)),this.setAlign(pu(t,"align",void 0)),this.setBackgroundColor(pu(t,"backgroundColor",null)),this.setBackgroundHeight(pu(t,"backgroundHeight",void 0)),this.setBackgroundBottomY(pu(t,"backgroundBottomY",void 0)),this}},{key:"modify",value:function(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(uu("stroke",t,this),uu("strokeThickness",t,this)),t.hasOwnProperty("shadowColor")&&this.setShadowColor(t.shadowColor),(t.hasOwnProperty("shadowOffsetX")||t.hasOwnProperty("shadowOffsetY"))&&this.setShadowOffset(uu("shadowOffsetX",t,this),uu("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}},{key:"setUpdateTextFlag",value:function(){return this.parent&&(this.parent.updateTextFlag=!0),this}},{key:"clone",value:function(){return new t(null,this.toJSON())}},{key:"copyFrom",value:function(t){return this.set(t.toJSON()),this}},{key:"copyTo",value:function(t){return t.set(this.toJSON()),this}},{key:"setBold",value:function(t){return void 0===t&&(t=!0),this.bold=t,this.setUpdateTextFlag(),this}},{key:"setItalic",value:function(t){return void 0===t&&(t=!0),this.italic=t,this.setUpdateTextFlag(),this}},{key:"fontStyle",get:function(){return this.bold&&this.italic?"bold italic":this.bold?"bold":this.italic?"italic":""}},{key:"setFontSize",value:function(t){return "number"==typeof t&&(t="".concat(t,"px")),this.fontSize=t,this.setUpdateTextFlag(),this}},{key:"setFontFamily",value:function(t){return this.fontFamily=t,this.setUpdateTextFlag(),this}},{key:"font",get:function(){return "".concat(this.fontStyle," ").concat(this.fontSize," ").concat(this.fontFamily)}},{key:"setColor",value:function(t){return this.color=Ha(t),this}},{key:"hasFill",get:function(){return null!=this.color}},{key:"setStrokeStyle",value:function(t,e){return this.stroke=Ha(t),void 0!==e&&(this.strokeThickness=e),this}},{key:"setStrokeThickness",value:function(t){return this.strokeThickness=t,this}},{key:"hasStroke",get:function(){return null!=this.stroke&&this.strokeThickness>0}},{key:"setShadowColor",value:function(t){return this.shadowColor=Ha(t),this}},{key:"setShadowOffset",value:function(t,e){return void 0===t&&(t=0),void 0===e&&(e=0),this.shadowOffsetX=t,this.shadowOffsetY=e,this}},{key:"setShadowBlur",value:function(t){return void 0===t&&(t=0),this.shaodwBlur=t,this}},{key:"setShadow",value:function(t,e,i,n){return this.setShadowColor(t).setShadowOffset(e,i).setShadowBlur(n),this}},{key:"setBackgroundColor",value:function(t){return this.backgroundColor=Ha(t),this}},{key:"hasBackgroundColor",get:function(){return null!=this.backgroundColor}},{key:"setBackgroundHeight",value:function(t){return this.backgroundHeight=t,this}},{key:"setBackgroundBottomY",value:function(t){return this.backgroundBottomY=t,this}},{key:"setOffsetX",value:function(t){return void 0===t&&(t=0),this.offsetX=t,this}},{key:"setOffsetY",value:function(t){return void 0===t&&(t=0),this.offsetY=t,this}},{key:"setOffset",value:function(t,e){return this.setOffsetX(t).setOffsetY(e),this}},{key:"setLeftSpace",value:function(t){return void 0===t&&(t=0),this.leftSpace=t,this}},{key:"setRightSpace",value:function(t){return void 0===t&&(t=0),this.rightSpace=t,this}},{key:"setSpace",value:function(t,e){return this.setLeftSpace(t).setRightSpace(e),this}},{key:"setAlign",value:function(t){return this.align=t,this}},{key:"syncFont",value:function(t){return t.font=this.font,this}},{key:"syncStyle",value:function(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}},{key:"syncShadow",value:function(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);}},{key:"getTextMetrics",value:function(t,e){return this.syncFont(t).syncStyle(t),t.measureText(e)}}]),t}(),yu=Phaser.Utils.Array.Remove,mu=Phaser.Utils.Array.Remove,ku="text",xu="image",bu="drawer",wu="space",Su="command",Cu=function(t){return t.type===ku&&"\n"===t.text},Ou=function(t){return t.type===ku&&"\f"===t.text},_u=function(t){return t.type===ku},Pu=function(t){r(o,t);var i=l(o);function o(t,n,r){var s;return e(this,o),(s=i.call(this,t,ku)).updateTextFlag=!1,s.style=new gu(a(s),r),s.setText(n),s}return n(o,[{key:"autoRound",get:function(){return this.parent.autoRound}},{key:"offsetX",get:function(){return this.style.offsetX},set:function(t){this.style&&(this.style.offsetX=t);}},{key:"offsetY",get:function(){return this.style.offsetY},set:function(t){this.style&&(this.style.offsetY=t);}},{key:"leftSpace",get:function(){return this.style.leftSpace*this.scaleX},set:function(t){this.style&&(this.style.leftSpace=t),f(s(o.prototype),"leftSpace",t,this,!0);}},{key:"rightSpace",get:function(){return this.style.rightSpace*this.scaleX},set:function(t){this.style&&(this.style.rightSpace=t),f(s(o.prototype),"rightSpace",t,this,!0);}},{key:"align",get:function(){return this.style.align},set:function(t){this.style&&(this.style.align=t);}},{key:"modifyStyle",value:function(t){return this.setDirty(!0),this.style.modify(t),this.updateTextFlag&&this.updateTextSize(),this}},{key:"modifyPorperties",value:function(t){return t?(this.modifyStyle(t),c(s(o.prototype),"modifyPorperties",this).call(this,t),this):this}},{key:"setText",value:function(t){return this.setDirty(this.text!=t),this.text=t,this.updateTextSize(),this}},{key:"updateTextSize",value:function(){var t=this.text;if("\n"===t||"\f"===t||""===t)this.clearTextSize();else {var e,i,n=this.style.getTextMetrics(this.context,this.text);this.textWidth=n.width,"actualBoundingBoxAscent"in n?(e=n.actualBoundingBoxAscent,i=n.actualBoundingBoxDescent):(e=0,i=0),this.textHeight=e+i,this.ascent=e,this.descent=i;}return this.updateTextFlag=!1,this}},{key:"clearTextSize",value:function(){return this.textWidth=0,this.textHeight=0,this.ascent=0,this.descent=0,this}},{key:"copyTextSize",value:function(t){return this.textWidth=t.textWidth,this.textHeight=t.textHeight,this.ascent=t.ascent,this.descent=t.descent,this}},{key:"width",get:function(){return this.textWidth*this.scaleX},set:function(t){this.textWidth>0?this.scaleX=t/this.textWidth:this.scaleX=1;}},{key:"height",get:function(){return this.textHeight*this.scaleY},set:function(t){this.textHeight>0?this.scaleY=t/this.textHeight:this.scaleY=1;}},{key:"willRender",get:function(){return 0!==this.textWidth&&c(s(o.prototype),"willRender",this)}},{key:"renderContent",value:function(){var t=this.context,e=this.style;if(e.hasBackgroundColor){t.fillStyle=e.backgroundColor;var i=this.drawTLX,n=this.drawTRX-i,r=e.backgroundBottomY;null==r&&(r=this.drawBLY);var s=e.backgroundHeight;null==s&&(s=r-this.drawTLY);var o=r-s;t.fillRect(i,o,n,s);}var a=e.hasFill,h=e.hasStroke;(a||h)&&(e.syncFont(t).syncStyle(t),h&&(e.syncShadow(t),t.strokeText(this.text,0,0)),a&&(e.syncShadow(t),t.fillText(this.text,0,0)));}},{key:"drawTLX",get:function(){return -this.leftSpace}},{key:"drawTLY",get:function(){return -this.ascent}},{key:"drawBLX",get:function(){return -this.leftSpace}},{key:"drawBLY",get:function(){return this.descent}},{key:"drawTRX",get:function(){return this.textWidth+this.rightSpace}},{key:"drawTRY",get:function(){return -this.ascent}},{key:"drawBRX",get:function(){return this.textWidth+this.rightSpace}},{key:"drawBRY",get:function(){return this.descent}}]),o}(lu),Tu=function(t,e){var i=this.createCharChildren(t,e);return this.addChild(i),this},Eu=function(t){r(s,t);var i=l(s);function s(t,n,r){var o;return e(this,s),(o=i.call(this,t,xu)).setTexture(n,r),o}return n(s,[{key:"frameWidth",get:function(){return this.frameObj?this.frameObj.cutWidth:0}},{key:"frameHeight",get:function(){return this.frameObj?this.frameObj.cutHeight:0}},{key:"offsetY",get:function(){return -this.height},set:function(t){}},{key:"key",get:function(){return this._key},set:function(t){this.setDirty(this._key!=t),this._key=t;}},{key:"frame",get:function(){return this._frame},set:function(t){this.setDirty(this._frame!=t),this._frame=t;}},{key:"setTexture",value:function(t,e){return this.key=t,this.frame=e,this.frameObj=this.scene.sys.textures.getFrame(t,e),this}},{key:"width",get:function(){return this.frameWidth*this.scaleX},set:function(t){this.setDirty(this.width!==t),this.scaleX=t/this.frameWidth;}},{key:"height",get:function(){return this.frameHeight*this.scaleY},set:function(t){this.setDirty(this.height!==t),this.scaleY=t/this.frameHeight;}},{key:"setHeight",value:function(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}},{key:"renderContent",value:function(){var t=this.context,e=this.frameObj,i=this.frameWidth,n=this.frameHeight;t.drawImage(e.source.image,e.cutX,e.cutY,i,n,0,0,i,n);}},{key:"drawTLX",get:function(){return -this.leftSpace}},{key:"drawTLY",get:function(){return 0}},{key:"drawBLX",get:function(){return -this.leftSpace}},{key:"drawBLY",get:function(){return this.frameHeight}},{key:"drawTRX",get:function(){return this.frameWidth+this.rightSpace}},{key:"drawTRY",get:function(){return 0}},{key:"drawBRX",get:function(){return this.frameWidth+this.rightSpace}},{key:"drawBRY",get:function(){return this.frameHeight}}]),s}(lu),Ru=function(t){r(o,t);var i=l(o);function o(t,n,r,s){var a;return e(this,o),(a=i.call(this,t,bu)).setRenderCallback(n),a.setDrawerSize(r,s),a}return n(o,[{key:"setRenderCallback",value:function(t){return t?this.renderContent=t.bind(this):delete this.renderContent,this}},{key:"setDrawerSize",value:function(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}},{key:"onFree",value:function(){c(s(o.prototype),"onFree",this).call(this),this.setRenderCallback();}},{key:"width",get:function(){return this.drawerWidth*this.scaleX},set:function(t){this.setDirty(this.width!==t),this.scaleX=this.drawerWidth>0?t/this.drawerWidth:1;}},{key:"height",get:function(){return this.drawerHeight*this.scaleY},set:function(t){this.setDirty(this.height!==t),this.scaleY=this.drawerHeight>0?t/this.drawerHeight:1;}},{key:"offsetY",get:function(){return -this.height},set:function(t){}},{key:"drawTLX",get:function(){return -this.leftSpace}},{key:"drawTLY",get:function(){return 0}},{key:"drawBLX",get:function(){return -this.leftSpace}},{key:"drawBLY",get:function(){return this.drawerHeight}},{key:"drawTRX",get:function(){return this.drawerWidth+this.rightSpace}},{key:"drawTRY",get:function(){return 0}},{key:"drawBRX",get:function(){return this.drawerWidth+this.rightSpace}},{key:"drawBRY",get:function(){return this.drawerHeight}}]),o}(lu),Lu=function(t){r(s,t);var i=l(s);function s(t,n){var r;return e(this,s),(r=i.call(this,t,wu)).setSpaceWidth(n),r}return n(s,[{key:"width",get:function(){return this.spaceWidth*this.scaleX},set:function(t){this.spaceWidth>0?this.scaleX=t/this.spaceWidth:this.scaleX=1;}},{key:"setSpaceWidth",value:function(t){return this.spaceWidth=t,this}}]),s}(lu),Mu=function(t){r(o,t);var i=l(o);function o(t,n,r,s,a){var h;return e(this,o),(h=i.call(this,t,Su)).setName(n).setParameter(s).setCallback(r,a),h}return n(o,[{key:"setName",value:function(t){return this.name=t,this}},{key:"setParameter",value:function(t){return this.param=t,this}},{key:"setCallback",value:function(t,e){return this.callback=t,this.scope=e,this}},{key:"exec",value:function(){return this.scope?this.callback.call(this.scope,this.param,this.name):this.callback(this.param,this.name)}},{key:"onFree",value:function(){c(s(o.prototype),"onFree",this).call(this),this.setName().setCallback().setParameter();}}]),o}(Nl),Au=function(t,e,i,n){void 0===n&&(n={word:[],width:0}),n.word.length=0;for(var r=t.length,s=e,o=n.word,a=0;s0&&!a){var h=this.fixedHeight-n;if(i>0)s=h/i;else s=(l=zu.call(this)).height,o=l.ascent,i=Math.floor((h-o)/s);}else {var l;s=(l=zu.call(this)).height,o=l.ascent;}}else if(this.fixedHeight>0){if(void 0===(i=Iu(t,"maxLines"))){h=this.fixedHeight-n;i=Math.floor(h/s);}}else i=Iu(t,"maxLines",0);void 0===o&&(o=s);var u=0===i,c=Iu(t,"wrapWidth",void 0);void 0===c&&(c=this.fixedWidth>0?this.fixedWidth-r:1/0);for(var d=Iu(t,"letterSpacing",0),f=Iu(t,"hAlign",0),v=Iu(t,"vAlign",0),p=Iu(t,"charWrap",!1),g={callback:"runWordWrap",start:e,isLastPage:!1,padding:this.wrapPadding,ascent:o,lineHeight:s,maxLines:i,wrapWidth:c,letterSpacing:d,hAlign:f,vAlign:v,charWrap:p,children:[],lines:[],maxLineWidth:0,linesHeight:0},y=this.children,m=0,k=y.length;m0&&(T.push({children:E,width:R}),L=Math.max(L,R)),g.start+=P.length,g.isLastPage=!M&&g.start===_,g.maxLineWidth=L,g.linesHeight=T.length*s;var W=this.fixedWidth>0?this.fixedWidth:g.maxLineWidth+r,X=this.fixedHeight>0?this.fixedHeight:g.linesHeight+n;!function(t,e,i){var n,r,s=t.hAlign,o=t.vAlign,a=t.linesHeight;switch(o){case 1:case"center":r=(i-a)/2;break;case 2:case"bottom":r=i-a;break;default:r=0;}for(var h=t.lines,l=0,u=h.length;l0?(o=this.fixedWidth-r)/i:0;else if(this.fixedWidth>0){if(void 0===(i=Yu(t,"maxLines",void 0))){var o=this.fixedWidth-r;i=Math.floor(o/s)+1;}}else i=Yu(t,"maxLines",0);var a=0===i,h=Yu(t,"fixedChildHeight",void 0);if(void 0===h){var l=Yu(t,"charPerLine",void 0);if(void 0!==l){var u=this.fixedHeight-n;h=Math.floor(u/l);}}var c=Yu(t,"wrapHeight",void 0);void 0===c&&(c=this.fixedHeight>0?this.fixedHeight-n:1/0);for(var d=Yu(t,"letterSpacing",0),f=Yu(t,"rtl",!0),v=Yu(t,"hAlign",f?2:0),p=Yu(t,"vAlign",0),g={callback:"runVerticalWrap",start:e,isLastPage:!1,padding:this.wrapPadding,lineWidth:s,maxLines:i,fixedChildHeight:h,wrapHeight:c,letterSpacing:d,hAlign:v,vAlign:p,rtl:f,children:[],lines:[],maxLineHeight:0,linesWidth:0},y=this.children,m=0,k=y.length;m0&&(T.push({children:E,height:R}),L=Math.max(L,R)),g.start+=P.length,g.isLastPage=g.start===_,g.maxLineHeight=L,g.linesWidth=T.length*s;var F=this.fixedWidth>0?this.fixedWidth:g.linesWidth+r,I=this.fixedHeight>0?this.fixedHeight:g.maxLineHeight+n;!function(t,e,i){var n,r,s=t.hAlign,o=t.vAlign,a=t.rtl,h=t.lines,l=t.lineWidth,u=t.linesWidth;switch(s){case 1:case"center":n=(e-u)/2;break;case 2:case"right":n=e-u;break;default:n=0;}a&&(n+=l);for(var c=0,d=h.length;c0?t:this.width,e>0?e:this.height),this):this},setPadding:function(t,e){var i=this.padding,n=i.left,r=i.right,s=i.top,o=i.bottom;return Ne(i,t,e),this.dirty=this.dirty||n!=i.left||r!=i.right||s!=i.top||o!=i.bottom,this},getPadding:function(t){return Be(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),yu(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 mu(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,n,r,s=Array.isArray(t);void 0===e||e===this.children.length?s?(i=this.children).push.apply(i,v(t)):this.children.push(t):s?(n=this.children).splice.apply(n,[e,0].concat(v(t))):this.children.splice(e,0,t);(this.lastAppendedChildren.length=0,s)?(r=this.lastAppendedChildren).push.apply(r,v(t)):this.lastAppendedChildren.push(t);return this},createCharChild:function(t,e){e&&this.textStyle.modify(e);var i=this.poolManager.allocate(ku);return null===i?i=new Pu(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=[],n=0,r=t.length;ne&&(n=e,r=t);})),r},getCharWorldPosition:function(t,e,i,n){return "number"==typeof t&&(t=this.getCharChild(t,!0)),ru(this,t,e,i,n)},setToMinSize:function(){for(var t=this.children,e=0,i=0,n=0,r=t.length;n=i.length&&(t=i.length);for(var n=0,r=0;r=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!=n&&(r=e.getCharChild(n))&&("\n"===r.text&&r.copyTextSize(e.lastInsertCursor),r.scrollTo(),e.emit("cursorin",r,n,e)),e.emit("movecursor",n,t.prevCursorPosition,e),t.prevCursorPosition=n;}}(this)):(Dc(this),jc(this)),this}},{key:"setNumberInput",value:function(){return this.onUpdateCallback=Ac,this}},{key:"setSelectAllWhenFocusEnable",value:function(t){return void 0===t&&(t=!0),this.selectAllWhenFocus=t,this}}]),s}(Mc),Ic=Phaser.Utils.Objects.GetValue,Wc=["inputType","onOpen","onFocus","onClose","onBlur","onUpdate","enterClose","readOnly","maxLength","minLength","selectAll"],Xc=function(t,e){if(t&&"number"!=typeof t){if(t.hasOwnProperty(e))return !0;if(-1!==e.indexOf(".")){for(var i=e.split("."),n=t,r=0;rt.length?i:t})),l.value=t.join(c);}else l.value=t.join(i.slice(a,a+l.count));a+=l.count,l.added||(h+=l.count);}}var d=e[o-1];return o>1&&"string"==typeof d.value&&(d.added||d.removed)&&t.equals("",d.value)&&(e[o-2].value+=d.value,e.pop()),e}Hc.prototype={diff:function(t,e){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=i.callback;"function"==typeof i&&(n=i,i={}),this.options=i;var r=this;function s(t){return n?(setTimeout((function(){n(void 0,t);}),0),!0):t}t=this.castInput(t),e=this.castInput(e),t=this.removeEmpty(this.tokenize(t));var o=(e=this.removeEmpty(this.tokenize(e))).length,a=t.length,h=1,l=o+a;i.maxEditLength&&(l=Math.min(l,i.maxEditLength));var u=[{newPos:-1,components:[]}],c=this.extractCommon(u[0],e,t,0);if(u[0].newPos+1>=o&&c+1>=a)return s([{value:this.join(e),count:e.length}]);function d(){for(var i=-1*h;i<=h;i+=2){var n=void 0,l=u[i-1],c=u[i+1],d=(c?c.newPos:0)-i;l&&(u[i-1]=void 0);var f=l&&l.newPos+1=o&&d+1>=a)return s(Gc(r,n.components,e,t,r.useLongestToken));u[i]=n;}else u[i]=void 0;}var p;h++;}if(n)!function t(){setTimeout((function(){if(h>l)return n();d()||t();}),0);}();else for(;h<=l;){var f=d();if(f)return f}},pushComponent:function(t,e,i){var n=t[t.length-1];n&&n.added===e&&n.removed===i?t[t.length-1]={count:n.count+1,added:e,removed:i}:t.push({count:1,added:e,removed:i});},extractCommon:function(t,e,i,n){for(var r=e.length,s=i.length,o=t.newPos,a=o-n,h=0;o+1h;l--){for(c=0;c0&&this.wrapMode!==Za&&0===this.wrapWidth}},{key:"setStyle",value:function(t,e,i){if(void 0===e&&(e=!0),void 0===i&&(i=!1),t&&t.hasOwnProperty("wrap")){var n=t.wrap;if(n.hasOwnProperty("mode")){var r=n.mode;"string"==typeof r&&(n.mode=rh[r]);}else n.hasOwnProperty("width")&&(n.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 s=this.propertyMap;for(var o in s){var a=s[o],h=a[0],u=i?a[1]:this[o],l=a[2];if("wrapCallback"===o||"wrapCallbackScope"===o)this[o]=ih(t,h,u);else {var c=eh(t,h,u);l&&(c=l(c)),this[o]=c;}}var d=ih(t,"font",null);this._font=null===d?this.fontStyle+" "+this.fontSize+" "+this.fontFamily:d;var f=ih(t,"fill",null);null!==f&&(this.color=Ha(f));var v=ih(t,"metrics",!1);return v?this.metrics={ascent:ih(v,"ascent",0),descent:ih(v,"descent",0),fontSize:ih(v,"fontSize",0)}:!e&&this.metrics||(this.metrics=Va(this)),e?this.parent.updateText():this.parent}},{key:"syncFont",value:function(t,e){e.font=this._font;}},{key:"syncStyle",value:function(t,e){e.textBaseline="alphabetic",e.fillStyle=this.color,e.strokeStyle=this.stroke,e.lineWidth=this.strokeThickness,e.lineCap="round",e.lineJoin="round";}},{key:"syncShadow",value:function(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);}},{key:"update",value:function(t){return t&&(this._font="".concat(this.fontStyle," ").concat(this.fontSize," ").concat(this.fontFamily).trim(),this.metrics=Va(this)),this.parent.updateText(t)}},{key:"buildFont",value:function(){var t="".concat(this.fontStyle," ").concat(this.fontSize," ").concat(this.fontFamily).trim();return t!==this._font&&(this._font=t),this}},{key:"setFont",value:function(t){return "string"==typeof t?(this.fontFamily=t,this.fontSize="",this.fontStyle=""):(this.fontFamily=ih(t,"fontFamily","Courier"),this.fontSize=ih(t,"fontSize","16px"),this.fontStyle=ih(t,"fontStyle","")),this.update(!0)}},{key:"setFontFamily",value:function(t){return this.fontFamily=t,this.update(!0)}},{key:"setFontStyle",value:function(t){return this.fontStyle=t,this.update(!0)}},{key:"setFontSize",value:function(t){return "number"==typeof t&&(t=t.toString()+"px"),this.fontSize=t,this.update(!0)}},{key:"setTestString",value:function(t){return this.testString=t,this.update(!0)}},{key:"setFixedSize",value:function(t,e){return this.fixedWidth=t,this.fixedHeight=e,t&&(this.parent.width=t),e&&(this.parent.height=e),this.update(this.isWrapFitMode)}},{key:"setResolution",value:function(t){return this.resolution=t,this.update(!1)}},{key:"setLineSpacing",value:function(t){return this.lineSpacing=t,this.update(!1)}},{key:"setXOffset",value:function(t){return this.xOffset=t,this.update(!1)}},{key:"setBackgroundColor",value:function(t,e,i){return void 0===i&&(i=!0),this.backgroundColor=Ha(t,this.parent.canvas,this.parent.context),this.backgroundColor2=Ha(e,this.parent.canvas,this.parent.context),this.backgroundHorizontalGradient=i,this.update(!1)}},{key:"setBackgroundStrokeColor",value:function(t,e){return this.backgroundStrokeColor=Ha(t,this.parent.canvas,this.parent.context),this.backgroundStrokeLineWidth=e,this.update(!1)}},{key:"setBackgroundCornerRadius",value:function(t,e){return this.backgroundCornerRadius=t,this.backgroundCornerIteration=e,this.update(!1)}},{key:"setFill",value:function(t){return this.color=Ha(t,this.parent.canvas,this.parent.context),this.update(!1)}},{key:"setColor",value:function(t){return this.color=Ha(t,this.parent.canvas,this.parent.context),this.update(!1)}},{key:"setStroke",value:function(t,e){return void 0===t?this.strokeThickness=0:(void 0===e&&(e=this.strokeThickness),this.stroke=Ha(t,this.parent.canvas,this.parent.context),this.strokeThickness=e),this.update(!0)}},{key:"setShadow",value:function(t,e,i,n,r,s){return void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i="#000"),void 0===n&&(n=0),void 0===r&&(r=!1),void 0===s&&(s=!0),this.shadowOffsetX=t,this.shadowOffsetY=e,this.shadowColor=Ha(i,this.parent.canvas,this.parent.context),this.shadowBlur=n,this.shadowStroke=r,this.shadowFill=s,this.update(!1)}},{key:"setShadowOffset",value:function(t,e){return void 0===t&&(t=0),void 0===e&&(e=t),this.shadowOffsetX=t,this.shadowOffsetY=e,this.update(!1)}},{key:"setShadowColor",value:function(t){return void 0===t&&(t="#000"),this.shadowColor=Ha(t,this.parent.canvas,this.parent.context),this.update(!1)}},{key:"setShadowBlur",value:function(t){return void 0===t&&(t=0),this.shadowBlur=t,this.update(!1)}},{key:"setShadowStroke",value:function(t){return this.shadowStroke=t,this.update(!1)}},{key:"setShadowFill",value:function(t){return this.shadowFill=t,this.update(!1)}},{key:"setUnderline",value:function(t,e,i){return void 0===t&&(t="#000"),void 0===e&&(e=0),void 0===i&&(i=0),this.underlineColor=Ha(t,this.parent.canvas,this.parent.context),this.underlineThickness=e,this.underlineOffset=i,this.update(!1)}},{key:"setUnderlineColor",value:function(t){return void 0===t&&(t="#000"),this.underlineColor=Ha(t,this.parent.canvas,this.parent.context),this.update(!1)}},{key:"setUnderlineThickness",value:function(t){return void 0===t&&(t=0),this.underlineThickness=t,this.update(!1)}},{key:"setUnderlineOffset",value:function(t){return void 0===t&&(t=0),this.underlineOffset=t,this.update(!1)}},{key:"setStrikethrough",value:function(t,e,i){return void 0===t&&(t="#000"),void 0===e&&(e=0),void 0===i&&(i=0),this.strikethroughColor=Ha(t,this.parent.canvas,this.parent.context),this.strikethroughThickness=e,this.strikethroughOffset=i,this.update(!1)}},{key:"setStrikethroughColor",value:function(t){return void 0===t&&(t="#000"),this.strikethroughColor=Ha(t,this.parent.canvas,this.parent.context),this.update(!1)}},{key:"setStrikethroughThickness",value:function(t){return void 0===t&&(t=0),this.strikethroughThickness=t,this.update(!1)}},{key:"setStrikethroughOffset",value:function(t){return void 0===t&&(t=0),this.strikethroughOffset=t,this.update(!1)}},{key:"setWrapMode",value:function(t){return "string"==typeof t&&(t=rh[t.toLowerCase()]||0),this.wrapMode=t,this.update(!0)}},{key:"setWrapWidth",value:function(t){return this.wrapWidth=t,this.update(!1)}},{key:"setAlign",value:function(t,e){return void 0===t&&(t="left"),void 0===e&&(e="top"),this.halign=t,this.valign=e,this.update(!1)}},{key:"setHAlign",value:function(t){return void 0===t&&(t="left"),this.halign=t,this.update(!1)}},{key:"setVAlign",value:function(t){return void 0===t&&(t="top"),this.valign=t,this.update(!1)}},{key:"setMaxLines",value:function(t){return void 0===t&&(t=0),this.maxLines=t,this.update(!1)}},{key:"getTextMetrics",value:function(){var t=this.metrics;return {ascent:t.ascent,descent:t.descent,fontSize:t.fontSize}}},{key:"setTextMetrics",value:function(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=ih(e,"fontFamily",this.fontFamily),this.fontSize=ih(e,"fontSize",this.fontSize),this.fontStyle=ih(e,"fontStyle",this.fontStyle))),this.parent.updateText(!0)}},{key:"lineHeight",get:function(){return this.metrics.fontSize+this.strokeThickness+this.lineSpacing}},{key:"toJSON",value:function(){var t={},e=this.propertyMap;for(var i in e)t[i]=this[i];return t.metrics=this.getTextMetrics(),t}},{key:"destroy",value:function(){this.parent=void 0;}}]),t}(),rh={none:Za,word:$a,char:Qa,character:Qa},sh=Phaser.Math.DegToRad,oh=function(t){return !t.hasOwnProperty("convex")||t.convex},ah=function(t){return t.x>0&&t.y>0},hh=function(t,e,i,n,r,s,o,a,h){if(a&&o>s?o-=360:!a&&o=f?1:n/f,g=r>=v?1:r/v,y=d.cornerRadius;t.save(),t.beginPath(),t.translate(e,i),a=y.tl,ah(a)?(h=a.x*p,u=a.y*g,oh(a)?hh(t,h,u,h,u,180,270,!1,o):hh(t,0,0,h,u,90,0,!0,o),l=0,c=u):(t.lineTo(0,0),l=0,c=0),a=y.tr,ah(a)?(h=a.x*p,u=a.y*g,oh(a)?hh(t,n-h,u,h,u,270,360,!1,o):hh(t,n,0,h,u,180,90,!0,o)):t.lineTo(n,0),a=y.br,ah(a)?(h=a.x*p,u=a.y*g,oh(a)?hh(t,n-h,r-u,h,u,0,90,!1,o):hh(t,n,r,h,u,270,180,!0,o)):t.lineTo(n,r),a=y.bl,ah(a)?(h=a.x*p,u=a.y*g,oh(a)?hh(t,h,r-u,h,u,90,180,!1,o):hh(t,0,r,h,u,360,270,!0,o)):t.lineTo(0,r),t.lineTo(l,c),t.closePath(),t.restore();}(e,i,n,r,s,o,d),null!=a){var f;if(null!=l)(f=c?e.createLinearGradient(0,0,r,0):e.createLinearGradient(0,0,0,s)).addColorStop(0,a),f.addColorStop(1,l),a=f;e.fillStyle=a,e.fill();}null!=h&&u>0&&(e.strokeStyle=h,e.lineWidth=u,e.stroke());},lh=function(t,e,i,n,r,s,o,a){if(null!=e||null!=i){var h=t.canvas.width,u=t.canvas.height;null==i&&(n=0);var l=n/2;h=Math.max(1,h-n),u=Math.max(1,u-n),uh(t.canvas,t.context,l,l,h,u,r,e,i,n,s,o,a);}},ch={draw:function(t,e,i,n){var r=this.penManager;this.hitAreaManager.clear();var s=this.context;s.save();var o=this.defaultStyle;this.clear(),lh(this,o.backgroundColor,o.backgroundStrokeColor,o.backgroundStrokeLineWidth,o.backgroundCornerRadius,o.backgroundColor2,o.backgroundHorizontalGradient,o.backgroundCornerIteration),t+=this.startXOffset,e+=this.startYOffset;var a,h,u,l,c,d,f=o.halign,v=o.valign,p=o.lineHeight,g=r.lines,y=g.length,m=o.maxLines;m>0&&y>m?(h=m,u="center"===v?Math.floor((y-h)/2):"bottom"===v?y-h:0):(h=y,u=0),l=u+h;var k=this.rtl,x=k?this.parent.width:void 0;d="center"===v?Math.max((n-h*p)/2,0):"bottom"===v?Math.max(n-h*p-2,0):0,d+=e;for(var b=u;b0&&t.width>0){var a=i+o.underlineOffset-o.underlineThickness/2;this.drawLine(e,a,t.width,o.underlineThickness,o.underlineColor);}if(t.isTextPen&&this.drawText(e,i,t.text,o),t.isImagePen&&this.drawImage(e,i,t.prop.img,o),o.strikethroughThickness>0&&t.width>0){a=i+o.strikethroughOffset-o.strikethroughThickness/2;this.drawLine(e,a,t.width,o.strikethroughThickness,o.strikethroughColor);}if(s.restore(),t.hasAreaMarker&&t.width>0){var h,u=t.prop.area;if(u)h={key:u};else {var l=t.prop.url;h={key:"url:".concat(l),url:l};}this.hitAreaManager.add(e,i-this.startYOffset,t.width,this.defaultStyle.lineHeight,h);}},clear:function(){var t=this.canvas;this.context.clearRect(0,0,t.width,t.height);},drawLine:function(t,e,i,n,r){this.autoRound&&(t=Math.round(t),e=Math.round(e));var s=this.context,o=s.lineCap;s.lineCap="butt",s.strokeStyle=r,s.lineWidth=n,s.beginPath(),s.moveTo(t,e),s.lineTo(t+i,e),s.stroke(),s.lineCap=o;},drawText:function(t,e,i,n){this.autoRound&&(t=Math.round(t),e=Math.round(e));var r=this.context;n.stroke&&"none"!==n.stroke&&n.strokeThickness>0&&(n.syncShadow(r,n.shadowStroke),r.strokeText(i,t,e)),n.color&&"none"!==n.color&&(n.syncShadow(r,n.shadowFill),r.fillText(i,t,e));},drawImage:function(t,e,i,n){e-=this.startYOffset,this.parent.imageManager.draw(i,this.context,t,e,this.autoRound);}},dh=Phaser.Utils.Objects.GetValue,fh=Ja,vh=Ka,ph=function(){function t(i){e(this,t),this.prop={},this.resetFromJSON(i);}return n(t,[{key:"resetFromJSON",value:function(t){this.text=dh(t,"text",""),this.x=dh(t,"x",0),this.y=dh(t,"y",0),this.width=dh(t,"width",0);var e=dh(t,"prop",null);null===e&&(e={}),this.prop=e,this.newLineMode=dh(t,"newLineMode",0),this.startIndex=dh(t,"startIndex",0);}},{key:"plainText",get:function(){var t=this.text;return this.newLineMode===vh&&(t+="\n"),t}},{key:"wrapText",get:function(){var t=this.text;return this.newLineMode!==fh&&(t+="\n"),t}},{key:"rawTextLength",get:function(){var t=this.text.length;return this.newLineMode===vh&&(t+=1),t}},{key:"endIndex",get:function(){return this.startIndex+this.rawTextLength}},{key:"lastX",get:function(){return this.x+this.width}},{key:"isTextPen",get:function(){return ""!==this.text}},{key:"isImagePen",get:function(){return !!this.prop.img}},{key:"hasAreaMarker",get:function(){return !!this.prop.area||!!this.prop.url}}]),t}(),gh=Phaser.Utils.Objects.GetFastValue,yh=Ja,mh=qa,kh=function(){function t(i){e(this,t),this.pens=[],this.lines=[],this.maxLinesWidth=void 0,this.pensPool=i.pensPool,this.linesPool=i.linesPool,this.tagToText=gh(i,"tagToText",Qt),this.tagToTextScope=gh(i,"tagToTextScope",void 0);}return n(t,[{key:"destroy",value:function(){this.clear(),this.tagToText=void 0,this.tagToTextScope=void 0;}},{key:"clear",value:function(){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}},{key:"getLineEndIndex",value:function(t){t>=this.lines.length&&(t=this.lines.length-1);var e,i,n=!1;for(e=t;e>=0&&!(n=null!=(i=this.lines[e])&&i.length>0);e--);return n?i[i.length-1].endIndex:0}},{key:"getLineWidth",value:function(t){var e=this.lines[t];if(!e)return 0;var i=e[e.length-1];return null==i?0:i.lastX}},{key:"getMaxLineWidth",value:function(){if(void 0!==this.maxLinesWidth)return this.maxLinesWidth;for(var t,e=0,i=0,n=this.lines.length;ie&&(e=t);return this.maxLinesWidth=e,e}},{key:"getLineWidths",value:function(){for(var t=[],e=0,i=this.lines.length;e=t&&h<=e||(o=o.substring(t-a,e-a)),this.tagToTextScope?c+=this.tagToText.call(this.tagToTextScope,o,u,l):c+=this.tagToText(o,u,l),l=u,!(h>=e)));d++);return c}},{key:"length",get:function(){return this.lines.length},set:function(t){this.clear();}}]),t}(),xh={},bh=function(){function t(){e(this,t),this.items=[];}return n(t,[{key:"destroy",value:function(){this.clear(),this.items=void 0;}},{key:"pop",value:function(){return this.items.length>0?this.items.pop():null}},{key:"push",value:function(t){return this.items.push(t),this}},{key:"pushMultiple",value:function(t){return this.items.push.apply(this.items,t),t.length=0,this}},{key:"clear",value:function(){return this.items.length=0,this}}]),t}(),wh=Phaser.Geom.Rectangle,Sh=new bh,Ch=function(){function t(){e(this,t),this.hitAreas=[];}return n(t,[{key:"destroy",value:function(){this.clear();}},{key:"clear",value:function(){for(var t=0,e=this.hitAreas.length;tr){""!==C?a.push(o.getLine(C,O,Lh)):0===P&&s>0&&a.push(o.getLine("",0,Lh)),a.push.apply(a,v(t(x,i,Dh,r,0,o)));var E=a.pop();C=E.text,O=E.width,o.freeLine(E)," "===C&&(C="",O=0);}else (S=O+b)>u?(a.push(o.getLine(C,O,Lh)),C=x,O=b,u=r):(C+=x,O=S),w&&a.push(o.getLine(C,O,l));}return a},Fh=Phaser.Utils.Objects.GetValue,Wh=Za,Ih=Ja,Xh=function(){function t(i){e(this,t),this.parent=i.parent,this.scene=this.parent.scene,this.context=Fh(i,"context",null),this.canvas=this.context.canvas,this.parser=Fh(i,"parser",null),this.defaultStyle=Fh(i,"style",null),this.autoRound=!0,this.pensPool=i.pensPool,this.linesPool=i.linesPool,this.wrapTextLinesPool=i.wrapTextLinesPool,this.penManager=this.newPenManager(),this._tmpPenManager=null,this.hitAreaManager=new Ch,this.lastHitAreaKey=null,this.urlTagCursorStyle=null;var n=this.context;this.getTextWidth=function(t){return n.measureText(t).width};}return n(t,[{key:"destroy",value:function(){this.parent=void 0,this.scene=void 0,this.context=void 0,this.canvas=void 0,this.parser=void 0,this.defaultStyle=void 0,this.penManager&&(this.penManager.destroy(),this.penManager=void 0),this._tmpPenManager&&(this._tmpPenManager.destroy(),this._tmpPenManager=void 0),this.hitAreaManager&&(this.hitAreaManager.destroy(),this.hitAreaManager=void 0),this.pensPool=void 0,this.linesPool=void 0,this.wrapTextLinesPool=void 0;}},{key:"updatePenManager",value:function(t,e,i,n,r){if(void 0===r&&(r=this.penManager),r.clear(),""===t)return r;var s=this.parent.style;if(s.isWrapFitMode){var o=this.parent.padding;i=s.fixedWidth-o.left-o.right;}for(var a,h,u,l,c,d=this.canvas,f=this.context,v=function(t){return f.measureText(t).width},p=0,g=0,y=s.wrapCallback,m=s.wrapCallbackScope,k=!0,x=this.parser.splitText(t),b=this.wrapTextLinesPool,w=0,S=x.length;w0&&e!==Wh&&i0&&t>e&&(t=e),t}},{key:"linesWidth",get:function(){return Math.ceil(this.penManager.getMaxLineWidth())}},{key:"linesHeight",get:function(){var t=this.desplayLinesCount,e=this.defaultStyle.lineHeight*t;return t>0&&(e-=this.defaultStyle.lineSpacing),e}},{key:"imageManager",get:function(){return this.parent.imageManager}},{key:"rtl",get:function(){return this.parent.style.rtl}},{key:"newPenManager",value:function(){return new kh({pensPool:this.pensPool,linesPool:this.linesPool,tagToText:this.parser.propToTagText,tagToTextScope:this.parser})}},{key:"tmpPenManager",get:function(){return null===this._tmpPenManager&&(this._tmpPenManager=this.newPenManager()),this._tmpPenManager}},{key:"getPlainText",value:function(t,e,i){var n;if(null==t)n=this.penManager.plainText;else {var r=this.parser.splitText(t,1);n="";for(var s=0,o=r.length;s0}},{key:"drawX",get:function(){var t=this.x+this.leftSpace+this.offsetX-this.originX*this.width;return this.parent._textOX*this.scrollFactorX+t}},{key:"drawY",get:function(){var t=this.y+this.offsetY;return this.parent._textOY*this.scrollFactorY+t}},{key:"drawTLX",get:function(){return 0}},{key:"drawTLY",get:function(){return 0}},{key:"drawBLX",get:function(){return 0}},{key:"drawBLY",get:function(){return 0}},{key:"drawTRX",get:function(){return 0}},{key:"drawTRY",get:function(){return 0}},{key:"drawBRX",get:function(){return 0}},{key:"drawBRY",get:function(){return 0}},{key:"drawCenterX",get:function(){return (this.drawTRX+this.drawTLX)/2}},{key:"drawCenterY",get:function(){return (this.drawBLY+this.drawTLY)/2}}]),s}(Nu);Object.assign(ul.prototype,sl);var ll=function(t,e,i){return e.hasOwnProperty(t)?e[t]:i[t]},cl=Phaser.Utils.Objects.GetValue,dl=function(t){r(o,t);var i=u(o);function o(t,n){var r;return e(this,o),(r=i.call(this,t,"background")).setScrollFactor(0),r.setColor(cl(n,"color",null),cl(n,"color2",null),cl(n,"horizontalGradient",!0)),r.setStroke(cl(n,"stroke",null),cl(n,"strokeThickness",2)),r.setCornerRadius(cl(n,"cornerRadius",0),cl(n,"cornerIteration",null)),r}return n(o,[{key:"color",get:function(){return this._color},set:function(t){t=Ha(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t;}},{key:"color2",get:function(){return this._color2},set:function(t){t=Ha(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t;}},{key:"horizontalGradient",get:function(){return this._horizontalGradient},set:function(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t;}},{key:"setColor",value:function(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}},{key:"stroke",get:function(){return this._stroke},set:function(t){t=Ha(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t;}},{key:"strokeThickness",get:function(){return this._strokeThickness},set:function(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t;}},{key:"setStroke",value:function(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}},{key:"cornerRadius",get:function(){return this._cornerRadius},set:function(t){this.setDirty(this._cornerRadius!=t),this._cornerRadius=t;}},{key:"cornerIteration",get:function(){return this._cornerIteration},set:function(t){this.setDirty(this._cornerIteration!=t),this._cornerIteration=t;}},{key:"modifyStyle",value:function(t){return t.hasOwnProperty("color")&&this.setColor(t.color,ll("color2",t,this),ll("horizontalGradient",t,this)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,ll("strokeThickness",t,this)),t.hasOwnProperty("cornerRadius")&&this.setCornerRadius(t.cornerRadius,ll("cornerIteration",t,this)),this}},{key:"modifyPorperties",value:function(t){return c(s(o.prototype),"modifyPorperties",this).call(this,t),this.modifyStyle(t),this}},{key:"setCornerRadius",value:function(t,e){return this.cornerRadius=t,this.cornerIteration=e,this}},{key:"renderContent",value:function(){lh(this.parent,this.color,this.stroke,this.strokeThickness,this.cornerRadius,this.color2,this.horizontalGradient,this.cornerIteration);}}]),o}(ul),fl=Phaser.Utils.Objects.GetValue,vl=function(t){r(o,t);var i=u(o);function o(t,n){var r;return e(this,o),(r=i.call(this,t,"innerbounds")).setScrollFactor(0),r.setColor(fl(n,"color",null),fl(n,"color2",null),fl(n,"horizontalGradient",!0)),r.setStroke(fl(n,"stroke",null),fl(n,"strokeThickness",2)),r}return n(o,[{key:"color",get:function(){return this._color},set:function(t){t=Ha(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t;}},{key:"color2",get:function(){return this._color2},set:function(t){t=Ha(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t;}},{key:"horizontalGradient",get:function(){return this._horizontalGradient},set:function(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t;}},{key:"setColor",value:function(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}},{key:"stroke",get:function(){return this._stroke},set:function(t){t=Ha(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t;}},{key:"strokeThickness",get:function(){return this._strokeThickness},set:function(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t;}},{key:"setStroke",value:function(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}},{key:"modifyPorperties",value:function(t){c(s(o.prototype),"modifyPorperties",this).call(this,t),t.hasOwnProperty("color")&&this.setColor(t.color,fl(t,"color2",null),fl(t,"horizontalGradient",!0)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,fl(t,"strokeThickness",2));}},{key:"renderContent",value:function(){var t=this.parent.padding,e=t.left,i=t.top,n=this.parent.width-t.left-t.right,r=this.parent.height-t.top-t.bottom,s=this.context;if(null!=this.color){var o,a;if(null!=this.color2)(a=this.horizontalGradient?s.createLinearGradient(0,0,n,0):s.createLinearGradient(0,0,0,r)).addColorStop(0,this.color),a.addColorStop(1,this.color2),o=a;else o=this.color;s.fillStyle=o,s.fillRect(e,i,n,r);}null!=this.stroke&&this.strokeThickness>0&&(s.strokeStyle=this.stroke,s.lineWidth=this.strokeThickness,s.strokeRect(e,i,n,r));}}]),o}(ul),pl=Phaser.Utils.Objects.GetValue,gl=function(){function t(i,n){e(this,t),this.parent=i,this.set(n);}return n(t,[{key:"toJSON",value:function(){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}}},{key:"set",value:function(t){return this.setBold(pl(t,"bold",!1)),this.setItalic(pl(t,"italic",!1)),this.setFontSize(pl(t,"fontSize","16px")),this.setFontFamily(pl(t,"fontFamily","Courier")),this.setColor(pl(t,"color","#fff")),this.setStrokeStyle(pl(t,"stroke",null),pl(t,"strokeThickness",0)),this.setShadow(pl(t,"shadowColor",null),pl(t,"shadowOffsetX",0),pl(t,"shadowOffsetY",0),pl(t,"shadowBlur",0)),this.setOffset(pl(t,"offsetX",0),pl(t,"offsetY",0)),this.setSpace(pl(t,"leftSpace",0),pl(t,"rightSpace",0)),this.setAlign(pl(t,"align",void 0)),this.setBackgroundColor(pl(t,"backgroundColor",null)),this.setBackgroundHeight(pl(t,"backgroundHeight",void 0)),this.setBackgroundBottomY(pl(t,"backgroundBottomY",void 0)),this}},{key:"modify",value:function(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(ll("stroke",t,this),ll("strokeThickness",t,this)),t.hasOwnProperty("shadowColor")&&this.setShadowColor(t.shadowColor),(t.hasOwnProperty("shadowOffsetX")||t.hasOwnProperty("shadowOffsetY"))&&this.setShadowOffset(ll("shadowOffsetX",t,this),ll("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}},{key:"setUpdateTextFlag",value:function(){return this.parent&&(this.parent.updateTextFlag=!0),this}},{key:"clone",value:function(){return new t(null,this.toJSON())}},{key:"copyFrom",value:function(t){return this.set(t.toJSON()),this}},{key:"copyTo",value:function(t){return t.set(this.toJSON()),this}},{key:"setBold",value:function(t){return void 0===t&&(t=!0),this.bold=t,this.setUpdateTextFlag(),this}},{key:"setItalic",value:function(t){return void 0===t&&(t=!0),this.italic=t,this.setUpdateTextFlag(),this}},{key:"fontStyle",get:function(){return this.bold&&this.italic?"bold italic":this.bold?"bold":this.italic?"italic":""}},{key:"setFontSize",value:function(t){return "number"==typeof t&&(t="".concat(t,"px")),this.fontSize=t,this.setUpdateTextFlag(),this}},{key:"setFontFamily",value:function(t){return this.fontFamily=t,this.setUpdateTextFlag(),this}},{key:"font",get:function(){return "".concat(this.fontStyle," ").concat(this.fontSize," ").concat(this.fontFamily)}},{key:"setColor",value:function(t){return this.color=Ha(t),this}},{key:"hasFill",get:function(){return null!=this.color}},{key:"setStrokeStyle",value:function(t,e){return this.stroke=Ha(t),void 0!==e&&(this.strokeThickness=e),this}},{key:"setStrokeThickness",value:function(t){return this.strokeThickness=t,this}},{key:"hasStroke",get:function(){return null!=this.stroke&&this.strokeThickness>0}},{key:"setShadowColor",value:function(t){return this.shadowColor=Ha(t),this}},{key:"setShadowOffset",value:function(t,e){return void 0===t&&(t=0),void 0===e&&(e=0),this.shadowOffsetX=t,this.shadowOffsetY=e,this}},{key:"setShadowBlur",value:function(t){return void 0===t&&(t=0),this.shaodwBlur=t,this}},{key:"setShadow",value:function(t,e,i,n){return this.setShadowColor(t).setShadowOffset(e,i).setShadowBlur(n),this}},{key:"setBackgroundColor",value:function(t){return this.backgroundColor=Ha(t),this}},{key:"hasBackgroundColor",get:function(){return null!=this.backgroundColor}},{key:"setBackgroundHeight",value:function(t){return this.backgroundHeight=t,this}},{key:"setBackgroundBottomY",value:function(t){return this.backgroundBottomY=t,this}},{key:"setOffsetX",value:function(t){return void 0===t&&(t=0),this.offsetX=t,this}},{key:"setOffsetY",value:function(t){return void 0===t&&(t=0),this.offsetY=t,this}},{key:"setOffset",value:function(t,e){return this.setOffsetX(t).setOffsetY(e),this}},{key:"setLeftSpace",value:function(t){return void 0===t&&(t=0),this.leftSpace=t,this}},{key:"setRightSpace",value:function(t){return void 0===t&&(t=0),this.rightSpace=t,this}},{key:"setSpace",value:function(t,e){return this.setLeftSpace(t).setRightSpace(e),this}},{key:"setAlign",value:function(t){return this.align=t,this}},{key:"syncFont",value:function(t){return t.font=this.font,this}},{key:"syncStyle",value:function(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}},{key:"syncShadow",value:function(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);}},{key:"getTextMetrics",value:function(t,e){return this.syncFont(t).syncStyle(t),t.measureText(e)}}]),t}(),yl=Phaser.Utils.Array.Remove,ml=Phaser.Utils.Array.Remove,kl="text",xl="image",bl="drawer",wl="space",Sl="command",Cl=function(t){return t.type===kl&&"\n"===t.text},Ol=function(t){return t.type===kl&&"\f"===t.text},_l=function(t){return t.type===kl},Pl=function(t){r(o,t);var i=u(o);function o(t,n,r){var s;return e(this,o),(s=i.call(this,t,kl)).updateTextFlag=!1,s.style=new gl(a(s),r),s.setText(n),s}return n(o,[{key:"autoRound",get:function(){return this.parent.autoRound}},{key:"offsetX",get:function(){return this.style.offsetX},set:function(t){this.style&&(this.style.offsetX=t);}},{key:"offsetY",get:function(){return this.style.offsetY},set:function(t){this.style&&(this.style.offsetY=t);}},{key:"leftSpace",get:function(){return this.style.leftSpace*this.scaleX},set:function(t){this.style&&(this.style.leftSpace=t),f(s(o.prototype),"leftSpace",t,this,!0);}},{key:"rightSpace",get:function(){return this.style.rightSpace*this.scaleX},set:function(t){this.style&&(this.style.rightSpace=t),f(s(o.prototype),"rightSpace",t,this,!0);}},{key:"align",get:function(){return this.style.align},set:function(t){this.style&&(this.style.align=t);}},{key:"modifyStyle",value:function(t){return this.setDirty(!0),this.style.modify(t),this.updateTextFlag&&this.updateTextSize(),this}},{key:"modifyPorperties",value:function(t){return t?(this.modifyStyle(t),c(s(o.prototype),"modifyPorperties",this).call(this,t),this):this}},{key:"setText",value:function(t){return this.setDirty(this.text!=t),this.text=t,this.updateTextSize(),this}},{key:"updateTextSize",value:function(){var t=this.text;if("\n"===t||"\f"===t||""===t)this.clearTextSize();else {var e,i,n=this.style.getTextMetrics(this.context,this.text);this.textWidth=n.width,"actualBoundingBoxAscent"in n?(e=n.actualBoundingBoxAscent,i=n.actualBoundingBoxDescent):(e=0,i=0),this.textHeight=e+i,this.ascent=e,this.descent=i;}return this.updateTextFlag=!1,this}},{key:"clearTextSize",value:function(){return this.textWidth=0,this.textHeight=0,this.ascent=0,this.descent=0,this}},{key:"copyTextSize",value:function(t){return this.textWidth=t.textWidth,this.textHeight=t.textHeight,this.ascent=t.ascent,this.descent=t.descent,this}},{key:"width",get:function(){return this.textWidth*this.scaleX},set:function(t){this.textWidth>0?this.scaleX=t/this.textWidth:this.scaleX=1;}},{key:"height",get:function(){return this.textHeight*this.scaleY},set:function(t){this.textHeight>0?this.scaleY=t/this.textHeight:this.scaleY=1;}},{key:"willRender",get:function(){return 0!==this.textWidth&&c(s(o.prototype),"willRender",this)}},{key:"renderContent",value:function(){var t=this.context,e=this.style;if(e.hasBackgroundColor){t.fillStyle=e.backgroundColor;var i=this.drawTLX,n=this.drawTRX-i,r=e.backgroundBottomY;null==r&&(r=this.drawBLY);var s=e.backgroundHeight;null==s&&(s=r-this.drawTLY);var o=r-s;t.fillRect(i,o,n,s);}var a=e.hasFill,h=e.hasStroke;(a||h)&&(e.syncFont(t).syncStyle(t),h&&(e.syncShadow(t),t.strokeText(this.text,0,0)),a&&(e.syncShadow(t),t.fillText(this.text,0,0)));}},{key:"drawTLX",get:function(){return -this.leftSpace}},{key:"drawTLY",get:function(){return -this.ascent}},{key:"drawBLX",get:function(){return -this.leftSpace}},{key:"drawBLY",get:function(){return this.descent}},{key:"drawTRX",get:function(){return this.textWidth+this.rightSpace}},{key:"drawTRY",get:function(){return -this.ascent}},{key:"drawBRX",get:function(){return this.textWidth+this.rightSpace}},{key:"drawBRY",get:function(){return this.descent}}]),o}(ul),Tl=function(t,e){var i=this.createCharChildren(t,e);return this.addChild(i),this},El=function(t){r(s,t);var i=u(s);function s(t,n,r){var o;return e(this,s),(o=i.call(this,t,xl)).setTexture(n,r),o}return n(s,[{key:"frameWidth",get:function(){return this.frameObj?this.frameObj.cutWidth:0}},{key:"frameHeight",get:function(){return this.frameObj?this.frameObj.cutHeight:0}},{key:"offsetY",get:function(){return -this.height},set:function(t){}},{key:"key",get:function(){return this._key},set:function(t){this.setDirty(this._key!=t),this._key=t;}},{key:"frame",get:function(){return this._frame},set:function(t){this.setDirty(this._frame!=t),this._frame=t;}},{key:"setTexture",value:function(t,e){return this.key=t,this.frame=e,this.frameObj=this.scene.sys.textures.getFrame(t,e),this}},{key:"width",get:function(){return this.frameWidth*this.scaleX},set:function(t){this.setDirty(this.width!==t),this.scaleX=t/this.frameWidth;}},{key:"height",get:function(){return this.frameHeight*this.scaleY},set:function(t){this.setDirty(this.height!==t),this.scaleY=t/this.frameHeight;}},{key:"setHeight",value:function(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}},{key:"renderContent",value:function(){var t=this.context,e=this.frameObj,i=this.frameWidth,n=this.frameHeight;t.drawImage(e.source.image,e.cutX,e.cutY,i,n,0,0,i,n);}},{key:"drawTLX",get:function(){return -this.leftSpace}},{key:"drawTLY",get:function(){return 0}},{key:"drawBLX",get:function(){return -this.leftSpace}},{key:"drawBLY",get:function(){return this.frameHeight}},{key:"drawTRX",get:function(){return this.frameWidth+this.rightSpace}},{key:"drawTRY",get:function(){return 0}},{key:"drawBRX",get:function(){return this.frameWidth+this.rightSpace}},{key:"drawBRY",get:function(){return this.frameHeight}}]),s}(ul),Rl=function(t){r(o,t);var i=u(o);function o(t,n,r,s){var a;return e(this,o),(a=i.call(this,t,bl)).setRenderCallback(n),a.setDrawerSize(r,s),a}return n(o,[{key:"setRenderCallback",value:function(t){return t?this.renderContent=t.bind(this):delete this.renderContent,this}},{key:"setDrawerSize",value:function(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}},{key:"onFree",value:function(){c(s(o.prototype),"onFree",this).call(this),this.setRenderCallback();}},{key:"width",get:function(){return this.drawerWidth*this.scaleX},set:function(t){this.setDirty(this.width!==t),this.scaleX=this.drawerWidth>0?t/this.drawerWidth:1;}},{key:"height",get:function(){return this.drawerHeight*this.scaleY},set:function(t){this.setDirty(this.height!==t),this.scaleY=this.drawerHeight>0?t/this.drawerHeight:1;}},{key:"offsetY",get:function(){return -this.height},set:function(t){}},{key:"drawTLX",get:function(){return -this.leftSpace}},{key:"drawTLY",get:function(){return 0}},{key:"drawBLX",get:function(){return -this.leftSpace}},{key:"drawBLY",get:function(){return this.drawerHeight}},{key:"drawTRX",get:function(){return this.drawerWidth+this.rightSpace}},{key:"drawTRY",get:function(){return 0}},{key:"drawBRX",get:function(){return this.drawerWidth+this.rightSpace}},{key:"drawBRY",get:function(){return this.drawerHeight}}]),o}(ul),Ll=function(t){r(s,t);var i=u(s);function s(t,n){var r;return e(this,s),(r=i.call(this,t,wl)).setSpaceWidth(n),r}return n(s,[{key:"width",get:function(){return this.spaceWidth*this.scaleX},set:function(t){this.spaceWidth>0?this.scaleX=t/this.spaceWidth:this.scaleX=1;}},{key:"setSpaceWidth",value:function(t){return this.spaceWidth=t,this}}]),s}(ul),Ml=function(t){r(o,t);var i=u(o);function o(t,n,r,s,a){var h;return e(this,o),(h=i.call(this,t,Sl)).setName(n).setParameter(s).setCallback(r,a),h}return n(o,[{key:"setName",value:function(t){return this.name=t,this}},{key:"setParameter",value:function(t){return this.param=t,this}},{key:"setCallback",value:function(t,e){return this.callback=t,this.scope=e,this}},{key:"exec",value:function(){return this.scope?this.callback.call(this.scope,this.param,this.name):this.callback(this.param,this.name)}},{key:"onFree",value:function(){c(s(o.prototype),"onFree",this).call(this),this.setName().setCallback().setParameter();}}]),o}(Nu),Al=function(t,e,i,n){void 0===n&&(n={word:[],width:0}),n.word.length=0;for(var r=t.length,s=e,o=n.word,a=0;s0&&!a){var h=this.fixedHeight-n;if(i>0)s=h/i;else s=(u=zl.call(this)).height,o=u.ascent,i=Math.floor((h-o)/s);}else {var u;s=(u=zl.call(this)).height,o=u.ascent;}}else if(this.fixedHeight>0){if(void 0===(i=Wl(t,"maxLines"))){h=this.fixedHeight-n;i=Math.floor(h/s);}}else i=Wl(t,"maxLines",0);void 0===o&&(o=s);var l=0===i,c=Wl(t,"wrapWidth",void 0);void 0===c&&(c=this.fixedWidth>0?this.fixedWidth-r:1/0);for(var d=Wl(t,"letterSpacing",0),f=Wl(t,"hAlign",0),v=Wl(t,"vAlign",0),p=Wl(t,"charWrap",!1),g={callback:"runWordWrap",start:e,isLastPage:!1,padding:this.wrapPadding,ascent:o,lineHeight:s,maxLines:i,wrapWidth:c,letterSpacing:d,hAlign:f,vAlign:v,charWrap:p,children:[],lines:[],maxLineWidth:0,linesHeight:0},y=this.children,m=0,k=y.length;m0&&(T.push({children:E,width:R}),L=Math.max(L,R)),g.start+=P.length,g.isLastPage=!M&&g.start===_,g.maxLineWidth=L,g.linesHeight=T.length*s;var I=this.fixedWidth>0?this.fixedWidth:g.maxLineWidth+r,X=this.fixedHeight>0?this.fixedHeight:g.linesHeight+n;!function(t,e,i){var n,r,s=t.hAlign,o=t.vAlign,a=t.linesHeight;switch(o){case 1:case"center":r=(i-a)/2;break;case 2:case"bottom":r=i-a;break;default:r=0;}for(var h=t.lines,u=0,l=h.length;u0?(o=this.fixedWidth-r)/i:0;else if(this.fixedWidth>0){if(void 0===(i=Yl(t,"maxLines",void 0))){var o=this.fixedWidth-r;i=Math.floor(o/s)+1;}}else i=Yl(t,"maxLines",0);var a=0===i,h=Yl(t,"fixedChildHeight",void 0);if(void 0===h){var u=Yl(t,"charPerLine",void 0);if(void 0!==u){var l=this.fixedHeight-n;h=Math.floor(l/u);}}var c=Yl(t,"wrapHeight",void 0);void 0===c&&(c=this.fixedHeight>0?this.fixedHeight-n:1/0);for(var d=Yl(t,"letterSpacing",0),f=Yl(t,"rtl",!0),v=Yl(t,"hAlign",f?2:0),p=Yl(t,"vAlign",0),g={callback:"runVerticalWrap",start:e,isLastPage:!1,padding:this.wrapPadding,lineWidth:s,maxLines:i,fixedChildHeight:h,wrapHeight:c,letterSpacing:d,hAlign:v,vAlign:p,rtl:f,children:[],lines:[],maxLineHeight:0,linesWidth:0},y=this.children,m=0,k=y.length;m0&&(T.push({children:E,height:R}),L=Math.max(L,R)),g.start+=P.length,g.isLastPage=g.start===_,g.maxLineHeight=L,g.linesWidth=T.length*s;var F=this.fixedWidth>0?this.fixedWidth:g.linesWidth+r,W=this.fixedHeight>0?this.fixedHeight:g.maxLineHeight+n;!function(t,e,i){var n,r,s=t.hAlign,o=t.vAlign,a=t.rtl,h=t.lines,u=t.lineWidth,l=t.linesWidth;switch(s){case 1:case"center":n=(e-l)/2;break;case 2:case"right":n=e-l;break;default:n=0;}a&&(n+=u);for(var c=0,d=h.length;c0?t:this.width,e>0?e:this.height),this):this},setPadding:function(t,e){var i=this.padding,n=i.left,r=i.right,s=i.top,o=i.bottom;return Ne(i,t,e),this.dirty=this.dirty||n!=i.left||r!=i.right||s!=i.top||o!=i.bottom,this},getPadding:function(t){return Be(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),yl(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 ml(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,n,r,s=Array.isArray(t);void 0===e||e===this.children.length?s?(i=this.children).push.apply(i,v(t)):this.children.push(t):s?(n=this.children).splice.apply(n,[e,0].concat(v(t))):this.children.splice(e,0,t);(this.lastAppendedChildren.length=0,s)?(r=this.lastAppendedChildren).push.apply(r,v(t)):this.lastAppendedChildren.push(t);return this},createCharChild:function(t,e){e&&this.textStyle.modify(e);var i=this.poolManager.allocate(kl);return null===i?i=new Pl(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=[],n=0,r=t.length;ne&&(n=e,r=t);})),r},getCharWorldPosition:function(t,e,i,n){return "number"==typeof t&&(t=this.getCharChild(t,!0)),rl(this,t,e,i,n)},setToMinSize:function(){for(var t=this.children,e=0,i=0,n=0,r=t.length;n=i.length&&(t=i.length);for(var n=0,r=0;r=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!=n&&(r=e.getCharChild(n))&&("\n"===r.text&&r.copyTextSize(e.lastInsertCursor),function(t){var e,i,n=t.parent,r=n.width,s=n.height,o=t.drawX,a=t.drawY,h=o+t.drawTLX,u=o+t.drawTRX,l=a+t.drawTLY,c=a+t.drawBLY;e=h<0?0-h:u>r?r-u:0,i=l<0?0-l:c>s?s-c:0,n._textOX+=e,n._textOY+=i;}(r),e.emit("cursorin",r,n,e)),e.emit("movecursor",n,t.prevCursorPosition,e),t.prevCursorPosition=n;}}(this)):(Dc(this),jc(this)),this}},{key:"setNumberInput",value:function(){return this.onUpdateCallback=Ac,this}},{key:"setSelectAllWhenFocusEnable",value:function(t){return void 0===t&&(t=!0),this.selectAllWhenFocus=t,this}}]),s}(Mc),Wc=Phaser.Utils.Objects.GetValue,Ic=["inputType","onOpen","onFocus","onClose","onBlur","onUpdate","enterClose","readOnly","maxLength","minLength","selectAll"],Xc=function(t,e){if(t&&"number"!=typeof t){if(t.hasOwnProperty(e))return !0;if(-1!==e.indexOf(".")){for(var i=e.split("."),n=t,r=0;rt.length?i:t})),u.value=t.join(c);}else u.value=t.join(i.slice(a,a+u.count));a+=u.count,u.added||(h+=u.count);}}var d=e[o-1];return o>1&&"string"==typeof d.value&&(d.added||d.removed)&&t.equals("",d.value)&&(e[o-2].value+=d.value,e.pop()),e}Hc.prototype={diff:function(t,e){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=i.callback;"function"==typeof i&&(n=i,i={}),this.options=i;var r=this;function s(t){return n?(setTimeout((function(){n(void 0,t);}),0),!0):t}t=this.castInput(t),e=this.castInput(e),t=this.removeEmpty(this.tokenize(t));var o=(e=this.removeEmpty(this.tokenize(e))).length,a=t.length,h=1,u=o+a;i.maxEditLength&&(u=Math.min(u,i.maxEditLength));var l=[{newPos:-1,components:[]}],c=this.extractCommon(l[0],e,t,0);if(l[0].newPos+1>=o&&c+1>=a)return s([{value:this.join(e),count:e.length}]);function d(){for(var i=-1*h;i<=h;i+=2){var n=void 0,u=l[i-1],c=l[i+1],d=(c?c.newPos:0)-i;u&&(l[i-1]=void 0);var f=u&&u.newPos+1=o&&d+1>=a)return s(Gc(r,n.components,e,t,r.useLongestToken));l[i]=n;}else l[i]=void 0;}var p;h++;}if(n)!function t(){setTimeout((function(){if(h>u)return n();d()||t();}),0);}();else for(;h<=u;){var f=d();if(f)return f}},pushComponent:function(t,e,i){var n=t[t.length-1];n&&n.added===e&&n.removed===i?t[t.length-1]={count:n.count+1,added:e,removed:i}:t.push({count:1,added:e,removed:i});},extractCommon:function(t,e,i,n){for(var r=e.length,s=i.length,o=t.newPos,a=o-n,h=0;o+1 textObject.width) { - dx = textObject.width - childRightX; - } else { - dx = 0; - } - var childTopY = this.drawY + this.drawTLY; - var childBottomY = childTopY + this.height; - if (childTopY < 0) { - dy = 0 - childTopY; - } else if (childBottomY > textObject.height) { - dy = textObject.height - childBottomY; - } else { - dy = 0; - } - textObject._textOX += dx; - textObject._textOY += dy; - return this; - }; - var Methods$4 = { contains: Contains, - getWorldPosition: GetWorldPosition, - scrollTo: ScrollTo + getWorldPosition: GetWorldPosition }; Object.assign(Methods$4, RenderMethods); @@ -15681,13 +15654,12 @@ } }; - var SetTextOXYMethods = { + var SetTextOXYMethods$1 = { setTextOX: function setTextOX(ox) { if (ox === this._textOX) { return this; } this._textOX = ox; - this.updateTexture(); return this; }, setTextOY: function setTextOY(oy) { @@ -15695,7 +15667,6 @@ return this; } this._textOY = oy; - this.updateTexture(); return this; }, setTextOXY: function setTextOXY(ox, oy) { @@ -15704,7 +15675,6 @@ } this._textOX = ox; this._textOY = oy; - this.updateTexture(); return this; }, addTextOX: function addTextOX(incX) { @@ -16165,7 +16135,7 @@ setChildrenInteractiveEnable: SetChildrenInteractiveEnable, setInteractive: SetInteractive$1 }; - Object.assign(Methods$3, MoveChildMethods, BackgroundMethods, InnerBoundsMethods, SetAlignMethods, SetTextOXYMethods); + Object.assign(Methods$3, MoveChildMethods, BackgroundMethods, InnerBoundsMethods, SetAlignMethods, SetTextOXYMethods$1); var Stack = /*#__PURE__*/function () { function Stack() { @@ -16956,6 +16926,38 @@ hiddenTextEdit.prevSelectionEnd = selectionEnd; }; + var ScrollToBob = function ScrollToBob(bob) { + var textObject = bob.parent; + var textObjectLeftX = 0, + textObjectRightX = textObject.width, + textObjectTopY = 0, + textObjectBottomY = textObject.height; + var childX = bob.drawX, + childY = bob.drawY; + var childLeftX = childX + bob.drawTLX, + childRightX = childX + bob.drawTRX, + childTopY = childY + bob.drawTLY, + childBottomY = childY + bob.drawBLY; + var dx; + if (childLeftX < textObjectLeftX) { + dx = textObjectLeftX - childLeftX; + } else if (childRightX > textObjectRightX) { + dx = textObjectRightX - childRightX; + } else { + dx = 0; + } + var dy; + if (childTopY < textObjectTopY) { + dy = textObjectTopY - childTopY; + } else if (childBottomY > textObjectBottomY) { + dy = textObjectBottomY - childBottomY; + } else { + dy = 0; + } + textObject._textOX += dx; + textObject._textOY += dy; + }; + var MoveCursor = function MoveCursor(hiddenTextEdit) { var textObject = hiddenTextEdit.parent; var text = textObject.text; @@ -16985,7 +16987,7 @@ if (child.text === '\n') { child.copyTextSize(textObject.lastInsertCursor); } - child.scrollTo(); + ScrollToBob(child); textObject.emit('cursorin', child, cursorPosition, textObject); } } @@ -17805,7 +17807,35 @@ // Push back lastInsertCursor directly textObject.children.push(textObject.lastInsertCursor); - textObject.runWordWrap(); + var result = textObject.runWordWrap(); + textObject.contentWidth = result.maxLineWidth; + textObject.contentHeight = result.linesHeight; + textObject.linesCount = result.lines.length; + }; + + var SetTextOXYMethods = { + setTextOYByPercentage: function setTextOYByPercentage(percentage) { + this.setTextOY(-this.textVisibleHeight * percentage); + return this; + }, + getTextOYPercentage: function getTextOYPercentage() { + var textVisibleHeight = this.textVisibleHeight; + if (textVisibleHeight === 0) { + return 0; + } + return this._textOY / -textVisibleHeight; + }, + setTextOXByPercentage: function setTextOXByPercentage(percentage) { + this.setTextOX(-this.textVisibleWidth * percentage); + return this; + }, + getTextOXPercentage: function getTextOXPercentage() { + var textVisibleWidth = this.textVisibleWidth; + if (textVisibleWidth === 0) { + return 0; + } + return this._textOX / -textVisibleWidth; + } }; var IsPlainObject$7 = Phaser.Utils.Objects.IsPlainObject; @@ -17834,6 +17864,11 @@ var cursorStyle = ExtractByPrefix(config.style, 'cursor'); _this = _super.call(this, scene, x, y, fixedWidth, fixedHeight, config); _this.type = 'rexCanvasInput'; + + // readonly + _this.contentWidth = undefined; + _this.contentHeight = undefined; + _this.linesCount = undefined; _this._text; _this.textEdit = CreateHiddenTextEdit(_assertThisInitialized(_this), config); if (config.focusStyle) { @@ -18065,12 +18100,67 @@ this.minLength = value; return this; } + }, { + key: "topTextOY", + get: function get() { + return 0; + } + }, { + key: "bottomTextOY", + get: function get() { + return -this.tableVisibleHeight; + } + }, { + key: "leftTextOX", + get: function get() { + return 0; + } + }, { + key: "rightTextOX", + get: function get() { + return -this.textVisibleWidth; + } + }, { + key: "textVisibleHeight", + get: function get() { + var h = this.contentHeight - this.height; + if (h < 0) { + h = 0; + } + return h; + } + }, { + key: "textVisibleWidth", + get: function get() { + var w = this.contentWidth - this.width; + if (w < 0) { + w = 0; + } + return w; + } + }, { + key: "t", + get: function get() { + return this.getTextOYPercentage(); + }, + set: function set(value) { + this.setTextOYByPercentage(value).updateTexture(); + } + }, { + key: "s", + get: function get() { + return this.getTextOXPercentage(); + }, + set: function set(value) { + this.setTextOXByPercentage(value).updateTexture(); + } }]); return CanvasInput; }(DynamicText); var DefaultParseTextCallback = function DefaultParseTextCallback(text) { return text; }; + Object.assign(CanvasInput.prototype, SetTextOXYMethods); var CreateInputText = function CreateInputText(scene, config, deepCloneConfig) { if (deepCloneConfig === undefined) { diff --git a/dist/rexcolorinput.min.js b/dist/rexcolorinput.min.js index e32bb13da6..67701463f6 100644 --- a/dist/rexcolorinput.min.js +++ b/dist/rexcolorinput.min.js @@ -1,12 +1,12 @@ -!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).rexcolorinput=e();}(undefined,(function(){function t(e){return t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},t(e)}function e(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){for(var i=0;it.length)&&(e=t.length);for(var i=0,n=new Array(e);i=0;i--)(e=this.children[i]).parentContainer||e.displayList||e.destroy(t);this.clear(!t),c(s(o.prototype),"destroy",this).call(this,t);}}},{key:"contains",value:function(t){return -1!==this.children.indexOf(t)}},{key:"add",value:function(t){var e=this;return x(this.children,t,0,(function(t){t.once("destroy",e.onChildDestroy,e);}),this),this}},{key:"remove",value:function(t,e){var i=this;return b(this.children,t,(function(t){t.off("destroy",i.onChildDestroy,i),e&&t.destroy();})),this}},{key:"onChildDestroy",value:function(t,e){this.remove(t,!1);}},{key:"clear",value:function(t){for(var e,i=0,n=this.children.length;i0;){var n=i.shift();!e(n)&&n.isRexContainerLite&&i.push.apply(i,v(n.children));}},it=Phaser.Utils.Array,nt={getChildren:function(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},Be=/(\S+)\[(\d+)\]/i,Xe=Phaser.Utils.Objects.GetValue,Ye=function(t,e){return void 0===e?t:t[e]},He=function(e,i,n){void 0===e&&(e={}),void 0===i&&(i=0);var r=t(i);return "string"===r?e[i]=n:"number"===r?(e.left=i,e.right=i,e.top=i,e.bottom=i):(e.left=Xe(i,"left",0),e.right=Xe(i,"right",0),e.top=Xe(i,"top",0),e.bottom=Xe(i,"bottom",0)),e},Ge={getInnerPadding:function(t){return Ye(this.space,t)},setInnerPadding:function(t,e){return He(this.space,t,e),this},getOuterPadding:function(t){return Ye(this.getSizerConfig(this).padding,t)},setOuterPadding:function(t,e){return He(this.getSizerConfig(this).padding,t,e),this},getChildOuterPadding:function(t,e){return "string"==typeof t&&(t=this.getElement(t)),Ye(this.getSizerConfig(t).padding,e)},setChildOuterPadding:function(t,e,i){return "string"==typeof t&&(t=this.getElement(t)),He(this.getSizerConfig(t).padding,e,i),this}},Ne=function(t){var e=this.childrenWidth,i=void 0!==this.minWidth?this.minWidth:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn("Layout width warn: ".concat(this.constructor.name,"'s minWidth (").concat(i,") < childrenWidth (").concat(e,")"))):this.layoutWarnEnable&&(i>t||e>t)&&console.warn("Layout width warn: ".concat(this.constructor.name,"'s minWidth (").concat(i,") or childrenWidth (").concat(e," > targetWidth ").concat(t,")")),t},Ue=function(t){var e=this.childrenHeight,i=void 0!==this.minHeight?this.minHeight:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn("Layout height warn: ".concat(this.constructor.name,"'s minHeight (").concat(i,") < childrenHeight (").concat(e,")"))):this.layoutWarnEnable&&(i>t||e>t)&&console.warn("Layout height warn: ".concat(this.constructor.name,"'s minHeight (").concat(i,") or childrenHeight (").concat(e,") > targetHeight (").concat(t,")")),t},Ve={getShownChildren:function(t){void 0===t&&(t=[]);for(var e,i=this.children,n=0,r=i.length;n0;){var i=e.shift();i.rexSizer&&i.rexSizer.hidden||(i!==this&&t.push(i),i.isRexContainerLite&&e.push.apply(e,v(i.children)));}return t}},Je=function(){this._childrenWidth=void 0,this._childrenHeight=void 0;for(var t,e=this.getChildrenSizers(),i=0,n=e.length;i0?-this.delay:0,this.state=this.nowTime>=0?gi:pi,this.repeatCounter=0,this}},{key:"stop",value:function(){return this.state=vi,this}},{key:"update",value:function(t,e){this.state!==vi&&this.state!==ki&&0!==e&&0!==this.timeScale&&(this.nowTime+=e*this.timeScale,this.justRestart=!1,this.nowTime>=this.duration?-1===this.repeat||this.repeatCounter0&&(this.nowTime-=this.repeatDelay,this.state=yi)):(this.nowTime=this.duration,this.state=ki):this.nowTime>=0&&(this.state=gi));}},{key:"t",get:function(){var t;switch(this.state){case vi:case pi:case yi:t=0;break;case gi:t=this.nowTime/this.duration;break;case ki:t=1;}return di(t,0,1)},set:function(t){(t=di(t,-1,1))<0?(this.state=pi,this.nowTime=-this.delay*t):(this.state=gi,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++);}},{key:"setT",value:function(t){return this.t=t,this}},{key:"isIdle",get:function(){return this.state===vi}},{key:"isDelay",get:function(){return this.state===pi}},{key:"isCountDown",get:function(){return this.state===gi}},{key:"isRunning",get:function(){return this.state===pi||this.state===gi}},{key:"isDone",get:function(){return this.state===ki}},{key:"isOddIteration",get:function(){return 1==(1&this.repeatCounter)}},{key:"isEvenIteration",get:function(){return 0==(1&this.repeatCounter)}}]),t}(),vi=0,pi=1,gi=2,yi=3,ki=-1,mi=function(t){r(o,t);var i=l(o);function o(t,n){var r;return e(this,o),(r=i.call(this,t,n)).timer=new fi,r}return n(o,[{key:"shutdown",value:function(t){this.isShutdown||(c(s(o.prototype),"shutdown",this).call(this,t),this.timer.destroy(),this.timer=void 0);}},{key:"start",value:function(){return this.timer.start(),c(s(o.prototype),"start",this).call(this),this}},{key:"stop",value:function(){return this.timer.stop(),c(s(o.prototype),"stop",this).call(this),this}},{key:"complete",value:function(){return this.timer.stop(),c(s(o.prototype),"complete",this).call(this),this}}]),o}(li),xi=Phaser.Utils.Objects.GetValue,bi=Phaser.Utils.Objects.GetAdvancedValue,wi=Phaser.Tweens.Builders.GetEaseFunction,Ci=function(t){r(o,t);var i=l(o);function o(){return e(this,o),i.apply(this,arguments)}return n(o,[{key:"resetFromJSON",value:function(t){return this.timer.resetFromJSON(xi(t,"timer")),this.setEnable(xi(t,"enable",!0)),this.setTarget(xi(t,"target",this.parent)),this.setDelay(bi(t,"delay",0)),this.setDuration(bi(t,"duration",1e3)),this.setEase(xi(t,"ease","Linear")),this.setRepeat(xi(t,"repeat",0)),this}},{key:"setEnable",value:function(t){return null==t&&(t=!0),this.enable=t,this}},{key:"setTarget",value:function(t){return void 0===t&&(t=this.parent),this.target=t,this}},{key:"setDelay",value:function(t){return this.delay=t,this}},{key:"setDuration",value:function(t){return this.duration=t,this}},{key:"setRepeat",value:function(t){return this.repeat=t,this}},{key:"setRepeatDelay",value:function(t){return this.repeatDelay=t,this}},{key:"setEase",value:function(t){return void 0===t&&(t="Linear"),this.ease=t,this.easeFn=wi(t),this}},{key:"start",value:function(){return this.timer.isRunning||c(s(o.prototype),"start",this).call(this),this}},{key:"restart",value:function(){return this.timer.stop(),this.start.apply(this,arguments),this}},{key:"stop",value:function(t){return void 0===t&&(t=!1),c(s(o.prototype),"stop",this).call(this),t&&(this.timer.setT(1),this.updateGameObject(this.target,this.timer),this.complete()),this}},{key:"update",value:function(t,e){if(!this.isRunning||!this.enable||!this.parent.active)return this;var i=this.target,n=this.timer;return n.update(t,e),n.isDelay||this.updateGameObject(i,n),this.emit("update",i,this),n.isDone&&this.complete(),this}},{key:"updateGameObject",value:function(t,e){}}]),o}(mi),Si=Phaser.Utils.Objects.GetValue,Pi=Phaser.Utils.Objects.GetAdvancedValue,Oi=Phaser.Math.Linear,Ti=function(t){r(o,t);var i=l(o);function o(t,n){var r;return e(this,o),(r=i.call(this,t,n)).scaleStart={},r.scaleEnd={},r.resetFromJSON(n),r.boot(),r}return n(o,[{key:"resetFromJSON",value:function(t){return c(s(o.prototype),"resetFromJSON",this).call(this,t),this.setMode(Si(t,"mode",0)),this.setScaleRange(Pi(t,"start",void 0),Pi(t,"end",0)),this}},{key:"setMode",value:function(t){return "string"==typeof t&&(t=_i[t]),this.mode=t,this}},{key:"setScaleRange",value:function(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}},{key:"start",value:function(){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),c(s(o.prototype),"start",this).call(this),this}},{key:"updateGameObject",value:function(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));}},{key:"complete",value:function(){return c(s(o.prototype),"complete",this).call(this),1===this.mode&&this.parent.destroy(),this}}]),o}(Ci),_i={stop:0,destroy:1,yoyo:2},Ei=function(t,e,i,n,r){var s,o;switch(void 0===n&&(n="Cubic"),i){case 0:case"x":s={x:0},o={x:t.scaleX};break;case 1:case"y":s={y:0},o={y:t.scaleY};break;default:s=0,o=t.scale;}var a={mode:0,start:s,end:o,duration:e,ease:n};return void 0===r?r=new Ti(t,a):r.resetFromJSON(a),r.restart(),r},Ri=function(t,e,i,n,r,s){void 0===n&&(n="Linear"),r instanceof Ti&&(s=r,r=void 0),void 0===r&&(r=!0);var o={};switch(o.mode=r?1:0,i){case 0:case"x":o.end={x:0};break;case 1:case"y":o.end={y:0};break;default:o.end=0;}return o.duration=e,o.ease=n,void 0===s?s=new Ti(t,o):s.resetFromJSON(o),s.restart(),s},Mi=function(t,e){return new Promise((function(i,n){t.once(e,(function(){i();}));}))},Li=function(t){return Mi(t,"complete")},Di=Phaser.Utils.Objects.IsPlainObject,Ai=function(t,e){e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0);})),e.on("update",(function(){var e=je.getParentSizer(t);e&&e.resetChildPositionState(t);}));},zi={popUp:function(t,e,i){if(Di(t)){var n=t;t=n.duration,e=n.orientation,i=n.ease;}var r=void 0===this._scaleBehavior;return this._scaleBehavior=Ei(this,t,e,i,this._scaleBehavior),r&&Ai(this,this._scaleBehavior),this._scaleBehavior.completeEventName="popup.complete",this},popUpPromise:function(t,e,i){return this.popUp(t,e,i),Li(this._scaleBehavior)},scaleDownDestroy:function(t,e,i,n){if(Di(t)){var r=t;t=r.duration,e=r.orientation,i=r.ease,n=r.destroy;}var s=void 0===this._scaleBehavior;return this._scaleBehavior=Ri(this,t,e,i,n,this._scaleBehavior),s&&Ai(this,this._scaleBehavior),this._scaleBehavior.completeEventName="scaledown.complete",this},scaleDownDestroyPromise:function(t,e,i,n){return this.scaleDownDestroy(t,e,i,n),Li(this._scaleBehavior)},scaleDown:function(t,e,i){return this.scaleDownDestroy(t,e,i,!1),this},scaleDownPromise:function(t,e,i){return this.scaleDown(t,e,i),Li(this._scaleBehavior)},scaleYoyo:function(t,e,i,n,r){if(Di(t)){var s=t;t=s.duration,e=s.peakValue,i=s.repeat,n=s.orientation,r=s.ease;}var o=void 0===this._scaleBehavior;return this._scaleBehavior=function(t,e,i,n,r,s,o){var a,h;switch(void 0===i&&(i=1.2),void 0===n&&(n=0),void 0===s&&(s="Cubic"),r){case 0:case"x":a={x:t.scaleX},h={x:i};break;case 1:case"y":a={y:t.scaleX},h={y:i};break;default:a=t.scaleX,h=i;}var l={mode:2,start:a,end:h,duration:e/2,ease:s,repeat:n};return void 0===o?o=new Ti(t,l):o.resetFromJSON(l),o.restart(),o}(this,t,e,i,n,r,this._scaleBehavior),o&&Ai(this,this._scaleBehavior),this._scaleBehavior.completeEventName="scaleyoyo.complete",this},scaleYoyoPromise:function(t,e,i,n,r){return this.scaleYoyo(t,e,i,n,r),Li(this._scaleBehavior)}},ji=Phaser.Utils.Objects.GetValue,Fi=Phaser.Utils.Objects.GetAdvancedValue,Ii=Phaser.Math.Linear,Wi=function(t){r(o,t);var i=l(o);function o(t,n){var r;return e(this,o),(r=i.call(this,t,n)).resetFromJSON(n),r.boot(),r}return n(o,[{key:"resetFromJSON",value:function(t){return c(s(o.prototype),"resetFromJSON",this).call(this,t),this.setMode(ji(t,"mode",0)),this.setAlphaRange(Fi(t,"start",this.parent.alpha),Fi(t,"end",0)),this}},{key:"setMode",value:function(t){return "string"==typeof t&&(t=Bi[t]),this.mode=t,this}},{key:"setAlphaRange",value:function(t,e){return this.alphaStart=t,this.alphaEnd=e,this}},{key:"start",value:function(){return this.timer.isRunning||(this.parent.setAlpha(this.alphaStart),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),c(s(o.prototype),"start",this).call(this)),this}},{key:"updateGameObject",value:function(t,e){var i=e.t;e.isOddIteration&&(i=1-i),t.alpha=Ii(this.alphaStart,this.alphaEnd,i);}},{key:"complete",value:function(){return c(s(o.prototype),"complete",this).call(this),1===this.mode&&this.parent.destroy(),this}}]),o}(Ci),Bi={stop:0,destroy:1,yoyo:2},Xi=Phaser.Utils.Objects.IsPlainObject,Yi=function(t,e,i,n){var r,s;Xi(i)?(r=i.start,s=i.end):s=i,void 0===r&&(r=0),void 0===s&&(s=1);var o={mode:0,start:r,end:s,duration:e};return void 0===n?n=new Wi(t,o):n.resetFromJSON(o),n.restart(),n},Hi=function(t,e,i,n){i instanceof Wi&&(n=i,i=void 0),void 0===i&&(i=!0);var r={mode:i?1:0,end:0,duration:e};return void 0===n?n=new Wi(t,r):n.resetFromJSON(r),n.restart(),n},Gi=Phaser.Utils.Objects.IsPlainObject,Ni=function(t,e){e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0);})),e.on("update",(function(){var e=je.getParentSizer(t);e&&e.resetChildAlphaState(t);}));},Ui={fadeIn:function(t,e){if(Gi(t)){var i=t;t=i.duration,e=i.alpha;}var n=void 0===this._fade;return this._fade=Yi(this,t,e,this._fade),n&&Ni(this,this._fade),this._fade.completeEventName="fadein.complete",this},fadeInPromise:function(t,e){return this.fadeIn(t,e),Li(this._fade)},fadeOutDestroy:function(t,e){if(Gi(t)){var i=t;t=i.duration,e=i.destroy;}var n=void 0===this._fade;return this._fade=Hi(this,t,e,this._fade),n&&Ni(this,this._fade),this._fade.completeEventName="fadeout.complete",this},fadeOutDestroyPromise:function(t,e){return this.fadeOutDestroy(t,e),Li(this._fade)},fadeOut:function(t){return this.fadeOutDestroy(t,!1),this},fadeOutPromise:function(t){return this.fadeOut(t),Li(this._fade)}},Vi=Phaser.Utils.Objects.GetValue,Ji=Phaser.Utils.Objects.GetAdvancedValue,qi=Phaser.Math.Linear,Ki=function(t){r(o,t);var i=l(o);function o(t,n){var r;return e(this,o),(r=i.call(this,t,n)).resetFromJSON(n),r.boot(),r}return n(o,[{key:"resetFromJSON",value:function(t){if(c(s(o.prototype),"resetFromJSON",this).call(this,t),this.setMode(Vi(t,"mode",0)),t&&(t.hasOwnProperty("x")||t.hasOwnProperty("y"))){var e=Ji(t,"x",void 0),i=Ji(t,"y",void 0);this.setTargetPosition(e,i);}else this.setTargetPosition(t);return this}},{key:"setMode",value:function(t){return "string"==typeof t&&(t=Zi[t]),this.mode=t,this}},{key:"setTargetPosition",value:function(t,e){if("number"==typeof t||"number"==typeof e)this.startX=this.parent.x,this.startY=this.parent.y,this.endX=t,this.endY=e;else {var i=t;this.startX=Ji(i,"startX",void 0),this.startY=Ji(i,"startY",void 0),this.endX=Ji(i,"endX",void 0),this.endY=Ji(i,"endY",void 0);}return this.hasMoveX=void 0!==this.startX&&void 0!==this.endX,this.hasMoveY=void 0!==this.startY&&void 0!==this.endY,this}},{key:"start",value:function(){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),c(s(o.prototype),"start",this).call(this),this}},{key:"updateGameObject",value:function(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasMoveX&&(t.x=qi(this.startX,this.endX,i)),this.hasMoveY&&(t.y=qi(this.startY,this.endY,i));}},{key:"complete",value:function(){return c(s(o.prototype),"complete",this).call(this),1===this.mode&&this.parent.destroy(),this}}]),o}(Ci),Zi={stop:0,destroy:1,yoyo:2},$i=function(t,e){if("number"==typeof t)return t;var i=t[0],n=parseFloat(t.substr(2));switch(i){case"+":return e+n;case"-":return e-n;case"*":return e*n;case"/":return e/n}},Qi=Phaser.Utils.Objects.IsPlainObject,tn=Phaser.Math.Distance.Between,en=function(t,e){e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0);})),e.on("update",(function(){var e=je.getParentSizer(t);e&&e.resetChildPositionState(t);}));},nn={moveFrom:function(t,e,i,n,r){if(Qi(t)){var s=t;e=s.x,i=s.y,t=s.hasOwnProperty("speed")?1e3*tn(e,i,this.x,this.y)/s.speed:s.duration,n=s.ease;}var o=void 0===this._easeMove;return this._easeMove=function(t,e,i,n,r,s,o){s instanceof Ki&&(o=s,s=void 0),void 0===s&&(s=!1);var a={};return a.mode=s?1:0,void 0!==i&&(a.startX=$i(i,t.x),a.endX=t.x),void 0!==n&&(a.startY=$i(n,t.y),a.endY=t.y),a.duration=e,a.ease=void 0===r?"Linear":r,void 0===o?o=new Ki(t,a):o.resetFromJSON(a),o.restart(),o}(this,t,e,i,n,r,this._easeMove),o&&en(this,this._easeMove),this._easeMove.completeEventName="movefrom.complete",this},moveFromPromise:function(t,e,i,n,r){return this.moveFrom(t,e,i,n,r),Li(this._easeMove)},moveFromDestroy:function(t,e,i,n){return this.moveFrom(t,e,i,n,!0),this},moveFromDestroyPromise:function(t,e,i,n){return this.moveFromDestroy(t,e,i,n),Li(this._easeMove)},moveTo:function(t,e,i,n,r){if(Qi(t)){var s=t;e=s.x,i=s.y,t=s.hasOwnProperty("speed")?1e3*tn(e,i,this.x,this.y)/s.speed:s.duration,n=s.ease;}var o=void 0===this._easeMove;return this._easeMove=function(t,e,i,n,r,s,o){s instanceof Ki&&(o=s,s=void 0),void 0===s&&(s=!1);var a={};return a.mode=s?1:0,void 0!==i&&(a.startX=t.x,a.endX=$i(i,t.x)),void 0!==n&&(a.startY=t.y,a.endY=$i(n,t.y)),a.duration=e,a.ease=void 0===r?"Linear":r,void 0===o?o=new Ki(t,a):o.resetFromJSON(a),o.restart(),o}(this,t,e,i,n,r,this._easeMove),o&&en(this,this._easeMove),this._easeMove.completeEventName="moveto.complete",this},moveToPromise:function(t,e,i,n,r){return this.moveTo(t,e,i,n,r),Li(this._easeMove)},moveToDestroy:function(t,e,i,n){return this.moveTo(t,e,i,n,!0),this},moveToDestroyPromise:function(t,e,i,n){return this.moveToDestroy(t,e,i,n,!0),Li(this._easeMove)},moveStop:function(t){return this._easeMove?(this._easeMove.stop(t),this):this}},rn=Phaser.Utils.Objects.GetValue,sn=function(t){r(o,t);var i=l(o);function o(t,n){var r;return e(this,o),(r=i.call(this,t,n)).timer=new fi,r.resetFromJSON(n),r.boot(),r}return n(o,[{key:"resetFromJSON",value:function(t){return this.timer.resetFromJSON(rn(t,"timer")),this.setEnable(rn(t,"enable",!0)),this.setMode(rn(t,"mode",1)),this.isRunning=rn(t,"isRunning",!1),this.setMagnitudeMode(rn(t,"magnitudeMode",1)),this.setAxisMode(rn(t,"axis",0)),this.setDuration(rn(t,"duration",500)),this.setMagnitude(rn(t,"magnitude",10)),this.ox=rn(t,"ox",void 0),this.oy=rn(t,"oy",void 0),this}},{key:"toJSON",value:function(){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}}},{key:"shutdown",value:function(t){this.isShutdown||(c(s(o.prototype),"shutdown",this).call(this,t),this.timer.destroy(),this.timer=void 0);}},{key:"startTicking",value:function(){c(s(o.prototype),"startTicking",this).call(this),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);}},{key:"stopTicking",value:function(){c(s(o.prototype),"stopTicking",this).call(this),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));}},{key:"setEnable",value:function(t){return null==t&&(t=!0),this.enable=t,this}},{key:"setMode",value:function(t){return "string"==typeof t&&(t=on[t]),this.mode=t,this}},{key:"setMagnitudeMode",value:function(t){return "string"==typeof t&&(t=hn[t]),this.magnitudeMode=t,this}},{key:"setAxisMode",value:function(t){return "string"==typeof t&&(t=an[t]),this.axisMode=t,this}},{key:"setDuration",value:function(t){return this.duration=t,this}},{key:"setMagnitude",value:function(t){return this.magnitude=t,this}},{key:"start",value:function(t,e){if("number"!=typeof t){var i=t;e=rn(i,"magnitude",void 0),t=rn(i,"duration",void 0);}return void 0!==e&&this.setMagnitude(e),void 0!==t&&this.setDuration(t),this.timer.setDuration(this.duration).start(),c(s(o.prototype),"start",this).call(this),this}},{key:"shake",value:function(t,e){return this.start(t,e),this}},{key:"update",value:function(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 n=this.magnitude;1===this.magnitudeMode&&(n*=1-this.timer.t);var r=Math.random()*Math.PI*2,s=this.ox+Math.cos(r)*n,o=this.oy+Math.sin(r)*n;switch(this.axisMode){case 1:i.x=s;break;case 2:i.y=o;break;default:i.x=s,i.y=o;}}return this}},{key:"backToOrigin",value:function(){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}}]),o}(oi),on={effect:0,behavior:1},an={both:0,"h&v":0,"x&y":0,horizontal:1,h:1,x:1,vertical:2,v:2,y:2},hn={constant:0,decay:1},ln=Phaser.Utils.Objects.IsPlainObject,un={shake:function(t,e,i){if(ln(t)){var n=t;t=n.duration,e=n.magnitude,i=n.magnitudeMode;}return void 0===this._shake&&(this._shake=new sn(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:function(t,e){return this.shake(t,e),Li(this._shake)}},cn=Phaser.Utils.Objects.GetValue,dn=Phaser.Math.Linear,fn=function(t){r(o,t);var i=l(o);function o(t,n){var r;return e(this,o),(r=i.call(this,t,n)).resetFromJSON(),r.boot(),r}return n(o,[{key:"start",value:function(t){if(this.timer.isRunning)return this;var e=this.target;this.propertyKey=cn(t,"key","value");var i=e[this.propertyKey];return this.fromValue=cn(t,"from",i),this.toValue=cn(t,"to",i),this.setEase(cn(t,"ease",this.ease)),this.setDuration(cn(t,"duration",this.duration)),this.setRepeat(cn(t,"repeat",0)),this.setDelay(cn(t,"delay",0)),this.setRepeatDelay(cn(t,"repeatDelay",0)),this.timer.setDuration(this.duration).setRepeat(this.repeat).setDelay(this.delay).setRepeatDelay(this.repeatDelay),e[this.propertyKey]=this.fromValue,c(s(o.prototype),"start",this).call(this),this}},{key:"updateGameObject",value:function(t,e){var i=e.t;i=this.easeFn(i),t[this.propertyKey]=dn(this.fromValue,this.toValue,i);}}]),o}(Ci),vn=Phaser.Utils.Objects.IsPlainObject,pn=function(t){r(s,t);var i=l(s);function s(t,n){var r;return e(this,s),(r=i.call(this,t,n)).parent.setDataEnabled(),r.easeTasks={},r}return n(s,[{key:"complete",value:function(t){this.emit("complete-".concat(t),this.parent,this),this.emit("complete",t,this.parent,this);}},{key:"getEaseTask",value:function(t){var e=this.easeTasks[t];return void 0===e&&(e=new fn(this.parent),this.easeTasks[t]=e,e.setTarget(this.parent.data.values).on("complete",(function(){this.complete(t);}),this)),e}},{key:"easeTo",value:function(t,e,i,n){if(vn(t)){var r=t;t=r.key,e=r.value,i=r.duration,n=r.ease;var s=r.speed;void 0===i&&void 0!==s&&(i=Math.abs(e-this.parent.data.values[t])/s*1e3);}return void 0===i&&(i=1e3),void 0===n&&(n="Linear"),this.getEaseTask(t).restart({key:t,to:e,duration:i,ease:n}),this}},{key:"easeFrom",value:function(t,e,i,n){if(vn(t)){var r=t;t=r.key,e=r.value,i=r.duration,n=r.ease;var s=r.speed;void 0===i&&void 0!==s&&(i=Math.abs(e-this.parent.data.values[t])/s*1e3);}return void 0===i&&(i=1e3),void 0===n&&(n="Linear"),this.getEaseTask(t).restart({key:t,from:e,duration:i,ease:n}),this}},{key:"stopEase",value:function(t,e){void 0===e&&(e=!0);var i=this.easeTasks[t];return i&&i.stop(e),this}},{key:"stopAll",value:function(t){for(var e in void 0===t&&(t=!0),this.easeTasks)this.stopEase(e,t);return this}}]),s}(ni),gn={easeDataTo:function(t,e,i,n){return this._easeData||(this._easeData=new pn(this),function(t,e){e.on("complete",(function(e){t.emit("easedata.".concat(e,".complete"),t),t.emit("easedata.complete",e,t);}));}(this,this._easeData)),this._easeData.easeTo(t,e,i,n),this},easeDataToPromise:function(t,e,i,n){return this.easeDataTo(t,e,i,n),Mi(this._easeData,"complete-".concat(t))},stopEaseData:function(t,e){return this._easeData?(this._easeData.stopEase(t,e),this):this},stopAllEaseData:function(t){return this._easeData?(this._easeData.stopAll(t),this):this}},yn=function(t,e){if(t){Ut(t).hidden=e;var i=P(t);i?i.setChildVisible(t,!e):t.setVisible(!e);}},kn={show:function(t){return void 0===t&&(t=this),function(t){yn(t,!1);}(t),this},hide:function(t){return void 0===t&&(t=this),function(t){yn(t,!0);}(t),this},isShow:function(t){return void 0===t&&(t=this),function(t){return !!t&&!Ut(t).hidden}(t)}};function mn(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var xn={exports:{}};!function(t){var e=Object.prototype.hasOwnProperty,i="~";function n(){}function r(t,e,i){this.fn=t,this.context=e,this.once=i||!1;}function s(t,e,n,s,o){if("function"!=typeof n)throw new TypeError("The listener must be a function");var a=new r(n,s||t,o),h=i?i+e:e;return t._events[h]?t._events[h].fn?t._events[h]=[t._events[h],a]:t._events[h].push(a):(t._events[h]=a,t._eventsCount++),t}function o(t,e){0==--t._eventsCount?t._events=new n:delete t._events[e];}function a(){this._events=new n,this._eventsCount=0;}Object.create&&(n.prototype=Object.create(null),(new n).__proto__||(i=!1)),a.prototype.eventNames=function(){var t,n,r=[];if(0===this._eventsCount)return r;for(n in t=this._events)e.call(t,n)&&r.push(i?n.slice(1):n);return Object.getOwnPropertySymbols?r.concat(Object.getOwnPropertySymbols(t)):r},a.prototype.listeners=function(t){var e=i?i+t:t,n=this._events[e];if(!n)return [];if(n.fn)return [n.fn];for(var r=0,s=n.length,o=new Array(s);r0){var e=t.runTransitionInCallback();t.delayCall(e,this.next,this);}else this.next();}},{key:"exit_TRANS_OPNE",value:function(){this.parent.removeDelayCall();}},{key:"next_OPEN",value:function(){return "TRANS_CLOSE"}},{key:"enter_OPEN",value:function(){this.parent.onOpen();}},{key:"exit_OPEN",value:function(){this.parent.removeDelayCall();}},{key:"next_TRANS_CLOSE",value:function(){return "CLOSE"}},{key:"enter_TRANS_CLOSE",value:function(){var t=this.parent;if(t.transitOutTime>0){var e=t.runTransitionOutCallback();t.delayCall(e,this.next,this);}else this.next();}},{key:"exit_TRANS_CLOSE",value:function(){this.parent.removeDelayCall();}},{key:"next_CLOSE",value:function(){return "TRANS_OPNE"}},{key:"enter_CLOSE",value:function(){this.parent.onClose();}},{key:"exit_CLOSE",value:function(){}},{key:"canOpen",value:function(){return "IDLE"===this.state||"CLOSE"===this.state}},{key:"canClose",value:function(){return "IDLE"===this.state||"OPEN"===this.state}}]),s}(_n),Rn={delayCall:function(t,e,i){return this.delayCallTimer=function(t,e,i,n,r){var s=$e(t);return s.time.delayedCall(e,(function(){s.game.events.once("poststep",(function(){i.call(n,r);}));}))}(this,t,e,i),this},removeDelayCall:function(){return this.delayCallTimer&&(this.delayCallTimer.remove(!1),this.delayCallTimer=void 0),this}},Mn={setTransitInTime:function(t){return this.transitInTime=t,this},setTransitOutTime:function(t){return this.transitOutTime=t,this},setTransitInCallback:function(t){return t||(t=Qt),this.transitInCallback=t,this},setTransitOutCallback:function(t){return t||(t=Qt),this.transitOutCallback=t,this}},Ln={runTransitionInCallback:function(){return this.transitInCallback(this.parent,this.transitInTime),this.transitInTime},onOpen:function(){},requestOpen:function(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}},Dn={runTransitionOutCallback:function(){return this.transitOutCallback(this.parent,this.transitOutTime),this.transitOutTime},onClose:function(){this.oneShotMode&&this.parent.destroy();},requestClose:function(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}},An={};Object.assign(An,Rn,Mn,Ln,Dn);var zn=Phaser.Utils.Objects.GetValue,jn=function(t){r(o,t);var i=l(o);function o(t,n){var r;return e(this,o),(r=i.call(this,t,n)).setTransitInTime(zn(n,"duration.in",200)),r.setTransitOutTime(zn(n,"duration.out",200)),r.setTransitInCallback(zn(n,"transitIn")),r.setTransitOutCallback(zn(n,"transitOut")),r.oneShotMode=zn(n,"destroy",!1),r.delayCallTimer=void 0,r._state=new En(a(r),{eventEmitter:!1,initState:zn(n,"initState","IDLE")}),r.openEventData=void 0,r.closeEventData=void 0,r}return n(o,[{key:"state",get:function(){return this._state.state}},{key:"shutdown",value:function(t){this.isShutdown||(this.transitInCallback=void 0,this.transitOutCallback=void 0,this.openEventData=void 0,this.closeEventData=void 0,this.removeDelayCall(),c(s(o.prototype),"shutdown",this).call(this,t));}}]),o}(ni);Object.assign(jn.prototype,An);var Fn=function(t){r(o,t);var i=l(o);function o(t,n,r){var s;return e(this,o),(s=i.call(this,t,0,0,2,2,n,1)).setAlpha(r),s.setScrollFactor(0),s.boot(),s}return n(o,[{key:"boot",value:function(){this.scene.sys.events.on("prerender",this.resize,this);}},{key:"destroy",value:function(t){this.scene&&!this.ignoreDestroy&&(this.scene.sys.events.off("prerender",this.resize,this),c(s(o.prototype),"destroy",this).call(this,t));}},{key:"tint",get:function(){return this.fillColor},set:function(t){this.setFillStyle(t,this.fillAlpha);}},{key:"resize",value:function(){var t=this.scene,e=t.sys.scale.gameSize,i=t.sys.cameras.main,n=e.width,r=e.height,s=1/i.zoom,o=n/2,a=r/2,h=n*s,l=r*s;this.x===o&&this.y===a||this.setPosition(o,a),this.width===h&&this.height===l||this.setSize(h,l).setOrigin(.5);}}]),o}(Phaser.GameObjects.Rectangle),In=Phaser.Utils.Objects.GetValue,Wn=function(t){r(s,t);var i=l(s);function s(t,n){var r;return e(this,s),(r=i.call(this,t,{eventEmitter:!1})).resetFromJSON(n),r.boot(),r}return n(s,[{key:"resetFromJSON",value:function(t){return this.setHitAreaMode(In(t,"hitAreaMode",0)),this.setEnable(In(t,"enable",!0)),this.setStopMode(In(t,"stopAllLevels",!0)),this}},{key:"boot",value:function(){this.parent.on("pointerdown",(function(t,e,i,n){this.stopAllLevels&&n.stopPropagation();}),this).on("pointerup",(function(t,e,i,n){this.stopAllLevels&&n.stopPropagation();}),this).on("pointermove",(function(t,e,i,n){this.stopAllLevels&&n.stopPropagation();}),this).on("pointerover",(function(t,e,i,n){this.stopAllLevels&&n.stopPropagation();}),this).on("pointerout",(function(t,e){this.stopAllLevels&&e.stopPropagation();}),this);}},{key:"setHitAreaMode",value:function(t){"string"==typeof t&&(t=Bn[t]);var e=this.parent;return e.input&&e.removeInteractive(),0===t?e.setInteractive():e.setInteractive({hitArea:{},hitAreaCallback:function(){return !0}}),this}},{key:"setEnable",value:function(t){return void 0===t&&(t=!0),t?this.parent.setInteractive():this.parent.disableInteractive(),this.enable=t,this}},{key:"setStopMode",value:function(t){return void 0===t&&(t=!0),this.stopAllLevels=t,this}},{key:"toggleEnable",value:function(){return this.setEnable(!this.enable),this}}]),s}(ni),Bn={default:0,fullWindow:1},Xn=Phaser.Utils.Objects.GetValue,Yn=function(t){r(s,t);var i=l(s);function s(t,n){var r;e(this,s);var o=Xn(n,"color",0),h=Xn(n,"alpha",.8);return (r=i.call(this,t,o,h)).touchEventStop=new Wn(a(r),{hitAreaMode:1}),r}return n(s)}(Fn),Hn=function(t,e){void 0!==t._modalScaleSave?(t.scaleX=t._modalScaleSave,t.scaleY=t._modalScaleSave):t._modalScaleSave=t.scaleX,Ei(t,e);},Gn=function(t,e){Ri(t,e,void 0,void 0,!1);},Nn=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Yi(t,e);},Un=function(t,e){Hi(t,e,!1);},Vn=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Yi(t,e,t.alpha);},Jn=function(t,e){Hi(t,e,!1);},qn=function(t,e,i,n,r){return !!t&&(!(n&&!n(t,e,i))&&(!!xt(t,!0).contains(e,i)&&!(r&&!r(t,e,i))))},Kn=Phaser.Utils.Objects.GetValue,Zn=function(t){r(o,t);var i=l(o);function o(t,n){var r;e(this,o),void 0===n&&(n={}),null==n.transitIn&&(n.transitIn=$n.popUp),null==n.transitOut&&(n.transitOut=$n.scaleDown),n.destroy=Kn(n,"destroy",!0),r=i.call(this,t,n);var s=Kn(n,"cover");r.cover=!1!==s?function(t,e){var i=t.scene,n=new Yn(i,e);return i.add.existing(n),t.isRexContainerLite?(t.pin(n,{syncPosition:!1,syncRotation:!1,syncScale:!1,syncAlpha:!1,syncScrollFactor:!1}),t.moveDepthBelow(n)):i.children.moveBelow(n,t),n}(t,s):void 0,r.cover&&(r.setCoverTransitInCallback(Kn(s,"transitIn",Vn)),r.setCoverTransitOutCallback(Kn(s,"transitOut",Jn)));var h=Kn(n,"touchOutsideClose",!1),l=Kn(n,"duration.hold",-1),u=Kn(n,"timeOutClose",l>=0),c=Kn(n,"anyTouchClose",!1);return Kn(n,"manualClose",!1)&&(h=!1,c=!1,u=!1),c&&(h=!1),u?r.setDisplayTime(l):r.setDisplayTime(-1),c?r.once("open",r.anyTouchClose,a(r)):h&&r.once("open",r.touchOutsideClose,a(r)),Kn(n,"openOnStart",!0)&&r.delayCall(0,r.requestOpen,a(r)),r}return n(o,[{key:"shutdown",value:function(t){this.isShutdown||(this.cover||this.scene.input.off("pointerup",this.touchCloseCallback,this),this.cover&&!t&&(this.cover.destroy(),this.cover=void 0),c(s(o.prototype),"shutdown",this).call(this,t));}},{key:"touchOutsideClose",value:function(){return this.cover?this.cover.on("pointerup",this.touchCloseCallback,this):this.scene.input.on("pointerup",this.touchCloseCallback,this),this.clickOutsideTest=!0,this}},{key:"anyTouchClose",value:function(){return this.cover?this.cover.once("pointerup",this.touchCloseCallback,this):this.scene.input.once("pointerup",this.touchCloseCallback,this),this}},{key:"touchCloseCallback",value:function(t){this.clickOutsideTest&&qn(this.parent,t.worldX,t.worldY)||this.requestClose();}},{key:"runTransitionInCallback",value:function(){var t=c(s(o.prototype),"runTransitionInCallback",this).call(this),e=this.cover;return e&&this.coverTransitInCallback&&this.coverTransitInCallback(e,t),t}},{key:"runTransitionOutCallback",value:function(){var t=c(s(o.prototype),"runTransitionOutCallback",this).call(this),e=this.cover;return e&&this.coverTransitOutCallback&&this.coverTransitOutCallback(e,t),t}},{key:"onOpen",value:function(){var t=this.displayTime;t>=0&&this.delayCall(t,this.requestClose,this),this.emit("open",this.parent,this),c(s(o.prototype),"onOpen",this).call(this);}},{key:"onClose",value:function(){this.emit("close",this.closeEventData),c(s(o.prototype),"onClose",this).call(this);}},{key:"setDisplayTime",value:function(t){return this.displayTime=t,this}},{key:"setTransitInCallback",value:function(t){switch("string"==typeof t&&(t=$n[t]),t){case $n.popUp:t=Hn;break;case $n.fadeIn:t=Nn;}return c(s(o.prototype),"setTransitInCallback",this).call(this,t),this}},{key:"setTransitOutCallback",value:function(t){switch("string"==typeof t&&(t=$n[t]),t){case $n.scaleDown:t=Gn;break;case $n.fadeOut:t=Un;}return c(s(o.prototype),"setTransitOutCallback",this).call(this,t),this}},{key:"setCoverTransitInCallback",value:function(t){return this.coverTransitInCallback=t,this}},{key:"setCoverTransitOutCallback",value:function(t){return this.coverTransitOutCallback=t,this}}]),o}(jn),$n={popUp:0,fadeIn:1,scaleDown:0,fadeOut:1},Qn=function(t){return t&&"function"==typeof t},tr={modal:function(t,e){return Qn(t)&&(e=t,t=void 0),void 0===this._modalBehavior&&(this.onCreateModalBehavior&&this.onCreateModalBehavior(this,t),this._modalBehavior=function(t,e){var i=new Zn(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:function(t){var e=this;return new Promise((function(i,n){e.modal(t,i);}))},modalClose:function(t){return function(t,e){t.emit("modal.requestClose",e);}(this,t),this}},er=function(t,e,i,n){if(e)return qn(t,e.worldX,e.worldY,i,n);for(var r=t.scene.input.manager,s=r.pointersTotal,o=r.pointers,a=0;a=this.dragThreshold&&this.cancel();}},{key:"click",value:function(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 n=this.lastClickTime;return void 0!==n&&t-n<=this.clickInterval||(this.lastClickTime=t,this.emit("click",this,this.parent,e,i)),this}},{key:"cancel",value:function(){return this.pointer=void 0,this}},{key:"onOver",value:function(t,e,i,n){return this.enable?(this.emit("over",this,this.parent,t,n),this):this}},{key:"onOut",value:function(t,e){return this.enable?(this.emit("out",this,this.parent,t,e),this):this}}]),o}(ni),pr={press:0,pointerdown:0,release:1,pointerup:1},gr={onClick:function(t,e,i,n){return t?("function"==typeof t&&(n=i,i=e,e=t,t=this),void 0===t._click&&(t._click=new vr(t,n)),t._click.on("click",e,i),this):this},offClick:function(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:function(e,i){return e&&"object"!==t(e)&&(i=e,e=this),void 0===e._click||e._click.setEnable(i),this},disableClick:function(e){return e&&"object"!==t(e)&&(e=this),void 0===e._click||e._click.setEnable(!1),this}},yr=function(t,e,i,n){if(e)return !(i&&!i(t,e))&&(!!kr(t,e)&&!(n&&!n(t,e)));for(var r=t.scene.input.manager,s=r.pointersTotal,o=r.pointers,a=0;a0)return mr.length=0,!0;return mr.length=0,!1},mr=[],xr=Phaser.Utils.Objects.GetValue,br=function(t){r(o,t);var i=l(o);function o(t,n){var r;e(this,o),(r=i.call(this,t,n))._enable=void 0;var s=xr(n,"inputConfig",void 0);return s&&t.setInteractive(s),r.resetFromJSON(n),r.boot(),r}return n(o,[{key:"resetFromJSON",value:function(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}},{key:"boot",value:function(){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);}},{key:"shutdown",value:function(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,c(s(o.prototype),"shutdown",this).call(this,t);}}},{key:"enable",get:function(){return this._enable},set:function(t){if(this._enable!==t){t||this.cancel(),this._enable=t;var e=t?"enable":"disable";this.emit(e,this,this.parent);}}},{key:"setEnable",value:function(t){return void 0===t&&(t=!0),this.enable=t,this}},{key:"toggleEnable",value:function(){return this.setEnable(!this.enable),this}},{key:"setMode",value:function(t){return "string"==typeof t&&(t=wr[t]),this.mode=t,this}},{key:"setClickInterval",value:function(t){return this.clickInterval=t,this}},{key:"setDragThreshold",value:function(t){return this.dragThreshold=t,this}},{key:"isPointerInside",value:function(t){var e=this.parent;return (e.input?yr:er)(e,t)}},{key:"onPress",value:function(t){this.parent.willRender(t.camera)&&void 0===this.pointer&&(this.pointer=t,0===this.mode&&(this.isPointerInside(t)||this.click(t.downTime,t)));}},{key:"onRelease",value:function(t){this.parent.willRender(t.camera)&&this.pointer===t&&(1===this.mode&&(this.isPointerInside(t)||this.click(t.upTime,t)),this.pointer=void 0);}},{key:"onMove",value:function(t,e,i,n){this.pointer===t&&void 0!==this.dragThreshold&&1===this.mode&&(t.getDistance()>=this.dragThreshold||this.isPointerInside(t))&&this.cancel();}},{key:"click",value:function(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}},{key:"cancel",value:function(){return this.pointer=void 0,this}}]),o}(ni),wr={press:0,pointerdown:0,release:1,pointerup:1},Cr={onClickOutside:function(t,e,i,n){return t?("function"==typeof t&&(n=i,i=e,e=t,t=this),void 0===t._clickOutside&&(t._clickOutside=new br(t,n)),t._clickOutside.on("clickoutside",e,i),this):this},offClickOutside:function(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:function(e,i){return e&&"object"!==t(e)&&(i=e,e=this),void 0===e._clickOutside||e._clickOutside.setEnable(i),this},disableClickOutside:function(e){return e&&"object"!==t(e)&&(e=this),void 0===e._clickOutside||e._clickOutside.setEnable(!1),this}},Sr=function(t){r(s,t);var i=l(s);function s(){var t;return e(this,s),(t=i.call(this,{eventEmitter:!1})).goto("IDLE"),t}return n(s,[{key:"setCooldownTime",value:function(t){return this.cooldownTime=t,this.cooldownMode=void 0!==t,this}},{key:"request",value:function(){return this.runMethod("request")}},{key:"update_IDLE",value:function(){this.compensationTime=0;}},{key:"request_IDLE",value:function(){return this.next(),!0}},{key:"next_IDLE",value:function(){if(this.cooldownMode)return "COOLDOWN"}},{key:"enter_COOLDOWN",value:function(){this.remainderTime=this.cooldownTime+this.compensationTime;}},{key:"update_COOLDOWN",value:function(t,e){this.remainderTime-=e,this.remainderTime<0&&(this.compensationTime=this.cooldownTime>e?-this.remainderTime:0,this.goto("IDLE"));}},{key:"request_COOLDOWN",value:function(){return !1}}]),s}(_n),Pr=Phaser.Utils.Objects.GetValue,Or=function(t){r(o,t);var i=l(o);function o(t,n){var r;return e(this,o),(r=i.call(this,t,n))._enable=void 0,r.cooldown=new Sr,r.parent.setInteractive(Pr(n,"inputConfig",void 0)),r.resetFromJSON(n),r.boot(),r}return n(o,[{key:"resetFromJSON",value:function(t){return this.pointer=void 0,this.prevIsInTouch=!1,this.isInTouching=!1,this.setEnable(Pr(t,"enable",!0)),this.setCooldown(Pr(t,"cooldown",void 0)),this}},{key:"boot",value:function(){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);}},{key:"shutdown",value:function(t){this.isShutdown||(this.scene.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,c(s(o.prototype),"shutdown",this).call(this,t));}},{key:"enable",get:function(){return this._enable},set:function(t){if(this._enable!==t)return t||(this.prevIsInTouch=!1,this.isInTouching=!1,this.pointer=void 0),this._enable=t,this}},{key:"setEnable",value:function(t){return void 0===t&&(t=!0),this.enable=t,this}},{key:"cooldownTime",get:function(){return this.cooldown.cooldownTime},set:function(t){this.cooldown.setCooldownTime(t);}},{key:"setCooldown",value:function(t){return this.cooldownTime=t,this}},{key:"toggleEnable",value:function(){return this.setEnable(!this.enable),this}},{key:"onPointIn",value:function(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.pointer=t,this.isInTouching=!0);}},{key:"onPointOut",value:function(t){this.enable&&this.pointer===t&&(this.pointer=void 0,this.isInTouching=!1);}},{key:"preupdate",value:function(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;}}]),o}(ni),Tr={isPointerInBounds:function(t){return void 0===t?t=this:"string"==typeof t&&(t=this.getElement(t)),!!t&&er(t)},onTouching:function(t,e,i,n){return t?("function"==typeof t&&(n=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new Or(t,n)),t._inTouching.on("intouch",e,i),this):this},offTouching:function(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:function(t,e,i,n){return t?("function"==typeof t&&(n=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new Or(t,n)),t._inTouching.on("touchend",e,i),this):this},offTouchingEnd:function(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:function(e,i){return e&&"object"!==t(e)&&(i=e,e=this),void 0===e._inTouching||e._inTouching.setEnable(i),this},disableTouching:function(e){return e&&"object"!==t(e)&&(e=this),void 0===e._inTouching||e._inTouching.setEnable(!1),this}},_r=function(t,e,i){for(var n,r=0,s=t.length;r0),this.onDragStart()));}},{key:"onPointerUp",value:function(t){this.enable&&((!this.bounds||this.bounds.contains(t.x,t.y))&&this.pointer===t&&(this.pointer=void 0,this.movedState=!1,this.tracerState=Gr,this.onDragEnd()));}},{key:"onPointerMove",value:function(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()));}}},{key:"dragCancel",value:function(){return this.tracerState===Nr&&this.onDragEnd(),this.pointer=void 0,this.tracerState=Gr,this}},{key:"onDragStart",value:function(){this.emit("dragstart",this);}},{key:"onDragEnd",value:function(){this.emit("dragend",this);}},{key:"onDrag",value:function(){this.emit("drag",this);}},{key:"preUpdate",value:function(t,e){}},{key:"postUpdate",value:function(t,e){}},{key:"startTicking",value:function(){c(s(o.prototype),"startTicking",this).call(this),this.scene.sys.events.on("preupdate",this.preUpdate,this),this.scene.sys.events.on("postupdate",this.postUpdate,this);}},{key:"stopTicking",value:function(){c(s(o.prototype),"stopTicking",this).call(this),this.scene&&(this.scene.sys.events.off("preupdate",this.preUpdate,this),this.scene.sys.events.off("postupdate",this.postUpdate,this));}},{key:"setRecongizedStateObject",value:function(t){return this.recongizedState=t,this}},{key:"state",get:function(){return this.recongizedState.state},set:function(t){this.recongizedState.state=t;}},{key:"cancel",value:function(){return this.state=Ur,this}}]),o}(oi),Gr=0,Nr=1,Ur="IDLE",Vr=Phaser.Utils.Objects.GetValue,Jr=Phaser.Math.Distance.Between,qr=function(t){r(o,t);var i=l(o);function o(t,n){var r;e(this,o);var s=a(r=i.call(this,t,n)),h={states:{IDLE:{enter:function(){s.stop(),s.tapsCount=0,s.x=0,s.y=0,s.worldX=0,s.worldY=0;},exit:function(){var t=s.lastPointer;s.x=t.x,s.y=t.y,s.worldX=t.worldX,s.worldY=t.worldY;}},BEGIN:{enter:function(){s.start(),s.tapsCount=0,s.emit("tappingstart",s,s.gameObject,s.lastPointer);}},RECOGNIZED:{enter:function(){s.start(),s.emit("tap",s,s.gameObject,s.lastPointer),s.emit("".concat(s.tapsCount,"tap"),s,s.gameObject,s.lastPointer);}}},init:function(){this.state=Kr;},eventEmitter:!1};return r.setRecongizedStateObject(new _n(h)),r}return n(o,[{key:"resetFromJSON",value:function(t){c(s(o.prototype),"resetFromJSON",this).call(this,t),this.setHoldTime(Vr(t,"time",250)),this.setTapInterval(Vr(t,"tapInterval",200)),this.setDragThreshold(Vr(t,"threshold",9)),this.setTapOffset(Vr(t,"tapOffset",10));var e=Vr(t,"taps",void 0);return void 0!==e?this.setTaps(e):(this.setMaxTaps(Vr(t,"maxTaps",void 0)),this.setMinTaps(Vr(t,"minTaps",void 0))),this}},{key:"onDragStart",value:function(){switch(this.state){case Kr:this.state=Zr;break;case Zr:var t=this.lastPointer;Jr(t.upX,t.upY,t.x,t.y)>this.tapOffset&&(this.state=$r,this.state=Zr);break;case $r:this.state=Zr;}}},{key:"onDragEnd",value:function(){this.state===Zr&&(this.tapsCount++,this.emit("tapping",this,this.gameObject,this.lastPointer),void 0!==this.maxTaps&&this.tapsCount===this.maxTaps&&(this.state=$r));}},{key:"onDrag",value:function(){this.state!==Kr&&this.pointer.getDistance()>this.dragThreshold&&(this.state=Kr);}},{key:"preUpdate",value:function(t,e){if(this.isRunning&&this.enable&&this.state===Zr){var i=this.lastPointer;if(i.isDown)t-i.downTime>this.holdTime&&(this.state=Kr);else t-i.upTime>this.tapInterval&&(void 0===this.minTaps||this.tapsCount>=this.minTaps?this.state=$r:this.state=Kr);}}},{key:"postUpdate",value:function(t,e){this.isRunning&&this.enable&&this.state===$r&&(this.state=Kr);}},{key:"isTapped",get:function(){return this.state===$r}},{key:"setHoldTime",value:function(t){return this.holdTime=t,this}},{key:"setTapInterval",value:function(t){return this.tapInterval=t,this}},{key:"setDragThreshold",value:function(t){return this.dragThreshold=t,this}},{key:"setTapOffset",value:function(t){return this.tapOffset=t,this}},{key:"setMaxTaps",value:function(t){return this.maxTaps=t,this}},{key:"setMinTaps",value:function(t){return this.minTaps=t,this}},{key:"setTaps",value:function(t,e){return void 0===e&&(e=t),this.setMinTaps(t).setMaxTaps(e),this}}]),o}(Hr),Kr="IDLE",Zr="BEGIN",$r="RECOGNIZED",Qr=Phaser.Utils.Objects.GetValue,ts=function(t){r(o,t);var i=l(o);function o(t,n){var r;e(this,o);var s=a(r=i.call(this,t,n)),h={states:{IDLE:{enter:function(){s.x=0,s.y=0,s.worldX=0,s.worldY=0;},exit:function(){var t=s.lastPointer;s.x=t.x,s.y=t.y,s.worldX=t.worldX,s.worldY=t.worldY;}},BEGIN:{enter:function(){s.start();},exit:function(){s.stop();}},RECOGNIZED:{enter:function(){s.emit("pressstart",s,s.gameObject,s.lastPointer);},exit:function(){s.emit("pressend",s,s.gameObject,s.lastPointer);}}},init:function(){this.state=es;},eventEmitter:!1};return r.setRecongizedStateObject(new _n(h)),r}return n(o,[{key:"resetFromJSON",value:function(t){return c(s(o.prototype),"resetFromJSON",this).call(this,t),this.setDragThreshold(Qr(t,"threshold",9)),this.setHoldTime(Qr(t,"time",251)),this}},{key:"onDragStart",value:function(){this.state=is,0===this.holdTime&&(this.state=ns);}},{key:"onDragEnd",value:function(){this.state=es;}},{key:"onDrag",value:function(){this.state!==es&&this.pointer.getDistance()>this.dragThreshold&&(this.state=es);}},{key:"preUpdate",value:function(t,e){this.isRunning&&this.enable&&(this.state===is&&t-this.pointer.downTime>=this.holdTime&&(this.state=ns));}},{key:"isPressed",get:function(){return this.state===ns}},{key:"setHoldTime",value:function(t){return this.holdTime=t,this}},{key:"setDragThreshold",value:function(t){return this.dragThreshold=t,this}}]),o}(Hr),es="IDLE",is="BEGIN",ns="RECOGNIZED";Phaser.Utils.Objects.GetValue;var rs=Phaser.Math.Distance.Between,ss=Phaser.Math.Angle.Between,os={getDt:function(){var t;return t=this.scene,ei(t).loop.delta},getVelocity:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return rs(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 ss(e.x,e.y,t.x,t.y)}},as={"up&down":0,"left&right":1,"4dir":2,"8dir":3},hs={},ls=Phaser.Utils.Objects.GetValue,us=Phaser.Math.RadToDeg,cs=function(t){r(o,t);var i=l(o);function o(t,n){var r;e(this,o);var s=a(r=i.call(this,t,n)),h={states:{IDLE:{enter:function(){s.x=0,s.y=0,s.worldX=0,s.worldY=0;},exit:function(){var t=s.lastPointer;s.x=t.x,s.y=t.y,s.worldX=t.worldX,s.worldY=t.worldY;}},BEGIN:{enter:function(){s.validDrag=!1;}},RECOGNIZED:{enter:function(){s.start(),s.updateDirectionStates(),s.emit("swipe",s,s.gameObject,s.lastPointer);},exit:function(){s.stop(),s.clearDirectionStates();}}},init:function(){this.state=ds;},eventEmitter:!1};return r.setRecongizedStateObject(new _n(h)),r.clearDirectionStates(),r}return n(o,[{key:"resetFromJSON",value:function(t){return c(s(o.prototype),"resetFromJSON",this).call(this,t),this.setDragThreshold(ls(t,"threshold",10)),this.setVelocityThreshold(ls(t,"velocityThreshold",1e3)),this.setDirectionMode(ls(t,"dir","8dir")),this}},{key:"onDragStart",value:function(){this.state=fs;}},{key:"onDragEnd",value:function(){this.state=ds;}},{key:"onDrag",value:function(){this.state===fs&&(this.validDrag||(this.validDrag=0===this.dragThreshold||this.pointer.getDistance()>=this.dragThreshold),this.validDrag&&this.dragVelocity>this.velocityThreshold&&(this.state=vs));}},{key:"postUpdate",value:function(t,e){this.isRunning&&this.enable&&this.state===vs&&(this.state=ds);}},{key:"isSwiped",get:function(){return this.state===vs}},{key:"dragVelocity",get:function(){var t;switch(this.dirMode){case 0:t=this.getVelocityY();break;case 1:t=this.getVelocityX();break;default:t=this.getVelocity();}return t}},{key:"setDragThreshold",value:function(t){return this.dragThreshold=t,this}},{key:"setVelocityThreshold",value:function(t){return this.velocityThreshold=t,this}},{key:"setDirectionMode",value:function(t){return "string"==typeof t&&(t=as[t]),this.dirMode=t,this}},{key:"updateDirectionStates",value:function(){return function(t,e,i){switch(void 0===i?i={}:!0===i&&(i=hs),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;}}(us(this.getVelocityAngle()),this.dirMode,this),this}},{key:"clearDirectionStates",value:function(){return this.left=!1,this.right=!1,this.up=!1,this.down=!1,this}}]),o}(Hr);Object.assign(cs.prototype,os);var ds="IDLE",fs="BEGIN",vs="RECOGNIZED",ps=Phaser.Utils.Objects.GetValue,gs=Phaser.Utils.Array.SpliceOne,ys=Phaser.Math.Distance.Between,ks=Phaser.Math.Angle.Between,ms=function(){function t(i,n){e(this,t);var r=i.input.manager.pointersTotal-1;r<2&&i.input.addPointer(2-r),this.scene=i,this.setEventEmitter(ps(n,"eventEmitter",void 0)),this._enable=void 0,this.pointers=[],this.movedState={},this.resetFromJSON(n),this.boot();}return n(t,[{key:"resetFromJSON",value:function(t){return this.setEnable(ps(t,"enable",!0)),this.bounds=ps(t,"bounds",void 0),this.tracerState=bs,this.pointers.length=0,Rt(this.movedState),this}},{key:"boot",value:function(){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);}},{key:"shutdown",value:function(){this.scene&&(this.destroyEventEmitter(),this.pointers.length=0,Rt(this.movedState),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);}},{key:"destroy",value:function(){this.shutdown();}},{key:"enable",get:function(){return this._enable},set:function(t){if(this._enable!==t)return t||this.dragCancel(),this._enable=t,this}},{key:"setEnable",value:function(t){return void 0===t&&(t=!0),this.enable=t,this}},{key:"toggleEnable",value:function(){return this.setEnable(!this.enable),this}},{key:"onPointerDown",value:function(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.tracerState){case bs:this.tracerState=ws,this.onDrag1Start();break;case ws:this.tracerState=Cs,this.onDrag2Start();}}},{key:"onPointerUp",value:function(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],gs(this.pointers,e),this.tracerState){case ws:this.tracerState=bs,this.onDrag1End();break;case Cs:this.tracerState=ws,this.onDrag2End(),this.onDrag1Start();}}}},{key:"onPointerMove",value:function(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 ws:this.onDrag1();break;case Cs:this.onDrag2();}}}},{key:"dragCancel",value:function(){return this.tracerState===Cs&&this.onDrag2End(),this.pointers.length=0,Rt(this.movedState),this.tracerState=bs,this}},{key:"onDrag1Start",value:function(){this.emit("drag1start",this);}},{key:"onDrag1End",value:function(){this.emit("drag1end",this);}},{key:"onDrag1",value:function(){this.emit("drag1",this);}},{key:"onDrag2Start",value:function(){this.emit("drag2start",this);}},{key:"onDrag2End",value:function(){this.emit("drag2end",this);}},{key:"onDrag2",value:function(){this.emit("drag2",this);}},{key:"distanceBetween",get:function(){if(this.tracerState!==Cs)return 0;var t=this.pointers[0],e=this.pointers[1];return ys(t.x,t.y,e.x,e.y)}},{key:"angleBetween",get:function(){if(this.tracerState!==Cs)return 0;var t=this.pointers[0],e=this.pointers[1];return ks(t.x,t.y,e.x,e.y)}},{key:"drag1Vector",get:function(){var t=this.pointers[0];if(t&&this.movedState[t.id]){var e=t.position,i=t.prevPosition;xs.x=e.x-i.x,xs.y=e.y-i.y;}else xs.x=0,xs.y=0;return xs}},{key:"centerX",get:function(){if(this.tracerState!==Cs)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return (t.x+e.x)/2}},{key:"centerY",get:function(){if(this.tracerState!==Cs)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return (t.y+e.y)/2}},{key:"prevCenterX",get:function(){if(this.tracerState!==Cs)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}},{key:"prevCenterY",get:function(){if(this.tracerState!==Cs)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}},{key:"movementCenterX",get:function(){return this.centerX-this.prevCenterX}},{key:"movementCenterY",get:function(){return this.centerY-this.prevCenterY}},{key:"setRecongizedStateObject",value:function(t){return this.recongizedState=t,this}},{key:"state",get:function(){return this.recongizedState.state},set:function(t){this.recongizedState.state=t;}},{key:"cancel",value:function(){return this.state=Ss,this}}]),t}();Object.assign(ms.prototype,qe);var xs={},bs=0,ws=1,Cs=2,Ss="IDLE";Phaser.Utils.Objects.GetValue;var Ps=Phaser.Math.RotateAround,Os=function(t,e,i,n){return Ps(t,e,i,n),t.rotation+=n,t},Ts={},_s=Phaser.Utils.Objects.GetValue,Es=Phaser.Math.Angle.WrapDegrees,Rs=Phaser.Math.Angle.ShortestBetween,Ms=Phaser.Math.RadToDeg,Ls=Phaser.Math.DegToRad,Ds=function(t){r(o,t);var i=l(o);function o(t,n){var r;e(this,o);var s=a(r=i.call(this,t,n)),h={states:{IDLE:{enter:function(){s.prevAngle=void 0,s.angle=0;}},BEGIN:{},RECOGNIZED:{enter:function(){s.emit("rotatestart",s);},exit:function(){s.emit("rotateend",s);}}},init:function(){this.state=zs;},eventEmitter:!1};return r.setRecongizedStateObject(new _n(h)),r}return n(o,[{key:"resetFromJSON",value:function(t){return c(s(o.prototype),"resetFromJSON",this).call(this,t),this.setDragThreshold(_s(t,"threshold",0)),this}},{key:"onDrag2Start",value:function(){this.prevAngle=Es(Ms(this.angleBetween)),this.state=js,0===this.dragThreshold&&(this.state=Fs);}},{key:"onDrag2End",value:function(){this.state=zs;}},{key:"onDrag2",value:function(){switch(this.state){case js:if(this.pointers[0].getDistance()>=this.dragThreshold&&this.pointers[1].getDistance()>=this.dragThreshold){var t=Es(Ms(this.angleBetween));this.angle=Rs(this.prevAngle,t),this.prevAngle=t,this.state=Fs;}break;case Fs:t=Es(Ms(this.angleBetween));this.angle=Rs(this.prevAngle,t),this.prevAngle=t,this.emit("rotate",this);}}},{key:"isRotated",get:function(){return this.state===Fs}},{key:"rotation",get:function(){return Ls(this.angle)}},{key:"setDragThreshold",value:function(t){return this.dragThreshold=t,this}}]),o}(ms),As={spinObject:function(t,e){if(!this.isRotation)return this;void 0===e&&(e=this.pointers[0].camera);var i=this.movementCenterX,n=this.movementCenterY,r=function(t,e,i,n){return void 0===n?n={}:!0===n&&(n=Ts),i.getWorldPoint(t,e,n),n}(this.centerX,this.centerY,e,!0),s=r.x,o=r.y,a=this.rotation;if(Array.isArray(t))for(var h=t,l=0,u=h.length;l=this.sizerChildren.length?this.sizerChildren.push(e):this.sizerChildren.splice(a,0,e),e.isRexSizer||(i>0&&(0===this.orientation?e.minWidth=void 0===h?pt(e):h:e.minHeight=void 0===l?gt(e):l),s&&(0===this.orientation?e.minHeight=l:e.minWidth=h)),void 0!==o&&this.addChildrenMap(o,e),this},ro={add:no,addSpace:function(t){return this.insertSpace(void 0,t),this},insertSpace:function(t,e){return void 0===e&&(e=1),no.call(this,new Zs(this.scene),{proportion:e,minWidth:0,minHeight:0,index:t}),this},insert:function(t,e,i,n,r,s,o,a){return Qs(i)&&(i.index=t),no.call(this,e,i,n,r,s,o,t,a),this},insertAtPosition:function(t,e,i,n,r,s,o,a,h){var l=$s.call(this,t,e);return -1===l&&(l=void 0),this.insert(l,i,n,r,s,o,a,h),this}},so=Nt.prototype.clear,oo=function(t){this.backgroundChildren&&(this.backgroundChildren.length=0);var e,i=!t&&this.sizerEventsEnable;if(i&&(e=this.getChildren([])),so.call(this,t),i)for(var n,r=0,s=e.length;r=0;e--)this.remove(this.sizerChildren[e],t);return this},clear:function(t){return this.sizerChildren.length=0,oo.call(this,t),this}},lo={getChildAlign:function(t){return this.getSizerConfig(t).align},setChildAlign:function(t,e){return "string"==typeof e&&(e=$t[e]),this.getSizerConfig(t).align=e,this}},uo={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,n,r=0,s=this.sizerChildren;if(0===this.orientation)for(var o=this.space.item,a=!0,h=0,l=s.length;h0&&this.proportionLength>0&&(i=n.proportion*this.proportionLength):n.expand&&(i=e-this.space.left-this.space.right-r.left-r.right);return i},getExpandedChildHeight:function(t,e){var i;void 0===e&&(e=this.height);var n=t.rexSizer,r=n.padding;0===this.orientation?n.expand&&(i=e-this.space.top-this.space.bottom-r.top-r.bottom):n.proportion>0&&this.proportionLength>0&&(i=n.proportion*this.proportionLength);return i},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,n=0,r=i.length;n0?(e=t-this.getChildrenWidth(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0;}return t},resolveHeight:function(t){t=Ue.call(this,t);if(void 0===this.proportionLength&&1===this.orientation){var e=t-this.childrenHeight;e>0?(e=t-this.getChildrenHeight(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0;}return t}};Object.assign(uo,ro,ho,lo,{getChildProportion:function(t){return this.getSizerConfig(t).proportion},setChildProportion:function(t,e){return this.getSizerConfig(t).proportion=e,this}},{getChildExpand:function(t){return this.getSizerConfig(t).expand},setChildExpand:function(t,e){return this.getSizerConfig(t).expand=e,this}});var co=function(){for(var t,e,i=0,n=this.sizerChildren,r=0,s=n.length;r0&&(i+=e);return i},fo={x:0,h:0,horizontal:0,"left-to-right":0,y:1,v:1,vertical:1,"top-to-bottom":1},vo=function(t){return "string"==typeof t&&(t=fo[t]),t},po=Phaser.Utils.Objects.IsPlainObject,go=Phaser.Utils.Objects.GetValue,yo=function(t){r(s,t);var i=l(s);function s(t,n,r,o,a,h,l){var u;return e(this,s),po(n)?(n=go(l=n,"x",0),r=go(l,"y",0),o=go(l,"width",void 0),a=go(l,"height",void 0),h=go(l,"orientation",0)):po(o)?(o=go(l=o,"width",void 0),a=go(l,"height",void 0),h=go(l,"orientation",0)):po(h)&&(h=go(l=h,"orientation",0)),void 0===h&&(h=0),(u=i.call(this,t,n,r,o,a,l)).type="rexSizer",u.sizerChildren=[],u.setOrientation(h),u.setItemSpacing(go(l,"space.item",0)),u.setStartChildIndex(go(l,"startChildIndex",0)),u.setRTL(go(l,"rtl",!1)),u.addChildrenMap("items",u.sizerChildren),u}return n(s,[{key:"setOrientation",value:function(t){return this.orientation=vo(t),this}},{key:"setItemSpacing",value:function(t){return this.space.item=t,this}},{key:"setStartChildIndex",value:function(t){return this.startChildIndex=t,this}},{key:"setRTL",value:function(t){return void 0===t&&(t=!0),this.rtl=t,this}},{key:"childrenProportion",get:function(){return void 0===this._childrenProportion&&(this._childrenProportion=co.call(this)),this._childrenProportion}}]),s}(Js);Object.assign(yo.prototype,uo);var ko=Phaser.Utils.Objects.GetValue,mo=function(){function t(i,n,r,s,o){e(this,t),void 0===i&&(i=0),void 0===n&&(n=i),void 0===r&&(r=0),void 0===s&&(s=0),void 0===o&&(o=0),this.cornerRadius={},this._width=0,this._height=0,this.setTo(i,n,r,s,o);}return n(t,[{key:"setTo",value:function(t,e,i,n,r){return this.setPosition(t,e),this.setRadius(r),this.setSize(i,n),this}},{key:"setPosition",value:function(t,e){return this.x=t,this.y=e,this}},{key:"setRadius",value:function(t){return void 0===t&&(t=0),this.radius=t,this}},{key:"setSize",value:function(t,e){return this.width=t,this.height=e,this}},{key:"minWidth",get:function(){var t=this.cornerRadius;return Math.max(t.tl.x+t.tr.x,t.bl.x+t.br.x)}},{key:"minHeight",get:function(){var t=this.cornerRadius;return Math.max(t.tl.y+t.bl.y,t.tr.y+t.br.y)}},{key:"width",get:function(){return this._width},set:function(t){null==t&&(t=0),this._width=Math.max(t,this.minWidth);}},{key:"height",get:function(){return this._height},set:function(t){null==t&&(t=0),this._height=Math.max(t,this.minHeight);}},{key:"radius",get:function(){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:function(t){var e,i;"number"==typeof t?(e=t,i=t):(e=ko(t,"x",0),i=ko(t,"y",0));var n=this.cornerRadius;n.tl=xo(ko(t,"tl",void 0),e,i),n.tr=xo(ko(t,"tr",void 0),e,i),n.bl=xo(ko(t,"bl",void 0),e,i),n.br=xo(ko(t,"br",void 0),e,i);}},{key:"radiusTL",get:function(){var t=this.cornerRadius.tl;return Math.max(t.x,t.y)},set:function(t){bo(this.cornerRadius.tl,t);}},{key:"radiusTR",get:function(){var t=this.cornerRadius.tr;return Math.max(t.x,t.y)},set:function(t){bo(this.cornerRadius.tr,t);}},{key:"radiusBL",get:function(){var t=this.cornerRadius.bl;return Math.max(t.x,t.y)},set:function(t){bo(this.cornerRadius.bl,t);}},{key:"radiusBR",get:function(){var t=this.cornerRadius.br;return Math.max(t.x,t.y)},set:function(t){bo(this.cornerRadius.br,t);}}]),t}(),xo=function(t,e,i){return void 0===t?t={x:e,y:i}:"number"==typeof t&&(t={x:t,y:t}),wo(t),t},bo=function(t,e){"number"==typeof e?(t.x=e,t.y=e):(t.x=ko(e,"x",0),t.y=ko(e,"y",0)),wo(t);},wo=function(t){t.convex=t.x>=0||t.y>=0,t.x=Math.abs(t.x),t.y=Math.abs(t.y);},Co=function(t,e,i){var n=i.length;if(n>=2){var r=i[n-2],s=i[n-1];if(t===r&&e===s)return i}return i.push(t,e),i},So=Phaser.Math.DegToRad,Po=function(t,e,i,n,r,s,o,a,h){o&&s>r?s-=360:!o&&s>>16,a=(65280&r)>>>8,h=255&r;t.fillStyle="rgba("+o+","+a+","+h+","+s+")";}(r,e),r.fill()),e.isStroked&&(!function(t,e,i,n){var r=i||e.strokeColor,s=n||e.strokeAlpha,o=(16711680&r)>>>16,a=(65280&r)>>>8,h=255&r;t.strokeStyle="rgba("+o+","+a+","+h+","+s+")",t.lineWidth=e.lineWidth;}(r,e),r.stroke()),r.restore();}}},Mo=Phaser.GameObjects.Shape,Lo=Phaser.Utils.Objects.IsPlainObject,Do=Phaser.Utils.Objects.GetValue,Ao=Phaser.Geom.Polygon.Earcut,zo=function(t){r(s,t);var i=l(s);function s(t,n,r,o,a,h,l,u){var c,d,f,v,p;if(e(this,s),Lo(n)){var g=n;n=g.x,r=g.y,o=g.width,a=g.height,h=g.radius,l=g.color,u=g.alpha,d=g.strokeColor,f=g.strokeAlpha,v=g.strokeWidth,p=g.shape;}void 0===n&&(n=0),void 0===r&&(r=0),void 0===o&&(o=1),void 0===a&&(a=o),void 0===h&&(h=0),void 0===p&&(p=0);var y=new mo;if((c=i.call(this,t,"rexRoundRectangleShape",y)).setShapeType(p),0===c.shapeType){var k=Do(h,"radius",h);y.setTo(0,0,o,a,k);}else {k={x:o/2,y:a/2};y.setTo(0,0,o,a,k);}var m=Do(h,"iteration",void 0);return c.setIteration(m),c.setPosition(n,r),c.setFillStyle(l,u),void 0!==d&&void 0===v&&(v=2),c.setStrokeStyle(v,d,f),c.updateDisplayOrigin(),c.dirty=!0,c}return n(s,[{key:"fillColor",get:function(){return this._fillColor},set:function(t){this._fillColor=t,this.isFilled=null!=t&&this._fillAlpha>0;}},{key:"fillAlpha",get:function(){return this._fillAlpha},set:function(t){this._fillAlpha=t,this.isFilled=t>0&&null!=this._fillColor;}},{key:"setFillStyle",value:function(t,e){return void 0===e&&(e=1),this.fillColor=t,this.fillAlpha=e,this}},{key:"strokeColor",get:function(){return this._strokeColor},set:function(t){this._strokeColor=t,this.isStroked=null!=t&&this._strokeAlpha>0&&this._lineWidth>0;}},{key:"strokeAlpha",get:function(){return this._strokeAlpha},set:function(t){this._strokeAlpha=t,this.isStroked=t>0&&null!=this._strokeColor&&this._lineWidth>0;}},{key:"lineWidth",get:function(){return this._lineWidth},set:function(t){this._lineWidth=t,this.isStroked=t>0&&null!=this._strokeColor;}},{key:"setStrokeStyle",value:function(t,e,i){return void 0===i&&(i=1),this.lineWidth=t,this.strokeColor=e,this.strokeAlpha=i,this}},{key:"updateData",value:function(){var t=this.geom,e=this.pathData;e.length=0;var i,n=t.width,r=t.height,s=t.cornerRadius,o=this.iteration+1;if(i=s.tl,jo(i))if(i.convex){var a=i.x,h=i.y;Po(a,h,i.x,i.y,180,270,!1,o,e);}else {Po(a=0,h=0,i.x,i.y,90,0,!0,o,e);}else Co(0,0,e);if(i=s.tr,jo(i))if(i.convex){a=n-i.x,h=i.y;Po(a,h,i.x,i.y,270,360,!1,o,e);}else {Po(a=n,h=0,i.x,i.y,180,90,!0,o,e);}else Co(n,0,e);if(i=s.br,jo(i))if(i.convex){a=n-i.x,h=r-i.y;Po(a,h,i.x,i.y,0,90,!1,o,e);}else {Po(a=n,h=r,i.x,i.y,270,180,!0,o,e);}else Co(n,r,e);if(i=s.bl,jo(i))if(i.convex){a=i.x,h=r-i.y;Po(a,h,i.x,i.y,90,180,!1,o,e);}else {Po(a=0,h=r,i.x,i.y,360,270,!0,o,e);}else Co(0,r,e);return e.push(e[0],e[1]),this.pathIndexes=Ao(e),this}},{key:"setShapeType",value:function(t){return "string"==typeof t&&(t=Fo[t]),this.shapeType=t,this}},{key:"width",get:function(){return this.geom.width},set:function(t){this.resize(t,this.height);}},{key:"height",get:function(){return this.geom.height},set:function(t){this.resize(this.width,t);}},{key:"setSize",value:function(t,e){if(void 0===e&&(e=t),this.geom.width===t&&this.geom.height===e)return this;this.geom.setSize(t,e),1===this.shapeType&&this.setRadius({x:t/2,y:e/2}),this.updateDisplayOrigin(),this.dirty=!0;var i=this.input;return i&&!i.customHitArea&&(i.hitArea.width=t,i.hitArea.height=e),this}},{key:"resize",value:function(t,e){return this.setSize(t,e),this}},{key:"radius",get:function(){return this.geom.radius},set:function(t){this.geom.setRadius(t),this.updateDisplayOrigin(),this.dirty=!0;}},{key:"radiusTL",get:function(){return this.geom.radiusTL},set:function(t){this.geom.radiusTL=t,this.dirty=!0;}},{key:"radiusTR",get:function(){return this.geom.radiusTR},set:function(t){this.geom.radiusTR=t,this.dirty=!0;}},{key:"radiusBL",get:function(){return this.geom.radiusBL},set:function(t){this.geom.radiusBL=t,this.dirty=!0;}},{key:"radiusBR",get:function(){return this.geom.radiusBR},set:function(t){this.geom.radiusBR=t,this.dirty=!0;}},{key:"setRadius",value:function(t){return void 0===t&&(t=0),this.radius=t,this}},{key:"setRadiusTL",value:function(t){return void 0===t&&(t=0),this.radiusTL=t,this}},{key:"setRadiusTR",value:function(t){return void 0===t&&(t=0),this.radiusTR=t,this}},{key:"setRadiusBL",value:function(t){return void 0===t&&(t=0),this.radiusBL=t,this}},{key:"setRadiusBR",value:function(t){return void 0===t&&(t=0),this.radiusBR=t,this}},{key:"cornerRadius",get:function(){return this.geom.cornerRadius},set:function(t){this.radius=t;}},{key:"setCornerRadius",value:function(t){return this.setRadius(t)}},{key:"iteration",get:function(){return this._iteration},set:function(t){void 0!==this._iteration?this._iteration!==t&&(this._iteration=t,this.dirty=!0):this._iteration=t;}},{key:"setIteration",value:function(t){return void 0===t&&(t=6),this.iteration=t,this}}]),s}(Mo),jo=function(t){return t.x>0&&t.y>0},Fo={rectangle:0,circle:1};Object.assign(zo.prototype,Ro);var Io=Phaser.Renderer.WebGL.Utils,Wo={renderWebGL:function(t,e,i,n){if(e.dirty&&(e.updateTexture(),e.dirty=!1),0!==e.width&&0!==e.height){i.addToRenderList(e);var r=e.frame,s=r.width,o=r.height,a=Io.getTintAppendFloatAlpha,h=t.pipelines.set(e.pipeline,e),l=h.setTexture2D(r.glTexture,e);t.pipelines.preBatch(e),h.batchTexture(e,r.glTexture,s,o,e.x,e.y,s/e.resolution,o/e.resolution,e.scaleX,e.scaleY,e.rotation,e.flipX,e.flipY,e.scrollFactorX,e.scrollFactorY,e.displayOriginX,e.displayOriginY,0,0,s,o,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,n,!1,l),t.pipelines.postBatch(e);}},renderCanvas:function(t,e,i,n){e.dirty&&(e.updateTexture(),e.dirty=!1),0!==e.width&&0!==e.height&&(i.addToRenderList(e),t.batchSprite(e,e.frame,i,n));}},Bo=Phaser.Display.Color,Xo={clear:function(){return this.context.clearRect(0,0,this.canvas.width,this.canvas.height),this.dirty=!0,this},fill:function(t){return this.context.fillStyle=t,this.context.fillRect(0,0,this.canvas.width,this.canvas.height),this.dirty=!0,this},drawFrame:function(t,e,i,n,r,s,o,a,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===n&&(n=0),void 0===r&&(r=c),void 0===s&&(s=d),void 0===o&&(o=0),void 0===a&&(a=0),void 0===h&&(h=c),void 0===l&&(l=d);var f=u.cutX+o,v=u.cutY+a;return this.context.drawImage(u.source.image,f,v,h,l,i,n,r,s),this.dirty=!0,this},getDataURL:function(t,e){return this.canvas.toDataURL(t,e)},getPixel:function(t,e,i){void 0===i&&(i=new Bo);var n=this.context.getImageData(t,e,1,1);return i.setTo(n.data[0],n.data[1],n.data[2],n.data[3]),i},setPixel:function(t,e,i,n,r,s){if("number"!=typeof i){var o=i;i=o.red,n=o.green,r=o.blue,s=o.alpha;}void 0===s&&(s=0!==i||0!==n||0!==r?255:0);var a=this.context.createImageData(1,1);return a.data[0]=i,a.data[1]=n,a.data[2]=r,a.data[3]=s,this.context.putImageData(a,t,e),this.dirty=!0,this}},Yo=function(t,e,i,n,r,s,o){var a,h=t.sys.textures,l=t.renderer;void 0===n&&(n=0),void 0===r&&(r=0),void 0===s&&(s=e.width),void 0===o&&(o=e.height);var u=(a=h.exists(i)?h.get(i):h.createCanvas(i,s,o)).getSourceImage();u.width!==s&&(u.width=s),u.height!==o&&(u.height=o);var c=u.getContext("2d",{willReadFrequently:!0});c.clearRect(0,0,s,o),c.drawImage(e,n,r,s,o),l.gl&&a&&l.canvasToTexture(u,a.source[0].glTexture,!0,0);},Ho={updateTexture:function(t,e){t&&(e?t.call(e,this.canvas,this.context):t(this.canvas,this.context)),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=this.frame.source.glTexture),this.dirty=!1;var i=this.input;return i&&!i.customHitArea&&(i.hitArea.width=this.width,i.hitArea.height=this.height),this},generateTexture:function(t,e,i,n,r){var s=this.canvas;return void 0===n?n=s.width:n*=this.resolution,void 0===r?r=s.height:r*=this.resolution,Yo(this.scene,s,t,e,i,n,r),this},loadTexture:function(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}};k();var Go=Phaser.Display.Canvas.CanvasPool,No=function(t){r(s,t);var i=l(s);function s(t,n,r,o,h){var l;return e(this,s),void 0===n&&(n=0),void 0===r&&(r=0),void 0===o&&(o=1),void 0===h&&(h=1),(l=i.call(this,t,"rexCanvas")).renderer=t.sys.game.renderer,l.resolution=1,l._width=o,l._height=h,o=Math.max(Math.ceil(o*l.resolution),1),h=Math.max(Math.ceil(h*l.resolution),1),l.canvas=Go.create(a(l),o,h),l.context=l.canvas.getContext("2d",{willReadFrequently:!0}),l.dirty=!1,l.setPosition(n,r),l.setOrigin(.5,.5),l.initPipeline(),l.initPostPipeline(!0),l._crop=l.resetCropObject(),l.texture=t.sys.textures.addCanvas(null,l.canvas,!0),l.frame=l.texture.get(),l.frame.source.resolution=l.resolution,l.renderer&&l.renderer.gl&&(l.renderer.deleteTexture(l.frame.source.glTexture),l.frame.source.glTexture=null),l.dirty=!0,l}return n(s,[{key:"preDestroy",value:function(){Go.remove(this.canvas),this.texture.destroy(),this.canvas=null,this.context=null;}},{key:"width",get:function(){return this._width},set:function(t){this.setSize(t,this._height);}},{key:"height",get:function(){return this._height},set:function(t){this.setSize(this._width,t);}},{key:"setCanvasSize",value:function(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}},{key:"setSize",value:function(t,e){return this.setCanvasSize(t,e),this}},{key:"displayWidth",get:function(){return this.scaleX*this._width},set:function(t){this.scaleX=t/this._width;}},{key:"displayHeight",get:function(){return this.scaleY*this._height},set:function(t){this.scaleY=t/this._height;}},{key:"setDisplaySize",value:function(t,e){return this.displayWidth=t,this.displayHeight=e,this}},{key:"getCanvas",value:function(t){return t||(this.dirty=!0),this.canvas}},{key:"getContext",value:function(t){return t||(this.dirty=!0),this.context}},{key:"needRedraw",value:function(){return this.dirty=!0,this}},{key:"resize",value:function(t,e){return this.setSize(t,e),this}}]),s}(Phaser.GameObjects.GameObject),Uo=Phaser.GameObjects.Components;Phaser.Class.mixin(No,[Uo.Alpha,Uo.BlendMode,Uo.Crop,Uo.Depth,Uo.Flip,Uo.GetBounds,Uo.Mask,Uo.Origin,Uo.Pipeline,Uo.PostPipeline,Uo.ScrollFactor,Uo.Tint,Uo.Transform,Uo.Visible,Wo,Xo,Ho]);var Vo={enableData:function(){return void 0===this.data&&(this.data={}),this},setData:function(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:function(t,e){return this.enableData(),void 0===t?this.data:Cn(this.data,t,e)},incData:function(t,e,i){return void 0===i&&(i=0),this.enableData(),this.setData(t,this.getData(t,i)+e),this},mulData:function(t,e,i){return void 0===i&&(i=0),this.enableData(),this.setData(t,this.getData(t,i)*e),this},clearData:function(){return this.data&&Rt(this.data),this}},Jo=function(){function t(i,n){e(this,t),this.setParent(i),this.type=n,this.renderable=!1,this.reset().setActive();}return n(t,[{key:"destroy",value:function(){this.parent.removeChild(this);}},{key:"setParent",value:function(t){return this.parent=t,this}},{key:"scene",get:function(){return this.parent.scene}},{key:"canvas",get:function(){return this.parent?this.parent.canvas:null}},{key:"context",get:function(){return this.parent?this.parent.context:null}},{key:"setDirty",value:function(t){return t&&this.parent&&(this.parent.dirty=!0),this}},{key:"active",get:function(){return this._active},set:function(t){this.setDirty(this._active!=t),this._active=t;}},{key:"setActive",value:function(t){return void 0===t&&(t=!0),this.active=t,this}},{key:"modifyPorperties",value:function(t){return this}},{key:"onFree",value:function(){this.reset().setParent();}},{key:"reset",value:function(){return this}},{key:"render",value:function(){}},{key:"contains",value:function(t,e){return !1}}]),t}();Object.assign(Jo.prototype,Vo);var qo,Ko,Zo,$o,Qo,ta={renderContent:function(){},render:function(){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}},ea=Phaser.Math.RotateAround,ia=Phaser.Geom.Rectangle,na=function(t){void 0===Ko&&(Ko=new ia);var e=t.drawTLX,i=t.drawTLY;return Ko.setTo(e,i,t.drawTRX-e,t.drawBLY-i),Ko},ra=Phaser.Math.RotateAround,sa=function(t,e,i,n){return void 0===n?n={}:!0===n&&(void 0===Zo&&(Zo={}),n=Zo),n.x=e,n.y=i,0!==t.rotation&&ra(n,0,0,t.rotation),n.x=n.x*t.scaleX+t.drawX,n.y=n.y*t.scaleY+t.drawY,n},oa=Phaser.GameObjects.Components.TransformMatrix,aa={},ha=function(t,e,i,n,r){var s=sa(e,i,n,!0),o=function(t,e,i,n){void 0===n?n={}:!0===n&&(n=aa);var r=e-t.width*t.originX,s=i-t.height*t.originY;return void 0===$o&&($o=new oa,Qo=new oa),t.parentContainer?t.getWorldTransformMatrix($o,Qo):$o.applyITRS(t.x,t.y,t.rotation,t.scaleX,t.scaleY),$o.transformPoint(r,s,n),n}(t,s.x,s.y,r);return o},la=function(t,e,i,n,r){"number"!=typeof i&&(r=i,i=0,n=0);var s=e.drawCenterX+i,o=e.drawCenterY+n;return ha(t,e,s,o,r)},ua={contains:function(t,e){if(0===this.width||0===this.height)return !1;var i=function(t,e,i,n){return void 0===n?n={}:!0===n&&(void 0===qo&&(qo={}),n=qo),n.x=(t-i.drawX)/i.scaleX,n.y=(e-i.drawY)/i.scaleY,0!==i.rotation&&ea(n,0,0,-i.rotation),n}(t,e,this,!0);return na(this).contains(i.x,i.y)},getWorldPosition:function(t,e,i){return la(this.parent,this,t,e,i)},scrollTo:function(){var t,e,i=this.parent,n=this.drawX+this.drawTLX,r=n+this.width;t=n<0?0-n:r>i.width?i.width-r:0;var s=this.drawY+this.drawTLY,o=s+this.height;return e=s<0?0-s:o>i.height?i.height-o:0,i._textOX+=t,i._textOY+=e,this}};Object.assign(ua,ta);var ca=Phaser.Math.DegToRad,da=Phaser.Math.RadToDeg,fa=Phaser.Utils.Objects.GetValue,va=function(t){r(s,t);var i=l(s);function s(t,n){var r;return e(this,s),(r=i.call(this,t,n)).renderable=!0,r.scrollFactorX=1,r.scrollFactorY=1,r.toLocalPosition=!0,r.originX=0,r.offsetX=0,r.offsetY=0,r}return n(s,[{key:"visible",get:function(){return this._visible},set:function(t){this.setDirty(this._visible!=t),this._visible=t;}},{key:"setVisible",value:function(t){return void 0===t&&(t=!0),this.visible=t,this}},{key:"alpha",get:function(){return this._alpha},set:function(t){this.setDirty(this._alpha!=t),this._alpha=t;}},{key:"setAlpha",value:function(t){return this.alpha=t,this}},{key:"x",get:function(){return this._x},set:function(t){this.setDirty(this._x!=t),this._x=t;}},{key:"setX",value:function(t){return this.x=t,this}},{key:"y",get:function(){return this._y},set:function(t){this.setDirty(this._y!=t),this._y=t;}},{key:"setY",value:function(t){return this.y=t,this}},{key:"setPosition",value:function(t,e){return this.x=t,this.y=e,this}},{key:"setInitialPosition",value:function(t,e){return this.x0=t,this.y0=e,this}},{key:"setScrollFactorX",value:function(t){return this.scrollFactorX=t,this}},{key:"setScrollFactorY",value:function(t){return this.scrollFactorY=t,this}},{key:"setScrollFactor",value:function(t,e){return void 0===e&&(e=t),this.scrollFactorX=t,this.scrollFactorY=e,this}},{key:"rotation",get:function(){return this._rotation},set:function(t){this.setDirty(this._rotation!=t),this._rotation=t;}},{key:"setRotation",value:function(t){return this.rotation=t,this}},{key:"angle",get:function(){return da(this._rotation)},set:function(t){this.rotation=ca(t);}},{key:"setAngle",value:function(t){return this.angle=t,this}},{key:"scaleX",get:function(){return this._scaleX},set:function(t){this.setDirty(this._scaleX!==t),this._scaleX=t;}},{key:"setScaleX",value:function(t){return this.scaleX=t,this}},{key:"width",get:function(){return 0},set:function(t){}},{key:"setWidth",value:function(t,e){return void 0===e&&(e=!1),this.width=t,e&&(this.scaleY=this.scaleX),this}},{key:"leftSpace",get:function(){return this._leftSpace},set:function(t){this.setDirty(this._leftSpace!==t),this._leftSpace=t;}},{key:"setLeftSpace",value:function(t){return this.leftSpace=t,this}},{key:"rightSpace",get:function(){return this._rightSpace},set:function(t){this.setDirty(this._rightSpace!==t),this._rightSpace=t;}},{key:"setRightSpace",value:function(t){return this.rightSpace=t,this}},{key:"outerWidth",get:function(){return this.width+this.leftSpace+this.rightSpace}},{key:"scaleY",get:function(){return this._scaleY},set:function(t){this.setDirty(this._scaleY!==t),this._scaleY=t;}},{key:"setScaleY",value:function(t){return this.scaleY=t,this}},{key:"height",get:function(){return 0},set:function(t){}},{key:"setHeight",value:function(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}},{key:"setScale",value:function(t,e){return void 0===e&&(e=t),this.scaleX=t,this.scaleY=e,this}},{key:"setOrigin",value:function(t){return this.originX=t,this}},{key:"setAlign",value:function(t){return this.align=t,this}},{key:"modifyPorperties",value:function(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=fa(t,"width",void 0),i=fa(t,"height",void 0),n=fa(t,"scaleX",void 0),r=fa(t,"scaleY",void 0);return void 0!==e?void 0===i&&void 0===r?this.setWidth(e,!0):this.setWidth(e):void 0!==n&&this.setScaleX(n),void 0!==i?void 0===e&&void 0===n?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}},{key:"setDrawBelowCallback",value:function(t){return this.drawBelowCallback=t,this}},{key:"setDrawAboveCallback",value:function(t){return this.drawAboveCallback=t,this}},{key:"reset",value:function(){return this.setVisible().setAlpha(1).setPosition(0,0).setRotation(0).setScale(1,1).setLeftSpace(0).setRightSpace(0).setOrigin(0).setAlign().setDrawBelowCallback().setDrawAboveCallback(),this}},{key:"willRender",get:function(){return this.visible&&this.alpha>0}},{key:"drawX",get:function(){var t=this.x+this.leftSpace+this.offsetX-this.originX*this.width;return this.parent._textOX*this.scrollFactorX+t}},{key:"drawY",get:function(){var t=this.y+this.offsetY;return this.parent._textOY*this.scrollFactorY+t}},{key:"drawTLX",get:function(){return 0}},{key:"drawTLY",get:function(){return 0}},{key:"drawBLX",get:function(){return 0}},{key:"drawBLY",get:function(){return 0}},{key:"drawTRX",get:function(){return 0}},{key:"drawTRY",get:function(){return 0}},{key:"drawBRX",get:function(){return 0}},{key:"drawBRY",get:function(){return 0}},{key:"drawCenterX",get:function(){return (this.drawTRX+this.drawTLX)/2}},{key:"drawCenterY",get:function(){return (this.drawBLY+this.drawTLY)/2}}]),s}(Jo);Object.assign(va.prototype,ua);var pa=Phaser.Utils.String.Pad,ga=function(e,i,n){if(null==e)return e;switch(t(e)){case"string":default:return e;case"number":return "#".concat(pa(Math.floor(e).toString(16),6,"0",1));case"function":return e(i,n);case"object":return e.hasOwnProperty("r")?e.hasOwnProperty("a")?"rgba(".concat(e.r,",").concat(e.g,",").concat(e.b,",").concat(e.a,")"):"rgb(".concat(e.r,",").concat(e.g,",").concat(e.b,")"):e.hasOwnProperty("h")?e.hasOwnProperty("a")?"hsla(".concat(e.h,",").concat(e.s,",").concat(e.l,",").concat(e.a,")"):"hsl(".concat(e.h,",").concat(e.s,",").concat(e.l,")"):e}},ya=function(t,e,i){return e.hasOwnProperty(t)?e[t]:i[t]},ka=Phaser.Math.DegToRad,ma=function(t){return !t.hasOwnProperty("convex")||t.convex},xa=function(t){return t.x>0&&t.y>0},ba=function(t,e,i,n,r,s,o,a,h){if(a&&o>s?o-=360:!a&&o=f?1:n/f,g=r>=v?1:r/v,y=d.cornerRadius;t.save(),t.beginPath(),t.translate(e,i),a=y.tl,xa(a)?(h=a.x*p,l=a.y*g,ma(a)?ba(t,h,l,h,l,180,270,!1,o):ba(t,0,0,h,l,90,0,!0,o),u=0,c=l):(t.lineTo(0,0),u=0,c=0),a=y.tr,xa(a)?(h=a.x*p,l=a.y*g,ma(a)?ba(t,n-h,l,h,l,270,360,!1,o):ba(t,n,0,h,l,180,90,!0,o)):t.lineTo(n,0),a=y.br,xa(a)?(h=a.x*p,l=a.y*g,ma(a)?ba(t,n-h,r-l,h,l,0,90,!1,o):ba(t,n,r,h,l,270,180,!0,o)):t.lineTo(n,r),a=y.bl,xa(a)?(h=a.x*p,l=a.y*g,ma(a)?ba(t,h,r-l,h,l,90,180,!1,o):ba(t,0,r,h,l,360,270,!0,o)):t.lineTo(0,r),t.lineTo(u,c),t.closePath(),t.restore();}(e,i,n,r,s,o,d),null!=a){var f;if(null!=u)(f=c?e.createLinearGradient(0,0,r,0):e.createLinearGradient(0,0,0,s)).addColorStop(0,a),f.addColorStop(1,u),a=f;e.fillStyle=a,e.fill();}null!=h&&l>0&&(e.strokeStyle=h,e.lineWidth=l,e.stroke());},Ca=function(t,e,i,n,r,s,o,a){if(null!=e||null!=i){var h=t.canvas.width,l=t.canvas.height;null==i&&(n=0);var u=n/2;h=Math.max(1,h-n),l=Math.max(1,l-n),wa(t.canvas,t.context,u,u,h,l,r,e,i,n,s,o,a);}},Sa=Phaser.Utils.Objects.GetValue,Pa=function(t){r(o,t);var i=l(o);function o(t,n){var r;return e(this,o),(r=i.call(this,t,"background")).setScrollFactor(0),r.setColor(Sa(n,"color",null),Sa(n,"color2",null),Sa(n,"horizontalGradient",!0)),r.setStroke(Sa(n,"stroke",null),Sa(n,"strokeThickness",2)),r.setCornerRadius(Sa(n,"cornerRadius",0),Sa(n,"cornerIteration",null)),r}return n(o,[{key:"color",get:function(){return this._color},set:function(t){t=ga(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t;}},{key:"color2",get:function(){return this._color2},set:function(t){t=ga(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t;}},{key:"horizontalGradient",get:function(){return this._horizontalGradient},set:function(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t;}},{key:"setColor",value:function(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}},{key:"stroke",get:function(){return this._stroke},set:function(t){t=ga(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t;}},{key:"strokeThickness",get:function(){return this._strokeThickness},set:function(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t;}},{key:"setStroke",value:function(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}},{key:"cornerRadius",get:function(){return this._cornerRadius},set:function(t){this.setDirty(this._cornerRadius!=t),this._cornerRadius=t;}},{key:"cornerIteration",get:function(){return this._cornerIteration},set:function(t){this.setDirty(this._cornerIteration!=t),this._cornerIteration=t;}},{key:"modifyStyle",value:function(t){return t.hasOwnProperty("color")&&this.setColor(t.color,ya("color2",t,this),ya("horizontalGradient",t,this)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,ya("strokeThickness",t,this)),t.hasOwnProperty("cornerRadius")&&this.setCornerRadius(t.cornerRadius,ya("cornerIteration",t,this)),this}},{key:"modifyPorperties",value:function(t){return c(s(o.prototype),"modifyPorperties",this).call(this,t),this.modifyStyle(t),this}},{key:"setCornerRadius",value:function(t,e){return this.cornerRadius=t,this.cornerIteration=e,this}},{key:"renderContent",value:function(){Ca(this.parent,this.color,this.stroke,this.strokeThickness,this.cornerRadius,this.color2,this.horizontalGradient,this.cornerIteration);}}]),o}(va),Oa=Phaser.Utils.Objects.GetValue,Ta=function(t){r(o,t);var i=l(o);function o(t,n){var r;return e(this,o),(r=i.call(this,t,"innerbounds")).setScrollFactor(0),r.setColor(Oa(n,"color",null),Oa(n,"color2",null),Oa(n,"horizontalGradient",!0)),r.setStroke(Oa(n,"stroke",null),Oa(n,"strokeThickness",2)),r}return n(o,[{key:"color",get:function(){return this._color},set:function(t){t=ga(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t;}},{key:"color2",get:function(){return this._color2},set:function(t){t=ga(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t;}},{key:"horizontalGradient",get:function(){return this._horizontalGradient},set:function(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t;}},{key:"setColor",value:function(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}},{key:"stroke",get:function(){return this._stroke},set:function(t){t=ga(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t;}},{key:"strokeThickness",get:function(){return this._strokeThickness},set:function(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t;}},{key:"setStroke",value:function(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}},{key:"modifyPorperties",value:function(t){c(s(o.prototype),"modifyPorperties",this).call(this,t),t.hasOwnProperty("color")&&this.setColor(t.color,Oa(t,"color2",null),Oa(t,"horizontalGradient",!0)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,Oa(t,"strokeThickness",2));}},{key:"renderContent",value:function(){var t=this.parent.padding,e=t.left,i=t.top,n=this.parent.width-t.left-t.right,r=this.parent.height-t.top-t.bottom,s=this.context;if(null!=this.color){var o,a;if(null!=this.color2)(a=this.horizontalGradient?s.createLinearGradient(0,0,n,0):s.createLinearGradient(0,0,0,r)).addColorStop(0,this.color),a.addColorStop(1,this.color2),o=a;else o=this.color;s.fillStyle=o,s.fillRect(e,i,n,r);}null!=this.stroke&&this.strokeThickness>0&&(s.strokeStyle=this.stroke,s.lineWidth=this.strokeThickness,s.strokeRect(e,i,n,r));}}]),o}(va),_a=Phaser.Utils.Objects.GetValue,Ea=function(){function t(i,n){e(this,t),this.parent=i,this.set(n);}return n(t,[{key:"toJSON",value:function(){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}}},{key:"set",value:function(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}},{key:"modify",value:function(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(ya("stroke",t,this),ya("strokeThickness",t,this)),t.hasOwnProperty("shadowColor")&&this.setShadowColor(t.shadowColor),(t.hasOwnProperty("shadowOffsetX")||t.hasOwnProperty("shadowOffsetY"))&&this.setShadowOffset(ya("shadowOffsetX",t,this),ya("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}},{key:"setUpdateTextFlag",value:function(){return this.parent&&(this.parent.updateTextFlag=!0),this}},{key:"clone",value:function(){return new t(null,this.toJSON())}},{key:"copyFrom",value:function(t){return this.set(t.toJSON()),this}},{key:"copyTo",value:function(t){return t.set(this.toJSON()),this}},{key:"setBold",value:function(t){return void 0===t&&(t=!0),this.bold=t,this.setUpdateTextFlag(),this}},{key:"setItalic",value:function(t){return void 0===t&&(t=!0),this.italic=t,this.setUpdateTextFlag(),this}},{key:"fontStyle",get:function(){return this.bold&&this.italic?"bold italic":this.bold?"bold":this.italic?"italic":""}},{key:"setFontSize",value:function(t){return "number"==typeof t&&(t="".concat(t,"px")),this.fontSize=t,this.setUpdateTextFlag(),this}},{key:"setFontFamily",value:function(t){return this.fontFamily=t,this.setUpdateTextFlag(),this}},{key:"font",get:function(){return "".concat(this.fontStyle," ").concat(this.fontSize," ").concat(this.fontFamily)}},{key:"setColor",value:function(t){return this.color=ga(t),this}},{key:"hasFill",get:function(){return null!=this.color}},{key:"setStrokeStyle",value:function(t,e){return this.stroke=ga(t),void 0!==e&&(this.strokeThickness=e),this}},{key:"setStrokeThickness",value:function(t){return this.strokeThickness=t,this}},{key:"hasStroke",get:function(){return null!=this.stroke&&this.strokeThickness>0}},{key:"setShadowColor",value:function(t){return this.shadowColor=ga(t),this}},{key:"setShadowOffset",value:function(t,e){return void 0===t&&(t=0),void 0===e&&(e=0),this.shadowOffsetX=t,this.shadowOffsetY=e,this}},{key:"setShadowBlur",value:function(t){return void 0===t&&(t=0),this.shaodwBlur=t,this}},{key:"setShadow",value:function(t,e,i,n){return this.setShadowColor(t).setShadowOffset(e,i).setShadowBlur(n),this}},{key:"setBackgroundColor",value:function(t){return this.backgroundColor=ga(t),this}},{key:"hasBackgroundColor",get:function(){return null!=this.backgroundColor}},{key:"setBackgroundHeight",value:function(t){return this.backgroundHeight=t,this}},{key:"setBackgroundBottomY",value:function(t){return this.backgroundBottomY=t,this}},{key:"setOffsetX",value:function(t){return void 0===t&&(t=0),this.offsetX=t,this}},{key:"setOffsetY",value:function(t){return void 0===t&&(t=0),this.offsetY=t,this}},{key:"setOffset",value:function(t,e){return this.setOffsetX(t).setOffsetY(e),this}},{key:"setLeftSpace",value:function(t){return void 0===t&&(t=0),this.leftSpace=t,this}},{key:"setRightSpace",value:function(t){return void 0===t&&(t=0),this.rightSpace=t,this}},{key:"setSpace",value:function(t,e){return this.setLeftSpace(t).setRightSpace(e),this}},{key:"setAlign",value:function(t){return this.align=t,this}},{key:"syncFont",value:function(t){return t.font=this.font,this}},{key:"syncStyle",value:function(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}},{key:"syncShadow",value:function(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);}},{key:"getTextMetrics",value:function(t,e){return this.syncFont(t).syncStyle(t),t.measureText(e)}}]),t}(),Ra=Phaser.Utils.Array.Remove,Ma=Phaser.Utils.Array.Remove,La="text",Da="image",Aa="drawer",za="space",ja="command",Fa=function(t){return t.type===La&&"\n"===t.text},Ia=function(t){return t.type===La&&"\f"===t.text},Wa=function(t){return t.type===La},Ba=function(t){r(o,t);var i=l(o);function o(t,n,r){var s;return e(this,o),(s=i.call(this,t,La)).updateTextFlag=!1,s.style=new Ea(a(s),r),s.setText(n),s}return n(o,[{key:"autoRound",get:function(){return this.parent.autoRound}},{key:"offsetX",get:function(){return this.style.offsetX},set:function(t){this.style&&(this.style.offsetX=t);}},{key:"offsetY",get:function(){return this.style.offsetY},set:function(t){this.style&&(this.style.offsetY=t);}},{key:"leftSpace",get:function(){return this.style.leftSpace*this.scaleX},set:function(t){this.style&&(this.style.leftSpace=t),f(s(o.prototype),"leftSpace",t,this,!0);}},{key:"rightSpace",get:function(){return this.style.rightSpace*this.scaleX},set:function(t){this.style&&(this.style.rightSpace=t),f(s(o.prototype),"rightSpace",t,this,!0);}},{key:"align",get:function(){return this.style.align},set:function(t){this.style&&(this.style.align=t);}},{key:"modifyStyle",value:function(t){return this.setDirty(!0),this.style.modify(t),this.updateTextFlag&&this.updateTextSize(),this}},{key:"modifyPorperties",value:function(t){return t?(this.modifyStyle(t),c(s(o.prototype),"modifyPorperties",this).call(this,t),this):this}},{key:"setText",value:function(t){return this.setDirty(this.text!=t),this.text=t,this.updateTextSize(),this}},{key:"updateTextSize",value:function(){var t=this.text;if("\n"===t||"\f"===t||""===t)this.clearTextSize();else {var e,i,n=this.style.getTextMetrics(this.context,this.text);this.textWidth=n.width,"actualBoundingBoxAscent"in n?(e=n.actualBoundingBoxAscent,i=n.actualBoundingBoxDescent):(e=0,i=0),this.textHeight=e+i,this.ascent=e,this.descent=i;}return this.updateTextFlag=!1,this}},{key:"clearTextSize",value:function(){return this.textWidth=0,this.textHeight=0,this.ascent=0,this.descent=0,this}},{key:"copyTextSize",value:function(t){return this.textWidth=t.textWidth,this.textHeight=t.textHeight,this.ascent=t.ascent,this.descent=t.descent,this}},{key:"width",get:function(){return this.textWidth*this.scaleX},set:function(t){this.textWidth>0?this.scaleX=t/this.textWidth:this.scaleX=1;}},{key:"height",get:function(){return this.textHeight*this.scaleY},set:function(t){this.textHeight>0?this.scaleY=t/this.textHeight:this.scaleY=1;}},{key:"willRender",get:function(){return 0!==this.textWidth&&c(s(o.prototype),"willRender",this)}},{key:"renderContent",value:function(){var t=this.context,e=this.style;if(e.hasBackgroundColor){t.fillStyle=e.backgroundColor;var i=this.drawTLX,n=this.drawTRX-i,r=e.backgroundBottomY;null==r&&(r=this.drawBLY);var s=e.backgroundHeight;null==s&&(s=r-this.drawTLY);var o=r-s;t.fillRect(i,o,n,s);}var a=e.hasFill,h=e.hasStroke;(a||h)&&(e.syncFont(t).syncStyle(t),h&&(e.syncShadow(t),t.strokeText(this.text,0,0)),a&&(e.syncShadow(t),t.fillText(this.text,0,0)));}},{key:"drawTLX",get:function(){return -this.leftSpace}},{key:"drawTLY",get:function(){return -this.ascent}},{key:"drawBLX",get:function(){return -this.leftSpace}},{key:"drawBLY",get:function(){return this.descent}},{key:"drawTRX",get:function(){return this.textWidth+this.rightSpace}},{key:"drawTRY",get:function(){return -this.ascent}},{key:"drawBRX",get:function(){return this.textWidth+this.rightSpace}},{key:"drawBRY",get:function(){return this.descent}}]),o}(va),Xa=function(t,e){var i=this.createCharChildren(t,e);return this.addChild(i),this},Ya=function(t){r(s,t);var i=l(s);function s(t,n,r){var o;return e(this,s),(o=i.call(this,t,Da)).setTexture(n,r),o}return n(s,[{key:"frameWidth",get:function(){return this.frameObj?this.frameObj.cutWidth:0}},{key:"frameHeight",get:function(){return this.frameObj?this.frameObj.cutHeight:0}},{key:"offsetY",get:function(){return -this.height},set:function(t){}},{key:"key",get:function(){return this._key},set:function(t){this.setDirty(this._key!=t),this._key=t;}},{key:"frame",get:function(){return this._frame},set:function(t){this.setDirty(this._frame!=t),this._frame=t;}},{key:"setTexture",value:function(t,e){return this.key=t,this.frame=e,this.frameObj=this.scene.sys.textures.getFrame(t,e),this}},{key:"width",get:function(){return this.frameWidth*this.scaleX},set:function(t){this.setDirty(this.width!==t),this.scaleX=t/this.frameWidth;}},{key:"height",get:function(){return this.frameHeight*this.scaleY},set:function(t){this.setDirty(this.height!==t),this.scaleY=t/this.frameHeight;}},{key:"setHeight",value:function(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}},{key:"renderContent",value:function(){var t=this.context,e=this.frameObj,i=this.frameWidth,n=this.frameHeight;t.drawImage(e.source.image,e.cutX,e.cutY,i,n,0,0,i,n);}},{key:"drawTLX",get:function(){return -this.leftSpace}},{key:"drawTLY",get:function(){return 0}},{key:"drawBLX",get:function(){return -this.leftSpace}},{key:"drawBLY",get:function(){return this.frameHeight}},{key:"drawTRX",get:function(){return this.frameWidth+this.rightSpace}},{key:"drawTRY",get:function(){return 0}},{key:"drawBRX",get:function(){return this.frameWidth+this.rightSpace}},{key:"drawBRY",get:function(){return this.frameHeight}}]),s}(va),Ha=function(t){r(o,t);var i=l(o);function o(t,n,r,s){var a;return e(this,o),(a=i.call(this,t,Aa)).setRenderCallback(n),a.setDrawerSize(r,s),a}return n(o,[{key:"setRenderCallback",value:function(t){return t?this.renderContent=t.bind(this):delete this.renderContent,this}},{key:"setDrawerSize",value:function(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}},{key:"onFree",value:function(){c(s(o.prototype),"onFree",this).call(this),this.setRenderCallback();}},{key:"width",get:function(){return this.drawerWidth*this.scaleX},set:function(t){this.setDirty(this.width!==t),this.scaleX=this.drawerWidth>0?t/this.drawerWidth:1;}},{key:"height",get:function(){return this.drawerHeight*this.scaleY},set:function(t){this.setDirty(this.height!==t),this.scaleY=this.drawerHeight>0?t/this.drawerHeight:1;}},{key:"offsetY",get:function(){return -this.height},set:function(t){}},{key:"drawTLX",get:function(){return -this.leftSpace}},{key:"drawTLY",get:function(){return 0}},{key:"drawBLX",get:function(){return -this.leftSpace}},{key:"drawBLY",get:function(){return this.drawerHeight}},{key:"drawTRX",get:function(){return this.drawerWidth+this.rightSpace}},{key:"drawTRY",get:function(){return 0}},{key:"drawBRX",get:function(){return this.drawerWidth+this.rightSpace}},{key:"drawBRY",get:function(){return this.drawerHeight}}]),o}(va),Ga=function(t){r(s,t);var i=l(s);function s(t,n){var r;return e(this,s),(r=i.call(this,t,za)).setSpaceWidth(n),r}return n(s,[{key:"width",get:function(){return this.spaceWidth*this.scaleX},set:function(t){this.spaceWidth>0?this.scaleX=t/this.spaceWidth:this.scaleX=1;}},{key:"setSpaceWidth",value:function(t){return this.spaceWidth=t,this}}]),s}(va),Na=function(t){r(o,t);var i=l(o);function o(t,n,r,s,a){var h;return e(this,o),(h=i.call(this,t,ja)).setName(n).setParameter(s).setCallback(r,a),h}return n(o,[{key:"setName",value:function(t){return this.name=t,this}},{key:"setParameter",value:function(t){return this.param=t,this}},{key:"setCallback",value:function(t,e){return this.callback=t,this.scope=e,this}},{key:"exec",value:function(){return this.scope?this.callback.call(this.scope,this.param,this.name):this.callback(this.param,this.name)}},{key:"onFree",value:function(){c(s(o.prototype),"onFree",this).call(this),this.setName().setCallback().setParameter();}}]),o}(Jo),Ua=function e(i){var n,r,s;if(null==i||"object"!==t(i))return i;if(n=Array.isArray(i)?[]:{},function(e){if("object"!==t(e)||e.nodeType||e===e.window)return !1;try{if(e.constructor&&!{}.hasOwnProperty.call(e.constructor.prototype,"isPrototypeOf"))return !1}catch(t){return !1}return !0}(i))for(s in i)r=i[s],n[s]=e(r);else n=i;return n},Va=function(t,e,i,n){void 0===n&&(n={word:[],width:0}),n.word.length=0;for(var r=t.length,s=e,o=n.word,a=0;s0&&!a){var h=this.fixedHeight-n;if(i>0)s=h/i;else s=(l=Ka.call(this)).height,o=l.ascent,i=Math.floor((h-o)/s);}else {var l;s=(l=Ka.call(this)).height,o=l.ascent;}}else if(this.fixedHeight>0){if(void 0===(i=$a(t,"maxLines"))){h=this.fixedHeight-n;i=Math.floor(h/s);}}else i=$a(t,"maxLines",0);void 0===o&&(o=s);var u=0===i,c=$a(t,"wrapWidth",void 0);void 0===c&&(c=this.fixedWidth>0?this.fixedWidth-r:1/0);for(var d=$a(t,"letterSpacing",0),f=$a(t,"hAlign",0),v=$a(t,"vAlign",0),p=$a(t,"charWrap",!1),g={callback:"runWordWrap",start:e,isLastPage:!1,padding:this.wrapPadding,ascent:o,lineHeight:s,maxLines:i,wrapWidth:c,letterSpacing:d,hAlign:f,vAlign:v,charWrap:p,children:[],lines:[],maxLineWidth:0,linesHeight:0},y=this.children,k=0,m=y.length;k0&&(_.push({children:E,width:R}),M=Math.max(M,R)),g.start+=T.length,g.isLastPage=!L&&g.start===O,g.maxLineWidth=M,g.linesHeight=_.length*s;var W=this.fixedWidth>0?this.fixedWidth:g.maxLineWidth+r,B=this.fixedHeight>0?this.fixedHeight:g.linesHeight+n;!function(t,e,i){var n,r,s=t.hAlign,o=t.vAlign,a=t.linesHeight;switch(o){case 1:case"center":r=(i-a)/2;break;case 2:case"bottom":r=i-a;break;default:r=0;}for(var h=t.lines,l=0,u=h.length;l0?(o=this.fixedWidth-r)/i:0;else if(this.fixedWidth>0){if(void 0===(i=eh(t,"maxLines",void 0))){var o=this.fixedWidth-r;i=Math.floor(o/s)+1;}}else i=eh(t,"maxLines",0);var a=0===i,h=eh(t,"fixedChildHeight",void 0);if(void 0===h){var l=eh(t,"charPerLine",void 0);if(void 0!==l){var u=this.fixedHeight-n;h=Math.floor(u/l);}}var c=eh(t,"wrapHeight",void 0);void 0===c&&(c=this.fixedHeight>0?this.fixedHeight-n:1/0);for(var d=eh(t,"letterSpacing",0),f=eh(t,"rtl",!0),v=eh(t,"hAlign",f?2:0),p=eh(t,"vAlign",0),g={callback:"runVerticalWrap",start:e,isLastPage:!1,padding:this.wrapPadding,lineWidth:s,maxLines:i,fixedChildHeight:h,wrapHeight:c,letterSpacing:d,hAlign:v,vAlign:p,rtl:f,children:[],lines:[],maxLineHeight:0,linesWidth:0},y=this.children,k=0,m=y.length;k0&&(_.push({children:E,height:R}),M=Math.max(M,R)),g.start+=T.length,g.isLastPage=g.start===O,g.maxLineHeight=M,g.linesWidth=_.length*s;var F=this.fixedWidth>0?this.fixedWidth:g.linesWidth+r,I=this.fixedHeight>0?this.fixedHeight:g.maxLineHeight+n;!function(t,e,i){var n,r,s=t.hAlign,o=t.vAlign,a=t.rtl,h=t.lines,l=t.lineWidth,u=t.linesWidth;switch(s){case 1:case"center":n=(e-u)/2;break;case 2:case"right":n=e-u;break;default:n=0;}a&&(n+=l);for(var c=0,d=h.length;c0?t:this.width,e>0?e:this.height),this):this},setPadding:function(t,e){var i=this.padding,n=i.left,r=i.right,s=i.top,o=i.bottom;return He(i,t,e),this.dirty=this.dirty||n!=i.left||r!=i.right||s!=i.top||o!=i.bottom,this},getPadding:function(t){return Ye(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),Ra(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 Ma(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,n,r,s=Array.isArray(t);void 0===e||e===this.children.length?s?(i=this.children).push.apply(i,v(t)):this.children.push(t):s?(n=this.children).splice.apply(n,[e,0].concat(v(t))):this.children.splice(e,0,t);(this.lastAppendedChildren.length=0,s)?(r=this.lastAppendedChildren).push.apply(r,v(t)):this.lastAppendedChildren.push(t);return this},createCharChild:function(t,e){e&&this.textStyle.modify(e);var i=this.poolManager.allocate(La);return null===i?i=new Ba(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=[],n=0,r=t.length;ne&&(n=e,r=t);})),r},getCharWorldPosition:function(t,e,i,n){return "number"==typeof t&&(t=this.getCharChild(t,!0)),la(this,t,e,i,n)},setToMinSize:function(){for(var t=this.children,e=0,i=0,n=0,r=t.length;n=i.length&&(t=i.length);for(var n=0,r=0;r0?this.items.pop():null}},{key:"push",value:function(t){return this.items.push(t),this}},{key:"pushMultiple",value:function(t){return this.items.push.apply(this.items,t),t.length=0,this}},{key:"clear",value:function(){return this.items.length=0,this}}]),t}(),wh=Phaser.Utils.Objects.GetFastValue,Ch={},Sh=function(){function t(i){e(this,t),this.pools=wh(i,"pools",Ch);}return n(t,[{key:"free",value:function(t){if(!this.pools)return this;var e=t.type;return this.pools.hasOwnProperty(e)||(this.pools[e]=new bh),this.pools[e].push(t),t.onFree(),this}},{key:"freeMultiple",value:function(t){if(!this.pools)return this;for(var e=0,i=t.length;e=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!=n&&(r=e.getCharChild(n))&&("\n"===r.text&&r.copyTextSize(e.lastInsertCursor),r.scrollTo(),e.emit("cursorin",r,n,e)),e.emit("movecursor",n,t.prevCursorPosition,e),t.prevCursorPosition=n;}}(this)):(Xh(this),Yh(this)),this}},{key:"setNumberInput",value:function(){return this.onUpdateCallback=Bh,this}},{key:"setSelectAllWhenFocusEnable",value:function(t){return void 0===t&&(t=!0),this.selectAllWhenFocus=t,this}}]),s}(Wh),Nh=Phaser.Utils.Objects.GetValue,Uh=["inputType","onOpen","onFocus","onClose","onBlur","onUpdate","enterClose","readOnly","maxLength","minLength","selectAll"],Vh=function(t,e){if(t&&"number"!=typeof t){if(t.hasOwnProperty(e))return !0;if(-1!==e.indexOf(".")){for(var i=e.split("."),n=t,r=0;rt.length?i:t})),l.value=t.join(c);}else l.value=t.join(i.slice(a,a+l.count));a+=l.count,l.added||(h+=l.count);}}var d=e[o-1];return o>1&&"string"==typeof d.value&&(d.added||d.removed)&&t.equals("",d.value)&&(e[o-2].value+=d.value,e.pop()),e}il.prototype={diff:function(t,e){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=i.callback;"function"==typeof i&&(n=i,i={}),this.options=i;var r=this;function s(t){return n?(setTimeout((function(){n(void 0,t);}),0),!0):t}t=this.castInput(t),e=this.castInput(e),t=this.removeEmpty(this.tokenize(t));var o=(e=this.removeEmpty(this.tokenize(e))).length,a=t.length,h=1,l=o+a;i.maxEditLength&&(l=Math.min(l,i.maxEditLength));var u=[{newPos:-1,components:[]}],c=this.extractCommon(u[0],e,t,0);if(u[0].newPos+1>=o&&c+1>=a)return s([{value:this.join(e),count:e.length}]);function d(){for(var i=-1*h;i<=h;i+=2){var n=void 0,l=u[i-1],c=u[i+1],d=(c?c.newPos:0)-i;l&&(u[i-1]=void 0);var f=l&&l.newPos+1=o&&d+1>=a)return s(nl(r,n.components,e,t,r.useLongestToken));u[i]=n;}else u[i]=void 0;}var p;h++;}if(n)!function t(){setTimeout((function(){if(h>l)return n();d()||t();}),0);}();else for(;h<=l;){var f=d();if(f)return f}},pushComponent:function(t,e,i){var n=t[t.length-1];n&&n.added===e&&n.removed===i?t[t.length-1]={count:n.count+1,added:e,removed:i}:t.push({count:1,added:e,removed:i});},extractCommon:function(t,e,i,n){for(var r=e.length,s=i.length,o=t.newPos,a=o-n,h=0;o+1=6?(n=[arguments[2],void 0,arguments[3]],r=[arguments[4],void 0,arguments[5]]):(n=Ua(n),r=Ua(r)),this.textureKey=e,this.baseFrameName=i,this.columns.data=n,this.columns.count=n?n.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 s=this.scene.sys.textures.get(e);if(!s)return this.clear(),this;if(!n||!r)return this.clear(),this;for(var o=s.get(i),a=o.width,h=0,l=0,u=n.length;l0?0:g,x=0;l=0;for(var S=n.length;l0?0:y),y>=1&&g>=1){var P=t(k=this.getFrameNameCallback(l,w,i));"string"!==P&&"number"!==P||s.add(k,0,x+o.cutX,b+o.cutY,y,g);}x+=y;}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,n,r,s,o,a,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,f=c>=0?this.maxFixedPartScaleY:this.height/l;if(this.preserveRatio){var v=Math.min(d,f);if(d>v){var p=(d-v)*h;u>=0?u+=p:u=p,d=v;}if(f>v){var g=(f-v)*l;c>=0?c+=g:c=g,f=v;}}this.columns.scale=d,this.rows.scale=f,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 y=0,k=0;this._beginDraw();for(var m=0,x=this.rows.count;m0&&a>0&&(0===(0===s.stretch&&0===r.stretch||0===this.getStretchMode(b,m)?0:1)?this._drawImage(this.textureKey,n,y,k,o,a):this._drawTileSprite(this.textureKey,n,y,k,o,a)),y+=o;k+=a;}this._endDraw();},setStretchMode:function(t){return Uu(t)?(this.stretchMode.edge=Ju(Vu(t,"edge",0)),this.stretchMode.internal=Ju(Vu(t,"internal",0))):(t=Ju(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}},$u=Phaser.Utils.Objects.IsPlainObject,Qu=Phaser.Utils.Objects.GetValue,tc=Phaser.GameObjects,ec=void 0,ic=function(t,e){if(ec||(ec={},ei(t).events.once("destroy",(function(){for(var t in ec)ec[t].destroy();ec=void 0;}))),!ec.hasOwnProperty(e)){var i=ei(t).scene.systemScene;(t=new tc[e](i)).setOrigin(0),ec[e]=t;}return ec[e]},nc=function(t){r(s,t);var i=l(s);function s(){return e(this,s),i.apply(this,arguments)}return n(s)}(function(t,i){var o=function(t){r(a,t);var o=l(a);function a(t,n,r,s,h,l,u,c,d,f){var v;if(e(this,a),$u(n)?(n=Qu(f=n,"x",0),r=Qu(f,"y",0),s=Qu(f,"width",1),h=Qu(f,"height",1),l=Qu(f,"key",void 0),u=Qu(f,"baseFrame",void 0),c=Qu(f,"columns",void 0),d=Qu(f,"rows",void 0)):$u(s)?(s=Qu(f=s,"width",1),h=Qu(f,"height",1),l=Qu(f,"key",void 0),u=Qu(f,"baseFrame",void 0),c=Qu(f,"columns",void 0),d=Qu(f,"rows",void 0)):$u(l)?(l=Qu(f=l,"key",void 0),u=Qu(f,"baseFrame",void 0),c=Qu(f,"columns",void 0),d=Qu(f,"rows",void 0)):$u(u)?(u=Qu(f=u,"baseFrame",void 0),c=Qu(f,"columns",void 0),d=Qu(f,"rows",void 0)):Array.isArray(u)?(f=d,d=c,c=u,u=Qu(f,"baseFrame",void 0)):$u(c)&&(c=Qu(f=c,"columns",void 0),d=Qu(f,"rows",void 0)),void 0===c){var p=Qu(f,"leftWidth",void 0),g=Qu(f,"rightWidth",void 0);void 0!==p&&void 0!==g&&(c=[p,void 0,g]);}if(void 0===d){var y=Qu(f,"topHeight",void 0),k=Qu(f,"bottomHeight",void 0);void 0!==y&&void 0!==k&&(d=[y,void 0,k]);}(v=o.call(this,t)).type=i,v.setPosition(n,r).setSize(s,h).setOrigin(.5,.5),v.columns={},v.rows={},v.stretchMode={},v._tileSprite=void 0,v._image=void 0,v.setGetFrameNameCallback(Qu(f,"getFrameNameCallback",void 0)),v.setStretchMode(Qu(f,"stretchMode",0)),v.setPreserveRatio(Qu(f,"preserveRatio",!0));var m=Qu(f,"maxFixedPartScale",1),x=Qu(f,"maxFixedPartScaleX",m),b=Qu(f,"maxFixedPartScaleY",void 0);return v.setMaxFixedPartScale(x,b),v.setBaseTexture(l,u,c,d),v}return n(a,[{key:"minWidth",get:function(){return this.columns.minWidth}},{key:"minHeight",get:function(){return this.rows.minHeight}},{key:"fixedPartScaleX",get:function(){return this.columns.scale}},{key:"fixedPartScaleY",get:function(){return this.rows.scale}},{key:"resize",value:function(t,e){return this.width===t&&this.height===e||(c(s(a.prototype),"resize",this)?c(s(a.prototype),"resize",this).call(this,t,e):c(s(a.prototype),"setSize",this).call(this,t,e),this.updateTexture()),this}}]),a}(t);return Object.assign(o.prototype,Zu),o}(Phaser.GameObjects.RenderTexture,"rexNinePatch")),rc={_drawImage:function(t,e,i,n,r,s){var o=ic(this,"Image").setTexture(t,e).setDisplaySize(r,s);this.draw(o,i,n);},_drawTileSprite:function(t,e,i,n,r,s){var o=ic(this,"TileSprite").setTexture(t,e).setSize(r,s);this.draw(o,i,n);}};Object.assign(nc.prototype,rc);var sc=function(t,e){var i,n;switch(e&&(e.hasOwnProperty("type")?i=e.type:e.hasOwnProperty("leftWidth")?i="nineSlice":e.hasOwnProperty("key")&&(i="image")),i){case"image":n=new Gu(t,e);break;case"nineSlice":n=e.hasOwnProperty("stretchMode")?new nc(t,e):new Bu(t,e);break;default:n=new Eu(t,e);}return t.add.existing(n),n},oc=Phaser.GameObjects.Text,ac=Phaser.Utils.Objects.GetValue,hc=function(t){r(s,t);var i=l(s);function s(t,n){var r;e(this,s),void 0===n&&(n={});var o=ac(n,"x",0),a=ac(n,"y",0),h=ac(n,"text","");return (r=i.call(this,t,o,a,h,n)).type="rexStatesText",n.style=r.style,n.onModifyStyle=function(t,e){var i=e.hasOwnProperty("fontStyle")||e.hasOwnProperty("fontSize")||e.hasOwnProperty("fontFamily");t.style.update(i);},r.addStyleManager(n),delete n.style,r}return n(s)}(oc);Object.assign(hc.prototype,_u); +!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).rexcolorinput=e();}(undefined,(function(){function t(e){return t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},t(e)}function e(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){for(var i=0;it.length)&&(e=t.length);for(var i=0,n=new Array(e);i=0;i--)(e=this.children[i]).parentContainer||e.displayList||e.destroy(t);this.clear(!t),c(s(o.prototype),"destroy",this).call(this,t);}}},{key:"contains",value:function(t){return -1!==this.children.indexOf(t)}},{key:"add",value:function(t){var e=this;return x(this.children,t,0,(function(t){t.once("destroy",e.onChildDestroy,e);}),this),this}},{key:"remove",value:function(t,e){var i=this;return b(this.children,t,(function(t){t.off("destroy",i.onChildDestroy,i),e&&t.destroy();})),this}},{key:"onChildDestroy",value:function(t,e){this.remove(t,!1);}},{key:"clear",value:function(t){for(var e,i=0,n=this.children.length;i0;){var n=i.shift();!e(n)&&n.isRexContainerLite&&i.push.apply(i,v(n.children));}},it=Phaser.Utils.Array,nt={getChildren:function(t){if(t)for(var e=0,i=this.children.length;e=0;e--)this.remove(this.backgroundChildren[e],t);return this}},Ie=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},Be=/(\S+)\[(\d+)\]/i,Xe=Phaser.Utils.Objects.GetValue,Ye=function(t,e){return void 0===e?t:t[e]},He=function(e,i,n){void 0===e&&(e={}),void 0===i&&(i=0);var r=t(i);return "string"===r?e[i]=n:"number"===r?(e.left=i,e.right=i,e.top=i,e.bottom=i):(e.left=Xe(i,"left",0),e.right=Xe(i,"right",0),e.top=Xe(i,"top",0),e.bottom=Xe(i,"bottom",0)),e},Ge={getInnerPadding:function(t){return Ye(this.space,t)},setInnerPadding:function(t,e){return He(this.space,t,e),this},getOuterPadding:function(t){return Ye(this.getSizerConfig(this).padding,t)},setOuterPadding:function(t,e){return He(this.getSizerConfig(this).padding,t,e),this},getChildOuterPadding:function(t,e){return "string"==typeof t&&(t=this.getElement(t)),Ye(this.getSizerConfig(t).padding,e)},setChildOuterPadding:function(t,e,i){return "string"==typeof t&&(t=this.getElement(t)),He(this.getSizerConfig(t).padding,e,i),this}},Ne=function(t){var e=this.childrenWidth,i=void 0!==this.minWidth?this.minWidth:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn("Layout width warn: ".concat(this.constructor.name,"'s minWidth (").concat(i,") < childrenWidth (").concat(e,")"))):this.layoutWarnEnable&&(i>t||e>t)&&console.warn("Layout width warn: ".concat(this.constructor.name,"'s minWidth (").concat(i,") or childrenWidth (").concat(e," > targetWidth ").concat(t,")")),t},Ue=function(t){var e=this.childrenHeight,i=void 0!==this.minHeight?this.minHeight:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn("Layout height warn: ".concat(this.constructor.name,"'s minHeight (").concat(i,") < childrenHeight (").concat(e,")"))):this.layoutWarnEnable&&(i>t||e>t)&&console.warn("Layout height warn: ".concat(this.constructor.name,"'s minHeight (").concat(i,") or childrenHeight (").concat(e,") > targetHeight (").concat(t,")")),t},Ve={getShownChildren:function(t){void 0===t&&(t=[]);for(var e,i=this.children,n=0,r=i.length;n0;){var i=e.shift();i.rexSizer&&i.rexSizer.hidden||(i!==this&&t.push(i),i.isRexContainerLite&&e.push.apply(e,v(i.children)));}return t}},Je=function(){this._childrenWidth=void 0,this._childrenHeight=void 0;for(var t,e=this.getChildrenSizers(),i=0,n=e.length;i0?-this.delay:0,this.state=this.nowTime>=0?gi:pi,this.repeatCounter=0,this}},{key:"stop",value:function(){return this.state=vi,this}},{key:"update",value:function(t,e){this.state!==vi&&this.state!==ki&&0!==e&&0!==this.timeScale&&(this.nowTime+=e*this.timeScale,this.justRestart=!1,this.nowTime>=this.duration?-1===this.repeat||this.repeatCounter0&&(this.nowTime-=this.repeatDelay,this.state=yi)):(this.nowTime=this.duration,this.state=ki):this.nowTime>=0&&(this.state=gi));}},{key:"t",get:function(){var t;switch(this.state){case vi:case pi:case yi:t=0;break;case gi:t=this.nowTime/this.duration;break;case ki:t=1;}return di(t,0,1)},set:function(t){(t=di(t,-1,1))<0?(this.state=pi,this.nowTime=-this.delay*t):(this.state=gi,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++);}},{key:"setT",value:function(t){return this.t=t,this}},{key:"isIdle",get:function(){return this.state===vi}},{key:"isDelay",get:function(){return this.state===pi}},{key:"isCountDown",get:function(){return this.state===gi}},{key:"isRunning",get:function(){return this.state===pi||this.state===gi}},{key:"isDone",get:function(){return this.state===ki}},{key:"isOddIteration",get:function(){return 1==(1&this.repeatCounter)}},{key:"isEvenIteration",get:function(){return 0==(1&this.repeatCounter)}}]),t}(),vi=0,pi=1,gi=2,yi=3,ki=-1,mi=function(t){r(o,t);var i=l(o);function o(t,n){var r;return e(this,o),(r=i.call(this,t,n)).timer=new fi,r}return n(o,[{key:"shutdown",value:function(t){this.isShutdown||(c(s(o.prototype),"shutdown",this).call(this,t),this.timer.destroy(),this.timer=void 0);}},{key:"start",value:function(){return this.timer.start(),c(s(o.prototype),"start",this).call(this),this}},{key:"stop",value:function(){return this.timer.stop(),c(s(o.prototype),"stop",this).call(this),this}},{key:"complete",value:function(){return this.timer.stop(),c(s(o.prototype),"complete",this).call(this),this}}]),o}(li),xi=Phaser.Utils.Objects.GetValue,bi=Phaser.Utils.Objects.GetAdvancedValue,wi=Phaser.Tweens.Builders.GetEaseFunction,Ci=function(t){r(o,t);var i=l(o);function o(){return e(this,o),i.apply(this,arguments)}return n(o,[{key:"resetFromJSON",value:function(t){return this.timer.resetFromJSON(xi(t,"timer")),this.setEnable(xi(t,"enable",!0)),this.setTarget(xi(t,"target",this.parent)),this.setDelay(bi(t,"delay",0)),this.setDuration(bi(t,"duration",1e3)),this.setEase(xi(t,"ease","Linear")),this.setRepeat(xi(t,"repeat",0)),this}},{key:"setEnable",value:function(t){return null==t&&(t=!0),this.enable=t,this}},{key:"setTarget",value:function(t){return void 0===t&&(t=this.parent),this.target=t,this}},{key:"setDelay",value:function(t){return this.delay=t,this}},{key:"setDuration",value:function(t){return this.duration=t,this}},{key:"setRepeat",value:function(t){return this.repeat=t,this}},{key:"setRepeatDelay",value:function(t){return this.repeatDelay=t,this}},{key:"setEase",value:function(t){return void 0===t&&(t="Linear"),this.ease=t,this.easeFn=wi(t),this}},{key:"start",value:function(){return this.timer.isRunning||c(s(o.prototype),"start",this).call(this),this}},{key:"restart",value:function(){return this.timer.stop(),this.start.apply(this,arguments),this}},{key:"stop",value:function(t){return void 0===t&&(t=!1),c(s(o.prototype),"stop",this).call(this),t&&(this.timer.setT(1),this.updateGameObject(this.target,this.timer),this.complete()),this}},{key:"update",value:function(t,e){if(!this.isRunning||!this.enable||!this.parent.active)return this;var i=this.target,n=this.timer;return n.update(t,e),n.isDelay||this.updateGameObject(i,n),this.emit("update",i,this),n.isDone&&this.complete(),this}},{key:"updateGameObject",value:function(t,e){}}]),o}(mi),Si=Phaser.Utils.Objects.GetValue,Pi=Phaser.Utils.Objects.GetAdvancedValue,Oi=Phaser.Math.Linear,Ti=function(t){r(o,t);var i=l(o);function o(t,n){var r;return e(this,o),(r=i.call(this,t,n)).scaleStart={},r.scaleEnd={},r.resetFromJSON(n),r.boot(),r}return n(o,[{key:"resetFromJSON",value:function(t){return c(s(o.prototype),"resetFromJSON",this).call(this,t),this.setMode(Si(t,"mode",0)),this.setScaleRange(Pi(t,"start",void 0),Pi(t,"end",0)),this}},{key:"setMode",value:function(t){return "string"==typeof t&&(t=_i[t]),this.mode=t,this}},{key:"setScaleRange",value:function(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}},{key:"start",value:function(){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),c(s(o.prototype),"start",this).call(this),this}},{key:"updateGameObject",value:function(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));}},{key:"complete",value:function(){return c(s(o.prototype),"complete",this).call(this),1===this.mode&&this.parent.destroy(),this}}]),o}(Ci),_i={stop:0,destroy:1,yoyo:2},Ei=function(t,e,i,n,r){var s,o;switch(void 0===n&&(n="Cubic"),i){case 0:case"x":s={x:0},o={x:t.scaleX};break;case 1:case"y":s={y:0},o={y:t.scaleY};break;default:s=0,o=t.scale;}var a={mode:0,start:s,end:o,duration:e,ease:n};return void 0===r?r=new Ti(t,a):r.resetFromJSON(a),r.restart(),r},Ri=function(t,e,i,n,r,s){void 0===n&&(n="Linear"),r instanceof Ti&&(s=r,r=void 0),void 0===r&&(r=!0);var o={};switch(o.mode=r?1:0,i){case 0:case"x":o.end={x:0};break;case 1:case"y":o.end={y:0};break;default:o.end=0;}return o.duration=e,o.ease=n,void 0===s?s=new Ti(t,o):s.resetFromJSON(o),s.restart(),s},Mi=function(t,e){return new Promise((function(i,n){t.once(e,(function(){i();}));}))},Li=function(t){return Mi(t,"complete")},Di=Phaser.Utils.Objects.IsPlainObject,Ai=function(t,e){e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0);})),e.on("update",(function(){var e=je.getParentSizer(t);e&&e.resetChildPositionState(t);}));},zi={popUp:function(t,e,i){if(Di(t)){var n=t;t=n.duration,e=n.orientation,i=n.ease;}var r=void 0===this._scaleBehavior;return this._scaleBehavior=Ei(this,t,e,i,this._scaleBehavior),r&&Ai(this,this._scaleBehavior),this._scaleBehavior.completeEventName="popup.complete",this},popUpPromise:function(t,e,i){return this.popUp(t,e,i),Li(this._scaleBehavior)},scaleDownDestroy:function(t,e,i,n){if(Di(t)){var r=t;t=r.duration,e=r.orientation,i=r.ease,n=r.destroy;}var s=void 0===this._scaleBehavior;return this._scaleBehavior=Ri(this,t,e,i,n,this._scaleBehavior),s&&Ai(this,this._scaleBehavior),this._scaleBehavior.completeEventName="scaledown.complete",this},scaleDownDestroyPromise:function(t,e,i,n){return this.scaleDownDestroy(t,e,i,n),Li(this._scaleBehavior)},scaleDown:function(t,e,i){return this.scaleDownDestroy(t,e,i,!1),this},scaleDownPromise:function(t,e,i){return this.scaleDown(t,e,i),Li(this._scaleBehavior)},scaleYoyo:function(t,e,i,n,r){if(Di(t)){var s=t;t=s.duration,e=s.peakValue,i=s.repeat,n=s.orientation,r=s.ease;}var o=void 0===this._scaleBehavior;return this._scaleBehavior=function(t,e,i,n,r,s,o){var a,h;switch(void 0===i&&(i=1.2),void 0===n&&(n=0),void 0===s&&(s="Cubic"),r){case 0:case"x":a={x:t.scaleX},h={x:i};break;case 1:case"y":a={y:t.scaleX},h={y:i};break;default:a=t.scaleX,h=i;}var l={mode:2,start:a,end:h,duration:e/2,ease:s,repeat:n};return void 0===o?o=new Ti(t,l):o.resetFromJSON(l),o.restart(),o}(this,t,e,i,n,r,this._scaleBehavior),o&&Ai(this,this._scaleBehavior),this._scaleBehavior.completeEventName="scaleyoyo.complete",this},scaleYoyoPromise:function(t,e,i,n,r){return this.scaleYoyo(t,e,i,n,r),Li(this._scaleBehavior)}},ji=Phaser.Utils.Objects.GetValue,Fi=Phaser.Utils.Objects.GetAdvancedValue,Wi=Phaser.Math.Linear,Ii=function(t){r(o,t);var i=l(o);function o(t,n){var r;return e(this,o),(r=i.call(this,t,n)).resetFromJSON(n),r.boot(),r}return n(o,[{key:"resetFromJSON",value:function(t){return c(s(o.prototype),"resetFromJSON",this).call(this,t),this.setMode(ji(t,"mode",0)),this.setAlphaRange(Fi(t,"start",this.parent.alpha),Fi(t,"end",0)),this}},{key:"setMode",value:function(t){return "string"==typeof t&&(t=Bi[t]),this.mode=t,this}},{key:"setAlphaRange",value:function(t,e){return this.alphaStart=t,this.alphaEnd=e,this}},{key:"start",value:function(){return this.timer.isRunning||(this.parent.setAlpha(this.alphaStart),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),c(s(o.prototype),"start",this).call(this)),this}},{key:"updateGameObject",value:function(t,e){var i=e.t;e.isOddIteration&&(i=1-i),t.alpha=Wi(this.alphaStart,this.alphaEnd,i);}},{key:"complete",value:function(){return c(s(o.prototype),"complete",this).call(this),1===this.mode&&this.parent.destroy(),this}}]),o}(Ci),Bi={stop:0,destroy:1,yoyo:2},Xi=Phaser.Utils.Objects.IsPlainObject,Yi=function(t,e,i,n){var r,s;Xi(i)?(r=i.start,s=i.end):s=i,void 0===r&&(r=0),void 0===s&&(s=1);var o={mode:0,start:r,end:s,duration:e};return void 0===n?n=new Ii(t,o):n.resetFromJSON(o),n.restart(),n},Hi=function(t,e,i,n){i instanceof Ii&&(n=i,i=void 0),void 0===i&&(i=!0);var r={mode:i?1:0,end:0,duration:e};return void 0===n?n=new Ii(t,r):n.resetFromJSON(r),n.restart(),n},Gi=Phaser.Utils.Objects.IsPlainObject,Ni=function(t,e){e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0);})),e.on("update",(function(){var e=je.getParentSizer(t);e&&e.resetChildAlphaState(t);}));},Ui={fadeIn:function(t,e){if(Gi(t)){var i=t;t=i.duration,e=i.alpha;}var n=void 0===this._fade;return this._fade=Yi(this,t,e,this._fade),n&&Ni(this,this._fade),this._fade.completeEventName="fadein.complete",this},fadeInPromise:function(t,e){return this.fadeIn(t,e),Li(this._fade)},fadeOutDestroy:function(t,e){if(Gi(t)){var i=t;t=i.duration,e=i.destroy;}var n=void 0===this._fade;return this._fade=Hi(this,t,e,this._fade),n&&Ni(this,this._fade),this._fade.completeEventName="fadeout.complete",this},fadeOutDestroyPromise:function(t,e){return this.fadeOutDestroy(t,e),Li(this._fade)},fadeOut:function(t){return this.fadeOutDestroy(t,!1),this},fadeOutPromise:function(t){return this.fadeOut(t),Li(this._fade)}},Vi=Phaser.Utils.Objects.GetValue,Ji=Phaser.Utils.Objects.GetAdvancedValue,qi=Phaser.Math.Linear,Ki=function(t){r(o,t);var i=l(o);function o(t,n){var r;return e(this,o),(r=i.call(this,t,n)).resetFromJSON(n),r.boot(),r}return n(o,[{key:"resetFromJSON",value:function(t){if(c(s(o.prototype),"resetFromJSON",this).call(this,t),this.setMode(Vi(t,"mode",0)),t&&(t.hasOwnProperty("x")||t.hasOwnProperty("y"))){var e=Ji(t,"x",void 0),i=Ji(t,"y",void 0);this.setTargetPosition(e,i);}else this.setTargetPosition(t);return this}},{key:"setMode",value:function(t){return "string"==typeof t&&(t=Zi[t]),this.mode=t,this}},{key:"setTargetPosition",value:function(t,e){if("number"==typeof t||"number"==typeof e)this.startX=this.parent.x,this.startY=this.parent.y,this.endX=t,this.endY=e;else {var i=t;this.startX=Ji(i,"startX",void 0),this.startY=Ji(i,"startY",void 0),this.endX=Ji(i,"endX",void 0),this.endY=Ji(i,"endY",void 0);}return this.hasMoveX=void 0!==this.startX&&void 0!==this.endX,this.hasMoveY=void 0!==this.startY&&void 0!==this.endY,this}},{key:"start",value:function(){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),c(s(o.prototype),"start",this).call(this),this}},{key:"updateGameObject",value:function(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasMoveX&&(t.x=qi(this.startX,this.endX,i)),this.hasMoveY&&(t.y=qi(this.startY,this.endY,i));}},{key:"complete",value:function(){return c(s(o.prototype),"complete",this).call(this),1===this.mode&&this.parent.destroy(),this}}]),o}(Ci),Zi={stop:0,destroy:1,yoyo:2},$i=function(t,e){if("number"==typeof t)return t;var i=t[0],n=parseFloat(t.substr(2));switch(i){case"+":return e+n;case"-":return e-n;case"*":return e*n;case"/":return e/n}},Qi=Phaser.Utils.Objects.IsPlainObject,tn=Phaser.Math.Distance.Between,en=function(t,e){e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0);})),e.on("update",(function(){var e=je.getParentSizer(t);e&&e.resetChildPositionState(t);}));},nn={moveFrom:function(t,e,i,n,r){if(Qi(t)){var s=t;e=s.x,i=s.y,t=s.hasOwnProperty("speed")?1e3*tn(e,i,this.x,this.y)/s.speed:s.duration,n=s.ease;}var o=void 0===this._easeMove;return this._easeMove=function(t,e,i,n,r,s,o){s instanceof Ki&&(o=s,s=void 0),void 0===s&&(s=!1);var a={};return a.mode=s?1:0,void 0!==i&&(a.startX=$i(i,t.x),a.endX=t.x),void 0!==n&&(a.startY=$i(n,t.y),a.endY=t.y),a.duration=e,a.ease=void 0===r?"Linear":r,void 0===o?o=new Ki(t,a):o.resetFromJSON(a),o.restart(),o}(this,t,e,i,n,r,this._easeMove),o&&en(this,this._easeMove),this._easeMove.completeEventName="movefrom.complete",this},moveFromPromise:function(t,e,i,n,r){return this.moveFrom(t,e,i,n,r),Li(this._easeMove)},moveFromDestroy:function(t,e,i,n){return this.moveFrom(t,e,i,n,!0),this},moveFromDestroyPromise:function(t,e,i,n){return this.moveFromDestroy(t,e,i,n),Li(this._easeMove)},moveTo:function(t,e,i,n,r){if(Qi(t)){var s=t;e=s.x,i=s.y,t=s.hasOwnProperty("speed")?1e3*tn(e,i,this.x,this.y)/s.speed:s.duration,n=s.ease;}var o=void 0===this._easeMove;return this._easeMove=function(t,e,i,n,r,s,o){s instanceof Ki&&(o=s,s=void 0),void 0===s&&(s=!1);var a={};return a.mode=s?1:0,void 0!==i&&(a.startX=t.x,a.endX=$i(i,t.x)),void 0!==n&&(a.startY=t.y,a.endY=$i(n,t.y)),a.duration=e,a.ease=void 0===r?"Linear":r,void 0===o?o=new Ki(t,a):o.resetFromJSON(a),o.restart(),o}(this,t,e,i,n,r,this._easeMove),o&&en(this,this._easeMove),this._easeMove.completeEventName="moveto.complete",this},moveToPromise:function(t,e,i,n,r){return this.moveTo(t,e,i,n,r),Li(this._easeMove)},moveToDestroy:function(t,e,i,n){return this.moveTo(t,e,i,n,!0),this},moveToDestroyPromise:function(t,e,i,n){return this.moveToDestroy(t,e,i,n,!0),Li(this._easeMove)},moveStop:function(t){return this._easeMove?(this._easeMove.stop(t),this):this}},rn=Phaser.Utils.Objects.GetValue,sn=function(t){r(o,t);var i=l(o);function o(t,n){var r;return e(this,o),(r=i.call(this,t,n)).timer=new fi,r.resetFromJSON(n),r.boot(),r}return n(o,[{key:"resetFromJSON",value:function(t){return this.timer.resetFromJSON(rn(t,"timer")),this.setEnable(rn(t,"enable",!0)),this.setMode(rn(t,"mode",1)),this.isRunning=rn(t,"isRunning",!1),this.setMagnitudeMode(rn(t,"magnitudeMode",1)),this.setAxisMode(rn(t,"axis",0)),this.setDuration(rn(t,"duration",500)),this.setMagnitude(rn(t,"magnitude",10)),this.ox=rn(t,"ox",void 0),this.oy=rn(t,"oy",void 0),this}},{key:"toJSON",value:function(){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}}},{key:"shutdown",value:function(t){this.isShutdown||(c(s(o.prototype),"shutdown",this).call(this,t),this.timer.destroy(),this.timer=void 0);}},{key:"startTicking",value:function(){c(s(o.prototype),"startTicking",this).call(this),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);}},{key:"stopTicking",value:function(){c(s(o.prototype),"stopTicking",this).call(this),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));}},{key:"setEnable",value:function(t){return null==t&&(t=!0),this.enable=t,this}},{key:"setMode",value:function(t){return "string"==typeof t&&(t=on[t]),this.mode=t,this}},{key:"setMagnitudeMode",value:function(t){return "string"==typeof t&&(t=hn[t]),this.magnitudeMode=t,this}},{key:"setAxisMode",value:function(t){return "string"==typeof t&&(t=an[t]),this.axisMode=t,this}},{key:"setDuration",value:function(t){return this.duration=t,this}},{key:"setMagnitude",value:function(t){return this.magnitude=t,this}},{key:"start",value:function(t,e){if("number"!=typeof t){var i=t;e=rn(i,"magnitude",void 0),t=rn(i,"duration",void 0);}return void 0!==e&&this.setMagnitude(e),void 0!==t&&this.setDuration(t),this.timer.setDuration(this.duration).start(),c(s(o.prototype),"start",this).call(this),this}},{key:"shake",value:function(t,e){return this.start(t,e),this}},{key:"update",value:function(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 n=this.magnitude;1===this.magnitudeMode&&(n*=1-this.timer.t);var r=Math.random()*Math.PI*2,s=this.ox+Math.cos(r)*n,o=this.oy+Math.sin(r)*n;switch(this.axisMode){case 1:i.x=s;break;case 2:i.y=o;break;default:i.x=s,i.y=o;}}return this}},{key:"backToOrigin",value:function(){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}}]),o}(oi),on={effect:0,behavior:1},an={both:0,"h&v":0,"x&y":0,horizontal:1,h:1,x:1,vertical:2,v:2,y:2},hn={constant:0,decay:1},ln=Phaser.Utils.Objects.IsPlainObject,un={shake:function(t,e,i){if(ln(t)){var n=t;t=n.duration,e=n.magnitude,i=n.magnitudeMode;}return void 0===this._shake&&(this._shake=new sn(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:function(t,e){return this.shake(t,e),Li(this._shake)}},cn=Phaser.Utils.Objects.GetValue,dn=Phaser.Math.Linear,fn=function(t){r(o,t);var i=l(o);function o(t,n){var r;return e(this,o),(r=i.call(this,t,n)).resetFromJSON(),r.boot(),r}return n(o,[{key:"start",value:function(t){if(this.timer.isRunning)return this;var e=this.target;this.propertyKey=cn(t,"key","value");var i=e[this.propertyKey];return this.fromValue=cn(t,"from",i),this.toValue=cn(t,"to",i),this.setEase(cn(t,"ease",this.ease)),this.setDuration(cn(t,"duration",this.duration)),this.setRepeat(cn(t,"repeat",0)),this.setDelay(cn(t,"delay",0)),this.setRepeatDelay(cn(t,"repeatDelay",0)),this.timer.setDuration(this.duration).setRepeat(this.repeat).setDelay(this.delay).setRepeatDelay(this.repeatDelay),e[this.propertyKey]=this.fromValue,c(s(o.prototype),"start",this).call(this),this}},{key:"updateGameObject",value:function(t,e){var i=e.t;i=this.easeFn(i),t[this.propertyKey]=dn(this.fromValue,this.toValue,i);}}]),o}(Ci),vn=Phaser.Utils.Objects.IsPlainObject,pn=function(t){r(s,t);var i=l(s);function s(t,n){var r;return e(this,s),(r=i.call(this,t,n)).parent.setDataEnabled(),r.easeTasks={},r}return n(s,[{key:"complete",value:function(t){this.emit("complete-".concat(t),this.parent,this),this.emit("complete",t,this.parent,this);}},{key:"getEaseTask",value:function(t){var e=this.easeTasks[t];return void 0===e&&(e=new fn(this.parent),this.easeTasks[t]=e,e.setTarget(this.parent.data.values).on("complete",(function(){this.complete(t);}),this)),e}},{key:"easeTo",value:function(t,e,i,n){if(vn(t)){var r=t;t=r.key,e=r.value,i=r.duration,n=r.ease;var s=r.speed;void 0===i&&void 0!==s&&(i=Math.abs(e-this.parent.data.values[t])/s*1e3);}return void 0===i&&(i=1e3),void 0===n&&(n="Linear"),this.getEaseTask(t).restart({key:t,to:e,duration:i,ease:n}),this}},{key:"easeFrom",value:function(t,e,i,n){if(vn(t)){var r=t;t=r.key,e=r.value,i=r.duration,n=r.ease;var s=r.speed;void 0===i&&void 0!==s&&(i=Math.abs(e-this.parent.data.values[t])/s*1e3);}return void 0===i&&(i=1e3),void 0===n&&(n="Linear"),this.getEaseTask(t).restart({key:t,from:e,duration:i,ease:n}),this}},{key:"stopEase",value:function(t,e){void 0===e&&(e=!0);var i=this.easeTasks[t];return i&&i.stop(e),this}},{key:"stopAll",value:function(t){for(var e in void 0===t&&(t=!0),this.easeTasks)this.stopEase(e,t);return this}}]),s}(ni),gn={easeDataTo:function(t,e,i,n){return this._easeData||(this._easeData=new pn(this),function(t,e){e.on("complete",(function(e){t.emit("easedata.".concat(e,".complete"),t),t.emit("easedata.complete",e,t);}));}(this,this._easeData)),this._easeData.easeTo(t,e,i,n),this},easeDataToPromise:function(t,e,i,n){return this.easeDataTo(t,e,i,n),Mi(this._easeData,"complete-".concat(t))},stopEaseData:function(t,e){return this._easeData?(this._easeData.stopEase(t,e),this):this},stopAllEaseData:function(t){return this._easeData?(this._easeData.stopAll(t),this):this}},yn=function(t,e){if(t){Ut(t).hidden=e;var i=P(t);i?i.setChildVisible(t,!e):t.setVisible(!e);}},kn={show:function(t){return void 0===t&&(t=this),function(t){yn(t,!1);}(t),this},hide:function(t){return void 0===t&&(t=this),function(t){yn(t,!0);}(t),this},isShow:function(t){return void 0===t&&(t=this),function(t){return !!t&&!Ut(t).hidden}(t)}};function mn(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var xn={exports:{}};!function(t){var e=Object.prototype.hasOwnProperty,i="~";function n(){}function r(t,e,i){this.fn=t,this.context=e,this.once=i||!1;}function s(t,e,n,s,o){if("function"!=typeof n)throw new TypeError("The listener must be a function");var a=new r(n,s||t,o),h=i?i+e:e;return t._events[h]?t._events[h].fn?t._events[h]=[t._events[h],a]:t._events[h].push(a):(t._events[h]=a,t._eventsCount++),t}function o(t,e){0==--t._eventsCount?t._events=new n:delete t._events[e];}function a(){this._events=new n,this._eventsCount=0;}Object.create&&(n.prototype=Object.create(null),(new n).__proto__||(i=!1)),a.prototype.eventNames=function(){var t,n,r=[];if(0===this._eventsCount)return r;for(n in t=this._events)e.call(t,n)&&r.push(i?n.slice(1):n);return Object.getOwnPropertySymbols?r.concat(Object.getOwnPropertySymbols(t)):r},a.prototype.listeners=function(t){var e=i?i+t:t,n=this._events[e];if(!n)return [];if(n.fn)return [n.fn];for(var r=0,s=n.length,o=new Array(s);r0){var e=t.runTransitionInCallback();t.delayCall(e,this.next,this);}else this.next();}},{key:"exit_TRANS_OPNE",value:function(){this.parent.removeDelayCall();}},{key:"next_OPEN",value:function(){return "TRANS_CLOSE"}},{key:"enter_OPEN",value:function(){this.parent.onOpen();}},{key:"exit_OPEN",value:function(){this.parent.removeDelayCall();}},{key:"next_TRANS_CLOSE",value:function(){return "CLOSE"}},{key:"enter_TRANS_CLOSE",value:function(){var t=this.parent;if(t.transitOutTime>0){var e=t.runTransitionOutCallback();t.delayCall(e,this.next,this);}else this.next();}},{key:"exit_TRANS_CLOSE",value:function(){this.parent.removeDelayCall();}},{key:"next_CLOSE",value:function(){return "TRANS_OPNE"}},{key:"enter_CLOSE",value:function(){this.parent.onClose();}},{key:"exit_CLOSE",value:function(){}},{key:"canOpen",value:function(){return "IDLE"===this.state||"CLOSE"===this.state}},{key:"canClose",value:function(){return "IDLE"===this.state||"OPEN"===this.state}}]),s}(_n),Rn={delayCall:function(t,e,i){return this.delayCallTimer=function(t,e,i,n,r){var s=$e(t);return s.time.delayedCall(e,(function(){s.game.events.once("poststep",(function(){i.call(n,r);}));}))}(this,t,e,i),this},removeDelayCall:function(){return this.delayCallTimer&&(this.delayCallTimer.remove(!1),this.delayCallTimer=void 0),this}},Mn={setTransitInTime:function(t){return this.transitInTime=t,this},setTransitOutTime:function(t){return this.transitOutTime=t,this},setTransitInCallback:function(t){return t||(t=Qt),this.transitInCallback=t,this},setTransitOutCallback:function(t){return t||(t=Qt),this.transitOutCallback=t,this}},Ln={runTransitionInCallback:function(){return this.transitInCallback(this.parent,this.transitInTime),this.transitInTime},onOpen:function(){},requestOpen:function(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}},Dn={runTransitionOutCallback:function(){return this.transitOutCallback(this.parent,this.transitOutTime),this.transitOutTime},onClose:function(){this.oneShotMode&&this.parent.destroy();},requestClose:function(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}},An={};Object.assign(An,Rn,Mn,Ln,Dn);var zn=Phaser.Utils.Objects.GetValue,jn=function(t){r(o,t);var i=l(o);function o(t,n){var r;return e(this,o),(r=i.call(this,t,n)).setTransitInTime(zn(n,"duration.in",200)),r.setTransitOutTime(zn(n,"duration.out",200)),r.setTransitInCallback(zn(n,"transitIn")),r.setTransitOutCallback(zn(n,"transitOut")),r.oneShotMode=zn(n,"destroy",!1),r.delayCallTimer=void 0,r._state=new En(a(r),{eventEmitter:!1,initState:zn(n,"initState","IDLE")}),r.openEventData=void 0,r.closeEventData=void 0,r}return n(o,[{key:"state",get:function(){return this._state.state}},{key:"shutdown",value:function(t){this.isShutdown||(this.transitInCallback=void 0,this.transitOutCallback=void 0,this.openEventData=void 0,this.closeEventData=void 0,this.removeDelayCall(),c(s(o.prototype),"shutdown",this).call(this,t));}}]),o}(ni);Object.assign(jn.prototype,An);var Fn=function(t){r(o,t);var i=l(o);function o(t,n,r){var s;return e(this,o),(s=i.call(this,t,0,0,2,2,n,1)).setAlpha(r),s.setScrollFactor(0),s.boot(),s}return n(o,[{key:"boot",value:function(){this.scene.sys.events.on("prerender",this.resize,this);}},{key:"destroy",value:function(t){this.scene&&!this.ignoreDestroy&&(this.scene.sys.events.off("prerender",this.resize,this),c(s(o.prototype),"destroy",this).call(this,t));}},{key:"tint",get:function(){return this.fillColor},set:function(t){this.setFillStyle(t,this.fillAlpha);}},{key:"resize",value:function(){var t=this.scene,e=t.sys.scale.gameSize,i=t.sys.cameras.main,n=e.width,r=e.height,s=1/i.zoom,o=n/2,a=r/2,h=n*s,l=r*s;this.x===o&&this.y===a||this.setPosition(o,a),this.width===h&&this.height===l||this.setSize(h,l).setOrigin(.5);}}]),o}(Phaser.GameObjects.Rectangle),Wn=Phaser.Utils.Objects.GetValue,In=function(t){r(s,t);var i=l(s);function s(t,n){var r;return e(this,s),(r=i.call(this,t,{eventEmitter:!1})).resetFromJSON(n),r.boot(),r}return n(s,[{key:"resetFromJSON",value:function(t){return this.setHitAreaMode(Wn(t,"hitAreaMode",0)),this.setEnable(Wn(t,"enable",!0)),this.setStopMode(Wn(t,"stopAllLevels",!0)),this}},{key:"boot",value:function(){this.parent.on("pointerdown",(function(t,e,i,n){this.stopAllLevels&&n.stopPropagation();}),this).on("pointerup",(function(t,e,i,n){this.stopAllLevels&&n.stopPropagation();}),this).on("pointermove",(function(t,e,i,n){this.stopAllLevels&&n.stopPropagation();}),this).on("pointerover",(function(t,e,i,n){this.stopAllLevels&&n.stopPropagation();}),this).on("pointerout",(function(t,e){this.stopAllLevels&&e.stopPropagation();}),this);}},{key:"setHitAreaMode",value:function(t){"string"==typeof t&&(t=Bn[t]);var e=this.parent;return e.input&&e.removeInteractive(),0===t?e.setInteractive():e.setInteractive({hitArea:{},hitAreaCallback:function(){return !0}}),this}},{key:"setEnable",value:function(t){return void 0===t&&(t=!0),t?this.parent.setInteractive():this.parent.disableInteractive(),this.enable=t,this}},{key:"setStopMode",value:function(t){return void 0===t&&(t=!0),this.stopAllLevels=t,this}},{key:"toggleEnable",value:function(){return this.setEnable(!this.enable),this}}]),s}(ni),Bn={default:0,fullWindow:1},Xn=Phaser.Utils.Objects.GetValue,Yn=function(t){r(s,t);var i=l(s);function s(t,n){var r;e(this,s);var o=Xn(n,"color",0),h=Xn(n,"alpha",.8);return (r=i.call(this,t,o,h)).touchEventStop=new In(a(r),{hitAreaMode:1}),r}return n(s)}(Fn),Hn=function(t,e){void 0!==t._modalScaleSave?(t.scaleX=t._modalScaleSave,t.scaleY=t._modalScaleSave):t._modalScaleSave=t.scaleX,Ei(t,e);},Gn=function(t,e){Ri(t,e,void 0,void 0,!1);},Nn=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Yi(t,e);},Un=function(t,e){Hi(t,e,!1);},Vn=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Yi(t,e,t.alpha);},Jn=function(t,e){Hi(t,e,!1);},qn=function(t,e,i,n,r){return !!t&&(!(n&&!n(t,e,i))&&(!!xt(t,!0).contains(e,i)&&!(r&&!r(t,e,i))))},Kn=Phaser.Utils.Objects.GetValue,Zn=function(t){r(o,t);var i=l(o);function o(t,n){var r;e(this,o),void 0===n&&(n={}),null==n.transitIn&&(n.transitIn=$n.popUp),null==n.transitOut&&(n.transitOut=$n.scaleDown),n.destroy=Kn(n,"destroy",!0),r=i.call(this,t,n);var s=Kn(n,"cover");r.cover=!1!==s?function(t,e){var i=t.scene,n=new Yn(i,e);return i.add.existing(n),t.isRexContainerLite?(t.pin(n,{syncPosition:!1,syncRotation:!1,syncScale:!1,syncAlpha:!1,syncScrollFactor:!1}),t.moveDepthBelow(n)):i.children.moveBelow(n,t),n}(t,s):void 0,r.cover&&(r.setCoverTransitInCallback(Kn(s,"transitIn",Vn)),r.setCoverTransitOutCallback(Kn(s,"transitOut",Jn)));var h=Kn(n,"touchOutsideClose",!1),l=Kn(n,"duration.hold",-1),u=Kn(n,"timeOutClose",l>=0),c=Kn(n,"anyTouchClose",!1);return Kn(n,"manualClose",!1)&&(h=!1,c=!1,u=!1),c&&(h=!1),u?r.setDisplayTime(l):r.setDisplayTime(-1),c?r.once("open",r.anyTouchClose,a(r)):h&&r.once("open",r.touchOutsideClose,a(r)),Kn(n,"openOnStart",!0)&&r.delayCall(0,r.requestOpen,a(r)),r}return n(o,[{key:"shutdown",value:function(t){this.isShutdown||(this.cover||this.scene.input.off("pointerup",this.touchCloseCallback,this),this.cover&&!t&&(this.cover.destroy(),this.cover=void 0),c(s(o.prototype),"shutdown",this).call(this,t));}},{key:"touchOutsideClose",value:function(){return this.cover?this.cover.on("pointerup",this.touchCloseCallback,this):this.scene.input.on("pointerup",this.touchCloseCallback,this),this.clickOutsideTest=!0,this}},{key:"anyTouchClose",value:function(){return this.cover?this.cover.once("pointerup",this.touchCloseCallback,this):this.scene.input.once("pointerup",this.touchCloseCallback,this),this}},{key:"touchCloseCallback",value:function(t){this.clickOutsideTest&&qn(this.parent,t.worldX,t.worldY)||this.requestClose();}},{key:"runTransitionInCallback",value:function(){var t=c(s(o.prototype),"runTransitionInCallback",this).call(this),e=this.cover;return e&&this.coverTransitInCallback&&this.coverTransitInCallback(e,t),t}},{key:"runTransitionOutCallback",value:function(){var t=c(s(o.prototype),"runTransitionOutCallback",this).call(this),e=this.cover;return e&&this.coverTransitOutCallback&&this.coverTransitOutCallback(e,t),t}},{key:"onOpen",value:function(){var t=this.displayTime;t>=0&&this.delayCall(t,this.requestClose,this),this.emit("open",this.parent,this),c(s(o.prototype),"onOpen",this).call(this);}},{key:"onClose",value:function(){this.emit("close",this.closeEventData),c(s(o.prototype),"onClose",this).call(this);}},{key:"setDisplayTime",value:function(t){return this.displayTime=t,this}},{key:"setTransitInCallback",value:function(t){switch("string"==typeof t&&(t=$n[t]),t){case $n.popUp:t=Hn;break;case $n.fadeIn:t=Nn;}return c(s(o.prototype),"setTransitInCallback",this).call(this,t),this}},{key:"setTransitOutCallback",value:function(t){switch("string"==typeof t&&(t=$n[t]),t){case $n.scaleDown:t=Gn;break;case $n.fadeOut:t=Un;}return c(s(o.prototype),"setTransitOutCallback",this).call(this,t),this}},{key:"setCoverTransitInCallback",value:function(t){return this.coverTransitInCallback=t,this}},{key:"setCoverTransitOutCallback",value:function(t){return this.coverTransitOutCallback=t,this}}]),o}(jn),$n={popUp:0,fadeIn:1,scaleDown:0,fadeOut:1},Qn=function(t){return t&&"function"==typeof t},tr={modal:function(t,e){return Qn(t)&&(e=t,t=void 0),void 0===this._modalBehavior&&(this.onCreateModalBehavior&&this.onCreateModalBehavior(this,t),this._modalBehavior=function(t,e){var i=new Zn(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:function(t){var e=this;return new Promise((function(i,n){e.modal(t,i);}))},modalClose:function(t){return function(t,e){t.emit("modal.requestClose",e);}(this,t),this}},er=function(t,e,i,n){if(e)return qn(t,e.worldX,e.worldY,i,n);for(var r=t.scene.input.manager,s=r.pointersTotal,o=r.pointers,a=0;a=this.dragThreshold&&this.cancel();}},{key:"click",value:function(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 n=this.lastClickTime;return void 0!==n&&t-n<=this.clickInterval||(this.lastClickTime=t,this.emit("click",this,this.parent,e,i)),this}},{key:"cancel",value:function(){return this.pointer=void 0,this}},{key:"onOver",value:function(t,e,i,n){return this.enable?(this.emit("over",this,this.parent,t,n),this):this}},{key:"onOut",value:function(t,e){return this.enable?(this.emit("out",this,this.parent,t,e),this):this}}]),o}(ni),pr={press:0,pointerdown:0,release:1,pointerup:1},gr={onClick:function(t,e,i,n){return t?("function"==typeof t&&(n=i,i=e,e=t,t=this),void 0===t._click&&(t._click=new vr(t,n)),t._click.on("click",e,i),this):this},offClick:function(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:function(e,i){return e&&"object"!==t(e)&&(i=e,e=this),void 0===e._click||e._click.setEnable(i),this},disableClick:function(e){return e&&"object"!==t(e)&&(e=this),void 0===e._click||e._click.setEnable(!1),this}},yr=function(t,e,i,n){if(e)return !(i&&!i(t,e))&&(!!kr(t,e)&&!(n&&!n(t,e)));for(var r=t.scene.input.manager,s=r.pointersTotal,o=r.pointers,a=0;a0)return mr.length=0,!0;return mr.length=0,!1},mr=[],xr=Phaser.Utils.Objects.GetValue,br=function(t){r(o,t);var i=l(o);function o(t,n){var r;e(this,o),(r=i.call(this,t,n))._enable=void 0;var s=xr(n,"inputConfig",void 0);return s&&t.setInteractive(s),r.resetFromJSON(n),r.boot(),r}return n(o,[{key:"resetFromJSON",value:function(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}},{key:"boot",value:function(){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);}},{key:"shutdown",value:function(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,c(s(o.prototype),"shutdown",this).call(this,t);}}},{key:"enable",get:function(){return this._enable},set:function(t){if(this._enable!==t){t||this.cancel(),this._enable=t;var e=t?"enable":"disable";this.emit(e,this,this.parent);}}},{key:"setEnable",value:function(t){return void 0===t&&(t=!0),this.enable=t,this}},{key:"toggleEnable",value:function(){return this.setEnable(!this.enable),this}},{key:"setMode",value:function(t){return "string"==typeof t&&(t=wr[t]),this.mode=t,this}},{key:"setClickInterval",value:function(t){return this.clickInterval=t,this}},{key:"setDragThreshold",value:function(t){return this.dragThreshold=t,this}},{key:"isPointerInside",value:function(t){var e=this.parent;return (e.input?yr:er)(e,t)}},{key:"onPress",value:function(t){this.parent.willRender(t.camera)&&void 0===this.pointer&&(this.pointer=t,0===this.mode&&(this.isPointerInside(t)||this.click(t.downTime,t)));}},{key:"onRelease",value:function(t){this.parent.willRender(t.camera)&&this.pointer===t&&(1===this.mode&&(this.isPointerInside(t)||this.click(t.upTime,t)),this.pointer=void 0);}},{key:"onMove",value:function(t,e,i,n){this.pointer===t&&void 0!==this.dragThreshold&&1===this.mode&&(t.getDistance()>=this.dragThreshold||this.isPointerInside(t))&&this.cancel();}},{key:"click",value:function(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}},{key:"cancel",value:function(){return this.pointer=void 0,this}}]),o}(ni),wr={press:0,pointerdown:0,release:1,pointerup:1},Cr={onClickOutside:function(t,e,i,n){return t?("function"==typeof t&&(n=i,i=e,e=t,t=this),void 0===t._clickOutside&&(t._clickOutside=new br(t,n)),t._clickOutside.on("clickoutside",e,i),this):this},offClickOutside:function(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:function(e,i){return e&&"object"!==t(e)&&(i=e,e=this),void 0===e._clickOutside||e._clickOutside.setEnable(i),this},disableClickOutside:function(e){return e&&"object"!==t(e)&&(e=this),void 0===e._clickOutside||e._clickOutside.setEnable(!1),this}},Sr=function(t){r(s,t);var i=l(s);function s(){var t;return e(this,s),(t=i.call(this,{eventEmitter:!1})).goto("IDLE"),t}return n(s,[{key:"setCooldownTime",value:function(t){return this.cooldownTime=t,this.cooldownMode=void 0!==t,this}},{key:"request",value:function(){return this.runMethod("request")}},{key:"update_IDLE",value:function(){this.compensationTime=0;}},{key:"request_IDLE",value:function(){return this.next(),!0}},{key:"next_IDLE",value:function(){if(this.cooldownMode)return "COOLDOWN"}},{key:"enter_COOLDOWN",value:function(){this.remainderTime=this.cooldownTime+this.compensationTime;}},{key:"update_COOLDOWN",value:function(t,e){this.remainderTime-=e,this.remainderTime<0&&(this.compensationTime=this.cooldownTime>e?-this.remainderTime:0,this.goto("IDLE"));}},{key:"request_COOLDOWN",value:function(){return !1}}]),s}(_n),Pr=Phaser.Utils.Objects.GetValue,Or=function(t){r(o,t);var i=l(o);function o(t,n){var r;return e(this,o),(r=i.call(this,t,n))._enable=void 0,r.cooldown=new Sr,r.parent.setInteractive(Pr(n,"inputConfig",void 0)),r.resetFromJSON(n),r.boot(),r}return n(o,[{key:"resetFromJSON",value:function(t){return this.pointer=void 0,this.prevIsInTouch=!1,this.isInTouching=!1,this.setEnable(Pr(t,"enable",!0)),this.setCooldown(Pr(t,"cooldown",void 0)),this}},{key:"boot",value:function(){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);}},{key:"shutdown",value:function(t){this.isShutdown||(this.scene.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,c(s(o.prototype),"shutdown",this).call(this,t));}},{key:"enable",get:function(){return this._enable},set:function(t){if(this._enable!==t)return t||(this.prevIsInTouch=!1,this.isInTouching=!1,this.pointer=void 0),this._enable=t,this}},{key:"setEnable",value:function(t){return void 0===t&&(t=!0),this.enable=t,this}},{key:"cooldownTime",get:function(){return this.cooldown.cooldownTime},set:function(t){this.cooldown.setCooldownTime(t);}},{key:"setCooldown",value:function(t){return this.cooldownTime=t,this}},{key:"toggleEnable",value:function(){return this.setEnable(!this.enable),this}},{key:"onPointIn",value:function(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.pointer=t,this.isInTouching=!0);}},{key:"onPointOut",value:function(t){this.enable&&this.pointer===t&&(this.pointer=void 0,this.isInTouching=!1);}},{key:"preupdate",value:function(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;}}]),o}(ni),Tr={isPointerInBounds:function(t){return void 0===t?t=this:"string"==typeof t&&(t=this.getElement(t)),!!t&&er(t)},onTouching:function(t,e,i,n){return t?("function"==typeof t&&(n=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new Or(t,n)),t._inTouching.on("intouch",e,i),this):this},offTouching:function(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:function(t,e,i,n){return t?("function"==typeof t&&(n=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new Or(t,n)),t._inTouching.on("touchend",e,i),this):this},offTouchingEnd:function(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:function(e,i){return e&&"object"!==t(e)&&(i=e,e=this),void 0===e._inTouching||e._inTouching.setEnable(i),this},disableTouching:function(e){return e&&"object"!==t(e)&&(e=this),void 0===e._inTouching||e._inTouching.setEnable(!1),this}},_r=function(t,e,i){for(var n,r=0,s=t.length;r0),this.onDragStart()));}},{key:"onPointerUp",value:function(t){this.enable&&((!this.bounds||this.bounds.contains(t.x,t.y))&&this.pointer===t&&(this.pointer=void 0,this.movedState=!1,this.tracerState=Gr,this.onDragEnd()));}},{key:"onPointerMove",value:function(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()));}}},{key:"dragCancel",value:function(){return this.tracerState===Nr&&this.onDragEnd(),this.pointer=void 0,this.tracerState=Gr,this}},{key:"onDragStart",value:function(){this.emit("dragstart",this);}},{key:"onDragEnd",value:function(){this.emit("dragend",this);}},{key:"onDrag",value:function(){this.emit("drag",this);}},{key:"preUpdate",value:function(t,e){}},{key:"postUpdate",value:function(t,e){}},{key:"startTicking",value:function(){c(s(o.prototype),"startTicking",this).call(this),this.scene.sys.events.on("preupdate",this.preUpdate,this),this.scene.sys.events.on("postupdate",this.postUpdate,this);}},{key:"stopTicking",value:function(){c(s(o.prototype),"stopTicking",this).call(this),this.scene&&(this.scene.sys.events.off("preupdate",this.preUpdate,this),this.scene.sys.events.off("postupdate",this.postUpdate,this));}},{key:"setRecongizedStateObject",value:function(t){return this.recongizedState=t,this}},{key:"state",get:function(){return this.recongizedState.state},set:function(t){this.recongizedState.state=t;}},{key:"cancel",value:function(){return this.state=Ur,this}}]),o}(oi),Gr=0,Nr=1,Ur="IDLE",Vr=Phaser.Utils.Objects.GetValue,Jr=Phaser.Math.Distance.Between,qr=function(t){r(o,t);var i=l(o);function o(t,n){var r;e(this,o);var s=a(r=i.call(this,t,n)),h={states:{IDLE:{enter:function(){s.stop(),s.tapsCount=0,s.x=0,s.y=0,s.worldX=0,s.worldY=0;},exit:function(){var t=s.lastPointer;s.x=t.x,s.y=t.y,s.worldX=t.worldX,s.worldY=t.worldY;}},BEGIN:{enter:function(){s.start(),s.tapsCount=0,s.emit("tappingstart",s,s.gameObject,s.lastPointer);}},RECOGNIZED:{enter:function(){s.start(),s.emit("tap",s,s.gameObject,s.lastPointer),s.emit("".concat(s.tapsCount,"tap"),s,s.gameObject,s.lastPointer);}}},init:function(){this.state=Kr;},eventEmitter:!1};return r.setRecongizedStateObject(new _n(h)),r}return n(o,[{key:"resetFromJSON",value:function(t){c(s(o.prototype),"resetFromJSON",this).call(this,t),this.setHoldTime(Vr(t,"time",250)),this.setTapInterval(Vr(t,"tapInterval",200)),this.setDragThreshold(Vr(t,"threshold",9)),this.setTapOffset(Vr(t,"tapOffset",10));var e=Vr(t,"taps",void 0);return void 0!==e?this.setTaps(e):(this.setMaxTaps(Vr(t,"maxTaps",void 0)),this.setMinTaps(Vr(t,"minTaps",void 0))),this}},{key:"onDragStart",value:function(){switch(this.state){case Kr:this.state=Zr;break;case Zr:var t=this.lastPointer;Jr(t.upX,t.upY,t.x,t.y)>this.tapOffset&&(this.state=$r,this.state=Zr);break;case $r:this.state=Zr;}}},{key:"onDragEnd",value:function(){this.state===Zr&&(this.tapsCount++,this.emit("tapping",this,this.gameObject,this.lastPointer),void 0!==this.maxTaps&&this.tapsCount===this.maxTaps&&(this.state=$r));}},{key:"onDrag",value:function(){this.state!==Kr&&this.pointer.getDistance()>this.dragThreshold&&(this.state=Kr);}},{key:"preUpdate",value:function(t,e){if(this.isRunning&&this.enable&&this.state===Zr){var i=this.lastPointer;if(i.isDown)t-i.downTime>this.holdTime&&(this.state=Kr);else t-i.upTime>this.tapInterval&&(void 0===this.minTaps||this.tapsCount>=this.minTaps?this.state=$r:this.state=Kr);}}},{key:"postUpdate",value:function(t,e){this.isRunning&&this.enable&&this.state===$r&&(this.state=Kr);}},{key:"isTapped",get:function(){return this.state===$r}},{key:"setHoldTime",value:function(t){return this.holdTime=t,this}},{key:"setTapInterval",value:function(t){return this.tapInterval=t,this}},{key:"setDragThreshold",value:function(t){return this.dragThreshold=t,this}},{key:"setTapOffset",value:function(t){return this.tapOffset=t,this}},{key:"setMaxTaps",value:function(t){return this.maxTaps=t,this}},{key:"setMinTaps",value:function(t){return this.minTaps=t,this}},{key:"setTaps",value:function(t,e){return void 0===e&&(e=t),this.setMinTaps(t).setMaxTaps(e),this}}]),o}(Hr),Kr="IDLE",Zr="BEGIN",$r="RECOGNIZED",Qr=Phaser.Utils.Objects.GetValue,ts=function(t){r(o,t);var i=l(o);function o(t,n){var r;e(this,o);var s=a(r=i.call(this,t,n)),h={states:{IDLE:{enter:function(){s.x=0,s.y=0,s.worldX=0,s.worldY=0;},exit:function(){var t=s.lastPointer;s.x=t.x,s.y=t.y,s.worldX=t.worldX,s.worldY=t.worldY;}},BEGIN:{enter:function(){s.start();},exit:function(){s.stop();}},RECOGNIZED:{enter:function(){s.emit("pressstart",s,s.gameObject,s.lastPointer);},exit:function(){s.emit("pressend",s,s.gameObject,s.lastPointer);}}},init:function(){this.state=es;},eventEmitter:!1};return r.setRecongizedStateObject(new _n(h)),r}return n(o,[{key:"resetFromJSON",value:function(t){return c(s(o.prototype),"resetFromJSON",this).call(this,t),this.setDragThreshold(Qr(t,"threshold",9)),this.setHoldTime(Qr(t,"time",251)),this}},{key:"onDragStart",value:function(){this.state=is,0===this.holdTime&&(this.state=ns);}},{key:"onDragEnd",value:function(){this.state=es;}},{key:"onDrag",value:function(){this.state!==es&&this.pointer.getDistance()>this.dragThreshold&&(this.state=es);}},{key:"preUpdate",value:function(t,e){this.isRunning&&this.enable&&(this.state===is&&t-this.pointer.downTime>=this.holdTime&&(this.state=ns));}},{key:"isPressed",get:function(){return this.state===ns}},{key:"setHoldTime",value:function(t){return this.holdTime=t,this}},{key:"setDragThreshold",value:function(t){return this.dragThreshold=t,this}}]),o}(Hr),es="IDLE",is="BEGIN",ns="RECOGNIZED";Phaser.Utils.Objects.GetValue;var rs=Phaser.Math.Distance.Between,ss=Phaser.Math.Angle.Between,os={getDt:function(){var t;return t=this.scene,ei(t).loop.delta},getVelocity:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return rs(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 ss(e.x,e.y,t.x,t.y)}},as={"up&down":0,"left&right":1,"4dir":2,"8dir":3},hs={},ls=Phaser.Utils.Objects.GetValue,us=Phaser.Math.RadToDeg,cs=function(t){r(o,t);var i=l(o);function o(t,n){var r;e(this,o);var s=a(r=i.call(this,t,n)),h={states:{IDLE:{enter:function(){s.x=0,s.y=0,s.worldX=0,s.worldY=0;},exit:function(){var t=s.lastPointer;s.x=t.x,s.y=t.y,s.worldX=t.worldX,s.worldY=t.worldY;}},BEGIN:{enter:function(){s.validDrag=!1;}},RECOGNIZED:{enter:function(){s.start(),s.updateDirectionStates(),s.emit("swipe",s,s.gameObject,s.lastPointer);},exit:function(){s.stop(),s.clearDirectionStates();}}},init:function(){this.state=ds;},eventEmitter:!1};return r.setRecongizedStateObject(new _n(h)),r.clearDirectionStates(),r}return n(o,[{key:"resetFromJSON",value:function(t){return c(s(o.prototype),"resetFromJSON",this).call(this,t),this.setDragThreshold(ls(t,"threshold",10)),this.setVelocityThreshold(ls(t,"velocityThreshold",1e3)),this.setDirectionMode(ls(t,"dir","8dir")),this}},{key:"onDragStart",value:function(){this.state=fs;}},{key:"onDragEnd",value:function(){this.state=ds;}},{key:"onDrag",value:function(){this.state===fs&&(this.validDrag||(this.validDrag=0===this.dragThreshold||this.pointer.getDistance()>=this.dragThreshold),this.validDrag&&this.dragVelocity>this.velocityThreshold&&(this.state=vs));}},{key:"postUpdate",value:function(t,e){this.isRunning&&this.enable&&this.state===vs&&(this.state=ds);}},{key:"isSwiped",get:function(){return this.state===vs}},{key:"dragVelocity",get:function(){var t;switch(this.dirMode){case 0:t=this.getVelocityY();break;case 1:t=this.getVelocityX();break;default:t=this.getVelocity();}return t}},{key:"setDragThreshold",value:function(t){return this.dragThreshold=t,this}},{key:"setVelocityThreshold",value:function(t){return this.velocityThreshold=t,this}},{key:"setDirectionMode",value:function(t){return "string"==typeof t&&(t=as[t]),this.dirMode=t,this}},{key:"updateDirectionStates",value:function(){return function(t,e,i){switch(void 0===i?i={}:!0===i&&(i=hs),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;}}(us(this.getVelocityAngle()),this.dirMode,this),this}},{key:"clearDirectionStates",value:function(){return this.left=!1,this.right=!1,this.up=!1,this.down=!1,this}}]),o}(Hr);Object.assign(cs.prototype,os);var ds="IDLE",fs="BEGIN",vs="RECOGNIZED",ps=Phaser.Utils.Objects.GetValue,gs=Phaser.Utils.Array.SpliceOne,ys=Phaser.Math.Distance.Between,ks=Phaser.Math.Angle.Between,ms=function(){function t(i,n){e(this,t);var r=i.input.manager.pointersTotal-1;r<2&&i.input.addPointer(2-r),this.scene=i,this.setEventEmitter(ps(n,"eventEmitter",void 0)),this._enable=void 0,this.pointers=[],this.movedState={},this.resetFromJSON(n),this.boot();}return n(t,[{key:"resetFromJSON",value:function(t){return this.setEnable(ps(t,"enable",!0)),this.bounds=ps(t,"bounds",void 0),this.tracerState=bs,this.pointers.length=0,Rt(this.movedState),this}},{key:"boot",value:function(){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);}},{key:"shutdown",value:function(){this.scene&&(this.destroyEventEmitter(),this.pointers.length=0,Rt(this.movedState),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);}},{key:"destroy",value:function(){this.shutdown();}},{key:"enable",get:function(){return this._enable},set:function(t){if(this._enable!==t)return t||this.dragCancel(),this._enable=t,this}},{key:"setEnable",value:function(t){return void 0===t&&(t=!0),this.enable=t,this}},{key:"toggleEnable",value:function(){return this.setEnable(!this.enable),this}},{key:"onPointerDown",value:function(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.tracerState){case bs:this.tracerState=ws,this.onDrag1Start();break;case ws:this.tracerState=Cs,this.onDrag2Start();}}},{key:"onPointerUp",value:function(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],gs(this.pointers,e),this.tracerState){case ws:this.tracerState=bs,this.onDrag1End();break;case Cs:this.tracerState=ws,this.onDrag2End(),this.onDrag1Start();}}}},{key:"onPointerMove",value:function(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 ws:this.onDrag1();break;case Cs:this.onDrag2();}}}},{key:"dragCancel",value:function(){return this.tracerState===Cs&&this.onDrag2End(),this.pointers.length=0,Rt(this.movedState),this.tracerState=bs,this}},{key:"onDrag1Start",value:function(){this.emit("drag1start",this);}},{key:"onDrag1End",value:function(){this.emit("drag1end",this);}},{key:"onDrag1",value:function(){this.emit("drag1",this);}},{key:"onDrag2Start",value:function(){this.emit("drag2start",this);}},{key:"onDrag2End",value:function(){this.emit("drag2end",this);}},{key:"onDrag2",value:function(){this.emit("drag2",this);}},{key:"distanceBetween",get:function(){if(this.tracerState!==Cs)return 0;var t=this.pointers[0],e=this.pointers[1];return ys(t.x,t.y,e.x,e.y)}},{key:"angleBetween",get:function(){if(this.tracerState!==Cs)return 0;var t=this.pointers[0],e=this.pointers[1];return ks(t.x,t.y,e.x,e.y)}},{key:"drag1Vector",get:function(){var t=this.pointers[0];if(t&&this.movedState[t.id]){var e=t.position,i=t.prevPosition;xs.x=e.x-i.x,xs.y=e.y-i.y;}else xs.x=0,xs.y=0;return xs}},{key:"centerX",get:function(){if(this.tracerState!==Cs)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return (t.x+e.x)/2}},{key:"centerY",get:function(){if(this.tracerState!==Cs)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return (t.y+e.y)/2}},{key:"prevCenterX",get:function(){if(this.tracerState!==Cs)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}},{key:"prevCenterY",get:function(){if(this.tracerState!==Cs)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}},{key:"movementCenterX",get:function(){return this.centerX-this.prevCenterX}},{key:"movementCenterY",get:function(){return this.centerY-this.prevCenterY}},{key:"setRecongizedStateObject",value:function(t){return this.recongizedState=t,this}},{key:"state",get:function(){return this.recongizedState.state},set:function(t){this.recongizedState.state=t;}},{key:"cancel",value:function(){return this.state=Ss,this}}]),t}();Object.assign(ms.prototype,qe);var xs={},bs=0,ws=1,Cs=2,Ss="IDLE";Phaser.Utils.Objects.GetValue;var Ps=Phaser.Math.RotateAround,Os=function(t,e,i,n){return Ps(t,e,i,n),t.rotation+=n,t},Ts={},_s=Phaser.Utils.Objects.GetValue,Es=Phaser.Math.Angle.WrapDegrees,Rs=Phaser.Math.Angle.ShortestBetween,Ms=Phaser.Math.RadToDeg,Ls=Phaser.Math.DegToRad,Ds=function(t){r(o,t);var i=l(o);function o(t,n){var r;e(this,o);var s=a(r=i.call(this,t,n)),h={states:{IDLE:{enter:function(){s.prevAngle=void 0,s.angle=0;}},BEGIN:{},RECOGNIZED:{enter:function(){s.emit("rotatestart",s);},exit:function(){s.emit("rotateend",s);}}},init:function(){this.state=zs;},eventEmitter:!1};return r.setRecongizedStateObject(new _n(h)),r}return n(o,[{key:"resetFromJSON",value:function(t){return c(s(o.prototype),"resetFromJSON",this).call(this,t),this.setDragThreshold(_s(t,"threshold",0)),this}},{key:"onDrag2Start",value:function(){this.prevAngle=Es(Ms(this.angleBetween)),this.state=js,0===this.dragThreshold&&(this.state=Fs);}},{key:"onDrag2End",value:function(){this.state=zs;}},{key:"onDrag2",value:function(){switch(this.state){case js:if(this.pointers[0].getDistance()>=this.dragThreshold&&this.pointers[1].getDistance()>=this.dragThreshold){var t=Es(Ms(this.angleBetween));this.angle=Rs(this.prevAngle,t),this.prevAngle=t,this.state=Fs;}break;case Fs:t=Es(Ms(this.angleBetween));this.angle=Rs(this.prevAngle,t),this.prevAngle=t,this.emit("rotate",this);}}},{key:"isRotated",get:function(){return this.state===Fs}},{key:"rotation",get:function(){return Ls(this.angle)}},{key:"setDragThreshold",value:function(t){return this.dragThreshold=t,this}}]),o}(ms),As={spinObject:function(t,e){if(!this.isRotation)return this;void 0===e&&(e=this.pointers[0].camera);var i=this.movementCenterX,n=this.movementCenterY,r=function(t,e,i,n){return void 0===n?n={}:!0===n&&(n=Ts),i.getWorldPoint(t,e,n),n}(this.centerX,this.centerY,e,!0),s=r.x,o=r.y,a=this.rotation;if(Array.isArray(t))for(var h=t,l=0,u=h.length;l=this.sizerChildren.length?this.sizerChildren.push(e):this.sizerChildren.splice(a,0,e),e.isRexSizer||(i>0&&(0===this.orientation?e.minWidth=void 0===h?pt(e):h:e.minHeight=void 0===l?gt(e):l),s&&(0===this.orientation?e.minHeight=l:e.minWidth=h)),void 0!==o&&this.addChildrenMap(o,e),this},ro={add:no,addSpace:function(t){return this.insertSpace(void 0,t),this},insertSpace:function(t,e){return void 0===e&&(e=1),no.call(this,new Zs(this.scene),{proportion:e,minWidth:0,minHeight:0,index:t}),this},insert:function(t,e,i,n,r,s,o,a){return Qs(i)&&(i.index=t),no.call(this,e,i,n,r,s,o,t,a),this},insertAtPosition:function(t,e,i,n,r,s,o,a,h){var l=$s.call(this,t,e);return -1===l&&(l=void 0),this.insert(l,i,n,r,s,o,a,h),this}},so=Nt.prototype.clear,oo=function(t){this.backgroundChildren&&(this.backgroundChildren.length=0);var e,i=!t&&this.sizerEventsEnable;if(i&&(e=this.getChildren([])),so.call(this,t),i)for(var n,r=0,s=e.length;r=0;e--)this.remove(this.sizerChildren[e],t);return this},clear:function(t){return this.sizerChildren.length=0,oo.call(this,t),this}},lo={getChildAlign:function(t){return this.getSizerConfig(t).align},setChildAlign:function(t,e){return "string"==typeof e&&(e=$t[e]),this.getSizerConfig(t).align=e,this}},uo={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,n,r=0,s=this.sizerChildren;if(0===this.orientation)for(var o=this.space.item,a=!0,h=0,l=s.length;h0&&this.proportionLength>0&&(i=n.proportion*this.proportionLength):n.expand&&(i=e-this.space.left-this.space.right-r.left-r.right);return i},getExpandedChildHeight:function(t,e){var i;void 0===e&&(e=this.height);var n=t.rexSizer,r=n.padding;0===this.orientation?n.expand&&(i=e-this.space.top-this.space.bottom-r.top-r.bottom):n.proportion>0&&this.proportionLength>0&&(i=n.proportion*this.proportionLength);return i},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,n=0,r=i.length;n0?(e=t-this.getChildrenWidth(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0;}return t},resolveHeight:function(t){t=Ue.call(this,t);if(void 0===this.proportionLength&&1===this.orientation){var e=t-this.childrenHeight;e>0?(e=t-this.getChildrenHeight(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0;}return t}};Object.assign(uo,ro,ho,lo,{getChildProportion:function(t){return this.getSizerConfig(t).proportion},setChildProportion:function(t,e){return this.getSizerConfig(t).proportion=e,this}},{getChildExpand:function(t){return this.getSizerConfig(t).expand},setChildExpand:function(t,e){return this.getSizerConfig(t).expand=e,this}});var co=function(){for(var t,e,i=0,n=this.sizerChildren,r=0,s=n.length;r0&&(i+=e);return i},fo={x:0,h:0,horizontal:0,"left-to-right":0,y:1,v:1,vertical:1,"top-to-bottom":1},vo=function(t){return "string"==typeof t&&(t=fo[t]),t},po=Phaser.Utils.Objects.IsPlainObject,go=Phaser.Utils.Objects.GetValue,yo=function(t){r(s,t);var i=l(s);function s(t,n,r,o,a,h,l){var u;return e(this,s),po(n)?(n=go(l=n,"x",0),r=go(l,"y",0),o=go(l,"width",void 0),a=go(l,"height",void 0),h=go(l,"orientation",0)):po(o)?(o=go(l=o,"width",void 0),a=go(l,"height",void 0),h=go(l,"orientation",0)):po(h)&&(h=go(l=h,"orientation",0)),void 0===h&&(h=0),(u=i.call(this,t,n,r,o,a,l)).type="rexSizer",u.sizerChildren=[],u.setOrientation(h),u.setItemSpacing(go(l,"space.item",0)),u.setStartChildIndex(go(l,"startChildIndex",0)),u.setRTL(go(l,"rtl",!1)),u.addChildrenMap("items",u.sizerChildren),u}return n(s,[{key:"setOrientation",value:function(t){return this.orientation=vo(t),this}},{key:"setItemSpacing",value:function(t){return this.space.item=t,this}},{key:"setStartChildIndex",value:function(t){return this.startChildIndex=t,this}},{key:"setRTL",value:function(t){return void 0===t&&(t=!0),this.rtl=t,this}},{key:"childrenProportion",get:function(){return void 0===this._childrenProportion&&(this._childrenProportion=co.call(this)),this._childrenProportion}}]),s}(Js);Object.assign(yo.prototype,uo);var ko=Phaser.Utils.Objects.GetValue,mo=function(){function t(i,n,r,s,o){e(this,t),void 0===i&&(i=0),void 0===n&&(n=i),void 0===r&&(r=0),void 0===s&&(s=0),void 0===o&&(o=0),this.cornerRadius={},this._width=0,this._height=0,this.setTo(i,n,r,s,o);}return n(t,[{key:"setTo",value:function(t,e,i,n,r){return this.setPosition(t,e),this.setRadius(r),this.setSize(i,n),this}},{key:"setPosition",value:function(t,e){return this.x=t,this.y=e,this}},{key:"setRadius",value:function(t){return void 0===t&&(t=0),this.radius=t,this}},{key:"setSize",value:function(t,e){return this.width=t,this.height=e,this}},{key:"minWidth",get:function(){var t=this.cornerRadius;return Math.max(t.tl.x+t.tr.x,t.bl.x+t.br.x)}},{key:"minHeight",get:function(){var t=this.cornerRadius;return Math.max(t.tl.y+t.bl.y,t.tr.y+t.br.y)}},{key:"width",get:function(){return this._width},set:function(t){null==t&&(t=0),this._width=Math.max(t,this.minWidth);}},{key:"height",get:function(){return this._height},set:function(t){null==t&&(t=0),this._height=Math.max(t,this.minHeight);}},{key:"radius",get:function(){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:function(t){var e,i;"number"==typeof t?(e=t,i=t):(e=ko(t,"x",0),i=ko(t,"y",0));var n=this.cornerRadius;n.tl=xo(ko(t,"tl",void 0),e,i),n.tr=xo(ko(t,"tr",void 0),e,i),n.bl=xo(ko(t,"bl",void 0),e,i),n.br=xo(ko(t,"br",void 0),e,i);}},{key:"radiusTL",get:function(){var t=this.cornerRadius.tl;return Math.max(t.x,t.y)},set:function(t){bo(this.cornerRadius.tl,t);}},{key:"radiusTR",get:function(){var t=this.cornerRadius.tr;return Math.max(t.x,t.y)},set:function(t){bo(this.cornerRadius.tr,t);}},{key:"radiusBL",get:function(){var t=this.cornerRadius.bl;return Math.max(t.x,t.y)},set:function(t){bo(this.cornerRadius.bl,t);}},{key:"radiusBR",get:function(){var t=this.cornerRadius.br;return Math.max(t.x,t.y)},set:function(t){bo(this.cornerRadius.br,t);}}]),t}(),xo=function(t,e,i){return void 0===t?t={x:e,y:i}:"number"==typeof t&&(t={x:t,y:t}),wo(t),t},bo=function(t,e){"number"==typeof e?(t.x=e,t.y=e):(t.x=ko(e,"x",0),t.y=ko(e,"y",0)),wo(t);},wo=function(t){t.convex=t.x>=0||t.y>=0,t.x=Math.abs(t.x),t.y=Math.abs(t.y);},Co=function(t,e,i){var n=i.length;if(n>=2){var r=i[n-2],s=i[n-1];if(t===r&&e===s)return i}return i.push(t,e),i},So=Phaser.Math.DegToRad,Po=function(t,e,i,n,r,s,o,a,h){o&&s>r?s-=360:!o&&s>>16,a=(65280&r)>>>8,h=255&r;t.fillStyle="rgba("+o+","+a+","+h+","+s+")";}(r,e),r.fill()),e.isStroked&&(!function(t,e,i,n){var r=i||e.strokeColor,s=n||e.strokeAlpha,o=(16711680&r)>>>16,a=(65280&r)>>>8,h=255&r;t.strokeStyle="rgba("+o+","+a+","+h+","+s+")",t.lineWidth=e.lineWidth;}(r,e),r.stroke()),r.restore();}}},Mo=Phaser.GameObjects.Shape,Lo=Phaser.Utils.Objects.IsPlainObject,Do=Phaser.Utils.Objects.GetValue,Ao=Phaser.Geom.Polygon.Earcut,zo=function(t){r(s,t);var i=l(s);function s(t,n,r,o,a,h,l,u){var c,d,f,v,p;if(e(this,s),Lo(n)){var g=n;n=g.x,r=g.y,o=g.width,a=g.height,h=g.radius,l=g.color,u=g.alpha,d=g.strokeColor,f=g.strokeAlpha,v=g.strokeWidth,p=g.shape;}void 0===n&&(n=0),void 0===r&&(r=0),void 0===o&&(o=1),void 0===a&&(a=o),void 0===h&&(h=0),void 0===p&&(p=0);var y=new mo;if((c=i.call(this,t,"rexRoundRectangleShape",y)).setShapeType(p),0===c.shapeType){var k=Do(h,"radius",h);y.setTo(0,0,o,a,k);}else {k={x:o/2,y:a/2};y.setTo(0,0,o,a,k);}var m=Do(h,"iteration",void 0);return c.setIteration(m),c.setPosition(n,r),c.setFillStyle(l,u),void 0!==d&&void 0===v&&(v=2),c.setStrokeStyle(v,d,f),c.updateDisplayOrigin(),c.dirty=!0,c}return n(s,[{key:"fillColor",get:function(){return this._fillColor},set:function(t){this._fillColor=t,this.isFilled=null!=t&&this._fillAlpha>0;}},{key:"fillAlpha",get:function(){return this._fillAlpha},set:function(t){this._fillAlpha=t,this.isFilled=t>0&&null!=this._fillColor;}},{key:"setFillStyle",value:function(t,e){return void 0===e&&(e=1),this.fillColor=t,this.fillAlpha=e,this}},{key:"strokeColor",get:function(){return this._strokeColor},set:function(t){this._strokeColor=t,this.isStroked=null!=t&&this._strokeAlpha>0&&this._lineWidth>0;}},{key:"strokeAlpha",get:function(){return this._strokeAlpha},set:function(t){this._strokeAlpha=t,this.isStroked=t>0&&null!=this._strokeColor&&this._lineWidth>0;}},{key:"lineWidth",get:function(){return this._lineWidth},set:function(t){this._lineWidth=t,this.isStroked=t>0&&null!=this._strokeColor;}},{key:"setStrokeStyle",value:function(t,e,i){return void 0===i&&(i=1),this.lineWidth=t,this.strokeColor=e,this.strokeAlpha=i,this}},{key:"updateData",value:function(){var t=this.geom,e=this.pathData;e.length=0;var i,n=t.width,r=t.height,s=t.cornerRadius,o=this.iteration+1;if(i=s.tl,jo(i))if(i.convex){var a=i.x,h=i.y;Po(a,h,i.x,i.y,180,270,!1,o,e);}else {Po(a=0,h=0,i.x,i.y,90,0,!0,o,e);}else Co(0,0,e);if(i=s.tr,jo(i))if(i.convex){a=n-i.x,h=i.y;Po(a,h,i.x,i.y,270,360,!1,o,e);}else {Po(a=n,h=0,i.x,i.y,180,90,!0,o,e);}else Co(n,0,e);if(i=s.br,jo(i))if(i.convex){a=n-i.x,h=r-i.y;Po(a,h,i.x,i.y,0,90,!1,o,e);}else {Po(a=n,h=r,i.x,i.y,270,180,!0,o,e);}else Co(n,r,e);if(i=s.bl,jo(i))if(i.convex){a=i.x,h=r-i.y;Po(a,h,i.x,i.y,90,180,!1,o,e);}else {Po(a=0,h=r,i.x,i.y,360,270,!0,o,e);}else Co(0,r,e);return e.push(e[0],e[1]),this.pathIndexes=Ao(e),this}},{key:"setShapeType",value:function(t){return "string"==typeof t&&(t=Fo[t]),this.shapeType=t,this}},{key:"width",get:function(){return this.geom.width},set:function(t){this.resize(t,this.height);}},{key:"height",get:function(){return this.geom.height},set:function(t){this.resize(this.width,t);}},{key:"setSize",value:function(t,e){if(void 0===e&&(e=t),this.geom.width===t&&this.geom.height===e)return this;this.geom.setSize(t,e),1===this.shapeType&&this.setRadius({x:t/2,y:e/2}),this.updateDisplayOrigin(),this.dirty=!0;var i=this.input;return i&&!i.customHitArea&&(i.hitArea.width=t,i.hitArea.height=e),this}},{key:"resize",value:function(t,e){return this.setSize(t,e),this}},{key:"radius",get:function(){return this.geom.radius},set:function(t){this.geom.setRadius(t),this.updateDisplayOrigin(),this.dirty=!0;}},{key:"radiusTL",get:function(){return this.geom.radiusTL},set:function(t){this.geom.radiusTL=t,this.dirty=!0;}},{key:"radiusTR",get:function(){return this.geom.radiusTR},set:function(t){this.geom.radiusTR=t,this.dirty=!0;}},{key:"radiusBL",get:function(){return this.geom.radiusBL},set:function(t){this.geom.radiusBL=t,this.dirty=!0;}},{key:"radiusBR",get:function(){return this.geom.radiusBR},set:function(t){this.geom.radiusBR=t,this.dirty=!0;}},{key:"setRadius",value:function(t){return void 0===t&&(t=0),this.radius=t,this}},{key:"setRadiusTL",value:function(t){return void 0===t&&(t=0),this.radiusTL=t,this}},{key:"setRadiusTR",value:function(t){return void 0===t&&(t=0),this.radiusTR=t,this}},{key:"setRadiusBL",value:function(t){return void 0===t&&(t=0),this.radiusBL=t,this}},{key:"setRadiusBR",value:function(t){return void 0===t&&(t=0),this.radiusBR=t,this}},{key:"cornerRadius",get:function(){return this.geom.cornerRadius},set:function(t){this.radius=t;}},{key:"setCornerRadius",value:function(t){return this.setRadius(t)}},{key:"iteration",get:function(){return this._iteration},set:function(t){void 0!==this._iteration?this._iteration!==t&&(this._iteration=t,this.dirty=!0):this._iteration=t;}},{key:"setIteration",value:function(t){return void 0===t&&(t=6),this.iteration=t,this}}]),s}(Mo),jo=function(t){return t.x>0&&t.y>0},Fo={rectangle:0,circle:1};Object.assign(zo.prototype,Ro);var Wo=Phaser.Renderer.WebGL.Utils,Io={renderWebGL:function(t,e,i,n){if(e.dirty&&(e.updateTexture(),e.dirty=!1),0!==e.width&&0!==e.height){i.addToRenderList(e);var r=e.frame,s=r.width,o=r.height,a=Wo.getTintAppendFloatAlpha,h=t.pipelines.set(e.pipeline,e),l=h.setTexture2D(r.glTexture,e);t.pipelines.preBatch(e),h.batchTexture(e,r.glTexture,s,o,e.x,e.y,s/e.resolution,o/e.resolution,e.scaleX,e.scaleY,e.rotation,e.flipX,e.flipY,e.scrollFactorX,e.scrollFactorY,e.displayOriginX,e.displayOriginY,0,0,s,o,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,n,!1,l),t.pipelines.postBatch(e);}},renderCanvas:function(t,e,i,n){e.dirty&&(e.updateTexture(),e.dirty=!1),0!==e.width&&0!==e.height&&(i.addToRenderList(e),t.batchSprite(e,e.frame,i,n));}},Bo=Phaser.Display.Color,Xo={clear:function(){return this.context.clearRect(0,0,this.canvas.width,this.canvas.height),this.dirty=!0,this},fill:function(t){return this.context.fillStyle=t,this.context.fillRect(0,0,this.canvas.width,this.canvas.height),this.dirty=!0,this},drawFrame:function(t,e,i,n,r,s,o,a,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===n&&(n=0),void 0===r&&(r=c),void 0===s&&(s=d),void 0===o&&(o=0),void 0===a&&(a=0),void 0===h&&(h=c),void 0===l&&(l=d);var f=u.cutX+o,v=u.cutY+a;return this.context.drawImage(u.source.image,f,v,h,l,i,n,r,s),this.dirty=!0,this},getDataURL:function(t,e){return this.canvas.toDataURL(t,e)},getPixel:function(t,e,i){void 0===i&&(i=new Bo);var n=this.context.getImageData(t,e,1,1);return i.setTo(n.data[0],n.data[1],n.data[2],n.data[3]),i},setPixel:function(t,e,i,n,r,s){if("number"!=typeof i){var o=i;i=o.red,n=o.green,r=o.blue,s=o.alpha;}void 0===s&&(s=0!==i||0!==n||0!==r?255:0);var a=this.context.createImageData(1,1);return a.data[0]=i,a.data[1]=n,a.data[2]=r,a.data[3]=s,this.context.putImageData(a,t,e),this.dirty=!0,this}},Yo=function(t,e,i,n,r,s,o){var a,h=t.sys.textures,l=t.renderer;void 0===n&&(n=0),void 0===r&&(r=0),void 0===s&&(s=e.width),void 0===o&&(o=e.height);var u=(a=h.exists(i)?h.get(i):h.createCanvas(i,s,o)).getSourceImage();u.width!==s&&(u.width=s),u.height!==o&&(u.height=o);var c=u.getContext("2d",{willReadFrequently:!0});c.clearRect(0,0,s,o),c.drawImage(e,n,r,s,o),l.gl&&a&&l.canvasToTexture(u,a.source[0].glTexture,!0,0);},Ho={updateTexture:function(t,e){t&&(e?t.call(e,this.canvas,this.context):t(this.canvas,this.context)),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=this.frame.source.glTexture),this.dirty=!1;var i=this.input;return i&&!i.customHitArea&&(i.hitArea.width=this.width,i.hitArea.height=this.height),this},generateTexture:function(t,e,i,n,r){var s=this.canvas;return void 0===n?n=s.width:n*=this.resolution,void 0===r?r=s.height:r*=this.resolution,Yo(this.scene,s,t,e,i,n,r),this},loadTexture:function(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}};k();var Go=Phaser.Display.Canvas.CanvasPool,No=function(t){r(s,t);var i=l(s);function s(t,n,r,o,h){var l;return e(this,s),void 0===n&&(n=0),void 0===r&&(r=0),void 0===o&&(o=1),void 0===h&&(h=1),(l=i.call(this,t,"rexCanvas")).renderer=t.sys.game.renderer,l.resolution=1,l._width=o,l._height=h,o=Math.max(Math.ceil(o*l.resolution),1),h=Math.max(Math.ceil(h*l.resolution),1),l.canvas=Go.create(a(l),o,h),l.context=l.canvas.getContext("2d",{willReadFrequently:!0}),l.dirty=!1,l.setPosition(n,r),l.setOrigin(.5,.5),l.initPipeline(),l.initPostPipeline(!0),l._crop=l.resetCropObject(),l.texture=t.sys.textures.addCanvas(null,l.canvas,!0),l.frame=l.texture.get(),l.frame.source.resolution=l.resolution,l.renderer&&l.renderer.gl&&(l.renderer.deleteTexture(l.frame.source.glTexture),l.frame.source.glTexture=null),l.dirty=!0,l}return n(s,[{key:"preDestroy",value:function(){Go.remove(this.canvas),this.texture.destroy(),this.canvas=null,this.context=null;}},{key:"width",get:function(){return this._width},set:function(t){this.setSize(t,this._height);}},{key:"height",get:function(){return this._height},set:function(t){this.setSize(this._width,t);}},{key:"setCanvasSize",value:function(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}},{key:"setSize",value:function(t,e){return this.setCanvasSize(t,e),this}},{key:"displayWidth",get:function(){return this.scaleX*this._width},set:function(t){this.scaleX=t/this._width;}},{key:"displayHeight",get:function(){return this.scaleY*this._height},set:function(t){this.scaleY=t/this._height;}},{key:"setDisplaySize",value:function(t,e){return this.displayWidth=t,this.displayHeight=e,this}},{key:"getCanvas",value:function(t){return t||(this.dirty=!0),this.canvas}},{key:"getContext",value:function(t){return t||(this.dirty=!0),this.context}},{key:"needRedraw",value:function(){return this.dirty=!0,this}},{key:"resize",value:function(t,e){return this.setSize(t,e),this}}]),s}(Phaser.GameObjects.GameObject),Uo=Phaser.GameObjects.Components;Phaser.Class.mixin(No,[Uo.Alpha,Uo.BlendMode,Uo.Crop,Uo.Depth,Uo.Flip,Uo.GetBounds,Uo.Mask,Uo.Origin,Uo.Pipeline,Uo.PostPipeline,Uo.ScrollFactor,Uo.Tint,Uo.Transform,Uo.Visible,Io,Xo,Ho]);var Vo={enableData:function(){return void 0===this.data&&(this.data={}),this},setData:function(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:function(t,e){return this.enableData(),void 0===t?this.data:Cn(this.data,t,e)},incData:function(t,e,i){return void 0===i&&(i=0),this.enableData(),this.setData(t,this.getData(t,i)+e),this},mulData:function(t,e,i){return void 0===i&&(i=0),this.enableData(),this.setData(t,this.getData(t,i)*e),this},clearData:function(){return this.data&&Rt(this.data),this}},Jo=function(){function t(i,n){e(this,t),this.setParent(i),this.type=n,this.renderable=!1,this.reset().setActive();}return n(t,[{key:"destroy",value:function(){this.parent.removeChild(this);}},{key:"setParent",value:function(t){return this.parent=t,this}},{key:"scene",get:function(){return this.parent.scene}},{key:"canvas",get:function(){return this.parent?this.parent.canvas:null}},{key:"context",get:function(){return this.parent?this.parent.context:null}},{key:"setDirty",value:function(t){return t&&this.parent&&(this.parent.dirty=!0),this}},{key:"active",get:function(){return this._active},set:function(t){this.setDirty(this._active!=t),this._active=t;}},{key:"setActive",value:function(t){return void 0===t&&(t=!0),this.active=t,this}},{key:"modifyPorperties",value:function(t){return this}},{key:"onFree",value:function(){this.reset().setParent();}},{key:"reset",value:function(){return this}},{key:"render",value:function(){}},{key:"contains",value:function(t,e){return !1}}]),t}();Object.assign(Jo.prototype,Vo);var qo,Ko,Zo,$o,Qo,ta={renderContent:function(){},render:function(){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}},ea=Phaser.Math.RotateAround,ia=Phaser.Geom.Rectangle,na=function(t){void 0===Ko&&(Ko=new ia);var e=t.drawTLX,i=t.drawTLY;return Ko.setTo(e,i,t.drawTRX-e,t.drawBLY-i),Ko},ra=Phaser.Math.RotateAround,sa=function(t,e,i,n){return void 0===n?n={}:!0===n&&(void 0===Zo&&(Zo={}),n=Zo),n.x=e,n.y=i,0!==t.rotation&&ra(n,0,0,t.rotation),n.x=n.x*t.scaleX+t.drawX,n.y=n.y*t.scaleY+t.drawY,n},oa=Phaser.GameObjects.Components.TransformMatrix,aa={},ha=function(t,e,i,n,r){var s=sa(e,i,n,!0),o=function(t,e,i,n){void 0===n?n={}:!0===n&&(n=aa);var r=e-t.width*t.originX,s=i-t.height*t.originY;return void 0===$o&&($o=new oa,Qo=new oa),t.parentContainer?t.getWorldTransformMatrix($o,Qo):$o.applyITRS(t.x,t.y,t.rotation,t.scaleX,t.scaleY),$o.transformPoint(r,s,n),n}(t,s.x,s.y,r);return o},la=function(t,e,i,n,r){"number"!=typeof i&&(r=i,i=0,n=0);var s=e.drawCenterX+i,o=e.drawCenterY+n;return ha(t,e,s,o,r)},ua={contains:function(t,e){if(0===this.width||0===this.height)return !1;var i=function(t,e,i,n){return void 0===n?n={}:!0===n&&(void 0===qo&&(qo={}),n=qo),n.x=(t-i.drawX)/i.scaleX,n.y=(e-i.drawY)/i.scaleY,0!==i.rotation&&ea(n,0,0,-i.rotation),n}(t,e,this,!0);return na(this).contains(i.x,i.y)},getWorldPosition:function(t,e,i){return la(this.parent,this,t,e,i)}};Object.assign(ua,ta);var ca=Phaser.Math.DegToRad,da=Phaser.Math.RadToDeg,fa=Phaser.Utils.Objects.GetValue,va=function(t){r(s,t);var i=l(s);function s(t,n){var r;return e(this,s),(r=i.call(this,t,n)).renderable=!0,r.scrollFactorX=1,r.scrollFactorY=1,r.toLocalPosition=!0,r.originX=0,r.offsetX=0,r.offsetY=0,r}return n(s,[{key:"visible",get:function(){return this._visible},set:function(t){this.setDirty(this._visible!=t),this._visible=t;}},{key:"setVisible",value:function(t){return void 0===t&&(t=!0),this.visible=t,this}},{key:"alpha",get:function(){return this._alpha},set:function(t){this.setDirty(this._alpha!=t),this._alpha=t;}},{key:"setAlpha",value:function(t){return this.alpha=t,this}},{key:"x",get:function(){return this._x},set:function(t){this.setDirty(this._x!=t),this._x=t;}},{key:"setX",value:function(t){return this.x=t,this}},{key:"y",get:function(){return this._y},set:function(t){this.setDirty(this._y!=t),this._y=t;}},{key:"setY",value:function(t){return this.y=t,this}},{key:"setPosition",value:function(t,e){return this.x=t,this.y=e,this}},{key:"setInitialPosition",value:function(t,e){return this.x0=t,this.y0=e,this}},{key:"setScrollFactorX",value:function(t){return this.scrollFactorX=t,this}},{key:"setScrollFactorY",value:function(t){return this.scrollFactorY=t,this}},{key:"setScrollFactor",value:function(t,e){return void 0===e&&(e=t),this.scrollFactorX=t,this.scrollFactorY=e,this}},{key:"rotation",get:function(){return this._rotation},set:function(t){this.setDirty(this._rotation!=t),this._rotation=t;}},{key:"setRotation",value:function(t){return this.rotation=t,this}},{key:"angle",get:function(){return da(this._rotation)},set:function(t){this.rotation=ca(t);}},{key:"setAngle",value:function(t){return this.angle=t,this}},{key:"scaleX",get:function(){return this._scaleX},set:function(t){this.setDirty(this._scaleX!==t),this._scaleX=t;}},{key:"setScaleX",value:function(t){return this.scaleX=t,this}},{key:"width",get:function(){return 0},set:function(t){}},{key:"setWidth",value:function(t,e){return void 0===e&&(e=!1),this.width=t,e&&(this.scaleY=this.scaleX),this}},{key:"leftSpace",get:function(){return this._leftSpace},set:function(t){this.setDirty(this._leftSpace!==t),this._leftSpace=t;}},{key:"setLeftSpace",value:function(t){return this.leftSpace=t,this}},{key:"rightSpace",get:function(){return this._rightSpace},set:function(t){this.setDirty(this._rightSpace!==t),this._rightSpace=t;}},{key:"setRightSpace",value:function(t){return this.rightSpace=t,this}},{key:"outerWidth",get:function(){return this.width+this.leftSpace+this.rightSpace}},{key:"scaleY",get:function(){return this._scaleY},set:function(t){this.setDirty(this._scaleY!==t),this._scaleY=t;}},{key:"setScaleY",value:function(t){return this.scaleY=t,this}},{key:"height",get:function(){return 0},set:function(t){}},{key:"setHeight",value:function(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}},{key:"setScale",value:function(t,e){return void 0===e&&(e=t),this.scaleX=t,this.scaleY=e,this}},{key:"setOrigin",value:function(t){return this.originX=t,this}},{key:"setAlign",value:function(t){return this.align=t,this}},{key:"modifyPorperties",value:function(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=fa(t,"width",void 0),i=fa(t,"height",void 0),n=fa(t,"scaleX",void 0),r=fa(t,"scaleY",void 0);return void 0!==e?void 0===i&&void 0===r?this.setWidth(e,!0):this.setWidth(e):void 0!==n&&this.setScaleX(n),void 0!==i?void 0===e&&void 0===n?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}},{key:"setDrawBelowCallback",value:function(t){return this.drawBelowCallback=t,this}},{key:"setDrawAboveCallback",value:function(t){return this.drawAboveCallback=t,this}},{key:"reset",value:function(){return this.setVisible().setAlpha(1).setPosition(0,0).setRotation(0).setScale(1,1).setLeftSpace(0).setRightSpace(0).setOrigin(0).setAlign().setDrawBelowCallback().setDrawAboveCallback(),this}},{key:"willRender",get:function(){return this.visible&&this.alpha>0}},{key:"drawX",get:function(){var t=this.x+this.leftSpace+this.offsetX-this.originX*this.width;return this.parent._textOX*this.scrollFactorX+t}},{key:"drawY",get:function(){var t=this.y+this.offsetY;return this.parent._textOY*this.scrollFactorY+t}},{key:"drawTLX",get:function(){return 0}},{key:"drawTLY",get:function(){return 0}},{key:"drawBLX",get:function(){return 0}},{key:"drawBLY",get:function(){return 0}},{key:"drawTRX",get:function(){return 0}},{key:"drawTRY",get:function(){return 0}},{key:"drawBRX",get:function(){return 0}},{key:"drawBRY",get:function(){return 0}},{key:"drawCenterX",get:function(){return (this.drawTRX+this.drawTLX)/2}},{key:"drawCenterY",get:function(){return (this.drawBLY+this.drawTLY)/2}}]),s}(Jo);Object.assign(va.prototype,ua);var pa=Phaser.Utils.String.Pad,ga=function(e,i,n){if(null==e)return e;switch(t(e)){case"string":default:return e;case"number":return "#".concat(pa(Math.floor(e).toString(16),6,"0",1));case"function":return e(i,n);case"object":return e.hasOwnProperty("r")?e.hasOwnProperty("a")?"rgba(".concat(e.r,",").concat(e.g,",").concat(e.b,",").concat(e.a,")"):"rgb(".concat(e.r,",").concat(e.g,",").concat(e.b,")"):e.hasOwnProperty("h")?e.hasOwnProperty("a")?"hsla(".concat(e.h,",").concat(e.s,",").concat(e.l,",").concat(e.a,")"):"hsl(".concat(e.h,",").concat(e.s,",").concat(e.l,")"):e}},ya=function(t,e,i){return e.hasOwnProperty(t)?e[t]:i[t]},ka=Phaser.Math.DegToRad,ma=function(t){return !t.hasOwnProperty("convex")||t.convex},xa=function(t){return t.x>0&&t.y>0},ba=function(t,e,i,n,r,s,o,a,h){if(a&&o>s?o-=360:!a&&o=f?1:n/f,g=r>=v?1:r/v,y=d.cornerRadius;t.save(),t.beginPath(),t.translate(e,i),a=y.tl,xa(a)?(h=a.x*p,l=a.y*g,ma(a)?ba(t,h,l,h,l,180,270,!1,o):ba(t,0,0,h,l,90,0,!0,o),u=0,c=l):(t.lineTo(0,0),u=0,c=0),a=y.tr,xa(a)?(h=a.x*p,l=a.y*g,ma(a)?ba(t,n-h,l,h,l,270,360,!1,o):ba(t,n,0,h,l,180,90,!0,o)):t.lineTo(n,0),a=y.br,xa(a)?(h=a.x*p,l=a.y*g,ma(a)?ba(t,n-h,r-l,h,l,0,90,!1,o):ba(t,n,r,h,l,270,180,!0,o)):t.lineTo(n,r),a=y.bl,xa(a)?(h=a.x*p,l=a.y*g,ma(a)?ba(t,h,r-l,h,l,90,180,!1,o):ba(t,0,r,h,l,360,270,!0,o)):t.lineTo(0,r),t.lineTo(u,c),t.closePath(),t.restore();}(e,i,n,r,s,o,d),null!=a){var f;if(null!=u)(f=c?e.createLinearGradient(0,0,r,0):e.createLinearGradient(0,0,0,s)).addColorStop(0,a),f.addColorStop(1,u),a=f;e.fillStyle=a,e.fill();}null!=h&&l>0&&(e.strokeStyle=h,e.lineWidth=l,e.stroke());},Ca=function(t,e,i,n,r,s,o,a){if(null!=e||null!=i){var h=t.canvas.width,l=t.canvas.height;null==i&&(n=0);var u=n/2;h=Math.max(1,h-n),l=Math.max(1,l-n),wa(t.canvas,t.context,u,u,h,l,r,e,i,n,s,o,a);}},Sa=Phaser.Utils.Objects.GetValue,Pa=function(t){r(o,t);var i=l(o);function o(t,n){var r;return e(this,o),(r=i.call(this,t,"background")).setScrollFactor(0),r.setColor(Sa(n,"color",null),Sa(n,"color2",null),Sa(n,"horizontalGradient",!0)),r.setStroke(Sa(n,"stroke",null),Sa(n,"strokeThickness",2)),r.setCornerRadius(Sa(n,"cornerRadius",0),Sa(n,"cornerIteration",null)),r}return n(o,[{key:"color",get:function(){return this._color},set:function(t){t=ga(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t;}},{key:"color2",get:function(){return this._color2},set:function(t){t=ga(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t;}},{key:"horizontalGradient",get:function(){return this._horizontalGradient},set:function(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t;}},{key:"setColor",value:function(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}},{key:"stroke",get:function(){return this._stroke},set:function(t){t=ga(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t;}},{key:"strokeThickness",get:function(){return this._strokeThickness},set:function(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t;}},{key:"setStroke",value:function(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}},{key:"cornerRadius",get:function(){return this._cornerRadius},set:function(t){this.setDirty(this._cornerRadius!=t),this._cornerRadius=t;}},{key:"cornerIteration",get:function(){return this._cornerIteration},set:function(t){this.setDirty(this._cornerIteration!=t),this._cornerIteration=t;}},{key:"modifyStyle",value:function(t){return t.hasOwnProperty("color")&&this.setColor(t.color,ya("color2",t,this),ya("horizontalGradient",t,this)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,ya("strokeThickness",t,this)),t.hasOwnProperty("cornerRadius")&&this.setCornerRadius(t.cornerRadius,ya("cornerIteration",t,this)),this}},{key:"modifyPorperties",value:function(t){return c(s(o.prototype),"modifyPorperties",this).call(this,t),this.modifyStyle(t),this}},{key:"setCornerRadius",value:function(t,e){return this.cornerRadius=t,this.cornerIteration=e,this}},{key:"renderContent",value:function(){Ca(this.parent,this.color,this.stroke,this.strokeThickness,this.cornerRadius,this.color2,this.horizontalGradient,this.cornerIteration);}}]),o}(va),Oa=Phaser.Utils.Objects.GetValue,Ta=function(t){r(o,t);var i=l(o);function o(t,n){var r;return e(this,o),(r=i.call(this,t,"innerbounds")).setScrollFactor(0),r.setColor(Oa(n,"color",null),Oa(n,"color2",null),Oa(n,"horizontalGradient",!0)),r.setStroke(Oa(n,"stroke",null),Oa(n,"strokeThickness",2)),r}return n(o,[{key:"color",get:function(){return this._color},set:function(t){t=ga(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t;}},{key:"color2",get:function(){return this._color2},set:function(t){t=ga(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t;}},{key:"horizontalGradient",get:function(){return this._horizontalGradient},set:function(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t;}},{key:"setColor",value:function(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}},{key:"stroke",get:function(){return this._stroke},set:function(t){t=ga(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t;}},{key:"strokeThickness",get:function(){return this._strokeThickness},set:function(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t;}},{key:"setStroke",value:function(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}},{key:"modifyPorperties",value:function(t){c(s(o.prototype),"modifyPorperties",this).call(this,t),t.hasOwnProperty("color")&&this.setColor(t.color,Oa(t,"color2",null),Oa(t,"horizontalGradient",!0)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,Oa(t,"strokeThickness",2));}},{key:"renderContent",value:function(){var t=this.parent.padding,e=t.left,i=t.top,n=this.parent.width-t.left-t.right,r=this.parent.height-t.top-t.bottom,s=this.context;if(null!=this.color){var o,a;if(null!=this.color2)(a=this.horizontalGradient?s.createLinearGradient(0,0,n,0):s.createLinearGradient(0,0,0,r)).addColorStop(0,this.color),a.addColorStop(1,this.color2),o=a;else o=this.color;s.fillStyle=o,s.fillRect(e,i,n,r);}null!=this.stroke&&this.strokeThickness>0&&(s.strokeStyle=this.stroke,s.lineWidth=this.strokeThickness,s.strokeRect(e,i,n,r));}}]),o}(va),_a=Phaser.Utils.Objects.GetValue,Ea=function(){function t(i,n){e(this,t),this.parent=i,this.set(n);}return n(t,[{key:"toJSON",value:function(){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}}},{key:"set",value:function(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}},{key:"modify",value:function(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(ya("stroke",t,this),ya("strokeThickness",t,this)),t.hasOwnProperty("shadowColor")&&this.setShadowColor(t.shadowColor),(t.hasOwnProperty("shadowOffsetX")||t.hasOwnProperty("shadowOffsetY"))&&this.setShadowOffset(ya("shadowOffsetX",t,this),ya("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}},{key:"setUpdateTextFlag",value:function(){return this.parent&&(this.parent.updateTextFlag=!0),this}},{key:"clone",value:function(){return new t(null,this.toJSON())}},{key:"copyFrom",value:function(t){return this.set(t.toJSON()),this}},{key:"copyTo",value:function(t){return t.set(this.toJSON()),this}},{key:"setBold",value:function(t){return void 0===t&&(t=!0),this.bold=t,this.setUpdateTextFlag(),this}},{key:"setItalic",value:function(t){return void 0===t&&(t=!0),this.italic=t,this.setUpdateTextFlag(),this}},{key:"fontStyle",get:function(){return this.bold&&this.italic?"bold italic":this.bold?"bold":this.italic?"italic":""}},{key:"setFontSize",value:function(t){return "number"==typeof t&&(t="".concat(t,"px")),this.fontSize=t,this.setUpdateTextFlag(),this}},{key:"setFontFamily",value:function(t){return this.fontFamily=t,this.setUpdateTextFlag(),this}},{key:"font",get:function(){return "".concat(this.fontStyle," ").concat(this.fontSize," ").concat(this.fontFamily)}},{key:"setColor",value:function(t){return this.color=ga(t),this}},{key:"hasFill",get:function(){return null!=this.color}},{key:"setStrokeStyle",value:function(t,e){return this.stroke=ga(t),void 0!==e&&(this.strokeThickness=e),this}},{key:"setStrokeThickness",value:function(t){return this.strokeThickness=t,this}},{key:"hasStroke",get:function(){return null!=this.stroke&&this.strokeThickness>0}},{key:"setShadowColor",value:function(t){return this.shadowColor=ga(t),this}},{key:"setShadowOffset",value:function(t,e){return void 0===t&&(t=0),void 0===e&&(e=0),this.shadowOffsetX=t,this.shadowOffsetY=e,this}},{key:"setShadowBlur",value:function(t){return void 0===t&&(t=0),this.shaodwBlur=t,this}},{key:"setShadow",value:function(t,e,i,n){return this.setShadowColor(t).setShadowOffset(e,i).setShadowBlur(n),this}},{key:"setBackgroundColor",value:function(t){return this.backgroundColor=ga(t),this}},{key:"hasBackgroundColor",get:function(){return null!=this.backgroundColor}},{key:"setBackgroundHeight",value:function(t){return this.backgroundHeight=t,this}},{key:"setBackgroundBottomY",value:function(t){return this.backgroundBottomY=t,this}},{key:"setOffsetX",value:function(t){return void 0===t&&(t=0),this.offsetX=t,this}},{key:"setOffsetY",value:function(t){return void 0===t&&(t=0),this.offsetY=t,this}},{key:"setOffset",value:function(t,e){return this.setOffsetX(t).setOffsetY(e),this}},{key:"setLeftSpace",value:function(t){return void 0===t&&(t=0),this.leftSpace=t,this}},{key:"setRightSpace",value:function(t){return void 0===t&&(t=0),this.rightSpace=t,this}},{key:"setSpace",value:function(t,e){return this.setLeftSpace(t).setRightSpace(e),this}},{key:"setAlign",value:function(t){return this.align=t,this}},{key:"syncFont",value:function(t){return t.font=this.font,this}},{key:"syncStyle",value:function(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}},{key:"syncShadow",value:function(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);}},{key:"getTextMetrics",value:function(t,e){return this.syncFont(t).syncStyle(t),t.measureText(e)}}]),t}(),Ra=Phaser.Utils.Array.Remove,Ma=Phaser.Utils.Array.Remove,La="text",Da="image",Aa="drawer",za="space",ja="command",Fa=function(t){return t.type===La&&"\n"===t.text},Wa=function(t){return t.type===La&&"\f"===t.text},Ia=function(t){return t.type===La},Ba=function(t){r(o,t);var i=l(o);function o(t,n,r){var s;return e(this,o),(s=i.call(this,t,La)).updateTextFlag=!1,s.style=new Ea(a(s),r),s.setText(n),s}return n(o,[{key:"autoRound",get:function(){return this.parent.autoRound}},{key:"offsetX",get:function(){return this.style.offsetX},set:function(t){this.style&&(this.style.offsetX=t);}},{key:"offsetY",get:function(){return this.style.offsetY},set:function(t){this.style&&(this.style.offsetY=t);}},{key:"leftSpace",get:function(){return this.style.leftSpace*this.scaleX},set:function(t){this.style&&(this.style.leftSpace=t),f(s(o.prototype),"leftSpace",t,this,!0);}},{key:"rightSpace",get:function(){return this.style.rightSpace*this.scaleX},set:function(t){this.style&&(this.style.rightSpace=t),f(s(o.prototype),"rightSpace",t,this,!0);}},{key:"align",get:function(){return this.style.align},set:function(t){this.style&&(this.style.align=t);}},{key:"modifyStyle",value:function(t){return this.setDirty(!0),this.style.modify(t),this.updateTextFlag&&this.updateTextSize(),this}},{key:"modifyPorperties",value:function(t){return t?(this.modifyStyle(t),c(s(o.prototype),"modifyPorperties",this).call(this,t),this):this}},{key:"setText",value:function(t){return this.setDirty(this.text!=t),this.text=t,this.updateTextSize(),this}},{key:"updateTextSize",value:function(){var t=this.text;if("\n"===t||"\f"===t||""===t)this.clearTextSize();else {var e,i,n=this.style.getTextMetrics(this.context,this.text);this.textWidth=n.width,"actualBoundingBoxAscent"in n?(e=n.actualBoundingBoxAscent,i=n.actualBoundingBoxDescent):(e=0,i=0),this.textHeight=e+i,this.ascent=e,this.descent=i;}return this.updateTextFlag=!1,this}},{key:"clearTextSize",value:function(){return this.textWidth=0,this.textHeight=0,this.ascent=0,this.descent=0,this}},{key:"copyTextSize",value:function(t){return this.textWidth=t.textWidth,this.textHeight=t.textHeight,this.ascent=t.ascent,this.descent=t.descent,this}},{key:"width",get:function(){return this.textWidth*this.scaleX},set:function(t){this.textWidth>0?this.scaleX=t/this.textWidth:this.scaleX=1;}},{key:"height",get:function(){return this.textHeight*this.scaleY},set:function(t){this.textHeight>0?this.scaleY=t/this.textHeight:this.scaleY=1;}},{key:"willRender",get:function(){return 0!==this.textWidth&&c(s(o.prototype),"willRender",this)}},{key:"renderContent",value:function(){var t=this.context,e=this.style;if(e.hasBackgroundColor){t.fillStyle=e.backgroundColor;var i=this.drawTLX,n=this.drawTRX-i,r=e.backgroundBottomY;null==r&&(r=this.drawBLY);var s=e.backgroundHeight;null==s&&(s=r-this.drawTLY);var o=r-s;t.fillRect(i,o,n,s);}var a=e.hasFill,h=e.hasStroke;(a||h)&&(e.syncFont(t).syncStyle(t),h&&(e.syncShadow(t),t.strokeText(this.text,0,0)),a&&(e.syncShadow(t),t.fillText(this.text,0,0)));}},{key:"drawTLX",get:function(){return -this.leftSpace}},{key:"drawTLY",get:function(){return -this.ascent}},{key:"drawBLX",get:function(){return -this.leftSpace}},{key:"drawBLY",get:function(){return this.descent}},{key:"drawTRX",get:function(){return this.textWidth+this.rightSpace}},{key:"drawTRY",get:function(){return -this.ascent}},{key:"drawBRX",get:function(){return this.textWidth+this.rightSpace}},{key:"drawBRY",get:function(){return this.descent}}]),o}(va),Xa=function(t,e){var i=this.createCharChildren(t,e);return this.addChild(i),this},Ya=function(t){r(s,t);var i=l(s);function s(t,n,r){var o;return e(this,s),(o=i.call(this,t,Da)).setTexture(n,r),o}return n(s,[{key:"frameWidth",get:function(){return this.frameObj?this.frameObj.cutWidth:0}},{key:"frameHeight",get:function(){return this.frameObj?this.frameObj.cutHeight:0}},{key:"offsetY",get:function(){return -this.height},set:function(t){}},{key:"key",get:function(){return this._key},set:function(t){this.setDirty(this._key!=t),this._key=t;}},{key:"frame",get:function(){return this._frame},set:function(t){this.setDirty(this._frame!=t),this._frame=t;}},{key:"setTexture",value:function(t,e){return this.key=t,this.frame=e,this.frameObj=this.scene.sys.textures.getFrame(t,e),this}},{key:"width",get:function(){return this.frameWidth*this.scaleX},set:function(t){this.setDirty(this.width!==t),this.scaleX=t/this.frameWidth;}},{key:"height",get:function(){return this.frameHeight*this.scaleY},set:function(t){this.setDirty(this.height!==t),this.scaleY=t/this.frameHeight;}},{key:"setHeight",value:function(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}},{key:"renderContent",value:function(){var t=this.context,e=this.frameObj,i=this.frameWidth,n=this.frameHeight;t.drawImage(e.source.image,e.cutX,e.cutY,i,n,0,0,i,n);}},{key:"drawTLX",get:function(){return -this.leftSpace}},{key:"drawTLY",get:function(){return 0}},{key:"drawBLX",get:function(){return -this.leftSpace}},{key:"drawBLY",get:function(){return this.frameHeight}},{key:"drawTRX",get:function(){return this.frameWidth+this.rightSpace}},{key:"drawTRY",get:function(){return 0}},{key:"drawBRX",get:function(){return this.frameWidth+this.rightSpace}},{key:"drawBRY",get:function(){return this.frameHeight}}]),s}(va),Ha=function(t){r(o,t);var i=l(o);function o(t,n,r,s){var a;return e(this,o),(a=i.call(this,t,Aa)).setRenderCallback(n),a.setDrawerSize(r,s),a}return n(o,[{key:"setRenderCallback",value:function(t){return t?this.renderContent=t.bind(this):delete this.renderContent,this}},{key:"setDrawerSize",value:function(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}},{key:"onFree",value:function(){c(s(o.prototype),"onFree",this).call(this),this.setRenderCallback();}},{key:"width",get:function(){return this.drawerWidth*this.scaleX},set:function(t){this.setDirty(this.width!==t),this.scaleX=this.drawerWidth>0?t/this.drawerWidth:1;}},{key:"height",get:function(){return this.drawerHeight*this.scaleY},set:function(t){this.setDirty(this.height!==t),this.scaleY=this.drawerHeight>0?t/this.drawerHeight:1;}},{key:"offsetY",get:function(){return -this.height},set:function(t){}},{key:"drawTLX",get:function(){return -this.leftSpace}},{key:"drawTLY",get:function(){return 0}},{key:"drawBLX",get:function(){return -this.leftSpace}},{key:"drawBLY",get:function(){return this.drawerHeight}},{key:"drawTRX",get:function(){return this.drawerWidth+this.rightSpace}},{key:"drawTRY",get:function(){return 0}},{key:"drawBRX",get:function(){return this.drawerWidth+this.rightSpace}},{key:"drawBRY",get:function(){return this.drawerHeight}}]),o}(va),Ga=function(t){r(s,t);var i=l(s);function s(t,n){var r;return e(this,s),(r=i.call(this,t,za)).setSpaceWidth(n),r}return n(s,[{key:"width",get:function(){return this.spaceWidth*this.scaleX},set:function(t){this.spaceWidth>0?this.scaleX=t/this.spaceWidth:this.scaleX=1;}},{key:"setSpaceWidth",value:function(t){return this.spaceWidth=t,this}}]),s}(va),Na=function(t){r(o,t);var i=l(o);function o(t,n,r,s,a){var h;return e(this,o),(h=i.call(this,t,ja)).setName(n).setParameter(s).setCallback(r,a),h}return n(o,[{key:"setName",value:function(t){return this.name=t,this}},{key:"setParameter",value:function(t){return this.param=t,this}},{key:"setCallback",value:function(t,e){return this.callback=t,this.scope=e,this}},{key:"exec",value:function(){return this.scope?this.callback.call(this.scope,this.param,this.name):this.callback(this.param,this.name)}},{key:"onFree",value:function(){c(s(o.prototype),"onFree",this).call(this),this.setName().setCallback().setParameter();}}]),o}(Jo),Ua=function e(i){var n,r,s;if(null==i||"object"!==t(i))return i;if(n=Array.isArray(i)?[]:{},function(e){if("object"!==t(e)||e.nodeType||e===e.window)return !1;try{if(e.constructor&&!{}.hasOwnProperty.call(e.constructor.prototype,"isPrototypeOf"))return !1}catch(t){return !1}return !0}(i))for(s in i)r=i[s],n[s]=e(r);else n=i;return n},Va=function(t,e,i,n){void 0===n&&(n={word:[],width:0}),n.word.length=0;for(var r=t.length,s=e,o=n.word,a=0;s0&&!a){var h=this.fixedHeight-n;if(i>0)s=h/i;else s=(l=Ka.call(this)).height,o=l.ascent,i=Math.floor((h-o)/s);}else {var l;s=(l=Ka.call(this)).height,o=l.ascent;}}else if(this.fixedHeight>0){if(void 0===(i=$a(t,"maxLines"))){h=this.fixedHeight-n;i=Math.floor(h/s);}}else i=$a(t,"maxLines",0);void 0===o&&(o=s);var u=0===i,c=$a(t,"wrapWidth",void 0);void 0===c&&(c=this.fixedWidth>0?this.fixedWidth-r:1/0);for(var d=$a(t,"letterSpacing",0),f=$a(t,"hAlign",0),v=$a(t,"vAlign",0),p=$a(t,"charWrap",!1),g={callback:"runWordWrap",start:e,isLastPage:!1,padding:this.wrapPadding,ascent:o,lineHeight:s,maxLines:i,wrapWidth:c,letterSpacing:d,hAlign:f,vAlign:v,charWrap:p,children:[],lines:[],maxLineWidth:0,linesHeight:0},y=this.children,k=0,m=y.length;k0&&(_.push({children:E,width:R}),M=Math.max(M,R)),g.start+=T.length,g.isLastPage=!L&&g.start===O,g.maxLineWidth=M,g.linesHeight=_.length*s;var I=this.fixedWidth>0?this.fixedWidth:g.maxLineWidth+r,B=this.fixedHeight>0?this.fixedHeight:g.linesHeight+n;!function(t,e,i){var n,r,s=t.hAlign,o=t.vAlign,a=t.linesHeight;switch(o){case 1:case"center":r=(i-a)/2;break;case 2:case"bottom":r=i-a;break;default:r=0;}for(var h=t.lines,l=0,u=h.length;l0?(o=this.fixedWidth-r)/i:0;else if(this.fixedWidth>0){if(void 0===(i=eh(t,"maxLines",void 0))){var o=this.fixedWidth-r;i=Math.floor(o/s)+1;}}else i=eh(t,"maxLines",0);var a=0===i,h=eh(t,"fixedChildHeight",void 0);if(void 0===h){var l=eh(t,"charPerLine",void 0);if(void 0!==l){var u=this.fixedHeight-n;h=Math.floor(u/l);}}var c=eh(t,"wrapHeight",void 0);void 0===c&&(c=this.fixedHeight>0?this.fixedHeight-n:1/0);for(var d=eh(t,"letterSpacing",0),f=eh(t,"rtl",!0),v=eh(t,"hAlign",f?2:0),p=eh(t,"vAlign",0),g={callback:"runVerticalWrap",start:e,isLastPage:!1,padding:this.wrapPadding,lineWidth:s,maxLines:i,fixedChildHeight:h,wrapHeight:c,letterSpacing:d,hAlign:v,vAlign:p,rtl:f,children:[],lines:[],maxLineHeight:0,linesWidth:0},y=this.children,k=0,m=y.length;k0&&(_.push({children:E,height:R}),M=Math.max(M,R)),g.start+=T.length,g.isLastPage=g.start===O,g.maxLineHeight=M,g.linesWidth=_.length*s;var F=this.fixedWidth>0?this.fixedWidth:g.linesWidth+r,W=this.fixedHeight>0?this.fixedHeight:g.maxLineHeight+n;!function(t,e,i){var n,r,s=t.hAlign,o=t.vAlign,a=t.rtl,h=t.lines,l=t.lineWidth,u=t.linesWidth;switch(s){case 1:case"center":n=(e-u)/2;break;case 2:case"right":n=e-u;break;default:n=0;}a&&(n+=l);for(var c=0,d=h.length;c0?t:this.width,e>0?e:this.height),this):this},setPadding:function(t,e){var i=this.padding,n=i.left,r=i.right,s=i.top,o=i.bottom;return He(i,t,e),this.dirty=this.dirty||n!=i.left||r!=i.right||s!=i.top||o!=i.bottom,this},getPadding:function(t){return Ye(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),Ra(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 Ma(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,n,r,s=Array.isArray(t);void 0===e||e===this.children.length?s?(i=this.children).push.apply(i,v(t)):this.children.push(t):s?(n=this.children).splice.apply(n,[e,0].concat(v(t))):this.children.splice(e,0,t);(this.lastAppendedChildren.length=0,s)?(r=this.lastAppendedChildren).push.apply(r,v(t)):this.lastAppendedChildren.push(t);return this},createCharChild:function(t,e){e&&this.textStyle.modify(e);var i=this.poolManager.allocate(La);return null===i?i=new Ba(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=[],n=0,r=t.length;ne&&(n=e,r=t);})),r},getCharWorldPosition:function(t,e,i,n){return "number"==typeof t&&(t=this.getCharChild(t,!0)),la(this,t,e,i,n)},setToMinSize:function(){for(var t=this.children,e=0,i=0,n=0,r=t.length;n=i.length&&(t=i.length);for(var n=0,r=0;r0?this.items.pop():null}},{key:"push",value:function(t){return this.items.push(t),this}},{key:"pushMultiple",value:function(t){return this.items.push.apply(this.items,t),t.length=0,this}},{key:"clear",value:function(){return this.items.length=0,this}}]),t}(),wh=Phaser.Utils.Objects.GetFastValue,Ch={},Sh=function(){function t(i){e(this,t),this.pools=wh(i,"pools",Ch);}return n(t,[{key:"free",value:function(t){if(!this.pools)return this;var e=t.type;return this.pools.hasOwnProperty(e)||(this.pools[e]=new bh),this.pools[e].push(t),t.onFree(),this}},{key:"freeMultiple",value:function(t){if(!this.pools)return this;for(var e=0,i=t.length;e=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!=n&&(r=e.getCharChild(n))&&("\n"===r.text&&r.copyTextSize(e.lastInsertCursor),function(t){var e,i,n=t.parent,r=n.width,s=n.height,o=t.drawX,a=t.drawY,h=o+t.drawTLX,l=o+t.drawTRX,u=a+t.drawTLY,c=a+t.drawBLY;e=h<0?0-h:l>r?r-l:0,i=u<0?0-u:c>s?s-c:0,n._textOX+=e,n._textOY+=i;}(r),e.emit("cursorin",r,n,e)),e.emit("movecursor",n,t.prevCursorPosition,e),t.prevCursorPosition=n;}}(this)):(Xh(this),Yh(this)),this}},{key:"setNumberInput",value:function(){return this.onUpdateCallback=Bh,this}},{key:"setSelectAllWhenFocusEnable",value:function(t){return void 0===t&&(t=!0),this.selectAllWhenFocus=t,this}}]),s}(Ih),Nh=Phaser.Utils.Objects.GetValue,Uh=["inputType","onOpen","onFocus","onClose","onBlur","onUpdate","enterClose","readOnly","maxLength","minLength","selectAll"],Vh=function(t,e){if(t&&"number"!=typeof t){if(t.hasOwnProperty(e))return !0;if(-1!==e.indexOf(".")){for(var i=e.split("."),n=t,r=0;rt.length?i:t})),l.value=t.join(c);}else l.value=t.join(i.slice(a,a+l.count));a+=l.count,l.added||(h+=l.count);}}var d=e[o-1];return o>1&&"string"==typeof d.value&&(d.added||d.removed)&&t.equals("",d.value)&&(e[o-2].value+=d.value,e.pop()),e}il.prototype={diff:function(t,e){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=i.callback;"function"==typeof i&&(n=i,i={}),this.options=i;var r=this;function s(t){return n?(setTimeout((function(){n(void 0,t);}),0),!0):t}t=this.castInput(t),e=this.castInput(e),t=this.removeEmpty(this.tokenize(t));var o=(e=this.removeEmpty(this.tokenize(e))).length,a=t.length,h=1,l=o+a;i.maxEditLength&&(l=Math.min(l,i.maxEditLength));var u=[{newPos:-1,components:[]}],c=this.extractCommon(u[0],e,t,0);if(u[0].newPos+1>=o&&c+1>=a)return s([{value:this.join(e),count:e.length}]);function d(){for(var i=-1*h;i<=h;i+=2){var n=void 0,l=u[i-1],c=u[i+1],d=(c?c.newPos:0)-i;l&&(u[i-1]=void 0);var f=l&&l.newPos+1=o&&d+1>=a)return s(nl(r,n.components,e,t,r.useLongestToken));u[i]=n;}else u[i]=void 0;}var p;h++;}if(n)!function t(){setTimeout((function(){if(h>l)return n();d()||t();}),0);}();else for(;h<=l;){var f=d();if(f)return f}},pushComponent:function(t,e,i){var n=t[t.length-1];n&&n.added===e&&n.removed===i?t[t.length-1]={count:n.count+1,added:e,removed:i}:t.push({count:1,added:e,removed:i});},extractCommon:function(t,e,i,n){for(var r=e.length,s=i.length,o=t.newPos,a=o-n,h=0;o+1=6?(n=[arguments[2],void 0,arguments[3]],r=[arguments[4],void 0,arguments[5]]):(n=Ua(n),r=Ua(r)),this.textureKey=e,this.baseFrameName=i,this.columns.data=n,this.columns.count=n?n.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 s=this.scene.sys.textures.get(e);if(!s)return this.clear(),this;if(!n||!r)return this.clear(),this;for(var o=s.get(i),a=o.width,h=0,l=0,u=n.length;l0?0:g,x=0;l=0;for(var S=n.length;l0?0:y),y>=1&&g>=1){var P=t(k=this.getFrameNameCallback(l,w,i));"string"!==P&&"number"!==P||s.add(k,0,x+o.cutX,b+o.cutY,y,g);}x+=y;}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,n,r,s,o,a,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,f=c>=0?this.maxFixedPartScaleY:this.height/l;if(this.preserveRatio){var v=Math.min(d,f);if(d>v){var p=(d-v)*h;u>=0?u+=p:u=p,d=v;}if(f>v){var g=(f-v)*l;c>=0?c+=g:c=g,f=v;}}this.columns.scale=d,this.rows.scale=f,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 y=0,k=0;this._beginDraw();for(var m=0,x=this.rows.count;m0&&a>0&&(0===(0===s.stretch&&0===r.stretch||0===this.getStretchMode(b,m)?0:1)?this._drawImage(this.textureKey,n,y,k,o,a):this._drawTileSprite(this.textureKey,n,y,k,o,a)),y+=o;k+=a;}this._endDraw();},setStretchMode:function(t){return Uu(t)?(this.stretchMode.edge=Ju(Vu(t,"edge",0)),this.stretchMode.internal=Ju(Vu(t,"internal",0))):(t=Ju(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}},$u=Phaser.Utils.Objects.IsPlainObject,Qu=Phaser.Utils.Objects.GetValue,tc=Phaser.GameObjects,ec=void 0,ic=function(t,e){if(ec||(ec={},ei(t).events.once("destroy",(function(){for(var t in ec)ec[t].destroy();ec=void 0;}))),!ec.hasOwnProperty(e)){var i=ei(t).scene.systemScene;(t=new tc[e](i)).setOrigin(0),ec[e]=t;}return ec[e]},nc=function(t){r(s,t);var i=l(s);function s(){return e(this,s),i.apply(this,arguments)}return n(s)}(function(t,i){var o=function(t){r(a,t);var o=l(a);function a(t,n,r,s,h,l,u,c,d,f){var v;if(e(this,a),$u(n)?(n=Qu(f=n,"x",0),r=Qu(f,"y",0),s=Qu(f,"width",1),h=Qu(f,"height",1),l=Qu(f,"key",void 0),u=Qu(f,"baseFrame",void 0),c=Qu(f,"columns",void 0),d=Qu(f,"rows",void 0)):$u(s)?(s=Qu(f=s,"width",1),h=Qu(f,"height",1),l=Qu(f,"key",void 0),u=Qu(f,"baseFrame",void 0),c=Qu(f,"columns",void 0),d=Qu(f,"rows",void 0)):$u(l)?(l=Qu(f=l,"key",void 0),u=Qu(f,"baseFrame",void 0),c=Qu(f,"columns",void 0),d=Qu(f,"rows",void 0)):$u(u)?(u=Qu(f=u,"baseFrame",void 0),c=Qu(f,"columns",void 0),d=Qu(f,"rows",void 0)):Array.isArray(u)?(f=d,d=c,c=u,u=Qu(f,"baseFrame",void 0)):$u(c)&&(c=Qu(f=c,"columns",void 0),d=Qu(f,"rows",void 0)),void 0===c){var p=Qu(f,"leftWidth",void 0),g=Qu(f,"rightWidth",void 0);void 0!==p&&void 0!==g&&(c=[p,void 0,g]);}if(void 0===d){var y=Qu(f,"topHeight",void 0),k=Qu(f,"bottomHeight",void 0);void 0!==y&&void 0!==k&&(d=[y,void 0,k]);}(v=o.call(this,t)).type=i,v.setPosition(n,r).setSize(s,h).setOrigin(.5,.5),v.columns={},v.rows={},v.stretchMode={},v._tileSprite=void 0,v._image=void 0,v.setGetFrameNameCallback(Qu(f,"getFrameNameCallback",void 0)),v.setStretchMode(Qu(f,"stretchMode",0)),v.setPreserveRatio(Qu(f,"preserveRatio",!0));var m=Qu(f,"maxFixedPartScale",1),x=Qu(f,"maxFixedPartScaleX",m),b=Qu(f,"maxFixedPartScaleY",void 0);return v.setMaxFixedPartScale(x,b),v.setBaseTexture(l,u,c,d),v}return n(a,[{key:"minWidth",get:function(){return this.columns.minWidth}},{key:"minHeight",get:function(){return this.rows.minHeight}},{key:"fixedPartScaleX",get:function(){return this.columns.scale}},{key:"fixedPartScaleY",get:function(){return this.rows.scale}},{key:"resize",value:function(t,e){return this.width===t&&this.height===e||(c(s(a.prototype),"resize",this)?c(s(a.prototype),"resize",this).call(this,t,e):c(s(a.prototype),"setSize",this).call(this,t,e),this.updateTexture()),this}}]),a}(t);return Object.assign(o.prototype,Zu),o}(Phaser.GameObjects.RenderTexture,"rexNinePatch")),rc={_drawImage:function(t,e,i,n,r,s){var o=ic(this,"Image").setTexture(t,e).setDisplaySize(r,s);this.draw(o,i,n);},_drawTileSprite:function(t,e,i,n,r,s){var o=ic(this,"TileSprite").setTexture(t,e).setSize(r,s);this.draw(o,i,n);}};Object.assign(nc.prototype,rc);var sc=function(t,e){var i,n;switch(e&&(e.hasOwnProperty("type")?i=e.type:e.hasOwnProperty("leftWidth")?i="nineSlice":e.hasOwnProperty("key")&&(i="image")),i){case"image":n=new Gu(t,e);break;case"nineSlice":n=e.hasOwnProperty("stretchMode")?new nc(t,e):new Bu(t,e);break;default:n=new Eu(t,e);}return t.add.existing(n),n},oc=Phaser.GameObjects.Text,ac=Phaser.Utils.Objects.GetValue,hc=function(t){r(s,t);var i=l(s);function s(t,n){var r;e(this,s),void 0===n&&(n={});var o=ac(n,"x",0),a=ac(n,"y",0),h=ac(n,"text","");return (r=i.call(this,t,o,a,h,n)).type="rexStatesText",n.style=r.style,n.onModifyStyle=function(t,e){var i=e.hasOwnProperty("fontStyle")||e.hasOwnProperty("fontSize")||e.hasOwnProperty("fontFamily");t.style.update(i);},r.addStyleManager(n),delete n.style,r}return n(s)}(oc);Object.assign(hc.prototype,_u); /** * @author Richard Davey * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var lc=Phaser.Renderer.WebGL.Utils,uc={renderWebGL:function(t,e,i,n){if(0!==e.width&&0!==e.height){i.addToRenderList(e);var r=e.frame,s=r.width,o=r.height,a=lc.getTintAppendFloatAlpha,h=t.pipelines.set(e.pipeline,e),l=h.setTexture2D(r.glTexture,e);t.pipelines.preBatch(e),h.batchTexture(e,r.glTexture,s,o,e.x,e.y,s/e.style.resolution,o/e.style.resolution,e.scaleX,e.scaleY,e.rotation,e.flipX,e.flipY,e.scrollFactorX,e.scrollFactorY,e.displayOriginX,e.displayOriginY,0,0,s,o,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,n,!1,l),t.pipelines.postBatch(e);}},renderCanvas:function(t,e,i,n){0!==e.width&&0!==e.height&&(i.addToRenderList(e),t.batchSprite(e,e.frame,i,n));}},cc=Phaser.Display.Canvas.CanvasPool;k();var dc=function(t){r(s,t);var i=l(s);function s(){return e(this,s),i.apply(this,arguments)}return n(s,[{key:"setStyle",value:function(t){return this.style.setStyle(t)}},{key:"setFont",value:function(t){return this.style.setFont(t)}},{key:"setFontFamily",value:function(t){return this.style.setFontFamily(t)}},{key:"setFontSize",value:function(t){return this.style.setFontSize(t)}},{key:"setFontStyle",value:function(t){return this.style.setFontStyle(t)}},{key:"setTestString",value:function(t){return this.style.setTestString(t)}},{key:"setFixedSize",value:function(t,e){return this.style.setFixedSize(t,e)}},{key:"setBackgroundColor",value:function(t,e,i){return this.style.setBackgroundColor(t,e,i)}},{key:"setBackgroundStrokeColor",value:function(t,e){return this.style.setBackgroundStrokeColor(t,e)}},{key:"setBackgroundCornerRadius",value:function(t,e){return this.style.setBackgroundCornerRadius(t,e)}},{key:"setFill",value:function(t){return this.style.setFill(t)}},{key:"setColor",value:function(t){return this.style.setColor(t)}},{key:"setStroke",value:function(t,e){return this.style.setStroke(t,e)}},{key:"setShadow",value:function(t,e,i,n,r,s){return this.style.setShadow(t,e,i,n,r,s)}},{key:"setShadowOffset",value:function(t,e){return this.style.setShadowOffset(t,e)}},{key:"setShadowColor",value:function(t){return this.style.setShadowColor(t)}},{key:"setShadowBlur",value:function(t){return this.style.setShadowBlur(t)}},{key:"setShadowStroke",value:function(t){return this.style.setShadowStroke(t)}},{key:"setShadowFill",value:function(t){return this.style.setShadowFill(t)}},{key:"setWrapMode",value:function(t){return this.style.setWrapMode(t)}},{key:"setWrapWidth",value:function(t){return this.style.setWrapWidth(t)}},{key:"setWordWrapWidth",value:function(t){return this.style.setWrapWidth(t)}},{key:"setAlign",value:function(t){return this.style.setHAlign(t)}},{key:"setHAlign",value:function(t){return this.style.setHAlign(t)}},{key:"setVAlign",value:function(t){return this.style.setVAlign(t)}},{key:"setLineSpacing",value:function(t){return this.style.setLineSpacing(t)}},{key:"lineSpacing",get:function(){return this.style.lineSpacing},set:function(t){this.setLineSpacing(t);}},{key:"setXOffset",value:function(t){return this.style.setXOffset(t)}},{key:"setMaxLines",value:function(t){return this.style.setMaxLines(t)}},{key:"setResolution",value:function(t){return this.style.setResolution(t)}},{key:"getTextMetrics",value:function(){return this.style.getTextMetrics()}},{key:"setTextMetrics",value:function(t,e){return this.style.setTextMetrics(t,e)}},{key:"measureTextMargins",value:function(t,e){return function(t,e,i){void 0===i&&(i={});var n=cc.create(this),r=n.getContext("2d",{willReadFrequently:!0});t.syncFont(n,r);var s=r.measureText(e),o=Math.ceil(s.width*t.baselineX),a=o,h=2*a;if(a=a*t.baselineY|0,n.width=o,n.height=h,r.fillStyle="#f00",r.fillRect(0,0,o,h),r.font=t._font,r.textBaseline="alphabetic",r.fillStyle="#000",r.fillText(t.testString,0,a),i.left=0,0===o||0===h||!r.getImageData(0,0,o,h))return cc.remove(n),i;for(var l=r.getImageData(0,0,o,h).data,u=!1,c=0;ch;u--){for(c=0;c0&&this.wrapMode!==xc&&0===this.wrapWidth}},{key:"setStyle",value:function(t,e,i){if(void 0===e&&(e=!0),void 0===i&&(i=!1),t&&t.hasOwnProperty("wrap")){var n=t.wrap;if(n.hasOwnProperty("mode")){var r=n.mode;"string"==typeof r&&(n.mode=Tc[r]);}else n.hasOwnProperty("width")&&(n.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 s=this.propertyMap;for(var o in s){var a=s[o],h=a[0],l=i?a[1]:this[o],u=a[2];if("wrapCallback"===o||"wrapCallbackScope"===o)this[o]=Pc(t,h,l);else {var c=Sc(t,h,l);u&&(c=u(c)),this[o]=c;}}var d=Pc(t,"font",null);this._font=null===d?this.fontStyle+" "+this.fontSize+" "+this.fontFamily:d;var f=Pc(t,"fill",null);null!==f&&(this.color=ga(f));var v=Pc(t,"metrics",!1);return v?this.metrics={ascent:Pc(v,"ascent",0),descent:Pc(v,"descent",0),fontSize:Pc(v,"fontSize",0)}:!e&&this.metrics||(this.metrics=gc(this)),e?this.parent.updateText():this.parent}},{key:"syncFont",value:function(t,e){e.font=this._font;}},{key:"syncStyle",value:function(t,e){e.textBaseline="alphabetic",e.fillStyle=this.color,e.strokeStyle=this.stroke,e.lineWidth=this.strokeThickness,e.lineCap="round",e.lineJoin="round";}},{key:"syncShadow",value:function(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);}},{key:"update",value:function(t){return t&&(this._font="".concat(this.fontStyle," ").concat(this.fontSize," ").concat(this.fontFamily).trim(),this.metrics=gc(this)),this.parent.updateText(t)}},{key:"buildFont",value:function(){var t="".concat(this.fontStyle," ").concat(this.fontSize," ").concat(this.fontFamily).trim();return t!==this._font&&(this._font=t),this}},{key:"setFont",value:function(t){return "string"==typeof t?(this.fontFamily=t,this.fontSize="",this.fontStyle=""):(this.fontFamily=Pc(t,"fontFamily","Courier"),this.fontSize=Pc(t,"fontSize","16px"),this.fontStyle=Pc(t,"fontStyle","")),this.update(!0)}},{key:"setFontFamily",value:function(t){return this.fontFamily=t,this.update(!0)}},{key:"setFontStyle",value:function(t){return this.fontStyle=t,this.update(!0)}},{key:"setFontSize",value:function(t){return "number"==typeof t&&(t=t.toString()+"px"),this.fontSize=t,this.update(!0)}},{key:"setTestString",value:function(t){return this.testString=t,this.update(!0)}},{key:"setFixedSize",value:function(t,e){return this.fixedWidth=t,this.fixedHeight=e,t&&(this.parent.width=t),e&&(this.parent.height=e),this.update(this.isWrapFitMode)}},{key:"setResolution",value:function(t){return this.resolution=t,this.update(!1)}},{key:"setLineSpacing",value:function(t){return this.lineSpacing=t,this.update(!1)}},{key:"setXOffset",value:function(t){return this.xOffset=t,this.update(!1)}},{key:"setBackgroundColor",value:function(t,e,i){return void 0===i&&(i=!0),this.backgroundColor=ga(t,this.parent.canvas,this.parent.context),this.backgroundColor2=ga(e,this.parent.canvas,this.parent.context),this.backgroundHorizontalGradient=i,this.update(!1)}},{key:"setBackgroundStrokeColor",value:function(t,e){return this.backgroundStrokeColor=ga(t,this.parent.canvas,this.parent.context),this.backgroundStrokeLineWidth=e,this.update(!1)}},{key:"setBackgroundCornerRadius",value:function(t,e){return this.backgroundCornerRadius=t,this.backgroundCornerIteration=e,this.update(!1)}},{key:"setFill",value:function(t){return this.color=ga(t,this.parent.canvas,this.parent.context),this.update(!1)}},{key:"setColor",value:function(t){return this.color=ga(t,this.parent.canvas,this.parent.context),this.update(!1)}},{key:"setStroke",value:function(t,e){return void 0===t?this.strokeThickness=0:(void 0===e&&(e=this.strokeThickness),this.stroke=ga(t,this.parent.canvas,this.parent.context),this.strokeThickness=e),this.update(!0)}},{key:"setShadow",value:function(t,e,i,n,r,s){return void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i="#000"),void 0===n&&(n=0),void 0===r&&(r=!1),void 0===s&&(s=!0),this.shadowOffsetX=t,this.shadowOffsetY=e,this.shadowColor=ga(i,this.parent.canvas,this.parent.context),this.shadowBlur=n,this.shadowStroke=r,this.shadowFill=s,this.update(!1)}},{key:"setShadowOffset",value:function(t,e){return void 0===t&&(t=0),void 0===e&&(e=t),this.shadowOffsetX=t,this.shadowOffsetY=e,this.update(!1)}},{key:"setShadowColor",value:function(t){return void 0===t&&(t="#000"),this.shadowColor=ga(t,this.parent.canvas,this.parent.context),this.update(!1)}},{key:"setShadowBlur",value:function(t){return void 0===t&&(t=0),this.shadowBlur=t,this.update(!1)}},{key:"setShadowStroke",value:function(t){return this.shadowStroke=t,this.update(!1)}},{key:"setShadowFill",value:function(t){return this.shadowFill=t,this.update(!1)}},{key:"setUnderline",value:function(t,e,i){return void 0===t&&(t="#000"),void 0===e&&(e=0),void 0===i&&(i=0),this.underlineColor=ga(t,this.parent.canvas,this.parent.context),this.underlineThickness=e,this.underlineOffset=i,this.update(!1)}},{key:"setUnderlineColor",value:function(t){return void 0===t&&(t="#000"),this.underlineColor=ga(t,this.parent.canvas,this.parent.context),this.update(!1)}},{key:"setUnderlineThickness",value:function(t){return void 0===t&&(t=0),this.underlineThickness=t,this.update(!1)}},{key:"setUnderlineOffset",value:function(t){return void 0===t&&(t=0),this.underlineOffset=t,this.update(!1)}},{key:"setStrikethrough",value:function(t,e,i){return void 0===t&&(t="#000"),void 0===e&&(e=0),void 0===i&&(i=0),this.strikethroughColor=ga(t,this.parent.canvas,this.parent.context),this.strikethroughThickness=e,this.strikethroughOffset=i,this.update(!1)}},{key:"setStrikethroughColor",value:function(t){return void 0===t&&(t="#000"),this.strikethroughColor=ga(t,this.parent.canvas,this.parent.context),this.update(!1)}},{key:"setStrikethroughThickness",value:function(t){return void 0===t&&(t=0),this.strikethroughThickness=t,this.update(!1)}},{key:"setStrikethroughOffset",value:function(t){return void 0===t&&(t=0),this.strikethroughOffset=t,this.update(!1)}},{key:"setWrapMode",value:function(t){return "string"==typeof t&&(t=Tc[t.toLowerCase()]||0),this.wrapMode=t,this.update(!0)}},{key:"setWrapWidth",value:function(t){return this.wrapWidth=t,this.update(!1)}},{key:"setAlign",value:function(t,e){return void 0===t&&(t="left"),void 0===e&&(e="top"),this.halign=t,this.valign=e,this.update(!1)}},{key:"setHAlign",value:function(t){return void 0===t&&(t="left"),this.halign=t,this.update(!1)}},{key:"setVAlign",value:function(t){return void 0===t&&(t="top"),this.valign=t,this.update(!1)}},{key:"setMaxLines",value:function(t){return void 0===t&&(t=0),this.maxLines=t,this.update(!1)}},{key:"getTextMetrics",value:function(){var t=this.metrics;return {ascent:t.ascent,descent:t.descent,fontSize:t.fontSize}}},{key:"setTextMetrics",value:function(t,e){return this.metrics.ascent=t.ascent,this.metrics.descent=t.descent,this.metrics.fontSize=t.fontSize,e&&("string"==typeof e?(this.fontFamily=e,this.fontSize="",this.fontStyle=""):(this.fontFamily=Pc(e,"fontFamily",this.fontFamily),this.fontSize=Pc(e,"fontSize",this.fontSize),this.fontStyle=Pc(e,"fontStyle",this.fontStyle))),this.parent.updateText(!0)}},{key:"lineHeight",get:function(){return this.metrics.fontSize+this.strokeThickness+this.lineSpacing}},{key:"toJSON",value:function(){var t={},e=this.propertyMap;for(var i in e)t[i]=this[i];return t.metrics=this.getTextMetrics(),t}},{key:"destroy",value:function(){this.parent=void 0;}}]),t}(),Tc={none:xc,word:bc,char:wc,character:wc},_c={draw:function(t,e,i,n){var r=this.penManager;this.hitAreaManager.clear();var s=this.context;s.save();var o=this.defaultStyle;this.clear(),Ca(this,o.backgroundColor,o.backgroundStrokeColor,o.backgroundStrokeLineWidth,o.backgroundCornerRadius,o.backgroundColor2,o.backgroundHorizontalGradient,o.backgroundCornerIteration),t+=this.startXOffset,e+=this.startYOffset;var a,h,l,u,c,d,f=o.halign,v=o.valign,p=o.lineHeight,g=r.lines,y=g.length,k=o.maxLines;k>0&&y>k?(h=k,l="center"===v?Math.floor((y-h)/2):"bottom"===v?y-h:0):(h=y,l=0),u=l+h;var m=this.rtl,x=m?this.parent.width:void 0;d="center"===v?Math.max((n-h*p)/2,0):"bottom"===v?Math.max(n-h*p-2,0):0,d+=e;for(var b=l;b0&&t.width>0){var a=i+o.underlineOffset-o.underlineThickness/2;this.drawLine(e,a,t.width,o.underlineThickness,o.underlineColor);}if(t.isTextPen&&this.drawText(e,i,t.text,o),t.isImagePen&&this.drawImage(e,i,t.prop.img,o),o.strikethroughThickness>0&&t.width>0){a=i+o.strikethroughOffset-o.strikethroughThickness/2;this.drawLine(e,a,t.width,o.strikethroughThickness,o.strikethroughColor);}if(s.restore(),t.hasAreaMarker&&t.width>0){var h,l=t.prop.area;if(l)h={key:l};else {var u=t.prop.url;h={key:"url:".concat(u),url:u};}this.hitAreaManager.add(e,i-this.startYOffset,t.width,this.defaultStyle.lineHeight,h);}},clear:function(){var t=this.canvas;this.context.clearRect(0,0,t.width,t.height);},drawLine:function(t,e,i,n,r){this.autoRound&&(t=Math.round(t),e=Math.round(e));var s=this.context,o=s.lineCap;s.lineCap="butt",s.strokeStyle=r,s.lineWidth=n,s.beginPath(),s.moveTo(t,e),s.lineTo(t+i,e),s.stroke(),s.lineCap=o;},drawText:function(t,e,i,n){this.autoRound&&(t=Math.round(t),e=Math.round(e));var r=this.context;n.stroke&&"none"!==n.stroke&&n.strokeThickness>0&&(n.syncShadow(r,n.shadowStroke),r.strokeText(i,t,e)),n.color&&"none"!==n.color&&(n.syncShadow(r,n.shadowFill),r.fillText(i,t,e));},drawImage:function(t,e,i,n){e-=this.startYOffset,this.parent.imageManager.draw(i,this.context,t,e,this.autoRound);}},Ec=Phaser.Utils.Objects.GetValue,Rc=yc,Mc=kc,Lc=function(){function t(i){e(this,t),this.prop={},this.resetFromJSON(i);}return n(t,[{key:"resetFromJSON",value:function(t){this.text=Ec(t,"text",""),this.x=Ec(t,"x",0),this.y=Ec(t,"y",0),this.width=Ec(t,"width",0);var e=Ec(t,"prop",null);null===e&&(e={}),this.prop=e,this.newLineMode=Ec(t,"newLineMode",0),this.startIndex=Ec(t,"startIndex",0);}},{key:"plainText",get:function(){var t=this.text;return this.newLineMode===Mc&&(t+="\n"),t}},{key:"wrapText",get:function(){var t=this.text;return this.newLineMode!==Rc&&(t+="\n"),t}},{key:"rawTextLength",get:function(){var t=this.text.length;return this.newLineMode===Mc&&(t+=1),t}},{key:"endIndex",get:function(){return this.startIndex+this.rawTextLength}},{key:"lastX",get:function(){return this.x+this.width}},{key:"isTextPen",get:function(){return ""!==this.text}},{key:"isImagePen",get:function(){return !!this.prop.img}},{key:"hasAreaMarker",get:function(){return !!this.prop.area||!!this.prop.url}}]),t}(),Dc=Phaser.Utils.Objects.GetFastValue,Ac=yc,zc=mc,jc=function(){function t(i){e(this,t),this.pens=[],this.lines=[],this.maxLinesWidth=void 0,this.pensPool=i.pensPool,this.linesPool=i.linesPool,this.tagToText=Dc(i,"tagToText",Qt),this.tagToTextScope=Dc(i,"tagToTextScope",void 0);}return n(t,[{key:"destroy",value:function(){this.clear(),this.tagToText=void 0,this.tagToTextScope=void 0;}},{key:"clear",value:function(){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}},{key:"getLineEndIndex",value:function(t){t>=this.lines.length&&(t=this.lines.length-1);var e,i,n=!1;for(e=t;e>=0&&!(n=null!=(i=this.lines[e])&&i.length>0);e--);return n?i[i.length-1].endIndex:0}},{key:"getLineWidth",value:function(t){var e=this.lines[t];if(!e)return 0;var i=e[e.length-1];return null==i?0:i.lastX}},{key:"getMaxLineWidth",value:function(){if(void 0!==this.maxLinesWidth)return this.maxLinesWidth;for(var t,e=0,i=0,n=this.lines.length;ie&&(e=t);return this.maxLinesWidth=e,e}},{key:"getLineWidths",value:function(){for(var t=[],e=0,i=this.lines.length;e=t&&h<=e||(o=o.substring(t-a,e-a)),this.tagToTextScope?c+=this.tagToText.call(this.tagToTextScope,o,l,u):c+=this.tagToText(o,l,u),u=l,!(h>=e)));d++);return c}},{key:"length",get:function(){return this.lines.length},set:function(t){this.clear();}}]),t}(),Fc={},Ic=Phaser.Geom.Rectangle,Wc=new bh,Bc=function(){function t(){e(this,t),this.hitAreas=[];}return n(t,[{key:"destroy",value:function(){this.clear();}},{key:"clear",value:function(){for(var t=0,e=this.hitAreas.length;tr){""!==S?a.push(o.getLine(S,P,Vc)):0===T&&s>0&&a.push(o.getLine("",0,Vc)),a.push.apply(a,v(t(x,i,Kc,r,0,o)));var E=a.pop();S=E.text,P=E.width,o.freeLine(E)," "===S&&(S="",P=0);}else (C=P+b)>l?(a.push(o.getLine(S,P,Vc)),S=x,P=b,l=r):(S+=x,P=C),w&&a.push(o.getLine(S,P,u));}return a},Qc=Phaser.Utils.Objects.GetValue,td=xc,ed=yc,id=function(){function t(i){e(this,t),this.parent=i.parent,this.scene=this.parent.scene,this.context=Qc(i,"context",null),this.canvas=this.context.canvas,this.parser=Qc(i,"parser",null),this.defaultStyle=Qc(i,"style",null),this.autoRound=!0,this.pensPool=i.pensPool,this.linesPool=i.linesPool,this.wrapTextLinesPool=i.wrapTextLinesPool,this.penManager=this.newPenManager(),this._tmpPenManager=null,this.hitAreaManager=new Bc,this.lastHitAreaKey=null,this.urlTagCursorStyle=null;var n=this.context;this.getTextWidth=function(t){return n.measureText(t).width};}return n(t,[{key:"destroy",value:function(){this.parent=void 0,this.scene=void 0,this.context=void 0,this.canvas=void 0,this.parser=void 0,this.defaultStyle=void 0,this.penManager&&(this.penManager.destroy(),this.penManager=void 0),this._tmpPenManager&&(this._tmpPenManager.destroy(),this._tmpPenManager=void 0),this.hitAreaManager&&(this.hitAreaManager.destroy(),this.hitAreaManager=void 0),this.pensPool=void 0,this.linesPool=void 0,this.wrapTextLinesPool=void 0;}},{key:"updatePenManager",value:function(t,e,i,n,r){if(void 0===r&&(r=this.penManager),r.clear(),""===t)return r;var s=this.parent.style;if(s.isWrapFitMode){var o=this.parent.padding;i=s.fixedWidth-o.left-o.right;}for(var a,h,l,u,c,d=this.canvas,f=this.context,v=function(t){return f.measureText(t).width},p=0,g=0,y=s.wrapCallback,k=s.wrapCallbackScope,m=!0,x=this.parser.splitText(t),b=this.wrapTextLinesPool,w=0,C=x.length;w0&&e!==td&&i0&&t>e&&(t=e),t}},{key:"linesWidth",get:function(){return Math.ceil(this.penManager.getMaxLineWidth())}},{key:"linesHeight",get:function(){var t=this.desplayLinesCount,e=this.defaultStyle.lineHeight*t;return t>0&&(e-=this.defaultStyle.lineSpacing),e}},{key:"imageManager",get:function(){return this.parent.imageManager}},{key:"rtl",get:function(){return this.parent.style.rtl}},{key:"newPenManager",value:function(){return new jc({pensPool:this.pensPool,linesPool:this.linesPool,tagToText:this.parser.propToTagText,tagToTextScope:this.parser})}},{key:"tmpPenManager",get:function(){return null===this._tmpPenManager&&(this._tmpPenManager=this.newPenManager()),this._tmpPenManager}},{key:"getPlainText",value:function(t,e,i){var n;if(null==t)n=this.penManager.plainText;else {var r=this.parser.splitText(t,1);n="";for(var s=0,o=r.length;sh;u--){for(c=0;c0&&this.wrapMode!==xc&&0===this.wrapWidth}},{key:"setStyle",value:function(t,e,i){if(void 0===e&&(e=!0),void 0===i&&(i=!1),t&&t.hasOwnProperty("wrap")){var n=t.wrap;if(n.hasOwnProperty("mode")){var r=n.mode;"string"==typeof r&&(n.mode=Tc[r]);}else n.hasOwnProperty("width")&&(n.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 s=this.propertyMap;for(var o in s){var a=s[o],h=a[0],l=i?a[1]:this[o],u=a[2];if("wrapCallback"===o||"wrapCallbackScope"===o)this[o]=Pc(t,h,l);else {var c=Sc(t,h,l);u&&(c=u(c)),this[o]=c;}}var d=Pc(t,"font",null);this._font=null===d?this.fontStyle+" "+this.fontSize+" "+this.fontFamily:d;var f=Pc(t,"fill",null);null!==f&&(this.color=ga(f));var v=Pc(t,"metrics",!1);return v?this.metrics={ascent:Pc(v,"ascent",0),descent:Pc(v,"descent",0),fontSize:Pc(v,"fontSize",0)}:!e&&this.metrics||(this.metrics=gc(this)),e?this.parent.updateText():this.parent}},{key:"syncFont",value:function(t,e){e.font=this._font;}},{key:"syncStyle",value:function(t,e){e.textBaseline="alphabetic",e.fillStyle=this.color,e.strokeStyle=this.stroke,e.lineWidth=this.strokeThickness,e.lineCap="round",e.lineJoin="round";}},{key:"syncShadow",value:function(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);}},{key:"update",value:function(t){return t&&(this._font="".concat(this.fontStyle," ").concat(this.fontSize," ").concat(this.fontFamily).trim(),this.metrics=gc(this)),this.parent.updateText(t)}},{key:"buildFont",value:function(){var t="".concat(this.fontStyle," ").concat(this.fontSize," ").concat(this.fontFamily).trim();return t!==this._font&&(this._font=t),this}},{key:"setFont",value:function(t){return "string"==typeof t?(this.fontFamily=t,this.fontSize="",this.fontStyle=""):(this.fontFamily=Pc(t,"fontFamily","Courier"),this.fontSize=Pc(t,"fontSize","16px"),this.fontStyle=Pc(t,"fontStyle","")),this.update(!0)}},{key:"setFontFamily",value:function(t){return this.fontFamily=t,this.update(!0)}},{key:"setFontStyle",value:function(t){return this.fontStyle=t,this.update(!0)}},{key:"setFontSize",value:function(t){return "number"==typeof t&&(t=t.toString()+"px"),this.fontSize=t,this.update(!0)}},{key:"setTestString",value:function(t){return this.testString=t,this.update(!0)}},{key:"setFixedSize",value:function(t,e){return this.fixedWidth=t,this.fixedHeight=e,t&&(this.parent.width=t),e&&(this.parent.height=e),this.update(this.isWrapFitMode)}},{key:"setResolution",value:function(t){return this.resolution=t,this.update(!1)}},{key:"setLineSpacing",value:function(t){return this.lineSpacing=t,this.update(!1)}},{key:"setXOffset",value:function(t){return this.xOffset=t,this.update(!1)}},{key:"setBackgroundColor",value:function(t,e,i){return void 0===i&&(i=!0),this.backgroundColor=ga(t,this.parent.canvas,this.parent.context),this.backgroundColor2=ga(e,this.parent.canvas,this.parent.context),this.backgroundHorizontalGradient=i,this.update(!1)}},{key:"setBackgroundStrokeColor",value:function(t,e){return this.backgroundStrokeColor=ga(t,this.parent.canvas,this.parent.context),this.backgroundStrokeLineWidth=e,this.update(!1)}},{key:"setBackgroundCornerRadius",value:function(t,e){return this.backgroundCornerRadius=t,this.backgroundCornerIteration=e,this.update(!1)}},{key:"setFill",value:function(t){return this.color=ga(t,this.parent.canvas,this.parent.context),this.update(!1)}},{key:"setColor",value:function(t){return this.color=ga(t,this.parent.canvas,this.parent.context),this.update(!1)}},{key:"setStroke",value:function(t,e){return void 0===t?this.strokeThickness=0:(void 0===e&&(e=this.strokeThickness),this.stroke=ga(t,this.parent.canvas,this.parent.context),this.strokeThickness=e),this.update(!0)}},{key:"setShadow",value:function(t,e,i,n,r,s){return void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i="#000"),void 0===n&&(n=0),void 0===r&&(r=!1),void 0===s&&(s=!0),this.shadowOffsetX=t,this.shadowOffsetY=e,this.shadowColor=ga(i,this.parent.canvas,this.parent.context),this.shadowBlur=n,this.shadowStroke=r,this.shadowFill=s,this.update(!1)}},{key:"setShadowOffset",value:function(t,e){return void 0===t&&(t=0),void 0===e&&(e=t),this.shadowOffsetX=t,this.shadowOffsetY=e,this.update(!1)}},{key:"setShadowColor",value:function(t){return void 0===t&&(t="#000"),this.shadowColor=ga(t,this.parent.canvas,this.parent.context),this.update(!1)}},{key:"setShadowBlur",value:function(t){return void 0===t&&(t=0),this.shadowBlur=t,this.update(!1)}},{key:"setShadowStroke",value:function(t){return this.shadowStroke=t,this.update(!1)}},{key:"setShadowFill",value:function(t){return this.shadowFill=t,this.update(!1)}},{key:"setUnderline",value:function(t,e,i){return void 0===t&&(t="#000"),void 0===e&&(e=0),void 0===i&&(i=0),this.underlineColor=ga(t,this.parent.canvas,this.parent.context),this.underlineThickness=e,this.underlineOffset=i,this.update(!1)}},{key:"setUnderlineColor",value:function(t){return void 0===t&&(t="#000"),this.underlineColor=ga(t,this.parent.canvas,this.parent.context),this.update(!1)}},{key:"setUnderlineThickness",value:function(t){return void 0===t&&(t=0),this.underlineThickness=t,this.update(!1)}},{key:"setUnderlineOffset",value:function(t){return void 0===t&&(t=0),this.underlineOffset=t,this.update(!1)}},{key:"setStrikethrough",value:function(t,e,i){return void 0===t&&(t="#000"),void 0===e&&(e=0),void 0===i&&(i=0),this.strikethroughColor=ga(t,this.parent.canvas,this.parent.context),this.strikethroughThickness=e,this.strikethroughOffset=i,this.update(!1)}},{key:"setStrikethroughColor",value:function(t){return void 0===t&&(t="#000"),this.strikethroughColor=ga(t,this.parent.canvas,this.parent.context),this.update(!1)}},{key:"setStrikethroughThickness",value:function(t){return void 0===t&&(t=0),this.strikethroughThickness=t,this.update(!1)}},{key:"setStrikethroughOffset",value:function(t){return void 0===t&&(t=0),this.strikethroughOffset=t,this.update(!1)}},{key:"setWrapMode",value:function(t){return "string"==typeof t&&(t=Tc[t.toLowerCase()]||0),this.wrapMode=t,this.update(!0)}},{key:"setWrapWidth",value:function(t){return this.wrapWidth=t,this.update(!1)}},{key:"setAlign",value:function(t,e){return void 0===t&&(t="left"),void 0===e&&(e="top"),this.halign=t,this.valign=e,this.update(!1)}},{key:"setHAlign",value:function(t){return void 0===t&&(t="left"),this.halign=t,this.update(!1)}},{key:"setVAlign",value:function(t){return void 0===t&&(t="top"),this.valign=t,this.update(!1)}},{key:"setMaxLines",value:function(t){return void 0===t&&(t=0),this.maxLines=t,this.update(!1)}},{key:"getTextMetrics",value:function(){var t=this.metrics;return {ascent:t.ascent,descent:t.descent,fontSize:t.fontSize}}},{key:"setTextMetrics",value:function(t,e){return this.metrics.ascent=t.ascent,this.metrics.descent=t.descent,this.metrics.fontSize=t.fontSize,e&&("string"==typeof e?(this.fontFamily=e,this.fontSize="",this.fontStyle=""):(this.fontFamily=Pc(e,"fontFamily",this.fontFamily),this.fontSize=Pc(e,"fontSize",this.fontSize),this.fontStyle=Pc(e,"fontStyle",this.fontStyle))),this.parent.updateText(!0)}},{key:"lineHeight",get:function(){return this.metrics.fontSize+this.strokeThickness+this.lineSpacing}},{key:"toJSON",value:function(){var t={},e=this.propertyMap;for(var i in e)t[i]=this[i];return t.metrics=this.getTextMetrics(),t}},{key:"destroy",value:function(){this.parent=void 0;}}]),t}(),Tc={none:xc,word:bc,char:wc,character:wc},_c={draw:function(t,e,i,n){var r=this.penManager;this.hitAreaManager.clear();var s=this.context;s.save();var o=this.defaultStyle;this.clear(),Ca(this,o.backgroundColor,o.backgroundStrokeColor,o.backgroundStrokeLineWidth,o.backgroundCornerRadius,o.backgroundColor2,o.backgroundHorizontalGradient,o.backgroundCornerIteration),t+=this.startXOffset,e+=this.startYOffset;var a,h,l,u,c,d,f=o.halign,v=o.valign,p=o.lineHeight,g=r.lines,y=g.length,k=o.maxLines;k>0&&y>k?(h=k,l="center"===v?Math.floor((y-h)/2):"bottom"===v?y-h:0):(h=y,l=0),u=l+h;var m=this.rtl,x=m?this.parent.width:void 0;d="center"===v?Math.max((n-h*p)/2,0):"bottom"===v?Math.max(n-h*p-2,0):0,d+=e;for(var b=l;b0&&t.width>0){var a=i+o.underlineOffset-o.underlineThickness/2;this.drawLine(e,a,t.width,o.underlineThickness,o.underlineColor);}if(t.isTextPen&&this.drawText(e,i,t.text,o),t.isImagePen&&this.drawImage(e,i,t.prop.img,o),o.strikethroughThickness>0&&t.width>0){a=i+o.strikethroughOffset-o.strikethroughThickness/2;this.drawLine(e,a,t.width,o.strikethroughThickness,o.strikethroughColor);}if(s.restore(),t.hasAreaMarker&&t.width>0){var h,l=t.prop.area;if(l)h={key:l};else {var u=t.prop.url;h={key:"url:".concat(u),url:u};}this.hitAreaManager.add(e,i-this.startYOffset,t.width,this.defaultStyle.lineHeight,h);}},clear:function(){var t=this.canvas;this.context.clearRect(0,0,t.width,t.height);},drawLine:function(t,e,i,n,r){this.autoRound&&(t=Math.round(t),e=Math.round(e));var s=this.context,o=s.lineCap;s.lineCap="butt",s.strokeStyle=r,s.lineWidth=n,s.beginPath(),s.moveTo(t,e),s.lineTo(t+i,e),s.stroke(),s.lineCap=o;},drawText:function(t,e,i,n){this.autoRound&&(t=Math.round(t),e=Math.round(e));var r=this.context;n.stroke&&"none"!==n.stroke&&n.strokeThickness>0&&(n.syncShadow(r,n.shadowStroke),r.strokeText(i,t,e)),n.color&&"none"!==n.color&&(n.syncShadow(r,n.shadowFill),r.fillText(i,t,e));},drawImage:function(t,e,i,n){e-=this.startYOffset,this.parent.imageManager.draw(i,this.context,t,e,this.autoRound);}},Ec=Phaser.Utils.Objects.GetValue,Rc=yc,Mc=kc,Lc=function(){function t(i){e(this,t),this.prop={},this.resetFromJSON(i);}return n(t,[{key:"resetFromJSON",value:function(t){this.text=Ec(t,"text",""),this.x=Ec(t,"x",0),this.y=Ec(t,"y",0),this.width=Ec(t,"width",0);var e=Ec(t,"prop",null);null===e&&(e={}),this.prop=e,this.newLineMode=Ec(t,"newLineMode",0),this.startIndex=Ec(t,"startIndex",0);}},{key:"plainText",get:function(){var t=this.text;return this.newLineMode===Mc&&(t+="\n"),t}},{key:"wrapText",get:function(){var t=this.text;return this.newLineMode!==Rc&&(t+="\n"),t}},{key:"rawTextLength",get:function(){var t=this.text.length;return this.newLineMode===Mc&&(t+=1),t}},{key:"endIndex",get:function(){return this.startIndex+this.rawTextLength}},{key:"lastX",get:function(){return this.x+this.width}},{key:"isTextPen",get:function(){return ""!==this.text}},{key:"isImagePen",get:function(){return !!this.prop.img}},{key:"hasAreaMarker",get:function(){return !!this.prop.area||!!this.prop.url}}]),t}(),Dc=Phaser.Utils.Objects.GetFastValue,Ac=yc,zc=mc,jc=function(){function t(i){e(this,t),this.pens=[],this.lines=[],this.maxLinesWidth=void 0,this.pensPool=i.pensPool,this.linesPool=i.linesPool,this.tagToText=Dc(i,"tagToText",Qt),this.tagToTextScope=Dc(i,"tagToTextScope",void 0);}return n(t,[{key:"destroy",value:function(){this.clear(),this.tagToText=void 0,this.tagToTextScope=void 0;}},{key:"clear",value:function(){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}},{key:"getLineEndIndex",value:function(t){t>=this.lines.length&&(t=this.lines.length-1);var e,i,n=!1;for(e=t;e>=0&&!(n=null!=(i=this.lines[e])&&i.length>0);e--);return n?i[i.length-1].endIndex:0}},{key:"getLineWidth",value:function(t){var e=this.lines[t];if(!e)return 0;var i=e[e.length-1];return null==i?0:i.lastX}},{key:"getMaxLineWidth",value:function(){if(void 0!==this.maxLinesWidth)return this.maxLinesWidth;for(var t,e=0,i=0,n=this.lines.length;ie&&(e=t);return this.maxLinesWidth=e,e}},{key:"getLineWidths",value:function(){for(var t=[],e=0,i=this.lines.length;e=t&&h<=e||(o=o.substring(t-a,e-a)),this.tagToTextScope?c+=this.tagToText.call(this.tagToTextScope,o,l,u):c+=this.tagToText(o,l,u),u=l,!(h>=e)));d++);return c}},{key:"length",get:function(){return this.lines.length},set:function(t){this.clear();}}]),t}(),Fc={},Wc=Phaser.Geom.Rectangle,Ic=new bh,Bc=function(){function t(){e(this,t),this.hitAreas=[];}return n(t,[{key:"destroy",value:function(){this.clear();}},{key:"clear",value:function(){for(var t=0,e=this.hitAreas.length;tr){""!==S?a.push(o.getLine(S,P,Vc)):0===T&&s>0&&a.push(o.getLine("",0,Vc)),a.push.apply(a,v(t(x,i,Kc,r,0,o)));var E=a.pop();S=E.text,P=E.width,o.freeLine(E)," "===S&&(S="",P=0);}else (C=P+b)>l?(a.push(o.getLine(S,P,Vc)),S=x,P=b,l=r):(S+=x,P=C),w&&a.push(o.getLine(S,P,u));}return a},Qc=Phaser.Utils.Objects.GetValue,td=xc,ed=yc,id=function(){function t(i){e(this,t),this.parent=i.parent,this.scene=this.parent.scene,this.context=Qc(i,"context",null),this.canvas=this.context.canvas,this.parser=Qc(i,"parser",null),this.defaultStyle=Qc(i,"style",null),this.autoRound=!0,this.pensPool=i.pensPool,this.linesPool=i.linesPool,this.wrapTextLinesPool=i.wrapTextLinesPool,this.penManager=this.newPenManager(),this._tmpPenManager=null,this.hitAreaManager=new Bc,this.lastHitAreaKey=null,this.urlTagCursorStyle=null;var n=this.context;this.getTextWidth=function(t){return n.measureText(t).width};}return n(t,[{key:"destroy",value:function(){this.parent=void 0,this.scene=void 0,this.context=void 0,this.canvas=void 0,this.parser=void 0,this.defaultStyle=void 0,this.penManager&&(this.penManager.destroy(),this.penManager=void 0),this._tmpPenManager&&(this._tmpPenManager.destroy(),this._tmpPenManager=void 0),this.hitAreaManager&&(this.hitAreaManager.destroy(),this.hitAreaManager=void 0),this.pensPool=void 0,this.linesPool=void 0,this.wrapTextLinesPool=void 0;}},{key:"updatePenManager",value:function(t,e,i,n,r){if(void 0===r&&(r=this.penManager),r.clear(),""===t)return r;var s=this.parent.style;if(s.isWrapFitMode){var o=this.parent.padding;i=s.fixedWidth-o.left-o.right;}for(var a,h,l,u,c,d=this.canvas,f=this.context,v=function(t){return f.measureText(t).width},p=0,g=0,y=s.wrapCallback,k=s.wrapCallbackScope,m=!0,x=this.parser.splitText(t),b=this.wrapTextLinesPool,w=0,C=x.length;w0&&e!==td&&i0&&t>e&&(t=e),t}},{key:"linesWidth",get:function(){return Math.ceil(this.penManager.getMaxLineWidth())}},{key:"linesHeight",get:function(){var t=this.desplayLinesCount,e=this.defaultStyle.lineHeight*t;return t>0&&(e-=this.defaultStyle.lineSpacing),e}},{key:"imageManager",get:function(){return this.parent.imageManager}},{key:"rtl",get:function(){return this.parent.style.rtl}},{key:"newPenManager",value:function(){return new jc({pensPool:this.pensPool,linesPool:this.linesPool,tagToText:this.parser.propToTagText,tagToTextScope:this.parser})}},{key:"tmpPenManager",get:function(){return null===this._tmpPenManager&&(this._tmpPenManager=this.newPenManager()),this._tmpPenManager}},{key:"getPlainText",value:function(t,e,i){var n;if(null==t)n=this.penManager.plainText;else {var r=this.parser.splitText(t,1);n="";for(var s=0,o=r.length;s * @copyright 2018 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */Object.assign(id.prototype,_c,nd);var rd=function(t){r(s,t);var i=l(s);function s(){return e(this,s),i.apply(this,arguments)}return n(s,[{key:"freeLine",value:function(t){if(t)return this.push(t),this}},{key:"freeLines",value:function(t){if(t)return this.pushMultiple(t),this}},{key:"getLine",value:function(t,e,i){var n=this.pop();return null===n&&(n={}),n.text=t,n.width=e,n.newLineMode=i,n}}]),s}(bh),sd=Phaser.Utils.Objects.IsPlainObject,od=Phaser.Utils.Objects.GetValue,ad=function(t,e){sd(t)?t=(e=t).key:void 0===e&&(e={key:t}),e.hasOwnProperty("key")||(e.key=t);var i=e.key,n=e.frame,r=e.width,s=e.height;if(void 0===r||void 0===s){var o=this.textureManager.getFrame(i,n),a=o?o.cutWidth:0,h=o?o.cutHeight:0;void 0===r&&void 0===s?(r=a,s=h):void 0===r?r=a*(s/h):void 0===s&&(s=h*(r/a));}this.images[t]={key:i,frame:n,width:r,height:s,y:od(e,"y",0),left:od(e,"left",0),right:od(e,"right",0),originX:od(e,"originX",0),originY:od(e,"originY",0)};},hd=function(){function t(i){e(this,t),this.textureManager=i.sys.textures,this.images={};}return n(t,[{key:"destroy",value:function(){this.textureManager=void 0,this.images=void 0;}},{key:"add",value:function(t,e){if("string"==typeof t)ad.call(this,t,e);else if(Array.isArray(t))for(var i=0,n=(r=t).length;i0&&{height:this.colorComponentsHeight,formatLabel:this.colorComponentsFormatLabelConfig,inputText:this.colorComponentsInputTextConfig,space:this.colorComponentsSpace};var o=new cf(t,{width:n,height:s,background:e,space:this.colorPickerSpace,hPalette:{position:this.colorPickerHPalettePosition},colorComponents:r,value:this.value});return t.add.existing(o),o},ff=Phaser.Utils.Objects.GetValue,vf=function(t,e){var i=ff(e,"expandDirection",void 0);"string"==typeof i&&(i=pf[i]);var n,r,s,a,h,l,u=(s="alignTargetX",Vh(n=e,r="alignTarget")?Cn(n,r):s&&Vh(n,s)?Cn(n,s):a),c=ff(e,"alignTargetY",u),d=ff(e,"alignOffsetX",0),f=ff(e,"alignOffsetY",0),v=ff(e,"alignSide","").includes("right"),p=ff(e,"bounds"),g=0===i,y=!g&&!(1===i),k=v?1:0,m=g||y?0:1;t.setOrigin(k,m),h=v?u.getTopRight().x:u.getTopLeft().x,l=c.getBottomLeft().y,t.setPosition(h+d,l+f);var x=p;x||(x=qt(t.scene)),y&&t.getBottomLeft().y>x.bottom&&(l=c.getTopLeft().y,t.setOrigin(0,1).setPosition(h+d,l+f));},pf={down:0,up:1},gf=Phaser.Utils.Objects.GetValue,yf=function(t){r(o,t);var i=l(o);function o(t,n){var r;e(this,o),void 0===n&&(n={}),null==n.transitIn&&(n.transitIn=function(t,e){Ei(t,e,"y","Cubic");}),null==n.transitOut&&(n.transitOut=function(t,e){!function(t,e,i,n,r){void 0===n&&(n="Linear");var s={mode:0};switch(i){case 0:case"x":s.end={x:0};break;case 1:case"y":s.end={y:0};break;default:s.end=0;}s.duration=e,s.ease=n,void 0===r?r=new Ti(t,s):r.resetFromJSON(s),r.restart();}(t,e,"y","Linear");}),n.manualClose=!0,n.clickOutsideClose=!0,n.destroy=!0,r=i.call(this,t,n),vf(t,n),t.isRexSizer&&t.layout();var s=gf(n,"touchOutsideClose",!1),h=gf(n,"anyTouchClose",!1);return h&&(s=!1),h?r.once("open",r.anyTouchClose,a(r)):s&&r.once("open",r.touchOutsideClose,a(r)),r.requestOpen(),r}return n(o,[{key:"shutdown",value:function(t){this.isShutdown||(this.scene.input.off("pointerup",this.touchCloseCallback,this),c(s(o.prototype),"shutdown",this).call(this,t));}},{key:"touchOutsideClose",value:function(){return this.scene.input.on("pointerup",this.touchCloseCallback,this),this.clickOutsideTest=!0,this}},{key:"anyTouchClose",value:function(){return this.scene.input.once("pointerup",this.touchCloseCallback,this),this}},{key:"touchCloseCallback",value:function(t){this.clickOutsideTest&&qn(this.parent,t.worldX,t.worldY)||this.requestClose();}},{key:"onOpen",value:function(){this.emit("open",this.parent,this),c(s(o.prototype),"onOpen",this).call(this);}},{key:"onClose",value:function(){this.emit("close",this.parent,this),c(s(o.prototype),"onClose",this).call(this);}}]),o}(jn),kf={openColorPicker:function(){if(!this.colorPicker){var t=df.call(this).layout(),e=new yf(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(kf,Ll);var mf=Phaser.Utils.Objects.GetValue,xf=function(t){r(s,t);var i=l(s);function s(t,n){var r;e(this,s),void 0===n&&(n={}),(r=i.call(this,t,n)).type="rexColorInput",n.hasOwnProperty("colorPicker")||(n.colorPicker={background:{color:0}});var o=n.colorPicker,h=!1!==o&&null!==o;if(h){var l;r.setColorPickerSize(mf(o,"width",160),mf(o,"height",170));var u=mf(o,"background");l=u?function(t){return sc(t,u)}:mf(o,"createBackgroundCallback"),r.setCreateColorPickerBackgroundCallback(l),r.setColorPickerHPalettePosition(mf(o,"hPalettePosition",0)),r.setColorPickerExpandDirection(mf(o,"expandDirection")),r.setColorPickerEaseInDuration(mf(o,"easeIn",200)),r.setColorPickerEaseOutDuration(mf(o,"easeOut",200)),r.setColorPickerTransitInCallback(mf(o,"transitIn")),r.setColorPickerTransitOutCallback(mf(o,"transitOut")),r.setColorPickerBounds(mf(o,"bounds"));var c=mf(o,"space");void 0===c&&(c={left:10,right:10,top:10,bottom:10,item:8}),r.setColorPickerSpace(c);}var d=n.colorComponents;if(h&&(!1!==d&&null!==d)){r.setColorComponentsHeight(mf(d,"height",30)),r.setColorComponentsFormatLabelConfig(mf(d,"formatLabel"));var f=mf(d,"inputText");f||(f=mf(n,"inputText")),r.setColorComponentsInputTextConfig(f);var v=mf(d,"space");void 0===v&&(v={item:8}),r.setColorComponentsSpace(v);}var p=r.childrenMap.swatch;return p&&h&&r.onClick(p,r.openColorPicker,a(r)),r}return n(s)}(Ml);return Object.assign(xf.prototype,kf),xf})); + */Object.assign(id.prototype,_c,nd);var rd=function(t){r(s,t);var i=l(s);function s(){return e(this,s),i.apply(this,arguments)}return n(s,[{key:"freeLine",value:function(t){if(t)return this.push(t),this}},{key:"freeLines",value:function(t){if(t)return this.pushMultiple(t),this}},{key:"getLine",value:function(t,e,i){var n=this.pop();return null===n&&(n={}),n.text=t,n.width=e,n.newLineMode=i,n}}]),s}(bh),sd=Phaser.Utils.Objects.IsPlainObject,od=Phaser.Utils.Objects.GetValue,ad=function(t,e){sd(t)?t=(e=t).key:void 0===e&&(e={key:t}),e.hasOwnProperty("key")||(e.key=t);var i=e.key,n=e.frame,r=e.width,s=e.height;if(void 0===r||void 0===s){var o=this.textureManager.getFrame(i,n),a=o?o.cutWidth:0,h=o?o.cutHeight:0;void 0===r&&void 0===s?(r=a,s=h):void 0===r?r=a*(s/h):void 0===s&&(s=h*(r/a));}this.images[t]={key:i,frame:n,width:r,height:s,y:od(e,"y",0),left:od(e,"left",0),right:od(e,"right",0),originX:od(e,"originX",0),originY:od(e,"originY",0)};},hd=function(){function t(i){e(this,t),this.textureManager=i.sys.textures,this.images={};}return n(t,[{key:"destroy",value:function(){this.textureManager=void 0,this.images=void 0;}},{key:"add",value:function(t,e){if("string"==typeof t)ad.call(this,t,e);else if(Array.isArray(t))for(var i=0,n=(r=t).length;i0&&{height:this.colorComponentsHeight,formatLabel:this.colorComponentsFormatLabelConfig,inputText:this.colorComponentsInputTextConfig,space:this.colorComponentsSpace};var o=new cf(t,{width:n,height:s,background:e,space:this.colorPickerSpace,hPalette:{position:this.colorPickerHPalettePosition},colorComponents:r,value:this.value});return t.add.existing(o),o},ff=Phaser.Utils.Objects.GetValue,vf=function(t,e){var i=ff(e,"expandDirection",void 0);"string"==typeof i&&(i=pf[i]);var n,r,s,a,h,l,u=(s="alignTargetX",Vh(n=e,r="alignTarget")?Cn(n,r):s&&Vh(n,s)?Cn(n,s):a),c=ff(e,"alignTargetY",u),d=ff(e,"alignOffsetX",0),f=ff(e,"alignOffsetY",0),v=ff(e,"alignSide","").includes("right"),p=ff(e,"bounds"),g=0===i,y=!g&&!(1===i),k=v?1:0,m=g||y?0:1;t.setOrigin(k,m),h=v?u.getTopRight().x:u.getTopLeft().x,l=c.getBottomLeft().y,t.setPosition(h+d,l+f);var x=p;x||(x=qt(t.scene)),y&&t.getBottomLeft().y>x.bottom&&(l=c.getTopLeft().y,t.setOrigin(0,1).setPosition(h+d,l+f));},pf={down:0,up:1},gf=Phaser.Utils.Objects.GetValue,yf=function(t){r(o,t);var i=l(o);function o(t,n){var r;e(this,o),void 0===n&&(n={}),null==n.transitIn&&(n.transitIn=function(t,e){Ei(t,e,"y","Cubic");}),null==n.transitOut&&(n.transitOut=function(t,e){!function(t,e,i,n,r){void 0===n&&(n="Linear");var s={mode:0};switch(i){case 0:case"x":s.end={x:0};break;case 1:case"y":s.end={y:0};break;default:s.end=0;}s.duration=e,s.ease=n,void 0===r?r=new Ti(t,s):r.resetFromJSON(s),r.restart();}(t,e,"y","Linear");}),n.manualClose=!0,n.clickOutsideClose=!0,n.destroy=!0,r=i.call(this,t,n),vf(t,n),t.isRexSizer&&t.layout();var s=gf(n,"touchOutsideClose",!1),h=gf(n,"anyTouchClose",!1);return h&&(s=!1),h?r.once("open",r.anyTouchClose,a(r)):s&&r.once("open",r.touchOutsideClose,a(r)),r.requestOpen(),r}return n(o,[{key:"shutdown",value:function(t){this.isShutdown||(this.scene.input.off("pointerup",this.touchCloseCallback,this),c(s(o.prototype),"shutdown",this).call(this,t));}},{key:"touchOutsideClose",value:function(){return this.scene.input.on("pointerup",this.touchCloseCallback,this),this.clickOutsideTest=!0,this}},{key:"anyTouchClose",value:function(){return this.scene.input.once("pointerup",this.touchCloseCallback,this),this}},{key:"touchCloseCallback",value:function(t){this.clickOutsideTest&&qn(this.parent,t.worldX,t.worldY)||this.requestClose();}},{key:"onOpen",value:function(){this.emit("open",this.parent,this),c(s(o.prototype),"onOpen",this).call(this);}},{key:"onClose",value:function(){this.emit("close",this.parent,this),c(s(o.prototype),"onClose",this).call(this);}}]),o}(jn),kf={openColorPicker:function(){if(!this.colorPicker){var t=df.call(this).layout(),e=new yf(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(kf,Ll);var mf=Phaser.Utils.Objects.GetValue,xf=function(t){r(s,t);var i=l(s);function s(t,n){var r;e(this,s),void 0===n&&(n={}),(r=i.call(this,t,n)).type="rexColorInput",n.hasOwnProperty("colorPicker")||(n.colorPicker={background:{color:0}});var o=n.colorPicker,h=!1!==o&&null!==o;if(h){var l;r.setColorPickerSize(mf(o,"width",160),mf(o,"height",170));var u=mf(o,"background");l=u?function(t){return sc(t,u)}:mf(o,"createBackgroundCallback"),r.setCreateColorPickerBackgroundCallback(l),r.setColorPickerHPalettePosition(mf(o,"hPalettePosition",0)),r.setColorPickerExpandDirection(mf(o,"expandDirection")),r.setColorPickerEaseInDuration(mf(o,"easeIn",200)),r.setColorPickerEaseOutDuration(mf(o,"easeOut",200)),r.setColorPickerTransitInCallback(mf(o,"transitIn")),r.setColorPickerTransitOutCallback(mf(o,"transitOut")),r.setColorPickerBounds(mf(o,"bounds"));var c=mf(o,"space");void 0===c&&(c={left:10,right:10,top:10,bottom:10,item:8}),r.setColorPickerSpace(c);}var d=n.colorComponents;if(h&&(!1!==d&&null!==d)){r.setColorComponentsHeight(mf(d,"height",30)),r.setColorComponentsFormatLabelConfig(mf(d,"formatLabel"));var f=mf(d,"inputText");f||(f=mf(n,"inputText")),r.setColorComponentsInputTextConfig(f);var v=mf(d,"space");void 0===v&&(v={item:8}),r.setColorComponentsSpace(v);}var p=r.childrenMap.swatch;return p&&h&&r.onClick(p,r.openColorPicker,a(r)),r}return n(s)}(Ml);return Object.assign(xf.prototype,kf),xf})); diff --git a/dist/rexconfirmdialog.js b/dist/rexconfirmdialog.js index 4af4195f0f..19b4e136da 100644 --- a/dist/rexconfirmdialog.js +++ b/dist/rexconfirmdialog.js @@ -22987,36 +22987,9 @@ return GetBobWorldPosition(this.parent, this, offsetX, offsetY, out); }; - var ScrollTo = function ScrollTo() { - var textObject = this.parent; - var dx, dy; - var childLeftX = this.drawX + this.drawTLX; - var childRightX = childLeftX + this.width; - if (childLeftX < 0) { - dx = 0 - childLeftX; - } else if (childRightX > textObject.width) { - dx = textObject.width - childRightX; - } else { - dx = 0; - } - var childTopY = this.drawY + this.drawTLY; - var childBottomY = childTopY + this.height; - if (childTopY < 0) { - dy = 0 - childTopY; - } else if (childBottomY > textObject.height) { - dy = textObject.height - childBottomY; - } else { - dy = 0; - } - textObject._textOX += dx; - textObject._textOY += dy; - return this; - }; - var Methods$4 = { contains: Contains, - getWorldPosition: GetWorldPosition, - scrollTo: ScrollTo + getWorldPosition: GetWorldPosition }; Object.assign(Methods$4, RenderMethods); @@ -25606,7 +25579,6 @@ return this; } this._textOX = ox; - this.updateTexture(); return this; }, setTextOY: function setTextOY(oy) { @@ -25614,7 +25586,6 @@ return this; } this._textOY = oy; - this.updateTexture(); return this; }, setTextOXY: function setTextOXY(ox, oy) { @@ -25623,7 +25594,6 @@ } this._textOX = ox; this._textOY = oy; - this.updateTexture(); return this; }, addTextOX: function addTextOX(incX) { @@ -29939,7 +29909,6 @@ if (config === undefined) { config = {}; } - config.scrollMode = 0; // Create text-block var textObject = GetValue$3(config, 'text', undefined); diff --git a/dist/rexconfirmdialog.min.js b/dist/rexconfirmdialog.min.js index a6cd566067..7fa3ce5204 100644 --- a/dist/rexconfirmdialog.min.js +++ b/dist/rexconfirmdialog.min.js @@ -1,7 +1,7 @@ -!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).rexconfirmdialog=e();}(undefined,(function(){function t(e){return t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},t(e)}function e(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){for(var i=0;it.length)&&(e=t.length);for(var i=0,n=new Array(e);i=0;i--)(e=this.children[i]).parentContainer||e.displayList||e.destroy(t);this.clear(!t),c(s(o.prototype),"destroy",this).call(this,t);}}},{key:"contains",value:function(t){return -1!==this.children.indexOf(t)}},{key:"add",value:function(t){var e=this;return b(this.children,t,0,(function(t){t.once("destroy",e.onChildDestroy,e);}),this),this}},{key:"remove",value:function(t,e){var i=this;return x(this.children,t,(function(t){t.off("destroy",i.onChildDestroy,i),e&&t.destroy();})),this}},{key:"onChildDestroy",value:function(t,e){this.remove(t,!1);}},{key:"clear",value:function(t){for(var e,i=0,n=this.children.length;i0;){var n=i.shift();!e(n)&&n.isRexContainerLite&&i.push.apply(i,p(n.children));}},it=Phaser.Utils.Array,nt={getChildren:function(t){if(t)for(var e=0,i=this.children.length;e=0;e--)this.remove(this.backgroundChildren[e],t);return this}},Xe=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},Ie=/(\S+)\[(\d+)\]/i,Fe=Phaser.Utils.Objects.GetValue,He=function(t,e){return void 0===e?t:t[e]},Ne=function(e,i,n){void 0===e&&(e={}),void 0===i&&(i=0);var r=t(i);return "string"===r?e[i]=n:"number"===r?(e.left=i,e.right=i,e.top=i,e.bottom=i):(e.left=Fe(i,"left",0),e.right=Fe(i,"right",0),e.top=Fe(i,"top",0),e.bottom=Fe(i,"bottom",0)),e},Ge={getInnerPadding:function(t){return He(this.space,t)},setInnerPadding:function(t,e){return Ne(this.space,t,e),this},getOuterPadding:function(t){return He(this.getSizerConfig(this).padding,t)},setOuterPadding:function(t,e){return Ne(this.getSizerConfig(this).padding,t,e),this},getChildOuterPadding:function(t,e){return "string"==typeof t&&(t=this.getElement(t)),He(this.getSizerConfig(t).padding,e)},setChildOuterPadding:function(t,e,i){return "string"==typeof t&&(t=this.getElement(t)),Ne(this.getSizerConfig(t).padding,e,i),this}},Ve=function(t){var e=this.childrenWidth,i=void 0!==this.minWidth?this.minWidth:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn("Layout width warn: ".concat(this.constructor.name,"'s minWidth (").concat(i,") < childrenWidth (").concat(e,")"))):this.layoutWarnEnable&&(i>t||e>t)&&console.warn("Layout width warn: ".concat(this.constructor.name,"'s minWidth (").concat(i,") or childrenWidth (").concat(e," > targetWidth ").concat(t,")")),t},Ue=function(t){var e=this.childrenHeight,i=void 0!==this.minHeight?this.minHeight:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn("Layout height warn: ".concat(this.constructor.name,"'s minHeight (").concat(i,") < childrenHeight (").concat(e,")"))):this.layoutWarnEnable&&(i>t||e>t)&&console.warn("Layout height warn: ".concat(this.constructor.name,"'s minHeight (").concat(i,") or childrenHeight (").concat(e,") > targetHeight (").concat(t,")")),t},Je={getShownChildren:function(t){void 0===t&&(t=[]);for(var e,i=this.children,n=0,r=i.length;n0;){var i=e.shift();i.rexSizer&&i.rexSizer.hidden||(i!==this&&t.push(i),i.isRexContainerLite&&e.push.apply(e,p(i.children)));}return t}},Ke=function(){this._childrenWidth=void 0,this._childrenHeight=void 0;for(var t,e=this.getChildrenSizers(),i=0,n=e.length;i0?-this.delay:0,this.state=this.nowTime>=0?mi:yi,this.repeatCounter=0,this}},{key:"stop",value:function(){return this.state=gi,this}},{key:"update",value:function(t,e){this.state!==gi&&this.state!==bi&&0!==e&&0!==this.timeScale&&(this.nowTime+=e*this.timeScale,this.justRestart=!1,this.nowTime>=this.duration?-1===this.repeat||this.repeatCounter0&&(this.nowTime-=this.repeatDelay,this.state=ki)):(this.nowTime=this.duration,this.state=bi):this.nowTime>=0&&(this.state=mi));}},{key:"t",get:function(){var t;switch(this.state){case gi:case yi:case ki:t=0;break;case mi:t=this.nowTime/this.duration;break;case bi:t=1;}return pi(t,0,1)},set:function(t){(t=pi(t,-1,1))<0?(this.state=yi,this.nowTime=-this.delay*t):(this.state=mi,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++);}},{key:"setT",value:function(t){return this.t=t,this}},{key:"isIdle",get:function(){return this.state===gi}},{key:"isDelay",get:function(){return this.state===yi}},{key:"isCountDown",get:function(){return this.state===mi}},{key:"isRunning",get:function(){return this.state===yi||this.state===mi}},{key:"isDone",get:function(){return this.state===bi}},{key:"isOddIteration",get:function(){return 1==(1&this.repeatCounter)}},{key:"isEvenIteration",get:function(){return 0==(1&this.repeatCounter)}}]),t}(),gi=0,yi=1,mi=2,ki=3,bi=-1,xi=function(t){r(o,t);var i=l(o);function o(t,n){var r;return e(this,o),(r=i.call(this,t,n)).timer=new vi,r}return n(o,[{key:"shutdown",value:function(t){this.isShutdown||(c(s(o.prototype),"shutdown",this).call(this,t),this.timer.destroy(),this.timer=void 0);}},{key:"start",value:function(){return this.timer.start(),c(s(o.prototype),"start",this).call(this),this}},{key:"stop",value:function(){return this.timer.stop(),c(s(o.prototype),"stop",this).call(this),this}},{key:"complete",value:function(){return this.timer.stop(),c(s(o.prototype),"complete",this).call(this),this}}]),o}(ci),wi=Phaser.Utils.Objects.GetValue,Si=Phaser.Utils.Objects.GetAdvancedValue,Ci=Phaser.Tweens.Builders.GetEaseFunction,Oi=function(t){r(o,t);var i=l(o);function o(){return e(this,o),i.apply(this,arguments)}return n(o,[{key:"resetFromJSON",value:function(t){return this.timer.resetFromJSON(wi(t,"timer")),this.setEnable(wi(t,"enable",!0)),this.setTarget(wi(t,"target",this.parent)),this.setDelay(Si(t,"delay",0)),this.setDuration(Si(t,"duration",1e3)),this.setEase(wi(t,"ease","Linear")),this.setRepeat(wi(t,"repeat",0)),this}},{key:"setEnable",value:function(t){return null==t&&(t=!0),this.enable=t,this}},{key:"setTarget",value:function(t){return void 0===t&&(t=this.parent),this.target=t,this}},{key:"setDelay",value:function(t){return this.delay=t,this}},{key:"setDuration",value:function(t){return this.duration=t,this}},{key:"setRepeat",value:function(t){return this.repeat=t,this}},{key:"setRepeatDelay",value:function(t){return this.repeatDelay=t,this}},{key:"setEase",value:function(t){return void 0===t&&(t="Linear"),this.ease=t,this.easeFn=Ci(t),this}},{key:"start",value:function(){return this.timer.isRunning||c(s(o.prototype),"start",this).call(this),this}},{key:"restart",value:function(){return this.timer.stop(),this.start.apply(this,arguments),this}},{key:"stop",value:function(t){return void 0===t&&(t=!1),c(s(o.prototype),"stop",this).call(this),t&&(this.timer.setT(1),this.updateGameObject(this.target,this.timer),this.complete()),this}},{key:"update",value:function(t,e){if(!this.isRunning||!this.enable||!this.parent.active)return this;var i=this.target,n=this.timer;return n.update(t,e),n.isDelay||this.updateGameObject(i,n),this.emit("update",i,this),n.isDone&&this.complete(),this}},{key:"updateGameObject",value:function(t,e){}}]),o}(xi),_i=Phaser.Utils.Objects.GetValue,Ti=Phaser.Utils.Objects.GetAdvancedValue,Pi=Phaser.Math.Linear,Ei=function(t){r(o,t);var i=l(o);function o(t,n){var r;return e(this,o),(r=i.call(this,t,n)).scaleStart={},r.scaleEnd={},r.resetFromJSON(n),r.boot(),r}return n(o,[{key:"resetFromJSON",value:function(t){return c(s(o.prototype),"resetFromJSON",this).call(this,t),this.setMode(_i(t,"mode",0)),this.setScaleRange(Ti(t,"start",void 0),Ti(t,"end",0)),this}},{key:"setMode",value:function(t){return "string"==typeof t&&(t=Mi[t]),this.mode=t,this}},{key:"setScaleRange",value:function(t,e){return "number"==typeof t?(this.startX=t,this.startY=t):(this.startX=Ti(t,"x",this.parent.scaleX),this.startY=Ti(t,"y",this.parent.scaleY)),"number"==typeof e?(this.endX=e,this.endY=e):(this.endX=Ti(e,"x",void 0),this.endY=Ti(e,"y",void 0)),this.hasScaleX=void 0!==this.startX&&void 0!==this.endX,this.hasScaleY=void 0!==this.startY&&void 0!==this.endY,this}},{key:"start",value:function(){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),c(s(o.prototype),"start",this).call(this),this}},{key:"updateGameObject",value:function(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));}},{key:"complete",value:function(){return c(s(o.prototype),"complete",this).call(this),1===this.mode&&this.parent.destroy(),this}}]),o}(Oi),Mi={stop:0,destroy:1,yoyo:2},Ri=function(t,e,i,n,r){var s,o;switch(void 0===n&&(n="Cubic"),i){case 0:case"x":s={x:0},o={x:t.scaleX};break;case 1:case"y":s={y:0},o={y:t.scaleY};break;default:s=0,o=t.scale;}var a={mode:0,start:s,end:o,duration:e,ease:n};return void 0===r?r=new Ei(t,a):r.resetFromJSON(a),r.restart(),r},Li=function(t,e,i,n,r,s){void 0===n&&(n="Linear"),r instanceof Ei&&(s=r,r=void 0),void 0===r&&(r=!0);var o={};switch(o.mode=r?1:0,i){case 0:case"x":o.end={x:0};break;case 1:case"y":o.end={y:0};break;default:o.end=0;}return o.duration=e,o.ease=n,void 0===s?s=new Ei(t,o):s.resetFromJSON(o),s.restart(),s},zi=function(t,e){return new Promise((function(i,n){t.once(e,(function(){i();}));}))},Ai=function(t){return zi(t,"complete")},Di=Phaser.Utils.Objects.IsPlainObject,Bi=function(t,e){e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0);})),e.on("update",(function(){var e=je.getParentSizer(t);e&&e.resetChildPositionState(t);}));},ji={popUp:function(t,e,i){if(Di(t)){var n=t;t=n.duration,e=n.orientation,i=n.ease;}var r=void 0===this._scaleBehavior;return this._scaleBehavior=Ri(this,t,e,i,this._scaleBehavior),r&&Bi(this,this._scaleBehavior),this._scaleBehavior.completeEventName="popup.complete",this},popUpPromise:function(t,e,i){return this.popUp(t,e,i),Ai(this._scaleBehavior)},scaleDownDestroy:function(t,e,i,n){if(Di(t)){var r=t;t=r.duration,e=r.orientation,i=r.ease,n=r.destroy;}var s=void 0===this._scaleBehavior;return this._scaleBehavior=Li(this,t,e,i,n,this._scaleBehavior),s&&Bi(this,this._scaleBehavior),this._scaleBehavior.completeEventName="scaledown.complete",this},scaleDownDestroyPromise:function(t,e,i,n){return this.scaleDownDestroy(t,e,i,n),Ai(this._scaleBehavior)},scaleDown:function(t,e,i){return this.scaleDownDestroy(t,e,i,!1),this},scaleDownPromise:function(t,e,i){return this.scaleDown(t,e,i),Ai(this._scaleBehavior)},scaleYoyo:function(t,e,i,n,r){if(Di(t)){var s=t;t=s.duration,e=s.peakValue,i=s.repeat,n=s.orientation,r=s.ease;}var o=void 0===this._scaleBehavior;return this._scaleBehavior=function(t,e,i,n,r,s,o){var a,h;switch(void 0===i&&(i=1.2),void 0===n&&(n=0),void 0===s&&(s="Cubic"),r){case 0:case"x":a={x:t.scaleX},h={x:i};break;case 1:case"y":a={y:t.scaleX},h={y:i};break;default:a=t.scaleX,h=i;}var l={mode:2,start:a,end:h,duration:e/2,ease:s,repeat:n};return void 0===o?o=new Ei(t,l):o.resetFromJSON(l),o.restart(),o}(this,t,e,i,n,r,this._scaleBehavior),o&&Bi(this,this._scaleBehavior),this._scaleBehavior.completeEventName="scaleyoyo.complete",this},scaleYoyoPromise:function(t,e,i,n,r){return this.scaleYoyo(t,e,i,n,r),Ai(this._scaleBehavior)}},Wi=Phaser.Utils.Objects.GetValue,Yi=Phaser.Utils.Objects.GetAdvancedValue,Xi=Phaser.Math.Linear,Ii=function(t){r(o,t);var i=l(o);function o(t,n){var r;return e(this,o),(r=i.call(this,t,n)).resetFromJSON(n),r.boot(),r}return n(o,[{key:"resetFromJSON",value:function(t){return c(s(o.prototype),"resetFromJSON",this).call(this,t),this.setMode(Wi(t,"mode",0)),this.setAlphaRange(Yi(t,"start",this.parent.alpha),Yi(t,"end",0)),this}},{key:"setMode",value:function(t){return "string"==typeof t&&(t=Fi[t]),this.mode=t,this}},{key:"setAlphaRange",value:function(t,e){return this.alphaStart=t,this.alphaEnd=e,this}},{key:"start",value:function(){return this.timer.isRunning||(this.parent.setAlpha(this.alphaStart),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),c(s(o.prototype),"start",this).call(this)),this}},{key:"updateGameObject",value:function(t,e){var i=e.t;e.isOddIteration&&(i=1-i),t.alpha=Xi(this.alphaStart,this.alphaEnd,i);}},{key:"complete",value:function(){return c(s(o.prototype),"complete",this).call(this),1===this.mode&&this.parent.destroy(),this}}]),o}(Oi),Fi={stop:0,destroy:1,yoyo:2},Hi=Phaser.Utils.Objects.IsPlainObject,Ni=function(t,e,i,n){var r,s;Hi(i)?(r=i.start,s=i.end):s=i,void 0===r&&(r=0),void 0===s&&(s=1);var o={mode:0,start:r,end:s,duration:e};return void 0===n?n=new Ii(t,o):n.resetFromJSON(o),n.restart(),n},Gi=function(t,e,i,n){i instanceof Ii&&(n=i,i=void 0),void 0===i&&(i=!0);var r={mode:i?1:0,end:0,duration:e};return void 0===n?n=new Ii(t,r):n.resetFromJSON(r),n.restart(),n},Vi=Phaser.Utils.Objects.IsPlainObject,Ui=function(t,e){e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0);})),e.on("update",(function(){var e=je.getParentSizer(t);e&&e.resetChildAlphaState(t);}));},Ji={fadeIn:function(t,e){if(Vi(t)){var i=t;t=i.duration,e=i.alpha;}var n=void 0===this._fade;return this._fade=Ni(this,t,e,this._fade),n&&Ui(this,this._fade),this._fade.completeEventName="fadein.complete",this},fadeInPromise:function(t,e){return this.fadeIn(t,e),Ai(this._fade)},fadeOutDestroy:function(t,e){if(Vi(t)){var i=t;t=i.duration,e=i.destroy;}var n=void 0===this._fade;return this._fade=Gi(this,t,e,this._fade),n&&Ui(this,this._fade),this._fade.completeEventName="fadeout.complete",this},fadeOutDestroyPromise:function(t,e){return this.fadeOutDestroy(t,e),Ai(this._fade)},fadeOut:function(t){return this.fadeOutDestroy(t,!1),this},fadeOutPromise:function(t){return this.fadeOut(t),Ai(this._fade)}},Ki=Phaser.Utils.Objects.GetValue,qi=Phaser.Utils.Objects.GetAdvancedValue,Zi=Phaser.Math.Linear,$i=function(t){r(o,t);var i=l(o);function o(t,n){var r;return e(this,o),(r=i.call(this,t,n)).resetFromJSON(n),r.boot(),r}return n(o,[{key:"resetFromJSON",value:function(t){if(c(s(o.prototype),"resetFromJSON",this).call(this,t),this.setMode(Ki(t,"mode",0)),t&&(t.hasOwnProperty("x")||t.hasOwnProperty("y"))){var e=qi(t,"x",void 0),i=qi(t,"y",void 0);this.setTargetPosition(e,i);}else this.setTargetPosition(t);return this}},{key:"setMode",value:function(t){return "string"==typeof t&&(t=Qi[t]),this.mode=t,this}},{key:"setTargetPosition",value:function(t,e){if("number"==typeof t||"number"==typeof e)this.startX=this.parent.x,this.startY=this.parent.y,this.endX=t,this.endY=e;else {var i=t;this.startX=qi(i,"startX",void 0),this.startY=qi(i,"startY",void 0),this.endX=qi(i,"endX",void 0),this.endY=qi(i,"endY",void 0);}return this.hasMoveX=void 0!==this.startX&&void 0!==this.endX,this.hasMoveY=void 0!==this.startY&&void 0!==this.endY,this}},{key:"start",value:function(){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),c(s(o.prototype),"start",this).call(this),this}},{key:"updateGameObject",value:function(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasMoveX&&(t.x=Zi(this.startX,this.endX,i)),this.hasMoveY&&(t.y=Zi(this.startY,this.endY,i));}},{key:"complete",value:function(){return c(s(o.prototype),"complete",this).call(this),1===this.mode&&this.parent.destroy(),this}}]),o}(Oi),Qi={stop:0,destroy:1,yoyo:2},tn=function(t,e){if("number"==typeof t)return t;var i=t[0],n=parseFloat(t.substr(2));switch(i){case"+":return e+n;case"-":return e-n;case"*":return e*n;case"/":return e/n}},en=Phaser.Utils.Objects.IsPlainObject,nn=Phaser.Math.Distance.Between,rn=function(t,e){e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0);})),e.on("update",(function(){var e=je.getParentSizer(t);e&&e.resetChildPositionState(t);}));},sn={moveFrom:function(t,e,i,n,r){if(en(t)){var s=t;e=s.x,i=s.y,t=s.hasOwnProperty("speed")?1e3*nn(e,i,this.x,this.y)/s.speed:s.duration,n=s.ease;}var o=void 0===this._easeMove;return this._easeMove=function(t,e,i,n,r,s,o){s instanceof $i&&(o=s,s=void 0),void 0===s&&(s=!1);var a={};return a.mode=s?1:0,void 0!==i&&(a.startX=tn(i,t.x),a.endX=t.x),void 0!==n&&(a.startY=tn(n,t.y),a.endY=t.y),a.duration=e,a.ease=void 0===r?"Linear":r,void 0===o?o=new $i(t,a):o.resetFromJSON(a),o.restart(),o}(this,t,e,i,n,r,this._easeMove),o&&rn(this,this._easeMove),this._easeMove.completeEventName="movefrom.complete",this},moveFromPromise:function(t,e,i,n,r){return this.moveFrom(t,e,i,n,r),Ai(this._easeMove)},moveFromDestroy:function(t,e,i,n){return this.moveFrom(t,e,i,n,!0),this},moveFromDestroyPromise:function(t,e,i,n){return this.moveFromDestroy(t,e,i,n),Ai(this._easeMove)},moveTo:function(t,e,i,n,r){if(en(t)){var s=t;e=s.x,i=s.y,t=s.hasOwnProperty("speed")?1e3*nn(e,i,this.x,this.y)/s.speed:s.duration,n=s.ease;}var o=void 0===this._easeMove;return this._easeMove=function(t,e,i,n,r,s,o){s instanceof $i&&(o=s,s=void 0),void 0===s&&(s=!1);var a={};return a.mode=s?1:0,void 0!==i&&(a.startX=t.x,a.endX=tn(i,t.x)),void 0!==n&&(a.startY=t.y,a.endY=tn(n,t.y)),a.duration=e,a.ease=void 0===r?"Linear":r,void 0===o?o=new $i(t,a):o.resetFromJSON(a),o.restart(),o}(this,t,e,i,n,r,this._easeMove),o&&rn(this,this._easeMove),this._easeMove.completeEventName="moveto.complete",this},moveToPromise:function(t,e,i,n,r){return this.moveTo(t,e,i,n,r),Ai(this._easeMove)},moveToDestroy:function(t,e,i,n){return this.moveTo(t,e,i,n,!0),this},moveToDestroyPromise:function(t,e,i,n){return this.moveToDestroy(t,e,i,n,!0),Ai(this._easeMove)},moveStop:function(t){return this._easeMove?(this._easeMove.stop(t),this):this}},on=Phaser.Utils.Objects.GetValue,an=function(t){r(o,t);var i=l(o);function o(t,n){var r;return e(this,o),(r=i.call(this,t,n)).timer=new vi,r.resetFromJSON(n),r.boot(),r}return n(o,[{key:"resetFromJSON",value:function(t){return this.timer.resetFromJSON(on(t,"timer")),this.setEnable(on(t,"enable",!0)),this.setMode(on(t,"mode",1)),this.isRunning=on(t,"isRunning",!1),this.setMagnitudeMode(on(t,"magnitudeMode",1)),this.setAxisMode(on(t,"axis",0)),this.setDuration(on(t,"duration",500)),this.setMagnitude(on(t,"magnitude",10)),this.ox=on(t,"ox",void 0),this.oy=on(t,"oy",void 0),this}},{key:"toJSON",value:function(){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}}},{key:"shutdown",value:function(t){this.isShutdown||(c(s(o.prototype),"shutdown",this).call(this,t),this.timer.destroy(),this.timer=void 0);}},{key:"startTicking",value:function(){c(s(o.prototype),"startTicking",this).call(this),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);}},{key:"stopTicking",value:function(){c(s(o.prototype),"stopTicking",this).call(this),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));}},{key:"setEnable",value:function(t){return null==t&&(t=!0),this.enable=t,this}},{key:"setMode",value:function(t){return "string"==typeof t&&(t=hn[t]),this.mode=t,this}},{key:"setMagnitudeMode",value:function(t){return "string"==typeof t&&(t=un[t]),this.magnitudeMode=t,this}},{key:"setAxisMode",value:function(t){return "string"==typeof t&&(t=ln[t]),this.axisMode=t,this}},{key:"setDuration",value:function(t){return this.duration=t,this}},{key:"setMagnitude",value:function(t){return this.magnitude=t,this}},{key:"start",value:function(t,e){if("number"!=typeof t){var i=t;e=on(i,"magnitude",void 0),t=on(i,"duration",void 0);}return void 0!==e&&this.setMagnitude(e),void 0!==t&&this.setDuration(t),this.timer.setDuration(this.duration).start(),c(s(o.prototype),"start",this).call(this),this}},{key:"shake",value:function(t,e){return this.start(t,e),this}},{key:"update",value:function(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 n=this.magnitude;1===this.magnitudeMode&&(n*=1-this.timer.t);var r=Math.random()*Math.PI*2,s=this.ox+Math.cos(r)*n,o=this.oy+Math.sin(r)*n;switch(this.axisMode){case 1:i.x=s;break;case 2:i.y=o;break;default:i.x=s,i.y=o;}}return this}},{key:"backToOrigin",value:function(){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}}]),o}(hi),hn={effect:0,behavior:1},ln={both:0,"h&v":0,"x&y":0,horizontal:1,h:1,x:1,vertical:2,v:2,y:2},un={constant:0,decay:1},cn=Phaser.Utils.Objects.IsPlainObject,dn={shake:function(t,e,i){if(cn(t)){var n=t;t=n.duration,e=n.magnitude,i=n.magnitudeMode;}return void 0===this._shake&&(this._shake=new an(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:function(t,e){return this.shake(t,e),Ai(this._shake)}},fn=Phaser.Utils.Objects.GetValue,pn=Phaser.Math.Linear,vn=function(t){r(o,t);var i=l(o);function o(t,n){var r;return e(this,o),(r=i.call(this,t,n)).resetFromJSON(),r.boot(),r}return n(o,[{key:"start",value:function(t){if(this.timer.isRunning)return this;var e=this.target;this.propertyKey=fn(t,"key","value");var i=e[this.propertyKey];return this.fromValue=fn(t,"from",i),this.toValue=fn(t,"to",i),this.setEase(fn(t,"ease",this.ease)),this.setDuration(fn(t,"duration",this.duration)),this.setRepeat(fn(t,"repeat",0)),this.setDelay(fn(t,"delay",0)),this.setRepeatDelay(fn(t,"repeatDelay",0)),this.timer.setDuration(this.duration).setRepeat(this.repeat).setDelay(this.delay).setRepeatDelay(this.repeatDelay),e[this.propertyKey]=this.fromValue,c(s(o.prototype),"start",this).call(this),this}},{key:"updateGameObject",value:function(t,e){var i=e.t;i=this.easeFn(i),t[this.propertyKey]=pn(this.fromValue,this.toValue,i);}}]),o}(Oi),gn=Phaser.Utils.Objects.IsPlainObject,yn=function(t){r(s,t);var i=l(s);function s(t,n){var r;return e(this,s),(r=i.call(this,t,n)).parent.setDataEnabled(),r.easeTasks={},r}return n(s,[{key:"complete",value:function(t){this.emit("complete-".concat(t),this.parent,this),this.emit("complete",t,this.parent,this);}},{key:"getEaseTask",value:function(t){var e=this.easeTasks[t];return void 0===e&&(e=new vn(this.parent),this.easeTasks[t]=e,e.setTarget(this.parent.data.values).on("complete",(function(){this.complete(t);}),this)),e}},{key:"easeTo",value:function(t,e,i,n){if(gn(t)){var r=t;t=r.key,e=r.value,i=r.duration,n=r.ease;var s=r.speed;void 0===i&&void 0!==s&&(i=Math.abs(e-this.parent.data.values[t])/s*1e3);}return void 0===i&&(i=1e3),void 0===n&&(n="Linear"),this.getEaseTask(t).restart({key:t,to:e,duration:i,ease:n}),this}},{key:"easeFrom",value:function(t,e,i,n){if(gn(t)){var r=t;t=r.key,e=r.value,i=r.duration,n=r.ease;var s=r.speed;void 0===i&&void 0!==s&&(i=Math.abs(e-this.parent.data.values[t])/s*1e3);}return void 0===i&&(i=1e3),void 0===n&&(n="Linear"),this.getEaseTask(t).restart({key:t,from:e,duration:i,ease:n}),this}},{key:"stopEase",value:function(t,e){void 0===e&&(e=!0);var i=this.easeTasks[t];return i&&i.stop(e),this}},{key:"stopAll",value:function(t){for(var e in void 0===t&&(t=!0),this.easeTasks)this.stopEase(e,t);return this}}]),s}(si),mn={easeDataTo:function(t,e,i,n){return this._easeData||(this._easeData=new yn(this),function(t,e){e.on("complete",(function(e){t.emit("easedata.".concat(e,".complete"),t),t.emit("easedata.complete",e,t);}));}(this,this._easeData)),this._easeData.easeTo(t,e,i,n),this},easeDataToPromise:function(t,e,i,n){return this.easeDataTo(t,e,i,n),zi(this._easeData,"complete-".concat(t))},stopEaseData:function(t,e){return this._easeData?(this._easeData.stopEase(t,e),this):this},stopAllEaseData:function(t){return this._easeData?(this._easeData.stopAll(t),this):this}},kn=function(t){wn(t,!1);},bn=function(t){wn(t,!0);},xn=function(t){return !!t&&!Vt(t).hidden},wn=function(t,e){if(t){Vt(t).hidden=e;var i=O(t);i?i.setChildVisible(t,!e):t.setVisible(!e);}},Sn={show:function(t){return void 0===t&&(t=this),kn(t),this},hide:function(t){return void 0===t&&(t=this),bn(t),this},isShow:function(t){return void 0===t&&(t=this),xn(t)}};function Cn(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var On={exports:{}};!function(t){var e=Object.prototype.hasOwnProperty,i="~";function n(){}function r(t,e,i){this.fn=t,this.context=e,this.once=i||!1;}function s(t,e,n,s,o){if("function"!=typeof n)throw new TypeError("The listener must be a function");var a=new r(n,s||t,o),h=i?i+e:e;return t._events[h]?t._events[h].fn?t._events[h]=[t._events[h],a]:t._events[h].push(a):(t._events[h]=a,t._eventsCount++),t}function o(t,e){0==--t._eventsCount?t._events=new n:delete t._events[e];}function a(){this._events=new n,this._eventsCount=0;}Object.create&&(n.prototype=Object.create(null),(new n).__proto__||(i=!1)),a.prototype.eventNames=function(){var t,n,r=[];if(0===this._eventsCount)return r;for(n in t=this._events)e.call(t,n)&&r.push(i?n.slice(1):n);return Object.getOwnPropertySymbols?r.concat(Object.getOwnPropertySymbols(t)):r},a.prototype.listeners=function(t){var e=i?i+t:t,n=this._events[e];if(!n)return [];if(n.fn)return [n.fn];for(var r=0,s=n.length,o=new Array(s);r0){var e=t.runTransitionInCallback();t.delayCall(e,this.next,this);}else this.next();}},{key:"exit_TRANS_OPNE",value:function(){this.parent.removeDelayCall();}},{key:"next_OPEN",value:function(){return "TRANS_CLOSE"}},{key:"enter_OPEN",value:function(){this.parent.onOpen();}},{key:"exit_OPEN",value:function(){this.parent.removeDelayCall();}},{key:"next_TRANS_CLOSE",value:function(){return "CLOSE"}},{key:"enter_TRANS_CLOSE",value:function(){var t=this.parent;if(t.transitOutTime>0){var e=t.runTransitionOutCallback();t.delayCall(e,this.next,this);}else this.next();}},{key:"exit_TRANS_CLOSE",value:function(){this.parent.removeDelayCall();}},{key:"next_CLOSE",value:function(){return "TRANS_OPNE"}},{key:"enter_CLOSE",value:function(){this.parent.onClose();}},{key:"exit_CLOSE",value:function(){}},{key:"canOpen",value:function(){return "IDLE"===this.state||"CLOSE"===this.state}},{key:"canClose",value:function(){return "IDLE"===this.state||"OPEN"===this.state}}]),s}(zn),Dn={delayCall:function(t,e,i){return this.delayCallTimer=function(t,e,i,n,r){var s=ti(t);return s.time.delayedCall(e,(function(){s.game.events.once("poststep",(function(){i.call(n,r);}));}))}(this,t,e,i),this},removeDelayCall:function(){return this.delayCallTimer&&(this.delayCallTimer.remove(!1),this.delayCallTimer=void 0),this}},Bn={setTransitInTime:function(t){return this.transitInTime=t,this},setTransitOutTime:function(t){return this.transitOutTime=t,this},setTransitInCallback:function(t){return t||(t=Qt),this.transitInCallback=t,this},setTransitOutCallback:function(t){return t||(t=Qt),this.transitOutCallback=t,this}},jn={runTransitionInCallback:function(){return this.transitInCallback(this.parent,this.transitInTime),this.transitInTime},onOpen:function(){},requestOpen:function(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}},Wn={runTransitionOutCallback:function(){return this.transitOutCallback(this.parent,this.transitOutTime),this.transitOutTime},onClose:function(){this.oneShotMode&&this.parent.destroy();},requestClose:function(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}},Yn={};Object.assign(Yn,Dn,Bn,jn,Wn);var Xn=Phaser.Utils.Objects.GetValue,In=function(t){r(o,t);var i=l(o);function o(t,n){var r;return e(this,o),(r=i.call(this,t,n)).setTransitInTime(Xn(n,"duration.in",200)),r.setTransitOutTime(Xn(n,"duration.out",200)),r.setTransitInCallback(Xn(n,"transitIn")),r.setTransitOutCallback(Xn(n,"transitOut")),r.oneShotMode=Xn(n,"destroy",!1),r.delayCallTimer=void 0,r._state=new An(a(r),{eventEmitter:!1,initState:Xn(n,"initState","IDLE")}),r.openEventData=void 0,r.closeEventData=void 0,r}return n(o,[{key:"state",get:function(){return this._state.state}},{key:"shutdown",value:function(t){this.isShutdown||(this.transitInCallback=void 0,this.transitOutCallback=void 0,this.openEventData=void 0,this.closeEventData=void 0,this.removeDelayCall(),c(s(o.prototype),"shutdown",this).call(this,t));}}]),o}(si);Object.assign(In.prototype,Yn);var Fn=function(t){r(o,t);var i=l(o);function o(t,n,r){var s;return e(this,o),(s=i.call(this,t,0,0,2,2,n,1)).setAlpha(r),s.setScrollFactor(0),s.boot(),s}return n(o,[{key:"boot",value:function(){this.scene.sys.events.on("prerender",this.resize,this);}},{key:"destroy",value:function(t){this.scene&&!this.ignoreDestroy&&(this.scene.sys.events.off("prerender",this.resize,this),c(s(o.prototype),"destroy",this).call(this,t));}},{key:"tint",get:function(){return this.fillColor},set:function(t){this.setFillStyle(t,this.fillAlpha);}},{key:"resize",value:function(){var t=this.scene,e=t.sys.scale.gameSize,i=t.sys.cameras.main,n=e.width,r=e.height,s=1/i.zoom,o=n/2,a=r/2,h=n*s,l=r*s;this.x===o&&this.y===a||this.setPosition(o,a),this.width===h&&this.height===l||this.setSize(h,l).setOrigin(.5);}}]),o}(Phaser.GameObjects.Rectangle),Hn=Phaser.Utils.Objects.GetValue,Nn=function(t){r(s,t);var i=l(s);function s(t,n){var r;return e(this,s),(r=i.call(this,t,{eventEmitter:!1})).resetFromJSON(n),r.boot(),r}return n(s,[{key:"resetFromJSON",value:function(t){return this.setHitAreaMode(Hn(t,"hitAreaMode",0)),this.setEnable(Hn(t,"enable",!0)),this.setStopMode(Hn(t,"stopAllLevels",!0)),this}},{key:"boot",value:function(){this.parent.on("pointerdown",(function(t,e,i,n){this.stopAllLevels&&n.stopPropagation();}),this).on("pointerup",(function(t,e,i,n){this.stopAllLevels&&n.stopPropagation();}),this).on("pointermove",(function(t,e,i,n){this.stopAllLevels&&n.stopPropagation();}),this).on("pointerover",(function(t,e,i,n){this.stopAllLevels&&n.stopPropagation();}),this).on("pointerout",(function(t,e){this.stopAllLevels&&e.stopPropagation();}),this);}},{key:"setHitAreaMode",value:function(t){"string"==typeof t&&(t=Gn[t]);var e=this.parent;return e.input&&e.removeInteractive(),0===t?e.setInteractive():e.setInteractive({hitArea:{},hitAreaCallback:function(){return !0}}),this}},{key:"setEnable",value:function(t){return void 0===t&&(t=!0),t?this.parent.setInteractive():this.parent.disableInteractive(),this.enable=t,this}},{key:"setStopMode",value:function(t){return void 0===t&&(t=!0),this.stopAllLevels=t,this}},{key:"toggleEnable",value:function(){return this.setEnable(!this.enable),this}}]),s}(si),Gn={default:0,fullWindow:1},Vn=Phaser.Utils.Objects.GetValue,Un=function(t){r(s,t);var i=l(s);function s(t,n){var r;e(this,s);var o=Vn(n,"color",0),h=Vn(n,"alpha",.8);return (r=i.call(this,t,o,h)).touchEventStop=new Nn(a(r),{hitAreaMode:1}),r}return n(s)}(Fn),Jn=function(t,e){void 0!==t._modalScaleSave?(t.scaleX=t._modalScaleSave,t.scaleY=t._modalScaleSave):t._modalScaleSave=t.scaleX,Ri(t,e);},Kn=function(t,e){Li(t,e,void 0,void 0,!1);},qn=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Ni(t,e);},Zn=function(t,e){Gi(t,e,!1);},$n=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Ni(t,e,t.alpha);},Qn=function(t,e){Gi(t,e,!1);},tr=function(t,e,i,n,r){return !!t&&(!(n&&!n(t,e,i))&&(!!bt(t,!0).contains(e,i)&&!(r&&!r(t,e,i))))},er=Phaser.Utils.Objects.GetValue,ir=function(t){r(o,t);var i=l(o);function o(t,n){var r;e(this,o),void 0===n&&(n={}),null==n.transitIn&&(n.transitIn=nr.popUp),null==n.transitOut&&(n.transitOut=nr.scaleDown),n.destroy=er(n,"destroy",!0),r=i.call(this,t,n);var s=er(n,"cover");r.cover=!1!==s?function(t,e){var i=t.scene,n=new Un(i,e);return i.add.existing(n),t.isRexContainerLite?(t.pin(n,{syncPosition:!1,syncRotation:!1,syncScale:!1,syncAlpha:!1,syncScrollFactor:!1}),t.moveDepthBelow(n)):i.children.moveBelow(n,t),n}(t,s):void 0,r.cover&&(r.setCoverTransitInCallback(er(s,"transitIn",$n)),r.setCoverTransitOutCallback(er(s,"transitOut",Qn)));var h=er(n,"touchOutsideClose",!1),l=er(n,"duration.hold",-1),u=er(n,"timeOutClose",l>=0),c=er(n,"anyTouchClose",!1);return er(n,"manualClose",!1)&&(h=!1,c=!1,u=!1),c&&(h=!1),u?r.setDisplayTime(l):r.setDisplayTime(-1),c?r.once("open",r.anyTouchClose,a(r)):h&&r.once("open",r.touchOutsideClose,a(r)),er(n,"openOnStart",!0)&&r.delayCall(0,r.requestOpen,a(r)),r}return n(o,[{key:"shutdown",value:function(t){this.isShutdown||(this.cover||this.scene.input.off("pointerup",this.touchCloseCallback,this),this.cover&&!t&&(this.cover.destroy(),this.cover=void 0),c(s(o.prototype),"shutdown",this).call(this,t));}},{key:"touchOutsideClose",value:function(){return this.cover?this.cover.on("pointerup",this.touchCloseCallback,this):this.scene.input.on("pointerup",this.touchCloseCallback,this),this.clickOutsideTest=!0,this}},{key:"anyTouchClose",value:function(){return this.cover?this.cover.once("pointerup",this.touchCloseCallback,this):this.scene.input.once("pointerup",this.touchCloseCallback,this),this}},{key:"touchCloseCallback",value:function(t){this.clickOutsideTest&&tr(this.parent,t.worldX,t.worldY)||this.requestClose();}},{key:"runTransitionInCallback",value:function(){var t=c(s(o.prototype),"runTransitionInCallback",this).call(this),e=this.cover;return e&&this.coverTransitInCallback&&this.coverTransitInCallback(e,t),t}},{key:"runTransitionOutCallback",value:function(){var t=c(s(o.prototype),"runTransitionOutCallback",this).call(this),e=this.cover;return e&&this.coverTransitOutCallback&&this.coverTransitOutCallback(e,t),t}},{key:"onOpen",value:function(){var t=this.displayTime;t>=0&&this.delayCall(t,this.requestClose,this),this.emit("open",this.parent,this),c(s(o.prototype),"onOpen",this).call(this);}},{key:"onClose",value:function(){this.emit("close",this.closeEventData),c(s(o.prototype),"onClose",this).call(this);}},{key:"setDisplayTime",value:function(t){return this.displayTime=t,this}},{key:"setTransitInCallback",value:function(t){switch("string"==typeof t&&(t=nr[t]),t){case nr.popUp:t=Jn;break;case nr.fadeIn:t=qn;}return c(s(o.prototype),"setTransitInCallback",this).call(this,t),this}},{key:"setTransitOutCallback",value:function(t){switch("string"==typeof t&&(t=nr[t]),t){case nr.scaleDown:t=Kn;break;case nr.fadeOut:t=Zn;}return c(s(o.prototype),"setTransitOutCallback",this).call(this,t),this}},{key:"setCoverTransitInCallback",value:function(t){return this.coverTransitInCallback=t,this}},{key:"setCoverTransitOutCallback",value:function(t){return this.coverTransitOutCallback=t,this}}]),o}(In),nr={popUp:0,fadeIn:1,scaleDown:0,fadeOut:1},rr=function(t){return t&&"function"==typeof t},sr={modal:function(t,e){return rr(t)&&(e=t,t=void 0),void 0===this._modalBehavior&&(this.onCreateModalBehavior&&this.onCreateModalBehavior(this,t),this._modalBehavior=function(t,e){var i=new ir(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:function(t){var e=this;return new Promise((function(i,n){e.modal(t,i);}))},modalClose:function(t){return function(t,e){t.emit("modal.requestClose",e);}(this,t),this}},or=function(t,e,i,n){if(e)return tr(t,e.worldX,e.worldY,i,n);for(var r=t.scene.input.manager,s=r.pointersTotal,o=r.pointers,a=0;a=this.dragThreshold&&this.cancel();}},{key:"click",value:function(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 n=this.lastClickTime;return void 0!==n&&t-n<=this.clickInterval||(this.lastClickTime=t,this.emit("click",this,this.parent,e,i)),this}},{key:"cancel",value:function(){return this.pointer=void 0,this}},{key:"onOver",value:function(t,e,i,n){return this.enable?(this.emit("over",this,this.parent,t,n),this):this}},{key:"onOut",value:function(t,e){return this.enable?(this.emit("out",this,this.parent,t,e),this):this}}]),o}(si),xr={press:0,pointerdown:0,release:1,pointerup:1},wr={onClick:function(t,e,i,n){return t?("function"==typeof t&&(n=i,i=e,e=t,t=this),void 0===t._click&&(t._click=new br(t,n)),t._click.on("click",e,i),this):this},offClick:function(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:function(e,i){return e&&"object"!==t(e)&&(i=e,e=this),void 0===e._click||e._click.setEnable(i),this},disableClick:function(e){return e&&"object"!==t(e)&&(e=this),void 0===e._click||e._click.setEnable(!1),this}},Sr=function(t,e,i,n){if(e)return !(i&&!i(t,e))&&(!!Cr(t,e)&&!(n&&!n(t,e)));for(var r=t.scene.input.manager,s=r.pointersTotal,o=r.pointers,a=0;a0)return Or.length=0,!0;return Or.length=0,!1},Or=[],_r=Phaser.Utils.Objects.GetValue,Tr=function(t){r(o,t);var i=l(o);function o(t,n){var r;e(this,o),(r=i.call(this,t,n))._enable=void 0;var s=_r(n,"inputConfig",void 0);return s&&t.setInteractive(s),r.resetFromJSON(n),r.boot(),r}return n(o,[{key:"resetFromJSON",value:function(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}},{key:"boot",value:function(){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);}},{key:"shutdown",value:function(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,c(s(o.prototype),"shutdown",this).call(this,t);}}},{key:"enable",get:function(){return this._enable},set:function(t){if(this._enable!==t){t||this.cancel(),this._enable=t;var e=t?"enable":"disable";this.emit(e,this,this.parent);}}},{key:"setEnable",value:function(t){return void 0===t&&(t=!0),this.enable=t,this}},{key:"toggleEnable",value:function(){return this.setEnable(!this.enable),this}},{key:"setMode",value:function(t){return "string"==typeof t&&(t=Pr[t]),this.mode=t,this}},{key:"setClickInterval",value:function(t){return this.clickInterval=t,this}},{key:"setDragThreshold",value:function(t){return this.dragThreshold=t,this}},{key:"isPointerInside",value:function(t){var e=this.parent;return (e.input?Sr:or)(e,t)}},{key:"onPress",value:function(t){this.parent.willRender(t.camera)&&void 0===this.pointer&&(this.pointer=t,0===this.mode&&(this.isPointerInside(t)||this.click(t.downTime,t)));}},{key:"onRelease",value:function(t){this.parent.willRender(t.camera)&&this.pointer===t&&(1===this.mode&&(this.isPointerInside(t)||this.click(t.upTime,t)),this.pointer=void 0);}},{key:"onMove",value:function(t,e,i,n){this.pointer===t&&void 0!==this.dragThreshold&&1===this.mode&&(t.getDistance()>=this.dragThreshold||this.isPointerInside(t))&&this.cancel();}},{key:"click",value:function(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}},{key:"cancel",value:function(){return this.pointer=void 0,this}}]),o}(si),Pr={press:0,pointerdown:0,release:1,pointerup:1},Er={onClickOutside:function(t,e,i,n){return t?("function"==typeof t&&(n=i,i=e,e=t,t=this),void 0===t._clickOutside&&(t._clickOutside=new Tr(t,n)),t._clickOutside.on("clickoutside",e,i),this):this},offClickOutside:function(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:function(e,i){return e&&"object"!==t(e)&&(i=e,e=this),void 0===e._clickOutside||e._clickOutside.setEnable(i),this},disableClickOutside:function(e){return e&&"object"!==t(e)&&(e=this),void 0===e._clickOutside||e._clickOutside.setEnable(!1),this}},Mr=function(t){r(s,t);var i=l(s);function s(){var t;return e(this,s),(t=i.call(this,{eventEmitter:!1})).goto("IDLE"),t}return n(s,[{key:"setCooldownTime",value:function(t){return this.cooldownTime=t,this.cooldownMode=void 0!==t,this}},{key:"request",value:function(){return this.runMethod("request")}},{key:"update_IDLE",value:function(){this.compensationTime=0;}},{key:"request_IDLE",value:function(){return this.next(),!0}},{key:"next_IDLE",value:function(){if(this.cooldownMode)return "COOLDOWN"}},{key:"enter_COOLDOWN",value:function(){this.remainderTime=this.cooldownTime+this.compensationTime;}},{key:"update_COOLDOWN",value:function(t,e){this.remainderTime-=e,this.remainderTime<0&&(this.compensationTime=this.cooldownTime>e?-this.remainderTime:0,this.goto("IDLE"));}},{key:"request_COOLDOWN",value:function(){return !1}}]),s}(zn),Rr=Phaser.Utils.Objects.GetValue,Lr=function(t){r(o,t);var i=l(o);function o(t,n){var r;return e(this,o),(r=i.call(this,t,n))._enable=void 0,r.cooldown=new Mr,r.parent.setInteractive(Rr(n,"inputConfig",void 0)),r.resetFromJSON(n),r.boot(),r}return n(o,[{key:"resetFromJSON",value:function(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}},{key:"boot",value:function(){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);}},{key:"shutdown",value:function(t){this.isShutdown||(this.scene.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,c(s(o.prototype),"shutdown",this).call(this,t));}},{key:"enable",get:function(){return this._enable},set:function(t){if(this._enable!==t)return t||(this.prevIsInTouch=!1,this.isInTouching=!1,this.pointer=void 0),this._enable=t,this}},{key:"setEnable",value:function(t){return void 0===t&&(t=!0),this.enable=t,this}},{key:"cooldownTime",get:function(){return this.cooldown.cooldownTime},set:function(t){this.cooldown.setCooldownTime(t);}},{key:"setCooldown",value:function(t){return this.cooldownTime=t,this}},{key:"toggleEnable",value:function(){return this.setEnable(!this.enable),this}},{key:"onPointIn",value:function(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.pointer=t,this.isInTouching=!0);}},{key:"onPointOut",value:function(t){this.enable&&this.pointer===t&&(this.pointer=void 0,this.isInTouching=!1);}},{key:"preupdate",value:function(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;}}]),o}(si),zr={isPointerInBounds:function(t){return void 0===t?t=this:"string"==typeof t&&(t=this.getElement(t)),!!t&&or(t)},onTouching:function(t,e,i,n){return t?("function"==typeof t&&(n=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new Lr(t,n)),t._inTouching.on("intouch",e,i),this):this},offTouching:function(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:function(t,e,i,n){return t?("function"==typeof t&&(n=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new Lr(t,n)),t._inTouching.on("touchend",e,i),this):this},offTouchingEnd:function(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:function(e,i){return e&&"object"!==t(e)&&(i=e,e=this),void 0===e._inTouching||e._inTouching.setEnable(i),this},disableTouching:function(e){return e&&"object"!==t(e)&&(e=this),void 0===e._inTouching||e._inTouching.setEnable(!1),this}},Ar=function(t,e,i){for(var n,r=0,s=t.length;r0),this.onDragStart()));}},{key:"onPointerUp",value:function(t){this.enable&&((!this.bounds||this.bounds.contains(t.x,t.y))&&this.pointer===t&&(this.pointer=void 0,this.movedState=!1,this.tracerState=qr,this.onDragEnd()));}},{key:"onPointerMove",value:function(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()));}}},{key:"dragCancel",value:function(){return this.tracerState===Zr&&this.onDragEnd(),this.pointer=void 0,this.tracerState=qr,this}},{key:"onDragStart",value:function(){this.emit("dragstart",this);}},{key:"onDragEnd",value:function(){this.emit("dragend",this);}},{key:"onDrag",value:function(){this.emit("drag",this);}},{key:"preUpdate",value:function(t,e){}},{key:"postUpdate",value:function(t,e){}},{key:"startTicking",value:function(){c(s(o.prototype),"startTicking",this).call(this),this.scene.sys.events.on("preupdate",this.preUpdate,this),this.scene.sys.events.on("postupdate",this.postUpdate,this);}},{key:"stopTicking",value:function(){c(s(o.prototype),"stopTicking",this).call(this),this.scene&&(this.scene.sys.events.off("preupdate",this.preUpdate,this),this.scene.sys.events.off("postupdate",this.postUpdate,this));}},{key:"setRecongizedStateObject",value:function(t){return this.recongizedState=t,this}},{key:"state",get:function(){return this.recongizedState.state},set:function(t){this.recongizedState.state=t;}},{key:"cancel",value:function(){return this.state=$r,this}}]),o}(hi),qr=0,Zr=1,$r="IDLE",Qr=Phaser.Utils.Objects.GetValue,ts=Phaser.Math.Distance.Between,es=function(t){r(o,t);var i=l(o);function o(t,n){var r;e(this,o);var s=a(r=i.call(this,t,n)),h={states:{IDLE:{enter:function(){s.stop(),s.tapsCount=0,s.x=0,s.y=0,s.worldX=0,s.worldY=0;},exit:function(){var t=s.lastPointer;s.x=t.x,s.y=t.y,s.worldX=t.worldX,s.worldY=t.worldY;}},BEGIN:{enter:function(){s.start(),s.tapsCount=0,s.emit("tappingstart",s,s.gameObject,s.lastPointer);}},RECOGNIZED:{enter:function(){s.start(),s.emit("tap",s,s.gameObject,s.lastPointer),s.emit("".concat(s.tapsCount,"tap"),s,s.gameObject,s.lastPointer);}}},init:function(){this.state=is;},eventEmitter:!1};return r.setRecongizedStateObject(new zn(h)),r}return n(o,[{key:"resetFromJSON",value:function(t){c(s(o.prototype),"resetFromJSON",this).call(this,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}},{key:"onDragStart",value:function(){switch(this.state){case is:this.state=ns;break;case ns:var t=this.lastPointer;ts(t.upX,t.upY,t.x,t.y)>this.tapOffset&&(this.state=rs,this.state=ns);break;case rs:this.state=ns;}}},{key:"onDragEnd",value:function(){this.state===ns&&(this.tapsCount++,this.emit("tapping",this,this.gameObject,this.lastPointer),void 0!==this.maxTaps&&this.tapsCount===this.maxTaps&&(this.state=rs));}},{key:"onDrag",value:function(){this.state!==is&&this.pointer.getDistance()>this.dragThreshold&&(this.state=is);}},{key:"preUpdate",value:function(t,e){if(this.isRunning&&this.enable&&this.state===ns){var i=this.lastPointer;if(i.isDown)t-i.downTime>this.holdTime&&(this.state=is);else t-i.upTime>this.tapInterval&&(void 0===this.minTaps||this.tapsCount>=this.minTaps?this.state=rs:this.state=is);}}},{key:"postUpdate",value:function(t,e){this.isRunning&&this.enable&&this.state===rs&&(this.state=is);}},{key:"isTapped",get:function(){return this.state===rs}},{key:"setHoldTime",value:function(t){return this.holdTime=t,this}},{key:"setTapInterval",value:function(t){return this.tapInterval=t,this}},{key:"setDragThreshold",value:function(t){return this.dragThreshold=t,this}},{key:"setTapOffset",value:function(t){return this.tapOffset=t,this}},{key:"setMaxTaps",value:function(t){return this.maxTaps=t,this}},{key:"setMinTaps",value:function(t){return this.minTaps=t,this}},{key:"setTaps",value:function(t,e){return void 0===e&&(e=t),this.setMinTaps(t).setMaxTaps(e),this}}]),o}(Kr),is="IDLE",ns="BEGIN",rs="RECOGNIZED",ss=Phaser.Utils.Objects.GetValue,os=function(t){r(o,t);var i=l(o);function o(t,n){var r;e(this,o);var s=a(r=i.call(this,t,n)),h={states:{IDLE:{enter:function(){s.x=0,s.y=0,s.worldX=0,s.worldY=0;},exit:function(){var t=s.lastPointer;s.x=t.x,s.y=t.y,s.worldX=t.worldX,s.worldY=t.worldY;}},BEGIN:{enter:function(){s.start();},exit:function(){s.stop();}},RECOGNIZED:{enter:function(){s.emit("pressstart",s,s.gameObject,s.lastPointer);},exit:function(){s.emit("pressend",s,s.gameObject,s.lastPointer);}}},init:function(){this.state=as;},eventEmitter:!1};return r.setRecongizedStateObject(new zn(h)),r}return n(o,[{key:"resetFromJSON",value:function(t){return c(s(o.prototype),"resetFromJSON",this).call(this,t),this.setDragThreshold(ss(t,"threshold",9)),this.setHoldTime(ss(t,"time",251)),this}},{key:"onDragStart",value:function(){this.state=hs,0===this.holdTime&&(this.state=ls);}},{key:"onDragEnd",value:function(){this.state=as;}},{key:"onDrag",value:function(){this.state!==as&&this.pointer.getDistance()>this.dragThreshold&&(this.state=as);}},{key:"preUpdate",value:function(t,e){this.isRunning&&this.enable&&(this.state===hs&&t-this.pointer.downTime>=this.holdTime&&(this.state=ls));}},{key:"isPressed",get:function(){return this.state===ls}},{key:"setHoldTime",value:function(t){return this.holdTime=t,this}},{key:"setDragThreshold",value:function(t){return this.dragThreshold=t,this}}]),o}(Kr),as="IDLE",hs="BEGIN",ls="RECOGNIZED";Phaser.Utils.Objects.GetValue;var us=function(t){return ni(t).loop.delta},cs=Phaser.Math.Distance.Between,ds=Phaser.Math.Angle.Between,fs={getDt:function(){return us(this.scene)},getVelocity:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return cs(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 ds(e.x,e.y,t.x,t.y)}},ps={"up&down":0,"left&right":1,"4dir":2,"8dir":3},vs={},gs=Phaser.Utils.Objects.GetValue,ys=Phaser.Math.RadToDeg,ms=function(t){r(o,t);var i=l(o);function o(t,n){var r;e(this,o);var s=a(r=i.call(this,t,n)),h={states:{IDLE:{enter:function(){s.x=0,s.y=0,s.worldX=0,s.worldY=0;},exit:function(){var t=s.lastPointer;s.x=t.x,s.y=t.y,s.worldX=t.worldX,s.worldY=t.worldY;}},BEGIN:{enter:function(){s.validDrag=!1;}},RECOGNIZED:{enter:function(){s.start(),s.updateDirectionStates(),s.emit("swipe",s,s.gameObject,s.lastPointer);},exit:function(){s.stop(),s.clearDirectionStates();}}},init:function(){this.state=ks;},eventEmitter:!1};return r.setRecongizedStateObject(new zn(h)),r.clearDirectionStates(),r}return n(o,[{key:"resetFromJSON",value:function(t){return c(s(o.prototype),"resetFromJSON",this).call(this,t),this.setDragThreshold(gs(t,"threshold",10)),this.setVelocityThreshold(gs(t,"velocityThreshold",1e3)),this.setDirectionMode(gs(t,"dir","8dir")),this}},{key:"onDragStart",value:function(){this.state=bs;}},{key:"onDragEnd",value:function(){this.state=ks;}},{key:"onDrag",value:function(){this.state===bs&&(this.validDrag||(this.validDrag=0===this.dragThreshold||this.pointer.getDistance()>=this.dragThreshold),this.validDrag&&this.dragVelocity>this.velocityThreshold&&(this.state=xs));}},{key:"postUpdate",value:function(t,e){this.isRunning&&this.enable&&this.state===xs&&(this.state=ks);}},{key:"isSwiped",get:function(){return this.state===xs}},{key:"dragVelocity",get:function(){var t;switch(this.dirMode){case 0:t=this.getVelocityY();break;case 1:t=this.getVelocityX();break;default:t=this.getVelocity();}return t}},{key:"setDragThreshold",value:function(t){return this.dragThreshold=t,this}},{key:"setVelocityThreshold",value:function(t){return this.velocityThreshold=t,this}},{key:"setDirectionMode",value:function(t){return "string"==typeof t&&(t=ps[t]),this.dirMode=t,this}},{key:"updateDirectionStates",value:function(){return function(t,e,i){switch(void 0===i?i={}:!0===i&&(i=vs),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;}}(ys(this.getVelocityAngle()),this.dirMode,this),this}},{key:"clearDirectionStates",value:function(){return this.left=!1,this.right=!1,this.up=!1,this.down=!1,this}}]),o}(Kr);Object.assign(ms.prototype,fs);var ks="IDLE",bs="BEGIN",xs="RECOGNIZED",ws=Phaser.Utils.Objects.GetValue,Ss=Phaser.Utils.Array.SpliceOne,Cs=Phaser.Math.Distance.Between,Os=Phaser.Math.Angle.Between,_s=function(){function t(i,n){e(this,t);var r=i.input.manager.pointersTotal-1;r<2&&i.input.addPointer(2-r),this.scene=i,this.setEventEmitter(ws(n,"eventEmitter",void 0)),this._enable=void 0,this.pointers=[],this.movedState={},this.resetFromJSON(n),this.boot();}return n(t,[{key:"resetFromJSON",value:function(t){return this.setEnable(ws(t,"enable",!0)),this.bounds=ws(t,"bounds",void 0),this.tracerState=Ps,this.pointers.length=0,Mt(this.movedState),this}},{key:"boot",value:function(){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);}},{key:"shutdown",value:function(){this.scene&&(this.destroyEventEmitter(),this.pointers.length=0,Mt(this.movedState),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);}},{key:"destroy",value:function(){this.shutdown();}},{key:"enable",get:function(){return this._enable},set:function(t){if(this._enable!==t)return t||this.dragCancel(),this._enable=t,this}},{key:"setEnable",value:function(t){return void 0===t&&(t=!0),this.enable=t,this}},{key:"toggleEnable",value:function(){return this.setEnable(!this.enable),this}},{key:"onPointerDown",value:function(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.tracerState){case Ps:this.tracerState=Es,this.onDrag1Start();break;case Es:this.tracerState=Ms,this.onDrag2Start();}}},{key:"onPointerUp",value:function(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],Ss(this.pointers,e),this.tracerState){case Es:this.tracerState=Ps,this.onDrag1End();break;case Ms:this.tracerState=Es,this.onDrag2End(),this.onDrag1Start();}}}},{key:"onPointerMove",value:function(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 Es:this.onDrag1();break;case Ms:this.onDrag2();}}}},{key:"dragCancel",value:function(){return this.tracerState===Ms&&this.onDrag2End(),this.pointers.length=0,Mt(this.movedState),this.tracerState=Ps,this}},{key:"onDrag1Start",value:function(){this.emit("drag1start",this);}},{key:"onDrag1End",value:function(){this.emit("drag1end",this);}},{key:"onDrag1",value:function(){this.emit("drag1",this);}},{key:"onDrag2Start",value:function(){this.emit("drag2start",this);}},{key:"onDrag2End",value:function(){this.emit("drag2end",this);}},{key:"onDrag2",value:function(){this.emit("drag2",this);}},{key:"distanceBetween",get:function(){if(this.tracerState!==Ms)return 0;var t=this.pointers[0],e=this.pointers[1];return Cs(t.x,t.y,e.x,e.y)}},{key:"angleBetween",get:function(){if(this.tracerState!==Ms)return 0;var t=this.pointers[0],e=this.pointers[1];return Os(t.x,t.y,e.x,e.y)}},{key:"drag1Vector",get:function(){var t=this.pointers[0];if(t&&this.movedState[t.id]){var e=t.position,i=t.prevPosition;Ts.x=e.x-i.x,Ts.y=e.y-i.y;}else Ts.x=0,Ts.y=0;return Ts}},{key:"centerX",get:function(){if(this.tracerState!==Ms)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return (t.x+e.x)/2}},{key:"centerY",get:function(){if(this.tracerState!==Ms)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return (t.y+e.y)/2}},{key:"prevCenterX",get:function(){if(this.tracerState!==Ms)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}},{key:"prevCenterY",get:function(){if(this.tracerState!==Ms)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}},{key:"movementCenterX",get:function(){return this.centerX-this.prevCenterX}},{key:"movementCenterY",get:function(){return this.centerY-this.prevCenterY}},{key:"setRecongizedStateObject",value:function(t){return this.recongizedState=t,this}},{key:"state",get:function(){return this.recongizedState.state},set:function(t){this.recongizedState.state=t;}},{key:"cancel",value:function(){return this.state=Rs,this}}]),t}();Object.assign(_s.prototype,Ze);var Ts={},Ps=0,Es=1,Ms=2,Rs="IDLE";Phaser.Utils.Objects.GetValue;var Ls=Phaser.Math.RotateAround,zs=function(t,e,i,n){return Ls(t,e,i,n),t.rotation+=n,t},As={},Ds=Phaser.Utils.Objects.GetValue,Bs=Phaser.Math.Angle.WrapDegrees,js=Phaser.Math.Angle.ShortestBetween,Ws=Phaser.Math.RadToDeg,Ys=Phaser.Math.DegToRad,Xs=function(t){r(o,t);var i=l(o);function o(t,n){var r;e(this,o);var s=a(r=i.call(this,t,n)),h={states:{IDLE:{enter:function(){s.prevAngle=void 0,s.angle=0;}},BEGIN:{},RECOGNIZED:{enter:function(){s.emit("rotatestart",s);},exit:function(){s.emit("rotateend",s);}}},init:function(){this.state=Fs;},eventEmitter:!1};return r.setRecongizedStateObject(new zn(h)),r}return n(o,[{key:"resetFromJSON",value:function(t){return c(s(o.prototype),"resetFromJSON",this).call(this,t),this.setDragThreshold(Ds(t,"threshold",0)),this}},{key:"onDrag2Start",value:function(){this.prevAngle=Bs(Ws(this.angleBetween)),this.state=Hs,0===this.dragThreshold&&(this.state=Ns);}},{key:"onDrag2End",value:function(){this.state=Fs;}},{key:"onDrag2",value:function(){switch(this.state){case Hs:if(this.pointers[0].getDistance()>=this.dragThreshold&&this.pointers[1].getDistance()>=this.dragThreshold){var t=Bs(Ws(this.angleBetween));this.angle=js(this.prevAngle,t),this.prevAngle=t,this.state=Ns;}break;case Ns:t=Bs(Ws(this.angleBetween));this.angle=js(this.prevAngle,t),this.prevAngle=t,this.emit("rotate",this);}}},{key:"isRotated",get:function(){return this.state===Ns}},{key:"rotation",get:function(){return Ys(this.angle)}},{key:"setDragThreshold",value:function(t){return this.dragThreshold=t,this}}]),o}(_s),Is={spinObject:function(t,e){if(!this.isRotation)return this;void 0===e&&(e=this.pointers[0].camera);var i=this.movementCenterX,n=this.movementCenterY,r=function(t,e,i,n){return void 0===n?n={}:!0===n&&(n=As),i.getWorldPoint(t,e,n),n}(this.centerX,this.centerY,e,!0),s=r.x,o=r.y,a=this.rotation;if(Array.isArray(t))for(var h=t,l=0,u=h.length;l=this.sizerChildren.length?this.sizerChildren.push(e):this.sizerChildren.splice(a,0,e),e.isRexSizer||(i>0&&(0===this.orientation?e.minWidth=void 0===h?vt(e):h:e.minHeight=void 0===l?gt(e):l),s&&(0===this.orientation?e.minHeight=l:e.minWidth=h)),void 0!==o&&this.addChildrenMap(o,e),this},co={add:uo,addSpace:function(t){return this.insertSpace(void 0,t),this},insertSpace:function(t,e){return void 0===e&&(e=1),uo.call(this,new ro(this.scene),{proportion:e,minWidth:0,minHeight:0,index:t}),this},insert:function(t,e,i,n,r,s,o,a){return oo(i)&&(i.index=t),uo.call(this,e,i,n,r,s,o,t,a),this},insertAtPosition:function(t,e,i,n,r,s,o,a,h){var l=so.call(this,t,e);return -1===l&&(l=void 0),this.insert(l,i,n,r,s,o,a,h),this}},fo=Gt.prototype.clear,po=function(t){this.backgroundChildren&&(this.backgroundChildren.length=0);var e,i=!t&&this.sizerEventsEnable;if(i&&(e=this.getChildren([])),fo.call(this,t),i)for(var n,r=0,s=e.length;r=0;e--)this.remove(this.sizerChildren[e],t);return this},clear:function(t){return this.sizerChildren.length=0,po.call(this,t),this}},yo={getChildAlign:function(t){return this.getSizerConfig(t).align},setChildAlign:function(t,e){return "string"==typeof e&&(e=$t[e]),this.getSizerConfig(t).align=e,this}},mo={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,n,r=0,s=this.sizerChildren;if(0===this.orientation)for(var o=this.space.item,a=!0,h=0,l=s.length;h0&&this.proportionLength>0&&(i=n.proportion*this.proportionLength):n.expand&&(i=e-this.space.left-this.space.right-r.left-r.right);return i},getExpandedChildHeight:function(t,e){var i;void 0===e&&(e=this.height);var n=t.rexSizer,r=n.padding;0===this.orientation?n.expand&&(i=e-this.space.top-this.space.bottom-r.top-r.bottom):n.proportion>0&&this.proportionLength>0&&(i=n.proportion*this.proportionLength);return i},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,n=0,r=i.length;n0?(e=t-this.getChildrenWidth(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0;}return t},resolveHeight:function(t){t=Ue.call(this,t);if(void 0===this.proportionLength&&1===this.orientation){var e=t-this.childrenHeight;e>0?(e=t-this.getChildrenHeight(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0;}return t}};Object.assign(mo,co,go,yo,{getChildProportion:function(t){return this.getSizerConfig(t).proportion},setChildProportion:function(t,e){return this.getSizerConfig(t).proportion=e,this}},{getChildExpand:function(t){return this.getSizerConfig(t).expand},setChildExpand:function(t,e){return this.getSizerConfig(t).expand=e,this}});var ko=function(){for(var t,e,i=0,n=this.sizerChildren,r=0,s=n.length;r0&&(i+=e);return i},bo={x:0,h:0,horizontal:0,"left-to-right":0,y:1,v:1,vertical:1,"top-to-bottom":1},xo=function(t){return "string"==typeof t&&(t=bo[t]),t},wo=Phaser.Utils.Objects.IsPlainObject,So=Phaser.Utils.Objects.GetValue,Co=function(t){r(s,t);var i=l(s);function s(t,n,r,o,a,h,l){var u;return e(this,s),wo(n)?(n=So(l=n,"x",0),r=So(l,"y",0),o=So(l,"width",void 0),a=So(l,"height",void 0),h=So(l,"orientation",0)):wo(o)?(o=So(l=o,"width",void 0),a=So(l,"height",void 0),h=So(l,"orientation",0)):wo(h)&&(h=So(l=h,"orientation",0)),void 0===h&&(h=0),(u=i.call(this,t,n,r,o,a,l)).type="rexSizer",u.sizerChildren=[],u.setOrientation(h),u.setItemSpacing(So(l,"space.item",0)),u.setStartChildIndex(So(l,"startChildIndex",0)),u.setRTL(So(l,"rtl",!1)),u.addChildrenMap("items",u.sizerChildren),u}return n(s,[{key:"setOrientation",value:function(t){return this.orientation=xo(t),this}},{key:"setItemSpacing",value:function(t){return this.space.item=t,this}},{key:"setStartChildIndex",value:function(t){return this.startChildIndex=t,this}},{key:"setRTL",value:function(t){return void 0===t&&(t=!0),this.rtl=t,this}},{key:"childrenProportion",get:function(){return void 0===this._childrenProportion&&(this._childrenProportion=ko.call(this)),this._childrenProportion}}]),s}(eo);Object.assign(Co.prototype,mo);var Oo=Phaser.Utils.Objects.IsPlainObject,_o=Phaser.Utils.Objects.GetValue,To=Phaser.Display.Align.CENTER,Po=Phaser.Utils.String.UUID,Eo={add:function(t,e,i,n,r,s,o,a,h){(Re.call(this,t),Oo(e))&&(e=_o(l=e,"key",void 0),i=_o(l,"align",To),a=_o(l,"offsetX",0),h=_o(l,"offsetY",0),n=_o(l,"padding",0),r=_o(l,"expand",!0),t.isRexSizer||(s=_o(l,"minWidth",t._minWidth),o=_o(l,"minHeight",t._minHeighted)));var l,u=void 0!==e;return u||(e=Po()),"string"==typeof i&&(i=$t[i]),void 0===i&&(i=To),void 0===a&&(a=0),void 0===h&&(h=0),void 0===n&&(n=0),void 0===r&&(r=!0),t.isRexSizer||(void 0===s&&(s=t._minWidth),void 0===o&&(o=t._minHeight)),(l=this.getSizerConfig(t)).align=i,l.alignOffsetX=a,l.alignOffsetY=h,l.padding=Ee(n),Oo(r)?(l.expandWidth=_o(r,"width",!1),l.expandHeight=_o(r,"height",!1)):(l.expandWidth=r,l.expandHeight=r),t.isRexSizer||(l.expandWidth&&(t.minWidth=void 0===s?vt(t):s),l.expandHeight&&(t.minHeight=void 0===o?gt(t):o)),this.sizerChildren.hasOwnProperty(e)&&this.sizerChildren[e].destroy(),this.sizerChildren[e]=t,u&&this.addChildrenMap(e,t),this}},Mo={remove:function(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]),De.call(this,t,e),this},removeAll:function(t){for(var e in this.sizerChildren)this.remove(e,t);return this},clear:function(t){for(var e in this.sizerChildren)delete this.sizerChildren[e],this.childrenMap.hasOwnProperty(e)&&delete this.childrenMap[e];return po.call(this,t),this}},Ro={getChildrenWidth:function(){if(this.rexSizer.hidden)return 0;var t,e,i,n=0,r=this.sizerChildren;for(var s in r)e=(t=r[s]).rexSizer.padding,i=this.getChildWidth(t)+e.left+e.right,n=Math.max(i,n);return n+this.space.left+this.space.right},getChildrenHeight:function(){if(this.rexSizer.hidden)return 0;var t,e,i,n=0,r=this.sizerChildren;for(var s in r)i=(t=r[s]).isRexSizer?Math.max(t.minHeight,t.childrenHeight):void 0!==t.minHeight?t.minHeight:gt(t),i+=(e=t.rexSizer.padding).top+e.bottom,n=Math.max(i,n);return n+this.space.top+this.space.bottom},getExpandedChildWidth:function(t,e){var i;void 0===e&&(e=this.width);var n=t.rexSizer;if(n.expandWidth){var r=e-this.space.left-this.space.right,s=n.padding;i=r-s.left-s.right;}return i},getExpandedChildHeight:function(t,e){var i;void 0===e&&(e=this.height);var n=t.rexSizer;if(n.expandHeight){var r=e-this.space.top-this.space.bottom,s=n.padding;i=r-s.top-s.bottom;}return i},getChildrenSizers:function(t){void 0===t&&(t=[]);var e,i=this.sizerChildren;for(var n in i)(e=i[n]).isRexSizer&&t.push(e);return t},layoutChildren:function(){var t,e,i,n,r,s,o,a,h,l=this.innerLeft,u=this.innerTop,c=this.innerWidth,d=this.innerHeight,f=this.sizerChildren;for(var p in f)(t=f[p]).rexSizer.hidden||(i=(e=t.rexSizer).padding,gr.call(this,t),t.isRexSizer?(t.runLayout(this,this.getExpandedChildWidth(t),this.getExpandedChildHeight(t)),io(t,this)):(a=void 0,h=void 0,e.expandWidth&&(a=c-i.left-i.right),e.expandHeight&&(h=d-i.top-i.bottom),dr(t,a,h)),n=l+i.left,s=c-i.left-i.right,r=u+i.top,o=d-i.top-i.bottom,yr.call(this,t,n,r,s,o,e.align,e.alignOffsetX,e.alignOffsetY));}};Object.assign(Ro,Eo,Mo);var Lo=Phaser.Utils.Objects.IsPlainObject,zo=Phaser.Utils.Objects.GetValue,Ao=function(t){r(s,t);var i=l(s);function s(t,n,r,o,a,h){var l;return e(this,s),Lo(n)?(n=zo(h=n,"x",0),r=zo(h,"y",0),o=zo(h,"width",void 0),a=zo(h,"height",void 0)):Lo(o)&&(o=zo(h=o,"width",void 0),a=zo(h,"height",void 0)),(l=i.call(this,t,n,r,o,a,h)).type="rexOverlapSizer",l.sizerChildren={},l.addChildrenMap("items",l.sizerChildren),l}return n(s,[{key:"childToKey",value:function(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}}]),s}(eo);Object.assign(Ao.prototype,Ro);var Do=Co.prototype.add,Bo=Co.prototype.addSpace,jo=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)&&Bo.call(this),Do.call(this,t,{proportion:i,expand:!0});var n=!this.buttonsExpand&&"center"===this.buttonsAlign;n&&Bo.call(this),this.hasTailSpace=n;}else Do.call(this,t,{proportion:i,expand:!0}),this.hasTailSpace=!1;else if(this.hasTailSpace){var r=this.sizerChildren.length-1;Do.call(this,t,{index:r,proportion:i,expand:!0});}else Do.call(this,t,{proportion:i,expand:!0});return e&&this.buttonGroup.add(t),this},Wo={addButton:function(t){if(ar(t))for(var e=t,i=0,n=e.length;i=0;i--)Io.call(this,e[i],t);return this}},Ho=function(t,e,i){if(t){var n=this.setValueCallback,r=this.setValueCallbackScope;n&&(r?n.call(r,t,e,i):n(t,e,i)),this.fireEvent("button.statechange",t,e,i);}},No=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 n=t._selected;t._selected=i,Ho.call(e,t,i,n);}},enumerable:!0,configurable:!0}),t.selected=!1;},Go={add:function(t){return this.buttons.push(t),t._click||(t._click=new br(t,this.clickConfig),t._click.on("click",(function(t,e,i,n){this.fireEvent("button.click",e,i,n);}),this).on("enable",(function(t,e){this.fireEvent("button.enable",e);}),this).on("disable",(function(t,e){this.fireEvent("button.disable",e);}),this),t.on("pointerover",(function(e,i,n,r){this.fireEvent("button.over",t,e,r);}),this).on("pointerout",(function(e,i){this.fireEvent("button.out",t,e,i);}),this).on("pointerdown",(function(e,i,n,r){this.fireEvent("button.down",t,e,r);}),this).on("pointerup",(function(e,i){this.fireEvent("button.up",t,e,i);}),this)),this.buttonsType&&(void 0===t.name&&console.error("".concat(this.parent.constructor.name,": Option button miss value")),No.call(this,t)),this},addMultiple:function(t){for(var e=0,i=t.length;e2?o-2:0),h=2;ha.height/2)){r>(h=aa(a.left,a.centerY,t,e))&&(r=h,n=s);var h,l=i[s+1];if(!l||l.y!==a.y)r>(h=aa(a.right,a.centerY,t,e))&&(r=h,n=s+1);}}return n},la=Phaser.Utils.Objects.IsPlainObject,ua=Phaser.Utils.Objects.GetValue,ca=Phaser.Display.Align.CENTER,da=function(t,e,i,n){if("\n"===t)return this.addNewLine(),this;var r;(Re.call(this,t),la(e))&&(e=ua(r=e,"padding",0),i=ua(r,"key",void 0),n=ua(r,"index",void 0));return void 0===e&&(e=0),(r=this.getSizerConfig(t)).align=ca,r.padding=Ee(e),void 0===n||n>=this.sizerChildren.length?this.sizerChildren.push(t):this.sizerChildren.splice(n,0,t),void 0!==i&&this.addChildrenMap(i,t),this},fa={add:function(t,e,i){if(ar(t))for(var n=t,r=0,s=n.length;r=0;e--)this.remove(this.sizerChildren[e],t);return this},clear:function(t){return this.sizerChildren.length=0,po.call(this,t),this}},ga={getChildrenWidth:function(){return this.rexSizer.hidden?0:this.maxChildWidth+this.space.left+this.space.right},getChildrenHeight:function(){return this.rexSizer.hidden?0:this.widthWrapResult.height+this.space.top+this.space.bottom},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,n=0,r=i.length;nr&&Sa.addNewLine(this);}else for(s=0,o=t.length;s=0;i--)Pa.call(this,e[i],t);return this}},Ma=Phaser.Utils.Objects.GetValue,Ra=function(t){r(o,t);var i=l(o);function o(t,n){var r;e(this,o),void 0===n&&(n={});var s=n.space;"number"==typeof s&&(n.space={item:s,line:s}),(r=i.call(this,t,n)).type="rexFixWidthButtons",r.buttonGroup=new $o({parent:a(r),eventEmitter:Ma(n,"eventEmitter",a(r)),groupName:Ma(n,"groupName",void 0),clickConfig:Ma(n,"click",void 0)}).setButtonsType(n);var h=Ma(n,"background",void 0),l=Ma(n,"buttons",void 0);return r.buttonsAlign=Ma(n,"align",void 0),h&&r.addBackground(h),l&&r.addButtons(l),r.addChildrenMap("background",h),r.addChildrenMap("buttons",r.buttonGroup.buttons),r}return n(o,[{key:"destroy",value:function(t){this.scene&&!this.ignoreDestroy&&(c(s(o.prototype),"destroy",this).call(this,t),this.buttonGroup.destroy(),this.buttonGroup=void 0);}},{key:"buttons",get:function(){return this.buttonGroup.buttons}},{key:"groupName",get:function(){return this.buttonGroup.groupName},set:function(t){this.buttonGroup.groupName=t;}},{key:"eventEmitter",get:function(){return this.buttonGroup.eventEmitter}}]),o}(xa);Object.assign(Ra.prototype,Oa,Ea,Zo,ta);var La=function(){return Array.prototype.reduce.call(arguments,za,0)},za=function(t,e){return t+e},Aa=Phaser.Utils.Objects.IsPlainObject,Da=Phaser.Utils.Objects.GetValue,Ba=Phaser.Display.Align.CENTER,ja=function(t,e,i,n,r){if("number"==typeof t||"number"==typeof e)if(void 0===t){for(var s=0;s=0;e--){var i=this.sizerChildren[e];i&&this.remove(i,t);}return this},clear:function(t){return Ya(this.sizerChildren,null),po.call(this,t),this}},Ia={setColumnSpace:function(t){if(this.space.column||(this.space.column=[]),this.space.column.length=this.columnCount-1,"number"==typeof t)Ya(this.space.column,t);else for(var e=0,i=this.columnCount-1;e=0;n--){var r=n*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},Ga={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);for(var e,i,n,r,s=0,o=this.sizerChildren,a=0;a0){var i=t-this.getChildrenWidth(!1);i>=0&&(this.proportionWidthLength=i/e);}else this.proportionWidthLength=0;}return t},resolveHeight:function(t){t=Ue.call(this,t);if(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,n;for(var r in this.sizerChildren)(e=this.sizerChildren[r])&&e.isRexSizer&&!e.ignoreLayout&&(n=this.getColumnWidth(parseInt(r)%this.columnCount),i=this.getExpandedChildWidth(e,n),i=e.resolveWidth(i),e.resolveChildrenWidth(i));},runWidthWrap:function(t){var e,i,n;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(n=this.getColumnWidth(parseInt(r)%this.columnCount),i=this.getExpandedChildWidth(e,n),e.isRexSizer&&(i=e.resolveWidth(i)),e.runWidthWrap(i));return this},resetGrid:function(t,e,i,n,r){if(void 0===i&&(i=0),void 0===n&&(n=0),this.columnCount=t,this.rowCount=e,this.gridCount=t*e,this.removeAll(),this.sizerChildren.length=t*e,Ya(this.sizerChildren,null),this.columnProportions=[],this.columnProportions.length=t,"number"==typeof i)Ya(this.columnProportions,i);else for(var s=0;s0&&(e+=t);return e},Ua=function(){for(var t,e=0,i=0;i0&&(e+=t);return e},Ja=Phaser.Utils.Objects.IsPlainObject,Ka=Phaser.Utils.Objects.GetValue,qa=function(t){r(o,t);var i=l(o);function o(t,n,r,s,a,h,l,u,c,d){var f;return e(this,o),Ja(n)?(n=Ka(d=n,"x",0),r=Ka(d,"y",0),s=Ka(d,"width",void 0),a=Ka(d,"height",void 0),h=Ka(d,"column",d.col||0),l=Ka(d,"row",0),u=Ka(d,"columnProportions",0),c=Ka(d,"rowProportions",0)):Ja(s)?(s=Ka(d=s,"width",void 0),a=Ka(d,"height",void 0),h=Ka(d,"column",d.col||0),l=Ka(d,"row",0),u=Ka(d,"columnProportions",0),c=Ka(d,"rowProportions",0)):Ja(h)?(h=Ka(d=h,"column",d.col||0),l=Ka(d,"row",0),u=Ka(d,"columnProportions",0),c=Ka(d,"rowProportions",0)):Ja(u)&&(u=Ka(d=u,"columnProportions",0),c=Ka(d,"rowProportions",0)),(f=i.call(this,t,n,r,s,a,d)).type="rexGridSizer",f.sizerChildren=[],f.addChildrenMap("items",f.sizerChildren),f.setCreateCellContainerCallback(Ka(d,"createCellContainerCallback")),f.setIndentLeft(Ka(d,"space.indentLeftOdd",0),Ka(d,"space.indentLeftEven",0)),f.setIndentTop(Ka(d,"space.indentTopOdd",0),Ka(d,"space.indentTopEven",0)),f.resetGrid(h,l,u,c,Ka(d,"space",void 0)),f}return n(o,[{key:"destroy",value:function(t){this.scene&&!this.ignoreDestroy&&(c(s(o.prototype),"destroy",this).call(this,t),this.columnProportions=void 0,this.rowProportions=void 0,this.columnWidth=void 0,this.rowHeight=void 0,this.createCellContainerCallback=void 0);}},{key:"setColumnProportion",value:function(t,e){return t>=this.columnProportions.length||(this.columnProportions[t]=e),this}},{key:"setRowProportion",value:function(t,e){return t>=this.rowProportions.length||(this.rowProportions[t]=e),this}},{key:"totalColumnProportions",get:function(){return void 0===this._totalColumnProportions&&(this._totalColumnProportions=Va.call(this)),this._totalColumnProportions}},{key:"totalRowProportions",get:function(){return void 0===this._totalRowProportions&&(this._totalRowProportions=Ua.call(this)),this._totalRowProportions}},{key:"getChildAt",value:function(t,e){return this.sizerChildren[e*this.columnCount+t]}},{key:"childToGridIndex",value:function(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)}},{key:"getColumnWidth",value:function(t){var e=this.columnProportions[t];return 0===e?this.columnWidth[t]:e*this.proportionWidthLength}},{key:"getRowHeight",value:function(t){var e=this.rowProportions[t];return 0===e?this.rowHeight[t]:e*this.proportionHeightLength}},{key:"setCreateCellContainerCallback",value:function(t){return this.createCellContainerCallback=t,this}}]),o}(eo);Object.assign(qa.prototype,Ga);var Za=qa.prototype.add,$a={addButton:function(t,e,i){return Za.call(this,t,e,i,void 0,0,this.buttonsExpand),this.buttonGroup.add(t),this},addButtons:function(t,e){for(var i=0,n=t;i=0;i--)eh.call(this,e[i],t);return this}},nh=Phaser.Utils.Objects.GetValue,rh=function(t){r(o,t);var i=l(o);function o(t,n){var r;e(this,o),void 0===n&&(n={});var s=nh(n,"row",0),h=nh(n,"column",n.col||0),l=nh(n,"createCellContainerCallback"),u=nh(n,"buttons",void 0),c=nh(n,"expand",!0),d=c?1:0;if(l&&(n.createCellContainerCallback=void 0),void 0!==u){s=Math.max(s,u.length);for(var f=0,p=u.length;f=0||t.y>=0,t.x=Math.abs(t.x),t.y=Math.abs(t.y);},Lh=function(t,e,i){var n=i.length;if(n>=2){var r=i[n-2],s=i[n-1];if(t===r&&e===s)return i}return i.push(t,e),i},zh=Phaser.Math.DegToRad,Ah=function(t,e,i,n,r,s,o,a,h){o&&s>r?s-=360:!o&&s>>16,a=(65280&r)>>>8,h=255&r;t.fillStyle="rgba("+o+","+a+","+h+","+s+")";}(r,e),r.fill()),e.isStroked&&(!function(t,e,i,n){var r=i||e.strokeColor,s=n||e.strokeAlpha,o=(16711680&r)>>>16,a=(65280&r)>>>8,h=255&r;t.strokeStyle="rgba("+o+","+a+","+h+","+s+")",t.lineWidth=e.lineWidth;}(r,e),r.stroke()),r.restore();}}},Xh=Phaser.GameObjects.Shape,Ih=Phaser.Utils.Objects.IsPlainObject,Fh=Phaser.Utils.Objects.GetValue,Hh=Phaser.Geom.Polygon.Earcut,Nh=function(t){r(s,t);var i=l(s);function s(t,n,r,o,a,h,l,u){var c,d,f,p,v;if(e(this,s),Ih(n)){var g=n;n=g.x,r=g.y,o=g.width,a=g.height,h=g.radius,l=g.color,u=g.alpha,d=g.strokeColor,f=g.strokeAlpha,p=g.strokeWidth,v=g.shape;}void 0===n&&(n=0),void 0===r&&(r=0),void 0===o&&(o=1),void 0===a&&(a=o),void 0===h&&(h=0),void 0===v&&(v=0);var y=new Ph;if((c=i.call(this,t,"rexRoundRectangleShape",y)).setShapeType(v),0===c.shapeType){var m=Fh(h,"radius",h);y.setTo(0,0,o,a,m);}else {m={x:o/2,y:a/2};y.setTo(0,0,o,a,m);}var k=Fh(h,"iteration",void 0);return c.setIteration(k),c.setPosition(n,r),c.setFillStyle(l,u),void 0!==d&&void 0===p&&(p=2),c.setStrokeStyle(p,d,f),c.updateDisplayOrigin(),c.dirty=!0,c}return n(s,[{key:"fillColor",get:function(){return this._fillColor},set:function(t){this._fillColor=t,this.isFilled=null!=t&&this._fillAlpha>0;}},{key:"fillAlpha",get:function(){return this._fillAlpha},set:function(t){this._fillAlpha=t,this.isFilled=t>0&&null!=this._fillColor;}},{key:"setFillStyle",value:function(t,e){return void 0===e&&(e=1),this.fillColor=t,this.fillAlpha=e,this}},{key:"strokeColor",get:function(){return this._strokeColor},set:function(t){this._strokeColor=t,this.isStroked=null!=t&&this._strokeAlpha>0&&this._lineWidth>0;}},{key:"strokeAlpha",get:function(){return this._strokeAlpha},set:function(t){this._strokeAlpha=t,this.isStroked=t>0&&null!=this._strokeColor&&this._lineWidth>0;}},{key:"lineWidth",get:function(){return this._lineWidth},set:function(t){this._lineWidth=t,this.isStroked=t>0&&null!=this._strokeColor;}},{key:"setStrokeStyle",value:function(t,e,i){return void 0===i&&(i=1),this.lineWidth=t,this.strokeColor=e,this.strokeAlpha=i,this}},{key:"updateData",value:function(){var t=this.geom,e=this.pathData;e.length=0;var i,n=t.width,r=t.height,s=t.cornerRadius,o=this.iteration+1;if(i=s.tl,Gh(i))if(i.convex){var a=i.x,h=i.y;Ah(a,h,i.x,i.y,180,270,!1,o,e);}else {Ah(a=0,h=0,i.x,i.y,90,0,!0,o,e);}else Lh(0,0,e);if(i=s.tr,Gh(i))if(i.convex){a=n-i.x,h=i.y;Ah(a,h,i.x,i.y,270,360,!1,o,e);}else {Ah(a=n,h=0,i.x,i.y,180,90,!0,o,e);}else Lh(n,0,e);if(i=s.br,Gh(i))if(i.convex){a=n-i.x,h=r-i.y;Ah(a,h,i.x,i.y,0,90,!1,o,e);}else {Ah(a=n,h=r,i.x,i.y,270,180,!0,o,e);}else Lh(n,r,e);if(i=s.bl,Gh(i))if(i.convex){a=i.x,h=r-i.y;Ah(a,h,i.x,i.y,90,180,!1,o,e);}else {Ah(a=0,h=r,i.x,i.y,360,270,!0,o,e);}else Lh(0,r,e);return e.push(e[0],e[1]),this.pathIndexes=Hh(e),this}},{key:"setShapeType",value:function(t){return "string"==typeof t&&(t=Vh[t]),this.shapeType=t,this}},{key:"width",get:function(){return this.geom.width},set:function(t){this.resize(t,this.height);}},{key:"height",get:function(){return this.geom.height},set:function(t){this.resize(this.width,t);}},{key:"setSize",value:function(t,e){if(void 0===e&&(e=t),this.geom.width===t&&this.geom.height===e)return this;this.geom.setSize(t,e),1===this.shapeType&&this.setRadius({x:t/2,y:e/2}),this.updateDisplayOrigin(),this.dirty=!0;var i=this.input;return i&&!i.customHitArea&&(i.hitArea.width=t,i.hitArea.height=e),this}},{key:"resize",value:function(t,e){return this.setSize(t,e),this}},{key:"radius",get:function(){return this.geom.radius},set:function(t){this.geom.setRadius(t),this.updateDisplayOrigin(),this.dirty=!0;}},{key:"radiusTL",get:function(){return this.geom.radiusTL},set:function(t){this.geom.radiusTL=t,this.dirty=!0;}},{key:"radiusTR",get:function(){return this.geom.radiusTR},set:function(t){this.geom.radiusTR=t,this.dirty=!0;}},{key:"radiusBL",get:function(){return this.geom.radiusBL},set:function(t){this.geom.radiusBL=t,this.dirty=!0;}},{key:"radiusBR",get:function(){return this.geom.radiusBR},set:function(t){this.geom.radiusBR=t,this.dirty=!0;}},{key:"setRadius",value:function(t){return void 0===t&&(t=0),this.radius=t,this}},{key:"setRadiusTL",value:function(t){return void 0===t&&(t=0),this.radiusTL=t,this}},{key:"setRadiusTR",value:function(t){return void 0===t&&(t=0),this.radiusTR=t,this}},{key:"setRadiusBL",value:function(t){return void 0===t&&(t=0),this.radiusBL=t,this}},{key:"setRadiusBR",value:function(t){return void 0===t&&(t=0),this.radiusBR=t,this}},{key:"cornerRadius",get:function(){return this.geom.cornerRadius},set:function(t){this.radius=t;}},{key:"setCornerRadius",value:function(t){return this.setRadius(t)}},{key:"iteration",get:function(){return this._iteration},set:function(t){void 0!==this._iteration?this._iteration!==t&&(this._iteration=t,this.dirty=!0):this._iteration=t;}},{key:"setIteration",value:function(t){return void 0===t&&(t=6),this.iteration=t,this}}]),s}(Xh),Gh=function(t){return t.x>0&&t.y>0},Vh={rectangle:0,circle:1};Object.assign(Nh.prototype,Yh);var Uh=Phaser.Utils.Objects.GetValue,Jh=function(t){r(s,t);var i=l(s);function s(t,n){var r;e(this,s),(r=i.call(this,t,n)).style=Uh(n,"style",a(r));var o=Uh(n,"propertiesMap");return r.activeStyle=Kh(n,"active",o),r.hoverStyle=Kh(n,"hover",o),r.disableStyle=Kh(n,"disable",o),r.onModifyStyle=Uh(n,"onModifyStyle"),r}return n(s,[{key:"getStyle",value:function(t){return function(t,e,i){if(void 0===i&&(i={}),Array.isArray(e))for(var n=0,r=e.length;n=6?(n=[arguments[2],void 0,arguments[3]],r=[arguments[4],void 0,arguments[5]]):(n=Ch(n),r=Ch(r)),this.textureKey=e,this.baseFrameName=i,this.columns.data=n,this.columns.count=n?n.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 s=this.scene.sys.textures.get(e);if(!s)return this.clear(),this;if(!n||!r)return this.clear(),this;for(var o=s.get(i),a=o.width,h=0,l=0,u=n.length;l0?0:g,b=0;l=0;for(var C=n.length;l0?0:y),y>=1&&g>=1){var O=t(m=this.getFrameNameCallback(l,w,i));"string"!==O&&"number"!==O||s.add(m,0,b+o.cutX,x+o.cutY,y,g);}b+=y;}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,n,r,s,o,a,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,f=c>=0?this.maxFixedPartScaleY:this.height/l;if(this.preserveRatio){var p=Math.min(d,f);if(d>p){var v=(d-p)*h;u>=0?u+=v:u=v,d=p;}if(f>p){var g=(f-p)*l;c>=0?c+=g:c=g,f=p;}}this.columns.scale=d,this.rows.scale=f,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 y=0,m=0;this._beginDraw();for(var k=0,b=this.rows.count;k0&&a>0&&(0===(0===s.stretch&&0===r.stretch||0===this.getStretchMode(x,k)?0:1)?this._drawImage(this.textureKey,n,y,m,o,a):this._drawTileSprite(this.textureKey,n,y,m,o,a)),y+=o;m+=a;}this._endDraw();},setStretchMode:function(t){return vl(t)?(this.stretchMode.edge=yl(gl(t,"edge",0)),this.stretchMode.internal=yl(gl(t,"internal",0))):(t=yl(t),this.stretchMode.edge=t,this.stretchMode.internal=t),this},getStretchMode:function(t,e){return kl.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}},xl=Phaser.Utils.Objects.IsPlainObject,wl=Phaser.Utils.Objects.GetValue,Sl=Phaser.GameObjects,Cl=void 0,Ol=function(t,e){if(Cl||(Cl={},ni(t).events.once("destroy",(function(){for(var t in Cl)Cl[t].destroy();Cl=void 0;}))),!Cl.hasOwnProperty(e)){var i=ni(t).scene.systemScene;(t=new Sl[e](i)).setOrigin(0),Cl[e]=t;}return Cl[e]},_l=function(t){r(s,t);var i=l(s);function s(){return e(this,s),i.apply(this,arguments)}return n(s)}(function(t,i){var o=function(t){r(a,t);var o=l(a);function a(t,n,r,s,h,l,u,c,d,f){var p;if(e(this,a),xl(n)?(n=wl(f=n,"x",0),r=wl(f,"y",0),s=wl(f,"width",1),h=wl(f,"height",1),l=wl(f,"key",void 0),u=wl(f,"baseFrame",void 0),c=wl(f,"columns",void 0),d=wl(f,"rows",void 0)):xl(s)?(s=wl(f=s,"width",1),h=wl(f,"height",1),l=wl(f,"key",void 0),u=wl(f,"baseFrame",void 0),c=wl(f,"columns",void 0),d=wl(f,"rows",void 0)):xl(l)?(l=wl(f=l,"key",void 0),u=wl(f,"baseFrame",void 0),c=wl(f,"columns",void 0),d=wl(f,"rows",void 0)):xl(u)?(u=wl(f=u,"baseFrame",void 0),c=wl(f,"columns",void 0),d=wl(f,"rows",void 0)):Array.isArray(u)?(f=d,d=c,c=u,u=wl(f,"baseFrame",void 0)):xl(c)&&(c=wl(f=c,"columns",void 0),d=wl(f,"rows",void 0)),void 0===c){var v=wl(f,"leftWidth",void 0),g=wl(f,"rightWidth",void 0);void 0!==v&&void 0!==g&&(c=[v,void 0,g]);}if(void 0===d){var y=wl(f,"topHeight",void 0),m=wl(f,"bottomHeight",void 0);void 0!==y&&void 0!==m&&(d=[y,void 0,m]);}(p=o.call(this,t)).type=i,p.setPosition(n,r).setSize(s,h).setOrigin(.5,.5),p.columns={},p.rows={},p.stretchMode={},p._tileSprite=void 0,p._image=void 0,p.setGetFrameNameCallback(wl(f,"getFrameNameCallback",void 0)),p.setStretchMode(wl(f,"stretchMode",0)),p.setPreserveRatio(wl(f,"preserveRatio",!0));var k=wl(f,"maxFixedPartScale",1),b=wl(f,"maxFixedPartScaleX",k),x=wl(f,"maxFixedPartScaleY",void 0);return p.setMaxFixedPartScale(b,x),p.setBaseTexture(l,u,c,d),p}return n(a,[{key:"minWidth",get:function(){return this.columns.minWidth}},{key:"minHeight",get:function(){return this.rows.minHeight}},{key:"fixedPartScaleX",get:function(){return this.columns.scale}},{key:"fixedPartScaleY",get:function(){return this.rows.scale}},{key:"resize",value:function(t,e){return this.width===t&&this.height===e||(c(s(a.prototype),"resize",this)?c(s(a.prototype),"resize",this).call(this,t,e):c(s(a.prototype),"setSize",this).call(this,t,e),this.updateTexture()),this}}]),a}(t);return Object.assign(o.prototype,bl),o}(Phaser.GameObjects.RenderTexture,"rexNinePatch")),Tl={_drawImage:function(t,e,i,n,r,s){var o=Ol(this,"Image").setTexture(t,e).setDisplaySize(r,s);this.draw(o,i,n);},_drawTileSprite:function(t,e,i,n,r,s){var o=Ol(this,"TileSprite").setTexture(t,e).setSize(r,s);this.draw(o,i,n);}};Object.assign(_l.prototype,Tl);var Pl=function(t,e){var i,n;switch(e&&(e.hasOwnProperty("type")?i=e.type:e.hasOwnProperty("leftWidth")?i="nineSlice":e.hasOwnProperty("key")&&(i="image")),i){case"image":n=new fl(t,e);break;case"nineSlice":n=e.hasOwnProperty("stretchMode")?new _l(t,e):new ll(t,e);break;default:n=new $h(t,e);}return t.add.existing(n),n},El=Phaser.GameObjects.Text,Ml=Phaser.Utils.Objects.GetValue,Rl=function(t){r(s,t);var i=l(s);function s(t,n){var r;e(this,s),void 0===n&&(n={});var o=Ml(n,"x",0),a=Ml(n,"y",0),h=Ml(n,"text","");return (r=i.call(this,t,o,a,h,n)).type="rexStatesText",n.style=r.style,n.onModifyStyle=function(t,e){var i=e.hasOwnProperty("fontStyle")||e.hasOwnProperty("fontSize")||e.hasOwnProperty("fontFamily");t.style.update(i);},r.addStyleManager(n),delete n.style,r}return n(s)}(El);Object.assign(Rl.prototype,Zh); +!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).rexconfirmdialog=e();}(undefined,(function(){function t(e){return t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},t(e)}function e(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){for(var i=0;it.length)&&(e=t.length);for(var i=0,n=new Array(e);i=0;i--)(e=this.children[i]).parentContainer||e.displayList||e.destroy(t);this.clear(!t),c(s(o.prototype),"destroy",this).call(this,t);}}},{key:"contains",value:function(t){return -1!==this.children.indexOf(t)}},{key:"add",value:function(t){var e=this;return b(this.children,t,0,(function(t){t.once("destroy",e.onChildDestroy,e);}),this),this}},{key:"remove",value:function(t,e){var i=this;return x(this.children,t,(function(t){t.off("destroy",i.onChildDestroy,i),e&&t.destroy();})),this}},{key:"onChildDestroy",value:function(t,e){this.remove(t,!1);}},{key:"clear",value:function(t){for(var e,i=0,n=this.children.length;i0;){var n=i.shift();!e(n)&&n.isRexContainerLite&&i.push.apply(i,p(n.children));}},it=Phaser.Utils.Array,nt={getChildren:function(t){if(t)for(var e=0,i=this.children.length;e=0;e--)this.remove(this.backgroundChildren[e],t);return this}},Xe=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},Ie=/(\S+)\[(\d+)\]/i,Fe=Phaser.Utils.Objects.GetValue,He=function(t,e){return void 0===e?t:t[e]},Ne=function(e,i,n){void 0===e&&(e={}),void 0===i&&(i=0);var r=t(i);return "string"===r?e[i]=n:"number"===r?(e.left=i,e.right=i,e.top=i,e.bottom=i):(e.left=Fe(i,"left",0),e.right=Fe(i,"right",0),e.top=Fe(i,"top",0),e.bottom=Fe(i,"bottom",0)),e},Ge={getInnerPadding:function(t){return He(this.space,t)},setInnerPadding:function(t,e){return Ne(this.space,t,e),this},getOuterPadding:function(t){return He(this.getSizerConfig(this).padding,t)},setOuterPadding:function(t,e){return Ne(this.getSizerConfig(this).padding,t,e),this},getChildOuterPadding:function(t,e){return "string"==typeof t&&(t=this.getElement(t)),He(this.getSizerConfig(t).padding,e)},setChildOuterPadding:function(t,e,i){return "string"==typeof t&&(t=this.getElement(t)),Ne(this.getSizerConfig(t).padding,e,i),this}},Ve=function(t){var e=this.childrenWidth,i=void 0!==this.minWidth?this.minWidth:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn("Layout width warn: ".concat(this.constructor.name,"'s minWidth (").concat(i,") < childrenWidth (").concat(e,")"))):this.layoutWarnEnable&&(i>t||e>t)&&console.warn("Layout width warn: ".concat(this.constructor.name,"'s minWidth (").concat(i,") or childrenWidth (").concat(e," > targetWidth ").concat(t,")")),t},Ue=function(t){var e=this.childrenHeight,i=void 0!==this.minHeight?this.minHeight:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn("Layout height warn: ".concat(this.constructor.name,"'s minHeight (").concat(i,") < childrenHeight (").concat(e,")"))):this.layoutWarnEnable&&(i>t||e>t)&&console.warn("Layout height warn: ".concat(this.constructor.name,"'s minHeight (").concat(i,") or childrenHeight (").concat(e,") > targetHeight (").concat(t,")")),t},Je={getShownChildren:function(t){void 0===t&&(t=[]);for(var e,i=this.children,n=0,r=i.length;n0;){var i=e.shift();i.rexSizer&&i.rexSizer.hidden||(i!==this&&t.push(i),i.isRexContainerLite&&e.push.apply(e,p(i.children)));}return t}},Ke=function(){this._childrenWidth=void 0,this._childrenHeight=void 0;for(var t,e=this.getChildrenSizers(),i=0,n=e.length;i0?-this.delay:0,this.state=this.nowTime>=0?mi:yi,this.repeatCounter=0,this}},{key:"stop",value:function(){return this.state=gi,this}},{key:"update",value:function(t,e){this.state!==gi&&this.state!==bi&&0!==e&&0!==this.timeScale&&(this.nowTime+=e*this.timeScale,this.justRestart=!1,this.nowTime>=this.duration?-1===this.repeat||this.repeatCounter0&&(this.nowTime-=this.repeatDelay,this.state=ki)):(this.nowTime=this.duration,this.state=bi):this.nowTime>=0&&(this.state=mi));}},{key:"t",get:function(){var t;switch(this.state){case gi:case yi:case ki:t=0;break;case mi:t=this.nowTime/this.duration;break;case bi:t=1;}return pi(t,0,1)},set:function(t){(t=pi(t,-1,1))<0?(this.state=yi,this.nowTime=-this.delay*t):(this.state=mi,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++);}},{key:"setT",value:function(t){return this.t=t,this}},{key:"isIdle",get:function(){return this.state===gi}},{key:"isDelay",get:function(){return this.state===yi}},{key:"isCountDown",get:function(){return this.state===mi}},{key:"isRunning",get:function(){return this.state===yi||this.state===mi}},{key:"isDone",get:function(){return this.state===bi}},{key:"isOddIteration",get:function(){return 1==(1&this.repeatCounter)}},{key:"isEvenIteration",get:function(){return 0==(1&this.repeatCounter)}}]),t}(),gi=0,yi=1,mi=2,ki=3,bi=-1,xi=function(t){r(o,t);var i=l(o);function o(t,n){var r;return e(this,o),(r=i.call(this,t,n)).timer=new vi,r}return n(o,[{key:"shutdown",value:function(t){this.isShutdown||(c(s(o.prototype),"shutdown",this).call(this,t),this.timer.destroy(),this.timer=void 0);}},{key:"start",value:function(){return this.timer.start(),c(s(o.prototype),"start",this).call(this),this}},{key:"stop",value:function(){return this.timer.stop(),c(s(o.prototype),"stop",this).call(this),this}},{key:"complete",value:function(){return this.timer.stop(),c(s(o.prototype),"complete",this).call(this),this}}]),o}(ci),wi=Phaser.Utils.Objects.GetValue,Si=Phaser.Utils.Objects.GetAdvancedValue,Ci=Phaser.Tweens.Builders.GetEaseFunction,Oi=function(t){r(o,t);var i=l(o);function o(){return e(this,o),i.apply(this,arguments)}return n(o,[{key:"resetFromJSON",value:function(t){return this.timer.resetFromJSON(wi(t,"timer")),this.setEnable(wi(t,"enable",!0)),this.setTarget(wi(t,"target",this.parent)),this.setDelay(Si(t,"delay",0)),this.setDuration(Si(t,"duration",1e3)),this.setEase(wi(t,"ease","Linear")),this.setRepeat(wi(t,"repeat",0)),this}},{key:"setEnable",value:function(t){return null==t&&(t=!0),this.enable=t,this}},{key:"setTarget",value:function(t){return void 0===t&&(t=this.parent),this.target=t,this}},{key:"setDelay",value:function(t){return this.delay=t,this}},{key:"setDuration",value:function(t){return this.duration=t,this}},{key:"setRepeat",value:function(t){return this.repeat=t,this}},{key:"setRepeatDelay",value:function(t){return this.repeatDelay=t,this}},{key:"setEase",value:function(t){return void 0===t&&(t="Linear"),this.ease=t,this.easeFn=Ci(t),this}},{key:"start",value:function(){return this.timer.isRunning||c(s(o.prototype),"start",this).call(this),this}},{key:"restart",value:function(){return this.timer.stop(),this.start.apply(this,arguments),this}},{key:"stop",value:function(t){return void 0===t&&(t=!1),c(s(o.prototype),"stop",this).call(this),t&&(this.timer.setT(1),this.updateGameObject(this.target,this.timer),this.complete()),this}},{key:"update",value:function(t,e){if(!this.isRunning||!this.enable||!this.parent.active)return this;var i=this.target,n=this.timer;return n.update(t,e),n.isDelay||this.updateGameObject(i,n),this.emit("update",i,this),n.isDone&&this.complete(),this}},{key:"updateGameObject",value:function(t,e){}}]),o}(xi),_i=Phaser.Utils.Objects.GetValue,Pi=Phaser.Utils.Objects.GetAdvancedValue,Ti=Phaser.Math.Linear,Ei=function(t){r(o,t);var i=l(o);function o(t,n){var r;return e(this,o),(r=i.call(this,t,n)).scaleStart={},r.scaleEnd={},r.resetFromJSON(n),r.boot(),r}return n(o,[{key:"resetFromJSON",value:function(t){return c(s(o.prototype),"resetFromJSON",this).call(this,t),this.setMode(_i(t,"mode",0)),this.setScaleRange(Pi(t,"start",void 0),Pi(t,"end",0)),this}},{key:"setMode",value:function(t){return "string"==typeof t&&(t=Mi[t]),this.mode=t,this}},{key:"setScaleRange",value:function(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}},{key:"start",value:function(){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),c(s(o.prototype),"start",this).call(this),this}},{key:"updateGameObject",value:function(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasScaleX&&(t.scaleX=Ti(this.startX,this.endX,i)),this.hasScaleY&&(t.scaleY=Ti(this.startY,this.endY,i));}},{key:"complete",value:function(){return c(s(o.prototype),"complete",this).call(this),1===this.mode&&this.parent.destroy(),this}}]),o}(Oi),Mi={stop:0,destroy:1,yoyo:2},Ri=function(t,e,i,n,r){var s,o;switch(void 0===n&&(n="Cubic"),i){case 0:case"x":s={x:0},o={x:t.scaleX};break;case 1:case"y":s={y:0},o={y:t.scaleY};break;default:s=0,o=t.scale;}var a={mode:0,start:s,end:o,duration:e,ease:n};return void 0===r?r=new Ei(t,a):r.resetFromJSON(a),r.restart(),r},Li=function(t,e,i,n,r,s){void 0===n&&(n="Linear"),r instanceof Ei&&(s=r,r=void 0),void 0===r&&(r=!0);var o={};switch(o.mode=r?1:0,i){case 0:case"x":o.end={x:0};break;case 1:case"y":o.end={y:0};break;default:o.end=0;}return o.duration=e,o.ease=n,void 0===s?s=new Ei(t,o):s.resetFromJSON(o),s.restart(),s},zi=function(t,e){return new Promise((function(i,n){t.once(e,(function(){i();}));}))},Ai=function(t){return zi(t,"complete")},Di=Phaser.Utils.Objects.IsPlainObject,Bi=function(t,e){e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0);})),e.on("update",(function(){var e=je.getParentSizer(t);e&&e.resetChildPositionState(t);}));},ji={popUp:function(t,e,i){if(Di(t)){var n=t;t=n.duration,e=n.orientation,i=n.ease;}var r=void 0===this._scaleBehavior;return this._scaleBehavior=Ri(this,t,e,i,this._scaleBehavior),r&&Bi(this,this._scaleBehavior),this._scaleBehavior.completeEventName="popup.complete",this},popUpPromise:function(t,e,i){return this.popUp(t,e,i),Ai(this._scaleBehavior)},scaleDownDestroy:function(t,e,i,n){if(Di(t)){var r=t;t=r.duration,e=r.orientation,i=r.ease,n=r.destroy;}var s=void 0===this._scaleBehavior;return this._scaleBehavior=Li(this,t,e,i,n,this._scaleBehavior),s&&Bi(this,this._scaleBehavior),this._scaleBehavior.completeEventName="scaledown.complete",this},scaleDownDestroyPromise:function(t,e,i,n){return this.scaleDownDestroy(t,e,i,n),Ai(this._scaleBehavior)},scaleDown:function(t,e,i){return this.scaleDownDestroy(t,e,i,!1),this},scaleDownPromise:function(t,e,i){return this.scaleDown(t,e,i),Ai(this._scaleBehavior)},scaleYoyo:function(t,e,i,n,r){if(Di(t)){var s=t;t=s.duration,e=s.peakValue,i=s.repeat,n=s.orientation,r=s.ease;}var o=void 0===this._scaleBehavior;return this._scaleBehavior=function(t,e,i,n,r,s,o){var a,h;switch(void 0===i&&(i=1.2),void 0===n&&(n=0),void 0===s&&(s="Cubic"),r){case 0:case"x":a={x:t.scaleX},h={x:i};break;case 1:case"y":a={y:t.scaleX},h={y:i};break;default:a=t.scaleX,h=i;}var l={mode:2,start:a,end:h,duration:e/2,ease:s,repeat:n};return void 0===o?o=new Ei(t,l):o.resetFromJSON(l),o.restart(),o}(this,t,e,i,n,r,this._scaleBehavior),o&&Bi(this,this._scaleBehavior),this._scaleBehavior.completeEventName="scaleyoyo.complete",this},scaleYoyoPromise:function(t,e,i,n,r){return this.scaleYoyo(t,e,i,n,r),Ai(this._scaleBehavior)}},Wi=Phaser.Utils.Objects.GetValue,Yi=Phaser.Utils.Objects.GetAdvancedValue,Xi=Phaser.Math.Linear,Ii=function(t){r(o,t);var i=l(o);function o(t,n){var r;return e(this,o),(r=i.call(this,t,n)).resetFromJSON(n),r.boot(),r}return n(o,[{key:"resetFromJSON",value:function(t){return c(s(o.prototype),"resetFromJSON",this).call(this,t),this.setMode(Wi(t,"mode",0)),this.setAlphaRange(Yi(t,"start",this.parent.alpha),Yi(t,"end",0)),this}},{key:"setMode",value:function(t){return "string"==typeof t&&(t=Fi[t]),this.mode=t,this}},{key:"setAlphaRange",value:function(t,e){return this.alphaStart=t,this.alphaEnd=e,this}},{key:"start",value:function(){return this.timer.isRunning||(this.parent.setAlpha(this.alphaStart),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),c(s(o.prototype),"start",this).call(this)),this}},{key:"updateGameObject",value:function(t,e){var i=e.t;e.isOddIteration&&(i=1-i),t.alpha=Xi(this.alphaStart,this.alphaEnd,i);}},{key:"complete",value:function(){return c(s(o.prototype),"complete",this).call(this),1===this.mode&&this.parent.destroy(),this}}]),o}(Oi),Fi={stop:0,destroy:1,yoyo:2},Hi=Phaser.Utils.Objects.IsPlainObject,Ni=function(t,e,i,n){var r,s;Hi(i)?(r=i.start,s=i.end):s=i,void 0===r&&(r=0),void 0===s&&(s=1);var o={mode:0,start:r,end:s,duration:e};return void 0===n?n=new Ii(t,o):n.resetFromJSON(o),n.restart(),n},Gi=function(t,e,i,n){i instanceof Ii&&(n=i,i=void 0),void 0===i&&(i=!0);var r={mode:i?1:0,end:0,duration:e};return void 0===n?n=new Ii(t,r):n.resetFromJSON(r),n.restart(),n},Vi=Phaser.Utils.Objects.IsPlainObject,Ui=function(t,e){e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0);})),e.on("update",(function(){var e=je.getParentSizer(t);e&&e.resetChildAlphaState(t);}));},Ji={fadeIn:function(t,e){if(Vi(t)){var i=t;t=i.duration,e=i.alpha;}var n=void 0===this._fade;return this._fade=Ni(this,t,e,this._fade),n&&Ui(this,this._fade),this._fade.completeEventName="fadein.complete",this},fadeInPromise:function(t,e){return this.fadeIn(t,e),Ai(this._fade)},fadeOutDestroy:function(t,e){if(Vi(t)){var i=t;t=i.duration,e=i.destroy;}var n=void 0===this._fade;return this._fade=Gi(this,t,e,this._fade),n&&Ui(this,this._fade),this._fade.completeEventName="fadeout.complete",this},fadeOutDestroyPromise:function(t,e){return this.fadeOutDestroy(t,e),Ai(this._fade)},fadeOut:function(t){return this.fadeOutDestroy(t,!1),this},fadeOutPromise:function(t){return this.fadeOut(t),Ai(this._fade)}},Ki=Phaser.Utils.Objects.GetValue,qi=Phaser.Utils.Objects.GetAdvancedValue,Zi=Phaser.Math.Linear,$i=function(t){r(o,t);var i=l(o);function o(t,n){var r;return e(this,o),(r=i.call(this,t,n)).resetFromJSON(n),r.boot(),r}return n(o,[{key:"resetFromJSON",value:function(t){if(c(s(o.prototype),"resetFromJSON",this).call(this,t),this.setMode(Ki(t,"mode",0)),t&&(t.hasOwnProperty("x")||t.hasOwnProperty("y"))){var e=qi(t,"x",void 0),i=qi(t,"y",void 0);this.setTargetPosition(e,i);}else this.setTargetPosition(t);return this}},{key:"setMode",value:function(t){return "string"==typeof t&&(t=Qi[t]),this.mode=t,this}},{key:"setTargetPosition",value:function(t,e){if("number"==typeof t||"number"==typeof e)this.startX=this.parent.x,this.startY=this.parent.y,this.endX=t,this.endY=e;else {var i=t;this.startX=qi(i,"startX",void 0),this.startY=qi(i,"startY",void 0),this.endX=qi(i,"endX",void 0),this.endY=qi(i,"endY",void 0);}return this.hasMoveX=void 0!==this.startX&&void 0!==this.endX,this.hasMoveY=void 0!==this.startY&&void 0!==this.endY,this}},{key:"start",value:function(){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),c(s(o.prototype),"start",this).call(this),this}},{key:"updateGameObject",value:function(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasMoveX&&(t.x=Zi(this.startX,this.endX,i)),this.hasMoveY&&(t.y=Zi(this.startY,this.endY,i));}},{key:"complete",value:function(){return c(s(o.prototype),"complete",this).call(this),1===this.mode&&this.parent.destroy(),this}}]),o}(Oi),Qi={stop:0,destroy:1,yoyo:2},tn=function(t,e){if("number"==typeof t)return t;var i=t[0],n=parseFloat(t.substr(2));switch(i){case"+":return e+n;case"-":return e-n;case"*":return e*n;case"/":return e/n}},en=Phaser.Utils.Objects.IsPlainObject,nn=Phaser.Math.Distance.Between,rn=function(t,e){e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0);})),e.on("update",(function(){var e=je.getParentSizer(t);e&&e.resetChildPositionState(t);}));},sn={moveFrom:function(t,e,i,n,r){if(en(t)){var s=t;e=s.x,i=s.y,t=s.hasOwnProperty("speed")?1e3*nn(e,i,this.x,this.y)/s.speed:s.duration,n=s.ease;}var o=void 0===this._easeMove;return this._easeMove=function(t,e,i,n,r,s,o){s instanceof $i&&(o=s,s=void 0),void 0===s&&(s=!1);var a={};return a.mode=s?1:0,void 0!==i&&(a.startX=tn(i,t.x),a.endX=t.x),void 0!==n&&(a.startY=tn(n,t.y),a.endY=t.y),a.duration=e,a.ease=void 0===r?"Linear":r,void 0===o?o=new $i(t,a):o.resetFromJSON(a),o.restart(),o}(this,t,e,i,n,r,this._easeMove),o&&rn(this,this._easeMove),this._easeMove.completeEventName="movefrom.complete",this},moveFromPromise:function(t,e,i,n,r){return this.moveFrom(t,e,i,n,r),Ai(this._easeMove)},moveFromDestroy:function(t,e,i,n){return this.moveFrom(t,e,i,n,!0),this},moveFromDestroyPromise:function(t,e,i,n){return this.moveFromDestroy(t,e,i,n),Ai(this._easeMove)},moveTo:function(t,e,i,n,r){if(en(t)){var s=t;e=s.x,i=s.y,t=s.hasOwnProperty("speed")?1e3*nn(e,i,this.x,this.y)/s.speed:s.duration,n=s.ease;}var o=void 0===this._easeMove;return this._easeMove=function(t,e,i,n,r,s,o){s instanceof $i&&(o=s,s=void 0),void 0===s&&(s=!1);var a={};return a.mode=s?1:0,void 0!==i&&(a.startX=t.x,a.endX=tn(i,t.x)),void 0!==n&&(a.startY=t.y,a.endY=tn(n,t.y)),a.duration=e,a.ease=void 0===r?"Linear":r,void 0===o?o=new $i(t,a):o.resetFromJSON(a),o.restart(),o}(this,t,e,i,n,r,this._easeMove),o&&rn(this,this._easeMove),this._easeMove.completeEventName="moveto.complete",this},moveToPromise:function(t,e,i,n,r){return this.moveTo(t,e,i,n,r),Ai(this._easeMove)},moveToDestroy:function(t,e,i,n){return this.moveTo(t,e,i,n,!0),this},moveToDestroyPromise:function(t,e,i,n){return this.moveToDestroy(t,e,i,n,!0),Ai(this._easeMove)},moveStop:function(t){return this._easeMove?(this._easeMove.stop(t),this):this}},on=Phaser.Utils.Objects.GetValue,an=function(t){r(o,t);var i=l(o);function o(t,n){var r;return e(this,o),(r=i.call(this,t,n)).timer=new vi,r.resetFromJSON(n),r.boot(),r}return n(o,[{key:"resetFromJSON",value:function(t){return this.timer.resetFromJSON(on(t,"timer")),this.setEnable(on(t,"enable",!0)),this.setMode(on(t,"mode",1)),this.isRunning=on(t,"isRunning",!1),this.setMagnitudeMode(on(t,"magnitudeMode",1)),this.setAxisMode(on(t,"axis",0)),this.setDuration(on(t,"duration",500)),this.setMagnitude(on(t,"magnitude",10)),this.ox=on(t,"ox",void 0),this.oy=on(t,"oy",void 0),this}},{key:"toJSON",value:function(){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}}},{key:"shutdown",value:function(t){this.isShutdown||(c(s(o.prototype),"shutdown",this).call(this,t),this.timer.destroy(),this.timer=void 0);}},{key:"startTicking",value:function(){c(s(o.prototype),"startTicking",this).call(this),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);}},{key:"stopTicking",value:function(){c(s(o.prototype),"stopTicking",this).call(this),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));}},{key:"setEnable",value:function(t){return null==t&&(t=!0),this.enable=t,this}},{key:"setMode",value:function(t){return "string"==typeof t&&(t=hn[t]),this.mode=t,this}},{key:"setMagnitudeMode",value:function(t){return "string"==typeof t&&(t=un[t]),this.magnitudeMode=t,this}},{key:"setAxisMode",value:function(t){return "string"==typeof t&&(t=ln[t]),this.axisMode=t,this}},{key:"setDuration",value:function(t){return this.duration=t,this}},{key:"setMagnitude",value:function(t){return this.magnitude=t,this}},{key:"start",value:function(t,e){if("number"!=typeof t){var i=t;e=on(i,"magnitude",void 0),t=on(i,"duration",void 0);}return void 0!==e&&this.setMagnitude(e),void 0!==t&&this.setDuration(t),this.timer.setDuration(this.duration).start(),c(s(o.prototype),"start",this).call(this),this}},{key:"shake",value:function(t,e){return this.start(t,e),this}},{key:"update",value:function(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 n=this.magnitude;1===this.magnitudeMode&&(n*=1-this.timer.t);var r=Math.random()*Math.PI*2,s=this.ox+Math.cos(r)*n,o=this.oy+Math.sin(r)*n;switch(this.axisMode){case 1:i.x=s;break;case 2:i.y=o;break;default:i.x=s,i.y=o;}}return this}},{key:"backToOrigin",value:function(){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}}]),o}(hi),hn={effect:0,behavior:1},ln={both:0,"h&v":0,"x&y":0,horizontal:1,h:1,x:1,vertical:2,v:2,y:2},un={constant:0,decay:1},cn=Phaser.Utils.Objects.IsPlainObject,dn={shake:function(t,e,i){if(cn(t)){var n=t;t=n.duration,e=n.magnitude,i=n.magnitudeMode;}return void 0===this._shake&&(this._shake=new an(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:function(t,e){return this.shake(t,e),Ai(this._shake)}},fn=Phaser.Utils.Objects.GetValue,pn=Phaser.Math.Linear,vn=function(t){r(o,t);var i=l(o);function o(t,n){var r;return e(this,o),(r=i.call(this,t,n)).resetFromJSON(),r.boot(),r}return n(o,[{key:"start",value:function(t){if(this.timer.isRunning)return this;var e=this.target;this.propertyKey=fn(t,"key","value");var i=e[this.propertyKey];return this.fromValue=fn(t,"from",i),this.toValue=fn(t,"to",i),this.setEase(fn(t,"ease",this.ease)),this.setDuration(fn(t,"duration",this.duration)),this.setRepeat(fn(t,"repeat",0)),this.setDelay(fn(t,"delay",0)),this.setRepeatDelay(fn(t,"repeatDelay",0)),this.timer.setDuration(this.duration).setRepeat(this.repeat).setDelay(this.delay).setRepeatDelay(this.repeatDelay),e[this.propertyKey]=this.fromValue,c(s(o.prototype),"start",this).call(this),this}},{key:"updateGameObject",value:function(t,e){var i=e.t;i=this.easeFn(i),t[this.propertyKey]=pn(this.fromValue,this.toValue,i);}}]),o}(Oi),gn=Phaser.Utils.Objects.IsPlainObject,yn=function(t){r(s,t);var i=l(s);function s(t,n){var r;return e(this,s),(r=i.call(this,t,n)).parent.setDataEnabled(),r.easeTasks={},r}return n(s,[{key:"complete",value:function(t){this.emit("complete-".concat(t),this.parent,this),this.emit("complete",t,this.parent,this);}},{key:"getEaseTask",value:function(t){var e=this.easeTasks[t];return void 0===e&&(e=new vn(this.parent),this.easeTasks[t]=e,e.setTarget(this.parent.data.values).on("complete",(function(){this.complete(t);}),this)),e}},{key:"easeTo",value:function(t,e,i,n){if(gn(t)){var r=t;t=r.key,e=r.value,i=r.duration,n=r.ease;var s=r.speed;void 0===i&&void 0!==s&&(i=Math.abs(e-this.parent.data.values[t])/s*1e3);}return void 0===i&&(i=1e3),void 0===n&&(n="Linear"),this.getEaseTask(t).restart({key:t,to:e,duration:i,ease:n}),this}},{key:"easeFrom",value:function(t,e,i,n){if(gn(t)){var r=t;t=r.key,e=r.value,i=r.duration,n=r.ease;var s=r.speed;void 0===i&&void 0!==s&&(i=Math.abs(e-this.parent.data.values[t])/s*1e3);}return void 0===i&&(i=1e3),void 0===n&&(n="Linear"),this.getEaseTask(t).restart({key:t,from:e,duration:i,ease:n}),this}},{key:"stopEase",value:function(t,e){void 0===e&&(e=!0);var i=this.easeTasks[t];return i&&i.stop(e),this}},{key:"stopAll",value:function(t){for(var e in void 0===t&&(t=!0),this.easeTasks)this.stopEase(e,t);return this}}]),s}(si),mn={easeDataTo:function(t,e,i,n){return this._easeData||(this._easeData=new yn(this),function(t,e){e.on("complete",(function(e){t.emit("easedata.".concat(e,".complete"),t),t.emit("easedata.complete",e,t);}));}(this,this._easeData)),this._easeData.easeTo(t,e,i,n),this},easeDataToPromise:function(t,e,i,n){return this.easeDataTo(t,e,i,n),zi(this._easeData,"complete-".concat(t))},stopEaseData:function(t,e){return this._easeData?(this._easeData.stopEase(t,e),this):this},stopAllEaseData:function(t){return this._easeData?(this._easeData.stopAll(t),this):this}},kn=function(t){wn(t,!1);},bn=function(t){wn(t,!0);},xn=function(t){return !!t&&!Vt(t).hidden},wn=function(t,e){if(t){Vt(t).hidden=e;var i=O(t);i?i.setChildVisible(t,!e):t.setVisible(!e);}},Sn={show:function(t){return void 0===t&&(t=this),kn(t),this},hide:function(t){return void 0===t&&(t=this),bn(t),this},isShow:function(t){return void 0===t&&(t=this),xn(t)}};function Cn(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var On={exports:{}};!function(t){var e=Object.prototype.hasOwnProperty,i="~";function n(){}function r(t,e,i){this.fn=t,this.context=e,this.once=i||!1;}function s(t,e,n,s,o){if("function"!=typeof n)throw new TypeError("The listener must be a function");var a=new r(n,s||t,o),h=i?i+e:e;return t._events[h]?t._events[h].fn?t._events[h]=[t._events[h],a]:t._events[h].push(a):(t._events[h]=a,t._eventsCount++),t}function o(t,e){0==--t._eventsCount?t._events=new n:delete t._events[e];}function a(){this._events=new n,this._eventsCount=0;}Object.create&&(n.prototype=Object.create(null),(new n).__proto__||(i=!1)),a.prototype.eventNames=function(){var t,n,r=[];if(0===this._eventsCount)return r;for(n in t=this._events)e.call(t,n)&&r.push(i?n.slice(1):n);return Object.getOwnPropertySymbols?r.concat(Object.getOwnPropertySymbols(t)):r},a.prototype.listeners=function(t){var e=i?i+t:t,n=this._events[e];if(!n)return [];if(n.fn)return [n.fn];for(var r=0,s=n.length,o=new Array(s);r0){var e=t.runTransitionInCallback();t.delayCall(e,this.next,this);}else this.next();}},{key:"exit_TRANS_OPNE",value:function(){this.parent.removeDelayCall();}},{key:"next_OPEN",value:function(){return "TRANS_CLOSE"}},{key:"enter_OPEN",value:function(){this.parent.onOpen();}},{key:"exit_OPEN",value:function(){this.parent.removeDelayCall();}},{key:"next_TRANS_CLOSE",value:function(){return "CLOSE"}},{key:"enter_TRANS_CLOSE",value:function(){var t=this.parent;if(t.transitOutTime>0){var e=t.runTransitionOutCallback();t.delayCall(e,this.next,this);}else this.next();}},{key:"exit_TRANS_CLOSE",value:function(){this.parent.removeDelayCall();}},{key:"next_CLOSE",value:function(){return "TRANS_OPNE"}},{key:"enter_CLOSE",value:function(){this.parent.onClose();}},{key:"exit_CLOSE",value:function(){}},{key:"canOpen",value:function(){return "IDLE"===this.state||"CLOSE"===this.state}},{key:"canClose",value:function(){return "IDLE"===this.state||"OPEN"===this.state}}]),s}(zn),Dn={delayCall:function(t,e,i){return this.delayCallTimer=function(t,e,i,n,r){var s=ti(t);return s.time.delayedCall(e,(function(){s.game.events.once("poststep",(function(){i.call(n,r);}));}))}(this,t,e,i),this},removeDelayCall:function(){return this.delayCallTimer&&(this.delayCallTimer.remove(!1),this.delayCallTimer=void 0),this}},Bn={setTransitInTime:function(t){return this.transitInTime=t,this},setTransitOutTime:function(t){return this.transitOutTime=t,this},setTransitInCallback:function(t){return t||(t=Qt),this.transitInCallback=t,this},setTransitOutCallback:function(t){return t||(t=Qt),this.transitOutCallback=t,this}},jn={runTransitionInCallback:function(){return this.transitInCallback(this.parent,this.transitInTime),this.transitInTime},onOpen:function(){},requestOpen:function(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}},Wn={runTransitionOutCallback:function(){return this.transitOutCallback(this.parent,this.transitOutTime),this.transitOutTime},onClose:function(){this.oneShotMode&&this.parent.destroy();},requestClose:function(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}},Yn={};Object.assign(Yn,Dn,Bn,jn,Wn);var Xn=Phaser.Utils.Objects.GetValue,In=function(t){r(o,t);var i=l(o);function o(t,n){var r;return e(this,o),(r=i.call(this,t,n)).setTransitInTime(Xn(n,"duration.in",200)),r.setTransitOutTime(Xn(n,"duration.out",200)),r.setTransitInCallback(Xn(n,"transitIn")),r.setTransitOutCallback(Xn(n,"transitOut")),r.oneShotMode=Xn(n,"destroy",!1),r.delayCallTimer=void 0,r._state=new An(a(r),{eventEmitter:!1,initState:Xn(n,"initState","IDLE")}),r.openEventData=void 0,r.closeEventData=void 0,r}return n(o,[{key:"state",get:function(){return this._state.state}},{key:"shutdown",value:function(t){this.isShutdown||(this.transitInCallback=void 0,this.transitOutCallback=void 0,this.openEventData=void 0,this.closeEventData=void 0,this.removeDelayCall(),c(s(o.prototype),"shutdown",this).call(this,t));}}]),o}(si);Object.assign(In.prototype,Yn);var Fn=function(t){r(o,t);var i=l(o);function o(t,n,r){var s;return e(this,o),(s=i.call(this,t,0,0,2,2,n,1)).setAlpha(r),s.setScrollFactor(0),s.boot(),s}return n(o,[{key:"boot",value:function(){this.scene.sys.events.on("prerender",this.resize,this);}},{key:"destroy",value:function(t){this.scene&&!this.ignoreDestroy&&(this.scene.sys.events.off("prerender",this.resize,this),c(s(o.prototype),"destroy",this).call(this,t));}},{key:"tint",get:function(){return this.fillColor},set:function(t){this.setFillStyle(t,this.fillAlpha);}},{key:"resize",value:function(){var t=this.scene,e=t.sys.scale.gameSize,i=t.sys.cameras.main,n=e.width,r=e.height,s=1/i.zoom,o=n/2,a=r/2,h=n*s,l=r*s;this.x===o&&this.y===a||this.setPosition(o,a),this.width===h&&this.height===l||this.setSize(h,l).setOrigin(.5);}}]),o}(Phaser.GameObjects.Rectangle),Hn=Phaser.Utils.Objects.GetValue,Nn=function(t){r(s,t);var i=l(s);function s(t,n){var r;return e(this,s),(r=i.call(this,t,{eventEmitter:!1})).resetFromJSON(n),r.boot(),r}return n(s,[{key:"resetFromJSON",value:function(t){return this.setHitAreaMode(Hn(t,"hitAreaMode",0)),this.setEnable(Hn(t,"enable",!0)),this.setStopMode(Hn(t,"stopAllLevels",!0)),this}},{key:"boot",value:function(){this.parent.on("pointerdown",(function(t,e,i,n){this.stopAllLevels&&n.stopPropagation();}),this).on("pointerup",(function(t,e,i,n){this.stopAllLevels&&n.stopPropagation();}),this).on("pointermove",(function(t,e,i,n){this.stopAllLevels&&n.stopPropagation();}),this).on("pointerover",(function(t,e,i,n){this.stopAllLevels&&n.stopPropagation();}),this).on("pointerout",(function(t,e){this.stopAllLevels&&e.stopPropagation();}),this);}},{key:"setHitAreaMode",value:function(t){"string"==typeof t&&(t=Gn[t]);var e=this.parent;return e.input&&e.removeInteractive(),0===t?e.setInteractive():e.setInteractive({hitArea:{},hitAreaCallback:function(){return !0}}),this}},{key:"setEnable",value:function(t){return void 0===t&&(t=!0),t?this.parent.setInteractive():this.parent.disableInteractive(),this.enable=t,this}},{key:"setStopMode",value:function(t){return void 0===t&&(t=!0),this.stopAllLevels=t,this}},{key:"toggleEnable",value:function(){return this.setEnable(!this.enable),this}}]),s}(si),Gn={default:0,fullWindow:1},Vn=Phaser.Utils.Objects.GetValue,Un=function(t){r(s,t);var i=l(s);function s(t,n){var r;e(this,s);var o=Vn(n,"color",0),h=Vn(n,"alpha",.8);return (r=i.call(this,t,o,h)).touchEventStop=new Nn(a(r),{hitAreaMode:1}),r}return n(s)}(Fn),Jn=function(t,e){void 0!==t._modalScaleSave?(t.scaleX=t._modalScaleSave,t.scaleY=t._modalScaleSave):t._modalScaleSave=t.scaleX,Ri(t,e);},Kn=function(t,e){Li(t,e,void 0,void 0,!1);},qn=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Ni(t,e);},Zn=function(t,e){Gi(t,e,!1);},$n=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Ni(t,e,t.alpha);},Qn=function(t,e){Gi(t,e,!1);},tr=function(t,e,i,n,r){return !!t&&(!(n&&!n(t,e,i))&&(!!bt(t,!0).contains(e,i)&&!(r&&!r(t,e,i))))},er=Phaser.Utils.Objects.GetValue,ir=function(t){r(o,t);var i=l(o);function o(t,n){var r;e(this,o),void 0===n&&(n={}),null==n.transitIn&&(n.transitIn=nr.popUp),null==n.transitOut&&(n.transitOut=nr.scaleDown),n.destroy=er(n,"destroy",!0),r=i.call(this,t,n);var s=er(n,"cover");r.cover=!1!==s?function(t,e){var i=t.scene,n=new Un(i,e);return i.add.existing(n),t.isRexContainerLite?(t.pin(n,{syncPosition:!1,syncRotation:!1,syncScale:!1,syncAlpha:!1,syncScrollFactor:!1}),t.moveDepthBelow(n)):i.children.moveBelow(n,t),n}(t,s):void 0,r.cover&&(r.setCoverTransitInCallback(er(s,"transitIn",$n)),r.setCoverTransitOutCallback(er(s,"transitOut",Qn)));var h=er(n,"touchOutsideClose",!1),l=er(n,"duration.hold",-1),u=er(n,"timeOutClose",l>=0),c=er(n,"anyTouchClose",!1);return er(n,"manualClose",!1)&&(h=!1,c=!1,u=!1),c&&(h=!1),u?r.setDisplayTime(l):r.setDisplayTime(-1),c?r.once("open",r.anyTouchClose,a(r)):h&&r.once("open",r.touchOutsideClose,a(r)),er(n,"openOnStart",!0)&&r.delayCall(0,r.requestOpen,a(r)),r}return n(o,[{key:"shutdown",value:function(t){this.isShutdown||(this.cover||this.scene.input.off("pointerup",this.touchCloseCallback,this),this.cover&&!t&&(this.cover.destroy(),this.cover=void 0),c(s(o.prototype),"shutdown",this).call(this,t));}},{key:"touchOutsideClose",value:function(){return this.cover?this.cover.on("pointerup",this.touchCloseCallback,this):this.scene.input.on("pointerup",this.touchCloseCallback,this),this.clickOutsideTest=!0,this}},{key:"anyTouchClose",value:function(){return this.cover?this.cover.once("pointerup",this.touchCloseCallback,this):this.scene.input.once("pointerup",this.touchCloseCallback,this),this}},{key:"touchCloseCallback",value:function(t){this.clickOutsideTest&&tr(this.parent,t.worldX,t.worldY)||this.requestClose();}},{key:"runTransitionInCallback",value:function(){var t=c(s(o.prototype),"runTransitionInCallback",this).call(this),e=this.cover;return e&&this.coverTransitInCallback&&this.coverTransitInCallback(e,t),t}},{key:"runTransitionOutCallback",value:function(){var t=c(s(o.prototype),"runTransitionOutCallback",this).call(this),e=this.cover;return e&&this.coverTransitOutCallback&&this.coverTransitOutCallback(e,t),t}},{key:"onOpen",value:function(){var t=this.displayTime;t>=0&&this.delayCall(t,this.requestClose,this),this.emit("open",this.parent,this),c(s(o.prototype),"onOpen",this).call(this);}},{key:"onClose",value:function(){this.emit("close",this.closeEventData),c(s(o.prototype),"onClose",this).call(this);}},{key:"setDisplayTime",value:function(t){return this.displayTime=t,this}},{key:"setTransitInCallback",value:function(t){switch("string"==typeof t&&(t=nr[t]),t){case nr.popUp:t=Jn;break;case nr.fadeIn:t=qn;}return c(s(o.prototype),"setTransitInCallback",this).call(this,t),this}},{key:"setTransitOutCallback",value:function(t){switch("string"==typeof t&&(t=nr[t]),t){case nr.scaleDown:t=Kn;break;case nr.fadeOut:t=Zn;}return c(s(o.prototype),"setTransitOutCallback",this).call(this,t),this}},{key:"setCoverTransitInCallback",value:function(t){return this.coverTransitInCallback=t,this}},{key:"setCoverTransitOutCallback",value:function(t){return this.coverTransitOutCallback=t,this}}]),o}(In),nr={popUp:0,fadeIn:1,scaleDown:0,fadeOut:1},rr=function(t){return t&&"function"==typeof t},sr={modal:function(t,e){return rr(t)&&(e=t,t=void 0),void 0===this._modalBehavior&&(this.onCreateModalBehavior&&this.onCreateModalBehavior(this,t),this._modalBehavior=function(t,e){var i=new ir(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:function(t){var e=this;return new Promise((function(i,n){e.modal(t,i);}))},modalClose:function(t){return function(t,e){t.emit("modal.requestClose",e);}(this,t),this}},or=function(t,e,i,n){if(e)return tr(t,e.worldX,e.worldY,i,n);for(var r=t.scene.input.manager,s=r.pointersTotal,o=r.pointers,a=0;a=this.dragThreshold&&this.cancel();}},{key:"click",value:function(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 n=this.lastClickTime;return void 0!==n&&t-n<=this.clickInterval||(this.lastClickTime=t,this.emit("click",this,this.parent,e,i)),this}},{key:"cancel",value:function(){return this.pointer=void 0,this}},{key:"onOver",value:function(t,e,i,n){return this.enable?(this.emit("over",this,this.parent,t,n),this):this}},{key:"onOut",value:function(t,e){return this.enable?(this.emit("out",this,this.parent,t,e),this):this}}]),o}(si),xr={press:0,pointerdown:0,release:1,pointerup:1},wr={onClick:function(t,e,i,n){return t?("function"==typeof t&&(n=i,i=e,e=t,t=this),void 0===t._click&&(t._click=new br(t,n)),t._click.on("click",e,i),this):this},offClick:function(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:function(e,i){return e&&"object"!==t(e)&&(i=e,e=this),void 0===e._click||e._click.setEnable(i),this},disableClick:function(e){return e&&"object"!==t(e)&&(e=this),void 0===e._click||e._click.setEnable(!1),this}},Sr=function(t,e,i,n){if(e)return !(i&&!i(t,e))&&(!!Cr(t,e)&&!(n&&!n(t,e)));for(var r=t.scene.input.manager,s=r.pointersTotal,o=r.pointers,a=0;a0)return Or.length=0,!0;return Or.length=0,!1},Or=[],_r=Phaser.Utils.Objects.GetValue,Pr=function(t){r(o,t);var i=l(o);function o(t,n){var r;e(this,o),(r=i.call(this,t,n))._enable=void 0;var s=_r(n,"inputConfig",void 0);return s&&t.setInteractive(s),r.resetFromJSON(n),r.boot(),r}return n(o,[{key:"resetFromJSON",value:function(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}},{key:"boot",value:function(){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);}},{key:"shutdown",value:function(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,c(s(o.prototype),"shutdown",this).call(this,t);}}},{key:"enable",get:function(){return this._enable},set:function(t){if(this._enable!==t){t||this.cancel(),this._enable=t;var e=t?"enable":"disable";this.emit(e,this,this.parent);}}},{key:"setEnable",value:function(t){return void 0===t&&(t=!0),this.enable=t,this}},{key:"toggleEnable",value:function(){return this.setEnable(!this.enable),this}},{key:"setMode",value:function(t){return "string"==typeof t&&(t=Tr[t]),this.mode=t,this}},{key:"setClickInterval",value:function(t){return this.clickInterval=t,this}},{key:"setDragThreshold",value:function(t){return this.dragThreshold=t,this}},{key:"isPointerInside",value:function(t){var e=this.parent;return (e.input?Sr:or)(e,t)}},{key:"onPress",value:function(t){this.parent.willRender(t.camera)&&void 0===this.pointer&&(this.pointer=t,0===this.mode&&(this.isPointerInside(t)||this.click(t.downTime,t)));}},{key:"onRelease",value:function(t){this.parent.willRender(t.camera)&&this.pointer===t&&(1===this.mode&&(this.isPointerInside(t)||this.click(t.upTime,t)),this.pointer=void 0);}},{key:"onMove",value:function(t,e,i,n){this.pointer===t&&void 0!==this.dragThreshold&&1===this.mode&&(t.getDistance()>=this.dragThreshold||this.isPointerInside(t))&&this.cancel();}},{key:"click",value:function(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}},{key:"cancel",value:function(){return this.pointer=void 0,this}}]),o}(si),Tr={press:0,pointerdown:0,release:1,pointerup:1},Er={onClickOutside:function(t,e,i,n){return t?("function"==typeof t&&(n=i,i=e,e=t,t=this),void 0===t._clickOutside&&(t._clickOutside=new Pr(t,n)),t._clickOutside.on("clickoutside",e,i),this):this},offClickOutside:function(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:function(e,i){return e&&"object"!==t(e)&&(i=e,e=this),void 0===e._clickOutside||e._clickOutside.setEnable(i),this},disableClickOutside:function(e){return e&&"object"!==t(e)&&(e=this),void 0===e._clickOutside||e._clickOutside.setEnable(!1),this}},Mr=function(t){r(s,t);var i=l(s);function s(){var t;return e(this,s),(t=i.call(this,{eventEmitter:!1})).goto("IDLE"),t}return n(s,[{key:"setCooldownTime",value:function(t){return this.cooldownTime=t,this.cooldownMode=void 0!==t,this}},{key:"request",value:function(){return this.runMethod("request")}},{key:"update_IDLE",value:function(){this.compensationTime=0;}},{key:"request_IDLE",value:function(){return this.next(),!0}},{key:"next_IDLE",value:function(){if(this.cooldownMode)return "COOLDOWN"}},{key:"enter_COOLDOWN",value:function(){this.remainderTime=this.cooldownTime+this.compensationTime;}},{key:"update_COOLDOWN",value:function(t,e){this.remainderTime-=e,this.remainderTime<0&&(this.compensationTime=this.cooldownTime>e?-this.remainderTime:0,this.goto("IDLE"));}},{key:"request_COOLDOWN",value:function(){return !1}}]),s}(zn),Rr=Phaser.Utils.Objects.GetValue,Lr=function(t){r(o,t);var i=l(o);function o(t,n){var r;return e(this,o),(r=i.call(this,t,n))._enable=void 0,r.cooldown=new Mr,r.parent.setInteractive(Rr(n,"inputConfig",void 0)),r.resetFromJSON(n),r.boot(),r}return n(o,[{key:"resetFromJSON",value:function(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}},{key:"boot",value:function(){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);}},{key:"shutdown",value:function(t){this.isShutdown||(this.scene.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,c(s(o.prototype),"shutdown",this).call(this,t));}},{key:"enable",get:function(){return this._enable},set:function(t){if(this._enable!==t)return t||(this.prevIsInTouch=!1,this.isInTouching=!1,this.pointer=void 0),this._enable=t,this}},{key:"setEnable",value:function(t){return void 0===t&&(t=!0),this.enable=t,this}},{key:"cooldownTime",get:function(){return this.cooldown.cooldownTime},set:function(t){this.cooldown.setCooldownTime(t);}},{key:"setCooldown",value:function(t){return this.cooldownTime=t,this}},{key:"toggleEnable",value:function(){return this.setEnable(!this.enable),this}},{key:"onPointIn",value:function(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.pointer=t,this.isInTouching=!0);}},{key:"onPointOut",value:function(t){this.enable&&this.pointer===t&&(this.pointer=void 0,this.isInTouching=!1);}},{key:"preupdate",value:function(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;}}]),o}(si),zr={isPointerInBounds:function(t){return void 0===t?t=this:"string"==typeof t&&(t=this.getElement(t)),!!t&&or(t)},onTouching:function(t,e,i,n){return t?("function"==typeof t&&(n=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new Lr(t,n)),t._inTouching.on("intouch",e,i),this):this},offTouching:function(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:function(t,e,i,n){return t?("function"==typeof t&&(n=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new Lr(t,n)),t._inTouching.on("touchend",e,i),this):this},offTouchingEnd:function(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:function(e,i){return e&&"object"!==t(e)&&(i=e,e=this),void 0===e._inTouching||e._inTouching.setEnable(i),this},disableTouching:function(e){return e&&"object"!==t(e)&&(e=this),void 0===e._inTouching||e._inTouching.setEnable(!1),this}},Ar=function(t,e,i){for(var n,r=0,s=t.length;r0),this.onDragStart()));}},{key:"onPointerUp",value:function(t){this.enable&&((!this.bounds||this.bounds.contains(t.x,t.y))&&this.pointer===t&&(this.pointer=void 0,this.movedState=!1,this.tracerState=qr,this.onDragEnd()));}},{key:"onPointerMove",value:function(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()));}}},{key:"dragCancel",value:function(){return this.tracerState===Zr&&this.onDragEnd(),this.pointer=void 0,this.tracerState=qr,this}},{key:"onDragStart",value:function(){this.emit("dragstart",this);}},{key:"onDragEnd",value:function(){this.emit("dragend",this);}},{key:"onDrag",value:function(){this.emit("drag",this);}},{key:"preUpdate",value:function(t,e){}},{key:"postUpdate",value:function(t,e){}},{key:"startTicking",value:function(){c(s(o.prototype),"startTicking",this).call(this),this.scene.sys.events.on("preupdate",this.preUpdate,this),this.scene.sys.events.on("postupdate",this.postUpdate,this);}},{key:"stopTicking",value:function(){c(s(o.prototype),"stopTicking",this).call(this),this.scene&&(this.scene.sys.events.off("preupdate",this.preUpdate,this),this.scene.sys.events.off("postupdate",this.postUpdate,this));}},{key:"setRecongizedStateObject",value:function(t){return this.recongizedState=t,this}},{key:"state",get:function(){return this.recongizedState.state},set:function(t){this.recongizedState.state=t;}},{key:"cancel",value:function(){return this.state=$r,this}}]),o}(hi),qr=0,Zr=1,$r="IDLE",Qr=Phaser.Utils.Objects.GetValue,ts=Phaser.Math.Distance.Between,es=function(t){r(o,t);var i=l(o);function o(t,n){var r;e(this,o);var s=a(r=i.call(this,t,n)),h={states:{IDLE:{enter:function(){s.stop(),s.tapsCount=0,s.x=0,s.y=0,s.worldX=0,s.worldY=0;},exit:function(){var t=s.lastPointer;s.x=t.x,s.y=t.y,s.worldX=t.worldX,s.worldY=t.worldY;}},BEGIN:{enter:function(){s.start(),s.tapsCount=0,s.emit("tappingstart",s,s.gameObject,s.lastPointer);}},RECOGNIZED:{enter:function(){s.start(),s.emit("tap",s,s.gameObject,s.lastPointer),s.emit("".concat(s.tapsCount,"tap"),s,s.gameObject,s.lastPointer);}}},init:function(){this.state=is;},eventEmitter:!1};return r.setRecongizedStateObject(new zn(h)),r}return n(o,[{key:"resetFromJSON",value:function(t){c(s(o.prototype),"resetFromJSON",this).call(this,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}},{key:"onDragStart",value:function(){switch(this.state){case is:this.state=ns;break;case ns:var t=this.lastPointer;ts(t.upX,t.upY,t.x,t.y)>this.tapOffset&&(this.state=rs,this.state=ns);break;case rs:this.state=ns;}}},{key:"onDragEnd",value:function(){this.state===ns&&(this.tapsCount++,this.emit("tapping",this,this.gameObject,this.lastPointer),void 0!==this.maxTaps&&this.tapsCount===this.maxTaps&&(this.state=rs));}},{key:"onDrag",value:function(){this.state!==is&&this.pointer.getDistance()>this.dragThreshold&&(this.state=is);}},{key:"preUpdate",value:function(t,e){if(this.isRunning&&this.enable&&this.state===ns){var i=this.lastPointer;if(i.isDown)t-i.downTime>this.holdTime&&(this.state=is);else t-i.upTime>this.tapInterval&&(void 0===this.minTaps||this.tapsCount>=this.minTaps?this.state=rs:this.state=is);}}},{key:"postUpdate",value:function(t,e){this.isRunning&&this.enable&&this.state===rs&&(this.state=is);}},{key:"isTapped",get:function(){return this.state===rs}},{key:"setHoldTime",value:function(t){return this.holdTime=t,this}},{key:"setTapInterval",value:function(t){return this.tapInterval=t,this}},{key:"setDragThreshold",value:function(t){return this.dragThreshold=t,this}},{key:"setTapOffset",value:function(t){return this.tapOffset=t,this}},{key:"setMaxTaps",value:function(t){return this.maxTaps=t,this}},{key:"setMinTaps",value:function(t){return this.minTaps=t,this}},{key:"setTaps",value:function(t,e){return void 0===e&&(e=t),this.setMinTaps(t).setMaxTaps(e),this}}]),o}(Kr),is="IDLE",ns="BEGIN",rs="RECOGNIZED",ss=Phaser.Utils.Objects.GetValue,os=function(t){r(o,t);var i=l(o);function o(t,n){var r;e(this,o);var s=a(r=i.call(this,t,n)),h={states:{IDLE:{enter:function(){s.x=0,s.y=0,s.worldX=0,s.worldY=0;},exit:function(){var t=s.lastPointer;s.x=t.x,s.y=t.y,s.worldX=t.worldX,s.worldY=t.worldY;}},BEGIN:{enter:function(){s.start();},exit:function(){s.stop();}},RECOGNIZED:{enter:function(){s.emit("pressstart",s,s.gameObject,s.lastPointer);},exit:function(){s.emit("pressend",s,s.gameObject,s.lastPointer);}}},init:function(){this.state=as;},eventEmitter:!1};return r.setRecongizedStateObject(new zn(h)),r}return n(o,[{key:"resetFromJSON",value:function(t){return c(s(o.prototype),"resetFromJSON",this).call(this,t),this.setDragThreshold(ss(t,"threshold",9)),this.setHoldTime(ss(t,"time",251)),this}},{key:"onDragStart",value:function(){this.state=hs,0===this.holdTime&&(this.state=ls);}},{key:"onDragEnd",value:function(){this.state=as;}},{key:"onDrag",value:function(){this.state!==as&&this.pointer.getDistance()>this.dragThreshold&&(this.state=as);}},{key:"preUpdate",value:function(t,e){this.isRunning&&this.enable&&(this.state===hs&&t-this.pointer.downTime>=this.holdTime&&(this.state=ls));}},{key:"isPressed",get:function(){return this.state===ls}},{key:"setHoldTime",value:function(t){return this.holdTime=t,this}},{key:"setDragThreshold",value:function(t){return this.dragThreshold=t,this}}]),o}(Kr),as="IDLE",hs="BEGIN",ls="RECOGNIZED";Phaser.Utils.Objects.GetValue;var us=function(t){return ni(t).loop.delta},cs=Phaser.Math.Distance.Between,ds=Phaser.Math.Angle.Between,fs={getDt:function(){return us(this.scene)},getVelocity:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return cs(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 ds(e.x,e.y,t.x,t.y)}},ps={"up&down":0,"left&right":1,"4dir":2,"8dir":3},vs={},gs=Phaser.Utils.Objects.GetValue,ys=Phaser.Math.RadToDeg,ms=function(t){r(o,t);var i=l(o);function o(t,n){var r;e(this,o);var s=a(r=i.call(this,t,n)),h={states:{IDLE:{enter:function(){s.x=0,s.y=0,s.worldX=0,s.worldY=0;},exit:function(){var t=s.lastPointer;s.x=t.x,s.y=t.y,s.worldX=t.worldX,s.worldY=t.worldY;}},BEGIN:{enter:function(){s.validDrag=!1;}},RECOGNIZED:{enter:function(){s.start(),s.updateDirectionStates(),s.emit("swipe",s,s.gameObject,s.lastPointer);},exit:function(){s.stop(),s.clearDirectionStates();}}},init:function(){this.state=ks;},eventEmitter:!1};return r.setRecongizedStateObject(new zn(h)),r.clearDirectionStates(),r}return n(o,[{key:"resetFromJSON",value:function(t){return c(s(o.prototype),"resetFromJSON",this).call(this,t),this.setDragThreshold(gs(t,"threshold",10)),this.setVelocityThreshold(gs(t,"velocityThreshold",1e3)),this.setDirectionMode(gs(t,"dir","8dir")),this}},{key:"onDragStart",value:function(){this.state=bs;}},{key:"onDragEnd",value:function(){this.state=ks;}},{key:"onDrag",value:function(){this.state===bs&&(this.validDrag||(this.validDrag=0===this.dragThreshold||this.pointer.getDistance()>=this.dragThreshold),this.validDrag&&this.dragVelocity>this.velocityThreshold&&(this.state=xs));}},{key:"postUpdate",value:function(t,e){this.isRunning&&this.enable&&this.state===xs&&(this.state=ks);}},{key:"isSwiped",get:function(){return this.state===xs}},{key:"dragVelocity",get:function(){var t;switch(this.dirMode){case 0:t=this.getVelocityY();break;case 1:t=this.getVelocityX();break;default:t=this.getVelocity();}return t}},{key:"setDragThreshold",value:function(t){return this.dragThreshold=t,this}},{key:"setVelocityThreshold",value:function(t){return this.velocityThreshold=t,this}},{key:"setDirectionMode",value:function(t){return "string"==typeof t&&(t=ps[t]),this.dirMode=t,this}},{key:"updateDirectionStates",value:function(){return function(t,e,i){switch(void 0===i?i={}:!0===i&&(i=vs),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;}}(ys(this.getVelocityAngle()),this.dirMode,this),this}},{key:"clearDirectionStates",value:function(){return this.left=!1,this.right=!1,this.up=!1,this.down=!1,this}}]),o}(Kr);Object.assign(ms.prototype,fs);var ks="IDLE",bs="BEGIN",xs="RECOGNIZED",ws=Phaser.Utils.Objects.GetValue,Ss=Phaser.Utils.Array.SpliceOne,Cs=Phaser.Math.Distance.Between,Os=Phaser.Math.Angle.Between,_s=function(){function t(i,n){e(this,t);var r=i.input.manager.pointersTotal-1;r<2&&i.input.addPointer(2-r),this.scene=i,this.setEventEmitter(ws(n,"eventEmitter",void 0)),this._enable=void 0,this.pointers=[],this.movedState={},this.resetFromJSON(n),this.boot();}return n(t,[{key:"resetFromJSON",value:function(t){return this.setEnable(ws(t,"enable",!0)),this.bounds=ws(t,"bounds",void 0),this.tracerState=Ts,this.pointers.length=0,Mt(this.movedState),this}},{key:"boot",value:function(){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);}},{key:"shutdown",value:function(){this.scene&&(this.destroyEventEmitter(),this.pointers.length=0,Mt(this.movedState),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);}},{key:"destroy",value:function(){this.shutdown();}},{key:"enable",get:function(){return this._enable},set:function(t){if(this._enable!==t)return t||this.dragCancel(),this._enable=t,this}},{key:"setEnable",value:function(t){return void 0===t&&(t=!0),this.enable=t,this}},{key:"toggleEnable",value:function(){return this.setEnable(!this.enable),this}},{key:"onPointerDown",value:function(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.tracerState){case Ts:this.tracerState=Es,this.onDrag1Start();break;case Es:this.tracerState=Ms,this.onDrag2Start();}}},{key:"onPointerUp",value:function(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],Ss(this.pointers,e),this.tracerState){case Es:this.tracerState=Ts,this.onDrag1End();break;case Ms:this.tracerState=Es,this.onDrag2End(),this.onDrag1Start();}}}},{key:"onPointerMove",value:function(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 Es:this.onDrag1();break;case Ms:this.onDrag2();}}}},{key:"dragCancel",value:function(){return this.tracerState===Ms&&this.onDrag2End(),this.pointers.length=0,Mt(this.movedState),this.tracerState=Ts,this}},{key:"onDrag1Start",value:function(){this.emit("drag1start",this);}},{key:"onDrag1End",value:function(){this.emit("drag1end",this);}},{key:"onDrag1",value:function(){this.emit("drag1",this);}},{key:"onDrag2Start",value:function(){this.emit("drag2start",this);}},{key:"onDrag2End",value:function(){this.emit("drag2end",this);}},{key:"onDrag2",value:function(){this.emit("drag2",this);}},{key:"distanceBetween",get:function(){if(this.tracerState!==Ms)return 0;var t=this.pointers[0],e=this.pointers[1];return Cs(t.x,t.y,e.x,e.y)}},{key:"angleBetween",get:function(){if(this.tracerState!==Ms)return 0;var t=this.pointers[0],e=this.pointers[1];return Os(t.x,t.y,e.x,e.y)}},{key:"drag1Vector",get:function(){var t=this.pointers[0];if(t&&this.movedState[t.id]){var e=t.position,i=t.prevPosition;Ps.x=e.x-i.x,Ps.y=e.y-i.y;}else Ps.x=0,Ps.y=0;return Ps}},{key:"centerX",get:function(){if(this.tracerState!==Ms)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return (t.x+e.x)/2}},{key:"centerY",get:function(){if(this.tracerState!==Ms)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return (t.y+e.y)/2}},{key:"prevCenterX",get:function(){if(this.tracerState!==Ms)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}},{key:"prevCenterY",get:function(){if(this.tracerState!==Ms)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}},{key:"movementCenterX",get:function(){return this.centerX-this.prevCenterX}},{key:"movementCenterY",get:function(){return this.centerY-this.prevCenterY}},{key:"setRecongizedStateObject",value:function(t){return this.recongizedState=t,this}},{key:"state",get:function(){return this.recongizedState.state},set:function(t){this.recongizedState.state=t;}},{key:"cancel",value:function(){return this.state=Rs,this}}]),t}();Object.assign(_s.prototype,Ze);var Ps={},Ts=0,Es=1,Ms=2,Rs="IDLE";Phaser.Utils.Objects.GetValue;var Ls=Phaser.Math.RotateAround,zs=function(t,e,i,n){return Ls(t,e,i,n),t.rotation+=n,t},As={},Ds=Phaser.Utils.Objects.GetValue,Bs=Phaser.Math.Angle.WrapDegrees,js=Phaser.Math.Angle.ShortestBetween,Ws=Phaser.Math.RadToDeg,Ys=Phaser.Math.DegToRad,Xs=function(t){r(o,t);var i=l(o);function o(t,n){var r;e(this,o);var s=a(r=i.call(this,t,n)),h={states:{IDLE:{enter:function(){s.prevAngle=void 0,s.angle=0;}},BEGIN:{},RECOGNIZED:{enter:function(){s.emit("rotatestart",s);},exit:function(){s.emit("rotateend",s);}}},init:function(){this.state=Fs;},eventEmitter:!1};return r.setRecongizedStateObject(new zn(h)),r}return n(o,[{key:"resetFromJSON",value:function(t){return c(s(o.prototype),"resetFromJSON",this).call(this,t),this.setDragThreshold(Ds(t,"threshold",0)),this}},{key:"onDrag2Start",value:function(){this.prevAngle=Bs(Ws(this.angleBetween)),this.state=Hs,0===this.dragThreshold&&(this.state=Ns);}},{key:"onDrag2End",value:function(){this.state=Fs;}},{key:"onDrag2",value:function(){switch(this.state){case Hs:if(this.pointers[0].getDistance()>=this.dragThreshold&&this.pointers[1].getDistance()>=this.dragThreshold){var t=Bs(Ws(this.angleBetween));this.angle=js(this.prevAngle,t),this.prevAngle=t,this.state=Ns;}break;case Ns:t=Bs(Ws(this.angleBetween));this.angle=js(this.prevAngle,t),this.prevAngle=t,this.emit("rotate",this);}}},{key:"isRotated",get:function(){return this.state===Ns}},{key:"rotation",get:function(){return Ys(this.angle)}},{key:"setDragThreshold",value:function(t){return this.dragThreshold=t,this}}]),o}(_s),Is={spinObject:function(t,e){if(!this.isRotation)return this;void 0===e&&(e=this.pointers[0].camera);var i=this.movementCenterX,n=this.movementCenterY,r=function(t,e,i,n){return void 0===n?n={}:!0===n&&(n=As),i.getWorldPoint(t,e,n),n}(this.centerX,this.centerY,e,!0),s=r.x,o=r.y,a=this.rotation;if(Array.isArray(t))for(var h=t,l=0,u=h.length;l=this.sizerChildren.length?this.sizerChildren.push(e):this.sizerChildren.splice(a,0,e),e.isRexSizer||(i>0&&(0===this.orientation?e.minWidth=void 0===h?vt(e):h:e.minHeight=void 0===l?gt(e):l),s&&(0===this.orientation?e.minHeight=l:e.minWidth=h)),void 0!==o&&this.addChildrenMap(o,e),this},co={add:uo,addSpace:function(t){return this.insertSpace(void 0,t),this},insertSpace:function(t,e){return void 0===e&&(e=1),uo.call(this,new ro(this.scene),{proportion:e,minWidth:0,minHeight:0,index:t}),this},insert:function(t,e,i,n,r,s,o,a){return oo(i)&&(i.index=t),uo.call(this,e,i,n,r,s,o,t,a),this},insertAtPosition:function(t,e,i,n,r,s,o,a,h){var l=so.call(this,t,e);return -1===l&&(l=void 0),this.insert(l,i,n,r,s,o,a,h),this}},fo=Gt.prototype.clear,po=function(t){this.backgroundChildren&&(this.backgroundChildren.length=0);var e,i=!t&&this.sizerEventsEnable;if(i&&(e=this.getChildren([])),fo.call(this,t),i)for(var n,r=0,s=e.length;r=0;e--)this.remove(this.sizerChildren[e],t);return this},clear:function(t){return this.sizerChildren.length=0,po.call(this,t),this}},yo={getChildAlign:function(t){return this.getSizerConfig(t).align},setChildAlign:function(t,e){return "string"==typeof e&&(e=$t[e]),this.getSizerConfig(t).align=e,this}},mo={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,n,r=0,s=this.sizerChildren;if(0===this.orientation)for(var o=this.space.item,a=!0,h=0,l=s.length;h0&&this.proportionLength>0&&(i=n.proportion*this.proportionLength):n.expand&&(i=e-this.space.left-this.space.right-r.left-r.right);return i},getExpandedChildHeight:function(t,e){var i;void 0===e&&(e=this.height);var n=t.rexSizer,r=n.padding;0===this.orientation?n.expand&&(i=e-this.space.top-this.space.bottom-r.top-r.bottom):n.proportion>0&&this.proportionLength>0&&(i=n.proportion*this.proportionLength);return i},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,n=0,r=i.length;n0?(e=t-this.getChildrenWidth(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0;}return t},resolveHeight:function(t){t=Ue.call(this,t);if(void 0===this.proportionLength&&1===this.orientation){var e=t-this.childrenHeight;e>0?(e=t-this.getChildrenHeight(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0;}return t}};Object.assign(mo,co,go,yo,{getChildProportion:function(t){return this.getSizerConfig(t).proportion},setChildProportion:function(t,e){return this.getSizerConfig(t).proportion=e,this}},{getChildExpand:function(t){return this.getSizerConfig(t).expand},setChildExpand:function(t,e){return this.getSizerConfig(t).expand=e,this}});var ko=function(){for(var t,e,i=0,n=this.sizerChildren,r=0,s=n.length;r0&&(i+=e);return i},bo={x:0,h:0,horizontal:0,"left-to-right":0,y:1,v:1,vertical:1,"top-to-bottom":1},xo=function(t){return "string"==typeof t&&(t=bo[t]),t},wo=Phaser.Utils.Objects.IsPlainObject,So=Phaser.Utils.Objects.GetValue,Co=function(t){r(s,t);var i=l(s);function s(t,n,r,o,a,h,l){var u;return e(this,s),wo(n)?(n=So(l=n,"x",0),r=So(l,"y",0),o=So(l,"width",void 0),a=So(l,"height",void 0),h=So(l,"orientation",0)):wo(o)?(o=So(l=o,"width",void 0),a=So(l,"height",void 0),h=So(l,"orientation",0)):wo(h)&&(h=So(l=h,"orientation",0)),void 0===h&&(h=0),(u=i.call(this,t,n,r,o,a,l)).type="rexSizer",u.sizerChildren=[],u.setOrientation(h),u.setItemSpacing(So(l,"space.item",0)),u.setStartChildIndex(So(l,"startChildIndex",0)),u.setRTL(So(l,"rtl",!1)),u.addChildrenMap("items",u.sizerChildren),u}return n(s,[{key:"setOrientation",value:function(t){return this.orientation=xo(t),this}},{key:"setItemSpacing",value:function(t){return this.space.item=t,this}},{key:"setStartChildIndex",value:function(t){return this.startChildIndex=t,this}},{key:"setRTL",value:function(t){return void 0===t&&(t=!0),this.rtl=t,this}},{key:"childrenProportion",get:function(){return void 0===this._childrenProportion&&(this._childrenProportion=ko.call(this)),this._childrenProportion}}]),s}(eo);Object.assign(Co.prototype,mo);var Oo=Phaser.Utils.Objects.IsPlainObject,_o=Phaser.Utils.Objects.GetValue,Po=Phaser.Display.Align.CENTER,To=Phaser.Utils.String.UUID,Eo={add:function(t,e,i,n,r,s,o,a,h){(Re.call(this,t),Oo(e))&&(e=_o(l=e,"key",void 0),i=_o(l,"align",Po),a=_o(l,"offsetX",0),h=_o(l,"offsetY",0),n=_o(l,"padding",0),r=_o(l,"expand",!0),t.isRexSizer||(s=_o(l,"minWidth",t._minWidth),o=_o(l,"minHeight",t._minHeighted)));var l,u=void 0!==e;return u||(e=To()),"string"==typeof i&&(i=$t[i]),void 0===i&&(i=Po),void 0===a&&(a=0),void 0===h&&(h=0),void 0===n&&(n=0),void 0===r&&(r=!0),t.isRexSizer||(void 0===s&&(s=t._minWidth),void 0===o&&(o=t._minHeight)),(l=this.getSizerConfig(t)).align=i,l.alignOffsetX=a,l.alignOffsetY=h,l.padding=Ee(n),Oo(r)?(l.expandWidth=_o(r,"width",!1),l.expandHeight=_o(r,"height",!1)):(l.expandWidth=r,l.expandHeight=r),t.isRexSizer||(l.expandWidth&&(t.minWidth=void 0===s?vt(t):s),l.expandHeight&&(t.minHeight=void 0===o?gt(t):o)),this.sizerChildren.hasOwnProperty(e)&&this.sizerChildren[e].destroy(),this.sizerChildren[e]=t,u&&this.addChildrenMap(e,t),this}},Mo={remove:function(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]),De.call(this,t,e),this},removeAll:function(t){for(var e in this.sizerChildren)this.remove(e,t);return this},clear:function(t){for(var e in this.sizerChildren)delete this.sizerChildren[e],this.childrenMap.hasOwnProperty(e)&&delete this.childrenMap[e];return po.call(this,t),this}},Ro={getChildrenWidth:function(){if(this.rexSizer.hidden)return 0;var t,e,i,n=0,r=this.sizerChildren;for(var s in r)e=(t=r[s]).rexSizer.padding,i=this.getChildWidth(t)+e.left+e.right,n=Math.max(i,n);return n+this.space.left+this.space.right},getChildrenHeight:function(){if(this.rexSizer.hidden)return 0;var t,e,i,n=0,r=this.sizerChildren;for(var s in r)i=(t=r[s]).isRexSizer?Math.max(t.minHeight,t.childrenHeight):void 0!==t.minHeight?t.minHeight:gt(t),i+=(e=t.rexSizer.padding).top+e.bottom,n=Math.max(i,n);return n+this.space.top+this.space.bottom},getExpandedChildWidth:function(t,e){var i;void 0===e&&(e=this.width);var n=t.rexSizer;if(n.expandWidth){var r=e-this.space.left-this.space.right,s=n.padding;i=r-s.left-s.right;}return i},getExpandedChildHeight:function(t,e){var i;void 0===e&&(e=this.height);var n=t.rexSizer;if(n.expandHeight){var r=e-this.space.top-this.space.bottom,s=n.padding;i=r-s.top-s.bottom;}return i},getChildrenSizers:function(t){void 0===t&&(t=[]);var e,i=this.sizerChildren;for(var n in i)(e=i[n]).isRexSizer&&t.push(e);return t},layoutChildren:function(){var t,e,i,n,r,s,o,a,h,l=this.innerLeft,u=this.innerTop,c=this.innerWidth,d=this.innerHeight,f=this.sizerChildren;for(var p in f)(t=f[p]).rexSizer.hidden||(i=(e=t.rexSizer).padding,gr.call(this,t),t.isRexSizer?(t.runLayout(this,this.getExpandedChildWidth(t),this.getExpandedChildHeight(t)),io(t,this)):(a=void 0,h=void 0,e.expandWidth&&(a=c-i.left-i.right),e.expandHeight&&(h=d-i.top-i.bottom),dr(t,a,h)),n=l+i.left,s=c-i.left-i.right,r=u+i.top,o=d-i.top-i.bottom,yr.call(this,t,n,r,s,o,e.align,e.alignOffsetX,e.alignOffsetY));}};Object.assign(Ro,Eo,Mo);var Lo=Phaser.Utils.Objects.IsPlainObject,zo=Phaser.Utils.Objects.GetValue,Ao=function(t){r(s,t);var i=l(s);function s(t,n,r,o,a,h){var l;return e(this,s),Lo(n)?(n=zo(h=n,"x",0),r=zo(h,"y",0),o=zo(h,"width",void 0),a=zo(h,"height",void 0)):Lo(o)&&(o=zo(h=o,"width",void 0),a=zo(h,"height",void 0)),(l=i.call(this,t,n,r,o,a,h)).type="rexOverlapSizer",l.sizerChildren={},l.addChildrenMap("items",l.sizerChildren),l}return n(s,[{key:"childToKey",value:function(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}}]),s}(eo);Object.assign(Ao.prototype,Ro);var Do=Co.prototype.add,Bo=Co.prototype.addSpace,jo=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)&&Bo.call(this),Do.call(this,t,{proportion:i,expand:!0});var n=!this.buttonsExpand&&"center"===this.buttonsAlign;n&&Bo.call(this),this.hasTailSpace=n;}else Do.call(this,t,{proportion:i,expand:!0}),this.hasTailSpace=!1;else if(this.hasTailSpace){var r=this.sizerChildren.length-1;Do.call(this,t,{index:r,proportion:i,expand:!0});}else Do.call(this,t,{proportion:i,expand:!0});return e&&this.buttonGroup.add(t),this},Wo={addButton:function(t){if(ar(t))for(var e=t,i=0,n=e.length;i=0;i--)Io.call(this,e[i],t);return this}},Ho=function(t,e,i){if(t){var n=this.setValueCallback,r=this.setValueCallbackScope;n&&(r?n.call(r,t,e,i):n(t,e,i)),this.fireEvent("button.statechange",t,e,i);}},No=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 n=t._selected;t._selected=i,Ho.call(e,t,i,n);}},enumerable:!0,configurable:!0}),t.selected=!1;},Go={add:function(t){return this.buttons.push(t),t._click||(t._click=new br(t,this.clickConfig),t._click.on("click",(function(t,e,i,n){this.fireEvent("button.click",e,i,n);}),this).on("enable",(function(t,e){this.fireEvent("button.enable",e);}),this).on("disable",(function(t,e){this.fireEvent("button.disable",e);}),this),t.on("pointerover",(function(e,i,n,r){this.fireEvent("button.over",t,e,r);}),this).on("pointerout",(function(e,i){this.fireEvent("button.out",t,e,i);}),this).on("pointerdown",(function(e,i,n,r){this.fireEvent("button.down",t,e,r);}),this).on("pointerup",(function(e,i){this.fireEvent("button.up",t,e,i);}),this)),this.buttonsType&&(void 0===t.name&&console.error("".concat(this.parent.constructor.name,": Option button miss value")),No.call(this,t)),this},addMultiple:function(t){for(var e=0,i=t.length;e2?o-2:0),h=2;ha.height/2)){r>(h=aa(a.left,a.centerY,t,e))&&(r=h,n=s);var h,l=i[s+1];if(!l||l.y!==a.y)r>(h=aa(a.right,a.centerY,t,e))&&(r=h,n=s+1);}}return n},la=Phaser.Utils.Objects.IsPlainObject,ua=Phaser.Utils.Objects.GetValue,ca=Phaser.Display.Align.CENTER,da=function(t,e,i,n){if("\n"===t)return this.addNewLine(),this;var r;(Re.call(this,t),la(e))&&(e=ua(r=e,"padding",0),i=ua(r,"key",void 0),n=ua(r,"index",void 0));return void 0===e&&(e=0),(r=this.getSizerConfig(t)).align=ca,r.padding=Ee(e),void 0===n||n>=this.sizerChildren.length?this.sizerChildren.push(t):this.sizerChildren.splice(n,0,t),void 0!==i&&this.addChildrenMap(i,t),this},fa={add:function(t,e,i){if(ar(t))for(var n=t,r=0,s=n.length;r=0;e--)this.remove(this.sizerChildren[e],t);return this},clear:function(t){return this.sizerChildren.length=0,po.call(this,t),this}},ga={getChildrenWidth:function(){return this.rexSizer.hidden?0:this.maxChildWidth+this.space.left+this.space.right},getChildrenHeight:function(){return this.rexSizer.hidden?0:this.widthWrapResult.height+this.space.top+this.space.bottom},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,n=0,r=i.length;nr&&Sa.addNewLine(this);}else for(s=0,o=t.length;s=0;i--)Ta.call(this,e[i],t);return this}},Ma=Phaser.Utils.Objects.GetValue,Ra=function(t){r(o,t);var i=l(o);function o(t,n){var r;e(this,o),void 0===n&&(n={});var s=n.space;"number"==typeof s&&(n.space={item:s,line:s}),(r=i.call(this,t,n)).type="rexFixWidthButtons",r.buttonGroup=new $o({parent:a(r),eventEmitter:Ma(n,"eventEmitter",a(r)),groupName:Ma(n,"groupName",void 0),clickConfig:Ma(n,"click",void 0)}).setButtonsType(n);var h=Ma(n,"background",void 0),l=Ma(n,"buttons",void 0);return r.buttonsAlign=Ma(n,"align",void 0),h&&r.addBackground(h),l&&r.addButtons(l),r.addChildrenMap("background",h),r.addChildrenMap("buttons",r.buttonGroup.buttons),r}return n(o,[{key:"destroy",value:function(t){this.scene&&!this.ignoreDestroy&&(c(s(o.prototype),"destroy",this).call(this,t),this.buttonGroup.destroy(),this.buttonGroup=void 0);}},{key:"buttons",get:function(){return this.buttonGroup.buttons}},{key:"groupName",get:function(){return this.buttonGroup.groupName},set:function(t){this.buttonGroup.groupName=t;}},{key:"eventEmitter",get:function(){return this.buttonGroup.eventEmitter}}]),o}(xa);Object.assign(Ra.prototype,Oa,Ea,Zo,ta);var La=function(){return Array.prototype.reduce.call(arguments,za,0)},za=function(t,e){return t+e},Aa=Phaser.Utils.Objects.IsPlainObject,Da=Phaser.Utils.Objects.GetValue,Ba=Phaser.Display.Align.CENTER,ja=function(t,e,i,n,r){if("number"==typeof t||"number"==typeof e)if(void 0===t){for(var s=0;s=0;e--){var i=this.sizerChildren[e];i&&this.remove(i,t);}return this},clear:function(t){return Ya(this.sizerChildren,null),po.call(this,t),this}},Ia={setColumnSpace:function(t){if(this.space.column||(this.space.column=[]),this.space.column.length=this.columnCount-1,"number"==typeof t)Ya(this.space.column,t);else for(var e=0,i=this.columnCount-1;e=0;n--){var r=n*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},Ga={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);for(var e,i,n,r,s=0,o=this.sizerChildren,a=0;a0){var i=t-this.getChildrenWidth(!1);i>=0&&(this.proportionWidthLength=i/e);}else this.proportionWidthLength=0;}return t},resolveHeight:function(t){t=Ue.call(this,t);if(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,n;for(var r in this.sizerChildren)(e=this.sizerChildren[r])&&e.isRexSizer&&!e.ignoreLayout&&(n=this.getColumnWidth(parseInt(r)%this.columnCount),i=this.getExpandedChildWidth(e,n),i=e.resolveWidth(i),e.resolveChildrenWidth(i));},runWidthWrap:function(t){var e,i,n;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(n=this.getColumnWidth(parseInt(r)%this.columnCount),i=this.getExpandedChildWidth(e,n),e.isRexSizer&&(i=e.resolveWidth(i)),e.runWidthWrap(i));return this},resetGrid:function(t,e,i,n,r){if(void 0===i&&(i=0),void 0===n&&(n=0),this.columnCount=t,this.rowCount=e,this.gridCount=t*e,this.removeAll(),this.sizerChildren.length=t*e,Ya(this.sizerChildren,null),this.columnProportions=[],this.columnProportions.length=t,"number"==typeof i)Ya(this.columnProportions,i);else for(var s=0;s0&&(e+=t);return e},Ua=function(){for(var t,e=0,i=0;i0&&(e+=t);return e},Ja=Phaser.Utils.Objects.IsPlainObject,Ka=Phaser.Utils.Objects.GetValue,qa=function(t){r(o,t);var i=l(o);function o(t,n,r,s,a,h,l,u,c,d){var f;return e(this,o),Ja(n)?(n=Ka(d=n,"x",0),r=Ka(d,"y",0),s=Ka(d,"width",void 0),a=Ka(d,"height",void 0),h=Ka(d,"column",d.col||0),l=Ka(d,"row",0),u=Ka(d,"columnProportions",0),c=Ka(d,"rowProportions",0)):Ja(s)?(s=Ka(d=s,"width",void 0),a=Ka(d,"height",void 0),h=Ka(d,"column",d.col||0),l=Ka(d,"row",0),u=Ka(d,"columnProportions",0),c=Ka(d,"rowProportions",0)):Ja(h)?(h=Ka(d=h,"column",d.col||0),l=Ka(d,"row",0),u=Ka(d,"columnProportions",0),c=Ka(d,"rowProportions",0)):Ja(u)&&(u=Ka(d=u,"columnProportions",0),c=Ka(d,"rowProportions",0)),(f=i.call(this,t,n,r,s,a,d)).type="rexGridSizer",f.sizerChildren=[],f.addChildrenMap("items",f.sizerChildren),f.setCreateCellContainerCallback(Ka(d,"createCellContainerCallback")),f.setIndentLeft(Ka(d,"space.indentLeftOdd",0),Ka(d,"space.indentLeftEven",0)),f.setIndentTop(Ka(d,"space.indentTopOdd",0),Ka(d,"space.indentTopEven",0)),f.resetGrid(h,l,u,c,Ka(d,"space",void 0)),f}return n(o,[{key:"destroy",value:function(t){this.scene&&!this.ignoreDestroy&&(c(s(o.prototype),"destroy",this).call(this,t),this.columnProportions=void 0,this.rowProportions=void 0,this.columnWidth=void 0,this.rowHeight=void 0,this.createCellContainerCallback=void 0);}},{key:"setColumnProportion",value:function(t,e){return t>=this.columnProportions.length||(this.columnProportions[t]=e),this}},{key:"setRowProportion",value:function(t,e){return t>=this.rowProportions.length||(this.rowProportions[t]=e),this}},{key:"totalColumnProportions",get:function(){return void 0===this._totalColumnProportions&&(this._totalColumnProportions=Va.call(this)),this._totalColumnProportions}},{key:"totalRowProportions",get:function(){return void 0===this._totalRowProportions&&(this._totalRowProportions=Ua.call(this)),this._totalRowProportions}},{key:"getChildAt",value:function(t,e){return this.sizerChildren[e*this.columnCount+t]}},{key:"childToGridIndex",value:function(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)}},{key:"getColumnWidth",value:function(t){var e=this.columnProportions[t];return 0===e?this.columnWidth[t]:e*this.proportionWidthLength}},{key:"getRowHeight",value:function(t){var e=this.rowProportions[t];return 0===e?this.rowHeight[t]:e*this.proportionHeightLength}},{key:"setCreateCellContainerCallback",value:function(t){return this.createCellContainerCallback=t,this}}]),o}(eo);Object.assign(qa.prototype,Ga);var Za=qa.prototype.add,$a={addButton:function(t,e,i){return Za.call(this,t,e,i,void 0,0,this.buttonsExpand),this.buttonGroup.add(t),this},addButtons:function(t,e){for(var i=0,n=t;i=0;i--)eh.call(this,e[i],t);return this}},nh=Phaser.Utils.Objects.GetValue,rh=function(t){r(o,t);var i=l(o);function o(t,n){var r;e(this,o),void 0===n&&(n={});var s=nh(n,"row",0),h=nh(n,"column",n.col||0),l=nh(n,"createCellContainerCallback"),u=nh(n,"buttons",void 0),c=nh(n,"expand",!0),d=c?1:0;if(l&&(n.createCellContainerCallback=void 0),void 0!==u){s=Math.max(s,u.length);for(var f=0,p=u.length;f=0||t.y>=0,t.x=Math.abs(t.x),t.y=Math.abs(t.y);},Lh=function(t,e,i){var n=i.length;if(n>=2){var r=i[n-2],s=i[n-1];if(t===r&&e===s)return i}return i.push(t,e),i},zh=Phaser.Math.DegToRad,Ah=function(t,e,i,n,r,s,o,a,h){o&&s>r?s-=360:!o&&s>>16,a=(65280&r)>>>8,h=255&r;t.fillStyle="rgba("+o+","+a+","+h+","+s+")";}(r,e),r.fill()),e.isStroked&&(!function(t,e,i,n){var r=i||e.strokeColor,s=n||e.strokeAlpha,o=(16711680&r)>>>16,a=(65280&r)>>>8,h=255&r;t.strokeStyle="rgba("+o+","+a+","+h+","+s+")",t.lineWidth=e.lineWidth;}(r,e),r.stroke()),r.restore();}}},Xh=Phaser.GameObjects.Shape,Ih=Phaser.Utils.Objects.IsPlainObject,Fh=Phaser.Utils.Objects.GetValue,Hh=Phaser.Geom.Polygon.Earcut,Nh=function(t){r(s,t);var i=l(s);function s(t,n,r,o,a,h,l,u){var c,d,f,p,v;if(e(this,s),Ih(n)){var g=n;n=g.x,r=g.y,o=g.width,a=g.height,h=g.radius,l=g.color,u=g.alpha,d=g.strokeColor,f=g.strokeAlpha,p=g.strokeWidth,v=g.shape;}void 0===n&&(n=0),void 0===r&&(r=0),void 0===o&&(o=1),void 0===a&&(a=o),void 0===h&&(h=0),void 0===v&&(v=0);var y=new Th;if((c=i.call(this,t,"rexRoundRectangleShape",y)).setShapeType(v),0===c.shapeType){var m=Fh(h,"radius",h);y.setTo(0,0,o,a,m);}else {m={x:o/2,y:a/2};y.setTo(0,0,o,a,m);}var k=Fh(h,"iteration",void 0);return c.setIteration(k),c.setPosition(n,r),c.setFillStyle(l,u),void 0!==d&&void 0===p&&(p=2),c.setStrokeStyle(p,d,f),c.updateDisplayOrigin(),c.dirty=!0,c}return n(s,[{key:"fillColor",get:function(){return this._fillColor},set:function(t){this._fillColor=t,this.isFilled=null!=t&&this._fillAlpha>0;}},{key:"fillAlpha",get:function(){return this._fillAlpha},set:function(t){this._fillAlpha=t,this.isFilled=t>0&&null!=this._fillColor;}},{key:"setFillStyle",value:function(t,e){return void 0===e&&(e=1),this.fillColor=t,this.fillAlpha=e,this}},{key:"strokeColor",get:function(){return this._strokeColor},set:function(t){this._strokeColor=t,this.isStroked=null!=t&&this._strokeAlpha>0&&this._lineWidth>0;}},{key:"strokeAlpha",get:function(){return this._strokeAlpha},set:function(t){this._strokeAlpha=t,this.isStroked=t>0&&null!=this._strokeColor&&this._lineWidth>0;}},{key:"lineWidth",get:function(){return this._lineWidth},set:function(t){this._lineWidth=t,this.isStroked=t>0&&null!=this._strokeColor;}},{key:"setStrokeStyle",value:function(t,e,i){return void 0===i&&(i=1),this.lineWidth=t,this.strokeColor=e,this.strokeAlpha=i,this}},{key:"updateData",value:function(){var t=this.geom,e=this.pathData;e.length=0;var i,n=t.width,r=t.height,s=t.cornerRadius,o=this.iteration+1;if(i=s.tl,Gh(i))if(i.convex){var a=i.x,h=i.y;Ah(a,h,i.x,i.y,180,270,!1,o,e);}else {Ah(a=0,h=0,i.x,i.y,90,0,!0,o,e);}else Lh(0,0,e);if(i=s.tr,Gh(i))if(i.convex){a=n-i.x,h=i.y;Ah(a,h,i.x,i.y,270,360,!1,o,e);}else {Ah(a=n,h=0,i.x,i.y,180,90,!0,o,e);}else Lh(n,0,e);if(i=s.br,Gh(i))if(i.convex){a=n-i.x,h=r-i.y;Ah(a,h,i.x,i.y,0,90,!1,o,e);}else {Ah(a=n,h=r,i.x,i.y,270,180,!0,o,e);}else Lh(n,r,e);if(i=s.bl,Gh(i))if(i.convex){a=i.x,h=r-i.y;Ah(a,h,i.x,i.y,90,180,!1,o,e);}else {Ah(a=0,h=r,i.x,i.y,360,270,!0,o,e);}else Lh(0,r,e);return e.push(e[0],e[1]),this.pathIndexes=Hh(e),this}},{key:"setShapeType",value:function(t){return "string"==typeof t&&(t=Vh[t]),this.shapeType=t,this}},{key:"width",get:function(){return this.geom.width},set:function(t){this.resize(t,this.height);}},{key:"height",get:function(){return this.geom.height},set:function(t){this.resize(this.width,t);}},{key:"setSize",value:function(t,e){if(void 0===e&&(e=t),this.geom.width===t&&this.geom.height===e)return this;this.geom.setSize(t,e),1===this.shapeType&&this.setRadius({x:t/2,y:e/2}),this.updateDisplayOrigin(),this.dirty=!0;var i=this.input;return i&&!i.customHitArea&&(i.hitArea.width=t,i.hitArea.height=e),this}},{key:"resize",value:function(t,e){return this.setSize(t,e),this}},{key:"radius",get:function(){return this.geom.radius},set:function(t){this.geom.setRadius(t),this.updateDisplayOrigin(),this.dirty=!0;}},{key:"radiusTL",get:function(){return this.geom.radiusTL},set:function(t){this.geom.radiusTL=t,this.dirty=!0;}},{key:"radiusTR",get:function(){return this.geom.radiusTR},set:function(t){this.geom.radiusTR=t,this.dirty=!0;}},{key:"radiusBL",get:function(){return this.geom.radiusBL},set:function(t){this.geom.radiusBL=t,this.dirty=!0;}},{key:"radiusBR",get:function(){return this.geom.radiusBR},set:function(t){this.geom.radiusBR=t,this.dirty=!0;}},{key:"setRadius",value:function(t){return void 0===t&&(t=0),this.radius=t,this}},{key:"setRadiusTL",value:function(t){return void 0===t&&(t=0),this.radiusTL=t,this}},{key:"setRadiusTR",value:function(t){return void 0===t&&(t=0),this.radiusTR=t,this}},{key:"setRadiusBL",value:function(t){return void 0===t&&(t=0),this.radiusBL=t,this}},{key:"setRadiusBR",value:function(t){return void 0===t&&(t=0),this.radiusBR=t,this}},{key:"cornerRadius",get:function(){return this.geom.cornerRadius},set:function(t){this.radius=t;}},{key:"setCornerRadius",value:function(t){return this.setRadius(t)}},{key:"iteration",get:function(){return this._iteration},set:function(t){void 0!==this._iteration?this._iteration!==t&&(this._iteration=t,this.dirty=!0):this._iteration=t;}},{key:"setIteration",value:function(t){return void 0===t&&(t=6),this.iteration=t,this}}]),s}(Xh),Gh=function(t){return t.x>0&&t.y>0},Vh={rectangle:0,circle:1};Object.assign(Nh.prototype,Yh);var Uh=Phaser.Utils.Objects.GetValue,Jh=function(t){r(s,t);var i=l(s);function s(t,n){var r;e(this,s),(r=i.call(this,t,n)).style=Uh(n,"style",a(r));var o=Uh(n,"propertiesMap");return r.activeStyle=Kh(n,"active",o),r.hoverStyle=Kh(n,"hover",o),r.disableStyle=Kh(n,"disable",o),r.onModifyStyle=Uh(n,"onModifyStyle"),r}return n(s,[{key:"getStyle",value:function(t){return function(t,e,i){if(void 0===i&&(i={}),Array.isArray(e))for(var n=0,r=e.length;n=6?(n=[arguments[2],void 0,arguments[3]],r=[arguments[4],void 0,arguments[5]]):(n=Ch(n),r=Ch(r)),this.textureKey=e,this.baseFrameName=i,this.columns.data=n,this.columns.count=n?n.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 s=this.scene.sys.textures.get(e);if(!s)return this.clear(),this;if(!n||!r)return this.clear(),this;for(var o=s.get(i),a=o.width,h=0,l=0,u=n.length;l0?0:g,b=0;l=0;for(var C=n.length;l0?0:y),y>=1&&g>=1){var O=t(m=this.getFrameNameCallback(l,w,i));"string"!==O&&"number"!==O||s.add(m,0,b+o.cutX,x+o.cutY,y,g);}b+=y;}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,n,r,s,o,a,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,f=c>=0?this.maxFixedPartScaleY:this.height/l;if(this.preserveRatio){var p=Math.min(d,f);if(d>p){var v=(d-p)*h;u>=0?u+=v:u=v,d=p;}if(f>p){var g=(f-p)*l;c>=0?c+=g:c=g,f=p;}}this.columns.scale=d,this.rows.scale=f,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 y=0,m=0;this._beginDraw();for(var k=0,b=this.rows.count;k0&&a>0&&(0===(0===s.stretch&&0===r.stretch||0===this.getStretchMode(x,k)?0:1)?this._drawImage(this.textureKey,n,y,m,o,a):this._drawTileSprite(this.textureKey,n,y,m,o,a)),y+=o;m+=a;}this._endDraw();},setStretchMode:function(t){return vl(t)?(this.stretchMode.edge=yl(gl(t,"edge",0)),this.stretchMode.internal=yl(gl(t,"internal",0))):(t=yl(t),this.stretchMode.edge=t,this.stretchMode.internal=t),this},getStretchMode:function(t,e){return kl.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}},xl=Phaser.Utils.Objects.IsPlainObject,wl=Phaser.Utils.Objects.GetValue,Sl=Phaser.GameObjects,Cl=void 0,Ol=function(t,e){if(Cl||(Cl={},ni(t).events.once("destroy",(function(){for(var t in Cl)Cl[t].destroy();Cl=void 0;}))),!Cl.hasOwnProperty(e)){var i=ni(t).scene.systemScene;(t=new Sl[e](i)).setOrigin(0),Cl[e]=t;}return Cl[e]},_l=function(t){r(s,t);var i=l(s);function s(){return e(this,s),i.apply(this,arguments)}return n(s)}(function(t,i){var o=function(t){r(a,t);var o=l(a);function a(t,n,r,s,h,l,u,c,d,f){var p;if(e(this,a),xl(n)?(n=wl(f=n,"x",0),r=wl(f,"y",0),s=wl(f,"width",1),h=wl(f,"height",1),l=wl(f,"key",void 0),u=wl(f,"baseFrame",void 0),c=wl(f,"columns",void 0),d=wl(f,"rows",void 0)):xl(s)?(s=wl(f=s,"width",1),h=wl(f,"height",1),l=wl(f,"key",void 0),u=wl(f,"baseFrame",void 0),c=wl(f,"columns",void 0),d=wl(f,"rows",void 0)):xl(l)?(l=wl(f=l,"key",void 0),u=wl(f,"baseFrame",void 0),c=wl(f,"columns",void 0),d=wl(f,"rows",void 0)):xl(u)?(u=wl(f=u,"baseFrame",void 0),c=wl(f,"columns",void 0),d=wl(f,"rows",void 0)):Array.isArray(u)?(f=d,d=c,c=u,u=wl(f,"baseFrame",void 0)):xl(c)&&(c=wl(f=c,"columns",void 0),d=wl(f,"rows",void 0)),void 0===c){var v=wl(f,"leftWidth",void 0),g=wl(f,"rightWidth",void 0);void 0!==v&&void 0!==g&&(c=[v,void 0,g]);}if(void 0===d){var y=wl(f,"topHeight",void 0),m=wl(f,"bottomHeight",void 0);void 0!==y&&void 0!==m&&(d=[y,void 0,m]);}(p=o.call(this,t)).type=i,p.setPosition(n,r).setSize(s,h).setOrigin(.5,.5),p.columns={},p.rows={},p.stretchMode={},p._tileSprite=void 0,p._image=void 0,p.setGetFrameNameCallback(wl(f,"getFrameNameCallback",void 0)),p.setStretchMode(wl(f,"stretchMode",0)),p.setPreserveRatio(wl(f,"preserveRatio",!0));var k=wl(f,"maxFixedPartScale",1),b=wl(f,"maxFixedPartScaleX",k),x=wl(f,"maxFixedPartScaleY",void 0);return p.setMaxFixedPartScale(b,x),p.setBaseTexture(l,u,c,d),p}return n(a,[{key:"minWidth",get:function(){return this.columns.minWidth}},{key:"minHeight",get:function(){return this.rows.minHeight}},{key:"fixedPartScaleX",get:function(){return this.columns.scale}},{key:"fixedPartScaleY",get:function(){return this.rows.scale}},{key:"resize",value:function(t,e){return this.width===t&&this.height===e||(c(s(a.prototype),"resize",this)?c(s(a.prototype),"resize",this).call(this,t,e):c(s(a.prototype),"setSize",this).call(this,t,e),this.updateTexture()),this}}]),a}(t);return Object.assign(o.prototype,bl),o}(Phaser.GameObjects.RenderTexture,"rexNinePatch")),Pl={_drawImage:function(t,e,i,n,r,s){var o=Ol(this,"Image").setTexture(t,e).setDisplaySize(r,s);this.draw(o,i,n);},_drawTileSprite:function(t,e,i,n,r,s){var o=Ol(this,"TileSprite").setTexture(t,e).setSize(r,s);this.draw(o,i,n);}};Object.assign(_l.prototype,Pl);var Tl=function(t,e){var i,n;switch(e&&(e.hasOwnProperty("type")?i=e.type:e.hasOwnProperty("leftWidth")?i="nineSlice":e.hasOwnProperty("key")&&(i="image")),i){case"image":n=new fl(t,e);break;case"nineSlice":n=e.hasOwnProperty("stretchMode")?new _l(t,e):new ll(t,e);break;default:n=new $h(t,e);}return t.add.existing(n),n},El=Phaser.GameObjects.Text,Ml=Phaser.Utils.Objects.GetValue,Rl=function(t){r(s,t);var i=l(s);function s(t,n){var r;e(this,s),void 0===n&&(n={});var o=Ml(n,"x",0),a=Ml(n,"y",0),h=Ml(n,"text","");return (r=i.call(this,t,o,a,h,n)).type="rexStatesText",n.style=r.style,n.onModifyStyle=function(t,e){var i=e.hasOwnProperty("fontStyle")||e.hasOwnProperty("fontSize")||e.hasOwnProperty("fontFamily");t.style.update(i);},r.addStyleManager(n),delete n.style,r}return n(s)}(El);Object.assign(Rl.prototype,Zh); /** * @author Richard Davey * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Ll=Phaser.Renderer.WebGL.Utils,zl={renderWebGL:function(t,e,i,n){if(0!==e.width&&0!==e.height){i.addToRenderList(e);var r=e.frame,s=r.width,o=r.height,a=Ll.getTintAppendFloatAlpha,h=t.pipelines.set(e.pipeline,e),l=h.setTexture2D(r.glTexture,e);t.pipelines.preBatch(e),h.batchTexture(e,r.glTexture,s,o,e.x,e.y,s/e.style.resolution,o/e.style.resolution,e.scaleX,e.scaleY,e.rotation,e.flipX,e.flipY,e.scrollFactorX,e.scrollFactorY,e.displayOriginX,e.displayOriginY,0,0,s,o,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,n,!1,l),t.pipelines.postBatch(e);}},renderCanvas:function(t,e,i,n){0!==e.width&&0!==e.height&&(i.addToRenderList(e),t.batchSprite(e,e.frame,i,n));}},Al=Phaser.Display.Canvas.CanvasPool;m();var Dl=function(t){r(s,t);var i=l(s);function s(){return e(this,s),i.apply(this,arguments)}return n(s,[{key:"setStyle",value:function(t){return this.style.setStyle(t)}},{key:"setFont",value:function(t){return this.style.setFont(t)}},{key:"setFontFamily",value:function(t){return this.style.setFontFamily(t)}},{key:"setFontSize",value:function(t){return this.style.setFontSize(t)}},{key:"setFontStyle",value:function(t){return this.style.setFontStyle(t)}},{key:"setTestString",value:function(t){return this.style.setTestString(t)}},{key:"setFixedSize",value:function(t,e){return this.style.setFixedSize(t,e)}},{key:"setBackgroundColor",value:function(t,e,i){return this.style.setBackgroundColor(t,e,i)}},{key:"setBackgroundStrokeColor",value:function(t,e){return this.style.setBackgroundStrokeColor(t,e)}},{key:"setBackgroundCornerRadius",value:function(t,e){return this.style.setBackgroundCornerRadius(t,e)}},{key:"setFill",value:function(t){return this.style.setFill(t)}},{key:"setColor",value:function(t){return this.style.setColor(t)}},{key:"setStroke",value:function(t,e){return this.style.setStroke(t,e)}},{key:"setShadow",value:function(t,e,i,n,r,s){return this.style.setShadow(t,e,i,n,r,s)}},{key:"setShadowOffset",value:function(t,e){return this.style.setShadowOffset(t,e)}},{key:"setShadowColor",value:function(t){return this.style.setShadowColor(t)}},{key:"setShadowBlur",value:function(t){return this.style.setShadowBlur(t)}},{key:"setShadowStroke",value:function(t){return this.style.setShadowStroke(t)}},{key:"setShadowFill",value:function(t){return this.style.setShadowFill(t)}},{key:"setWrapMode",value:function(t){return this.style.setWrapMode(t)}},{key:"setWrapWidth",value:function(t){return this.style.setWrapWidth(t)}},{key:"setWordWrapWidth",value:function(t){return this.style.setWrapWidth(t)}},{key:"setAlign",value:function(t){return this.style.setHAlign(t)}},{key:"setHAlign",value:function(t){return this.style.setHAlign(t)}},{key:"setVAlign",value:function(t){return this.style.setVAlign(t)}},{key:"setLineSpacing",value:function(t){return this.style.setLineSpacing(t)}},{key:"lineSpacing",get:function(){return this.style.lineSpacing},set:function(t){this.setLineSpacing(t);}},{key:"setXOffset",value:function(t){return this.style.setXOffset(t)}},{key:"setMaxLines",value:function(t){return this.style.setMaxLines(t)}},{key:"setResolution",value:function(t){return this.style.setResolution(t)}},{key:"getTextMetrics",value:function(){return this.style.getTextMetrics()}},{key:"setTextMetrics",value:function(t,e){return this.style.setTextMetrics(t,e)}},{key:"measureTextMargins",value:function(t,e){return function(t,e,i){void 0===i&&(i={});var n=Al.create(this),r=n.getContext("2d",{willReadFrequently:!0});t.syncFont(n,r);var s=r.measureText(e),o=Math.ceil(s.width*t.baselineX),a=o,h=2*a;if(a=a*t.baselineY|0,n.width=o,n.height=h,r.fillStyle="#f00",r.fillRect(0,0,o,h),r.font=t._font,r.textBaseline="alphabetic",r.fillStyle="#000",r.fillText(t.testString,0,a),i.left=0,0===o||0===h||!r.getImageData(0,0,o,h))return Al.remove(n),i;for(var l=r.getImageData(0,0,o,h).data,u=!1,c=0;ch;u--){for(c=0;c0&&this.wrapMode!==Gl&&0===this.wrapWidth}},{key:"setStyle",value:function(t,e,i){if(void 0===e&&(e=!0),void 0===i&&(i=!1),t&&t.hasOwnProperty("wrap")){var n=t.wrap;if(n.hasOwnProperty("mode")){var r=n.mode;"string"==typeof r&&(n.mode=$l[r]);}else n.hasOwnProperty("width")&&(n.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 s=this.propertyMap;for(var o in s){var a=s[o],h=a[0],l=i?a[1]:this[o],u=a[2];if("wrapCallback"===o||"wrapCallbackScope"===o)this[o]=ql(t,h,l);else {var c=Kl(t,h,l);u&&(c=u(c)),this[o]=c;}}var d=ql(t,"font",null);this._font=null===d?this.fontStyle+" "+this.fontSize+" "+this.fontFamily:d;var f=ql(t,"fill",null);null!==f&&(this.color=Wl(f));var p=ql(t,"metrics",!1);return p?this.metrics={ascent:ql(p,"ascent",0),descent:ql(p,"descent",0),fontSize:ql(p,"fontSize",0)}:!e&&this.metrics||(this.metrics=Il(this)),e?this.parent.updateText():this.parent}},{key:"syncFont",value:function(t,e){e.font=this._font;}},{key:"syncStyle",value:function(t,e){e.textBaseline="alphabetic",e.fillStyle=this.color,e.strokeStyle=this.stroke,e.lineWidth=this.strokeThickness,e.lineCap="round",e.lineJoin="round";}},{key:"syncShadow",value:function(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);}},{key:"update",value:function(t){return t&&(this._font="".concat(this.fontStyle," ").concat(this.fontSize," ").concat(this.fontFamily).trim(),this.metrics=Il(this)),this.parent.updateText(t)}},{key:"buildFont",value:function(){var t="".concat(this.fontStyle," ").concat(this.fontSize," ").concat(this.fontFamily).trim();return t!==this._font&&(this._font=t),this}},{key:"setFont",value:function(t){return "string"==typeof t?(this.fontFamily=t,this.fontSize="",this.fontStyle=""):(this.fontFamily=ql(t,"fontFamily","Courier"),this.fontSize=ql(t,"fontSize","16px"),this.fontStyle=ql(t,"fontStyle","")),this.update(!0)}},{key:"setFontFamily",value:function(t){return this.fontFamily=t,this.update(!0)}},{key:"setFontStyle",value:function(t){return this.fontStyle=t,this.update(!0)}},{key:"setFontSize",value:function(t){return "number"==typeof t&&(t=t.toString()+"px"),this.fontSize=t,this.update(!0)}},{key:"setTestString",value:function(t){return this.testString=t,this.update(!0)}},{key:"setFixedSize",value:function(t,e){return this.fixedWidth=t,this.fixedHeight=e,t&&(this.parent.width=t),e&&(this.parent.height=e),this.update(this.isWrapFitMode)}},{key:"setResolution",value:function(t){return this.resolution=t,this.update(!1)}},{key:"setLineSpacing",value:function(t){return this.lineSpacing=t,this.update(!1)}},{key:"setXOffset",value:function(t){return this.xOffset=t,this.update(!1)}},{key:"setBackgroundColor",value:function(t,e,i){return void 0===i&&(i=!0),this.backgroundColor=Wl(t,this.parent.canvas,this.parent.context),this.backgroundColor2=Wl(e,this.parent.canvas,this.parent.context),this.backgroundHorizontalGradient=i,this.update(!1)}},{key:"setBackgroundStrokeColor",value:function(t,e){return this.backgroundStrokeColor=Wl(t,this.parent.canvas,this.parent.context),this.backgroundStrokeLineWidth=e,this.update(!1)}},{key:"setBackgroundCornerRadius",value:function(t,e){return this.backgroundCornerRadius=t,this.backgroundCornerIteration=e,this.update(!1)}},{key:"setFill",value:function(t){return this.color=Wl(t,this.parent.canvas,this.parent.context),this.update(!1)}},{key:"setColor",value:function(t){return this.color=Wl(t,this.parent.canvas,this.parent.context),this.update(!1)}},{key:"setStroke",value:function(t,e){return void 0===t?this.strokeThickness=0:(void 0===e&&(e=this.strokeThickness),this.stroke=Wl(t,this.parent.canvas,this.parent.context),this.strokeThickness=e),this.update(!0)}},{key:"setShadow",value:function(t,e,i,n,r,s){return void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i="#000"),void 0===n&&(n=0),void 0===r&&(r=!1),void 0===s&&(s=!0),this.shadowOffsetX=t,this.shadowOffsetY=e,this.shadowColor=Wl(i,this.parent.canvas,this.parent.context),this.shadowBlur=n,this.shadowStroke=r,this.shadowFill=s,this.update(!1)}},{key:"setShadowOffset",value:function(t,e){return void 0===t&&(t=0),void 0===e&&(e=t),this.shadowOffsetX=t,this.shadowOffsetY=e,this.update(!1)}},{key:"setShadowColor",value:function(t){return void 0===t&&(t="#000"),this.shadowColor=Wl(t,this.parent.canvas,this.parent.context),this.update(!1)}},{key:"setShadowBlur",value:function(t){return void 0===t&&(t=0),this.shadowBlur=t,this.update(!1)}},{key:"setShadowStroke",value:function(t){return this.shadowStroke=t,this.update(!1)}},{key:"setShadowFill",value:function(t){return this.shadowFill=t,this.update(!1)}},{key:"setUnderline",value:function(t,e,i){return void 0===t&&(t="#000"),void 0===e&&(e=0),void 0===i&&(i=0),this.underlineColor=Wl(t,this.parent.canvas,this.parent.context),this.underlineThickness=e,this.underlineOffset=i,this.update(!1)}},{key:"setUnderlineColor",value:function(t){return void 0===t&&(t="#000"),this.underlineColor=Wl(t,this.parent.canvas,this.parent.context),this.update(!1)}},{key:"setUnderlineThickness",value:function(t){return void 0===t&&(t=0),this.underlineThickness=t,this.update(!1)}},{key:"setUnderlineOffset",value:function(t){return void 0===t&&(t=0),this.underlineOffset=t,this.update(!1)}},{key:"setStrikethrough",value:function(t,e,i){return void 0===t&&(t="#000"),void 0===e&&(e=0),void 0===i&&(i=0),this.strikethroughColor=Wl(t,this.parent.canvas,this.parent.context),this.strikethroughThickness=e,this.strikethroughOffset=i,this.update(!1)}},{key:"setStrikethroughColor",value:function(t){return void 0===t&&(t="#000"),this.strikethroughColor=Wl(t,this.parent.canvas,this.parent.context),this.update(!1)}},{key:"setStrikethroughThickness",value:function(t){return void 0===t&&(t=0),this.strikethroughThickness=t,this.update(!1)}},{key:"setStrikethroughOffset",value:function(t){return void 0===t&&(t=0),this.strikethroughOffset=t,this.update(!1)}},{key:"setWrapMode",value:function(t){return "string"==typeof t&&(t=$l[t.toLowerCase()]||0),this.wrapMode=t,this.update(!0)}},{key:"setWrapWidth",value:function(t){return this.wrapWidth=t,this.update(!1)}},{key:"setAlign",value:function(t,e){return void 0===t&&(t="left"),void 0===e&&(e="top"),this.halign=t,this.valign=e,this.update(!1)}},{key:"setHAlign",value:function(t){return void 0===t&&(t="left"),this.halign=t,this.update(!1)}},{key:"setVAlign",value:function(t){return void 0===t&&(t="top"),this.valign=t,this.update(!1)}},{key:"setMaxLines",value:function(t){return void 0===t&&(t=0),this.maxLines=t,this.update(!1)}},{key:"getTextMetrics",value:function(){var t=this.metrics;return {ascent:t.ascent,descent:t.descent,fontSize:t.fontSize}}},{key:"setTextMetrics",value:function(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=ql(e,"fontFamily",this.fontFamily),this.fontSize=ql(e,"fontSize",this.fontSize),this.fontStyle=ql(e,"fontStyle",this.fontStyle))),this.parent.updateText(!0)}},{key:"lineHeight",get:function(){return this.metrics.fontSize+this.strokeThickness+this.lineSpacing}},{key:"toJSON",value:function(){var t={},e=this.propertyMap;for(var i in e)t[i]=this[i];return t.metrics=this.getTextMetrics(),t}},{key:"destroy",value:function(){this.parent=void 0;}}]),t}(),$l={none:Gl,word:Vl,char:Ul,character:Ul},Ql=Phaser.Math.DegToRad,tu=function(t){return !t.hasOwnProperty("convex")||t.convex},eu=function(t){return t.x>0&&t.y>0},iu=function(t,e,i,n,r,s,o,a,h){if(a&&o>s?o-=360:!a&&o=f?1:n/f,g=r>=p?1:r/p,y=d.cornerRadius;t.save(),t.beginPath(),t.translate(e,i),a=y.tl,eu(a)?(h=a.x*v,l=a.y*g,tu(a)?iu(t,h,l,h,l,180,270,!1,o):iu(t,0,0,h,l,90,0,!0,o),u=0,c=l):(t.lineTo(0,0),u=0,c=0),a=y.tr,eu(a)?(h=a.x*v,l=a.y*g,tu(a)?iu(t,n-h,l,h,l,270,360,!1,o):iu(t,n,0,h,l,180,90,!0,o)):t.lineTo(n,0),a=y.br,eu(a)?(h=a.x*v,l=a.y*g,tu(a)?iu(t,n-h,r-l,h,l,0,90,!1,o):iu(t,n,r,h,l,270,180,!0,o)):t.lineTo(n,r),a=y.bl,eu(a)?(h=a.x*v,l=a.y*g,tu(a)?iu(t,h,r-l,h,l,90,180,!1,o):iu(t,0,r,h,l,360,270,!0,o)):t.lineTo(0,r),t.lineTo(u,c),t.closePath(),t.restore();}(e,i,n,r,s,o,d),null!=a){var f;if(null!=u)(f=c?e.createLinearGradient(0,0,r,0):e.createLinearGradient(0,0,0,s)).addColorStop(0,a),f.addColorStop(1,u),a=f;e.fillStyle=a,e.fill();}null!=h&&l>0&&(e.strokeStyle=h,e.lineWidth=l,e.stroke());},ru=function(t,e,i,n,r,s,o,a){if(null!=e||null!=i){var h=t.canvas.width,l=t.canvas.height;null==i&&(n=0);var u=n/2;h=Math.max(1,h-n),l=Math.max(1,l-n),nu(t.canvas,t.context,u,u,h,l,r,e,i,n,s,o,a);}},su={draw:function(t,e,i,n){var r=this.penManager;this.hitAreaManager.clear();var s=this.context;s.save();var o=this.defaultStyle;this.clear(),ru(this,o.backgroundColor,o.backgroundStrokeColor,o.backgroundStrokeLineWidth,o.backgroundCornerRadius,o.backgroundColor2,o.backgroundHorizontalGradient,o.backgroundCornerIteration),t+=this.startXOffset,e+=this.startYOffset;var a,h,l,u,c,d,f=o.halign,p=o.valign,v=o.lineHeight,g=r.lines,y=g.length,m=o.maxLines;m>0&&y>m?(h=m,l="center"===p?Math.floor((y-h)/2):"bottom"===p?y-h:0):(h=y,l=0),u=l+h;var k=this.rtl,b=k?this.parent.width:void 0;d="center"===p?Math.max((n-h*v)/2,0):"bottom"===p?Math.max(n-h*v-2,0):0,d+=e;for(var x=l;x0&&t.width>0){var a=i+o.underlineOffset-o.underlineThickness/2;this.drawLine(e,a,t.width,o.underlineThickness,o.underlineColor);}if(t.isTextPen&&this.drawText(e,i,t.text,o),t.isImagePen&&this.drawImage(e,i,t.prop.img,o),o.strikethroughThickness>0&&t.width>0){a=i+o.strikethroughOffset-o.strikethroughThickness/2;this.drawLine(e,a,t.width,o.strikethroughThickness,o.strikethroughColor);}if(s.restore(),t.hasAreaMarker&&t.width>0){var h,l=t.prop.area;if(l)h={key:l};else {var u=t.prop.url;h={key:"url:".concat(u),url:u};}this.hitAreaManager.add(e,i-this.startYOffset,t.width,this.defaultStyle.lineHeight,h);}},clear:function(){var t=this.canvas;this.context.clearRect(0,0,t.width,t.height);},drawLine:function(t,e,i,n,r){this.autoRound&&(t=Math.round(t),e=Math.round(e));var s=this.context,o=s.lineCap;s.lineCap="butt",s.strokeStyle=r,s.lineWidth=n,s.beginPath(),s.moveTo(t,e),s.lineTo(t+i,e),s.stroke(),s.lineCap=o;},drawText:function(t,e,i,n){this.autoRound&&(t=Math.round(t),e=Math.round(e));var r=this.context;n.stroke&&"none"!==n.stroke&&n.strokeThickness>0&&(n.syncShadow(r,n.shadowStroke),r.strokeText(i,t,e)),n.color&&"none"!==n.color&&(n.syncShadow(r,n.shadowFill),r.fillText(i,t,e));},drawImage:function(t,e,i,n){e-=this.startYOffset,this.parent.imageManager.draw(i,this.context,t,e,this.autoRound);}},ou=Phaser.Utils.Objects.GetValue,au=Fl,hu=Hl,lu=function(){function t(i){e(this,t),this.prop={},this.resetFromJSON(i);}return n(t,[{key:"resetFromJSON",value:function(t){this.text=ou(t,"text",""),this.x=ou(t,"x",0),this.y=ou(t,"y",0),this.width=ou(t,"width",0);var e=ou(t,"prop",null);null===e&&(e={}),this.prop=e,this.newLineMode=ou(t,"newLineMode",0),this.startIndex=ou(t,"startIndex",0);}},{key:"plainText",get:function(){var t=this.text;return this.newLineMode===hu&&(t+="\n"),t}},{key:"wrapText",get:function(){var t=this.text;return this.newLineMode!==au&&(t+="\n"),t}},{key:"rawTextLength",get:function(){var t=this.text.length;return this.newLineMode===hu&&(t+=1),t}},{key:"endIndex",get:function(){return this.startIndex+this.rawTextLength}},{key:"lastX",get:function(){return this.x+this.width}},{key:"isTextPen",get:function(){return ""!==this.text}},{key:"isImagePen",get:function(){return !!this.prop.img}},{key:"hasAreaMarker",get:function(){return !!this.prop.area||!!this.prop.url}}]),t}(),uu=Phaser.Utils.Objects.GetFastValue,cu=Fl,du=Nl,fu=function(){function t(i){e(this,t),this.pens=[],this.lines=[],this.maxLinesWidth=void 0,this.pensPool=i.pensPool,this.linesPool=i.linesPool,this.tagToText=uu(i,"tagToText",Qt),this.tagToTextScope=uu(i,"tagToTextScope",void 0);}return n(t,[{key:"destroy",value:function(){this.clear(),this.tagToText=void 0,this.tagToTextScope=void 0;}},{key:"clear",value:function(){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}},{key:"getLineEndIndex",value:function(t){t>=this.lines.length&&(t=this.lines.length-1);var e,i,n=!1;for(e=t;e>=0&&!(n=null!=(i=this.lines[e])&&i.length>0);e--);return n?i[i.length-1].endIndex:0}},{key:"getLineWidth",value:function(t){var e=this.lines[t];if(!e)return 0;var i=e[e.length-1];return null==i?0:i.lastX}},{key:"getMaxLineWidth",value:function(){if(void 0!==this.maxLinesWidth)return this.maxLinesWidth;for(var t,e=0,i=0,n=this.lines.length;ie&&(e=t);return this.maxLinesWidth=e,e}},{key:"getLineWidths",value:function(){for(var t=[],e=0,i=this.lines.length;e=t&&h<=e||(o=o.substring(t-a,e-a)),this.tagToTextScope?c+=this.tagToText.call(this.tagToTextScope,o,l,u):c+=this.tagToText(o,l,u),u=l,!(h>=e)));d++);return c}},{key:"length",get:function(){return this.lines.length},set:function(t){this.clear();}}]),t}(),pu={},vu=function(){function t(){e(this,t),this.items=[];}return n(t,[{key:"destroy",value:function(){this.clear(),this.items=void 0;}},{key:"pop",value:function(){return this.items.length>0?this.items.pop():null}},{key:"push",value:function(t){return this.items.push(t),this}},{key:"pushMultiple",value:function(t){return this.items.push.apply(this.items,t),t.length=0,this}},{key:"clear",value:function(){return this.items.length=0,this}}]),t}(),gu=Phaser.Geom.Rectangle,yu=new vu,mu=function(){function t(){e(this,t),this.hitAreas=[];}return n(t,[{key:"destroy",value:function(){this.clear();}},{key:"clear",value:function(){for(var t=0,e=this.hitAreas.length;tr){""!==C?a.push(o.getLine(C,O,Ou)):0===T&&s>0&&a.push(o.getLine("",0,Ou)),a.push.apply(a,p(t(b,i,Pu,r,0,o)));var E=a.pop();C=E.text,O=E.width,o.freeLine(E)," "===C&&(C="",O=0);}else (S=O+x)>l?(a.push(o.getLine(C,O,Ou)),C=b,O=x,l=r):(C+=b,O=S),w&&a.push(o.getLine(C,O,u));}return a},Ru=Phaser.Utils.Objects.GetValue,Lu=Gl,zu=Fl,Au=function(){function t(i){e(this,t),this.parent=i.parent,this.scene=this.parent.scene,this.context=Ru(i,"context",null),this.canvas=this.context.canvas,this.parser=Ru(i,"parser",null),this.defaultStyle=Ru(i,"style",null),this.autoRound=!0,this.pensPool=i.pensPool,this.linesPool=i.linesPool,this.wrapTextLinesPool=i.wrapTextLinesPool,this.penManager=this.newPenManager(),this._tmpPenManager=null,this.hitAreaManager=new mu,this.lastHitAreaKey=null,this.urlTagCursorStyle=null;var n=this.context;this.getTextWidth=function(t){return n.measureText(t).width};}return n(t,[{key:"destroy",value:function(){this.parent=void 0,this.scene=void 0,this.context=void 0,this.canvas=void 0,this.parser=void 0,this.defaultStyle=void 0,this.penManager&&(this.penManager.destroy(),this.penManager=void 0),this._tmpPenManager&&(this._tmpPenManager.destroy(),this._tmpPenManager=void 0),this.hitAreaManager&&(this.hitAreaManager.destroy(),this.hitAreaManager=void 0),this.pensPool=void 0,this.linesPool=void 0,this.wrapTextLinesPool=void 0;}},{key:"updatePenManager",value:function(t,e,i,n,r){if(void 0===r&&(r=this.penManager),r.clear(),""===t)return r;var s=this.parent.style;if(s.isWrapFitMode){var o=this.parent.padding;i=s.fixedWidth-o.left-o.right;}for(var a,h,l,u,c,d=this.canvas,f=this.context,p=function(t){return f.measureText(t).width},v=0,g=0,y=s.wrapCallback,m=s.wrapCallbackScope,k=!0,b=this.parser.splitText(t),x=this.wrapTextLinesPool,w=0,S=b.length;w0&&e!==Lu&&i0&&t>e&&(t=e),t}},{key:"linesWidth",get:function(){return Math.ceil(this.penManager.getMaxLineWidth())}},{key:"linesHeight",get:function(){var t=this.desplayLinesCount,e=this.defaultStyle.lineHeight*t;return t>0&&(e-=this.defaultStyle.lineSpacing),e}},{key:"imageManager",get:function(){return this.parent.imageManager}},{key:"rtl",get:function(){return this.parent.style.rtl}},{key:"newPenManager",value:function(){return new fu({pensPool:this.pensPool,linesPool:this.linesPool,tagToText:this.parser.propToTagText,tagToTextScope:this.parser})}},{key:"tmpPenManager",get:function(){return null===this._tmpPenManager&&(this._tmpPenManager=this.newPenManager()),this._tmpPenManager}},{key:"getPlainText",value:function(t,e,i){var n;if(null==t)n=this.penManager.plainText;else {var r=this.parser.splitText(t,1);n="";for(var s=0,o=r.length;si.width?i.width-r:0;var s=this.drawY+this.drawTLY,o=s+this.height;return e=s<0?0-s:o>i.height?i.height-o:0,i._textOX+=t,i._textOY+=e,this}};Object.assign(Qc,Hc);var td=Phaser.Math.DegToRad,ed=Phaser.Math.RadToDeg,id=Phaser.Utils.Objects.GetValue,nd=function(t){r(s,t);var i=l(s);function s(t,n){var r;return e(this,s),(r=i.call(this,t,n)).renderable=!0,r.scrollFactorX=1,r.scrollFactorY=1,r.toLocalPosition=!0,r.originX=0,r.offsetX=0,r.offsetY=0,r}return n(s,[{key:"visible",get:function(){return this._visible},set:function(t){this.setDirty(this._visible!=t),this._visible=t;}},{key:"setVisible",value:function(t){return void 0===t&&(t=!0),this.visible=t,this}},{key:"alpha",get:function(){return this._alpha},set:function(t){this.setDirty(this._alpha!=t),this._alpha=t;}},{key:"setAlpha",value:function(t){return this.alpha=t,this}},{key:"x",get:function(){return this._x},set:function(t){this.setDirty(this._x!=t),this._x=t;}},{key:"setX",value:function(t){return this.x=t,this}},{key:"y",get:function(){return this._y},set:function(t){this.setDirty(this._y!=t),this._y=t;}},{key:"setY",value:function(t){return this.y=t,this}},{key:"setPosition",value:function(t,e){return this.x=t,this.y=e,this}},{key:"setInitialPosition",value:function(t,e){return this.x0=t,this.y0=e,this}},{key:"setScrollFactorX",value:function(t){return this.scrollFactorX=t,this}},{key:"setScrollFactorY",value:function(t){return this.scrollFactorY=t,this}},{key:"setScrollFactor",value:function(t,e){return void 0===e&&(e=t),this.scrollFactorX=t,this.scrollFactorY=e,this}},{key:"rotation",get:function(){return this._rotation},set:function(t){this.setDirty(this._rotation!=t),this._rotation=t;}},{key:"setRotation",value:function(t){return this.rotation=t,this}},{key:"angle",get:function(){return ed(this._rotation)},set:function(t){this.rotation=td(t);}},{key:"setAngle",value:function(t){return this.angle=t,this}},{key:"scaleX",get:function(){return this._scaleX},set:function(t){this.setDirty(this._scaleX!==t),this._scaleX=t;}},{key:"setScaleX",value:function(t){return this.scaleX=t,this}},{key:"width",get:function(){return 0},set:function(t){}},{key:"setWidth",value:function(t,e){return void 0===e&&(e=!1),this.width=t,e&&(this.scaleY=this.scaleX),this}},{key:"leftSpace",get:function(){return this._leftSpace},set:function(t){this.setDirty(this._leftSpace!==t),this._leftSpace=t;}},{key:"setLeftSpace",value:function(t){return this.leftSpace=t,this}},{key:"rightSpace",get:function(){return this._rightSpace},set:function(t){this.setDirty(this._rightSpace!==t),this._rightSpace=t;}},{key:"setRightSpace",value:function(t){return this.rightSpace=t,this}},{key:"outerWidth",get:function(){return this.width+this.leftSpace+this.rightSpace}},{key:"scaleY",get:function(){return this._scaleY},set:function(t){this.setDirty(this._scaleY!==t),this._scaleY=t;}},{key:"setScaleY",value:function(t){return this.scaleY=t,this}},{key:"height",get:function(){return 0},set:function(t){}},{key:"setHeight",value:function(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}},{key:"setScale",value:function(t,e){return void 0===e&&(e=t),this.scaleX=t,this.scaleY=e,this}},{key:"setOrigin",value:function(t){return this.originX=t,this}},{key:"setAlign",value:function(t){return this.align=t,this}},{key:"modifyPorperties",value:function(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),n=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!==n&&this.setScaleX(n),void 0!==i?void 0===e&&void 0===n?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}},{key:"setDrawBelowCallback",value:function(t){return this.drawBelowCallback=t,this}},{key:"setDrawAboveCallback",value:function(t){return this.drawAboveCallback=t,this}},{key:"reset",value:function(){return this.setVisible().setAlpha(1).setPosition(0,0).setRotation(0).setScale(1,1).setLeftSpace(0).setRightSpace(0).setOrigin(0).setAlign().setDrawBelowCallback().setDrawAboveCallback(),this}},{key:"willRender",get:function(){return this.visible&&this.alpha>0}},{key:"drawX",get:function(){var t=this.x+this.leftSpace+this.offsetX-this.originX*this.width;return this.parent._textOX*this.scrollFactorX+t}},{key:"drawY",get:function(){var t=this.y+this.offsetY;return this.parent._textOY*this.scrollFactorY+t}},{key:"drawTLX",get:function(){return 0}},{key:"drawTLY",get:function(){return 0}},{key:"drawBLX",get:function(){return 0}},{key:"drawBLY",get:function(){return 0}},{key:"drawTRX",get:function(){return 0}},{key:"drawTRY",get:function(){return 0}},{key:"drawBRX",get:function(){return 0}},{key:"drawBRY",get:function(){return 0}},{key:"drawCenterX",get:function(){return (this.drawTRX+this.drawTLX)/2}},{key:"drawCenterY",get:function(){return (this.drawBLY+this.drawTLY)/2}}]),s}(jc);Object.assign(nd.prototype,Qc);var rd=function(t,e,i){return e.hasOwnProperty(t)?e[t]:i[t]},sd=Phaser.Utils.Objects.GetValue,od=function(t){r(o,t);var i=l(o);function o(t,n){var r;return e(this,o),(r=i.call(this,t,"background")).setScrollFactor(0),r.setColor(sd(n,"color",null),sd(n,"color2",null),sd(n,"horizontalGradient",!0)),r.setStroke(sd(n,"stroke",null),sd(n,"strokeThickness",2)),r.setCornerRadius(sd(n,"cornerRadius",0),sd(n,"cornerIteration",null)),r}return n(o,[{key:"color",get:function(){return this._color},set:function(t){t=Wl(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t;}},{key:"color2",get:function(){return this._color2},set:function(t){t=Wl(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t;}},{key:"horizontalGradient",get:function(){return this._horizontalGradient},set:function(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t;}},{key:"setColor",value:function(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}},{key:"stroke",get:function(){return this._stroke},set:function(t){t=Wl(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t;}},{key:"strokeThickness",get:function(){return this._strokeThickness},set:function(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t;}},{key:"setStroke",value:function(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}},{key:"cornerRadius",get:function(){return this._cornerRadius},set:function(t){this.setDirty(this._cornerRadius!=t),this._cornerRadius=t;}},{key:"cornerIteration",get:function(){return this._cornerIteration},set:function(t){this.setDirty(this._cornerIteration!=t),this._cornerIteration=t;}},{key:"modifyStyle",value:function(t){return t.hasOwnProperty("color")&&this.setColor(t.color,rd("color2",t,this),rd("horizontalGradient",t,this)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,rd("strokeThickness",t,this)),t.hasOwnProperty("cornerRadius")&&this.setCornerRadius(t.cornerRadius,rd("cornerIteration",t,this)),this}},{key:"modifyPorperties",value:function(t){return c(s(o.prototype),"modifyPorperties",this).call(this,t),this.modifyStyle(t),this}},{key:"setCornerRadius",value:function(t,e){return this.cornerRadius=t,this.cornerIteration=e,this}},{key:"renderContent",value:function(){ru(this.parent,this.color,this.stroke,this.strokeThickness,this.cornerRadius,this.color2,this.horizontalGradient,this.cornerIteration);}}]),o}(nd),ad=Phaser.Utils.Objects.GetValue,hd=function(t){r(o,t);var i=l(o);function o(t,n){var r;return e(this,o),(r=i.call(this,t,"innerbounds")).setScrollFactor(0),r.setColor(ad(n,"color",null),ad(n,"color2",null),ad(n,"horizontalGradient",!0)),r.setStroke(ad(n,"stroke",null),ad(n,"strokeThickness",2)),r}return n(o,[{key:"color",get:function(){return this._color},set:function(t){t=Wl(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t;}},{key:"color2",get:function(){return this._color2},set:function(t){t=Wl(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t;}},{key:"horizontalGradient",get:function(){return this._horizontalGradient},set:function(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t;}},{key:"setColor",value:function(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}},{key:"stroke",get:function(){return this._stroke},set:function(t){t=Wl(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t;}},{key:"strokeThickness",get:function(){return this._strokeThickness},set:function(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t;}},{key:"setStroke",value:function(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}},{key:"modifyPorperties",value:function(t){c(s(o.prototype),"modifyPorperties",this).call(this,t),t.hasOwnProperty("color")&&this.setColor(t.color,ad(t,"color2",null),ad(t,"horizontalGradient",!0)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,ad(t,"strokeThickness",2));}},{key:"renderContent",value:function(){var t=this.parent.padding,e=t.left,i=t.top,n=this.parent.width-t.left-t.right,r=this.parent.height-t.top-t.bottom,s=this.context;if(null!=this.color){var o,a;if(null!=this.color2)(a=this.horizontalGradient?s.createLinearGradient(0,0,n,0):s.createLinearGradient(0,0,0,r)).addColorStop(0,this.color),a.addColorStop(1,this.color2),o=a;else o=this.color;s.fillStyle=o,s.fillRect(e,i,n,r);}null!=this.stroke&&this.strokeThickness>0&&(s.strokeStyle=this.stroke,s.lineWidth=this.strokeThickness,s.strokeRect(e,i,n,r));}}]),o}(nd),ld=Phaser.Utils.Objects.GetValue,ud=function(){function t(i,n){e(this,t),this.parent=i,this.set(n);}return n(t,[{key:"toJSON",value:function(){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}}},{key:"set",value:function(t){return this.setBold(ld(t,"bold",!1)),this.setItalic(ld(t,"italic",!1)),this.setFontSize(ld(t,"fontSize","16px")),this.setFontFamily(ld(t,"fontFamily","Courier")),this.setColor(ld(t,"color","#fff")),this.setStrokeStyle(ld(t,"stroke",null),ld(t,"strokeThickness",0)),this.setShadow(ld(t,"shadowColor",null),ld(t,"shadowOffsetX",0),ld(t,"shadowOffsetY",0),ld(t,"shadowBlur",0)),this.setOffset(ld(t,"offsetX",0),ld(t,"offsetY",0)),this.setSpace(ld(t,"leftSpace",0),ld(t,"rightSpace",0)),this.setAlign(ld(t,"align",void 0)),this.setBackgroundColor(ld(t,"backgroundColor",null)),this.setBackgroundHeight(ld(t,"backgroundHeight",void 0)),this.setBackgroundBottomY(ld(t,"backgroundBottomY",void 0)),this}},{key:"modify",value:function(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(rd("stroke",t,this),rd("strokeThickness",t,this)),t.hasOwnProperty("shadowColor")&&this.setShadowColor(t.shadowColor),(t.hasOwnProperty("shadowOffsetX")||t.hasOwnProperty("shadowOffsetY"))&&this.setShadowOffset(rd("shadowOffsetX",t,this),rd("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}},{key:"setUpdateTextFlag",value:function(){return this.parent&&(this.parent.updateTextFlag=!0),this}},{key:"clone",value:function(){return new t(null,this.toJSON())}},{key:"copyFrom",value:function(t){return this.set(t.toJSON()),this}},{key:"copyTo",value:function(t){return t.set(this.toJSON()),this}},{key:"setBold",value:function(t){return void 0===t&&(t=!0),this.bold=t,this.setUpdateTextFlag(),this}},{key:"setItalic",value:function(t){return void 0===t&&(t=!0),this.italic=t,this.setUpdateTextFlag(),this}},{key:"fontStyle",get:function(){return this.bold&&this.italic?"bold italic":this.bold?"bold":this.italic?"italic":""}},{key:"setFontSize",value:function(t){return "number"==typeof t&&(t="".concat(t,"px")),this.fontSize=t,this.setUpdateTextFlag(),this}},{key:"setFontFamily",value:function(t){return this.fontFamily=t,this.setUpdateTextFlag(),this}},{key:"font",get:function(){return "".concat(this.fontStyle," ").concat(this.fontSize," ").concat(this.fontFamily)}},{key:"setColor",value:function(t){return this.color=Wl(t),this}},{key:"hasFill",get:function(){return null!=this.color}},{key:"setStrokeStyle",value:function(t,e){return this.stroke=Wl(t),void 0!==e&&(this.strokeThickness=e),this}},{key:"setStrokeThickness",value:function(t){return this.strokeThickness=t,this}},{key:"hasStroke",get:function(){return null!=this.stroke&&this.strokeThickness>0}},{key:"setShadowColor",value:function(t){return this.shadowColor=Wl(t),this}},{key:"setShadowOffset",value:function(t,e){return void 0===t&&(t=0),void 0===e&&(e=0),this.shadowOffsetX=t,this.shadowOffsetY=e,this}},{key:"setShadowBlur",value:function(t){return void 0===t&&(t=0),this.shaodwBlur=t,this}},{key:"setShadow",value:function(t,e,i,n){return this.setShadowColor(t).setShadowOffset(e,i).setShadowBlur(n),this}},{key:"setBackgroundColor",value:function(t){return this.backgroundColor=Wl(t),this}},{key:"hasBackgroundColor",get:function(){return null!=this.backgroundColor}},{key:"setBackgroundHeight",value:function(t){return this.backgroundHeight=t,this}},{key:"setBackgroundBottomY",value:function(t){return this.backgroundBottomY=t,this}},{key:"setOffsetX",value:function(t){return void 0===t&&(t=0),this.offsetX=t,this}},{key:"setOffsetY",value:function(t){return void 0===t&&(t=0),this.offsetY=t,this}},{key:"setOffset",value:function(t,e){return this.setOffsetX(t).setOffsetY(e),this}},{key:"setLeftSpace",value:function(t){return void 0===t&&(t=0),this.leftSpace=t,this}},{key:"setRightSpace",value:function(t){return void 0===t&&(t=0),this.rightSpace=t,this}},{key:"setSpace",value:function(t,e){return this.setLeftSpace(t).setRightSpace(e),this}},{key:"setAlign",value:function(t){return this.align=t,this}},{key:"syncFont",value:function(t){return t.font=this.font,this}},{key:"syncStyle",value:function(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}},{key:"syncShadow",value:function(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);}},{key:"getTextMetrics",value:function(t,e){return this.syncFont(t).syncStyle(t),t.measureText(e)}}]),t}(),cd=Phaser.Utils.Array.Remove,dd=Phaser.Utils.Array.Remove,fd="text",pd="image",vd="drawer",gd="space",yd="command",md=function(t){return t.type===fd&&"\n"===t.text},kd=function(t){return t.type===fd&&"\f"===t.text},bd=function(t){return t.type===fd},xd=function(t){r(o,t);var i=l(o);function o(t,n,r){var s;return e(this,o),(s=i.call(this,t,fd)).updateTextFlag=!1,s.style=new ud(a(s),r),s.setText(n),s}return n(o,[{key:"autoRound",get:function(){return this.parent.autoRound}},{key:"offsetX",get:function(){return this.style.offsetX},set:function(t){this.style&&(this.style.offsetX=t);}},{key:"offsetY",get:function(){return this.style.offsetY},set:function(t){this.style&&(this.style.offsetY=t);}},{key:"leftSpace",get:function(){return this.style.leftSpace*this.scaleX},set:function(t){this.style&&(this.style.leftSpace=t),f(s(o.prototype),"leftSpace",t,this,!0);}},{key:"rightSpace",get:function(){return this.style.rightSpace*this.scaleX},set:function(t){this.style&&(this.style.rightSpace=t),f(s(o.prototype),"rightSpace",t,this,!0);}},{key:"align",get:function(){return this.style.align},set:function(t){this.style&&(this.style.align=t);}},{key:"modifyStyle",value:function(t){return this.setDirty(!0),this.style.modify(t),this.updateTextFlag&&this.updateTextSize(),this}},{key:"modifyPorperties",value:function(t){return t?(this.modifyStyle(t),c(s(o.prototype),"modifyPorperties",this).call(this,t),this):this}},{key:"setText",value:function(t){return this.setDirty(this.text!=t),this.text=t,this.updateTextSize(),this}},{key:"updateTextSize",value:function(){var t=this.text;if("\n"===t||"\f"===t||""===t)this.clearTextSize();else {var e,i,n=this.style.getTextMetrics(this.context,this.text);this.textWidth=n.width,"actualBoundingBoxAscent"in n?(e=n.actualBoundingBoxAscent,i=n.actualBoundingBoxDescent):(e=0,i=0),this.textHeight=e+i,this.ascent=e,this.descent=i;}return this.updateTextFlag=!1,this}},{key:"clearTextSize",value:function(){return this.textWidth=0,this.textHeight=0,this.ascent=0,this.descent=0,this}},{key:"copyTextSize",value:function(t){return this.textWidth=t.textWidth,this.textHeight=t.textHeight,this.ascent=t.ascent,this.descent=t.descent,this}},{key:"width",get:function(){return this.textWidth*this.scaleX},set:function(t){this.textWidth>0?this.scaleX=t/this.textWidth:this.scaleX=1;}},{key:"height",get:function(){return this.textHeight*this.scaleY},set:function(t){this.textHeight>0?this.scaleY=t/this.textHeight:this.scaleY=1;}},{key:"willRender",get:function(){return 0!==this.textWidth&&c(s(o.prototype),"willRender",this)}},{key:"renderContent",value:function(){var t=this.context,e=this.style;if(e.hasBackgroundColor){t.fillStyle=e.backgroundColor;var i=this.drawTLX,n=this.drawTRX-i,r=e.backgroundBottomY;null==r&&(r=this.drawBLY);var s=e.backgroundHeight;null==s&&(s=r-this.drawTLY);var o=r-s;t.fillRect(i,o,n,s);}var a=e.hasFill,h=e.hasStroke;(a||h)&&(e.syncFont(t).syncStyle(t),h&&(e.syncShadow(t),t.strokeText(this.text,0,0)),a&&(e.syncShadow(t),t.fillText(this.text,0,0)));}},{key:"drawTLX",get:function(){return -this.leftSpace}},{key:"drawTLY",get:function(){return -this.ascent}},{key:"drawBLX",get:function(){return -this.leftSpace}},{key:"drawBLY",get:function(){return this.descent}},{key:"drawTRX",get:function(){return this.textWidth+this.rightSpace}},{key:"drawTRY",get:function(){return -this.ascent}},{key:"drawBRX",get:function(){return this.textWidth+this.rightSpace}},{key:"drawBRY",get:function(){return this.descent}}]),o}(nd),wd=function(t,e){var i=this.createCharChildren(t,e);return this.addChild(i),this},Sd=function(t){r(s,t);var i=l(s);function s(t,n,r){var o;return e(this,s),(o=i.call(this,t,pd)).setTexture(n,r),o}return n(s,[{key:"frameWidth",get:function(){return this.frameObj?this.frameObj.cutWidth:0}},{key:"frameHeight",get:function(){return this.frameObj?this.frameObj.cutHeight:0}},{key:"offsetY",get:function(){return -this.height},set:function(t){}},{key:"key",get:function(){return this._key},set:function(t){this.setDirty(this._key!=t),this._key=t;}},{key:"frame",get:function(){return this._frame},set:function(t){this.setDirty(this._frame!=t),this._frame=t;}},{key:"setTexture",value:function(t,e){return this.key=t,this.frame=e,this.frameObj=this.scene.sys.textures.getFrame(t,e),this}},{key:"width",get:function(){return this.frameWidth*this.scaleX},set:function(t){this.setDirty(this.width!==t),this.scaleX=t/this.frameWidth;}},{key:"height",get:function(){return this.frameHeight*this.scaleY},set:function(t){this.setDirty(this.height!==t),this.scaleY=t/this.frameHeight;}},{key:"setHeight",value:function(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}},{key:"renderContent",value:function(){var t=this.context,e=this.frameObj,i=this.frameWidth,n=this.frameHeight;t.drawImage(e.source.image,e.cutX,e.cutY,i,n,0,0,i,n);}},{key:"drawTLX",get:function(){return -this.leftSpace}},{key:"drawTLY",get:function(){return 0}},{key:"drawBLX",get:function(){return -this.leftSpace}},{key:"drawBLY",get:function(){return this.frameHeight}},{key:"drawTRX",get:function(){return this.frameWidth+this.rightSpace}},{key:"drawTRY",get:function(){return 0}},{key:"drawBRX",get:function(){return this.frameWidth+this.rightSpace}},{key:"drawBRY",get:function(){return this.frameHeight}}]),s}(nd),Cd=function(t){r(o,t);var i=l(o);function o(t,n,r,s){var a;return e(this,o),(a=i.call(this,t,vd)).setRenderCallback(n),a.setDrawerSize(r,s),a}return n(o,[{key:"setRenderCallback",value:function(t){return t?this.renderContent=t.bind(this):delete this.renderContent,this}},{key:"setDrawerSize",value:function(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}},{key:"onFree",value:function(){c(s(o.prototype),"onFree",this).call(this),this.setRenderCallback();}},{key:"width",get:function(){return this.drawerWidth*this.scaleX},set:function(t){this.setDirty(this.width!==t),this.scaleX=this.drawerWidth>0?t/this.drawerWidth:1;}},{key:"height",get:function(){return this.drawerHeight*this.scaleY},set:function(t){this.setDirty(this.height!==t),this.scaleY=this.drawerHeight>0?t/this.drawerHeight:1;}},{key:"offsetY",get:function(){return -this.height},set:function(t){}},{key:"drawTLX",get:function(){return -this.leftSpace}},{key:"drawTLY",get:function(){return 0}},{key:"drawBLX",get:function(){return -this.leftSpace}},{key:"drawBLY",get:function(){return this.drawerHeight}},{key:"drawTRX",get:function(){return this.drawerWidth+this.rightSpace}},{key:"drawTRY",get:function(){return 0}},{key:"drawBRX",get:function(){return this.drawerWidth+this.rightSpace}},{key:"drawBRY",get:function(){return this.drawerHeight}}]),o}(nd),Od=function(t){r(s,t);var i=l(s);function s(t,n){var r;return e(this,s),(r=i.call(this,t,gd)).setSpaceWidth(n),r}return n(s,[{key:"width",get:function(){return this.spaceWidth*this.scaleX},set:function(t){this.spaceWidth>0?this.scaleX=t/this.spaceWidth:this.scaleX=1;}},{key:"setSpaceWidth",value:function(t){return this.spaceWidth=t,this}}]),s}(nd),_d=function(t){r(o,t);var i=l(o);function o(t,n,r,s,a){var h;return e(this,o),(h=i.call(this,t,yd)).setName(n).setParameter(s).setCallback(r,a),h}return n(o,[{key:"setName",value:function(t){return this.name=t,this}},{key:"setParameter",value:function(t){return this.param=t,this}},{key:"setCallback",value:function(t,e){return this.callback=t,this.scope=e,this}},{key:"exec",value:function(){return this.scope?this.callback.call(this.scope,this.param,this.name):this.callback(this.param,this.name)}},{key:"onFree",value:function(){c(s(o.prototype),"onFree",this).call(this),this.setName().setCallback().setParameter();}}]),o}(jc),Td=function(t,e,i,n){void 0===n&&(n={word:[],width:0}),n.word.length=0;for(var r=t.length,s=e,o=n.word,a=0;s0&&!a){var h=this.fixedHeight-n;if(i>0)s=h/i;else s=(l=Md.call(this)).height,o=l.ascent,i=Math.floor((h-o)/s);}else {var l;s=(l=Md.call(this)).height,o=l.ascent;}}else if(this.fixedHeight>0){if(void 0===(i=Ld(t,"maxLines"))){h=this.fixedHeight-n;i=Math.floor(h/s);}}else i=Ld(t,"maxLines",0);void 0===o&&(o=s);var u=0===i,c=Ld(t,"wrapWidth",void 0);void 0===c&&(c=this.fixedWidth>0?this.fixedWidth-r:1/0);for(var d=Ld(t,"letterSpacing",0),f=Ld(t,"hAlign",0),p=Ld(t,"vAlign",0),v=Ld(t,"charWrap",!1),g={callback:"runWordWrap",start:e,isLastPage:!1,padding:this.wrapPadding,ascent:o,lineHeight:s,maxLines:i,wrapWidth:c,letterSpacing:d,hAlign:f,vAlign:p,charWrap:v,children:[],lines:[],maxLineWidth:0,linesHeight:0},y=this.children,m=0,k=y.length;m0&&(P.push({children:E,width:M}),R=Math.max(R,M)),g.start+=T.length,g.isLastPage=!L&&g.start===_,g.maxLineWidth=R,g.linesHeight=P.length*s;var Y=this.fixedWidth>0?this.fixedWidth:g.maxLineWidth+r,X=this.fixedHeight>0?this.fixedHeight:g.linesHeight+n;!function(t,e,i){var n,r,s=t.hAlign,o=t.vAlign,a=t.linesHeight;switch(o){case 1:case"center":r=(i-a)/2;break;case 2:case"bottom":r=i-a;break;default:r=0;}for(var h=t.lines,l=0,u=h.length;l0?(o=this.fixedWidth-r)/i:0;else if(this.fixedWidth>0){if(void 0===(i=Dd(t,"maxLines",void 0))){var o=this.fixedWidth-r;i=Math.floor(o/s)+1;}}else i=Dd(t,"maxLines",0);var a=0===i,h=Dd(t,"fixedChildHeight",void 0);if(void 0===h){var l=Dd(t,"charPerLine",void 0);if(void 0!==l){var u=this.fixedHeight-n;h=Math.floor(u/l);}}var c=Dd(t,"wrapHeight",void 0);void 0===c&&(c=this.fixedHeight>0?this.fixedHeight-n:1/0);for(var d=Dd(t,"letterSpacing",0),f=Dd(t,"rtl",!0),p=Dd(t,"hAlign",f?2:0),v=Dd(t,"vAlign",0),g={callback:"runVerticalWrap",start:e,isLastPage:!1,padding:this.wrapPadding,lineWidth:s,maxLines:i,fixedChildHeight:h,wrapHeight:c,letterSpacing:d,hAlign:p,vAlign:v,rtl:f,children:[],lines:[],maxLineHeight:0,linesWidth:0},y=this.children,m=0,k=y.length;m0&&(P.push({children:E,height:M}),R=Math.max(R,M)),g.start+=T.length,g.isLastPage=g.start===_,g.maxLineHeight=R,g.linesWidth=P.length*s;var j=this.fixedWidth>0?this.fixedWidth:g.linesWidth+r,W=this.fixedHeight>0?this.fixedHeight:g.maxLineHeight+n;!function(t,e,i){var n,r,s=t.hAlign,o=t.vAlign,a=t.rtl,h=t.lines,l=t.lineWidth,u=t.linesWidth;switch(s){case 1:case"center":n=(e-u)/2;break;case 2:case"right":n=e-u;break;default:n=0;}a&&(n+=l);for(var c=0,d=h.length;c0?t:this.width,e>0?e:this.height),this):this},setPadding:function(t,e){var i=this.padding,n=i.left,r=i.right,s=i.top,o=i.bottom;return Ne(i,t,e),this.dirty=this.dirty||n!=i.left||r!=i.right||s!=i.top||o!=i.bottom,this},getPadding:function(t){return He(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),cd(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 dd(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,n,r,s=Array.isArray(t);void 0===e||e===this.children.length?s?(i=this.children).push.apply(i,p(t)):this.children.push(t):s?(n=this.children).splice.apply(n,[e,0].concat(p(t))):this.children.splice(e,0,t);(this.lastAppendedChildren.length=0,s)?(r=this.lastAppendedChildren).push.apply(r,p(t)):this.lastAppendedChildren.push(t);return this},createCharChild:function(t,e){e&&this.textStyle.modify(e);var i=this.poolManager.allocate(fd);return null===i?i=new xd(this,t,this.textStyle):i.setParent(this).setActive().modifyStyle(this.textStyle).setText(t),i},createCharChildren:function(t,e){e&&this.textStyle.modify(e);for(var i=[],n=0,r=t.length;ne&&(n=e,r=t);})),r},getCharWorldPosition:function(t,e,i,n){return "number"==typeof t&&(t=this.getCharChild(t,!0)),$c(this,t,e,i,n)},setToMinSize:function(){for(var t=this.children,e=0,i=0,n=0,r=t.length;n=i.length&&(t=i.length);for(var n=0,r=0;r=t.dragThreshold?"DRAG":"DRAGBEGIN":"IDLE"}},{key:"update_DRAGBEGIN",value:function(t,e){this.next();}},{key:"next_DRAG",value:function(){var t,e=this.parent;return e.dragState.isUp&&(t=e.outOfBounds?"BACK":e.slidingEnable?"SLIDE":"IDLE"),t}},{key:"update_DRAG",value:function(t,e){var i=this.parent;i.dragState.justMoved&&i.dragging(),this.next();}},{key:"enter_DRAG",value:function(){this.parent.onDragStart();}},{key:"exit_DRAG",value:function(){this.parent.onDragEnd();}},{key:"next_SLIDE",value:function(){var t,e=this.parent;return e.dragState.isDown?t="DRAG":e.isSliding||(t="IDLE"),t}},{key:"enter_SLIDE",value:function(){this.parent.onSliding();}},{key:"exit_SLIDE",value:function(){this.parent.stop();}},{key:"update_SLIDE",value:function(t,e){this.parent.sliding(t,e),this.next();}},{key:"next_BACK",value:function(){var t,e=this.parent;return e.dragState.isDown?t="DRAG":e.isPullBack||(t="IDLE"),t}},{key:"enter_BACK",value:function(){this.parent.onPullBack();}},{key:"exit_BACK",value:function(){this.parent.stop();}},{key:"update_BACK",value:function(t,e){this.parent.pullBack(t,e),this.next();}}]),s}(zn),vp=Phaser.Utils.Objects.GetValue,gp=Phaser.Math.Distance.Between,yp=function(t){r(o,t);var i=l(o);function o(t,n){var r;return e(this,o),(r=i.call(this,t,n))._enable=void 0,t.setInteractive(vp(n,"inputConfig",void 0)),r.resetFromJSON(n),r.boot(),r}return n(o,[{key:"resetFromJSON",value:function(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(vp(t,"enable",!0)),this.holdThreshold=vp(t,"holdThreshold",50),this.pointerOutReleaseEnable=vp(t,"pointerOutRelease",!0),this}},{key:"boot",value:function(){this.parent.on("pointerdown",this.onPointIn,this),this.parent.on("pointerup",this.onPointOut,this),this.pointerOutReleaseEnable&&this.parent.on("pointerout",this.onPointOut,this),this.parent.on("pointermove",this.onPointerMove,this),this.scene.sys.events.on("preupdate",this.preupdate,this);}},{key:"shutdown",value:function(t){this.isShutdown||(this.scene.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,c(s(o.prototype),"shutdown",this).call(this,t));}},{key:"enable",get:function(){return this._enable},set:function(t){this._enable!==t&&(t||(this.isInTouched=!1,this.pointer=void 0),this._enable=t);}},{key:"setEnable",value:function(t){return void 0===t&&(t=!0),this.enable=t,this}},{key:"toggleEnable",value:function(){return this.setEnable(!this.enable),this}},{key:"setPointerOutReleaseEnable",value:function(t){return void 0===t&&(t=!0),this.pointerOutReleaseEnable=t,this}},{key:"isDown",get:function(){return this.pointer&&this.pointer.isDown}},{key:"isUp",get:function(){return !this.isDown}},{key:"dx",get:function(){return this.x-this.preX}},{key:"dy",get:function(){return this.y-this.preY}},{key:"dt",get:function(){return us(this.scene)}},{key:"speed",get:function(){return this.x===this.preX&&this.y===this.preY?0:gp(this.preX,this.preY,this.x,this.y)/(.001*this.dt)}},{key:"speedX",get:function(){return this.dx/(.001*this.dt)}},{key:"speedY",get:function(){return this.dy/(.001*this.dt)}},{key:"onPointIn",value:function(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.pointer=t,this.localX=e,this.localY=i);}},{key:"onPointOut",value:function(t){this.enable&&this.pointer===t&&(this.pointer=void 0);}},{key:"onPointerMove",value:function(t,e,i){this.enable&&t.isDown&&this.pointer===t&&(this.localX=e,this.localY=i);}},{key:"preupdate",value:function(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));}}}]),o}(si),mp=Phaser.Utils.Objects.GetValue,kp=function(){function t(i){e(this,t),this.resetFromJSON(i);}return n(t,[{key:"resetFromJSON",value:function(t){return this.setValue(mp(t,"value",0)),this.setSpeed(mp(t,"speed",0)),this.setAcceleration(mp(t,"acceleration",0)),this}},{key:"reset",value:function(){this.setValue(0),this.setSpeed(0),this.setAcceleration(0);}},{key:"setValue",value:function(t){return this.value=t,this}},{key:"setSpeed",value:function(t){return this.speed=t,this}},{key:"setAcceleration",value:function(t){return this.acceleration=t,this}},{key:"updateSpeed",value:function(t){return 0!==this.acceleration&&(this.speed+=this.acceleration*t,this.speed<0&&(this.speed=0)),this}},{key:"getDeltaValue",value:function(t){return this.updateSpeed(t),this.speed<=0?0:this.speed*t}},{key:"update",value:function(t){return this.updateSpeed(t),this.speed>0&&(this.value+=this.getDeltaValue(t)),this}},{key:"isMoving",get:function(){return this.speed>0}}]),t}(),bp=function(){function t(){e(this,t),this.value,this.dir,this.movement=new kp;}return n(t,[{key:"init",value:function(t,e,i,n,r){return this.value=t,this.end=r,this.dir=void 0!==r?tthis.end&&(this.value=this.end):this.valuethis.maxValue}},{key:"overMin",value:function(t){return null!=this.minValue&&t0,Math.abs(e),i);}},{key:"sliding",value:function(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;}},{key:"onPullBack",value:function(){var t=this.value,e=this.outOfMinBound?this.minValue:this.maxValue,i=Math.abs(e-t),n=this.backDeceleration,r=Math.sqrt(2*n*i);this._slowDown.init(t,void 0,r,n,e);}},{key:"pullBack",value:function(t,e){e*=.001,this.value=this._slowDown.update(e).value,this._slowDown.isMoving||this._state.next();}},{key:"stop",value:function(){this._slowDown.stop();}}]),o}(si),Cp={y:0,v:0,vertical:0,x:1,h:1,horizontal:1},Op=Phaser.Utils.Objects.GetValue,_p=function(t){r(s,t);var i=l(s);function s(t,n){var r;(e(this,s),(r=i.call(this,t,n)).parent!==r.scene?r.focusMode=Op(n,"focus",!1):r.focusMode=!1,r.setSpeed(Op(n,"speed",.1)),r.setEnable(Op(n,"enable",!0)),r.focusMode)?(t=r.parent).setInteractive(Op(n,"inputConfig",void 0)).on("wheel",(function(t,e,i,n,r){this.enable&&this.scroll(i);}),a(r)):r.scene.input.on("wheel",r.onSceneScroll,a(r));return r}return n(s,[{key:"destroy",value:function(){this.focusMode||this.scene.input.off("wheel",this.onSceneScroll,this);}},{key:"onSceneScroll",value:function(t,e,i,n,r,s){this.enable&&this.scroll(n);}},{key:"setEnable",value:function(t){return void 0===t&&(t=!0),this.enable=t,this}},{key:"setSpeed",value:function(t){return this.speed=t,this}},{key:"scroll",value:function(t){t*=this.speed,this.emit("scroll",t,this.parent,this);}}]),s}(si),Tp=Phaser.Utils.Objects.GetValue,Pp=function(t,e,i,n){var r,s,o,a,h="Y"===(i=i.toUpperCase()),l=2===t.scrollMode,u=t.childrenMap.child,c="slider".concat(i);if(r=l||n.hasOwnProperty(c)?Tp(n,c,void 0):Tp(n,"slider",void 0)){var d,f,p;!0===r&&(r={}),r.orientation=h?1:0,s=function(t,e){void 0===e&&(e={});var i=Rt(e);(e={slider:i}).orientation=i.orientation,delete i.orientation,e.background=i.background,delete i.background,e.buttons=i.buttons,delete i.buttons;var n=new fp(t,e);t.add.existing(n);var r=n.childrenMap.slider;return n.addChildrenMap("track",r.childrenMap.track),n.addChildrenMap("indicator",r.childrenMap.indicator),n.addChildrenMap("thumb",r.childrenMap.thumb),n}(t.scene,r);var v=Tp(r,"position",0);"string"==typeof v&&(v=Ep[v]);var g=Tp(n,"space.slider".concat(i),void 0);void 0===g&&void 0===(g=Tp(n,"space.slider",void 0))&&(g=l?0:Tp(n,"space.child",0));var y="number"==typeof g;h?0===v?(d=2,f=1,p=y?{left:g}:g):(d=0,f=1,p=y?{right:g}:g):0===v?(d=1,f=2,p=y?{top:g}:g):(d=1,f=0,p=y?{bottom:g}:g),e.add(s,{column:d,row:f,align:"center",padding:p,expand:!0}),t["hideUnscrollableSlider".concat(i)]=Tp(r,"hideUnscrollableSlider",!1),t["adaptThumb".concat(i,"SizeMode")]=Tp(r,"adaptThumbSize",!1),t["minThumb".concat(i,"Size")]=Tp(r,"minThumbSize",void 0);}else t["hideUnscrollableSlider".concat(i)]=!1,t["adaptThumb".concat(i,"SizeMode")]=!1,t["minThumb".concat(i,"Size")]=void 0;var m="scroller".concat(i);(o=l||n.hasOwnProperty(m)?Tp(n,m,!0):Tp(n,"scroller",!0))&&u&&(!0===o&&(o={}),o.orientation=h?0:1,a=new Sp(u,o));var k,b,x,w,S=Tp(n,l?"mouseWheelScroller".concat(i):"mouseWheelScroller",!1);(S&&u&&(k=new _p(u,S)),t.addChildrenMap("slider".concat(i),s),t.addChildrenMap("scroller".concat(i),a),t.addChildrenMap("mouseWheelScroller".concat(i),k),l&&!h||(t.hideUnscrollableSlider=t["hideUnscrollableSlider".concat(i)],t.adaptThumbSizeMode=t["adaptThumb".concat(i,"SizeMode")],t.minThumbSize=t["minThumb".concat(i,"Size")],t.addChildrenMap("slider",s),t.addChildrenMap("scroller",a),t.addChildrenMap("mouseWheelScroller",k)),s)&&(l?(b=h?"t":"s",w="scroll".concat(i)):(b="t",w="scroll"),s.on("valuechange",(function(e){t[b]=e,t.emit(w,t);})));a&&(l?(x="childO".concat(i),w="scroll".concat(i)):(x="childOY",w="scroll"),a.on("valuechange",(function(e){t[x]=e,t.emit(w,t);})));if(k){var C="addChildO".concat(i);k.on("scroll",(function(e){t[C](-e,!0);}));}},Ep={right:0,left:1,bottom:0,top:1},Mp=Phaser.Utils.Objects.GetValue,Rp=function(t,e){var i=t.scene,n=[0,1,0],r=[0,1,0],s=Mp(e,"width"),o=Mp(e,"height");s||(n[1]=0),o||(r[1]=0);var a=new qa(i,{column:3,row:3,columnProportions:n,rowProportions:r});switch(function(t,e,i){var n=Rf(i,"child"),r=Rf(n,"gameObject",void 0);if(r){var s=Rf(i,"space.child",0);t.childMargin={};var o=t.childMargin,a={};if("number"==typeof s)switch(t.scrollMode){case 0:case 1:o.top=0,o.bottom=0,o.left=0,o.right=0;break;default:o.top=s,o.bottom=s,o.left=s,o.right=s;}else switch(t.scrollMode){case 0:o.top=Rf(s,"top",0),o.bottom=Rf(s,"bottom",0),a.left=Rf(s,"left",0),a.right=Rf(s,"right",0);break;case 1:o.top=Rf(s,"left",0),o.bottom=Rf(s,"right",0),a.top=Rf(s,"top",0),a.bottom=Rf(s,"bottom",0);break;default:o.top=Rf(s,"top",0),o.bottom=Rf(s,"bottom",0),o.left=Rf(s,"left",0),o.right=Rf(s,"right",0);}e.add(r,{column:1,row:1,align:Rf(n,"align","center"),padding:a,expand:{width:Rf(n,"expandWidth",!0),height:Rf(n,"expandHeight",!0)}});}t.addChildrenMap("child",r);}(t,a,e),t.scrollMode){case 0:Pp(t,a,"y",e);break;case 1:Pp(t,a,"x",e);break;default:Pp(t,a,"y",e),Pp(t,a,"x",e);}return a},Lp=function(t){var e,i,n,r;switch(this.scrollMode){case 0:case 1:e=this.topChildOY,i=this.bottomChildOY,n=this.childrenMap.scroller,r=this.childrenMap.slider;break;default:"Y"===(t=t.toUpperCase())?(e=this.topChildOY,i=this.bottomChildOY):(e=this.leftChildOX,i=this.rightChildOX),n=this.childrenMap["scroller".concat(t)],r=this.childrenMap["slider".concat(t)];}n&&n.setBounds(e,i),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".concat(t)],i=this["hideUnscrollableSlider".concat(t)],n=this["isOverflow".concat(t)];e&&i&&this.setChildVisible(e,n);}},Ap=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,n=a.childrenMap.thumb,r=this.minThumbSize;if(0===this.scrollMode){var s=i.displayHeight*e;void 0!==r&&s0?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(Ip.call(this,-this.textOY)),0),e=Fp.call(this,t)+this.textOY,i=Hp.call(this,t);return function(t,e){switch(Xp(t)){case 0:var i=(r=t.style).wordWrapWidth,n=r.wordWrapCallback;r.wordWrapWidth=0,r.wordWrapCallback=void 0,t.setText(e),r.wordWrapWidth=i,r.wordWrapCallback=n;break;case 1:var r,s=(r=t.style).wrapMode;r.wrapMode=0,t.setText(e),r.wrapMode=s;break;case 2:var o=t._maxWidth;t._maxWidth=0,t.setText(e),t._maxWidth=o;}}(this.textObject,i),this.textObject.rexSizer.offsetY=e,Np.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,Ke.call(this),this},layoutChildren:function(){var t,e,i,n,r,s,o,a=this.left,h=this.top;(t=this.textObject).rexSizer.hidden||(n=a+(i=(e=t.rexSizer).padding).left,r=h+i.top,s=this.width-i.left-i.right,o=this.height-i.top-i.bottom,Vp.call(this,t,s,o),Se(t,n,r,s,o,e.align),e.preOffsetY=0,Np.call(this),this.textMask&&(this.textMask.setPosition().resize(),this.resetChildPositionState(this.textMask)));}},Jp=Phaser.Utils.Objects.IsPlainObject,Kp=Phaser.Utils.Objects.GetValue,qp=Phaser.Display.Align.TOP_LEFT,Zp=function(t){r(o,t);var i=l(o);function o(t,n,r,s,h,l){var u;e(this,o),Jp(n)?(n=Kp(l=n,"x",0),r=Kp(l,"y",0),s=Kp(l,"width",void 0),h=Kp(l,"height",void 0)):Jp(s)&&(s=Kp(l=s,"width",void 0),h=Kp(l,"height",void 0)),(u=i.call(this,t,n,r,s,h,l)).type="rexTextBlock",u.textObject=void 0,u.linesCount=0,u.textMask=void 0,u.textObjectType=void 0,u._textLineHeight=void 0,u._textLineSpacing=void 0,u._visibleLinesCount=void 0,u._textHeight=void 0,u._textVisibleHeight=void 0,u._textObjectRealHeight=0,u.lines=void 0,u.text=Kp(l,"content",""),u._textOY=0,u.execeedTopState=!1,u.execeedBottomState=!1,u.setClampMode(Kp(l,"clamplTextOY",!0)),u.alwaysScrollable=Kp(l,"alwaysScrollable",!1);var c=Kp(l,"background",void 0),d=Kp(l,"text",void 0);void 0===d&&(d=$p(t)),u.textCropEnable=Kp(l,"textCrop",!!d.setCrop);var f=Kp(l,"textMask",!u.textCropEnable);c&&u.addBackground(c),u.add(d),u.sizerChildren=[d];var p=u.getSizerConfig(d);return p.align=qp,p.padding=Ee(0),p.expand=!0,u.textObject=d,u.textObjectType=Xp(d),p.preOffsetY=0,p.offsetY=0,f&&(u.textMask=xh.call(a(u),u.textObject,a(u))),u.addChildrenMap("background",c),u.addChildrenMap("text",d),u}return n(o,[{key:"destroy",value:function(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;}c(s(o.prototype),"destroy",this).call(this,t);}}},{key:"setClampMode",value:function(t){return void 0===t&&(t=!0),this.clampTextOY=t,this}},{key:"textLineHeight",get:function(){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}},{key:"textLineSpacing",get:function(){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}},{key:"visibleLinesCount",get:function(){return void 0===this._visibleLinesCount&&(this._visibleLinesCount=Math.floor(Ip.call(this,this._textObjectRealHeight))),this._visibleLinesCount}},{key:"topTextOY",get:function(){return 0}},{key:"bottomTextOY",get:function(){return -this.textVisibleHeight}},{key:"textHeight",get:function(){return void 0===this._textHeight&&(this._textHeight=Fp.call(this,this.linesCount)),this._textHeight}},{key:"textObjectHeight",get:function(){return this._textObjectRealHeight-(this.textLineHeight+this.textLineSpacing)}},{key:"textVisibleHeight",get:function(){if(void 0===this._textVisibleHeight){var t=this.textHeight-this.textObjectHeight;!this.alwaysScrollable&&t<0&&(t=0),this._textVisibleHeight=t;}return this._textVisibleHeight}},{key:"textOYExceedTop",value:function(t){return void 0===t&&(t=this.textOY),t>this.topTextOY}},{key:"textOYExeceedBottom",value:function(t){return void 0===t&&(t=this.textOY),tthis.linesCount?t=0:n?t=e:r&&(t=i)),this._textOY!==t&&(this._textOY=t,this.updateTextObject()),n&&(this.execeedTopState||this.emit("execeedtop",this,t,e)),this.execeedTopState=n,r&&(this.execeedBottomState||this.emit("execeedbottom",this,t,i)),this.execeedBottomState=r;}},{key:"setTextOY",value:function(t){return this.textOY=t,this}},{key:"t",get:function(){var t=this.textVisibleHeight;return 0===t?0:this.textOY/-t},set:function(t){this.textOY=-this.textVisibleHeight*t;}},{key:"setTextOYByPercentage",value:function(t){return this.t=t,this}}]),o}(eo),$p=function(t){return t.add.text(0,0,"")};Object.assign(Zp.prototype,Up);Phaser.Math.Clamp;var Qp={scrollToLine:function(t){return this.setChildOY(-this.lineHeight*t),this},scrollToNextLine:function(t){void 0===t&&(t=1);var e=this.lineIndex+t;return this.scrollToLine(e),this}},tv=Phaser.Utils.Objects.GetValue,ev=function(t){r(s,t);var i=l(s);function s(t,n){var r;e(this,s),void 0===n&&(n={}),n.scrollMode=0;var o=tv(n,"text",void 0),a=tv(n,"textWidth",void 0),h=tv(n,"textHeight",void 0),l=tv(n,"textCrop",!!o.setCrop),u=tv(n,"textMask",!l),c=tv(n,"content",""),d=new Zp(t,{width:a,height:h,text:o,textMask:u,textCrop:l&&!u,content:c,clamplTextOY:tv(n,"clamplChildOY",!1),alwaysScrollable:tv(n,"alwaysScrollable",!1)});t.add.existing(d),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}});}(d),n.scrollMode=0,n.type="rexTextArea",n.child={gameObject:d,expandWidth:void 0===a,expandHeight:void 0===h};var f=tv(n,"space",void 0);return f&&(f.child=tv(f,"text",0)),(r=i.call(this,t,n)).addChildrenMap("text",o),r}return n(s,[{key:"text",get:function(){return this.childrenMap.child.text}},{key:"lineHeight",get:function(){var t=this.childrenMap.child;return t.textLineHeight+t.textLineSpacing}},{key:"lineIndex",get:function(){return Math.floor(-this.childOY/this.lineHeight)}},{key:"linesCount",get:function(){return this.childrenMap.child.linesCount}},{key:"contentHeight",get:function(){return this.childrenMap.child.textHeight}}]),s}(Wp);Object.assign(ev.prototype,{setText:function(t){return this.childrenMap.child.setText(t),this.resizeController(),this},appendText:function(t){return this.setText(this.text+t),this}},Qp);var iv=Phaser.Utils.Objects.GetValue,nv=function(t,e,i){e=e?Ch(e):{};var n=iv(i,"background",Pl),r=iv(i,"text",Tc),s=iv(i,"track",Pl),o=iv(i,"thumb",Pl);n?e.background=n(t,e.background):delete e.background,r?e.text=r(t,e.text):delete e.text;var a=e.slider;!1!==a&&(void 0===a&&(a={}),s?a.track=s(t,a.track):delete a.track,o?a.thumb=o(t,a.thumb):delete a.thumb,e.slider=a);var h=new ev(t,e);return t.add.existing(h),h},rv=Phaser.Utils.Objects.GetValue,sv=function(t,e){if(t&&"number"!=typeof t){if(t.hasOwnProperty(e))return !0;if(-1!==e.indexOf(".")){for(var i=e.split("."),n=t,r=0;rh;u--){for(c=0;c0&&this.wrapMode!==Gl&&0===this.wrapWidth}},{key:"setStyle",value:function(t,e,i){if(void 0===e&&(e=!0),void 0===i&&(i=!1),t&&t.hasOwnProperty("wrap")){var n=t.wrap;if(n.hasOwnProperty("mode")){var r=n.mode;"string"==typeof r&&(n.mode=$l[r]);}else n.hasOwnProperty("width")&&(n.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 s=this.propertyMap;for(var o in s){var a=s[o],h=a[0],l=i?a[1]:this[o],u=a[2];if("wrapCallback"===o||"wrapCallbackScope"===o)this[o]=ql(t,h,l);else {var c=Kl(t,h,l);u&&(c=u(c)),this[o]=c;}}var d=ql(t,"font",null);this._font=null===d?this.fontStyle+" "+this.fontSize+" "+this.fontFamily:d;var f=ql(t,"fill",null);null!==f&&(this.color=Wl(f));var p=ql(t,"metrics",!1);return p?this.metrics={ascent:ql(p,"ascent",0),descent:ql(p,"descent",0),fontSize:ql(p,"fontSize",0)}:!e&&this.metrics||(this.metrics=Il(this)),e?this.parent.updateText():this.parent}},{key:"syncFont",value:function(t,e){e.font=this._font;}},{key:"syncStyle",value:function(t,e){e.textBaseline="alphabetic",e.fillStyle=this.color,e.strokeStyle=this.stroke,e.lineWidth=this.strokeThickness,e.lineCap="round",e.lineJoin="round";}},{key:"syncShadow",value:function(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);}},{key:"update",value:function(t){return t&&(this._font="".concat(this.fontStyle," ").concat(this.fontSize," ").concat(this.fontFamily).trim(),this.metrics=Il(this)),this.parent.updateText(t)}},{key:"buildFont",value:function(){var t="".concat(this.fontStyle," ").concat(this.fontSize," ").concat(this.fontFamily).trim();return t!==this._font&&(this._font=t),this}},{key:"setFont",value:function(t){return "string"==typeof t?(this.fontFamily=t,this.fontSize="",this.fontStyle=""):(this.fontFamily=ql(t,"fontFamily","Courier"),this.fontSize=ql(t,"fontSize","16px"),this.fontStyle=ql(t,"fontStyle","")),this.update(!0)}},{key:"setFontFamily",value:function(t){return this.fontFamily=t,this.update(!0)}},{key:"setFontStyle",value:function(t){return this.fontStyle=t,this.update(!0)}},{key:"setFontSize",value:function(t){return "number"==typeof t&&(t=t.toString()+"px"),this.fontSize=t,this.update(!0)}},{key:"setTestString",value:function(t){return this.testString=t,this.update(!0)}},{key:"setFixedSize",value:function(t,e){return this.fixedWidth=t,this.fixedHeight=e,t&&(this.parent.width=t),e&&(this.parent.height=e),this.update(this.isWrapFitMode)}},{key:"setResolution",value:function(t){return this.resolution=t,this.update(!1)}},{key:"setLineSpacing",value:function(t){return this.lineSpacing=t,this.update(!1)}},{key:"setXOffset",value:function(t){return this.xOffset=t,this.update(!1)}},{key:"setBackgroundColor",value:function(t,e,i){return void 0===i&&(i=!0),this.backgroundColor=Wl(t,this.parent.canvas,this.parent.context),this.backgroundColor2=Wl(e,this.parent.canvas,this.parent.context),this.backgroundHorizontalGradient=i,this.update(!1)}},{key:"setBackgroundStrokeColor",value:function(t,e){return this.backgroundStrokeColor=Wl(t,this.parent.canvas,this.parent.context),this.backgroundStrokeLineWidth=e,this.update(!1)}},{key:"setBackgroundCornerRadius",value:function(t,e){return this.backgroundCornerRadius=t,this.backgroundCornerIteration=e,this.update(!1)}},{key:"setFill",value:function(t){return this.color=Wl(t,this.parent.canvas,this.parent.context),this.update(!1)}},{key:"setColor",value:function(t){return this.color=Wl(t,this.parent.canvas,this.parent.context),this.update(!1)}},{key:"setStroke",value:function(t,e){return void 0===t?this.strokeThickness=0:(void 0===e&&(e=this.strokeThickness),this.stroke=Wl(t,this.parent.canvas,this.parent.context),this.strokeThickness=e),this.update(!0)}},{key:"setShadow",value:function(t,e,i,n,r,s){return void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i="#000"),void 0===n&&(n=0),void 0===r&&(r=!1),void 0===s&&(s=!0),this.shadowOffsetX=t,this.shadowOffsetY=e,this.shadowColor=Wl(i,this.parent.canvas,this.parent.context),this.shadowBlur=n,this.shadowStroke=r,this.shadowFill=s,this.update(!1)}},{key:"setShadowOffset",value:function(t,e){return void 0===t&&(t=0),void 0===e&&(e=t),this.shadowOffsetX=t,this.shadowOffsetY=e,this.update(!1)}},{key:"setShadowColor",value:function(t){return void 0===t&&(t="#000"),this.shadowColor=Wl(t,this.parent.canvas,this.parent.context),this.update(!1)}},{key:"setShadowBlur",value:function(t){return void 0===t&&(t=0),this.shadowBlur=t,this.update(!1)}},{key:"setShadowStroke",value:function(t){return this.shadowStroke=t,this.update(!1)}},{key:"setShadowFill",value:function(t){return this.shadowFill=t,this.update(!1)}},{key:"setUnderline",value:function(t,e,i){return void 0===t&&(t="#000"),void 0===e&&(e=0),void 0===i&&(i=0),this.underlineColor=Wl(t,this.parent.canvas,this.parent.context),this.underlineThickness=e,this.underlineOffset=i,this.update(!1)}},{key:"setUnderlineColor",value:function(t){return void 0===t&&(t="#000"),this.underlineColor=Wl(t,this.parent.canvas,this.parent.context),this.update(!1)}},{key:"setUnderlineThickness",value:function(t){return void 0===t&&(t=0),this.underlineThickness=t,this.update(!1)}},{key:"setUnderlineOffset",value:function(t){return void 0===t&&(t=0),this.underlineOffset=t,this.update(!1)}},{key:"setStrikethrough",value:function(t,e,i){return void 0===t&&(t="#000"),void 0===e&&(e=0),void 0===i&&(i=0),this.strikethroughColor=Wl(t,this.parent.canvas,this.parent.context),this.strikethroughThickness=e,this.strikethroughOffset=i,this.update(!1)}},{key:"setStrikethroughColor",value:function(t){return void 0===t&&(t="#000"),this.strikethroughColor=Wl(t,this.parent.canvas,this.parent.context),this.update(!1)}},{key:"setStrikethroughThickness",value:function(t){return void 0===t&&(t=0),this.strikethroughThickness=t,this.update(!1)}},{key:"setStrikethroughOffset",value:function(t){return void 0===t&&(t=0),this.strikethroughOffset=t,this.update(!1)}},{key:"setWrapMode",value:function(t){return "string"==typeof t&&(t=$l[t.toLowerCase()]||0),this.wrapMode=t,this.update(!0)}},{key:"setWrapWidth",value:function(t){return this.wrapWidth=t,this.update(!1)}},{key:"setAlign",value:function(t,e){return void 0===t&&(t="left"),void 0===e&&(e="top"),this.halign=t,this.valign=e,this.update(!1)}},{key:"setHAlign",value:function(t){return void 0===t&&(t="left"),this.halign=t,this.update(!1)}},{key:"setVAlign",value:function(t){return void 0===t&&(t="top"),this.valign=t,this.update(!1)}},{key:"setMaxLines",value:function(t){return void 0===t&&(t=0),this.maxLines=t,this.update(!1)}},{key:"getTextMetrics",value:function(){var t=this.metrics;return {ascent:t.ascent,descent:t.descent,fontSize:t.fontSize}}},{key:"setTextMetrics",value:function(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=ql(e,"fontFamily",this.fontFamily),this.fontSize=ql(e,"fontSize",this.fontSize),this.fontStyle=ql(e,"fontStyle",this.fontStyle))),this.parent.updateText(!0)}},{key:"lineHeight",get:function(){return this.metrics.fontSize+this.strokeThickness+this.lineSpacing}},{key:"toJSON",value:function(){var t={},e=this.propertyMap;for(var i in e)t[i]=this[i];return t.metrics=this.getTextMetrics(),t}},{key:"destroy",value:function(){this.parent=void 0;}}]),t}(),$l={none:Gl,word:Vl,char:Ul,character:Ul},Ql=Phaser.Math.DegToRad,tu=function(t){return !t.hasOwnProperty("convex")||t.convex},eu=function(t){return t.x>0&&t.y>0},iu=function(t,e,i,n,r,s,o,a,h){if(a&&o>s?o-=360:!a&&o=f?1:n/f,g=r>=p?1:r/p,y=d.cornerRadius;t.save(),t.beginPath(),t.translate(e,i),a=y.tl,eu(a)?(h=a.x*v,l=a.y*g,tu(a)?iu(t,h,l,h,l,180,270,!1,o):iu(t,0,0,h,l,90,0,!0,o),u=0,c=l):(t.lineTo(0,0),u=0,c=0),a=y.tr,eu(a)?(h=a.x*v,l=a.y*g,tu(a)?iu(t,n-h,l,h,l,270,360,!1,o):iu(t,n,0,h,l,180,90,!0,o)):t.lineTo(n,0),a=y.br,eu(a)?(h=a.x*v,l=a.y*g,tu(a)?iu(t,n-h,r-l,h,l,0,90,!1,o):iu(t,n,r,h,l,270,180,!0,o)):t.lineTo(n,r),a=y.bl,eu(a)?(h=a.x*v,l=a.y*g,tu(a)?iu(t,h,r-l,h,l,90,180,!1,o):iu(t,0,r,h,l,360,270,!0,o)):t.lineTo(0,r),t.lineTo(u,c),t.closePath(),t.restore();}(e,i,n,r,s,o,d),null!=a){var f;if(null!=u)(f=c?e.createLinearGradient(0,0,r,0):e.createLinearGradient(0,0,0,s)).addColorStop(0,a),f.addColorStop(1,u),a=f;e.fillStyle=a,e.fill();}null!=h&&l>0&&(e.strokeStyle=h,e.lineWidth=l,e.stroke());},ru=function(t,e,i,n,r,s,o,a){if(null!=e||null!=i){var h=t.canvas.width,l=t.canvas.height;null==i&&(n=0);var u=n/2;h=Math.max(1,h-n),l=Math.max(1,l-n),nu(t.canvas,t.context,u,u,h,l,r,e,i,n,s,o,a);}},su={draw:function(t,e,i,n){var r=this.penManager;this.hitAreaManager.clear();var s=this.context;s.save();var o=this.defaultStyle;this.clear(),ru(this,o.backgroundColor,o.backgroundStrokeColor,o.backgroundStrokeLineWidth,o.backgroundCornerRadius,o.backgroundColor2,o.backgroundHorizontalGradient,o.backgroundCornerIteration),t+=this.startXOffset,e+=this.startYOffset;var a,h,l,u,c,d,f=o.halign,p=o.valign,v=o.lineHeight,g=r.lines,y=g.length,m=o.maxLines;m>0&&y>m?(h=m,l="center"===p?Math.floor((y-h)/2):"bottom"===p?y-h:0):(h=y,l=0),u=l+h;var k=this.rtl,b=k?this.parent.width:void 0;d="center"===p?Math.max((n-h*v)/2,0):"bottom"===p?Math.max(n-h*v-2,0):0,d+=e;for(var x=l;x0&&t.width>0){var a=i+o.underlineOffset-o.underlineThickness/2;this.drawLine(e,a,t.width,o.underlineThickness,o.underlineColor);}if(t.isTextPen&&this.drawText(e,i,t.text,o),t.isImagePen&&this.drawImage(e,i,t.prop.img,o),o.strikethroughThickness>0&&t.width>0){a=i+o.strikethroughOffset-o.strikethroughThickness/2;this.drawLine(e,a,t.width,o.strikethroughThickness,o.strikethroughColor);}if(s.restore(),t.hasAreaMarker&&t.width>0){var h,l=t.prop.area;if(l)h={key:l};else {var u=t.prop.url;h={key:"url:".concat(u),url:u};}this.hitAreaManager.add(e,i-this.startYOffset,t.width,this.defaultStyle.lineHeight,h);}},clear:function(){var t=this.canvas;this.context.clearRect(0,0,t.width,t.height);},drawLine:function(t,e,i,n,r){this.autoRound&&(t=Math.round(t),e=Math.round(e));var s=this.context,o=s.lineCap;s.lineCap="butt",s.strokeStyle=r,s.lineWidth=n,s.beginPath(),s.moveTo(t,e),s.lineTo(t+i,e),s.stroke(),s.lineCap=o;},drawText:function(t,e,i,n){this.autoRound&&(t=Math.round(t),e=Math.round(e));var r=this.context;n.stroke&&"none"!==n.stroke&&n.strokeThickness>0&&(n.syncShadow(r,n.shadowStroke),r.strokeText(i,t,e)),n.color&&"none"!==n.color&&(n.syncShadow(r,n.shadowFill),r.fillText(i,t,e));},drawImage:function(t,e,i,n){e-=this.startYOffset,this.parent.imageManager.draw(i,this.context,t,e,this.autoRound);}},ou=Phaser.Utils.Objects.GetValue,au=Fl,hu=Hl,lu=function(){function t(i){e(this,t),this.prop={},this.resetFromJSON(i);}return n(t,[{key:"resetFromJSON",value:function(t){this.text=ou(t,"text",""),this.x=ou(t,"x",0),this.y=ou(t,"y",0),this.width=ou(t,"width",0);var e=ou(t,"prop",null);null===e&&(e={}),this.prop=e,this.newLineMode=ou(t,"newLineMode",0),this.startIndex=ou(t,"startIndex",0);}},{key:"plainText",get:function(){var t=this.text;return this.newLineMode===hu&&(t+="\n"),t}},{key:"wrapText",get:function(){var t=this.text;return this.newLineMode!==au&&(t+="\n"),t}},{key:"rawTextLength",get:function(){var t=this.text.length;return this.newLineMode===hu&&(t+=1),t}},{key:"endIndex",get:function(){return this.startIndex+this.rawTextLength}},{key:"lastX",get:function(){return this.x+this.width}},{key:"isTextPen",get:function(){return ""!==this.text}},{key:"isImagePen",get:function(){return !!this.prop.img}},{key:"hasAreaMarker",get:function(){return !!this.prop.area||!!this.prop.url}}]),t}(),uu=Phaser.Utils.Objects.GetFastValue,cu=Fl,du=Nl,fu=function(){function t(i){e(this,t),this.pens=[],this.lines=[],this.maxLinesWidth=void 0,this.pensPool=i.pensPool,this.linesPool=i.linesPool,this.tagToText=uu(i,"tagToText",Qt),this.tagToTextScope=uu(i,"tagToTextScope",void 0);}return n(t,[{key:"destroy",value:function(){this.clear(),this.tagToText=void 0,this.tagToTextScope=void 0;}},{key:"clear",value:function(){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}},{key:"getLineEndIndex",value:function(t){t>=this.lines.length&&(t=this.lines.length-1);var e,i,n=!1;for(e=t;e>=0&&!(n=null!=(i=this.lines[e])&&i.length>0);e--);return n?i[i.length-1].endIndex:0}},{key:"getLineWidth",value:function(t){var e=this.lines[t];if(!e)return 0;var i=e[e.length-1];return null==i?0:i.lastX}},{key:"getMaxLineWidth",value:function(){if(void 0!==this.maxLinesWidth)return this.maxLinesWidth;for(var t,e=0,i=0,n=this.lines.length;ie&&(e=t);return this.maxLinesWidth=e,e}},{key:"getLineWidths",value:function(){for(var t=[],e=0,i=this.lines.length;e=t&&h<=e||(o=o.substring(t-a,e-a)),this.tagToTextScope?c+=this.tagToText.call(this.tagToTextScope,o,l,u):c+=this.tagToText(o,l,u),u=l,!(h>=e)));d++);return c}},{key:"length",get:function(){return this.lines.length},set:function(t){this.clear();}}]),t}(),pu={},vu=function(){function t(){e(this,t),this.items=[];}return n(t,[{key:"destroy",value:function(){this.clear(),this.items=void 0;}},{key:"pop",value:function(){return this.items.length>0?this.items.pop():null}},{key:"push",value:function(t){return this.items.push(t),this}},{key:"pushMultiple",value:function(t){return this.items.push.apply(this.items,t),t.length=0,this}},{key:"clear",value:function(){return this.items.length=0,this}}]),t}(),gu=Phaser.Geom.Rectangle,yu=new vu,mu=function(){function t(){e(this,t),this.hitAreas=[];}return n(t,[{key:"destroy",value:function(){this.clear();}},{key:"clear",value:function(){for(var t=0,e=this.hitAreas.length;tr){""!==C?a.push(o.getLine(C,O,Ou)):0===P&&s>0&&a.push(o.getLine("",0,Ou)),a.push.apply(a,p(t(b,i,Tu,r,0,o)));var E=a.pop();C=E.text,O=E.width,o.freeLine(E)," "===C&&(C="",O=0);}else (S=O+x)>l?(a.push(o.getLine(C,O,Ou)),C=b,O=x,l=r):(C+=b,O=S),w&&a.push(o.getLine(C,O,u));}return a},Ru=Phaser.Utils.Objects.GetValue,Lu=Gl,zu=Fl,Au=function(){function t(i){e(this,t),this.parent=i.parent,this.scene=this.parent.scene,this.context=Ru(i,"context",null),this.canvas=this.context.canvas,this.parser=Ru(i,"parser",null),this.defaultStyle=Ru(i,"style",null),this.autoRound=!0,this.pensPool=i.pensPool,this.linesPool=i.linesPool,this.wrapTextLinesPool=i.wrapTextLinesPool,this.penManager=this.newPenManager(),this._tmpPenManager=null,this.hitAreaManager=new mu,this.lastHitAreaKey=null,this.urlTagCursorStyle=null;var n=this.context;this.getTextWidth=function(t){return n.measureText(t).width};}return n(t,[{key:"destroy",value:function(){this.parent=void 0,this.scene=void 0,this.context=void 0,this.canvas=void 0,this.parser=void 0,this.defaultStyle=void 0,this.penManager&&(this.penManager.destroy(),this.penManager=void 0),this._tmpPenManager&&(this._tmpPenManager.destroy(),this._tmpPenManager=void 0),this.hitAreaManager&&(this.hitAreaManager.destroy(),this.hitAreaManager=void 0),this.pensPool=void 0,this.linesPool=void 0,this.wrapTextLinesPool=void 0;}},{key:"updatePenManager",value:function(t,e,i,n,r){if(void 0===r&&(r=this.penManager),r.clear(),""===t)return r;var s=this.parent.style;if(s.isWrapFitMode){var o=this.parent.padding;i=s.fixedWidth-o.left-o.right;}for(var a,h,l,u,c,d=this.canvas,f=this.context,p=function(t){return f.measureText(t).width},v=0,g=0,y=s.wrapCallback,m=s.wrapCallbackScope,k=!0,b=this.parser.splitText(t),x=this.wrapTextLinesPool,w=0,S=b.length;w0&&e!==Lu&&i0&&t>e&&(t=e),t}},{key:"linesWidth",get:function(){return Math.ceil(this.penManager.getMaxLineWidth())}},{key:"linesHeight",get:function(){var t=this.desplayLinesCount,e=this.defaultStyle.lineHeight*t;return t>0&&(e-=this.defaultStyle.lineSpacing),e}},{key:"imageManager",get:function(){return this.parent.imageManager}},{key:"rtl",get:function(){return this.parent.style.rtl}},{key:"newPenManager",value:function(){return new fu({pensPool:this.pensPool,linesPool:this.linesPool,tagToText:this.parser.propToTagText,tagToTextScope:this.parser})}},{key:"tmpPenManager",get:function(){return null===this._tmpPenManager&&(this._tmpPenManager=this.newPenManager()),this._tmpPenManager}},{key:"getPlainText",value:function(t,e,i){var n;if(null==t)n=this.penManager.plainText;else {var r=this.parser.splitText(t,1);n="";for(var s=0,o=r.length;s0}},{key:"drawX",get:function(){var t=this.x+this.leftSpace+this.offsetX-this.originX*this.width;return this.parent._textOX*this.scrollFactorX+t}},{key:"drawY",get:function(){var t=this.y+this.offsetY;return this.parent._textOY*this.scrollFactorY+t}},{key:"drawTLX",get:function(){return 0}},{key:"drawTLY",get:function(){return 0}},{key:"drawBLX",get:function(){return 0}},{key:"drawBLY",get:function(){return 0}},{key:"drawTRX",get:function(){return 0}},{key:"drawTRY",get:function(){return 0}},{key:"drawBRX",get:function(){return 0}},{key:"drawBRY",get:function(){return 0}},{key:"drawCenterX",get:function(){return (this.drawTRX+this.drawTLX)/2}},{key:"drawCenterY",get:function(){return (this.drawBLY+this.drawTLY)/2}}]),s}(jc);Object.assign(nd.prototype,Qc);var rd=function(t,e,i){return e.hasOwnProperty(t)?e[t]:i[t]},sd=Phaser.Utils.Objects.GetValue,od=function(t){r(o,t);var i=l(o);function o(t,n){var r;return e(this,o),(r=i.call(this,t,"background")).setScrollFactor(0),r.setColor(sd(n,"color",null),sd(n,"color2",null),sd(n,"horizontalGradient",!0)),r.setStroke(sd(n,"stroke",null),sd(n,"strokeThickness",2)),r.setCornerRadius(sd(n,"cornerRadius",0),sd(n,"cornerIteration",null)),r}return n(o,[{key:"color",get:function(){return this._color},set:function(t){t=Wl(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t;}},{key:"color2",get:function(){return this._color2},set:function(t){t=Wl(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t;}},{key:"horizontalGradient",get:function(){return this._horizontalGradient},set:function(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t;}},{key:"setColor",value:function(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}},{key:"stroke",get:function(){return this._stroke},set:function(t){t=Wl(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t;}},{key:"strokeThickness",get:function(){return this._strokeThickness},set:function(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t;}},{key:"setStroke",value:function(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}},{key:"cornerRadius",get:function(){return this._cornerRadius},set:function(t){this.setDirty(this._cornerRadius!=t),this._cornerRadius=t;}},{key:"cornerIteration",get:function(){return this._cornerIteration},set:function(t){this.setDirty(this._cornerIteration!=t),this._cornerIteration=t;}},{key:"modifyStyle",value:function(t){return t.hasOwnProperty("color")&&this.setColor(t.color,rd("color2",t,this),rd("horizontalGradient",t,this)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,rd("strokeThickness",t,this)),t.hasOwnProperty("cornerRadius")&&this.setCornerRadius(t.cornerRadius,rd("cornerIteration",t,this)),this}},{key:"modifyPorperties",value:function(t){return c(s(o.prototype),"modifyPorperties",this).call(this,t),this.modifyStyle(t),this}},{key:"setCornerRadius",value:function(t,e){return this.cornerRadius=t,this.cornerIteration=e,this}},{key:"renderContent",value:function(){ru(this.parent,this.color,this.stroke,this.strokeThickness,this.cornerRadius,this.color2,this.horizontalGradient,this.cornerIteration);}}]),o}(nd),ad=Phaser.Utils.Objects.GetValue,hd=function(t){r(o,t);var i=l(o);function o(t,n){var r;return e(this,o),(r=i.call(this,t,"innerbounds")).setScrollFactor(0),r.setColor(ad(n,"color",null),ad(n,"color2",null),ad(n,"horizontalGradient",!0)),r.setStroke(ad(n,"stroke",null),ad(n,"strokeThickness",2)),r}return n(o,[{key:"color",get:function(){return this._color},set:function(t){t=Wl(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t;}},{key:"color2",get:function(){return this._color2},set:function(t){t=Wl(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t;}},{key:"horizontalGradient",get:function(){return this._horizontalGradient},set:function(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t;}},{key:"setColor",value:function(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}},{key:"stroke",get:function(){return this._stroke},set:function(t){t=Wl(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t;}},{key:"strokeThickness",get:function(){return this._strokeThickness},set:function(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t;}},{key:"setStroke",value:function(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}},{key:"modifyPorperties",value:function(t){c(s(o.prototype),"modifyPorperties",this).call(this,t),t.hasOwnProperty("color")&&this.setColor(t.color,ad(t,"color2",null),ad(t,"horizontalGradient",!0)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,ad(t,"strokeThickness",2));}},{key:"renderContent",value:function(){var t=this.parent.padding,e=t.left,i=t.top,n=this.parent.width-t.left-t.right,r=this.parent.height-t.top-t.bottom,s=this.context;if(null!=this.color){var o,a;if(null!=this.color2)(a=this.horizontalGradient?s.createLinearGradient(0,0,n,0):s.createLinearGradient(0,0,0,r)).addColorStop(0,this.color),a.addColorStop(1,this.color2),o=a;else o=this.color;s.fillStyle=o,s.fillRect(e,i,n,r);}null!=this.stroke&&this.strokeThickness>0&&(s.strokeStyle=this.stroke,s.lineWidth=this.strokeThickness,s.strokeRect(e,i,n,r));}}]),o}(nd),ld=Phaser.Utils.Objects.GetValue,ud=function(){function t(i,n){e(this,t),this.parent=i,this.set(n);}return n(t,[{key:"toJSON",value:function(){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}}},{key:"set",value:function(t){return this.setBold(ld(t,"bold",!1)),this.setItalic(ld(t,"italic",!1)),this.setFontSize(ld(t,"fontSize","16px")),this.setFontFamily(ld(t,"fontFamily","Courier")),this.setColor(ld(t,"color","#fff")),this.setStrokeStyle(ld(t,"stroke",null),ld(t,"strokeThickness",0)),this.setShadow(ld(t,"shadowColor",null),ld(t,"shadowOffsetX",0),ld(t,"shadowOffsetY",0),ld(t,"shadowBlur",0)),this.setOffset(ld(t,"offsetX",0),ld(t,"offsetY",0)),this.setSpace(ld(t,"leftSpace",0),ld(t,"rightSpace",0)),this.setAlign(ld(t,"align",void 0)),this.setBackgroundColor(ld(t,"backgroundColor",null)),this.setBackgroundHeight(ld(t,"backgroundHeight",void 0)),this.setBackgroundBottomY(ld(t,"backgroundBottomY",void 0)),this}},{key:"modify",value:function(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(rd("stroke",t,this),rd("strokeThickness",t,this)),t.hasOwnProperty("shadowColor")&&this.setShadowColor(t.shadowColor),(t.hasOwnProperty("shadowOffsetX")||t.hasOwnProperty("shadowOffsetY"))&&this.setShadowOffset(rd("shadowOffsetX",t,this),rd("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}},{key:"setUpdateTextFlag",value:function(){return this.parent&&(this.parent.updateTextFlag=!0),this}},{key:"clone",value:function(){return new t(null,this.toJSON())}},{key:"copyFrom",value:function(t){return this.set(t.toJSON()),this}},{key:"copyTo",value:function(t){return t.set(this.toJSON()),this}},{key:"setBold",value:function(t){return void 0===t&&(t=!0),this.bold=t,this.setUpdateTextFlag(),this}},{key:"setItalic",value:function(t){return void 0===t&&(t=!0),this.italic=t,this.setUpdateTextFlag(),this}},{key:"fontStyle",get:function(){return this.bold&&this.italic?"bold italic":this.bold?"bold":this.italic?"italic":""}},{key:"setFontSize",value:function(t){return "number"==typeof t&&(t="".concat(t,"px")),this.fontSize=t,this.setUpdateTextFlag(),this}},{key:"setFontFamily",value:function(t){return this.fontFamily=t,this.setUpdateTextFlag(),this}},{key:"font",get:function(){return "".concat(this.fontStyle," ").concat(this.fontSize," ").concat(this.fontFamily)}},{key:"setColor",value:function(t){return this.color=Wl(t),this}},{key:"hasFill",get:function(){return null!=this.color}},{key:"setStrokeStyle",value:function(t,e){return this.stroke=Wl(t),void 0!==e&&(this.strokeThickness=e),this}},{key:"setStrokeThickness",value:function(t){return this.strokeThickness=t,this}},{key:"hasStroke",get:function(){return null!=this.stroke&&this.strokeThickness>0}},{key:"setShadowColor",value:function(t){return this.shadowColor=Wl(t),this}},{key:"setShadowOffset",value:function(t,e){return void 0===t&&(t=0),void 0===e&&(e=0),this.shadowOffsetX=t,this.shadowOffsetY=e,this}},{key:"setShadowBlur",value:function(t){return void 0===t&&(t=0),this.shaodwBlur=t,this}},{key:"setShadow",value:function(t,e,i,n){return this.setShadowColor(t).setShadowOffset(e,i).setShadowBlur(n),this}},{key:"setBackgroundColor",value:function(t){return this.backgroundColor=Wl(t),this}},{key:"hasBackgroundColor",get:function(){return null!=this.backgroundColor}},{key:"setBackgroundHeight",value:function(t){return this.backgroundHeight=t,this}},{key:"setBackgroundBottomY",value:function(t){return this.backgroundBottomY=t,this}},{key:"setOffsetX",value:function(t){return void 0===t&&(t=0),this.offsetX=t,this}},{key:"setOffsetY",value:function(t){return void 0===t&&(t=0),this.offsetY=t,this}},{key:"setOffset",value:function(t,e){return this.setOffsetX(t).setOffsetY(e),this}},{key:"setLeftSpace",value:function(t){return void 0===t&&(t=0),this.leftSpace=t,this}},{key:"setRightSpace",value:function(t){return void 0===t&&(t=0),this.rightSpace=t,this}},{key:"setSpace",value:function(t,e){return this.setLeftSpace(t).setRightSpace(e),this}},{key:"setAlign",value:function(t){return this.align=t,this}},{key:"syncFont",value:function(t){return t.font=this.font,this}},{key:"syncStyle",value:function(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}},{key:"syncShadow",value:function(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);}},{key:"getTextMetrics",value:function(t,e){return this.syncFont(t).syncStyle(t),t.measureText(e)}}]),t}(),cd=Phaser.Utils.Array.Remove,dd=Phaser.Utils.Array.Remove,fd="text",pd="image",vd="drawer",gd="space",yd="command",md=function(t){return t.type===fd&&"\n"===t.text},kd=function(t){return t.type===fd&&"\f"===t.text},bd=function(t){return t.type===fd},xd=function(t){r(o,t);var i=l(o);function o(t,n,r){var s;return e(this,o),(s=i.call(this,t,fd)).updateTextFlag=!1,s.style=new ud(a(s),r),s.setText(n),s}return n(o,[{key:"autoRound",get:function(){return this.parent.autoRound}},{key:"offsetX",get:function(){return this.style.offsetX},set:function(t){this.style&&(this.style.offsetX=t);}},{key:"offsetY",get:function(){return this.style.offsetY},set:function(t){this.style&&(this.style.offsetY=t);}},{key:"leftSpace",get:function(){return this.style.leftSpace*this.scaleX},set:function(t){this.style&&(this.style.leftSpace=t),f(s(o.prototype),"leftSpace",t,this,!0);}},{key:"rightSpace",get:function(){return this.style.rightSpace*this.scaleX},set:function(t){this.style&&(this.style.rightSpace=t),f(s(o.prototype),"rightSpace",t,this,!0);}},{key:"align",get:function(){return this.style.align},set:function(t){this.style&&(this.style.align=t);}},{key:"modifyStyle",value:function(t){return this.setDirty(!0),this.style.modify(t),this.updateTextFlag&&this.updateTextSize(),this}},{key:"modifyPorperties",value:function(t){return t?(this.modifyStyle(t),c(s(o.prototype),"modifyPorperties",this).call(this,t),this):this}},{key:"setText",value:function(t){return this.setDirty(this.text!=t),this.text=t,this.updateTextSize(),this}},{key:"updateTextSize",value:function(){var t=this.text;if("\n"===t||"\f"===t||""===t)this.clearTextSize();else {var e,i,n=this.style.getTextMetrics(this.context,this.text);this.textWidth=n.width,"actualBoundingBoxAscent"in n?(e=n.actualBoundingBoxAscent,i=n.actualBoundingBoxDescent):(e=0,i=0),this.textHeight=e+i,this.ascent=e,this.descent=i;}return this.updateTextFlag=!1,this}},{key:"clearTextSize",value:function(){return this.textWidth=0,this.textHeight=0,this.ascent=0,this.descent=0,this}},{key:"copyTextSize",value:function(t){return this.textWidth=t.textWidth,this.textHeight=t.textHeight,this.ascent=t.ascent,this.descent=t.descent,this}},{key:"width",get:function(){return this.textWidth*this.scaleX},set:function(t){this.textWidth>0?this.scaleX=t/this.textWidth:this.scaleX=1;}},{key:"height",get:function(){return this.textHeight*this.scaleY},set:function(t){this.textHeight>0?this.scaleY=t/this.textHeight:this.scaleY=1;}},{key:"willRender",get:function(){return 0!==this.textWidth&&c(s(o.prototype),"willRender",this)}},{key:"renderContent",value:function(){var t=this.context,e=this.style;if(e.hasBackgroundColor){t.fillStyle=e.backgroundColor;var i=this.drawTLX,n=this.drawTRX-i,r=e.backgroundBottomY;null==r&&(r=this.drawBLY);var s=e.backgroundHeight;null==s&&(s=r-this.drawTLY);var o=r-s;t.fillRect(i,o,n,s);}var a=e.hasFill,h=e.hasStroke;(a||h)&&(e.syncFont(t).syncStyle(t),h&&(e.syncShadow(t),t.strokeText(this.text,0,0)),a&&(e.syncShadow(t),t.fillText(this.text,0,0)));}},{key:"drawTLX",get:function(){return -this.leftSpace}},{key:"drawTLY",get:function(){return -this.ascent}},{key:"drawBLX",get:function(){return -this.leftSpace}},{key:"drawBLY",get:function(){return this.descent}},{key:"drawTRX",get:function(){return this.textWidth+this.rightSpace}},{key:"drawTRY",get:function(){return -this.ascent}},{key:"drawBRX",get:function(){return this.textWidth+this.rightSpace}},{key:"drawBRY",get:function(){return this.descent}}]),o}(nd),wd=function(t,e){var i=this.createCharChildren(t,e);return this.addChild(i),this},Sd=function(t){r(s,t);var i=l(s);function s(t,n,r){var o;return e(this,s),(o=i.call(this,t,pd)).setTexture(n,r),o}return n(s,[{key:"frameWidth",get:function(){return this.frameObj?this.frameObj.cutWidth:0}},{key:"frameHeight",get:function(){return this.frameObj?this.frameObj.cutHeight:0}},{key:"offsetY",get:function(){return -this.height},set:function(t){}},{key:"key",get:function(){return this._key},set:function(t){this.setDirty(this._key!=t),this._key=t;}},{key:"frame",get:function(){return this._frame},set:function(t){this.setDirty(this._frame!=t),this._frame=t;}},{key:"setTexture",value:function(t,e){return this.key=t,this.frame=e,this.frameObj=this.scene.sys.textures.getFrame(t,e),this}},{key:"width",get:function(){return this.frameWidth*this.scaleX},set:function(t){this.setDirty(this.width!==t),this.scaleX=t/this.frameWidth;}},{key:"height",get:function(){return this.frameHeight*this.scaleY},set:function(t){this.setDirty(this.height!==t),this.scaleY=t/this.frameHeight;}},{key:"setHeight",value:function(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}},{key:"renderContent",value:function(){var t=this.context,e=this.frameObj,i=this.frameWidth,n=this.frameHeight;t.drawImage(e.source.image,e.cutX,e.cutY,i,n,0,0,i,n);}},{key:"drawTLX",get:function(){return -this.leftSpace}},{key:"drawTLY",get:function(){return 0}},{key:"drawBLX",get:function(){return -this.leftSpace}},{key:"drawBLY",get:function(){return this.frameHeight}},{key:"drawTRX",get:function(){return this.frameWidth+this.rightSpace}},{key:"drawTRY",get:function(){return 0}},{key:"drawBRX",get:function(){return this.frameWidth+this.rightSpace}},{key:"drawBRY",get:function(){return this.frameHeight}}]),s}(nd),Cd=function(t){r(o,t);var i=l(o);function o(t,n,r,s){var a;return e(this,o),(a=i.call(this,t,vd)).setRenderCallback(n),a.setDrawerSize(r,s),a}return n(o,[{key:"setRenderCallback",value:function(t){return t?this.renderContent=t.bind(this):delete this.renderContent,this}},{key:"setDrawerSize",value:function(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}},{key:"onFree",value:function(){c(s(o.prototype),"onFree",this).call(this),this.setRenderCallback();}},{key:"width",get:function(){return this.drawerWidth*this.scaleX},set:function(t){this.setDirty(this.width!==t),this.scaleX=this.drawerWidth>0?t/this.drawerWidth:1;}},{key:"height",get:function(){return this.drawerHeight*this.scaleY},set:function(t){this.setDirty(this.height!==t),this.scaleY=this.drawerHeight>0?t/this.drawerHeight:1;}},{key:"offsetY",get:function(){return -this.height},set:function(t){}},{key:"drawTLX",get:function(){return -this.leftSpace}},{key:"drawTLY",get:function(){return 0}},{key:"drawBLX",get:function(){return -this.leftSpace}},{key:"drawBLY",get:function(){return this.drawerHeight}},{key:"drawTRX",get:function(){return this.drawerWidth+this.rightSpace}},{key:"drawTRY",get:function(){return 0}},{key:"drawBRX",get:function(){return this.drawerWidth+this.rightSpace}},{key:"drawBRY",get:function(){return this.drawerHeight}}]),o}(nd),Od=function(t){r(s,t);var i=l(s);function s(t,n){var r;return e(this,s),(r=i.call(this,t,gd)).setSpaceWidth(n),r}return n(s,[{key:"width",get:function(){return this.spaceWidth*this.scaleX},set:function(t){this.spaceWidth>0?this.scaleX=t/this.spaceWidth:this.scaleX=1;}},{key:"setSpaceWidth",value:function(t){return this.spaceWidth=t,this}}]),s}(nd),_d=function(t){r(o,t);var i=l(o);function o(t,n,r,s,a){var h;return e(this,o),(h=i.call(this,t,yd)).setName(n).setParameter(s).setCallback(r,a),h}return n(o,[{key:"setName",value:function(t){return this.name=t,this}},{key:"setParameter",value:function(t){return this.param=t,this}},{key:"setCallback",value:function(t,e){return this.callback=t,this.scope=e,this}},{key:"exec",value:function(){return this.scope?this.callback.call(this.scope,this.param,this.name):this.callback(this.param,this.name)}},{key:"onFree",value:function(){c(s(o.prototype),"onFree",this).call(this),this.setName().setCallback().setParameter();}}]),o}(jc),Pd=function(t,e,i,n){void 0===n&&(n={word:[],width:0}),n.word.length=0;for(var r=t.length,s=e,o=n.word,a=0;s0&&!a){var h=this.fixedHeight-n;if(i>0)s=h/i;else s=(l=Md.call(this)).height,o=l.ascent,i=Math.floor((h-o)/s);}else {var l;s=(l=Md.call(this)).height,o=l.ascent;}}else if(this.fixedHeight>0){if(void 0===(i=Ld(t,"maxLines"))){h=this.fixedHeight-n;i=Math.floor(h/s);}}else i=Ld(t,"maxLines",0);void 0===o&&(o=s);var u=0===i,c=Ld(t,"wrapWidth",void 0);void 0===c&&(c=this.fixedWidth>0?this.fixedWidth-r:1/0);for(var d=Ld(t,"letterSpacing",0),f=Ld(t,"hAlign",0),p=Ld(t,"vAlign",0),v=Ld(t,"charWrap",!1),g={callback:"runWordWrap",start:e,isLastPage:!1,padding:this.wrapPadding,ascent:o,lineHeight:s,maxLines:i,wrapWidth:c,letterSpacing:d,hAlign:f,vAlign:p,charWrap:v,children:[],lines:[],maxLineWidth:0,linesHeight:0},y=this.children,m=0,k=y.length;m0&&(T.push({children:E,width:M}),R=Math.max(R,M)),g.start+=P.length,g.isLastPage=!L&&g.start===_,g.maxLineWidth=R,g.linesHeight=T.length*s;var Y=this.fixedWidth>0?this.fixedWidth:g.maxLineWidth+r,X=this.fixedHeight>0?this.fixedHeight:g.linesHeight+n;!function(t,e,i){var n,r,s=t.hAlign,o=t.vAlign,a=t.linesHeight;switch(o){case 1:case"center":r=(i-a)/2;break;case 2:case"bottom":r=i-a;break;default:r=0;}for(var h=t.lines,l=0,u=h.length;l0?(o=this.fixedWidth-r)/i:0;else if(this.fixedWidth>0){if(void 0===(i=Dd(t,"maxLines",void 0))){var o=this.fixedWidth-r;i=Math.floor(o/s)+1;}}else i=Dd(t,"maxLines",0);var a=0===i,h=Dd(t,"fixedChildHeight",void 0);if(void 0===h){var l=Dd(t,"charPerLine",void 0);if(void 0!==l){var u=this.fixedHeight-n;h=Math.floor(u/l);}}var c=Dd(t,"wrapHeight",void 0);void 0===c&&(c=this.fixedHeight>0?this.fixedHeight-n:1/0);for(var d=Dd(t,"letterSpacing",0),f=Dd(t,"rtl",!0),p=Dd(t,"hAlign",f?2:0),v=Dd(t,"vAlign",0),g={callback:"runVerticalWrap",start:e,isLastPage:!1,padding:this.wrapPadding,lineWidth:s,maxLines:i,fixedChildHeight:h,wrapHeight:c,letterSpacing:d,hAlign:p,vAlign:v,rtl:f,children:[],lines:[],maxLineHeight:0,linesWidth:0},y=this.children,m=0,k=y.length;m0&&(T.push({children:E,height:M}),R=Math.max(R,M)),g.start+=P.length,g.isLastPage=g.start===_,g.maxLineHeight=R,g.linesWidth=T.length*s;var j=this.fixedWidth>0?this.fixedWidth:g.linesWidth+r,W=this.fixedHeight>0?this.fixedHeight:g.maxLineHeight+n;!function(t,e,i){var n,r,s=t.hAlign,o=t.vAlign,a=t.rtl,h=t.lines,l=t.lineWidth,u=t.linesWidth;switch(s){case 1:case"center":n=(e-u)/2;break;case 2:case"right":n=e-u;break;default:n=0;}a&&(n+=l);for(var c=0,d=h.length;c0?t:this.width,e>0?e:this.height),this):this},setPadding:function(t,e){var i=this.padding,n=i.left,r=i.right,s=i.top,o=i.bottom;return Ne(i,t,e),this.dirty=this.dirty||n!=i.left||r!=i.right||s!=i.top||o!=i.bottom,this},getPadding:function(t){return He(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),cd(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 dd(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,n,r,s=Array.isArray(t);void 0===e||e===this.children.length?s?(i=this.children).push.apply(i,p(t)):this.children.push(t):s?(n=this.children).splice.apply(n,[e,0].concat(p(t))):this.children.splice(e,0,t);(this.lastAppendedChildren.length=0,s)?(r=this.lastAppendedChildren).push.apply(r,p(t)):this.lastAppendedChildren.push(t);return this},createCharChild:function(t,e){e&&this.textStyle.modify(e);var i=this.poolManager.allocate(fd);return null===i?i=new xd(this,t,this.textStyle):i.setParent(this).setActive().modifyStyle(this.textStyle).setText(t),i},createCharChildren:function(t,e){e&&this.textStyle.modify(e);for(var i=[],n=0,r=t.length;ne&&(n=e,r=t);})),r},getCharWorldPosition:function(t,e,i,n){return "number"==typeof t&&(t=this.getCharChild(t,!0)),$c(this,t,e,i,n)},setToMinSize:function(){for(var t=this.children,e=0,i=0,n=0,r=t.length;n=i.length&&(t=i.length);for(var n=0,r=0;r=t.dragThreshold?"DRAG":"DRAGBEGIN":"IDLE"}},{key:"update_DRAGBEGIN",value:function(t,e){this.next();}},{key:"next_DRAG",value:function(){var t,e=this.parent;return e.dragState.isUp&&(t=e.outOfBounds?"BACK":e.slidingEnable?"SLIDE":"IDLE"),t}},{key:"update_DRAG",value:function(t,e){var i=this.parent;i.dragState.justMoved&&i.dragging(),this.next();}},{key:"enter_DRAG",value:function(){this.parent.onDragStart();}},{key:"exit_DRAG",value:function(){this.parent.onDragEnd();}},{key:"next_SLIDE",value:function(){var t,e=this.parent;return e.dragState.isDown?t="DRAG":e.isSliding||(t="IDLE"),t}},{key:"enter_SLIDE",value:function(){this.parent.onSliding();}},{key:"exit_SLIDE",value:function(){this.parent.stop();}},{key:"update_SLIDE",value:function(t,e){this.parent.sliding(t,e),this.next();}},{key:"next_BACK",value:function(){var t,e=this.parent;return e.dragState.isDown?t="DRAG":e.isPullBack||(t="IDLE"),t}},{key:"enter_BACK",value:function(){this.parent.onPullBack();}},{key:"exit_BACK",value:function(){this.parent.stop();}},{key:"update_BACK",value:function(t,e){this.parent.pullBack(t,e),this.next();}}]),s}(zn),vp=Phaser.Utils.Objects.GetValue,gp=Phaser.Math.Distance.Between,yp=function(t){r(o,t);var i=l(o);function o(t,n){var r;return e(this,o),(r=i.call(this,t,n))._enable=void 0,t.setInteractive(vp(n,"inputConfig",void 0)),r.resetFromJSON(n),r.boot(),r}return n(o,[{key:"resetFromJSON",value:function(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(vp(t,"enable",!0)),this.holdThreshold=vp(t,"holdThreshold",50),this.pointerOutReleaseEnable=vp(t,"pointerOutRelease",!0),this}},{key:"boot",value:function(){this.parent.on("pointerdown",this.onPointIn,this),this.parent.on("pointerup",this.onPointOut,this),this.pointerOutReleaseEnable&&this.parent.on("pointerout",this.onPointOut,this),this.parent.on("pointermove",this.onPointerMove,this),this.scene.sys.events.on("preupdate",this.preupdate,this);}},{key:"shutdown",value:function(t){this.isShutdown||(this.scene.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,c(s(o.prototype),"shutdown",this).call(this,t));}},{key:"enable",get:function(){return this._enable},set:function(t){this._enable!==t&&(t||(this.isInTouched=!1,this.pointer=void 0),this._enable=t);}},{key:"setEnable",value:function(t){return void 0===t&&(t=!0),this.enable=t,this}},{key:"toggleEnable",value:function(){return this.setEnable(!this.enable),this}},{key:"setPointerOutReleaseEnable",value:function(t){return void 0===t&&(t=!0),this.pointerOutReleaseEnable=t,this}},{key:"isDown",get:function(){return this.pointer&&this.pointer.isDown}},{key:"isUp",get:function(){return !this.isDown}},{key:"dx",get:function(){return this.x-this.preX}},{key:"dy",get:function(){return this.y-this.preY}},{key:"dt",get:function(){return us(this.scene)}},{key:"speed",get:function(){return this.x===this.preX&&this.y===this.preY?0:gp(this.preX,this.preY,this.x,this.y)/(.001*this.dt)}},{key:"speedX",get:function(){return this.dx/(.001*this.dt)}},{key:"speedY",get:function(){return this.dy/(.001*this.dt)}},{key:"onPointIn",value:function(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.pointer=t,this.localX=e,this.localY=i);}},{key:"onPointOut",value:function(t){this.enable&&this.pointer===t&&(this.pointer=void 0);}},{key:"onPointerMove",value:function(t,e,i){this.enable&&t.isDown&&this.pointer===t&&(this.localX=e,this.localY=i);}},{key:"preupdate",value:function(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));}}}]),o}(si),mp=Phaser.Utils.Objects.GetValue,kp=function(){function t(i){e(this,t),this.resetFromJSON(i);}return n(t,[{key:"resetFromJSON",value:function(t){return this.setValue(mp(t,"value",0)),this.setSpeed(mp(t,"speed",0)),this.setAcceleration(mp(t,"acceleration",0)),this}},{key:"reset",value:function(){this.setValue(0),this.setSpeed(0),this.setAcceleration(0);}},{key:"setValue",value:function(t){return this.value=t,this}},{key:"setSpeed",value:function(t){return this.speed=t,this}},{key:"setAcceleration",value:function(t){return this.acceleration=t,this}},{key:"updateSpeed",value:function(t){return 0!==this.acceleration&&(this.speed+=this.acceleration*t,this.speed<0&&(this.speed=0)),this}},{key:"getDeltaValue",value:function(t){return this.updateSpeed(t),this.speed<=0?0:this.speed*t}},{key:"update",value:function(t){return this.updateSpeed(t),this.speed>0&&(this.value+=this.getDeltaValue(t)),this}},{key:"isMoving",get:function(){return this.speed>0}}]),t}(),bp=function(){function t(){e(this,t),this.value,this.dir,this.movement=new kp;}return n(t,[{key:"init",value:function(t,e,i,n,r){return this.value=t,this.end=r,this.dir=void 0!==r?tthis.end&&(this.value=this.end):this.valuethis.maxValue}},{key:"overMin",value:function(t){return null!=this.minValue&&t0,Math.abs(e),i);}},{key:"sliding",value:function(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;}},{key:"onPullBack",value:function(){var t=this.value,e=this.outOfMinBound?this.minValue:this.maxValue,i=Math.abs(e-t),n=this.backDeceleration,r=Math.sqrt(2*n*i);this._slowDown.init(t,void 0,r,n,e);}},{key:"pullBack",value:function(t,e){e*=.001,this.value=this._slowDown.update(e).value,this._slowDown.isMoving||this._state.next();}},{key:"stop",value:function(){this._slowDown.stop();}}]),o}(si),Cp={y:0,v:0,vertical:0,x:1,h:1,horizontal:1},Op=Phaser.Utils.Objects.GetValue,_p=function(t){r(s,t);var i=l(s);function s(t,n){var r;(e(this,s),(r=i.call(this,t,n)).parent!==r.scene?r.focusMode=Op(n,"focus",!1):r.focusMode=!1,r.setSpeed(Op(n,"speed",.1)),r.setEnable(Op(n,"enable",!0)),r.focusMode)?(t=r.parent).setInteractive(Op(n,"inputConfig",void 0)).on("wheel",(function(t,e,i,n,r){this.enable&&this.scroll(i);}),a(r)):r.scene.input.on("wheel",r.onSceneScroll,a(r));return r}return n(s,[{key:"destroy",value:function(){this.focusMode||this.scene.input.off("wheel",this.onSceneScroll,this);}},{key:"onSceneScroll",value:function(t,e,i,n,r,s){this.enable&&this.scroll(n);}},{key:"setEnable",value:function(t){return void 0===t&&(t=!0),this.enable=t,this}},{key:"setSpeed",value:function(t){return this.speed=t,this}},{key:"scroll",value:function(t){t*=this.speed,this.emit("scroll",t,this.parent,this);}}]),s}(si),Pp=Phaser.Utils.Objects.GetValue,Tp=function(t,e,i,n){var r,s,o,a,h="Y"===(i=i.toUpperCase()),l=2===t.scrollMode,u=t.childrenMap.child,c="slider".concat(i);if(r=l||n.hasOwnProperty(c)?Pp(n,c,void 0):Pp(n,"slider",void 0)){var d,f,p;!0===r&&(r={}),r.orientation=h?1:0,s=function(t,e){void 0===e&&(e={});var i=Rt(e);(e={slider:i}).orientation=i.orientation,delete i.orientation,e.background=i.background,delete i.background,e.buttons=i.buttons,delete i.buttons;var n=new fp(t,e);t.add.existing(n);var r=n.childrenMap.slider;return n.addChildrenMap("track",r.childrenMap.track),n.addChildrenMap("indicator",r.childrenMap.indicator),n.addChildrenMap("thumb",r.childrenMap.thumb),n}(t.scene,r);var v=Pp(r,"position",0);"string"==typeof v&&(v=Ep[v]);var g=Pp(n,"space.slider".concat(i),void 0);void 0===g&&void 0===(g=Pp(n,"space.slider",void 0))&&(g=l?0:Pp(n,"space.child",0));var y="number"==typeof g;h?0===v?(d=2,f=1,p=y?{left:g}:g):(d=0,f=1,p=y?{right:g}:g):0===v?(d=1,f=2,p=y?{top:g}:g):(d=1,f=0,p=y?{bottom:g}:g),e.add(s,{column:d,row:f,align:"center",padding:p,expand:!0}),t["hideUnscrollableSlider".concat(i)]=Pp(r,"hideUnscrollableSlider",!1),t["adaptThumb".concat(i,"SizeMode")]=Pp(r,"adaptThumbSize",!1),t["minThumb".concat(i,"Size")]=Pp(r,"minThumbSize",void 0);}else t["hideUnscrollableSlider".concat(i)]=!1,t["adaptThumb".concat(i,"SizeMode")]=!1,t["minThumb".concat(i,"Size")]=void 0;var m="scroller".concat(i);(o=l||n.hasOwnProperty(m)?Pp(n,m,!0):Pp(n,"scroller",!0))&&u&&(!0===o&&(o={}),o.orientation=h?0:1,a=new Sp(u,o));var k,b,x,w,S=Pp(n,l?"mouseWheelScroller".concat(i):"mouseWheelScroller",!1);(S&&u&&(k=new _p(u,S)),t.addChildrenMap("slider".concat(i),s),t.addChildrenMap("scroller".concat(i),a),t.addChildrenMap("mouseWheelScroller".concat(i),k),l&&!h||(t.hideUnscrollableSlider=t["hideUnscrollableSlider".concat(i)],t.adaptThumbSizeMode=t["adaptThumb".concat(i,"SizeMode")],t.minThumbSize=t["minThumb".concat(i,"Size")],t.addChildrenMap("slider",s),t.addChildrenMap("scroller",a),t.addChildrenMap("mouseWheelScroller",k)),s)&&(l?(b=h?"t":"s",w="scroll".concat(i)):(b="t",w="scroll"),s.on("valuechange",(function(e){t[b]=e,t.emit(w,t);})));a&&(l?(x="childO".concat(i),w="scroll".concat(i)):(x="childOY",w="scroll"),a.on("valuechange",(function(e){t[x]=e,t.emit(w,t);})));if(k){var C="addChildO".concat(i);k.on("scroll",(function(e){t[C](-e,!0);}));}},Ep={right:0,left:1,bottom:0,top:1},Mp=Phaser.Utils.Objects.GetValue,Rp=function(t,e){var i=t.scene,n=[0,1,0],r=[0,1,0],s=Mp(e,"width"),o=Mp(e,"height");s||(n[1]=0),o||(r[1]=0);var a=new qa(i,{column:3,row:3,columnProportions:n,rowProportions:r});switch(function(t,e,i){var n=Rf(i,"child"),r=Rf(n,"gameObject",void 0);if(r){var s=Rf(i,"space.child",0);t.childMargin={};var o=t.childMargin,a={};if("number"==typeof s)switch(t.scrollMode){case 0:case 1:o.top=0,o.bottom=0,o.left=0,o.right=0;break;default:o.top=s,o.bottom=s,o.left=s,o.right=s;}else switch(t.scrollMode){case 0:o.top=Rf(s,"top",0),o.bottom=Rf(s,"bottom",0),a.left=Rf(s,"left",0),a.right=Rf(s,"right",0);break;case 1:o.top=Rf(s,"left",0),o.bottom=Rf(s,"right",0),a.top=Rf(s,"top",0),a.bottom=Rf(s,"bottom",0);break;default:o.top=Rf(s,"top",0),o.bottom=Rf(s,"bottom",0),o.left=Rf(s,"left",0),o.right=Rf(s,"right",0);}e.add(r,{column:1,row:1,align:Rf(n,"align","center"),padding:a,expand:{width:Rf(n,"expandWidth",!0),height:Rf(n,"expandHeight",!0)}});}t.addChildrenMap("child",r);}(t,a,e),t.scrollMode){case 0:Tp(t,a,"y",e);break;case 1:Tp(t,a,"x",e);break;default:Tp(t,a,"y",e),Tp(t,a,"x",e);}return a},Lp=function(t){var e,i,n,r;switch(this.scrollMode){case 0:case 1:e=this.topChildOY,i=this.bottomChildOY,n=this.childrenMap.scroller,r=this.childrenMap.slider;break;default:"Y"===(t=t.toUpperCase())?(e=this.topChildOY,i=this.bottomChildOY):(e=this.leftChildOX,i=this.rightChildOX),n=this.childrenMap["scroller".concat(t)],r=this.childrenMap["slider".concat(t)];}n&&n.setBounds(e,i),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".concat(t)],i=this["hideUnscrollableSlider".concat(t)],n=this["isOverflow".concat(t)];e&&i&&this.setChildVisible(e,n);}},Ap=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,n=a.childrenMap.thumb,r=this.minThumbSize;if(0===this.scrollMode){var s=i.displayHeight*e;void 0!==r&&s0?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(Ip.call(this,-this.textOY)),0),e=Fp.call(this,t)+this.textOY,i=Hp.call(this,t);return function(t,e){switch(Xp(t)){case 0:var i=(r=t.style).wordWrapWidth,n=r.wordWrapCallback;r.wordWrapWidth=0,r.wordWrapCallback=void 0,t.setText(e),r.wordWrapWidth=i,r.wordWrapCallback=n;break;case 1:var r,s=(r=t.style).wrapMode;r.wrapMode=0,t.setText(e),r.wrapMode=s;break;case 2:var o=t._maxWidth;t._maxWidth=0,t.setText(e),t._maxWidth=o;}}(this.textObject,i),this.textObject.rexSizer.offsetY=e,Np.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,Ke.call(this),this},layoutChildren:function(){var t,e,i,n,r,s,o,a=this.left,h=this.top;(t=this.textObject).rexSizer.hidden||(n=a+(i=(e=t.rexSizer).padding).left,r=h+i.top,s=this.width-i.left-i.right,o=this.height-i.top-i.bottom,Vp.call(this,t,s,o),Se(t,n,r,s,o,e.align),e.preOffsetY=0,Np.call(this),this.textMask&&(this.textMask.setPosition().resize(),this.resetChildPositionState(this.textMask)));}},Jp=Phaser.Utils.Objects.IsPlainObject,Kp=Phaser.Utils.Objects.GetValue,qp=Phaser.Display.Align.TOP_LEFT,Zp=function(t){r(o,t);var i=l(o);function o(t,n,r,s,h,l){var u;e(this,o),Jp(n)?(n=Kp(l=n,"x",0),r=Kp(l,"y",0),s=Kp(l,"width",void 0),h=Kp(l,"height",void 0)):Jp(s)&&(s=Kp(l=s,"width",void 0),h=Kp(l,"height",void 0)),(u=i.call(this,t,n,r,s,h,l)).type="rexTextBlock",u.textObject=void 0,u.linesCount=0,u.textMask=void 0,u.textObjectType=void 0,u._textLineHeight=void 0,u._textLineSpacing=void 0,u._visibleLinesCount=void 0,u._textHeight=void 0,u._textVisibleHeight=void 0,u._textObjectRealHeight=0,u.lines=void 0,u.text=Kp(l,"content",""),u._textOY=0,u.execeedTopState=!1,u.execeedBottomState=!1,u.setClampMode(Kp(l,"clamplTextOY",!0)),u.alwaysScrollable=Kp(l,"alwaysScrollable",!1);var c=Kp(l,"background",void 0),d=Kp(l,"text",void 0);void 0===d&&(d=$p(t)),u.textCropEnable=Kp(l,"textCrop",!!d.setCrop);var f=Kp(l,"textMask",!u.textCropEnable);c&&u.addBackground(c),u.add(d),u.sizerChildren=[d];var p=u.getSizerConfig(d);return p.align=qp,p.padding=Ee(0),p.expand=!0,u.textObject=d,u.textObjectType=Xp(d),p.preOffsetY=0,p.offsetY=0,f&&(u.textMask=xh.call(a(u),u.textObject,a(u))),u.addChildrenMap("background",c),u.addChildrenMap("text",d),u}return n(o,[{key:"destroy",value:function(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;}c(s(o.prototype),"destroy",this).call(this,t);}}},{key:"setClampMode",value:function(t){return void 0===t&&(t=!0),this.clampTextOY=t,this}},{key:"textLineHeight",get:function(){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}},{key:"textLineSpacing",get:function(){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}},{key:"visibleLinesCount",get:function(){return void 0===this._visibleLinesCount&&(this._visibleLinesCount=Math.floor(Ip.call(this,this._textObjectRealHeight))),this._visibleLinesCount}},{key:"topTextOY",get:function(){return 0}},{key:"bottomTextOY",get:function(){return -this.textVisibleHeight}},{key:"textHeight",get:function(){return void 0===this._textHeight&&(this._textHeight=Fp.call(this,this.linesCount)),this._textHeight}},{key:"textObjectHeight",get:function(){return this._textObjectRealHeight-(this.textLineHeight+this.textLineSpacing)}},{key:"textVisibleHeight",get:function(){if(void 0===this._textVisibleHeight){var t=this.textHeight-this.textObjectHeight;!this.alwaysScrollable&&t<0&&(t=0),this._textVisibleHeight=t;}return this._textVisibleHeight}},{key:"textOYExceedTop",value:function(t){return void 0===t&&(t=this.textOY),t>this.topTextOY}},{key:"textOYExeceedBottom",value:function(t){return void 0===t&&(t=this.textOY),tthis.linesCount?t=0:n?t=e:r&&(t=i)),this._textOY!==t&&(this._textOY=t,this.updateTextObject()),n&&(this.execeedTopState||this.emit("execeedtop",this,t,e)),this.execeedTopState=n,r&&(this.execeedBottomState||this.emit("execeedbottom",this,t,i)),this.execeedBottomState=r;}},{key:"setTextOY",value:function(t){return this.textOY=t,this}},{key:"t",get:function(){var t=this.textVisibleHeight;return 0===t?0:this.textOY/-t},set:function(t){this.textOY=-this.textVisibleHeight*t;}},{key:"setTextOYByPercentage",value:function(t){return this.t=t,this}}]),o}(eo),$p=function(t){return t.add.text(0,0,"")};Object.assign(Zp.prototype,Up);Phaser.Math.Clamp;var Qp={scrollToLine:function(t){return this.setChildOY(-this.lineHeight*t),this},scrollToNextLine:function(t){void 0===t&&(t=1);var e=this.lineIndex+t;return this.scrollToLine(e),this}},tv=Phaser.Utils.Objects.GetValue,ev=function(t){r(s,t);var i=l(s);function s(t,n){var r;e(this,s),void 0===n&&(n={});var o=tv(n,"text",void 0),a=tv(n,"textWidth",void 0),h=tv(n,"textHeight",void 0),l=tv(n,"textCrop",!!o.setCrop),u=tv(n,"textMask",!l),c=tv(n,"content",""),d=new Zp(t,{width:a,height:h,text:o,textMask:u,textCrop:l&&!u,content:c,clamplTextOY:tv(n,"clamplChildOY",!1),alwaysScrollable:tv(n,"alwaysScrollable",!1)});t.add.existing(d),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}});}(d),n.scrollMode=0,n.type="rexTextArea",n.child={gameObject:d,expandWidth:void 0===a,expandHeight:void 0===h};var f=tv(n,"space",void 0);return f&&(f.child=tv(f,"text",0)),(r=i.call(this,t,n)).addChildrenMap("text",o),r}return n(s,[{key:"text",get:function(){return this.childrenMap.child.text}},{key:"lineHeight",get:function(){var t=this.childrenMap.child;return t.textLineHeight+t.textLineSpacing}},{key:"lineIndex",get:function(){return Math.floor(-this.childOY/this.lineHeight)}},{key:"linesCount",get:function(){return this.childrenMap.child.linesCount}},{key:"contentHeight",get:function(){return this.childrenMap.child.textHeight}}]),s}(Wp);Object.assign(ev.prototype,{setText:function(t){return this.childrenMap.child.setText(t),this.resizeController(),this},appendText:function(t){return this.setText(this.text+t),this}},Qp);var iv=Phaser.Utils.Objects.GetValue,nv=function(t,e,i){e=e?Ch(e):{};var n=iv(i,"background",Tl),r=iv(i,"text",Pc),s=iv(i,"track",Tl),o=iv(i,"thumb",Tl);n?e.background=n(t,e.background):delete e.background,r?e.text=r(t,e.text):delete e.text;var a=e.slider;!1!==a&&(void 0===a&&(a={}),s?a.track=s(t,a.track):delete a.track,o?a.thumb=o(t,a.thumb):delete a.thumb,e.slider=a);var h=new ev(t,e);return t.add.existing(h),h},rv=Phaser.Utils.Objects.GetValue,sv=function(t,e){if(t&&"number"!=typeof t){if(t.hasOwnProperty(e))return !0;if(-1!==e.indexOf(".")){for(var i=e.split("."),n=t,r=0;r textObject.width) { - dx = textObject.width - childRightX; - } else { - dx = 0; - } - var childTopY = this.drawY + this.drawTLY; - var childBottomY = childTopY + this.height; - if (childTopY < 0) { - dy = 0 - childTopY; - } else if (childBottomY > textObject.height) { - dy = textObject.height - childBottomY; - } else { - dy = 0; - } - textObject._textOX += dx; - textObject._textOY += dy; - return this; - }; - var Methods$1 = { contains: Contains, - getWorldPosition: GetWorldPosition, - scrollTo: ScrollTo + getWorldPosition: GetWorldPosition }; Object.assign(Methods$1, RenderMethods); @@ -4060,7 +4033,6 @@ return this; } this._textOX = ox; - this.updateTexture(); return this; }, setTextOY: function setTextOY(oy) { @@ -4068,7 +4040,6 @@ return this; } this._textOY = oy; - this.updateTexture(); return this; }, setTextOXY: function setTextOXY(ox, oy) { @@ -4077,7 +4048,6 @@ } this._textOX = ox; this._textOY = oy; - this.updateTexture(); return this; }, addTextOX: function addTextOX(incX) { diff --git a/dist/rexdynamictext.min.js b/dist/rexdynamictext.min.js index 84ad7f3a76..b0cb606443 100644 --- a/dist/rexdynamictext.min.js +++ b/dist/rexdynamictext.min.js @@ -1 +1 @@ -!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).rexdynamictext=e();}(undefined,(function(){function t(e){return t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},t(e)}function e(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){for(var i=0;it.length)&&(e=t.length);for(var i=0,r=new Array(e);ii.width?i.width-n:0;var s=this.drawY+this.drawTLY,h=s+this.height;return e=s<0?0-s:h>i.height?i.height-h:0,i._textOX+=t,i._textOY+=e,this}};Object.assign(E,D);var V=Phaser.Math.DegToRad,N=Phaser.Math.RadToDeg,J=Phaser.Utils.Objects.GetValue,q=function(t){n(s,t);var i=a(s);function s(t,r){var n;return e(this,s),(n=i.call(this,t,r)).renderable=!0,n.scrollFactorX=1,n.scrollFactorY=1,n.toLocalPosition=!0,n.originX=0,n.offsetX=0,n.offsetY=0,n}return r(s,[{key:"visible",get:function(){return this._visible},set:function(t){this.setDirty(this._visible!=t),this._visible=t;}},{key:"setVisible",value:function(t){return void 0===t&&(t=!0),this.visible=t,this}},{key:"alpha",get:function(){return this._alpha},set:function(t){this.setDirty(this._alpha!=t),this._alpha=t;}},{key:"setAlpha",value:function(t){return this.alpha=t,this}},{key:"x",get:function(){return this._x},set:function(t){this.setDirty(this._x!=t),this._x=t;}},{key:"setX",value:function(t){return this.x=t,this}},{key:"y",get:function(){return this._y},set:function(t){this.setDirty(this._y!=t),this._y=t;}},{key:"setY",value:function(t){return this.y=t,this}},{key:"setPosition",value:function(t,e){return this.x=t,this.y=e,this}},{key:"setInitialPosition",value:function(t,e){return this.x0=t,this.y0=e,this}},{key:"setScrollFactorX",value:function(t){return this.scrollFactorX=t,this}},{key:"setScrollFactorY",value:function(t){return this.scrollFactorY=t,this}},{key:"setScrollFactor",value:function(t,e){return void 0===e&&(e=t),this.scrollFactorX=t,this.scrollFactorY=e,this}},{key:"rotation",get:function(){return this._rotation},set:function(t){this.setDirty(this._rotation!=t),this._rotation=t;}},{key:"setRotation",value:function(t){return this.rotation=t,this}},{key:"angle",get:function(){return N(this._rotation)},set:function(t){this.rotation=V(t);}},{key:"setAngle",value:function(t){return this.angle=t,this}},{key:"scaleX",get:function(){return this._scaleX},set:function(t){this.setDirty(this._scaleX!==t),this._scaleX=t;}},{key:"setScaleX",value:function(t){return this.scaleX=t,this}},{key:"width",get:function(){return 0},set:function(t){}},{key:"setWidth",value:function(t,e){return void 0===e&&(e=!1),this.width=t,e&&(this.scaleY=this.scaleX),this}},{key:"leftSpace",get:function(){return this._leftSpace},set:function(t){this.setDirty(this._leftSpace!==t),this._leftSpace=t;}},{key:"setLeftSpace",value:function(t){return this.leftSpace=t,this}},{key:"rightSpace",get:function(){return this._rightSpace},set:function(t){this.setDirty(this._rightSpace!==t),this._rightSpace=t;}},{key:"setRightSpace",value:function(t){return this.rightSpace=t,this}},{key:"outerWidth",get:function(){return this.width+this.leftSpace+this.rightSpace}},{key:"scaleY",get:function(){return this._scaleY},set:function(t){this.setDirty(this._scaleY!==t),this._scaleY=t;}},{key:"setScaleY",value:function(t){return this.scaleY=t,this}},{key:"height",get:function(){return 0},set:function(t){}},{key:"setHeight",value:function(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}},{key:"setScale",value:function(t,e){return void 0===e&&(e=t),this.scaleX=t,this.scaleY=e,this}},{key:"setOrigin",value:function(t){return this.originX=t,this}},{key:"setAlign",value:function(t){return this.align=t,this}},{key:"modifyPorperties",value:function(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=J(t,"width",void 0),i=J(t,"height",void 0),r=J(t,"scaleX",void 0),n=J(t,"scaleY",void 0);return void 0!==e?void 0===i&&void 0===n?this.setWidth(e,!0):this.setWidth(e):void 0!==r&&this.setScaleX(r),void 0!==i?void 0===e&&void 0===r?this.setHeight(i,!0):this.setHeight(i):void 0!==n&&this.setScaleY(n),t.hasOwnProperty("leftSpace")&&this.setLeftSpace(t.leftSpace),t.hasOwnProperty("rightSpace")&&this.setRightSpace(t.rightSpace),t.hasOwnProperty("align")&&this.setAlign(t.align),this}},{key:"setDrawBelowCallback",value:function(t){return this.drawBelowCallback=t,this}},{key:"setDrawAboveCallback",value:function(t){return this.drawAboveCallback=t,this}},{key:"reset",value:function(){return this.setVisible().setAlpha(1).setPosition(0,0).setRotation(0).setScale(1,1).setLeftSpace(0).setRightSpace(0).setOrigin(0).setAlign().setDrawBelowCallback().setDrawAboveCallback(),this}},{key:"willRender",get:function(){return this.visible&&this.alpha>0}},{key:"drawX",get:function(){var t=this.x+this.leftSpace+this.offsetX-this.originX*this.width;return this.parent._textOX*this.scrollFactorX+t}},{key:"drawY",get:function(){var t=this.y+this.offsetY;return this.parent._textOY*this.scrollFactorY+t}},{key:"drawTLX",get:function(){return 0}},{key:"drawTLY",get:function(){return 0}},{key:"drawBLX",get:function(){return 0}},{key:"drawBLY",get:function(){return 0}},{key:"drawTRX",get:function(){return 0}},{key:"drawTRY",get:function(){return 0}},{key:"drawBRX",get:function(){return 0}},{key:"drawBRY",get:function(){return 0}},{key:"drawCenterX",get:function(){return (this.drawTRX+this.drawTLX)/2}},{key:"drawCenterY",get:function(){return (this.drawBLY+this.drawTLY)/2}}]),s}(Y);Object.assign(q.prototype,E);var $=Phaser.Utils.String.Pad,K=function(e,i,r){if(null==e)return e;switch(t(e)){case"string":default:return e;case"number":return "#".concat($(Math.floor(e).toString(16),6,"0",1));case"function":return e(i,r);case"object":return e.hasOwnProperty("r")?e.hasOwnProperty("a")?"rgba(".concat(e.r,",").concat(e.g,",").concat(e.b,",").concat(e.a,")"):"rgb(".concat(e.r,",").concat(e.g,",").concat(e.b,")"):e.hasOwnProperty("h")?e.hasOwnProperty("a")?"hsla(".concat(e.h,",").concat(e.s,",").concat(e.l,",").concat(e.a,")"):"hsl(".concat(e.h,",").concat(e.s,",").concat(e.l,")"):e}},Q=function(t,e,i){return e.hasOwnProperty(t)?e[t]:i[t]},Z=Phaser.Utils.Objects.GetValue,tt=function(){function t(i,r,n,s,h){e(this,t),void 0===i&&(i=0),void 0===r&&(r=i),void 0===n&&(n=0),void 0===s&&(s=0),void 0===h&&(h=0),this.cornerRadius={},this._width=0,this._height=0,this.setTo(i,r,n,s,h);}return r(t,[{key:"setTo",value:function(t,e,i,r,n){return this.setPosition(t,e),this.setRadius(n),this.setSize(i,r),this}},{key:"setPosition",value:function(t,e){return this.x=t,this.y=e,this}},{key:"setRadius",value:function(t){return void 0===t&&(t=0),this.radius=t,this}},{key:"setSize",value:function(t,e){return this.width=t,this.height=e,this}},{key:"minWidth",get:function(){var t=this.cornerRadius;return Math.max(t.tl.x+t.tr.x,t.bl.x+t.br.x)}},{key:"minHeight",get:function(){var t=this.cornerRadius;return Math.max(t.tl.y+t.bl.y,t.tr.y+t.br.y)}},{key:"width",get:function(){return this._width},set:function(t){null==t&&(t=0),this._width=Math.max(t,this.minWidth);}},{key:"height",get:function(){return this._height},set:function(t){null==t&&(t=0),this._height=Math.max(t,this.minHeight);}},{key:"radius",get:function(){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:function(t){var e,i;"number"==typeof t?(e=t,i=t):(e=Z(t,"x",0),i=Z(t,"y",0));var r=this.cornerRadius;r.tl=et(Z(t,"tl",void 0),e,i),r.tr=et(Z(t,"tr",void 0),e,i),r.bl=et(Z(t,"bl",void 0),e,i),r.br=et(Z(t,"br",void 0),e,i);}},{key:"radiusTL",get:function(){var t=this.cornerRadius.tl;return Math.max(t.x,t.y)},set:function(t){it(this.cornerRadius.tl,t);}},{key:"radiusTR",get:function(){var t=this.cornerRadius.tr;return Math.max(t.x,t.y)},set:function(t){it(this.cornerRadius.tr,t);}},{key:"radiusBL",get:function(){var t=this.cornerRadius.bl;return Math.max(t.x,t.y)},set:function(t){it(this.cornerRadius.bl,t);}},{key:"radiusBR",get:function(){var t=this.cornerRadius.br;return Math.max(t.x,t.y)},set:function(t){it(this.cornerRadius.br,t);}}]),t}(),et=function(t,e,i){return void 0===t?t={x:e,y:i}:"number"==typeof t&&(t={x:t,y:t}),rt(t),t},it=function(t,e){"number"==typeof e?(t.x=e,t.y=e):(t.x=Z(e,"x",0),t.y=Z(e,"y",0)),rt(t);},rt=function(t){t.convex=t.x>=0||t.y>=0,t.x=Math.abs(t.x),t.y=Math.abs(t.y);},nt=Phaser.Math.DegToRad,st=function(t){return !t.hasOwnProperty("convex")||t.convex},ht=function(t){return t.x>0&&t.y>0},ot=function(t,e,i,r,n,s,h,o,a){if(o&&h>s?h-=360:!o&&h=f?1:r/f,v=n>=y?1:n/y,p=d.cornerRadius;t.save(),t.beginPath(),t.translate(e,i),o=p.tl,ht(o)?(a=o.x*g,l=o.y*v,st(o)?ot(t,a,l,a,l,180,270,!1,h):ot(t,0,0,a,l,90,0,!0,h),u=0,c=l):(t.lineTo(0,0),u=0,c=0),o=p.tr,ht(o)?(a=o.x*g,l=o.y*v,st(o)?ot(t,r-a,l,a,l,270,360,!1,h):ot(t,r,0,a,l,180,90,!0,h)):t.lineTo(r,0),o=p.br,ht(o)?(a=o.x*g,l=o.y*v,st(o)?ot(t,r-a,n-l,a,l,0,90,!1,h):ot(t,r,n,a,l,270,180,!0,h)):t.lineTo(r,n),o=p.bl,ht(o)?(a=o.x*g,l=o.y*v,st(o)?ot(t,a,n-l,a,l,90,180,!1,h):ot(t,0,n,a,l,360,270,!0,h)):t.lineTo(0,n),t.lineTo(u,c),t.closePath(),t.restore();}(e,i,r,n,s,h,d),null!=o){var f;if(null!=u)(f=c?e.createLinearGradient(0,0,n,0):e.createLinearGradient(0,0,0,s)).addColorStop(0,o),f.addColorStop(1,u),o=f;e.fillStyle=o,e.fill();}null!=a&&l>0&&(e.strokeStyle=a,e.lineWidth=l,e.stroke());},lt=Phaser.Utils.Objects.GetValue,ut=function(t){n(h,t);var i=a(h);function h(t,r){var n;return e(this,h),(n=i.call(this,t,"background")).setScrollFactor(0),n.setColor(lt(r,"color",null),lt(r,"color2",null),lt(r,"horizontalGradient",!0)),n.setStroke(lt(r,"stroke",null),lt(r,"strokeThickness",2)),n.setCornerRadius(lt(r,"cornerRadius",0),lt(r,"cornerIteration",null)),n}return r(h,[{key:"color",get:function(){return this._color},set:function(t){t=K(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t;}},{key:"color2",get:function(){return this._color2},set:function(t){t=K(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t;}},{key:"horizontalGradient",get:function(){return this._horizontalGradient},set:function(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t;}},{key:"setColor",value:function(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}},{key:"stroke",get:function(){return this._stroke},set:function(t){t=K(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t;}},{key:"strokeThickness",get:function(){return this._strokeThickness},set:function(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t;}},{key:"setStroke",value:function(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}},{key:"cornerRadius",get:function(){return this._cornerRadius},set:function(t){this.setDirty(this._cornerRadius!=t),this._cornerRadius=t;}},{key:"cornerIteration",get:function(){return this._cornerIteration},set:function(t){this.setDirty(this._cornerIteration!=t),this._cornerIteration=t;}},{key:"modifyStyle",value:function(t){return t.hasOwnProperty("color")&&this.setColor(t.color,Q("color2",t,this),Q("horizontalGradient",t,this)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,Q("strokeThickness",t,this)),t.hasOwnProperty("cornerRadius")&&this.setCornerRadius(t.cornerRadius,Q("cornerIteration",t,this)),this}},{key:"modifyPorperties",value:function(t){return u(s(h.prototype),"modifyPorperties",this).call(this,t),this.modifyStyle(t),this}},{key:"setCornerRadius",value:function(t,e){return this.cornerRadius=t,this.cornerIteration=e,this}},{key:"renderContent",value:function(){!function(t,e,i,r,n,s,h,o){if(null!=e||null!=i){var a=t.canvas.width,l=t.canvas.height;null==i&&(r=0);var u=r/2;a=Math.max(1,a-r),l=Math.max(1,l-r),at(t.canvas,t.context,u,u,a,l,n,e,i,r,s,h,o);}}(this.parent,this.color,this.stroke,this.strokeThickness,this.cornerRadius,this.color2,this.horizontalGradient,this.cornerIteration);}}]),h}(q),ct=Phaser.Utils.Objects.GetValue,dt=function(t){n(h,t);var i=a(h);function h(t,r){var n;return e(this,h),(n=i.call(this,t,"innerbounds")).setScrollFactor(0),n.setColor(ct(r,"color",null),ct(r,"color2",null),ct(r,"horizontalGradient",!0)),n.setStroke(ct(r,"stroke",null),ct(r,"strokeThickness",2)),n}return r(h,[{key:"color",get:function(){return this._color},set:function(t){t=K(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t;}},{key:"color2",get:function(){return this._color2},set:function(t){t=K(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t;}},{key:"horizontalGradient",get:function(){return this._horizontalGradient},set:function(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t;}},{key:"setColor",value:function(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}},{key:"stroke",get:function(){return this._stroke},set:function(t){t=K(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t;}},{key:"strokeThickness",get:function(){return this._strokeThickness},set:function(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t;}},{key:"setStroke",value:function(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}},{key:"modifyPorperties",value:function(t){u(s(h.prototype),"modifyPorperties",this).call(this,t),t.hasOwnProperty("color")&&this.setColor(t.color,ct(t,"color2",null),ct(t,"horizontalGradient",!0)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,ct(t,"strokeThickness",2));}},{key:"renderContent",value:function(){var t=this.parent.padding,e=t.left,i=t.top,r=this.parent.width-t.left-t.right,n=this.parent.height-t.top-t.bottom,s=this.context;if(null!=this.color){var h,o;if(null!=this.color2)(o=this.horizontalGradient?s.createLinearGradient(0,0,r,0):s.createLinearGradient(0,0,0,n)).addColorStop(0,this.color),o.addColorStop(1,this.color2),h=o;else h=this.color;s.fillStyle=h,s.fillRect(e,i,r,n);}null!=this.stroke&&this.strokeThickness>0&&(s.strokeStyle=this.stroke,s.lineWidth=this.strokeThickness,s.strokeRect(e,i,r,n));}}]),h}(q),ft=Phaser.Utils.Objects.GetValue,yt=function(){function t(i,r){e(this,t),this.parent=i,this.set(r);}return r(t,[{key:"toJSON",value:function(){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}}},{key:"set",value:function(t){return this.setBold(ft(t,"bold",!1)),this.setItalic(ft(t,"italic",!1)),this.setFontSize(ft(t,"fontSize","16px")),this.setFontFamily(ft(t,"fontFamily","Courier")),this.setColor(ft(t,"color","#fff")),this.setStrokeStyle(ft(t,"stroke",null),ft(t,"strokeThickness",0)),this.setShadow(ft(t,"shadowColor",null),ft(t,"shadowOffsetX",0),ft(t,"shadowOffsetY",0),ft(t,"shadowBlur",0)),this.setOffset(ft(t,"offsetX",0),ft(t,"offsetY",0)),this.setSpace(ft(t,"leftSpace",0),ft(t,"rightSpace",0)),this.setAlign(ft(t,"align",void 0)),this.setBackgroundColor(ft(t,"backgroundColor",null)),this.setBackgroundHeight(ft(t,"backgroundHeight",void 0)),this.setBackgroundBottomY(ft(t,"backgroundBottomY",void 0)),this}},{key:"modify",value:function(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(Q("stroke",t,this),Q("strokeThickness",t,this)),t.hasOwnProperty("shadowColor")&&this.setShadowColor(t.shadowColor),(t.hasOwnProperty("shadowOffsetX")||t.hasOwnProperty("shadowOffsetY"))&&this.setShadowOffset(Q("shadowOffsetX",t,this),Q("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}},{key:"setUpdateTextFlag",value:function(){return this.parent&&(this.parent.updateTextFlag=!0),this}},{key:"clone",value:function(){return new t(null,this.toJSON())}},{key:"copyFrom",value:function(t){return this.set(t.toJSON()),this}},{key:"copyTo",value:function(t){return t.set(this.toJSON()),this}},{key:"setBold",value:function(t){return void 0===t&&(t=!0),this.bold=t,this.setUpdateTextFlag(),this}},{key:"setItalic",value:function(t){return void 0===t&&(t=!0),this.italic=t,this.setUpdateTextFlag(),this}},{key:"fontStyle",get:function(){return this.bold&&this.italic?"bold italic":this.bold?"bold":this.italic?"italic":""}},{key:"setFontSize",value:function(t){return "number"==typeof t&&(t="".concat(t,"px")),this.fontSize=t,this.setUpdateTextFlag(),this}},{key:"setFontFamily",value:function(t){return this.fontFamily=t,this.setUpdateTextFlag(),this}},{key:"font",get:function(){return "".concat(this.fontStyle," ").concat(this.fontSize," ").concat(this.fontFamily)}},{key:"setColor",value:function(t){return this.color=K(t),this}},{key:"hasFill",get:function(){return null!=this.color}},{key:"setStrokeStyle",value:function(t,e){return this.stroke=K(t),void 0!==e&&(this.strokeThickness=e),this}},{key:"setStrokeThickness",value:function(t){return this.strokeThickness=t,this}},{key:"hasStroke",get:function(){return null!=this.stroke&&this.strokeThickness>0}},{key:"setShadowColor",value:function(t){return this.shadowColor=K(t),this}},{key:"setShadowOffset",value:function(t,e){return void 0===t&&(t=0),void 0===e&&(e=0),this.shadowOffsetX=t,this.shadowOffsetY=e,this}},{key:"setShadowBlur",value:function(t){return void 0===t&&(t=0),this.shaodwBlur=t,this}},{key:"setShadow",value:function(t,e,i,r){return this.setShadowColor(t).setShadowOffset(e,i).setShadowBlur(r),this}},{key:"setBackgroundColor",value:function(t){return this.backgroundColor=K(t),this}},{key:"hasBackgroundColor",get:function(){return null!=this.backgroundColor}},{key:"setBackgroundHeight",value:function(t){return this.backgroundHeight=t,this}},{key:"setBackgroundBottomY",value:function(t){return this.backgroundBottomY=t,this}},{key:"setOffsetX",value:function(t){return void 0===t&&(t=0),this.offsetX=t,this}},{key:"setOffsetY",value:function(t){return void 0===t&&(t=0),this.offsetY=t,this}},{key:"setOffset",value:function(t,e){return this.setOffsetX(t).setOffsetY(e),this}},{key:"setLeftSpace",value:function(t){return void 0===t&&(t=0),this.leftSpace=t,this}},{key:"setRightSpace",value:function(t){return void 0===t&&(t=0),this.rightSpace=t,this}},{key:"setSpace",value:function(t,e){return this.setLeftSpace(t).setRightSpace(e),this}},{key:"setAlign",value:function(t){return this.align=t,this}},{key:"syncFont",value:function(t){return t.font=this.font,this}},{key:"syncStyle",value:function(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}},{key:"syncShadow",value:function(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);}},{key:"getTextMetrics",value:function(t,e){return this.syncFont(t).syncStyle(t),t.measureText(e)}}]),t}(),gt=Phaser.Utils.Array.Remove,vt=Phaser.Utils.Array.Remove,pt="text",kt="image",wt="drawer",xt="space",mt="command",bt=function(t){return t.type===pt&&"\n"===t.text},St=function(t){return t.type===pt&&"\f"===t.text},Ct=function(t){return t.type===pt},Ot=function(t){n(h,t);var i=a(h);function h(t,r,n){var s;return e(this,h),(s=i.call(this,t,pt)).updateTextFlag=!1,s.style=new yt(o(s),n),s.setText(r),s}return r(h,[{key:"autoRound",get:function(){return this.parent.autoRound}},{key:"offsetX",get:function(){return this.style.offsetX},set:function(t){this.style&&(this.style.offsetX=t);}},{key:"offsetY",get:function(){return this.style.offsetY},set:function(t){this.style&&(this.style.offsetY=t);}},{key:"leftSpace",get:function(){return this.style.leftSpace*this.scaleX},set:function(t){this.style&&(this.style.leftSpace=t),d(s(h.prototype),"leftSpace",t,this,!0);}},{key:"rightSpace",get:function(){return this.style.rightSpace*this.scaleX},set:function(t){this.style&&(this.style.rightSpace=t),d(s(h.prototype),"rightSpace",t,this,!0);}},{key:"align",get:function(){return this.style.align},set:function(t){this.style&&(this.style.align=t);}},{key:"modifyStyle",value:function(t){return this.setDirty(!0),this.style.modify(t),this.updateTextFlag&&this.updateTextSize(),this}},{key:"modifyPorperties",value:function(t){return t?(this.modifyStyle(t),u(s(h.prototype),"modifyPorperties",this).call(this,t),this):this}},{key:"setText",value:function(t){return this.setDirty(this.text!=t),this.text=t,this.updateTextSize(),this}},{key:"updateTextSize",value:function(){var t=this.text;if("\n"===t||"\f"===t||""===t)this.clearTextSize();else {var e,i,r=this.style.getTextMetrics(this.context,this.text);this.textWidth=r.width,"actualBoundingBoxAscent"in r?(e=r.actualBoundingBoxAscent,i=r.actualBoundingBoxDescent):(e=0,i=0),this.textHeight=e+i,this.ascent=e,this.descent=i;}return this.updateTextFlag=!1,this}},{key:"clearTextSize",value:function(){return this.textWidth=0,this.textHeight=0,this.ascent=0,this.descent=0,this}},{key:"copyTextSize",value:function(t){return this.textWidth=t.textWidth,this.textHeight=t.textHeight,this.ascent=t.ascent,this.descent=t.descent,this}},{key:"width",get:function(){return this.textWidth*this.scaleX},set:function(t){this.textWidth>0?this.scaleX=t/this.textWidth:this.scaleX=1;}},{key:"height",get:function(){return this.textHeight*this.scaleY},set:function(t){this.textHeight>0?this.scaleY=t/this.textHeight:this.scaleY=1;}},{key:"willRender",get:function(){return 0!==this.textWidth&&u(s(h.prototype),"willRender",this)}},{key:"renderContent",value:function(){var t=this.context,e=this.style;if(e.hasBackgroundColor){t.fillStyle=e.backgroundColor;var i=this.drawTLX,r=this.drawTRX-i,n=e.backgroundBottomY;null==n&&(n=this.drawBLY);var s=e.backgroundHeight;null==s&&(s=n-this.drawTLY);var h=n-s;t.fillRect(i,h,r,s);}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)));}},{key:"drawTLX",get:function(){return -this.leftSpace}},{key:"drawTLY",get:function(){return -this.ascent}},{key:"drawBLX",get:function(){return -this.leftSpace}},{key:"drawBLY",get:function(){return this.descent}},{key:"drawTRX",get:function(){return this.textWidth+this.rightSpace}},{key:"drawTRY",get:function(){return -this.ascent}},{key:"drawBRX",get:function(){return this.textWidth+this.rightSpace}},{key:"drawBRY",get:function(){return this.descent}}]),h}(q),Tt=function(t,e){var i=this.createCharChildren(t,e);return this.addChild(i),this},Pt=function(t){n(s,t);var i=a(s);function s(t,r,n){var h;return e(this,s),(h=i.call(this,t,kt)).setTexture(r,n),h}return r(s,[{key:"frameWidth",get:function(){return this.frameObj?this.frameObj.cutWidth:0}},{key:"frameHeight",get:function(){return this.frameObj?this.frameObj.cutHeight:0}},{key:"offsetY",get:function(){return -this.height},set:function(t){}},{key:"key",get:function(){return this._key},set:function(t){this.setDirty(this._key!=t),this._key=t;}},{key:"frame",get:function(){return this._frame},set:function(t){this.setDirty(this._frame!=t),this._frame=t;}},{key:"setTexture",value:function(t,e){return this.key=t,this.frame=e,this.frameObj=this.scene.sys.textures.getFrame(t,e),this}},{key:"width",get:function(){return this.frameWidth*this.scaleX},set:function(t){this.setDirty(this.width!==t),this.scaleX=t/this.frameWidth;}},{key:"height",get:function(){return this.frameHeight*this.scaleY},set:function(t){this.setDirty(this.height!==t),this.scaleY=t/this.frameHeight;}},{key:"setHeight",value:function(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}},{key:"renderContent",value:function(){var t=this.context,e=this.frameObj,i=this.frameWidth,r=this.frameHeight;t.drawImage(e.source.image,e.cutX,e.cutY,i,r,0,0,i,r);}},{key:"drawTLX",get:function(){return -this.leftSpace}},{key:"drawTLY",get:function(){return 0}},{key:"drawBLX",get:function(){return -this.leftSpace}},{key:"drawBLY",get:function(){return this.frameHeight}},{key:"drawTRX",get:function(){return this.frameWidth+this.rightSpace}},{key:"drawTRY",get:function(){return 0}},{key:"drawBRX",get:function(){return this.frameWidth+this.rightSpace}},{key:"drawBRY",get:function(){return this.frameHeight}}]),s}(q),_t=function(t){n(h,t);var i=a(h);function h(t,r,n,s){var o;return e(this,h),(o=i.call(this,t,wt)).setRenderCallback(r),o.setDrawerSize(n,s),o}return r(h,[{key:"setRenderCallback",value:function(t){return t?this.renderContent=t.bind(this):delete this.renderContent,this}},{key:"setDrawerSize",value:function(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}},{key:"onFree",value:function(){u(s(h.prototype),"onFree",this).call(this),this.setRenderCallback();}},{key:"width",get:function(){return this.drawerWidth*this.scaleX},set:function(t){this.setDirty(this.width!==t),this.scaleX=this.drawerWidth>0?t/this.drawerWidth:1;}},{key:"height",get:function(){return this.drawerHeight*this.scaleY},set:function(t){this.setDirty(this.height!==t),this.scaleY=this.drawerHeight>0?t/this.drawerHeight:1;}},{key:"offsetY",get:function(){return -this.height},set:function(t){}},{key:"drawTLX",get:function(){return -this.leftSpace}},{key:"drawTLY",get:function(){return 0}},{key:"drawBLX",get:function(){return -this.leftSpace}},{key:"drawBLY",get:function(){return this.drawerHeight}},{key:"drawTRX",get:function(){return this.drawerWidth+this.rightSpace}},{key:"drawTRY",get:function(){return 0}},{key:"drawBRX",get:function(){return this.drawerWidth+this.rightSpace}},{key:"drawBRY",get:function(){return this.drawerHeight}}]),h}(q),Yt=function(t){n(s,t);var i=a(s);function s(t,r){var n;return e(this,s),(n=i.call(this,t,xt)).setSpaceWidth(r),n}return r(s,[{key:"width",get:function(){return this.spaceWidth*this.scaleX},set:function(t){this.spaceWidth>0?this.scaleX=t/this.spaceWidth:this.scaleX=1;}},{key:"setSpaceWidth",value:function(t){return this.spaceWidth=t,this}}]),s}(q),Xt=function(t){n(h,t);var i=a(h);function h(t,r,n,s,o){var a;return e(this,h),(a=i.call(this,t,mt)).setName(r).setParameter(s).setCallback(n,o),a}return r(h,[{key:"setName",value:function(t){return this.name=t,this}},{key:"setParameter",value:function(t){return this.param=t,this}},{key:"setCallback",value:function(t,e){return this.callback=t,this.scope=e,this}},{key:"exec",value:function(){return this.scope?this.callback.call(this.scope,this.param,this.name):this.callback(this.param,this.name)}},{key:"onFree",value:function(){u(s(h.prototype),"onFree",this).call(this),this.setName().setCallback().setParameter();}}]),h}(Y),Rt=function e(i){var r,n,s;if(null==i||"object"!==t(i))return i;if(r=Array.isArray(i)?[]:{},function(e){if("object"!==t(e)||e.nodeType||e===e.window)return !1;try{if(e.constructor&&!{}.hasOwnProperty.call(e.constructor.prototype,"isPrototypeOf"))return !1}catch(t){return !1}return !0}(i))for(s in i)n=i[s],r[s]=e(n);else r=i;return r},Bt=function(t,e,i,r){void 0===r&&(r={word:[],width:0}),r.word.length=0;for(var n=t.length,s=e,h=r.word,o=0;s0&&!o){var a=this.fixedHeight-r;if(i>0)s=a/i;else s=(l=Dt.call(this)).height,h=l.ascent,i=Math.floor((a-h)/s);}else {var l;s=(l=Dt.call(this)).height,h=l.ascent;}}else if(this.fixedHeight>0){if(void 0===(i=Ht(t,"maxLines"))){a=this.fixedHeight-r;i=Math.floor(a/s);}}else i=Ht(t,"maxLines",0);void 0===h&&(h=s);var u=0===i,c=Ht(t,"wrapWidth",void 0);void 0===c&&(c=this.fixedWidth>0?this.fixedWidth-n:1/0);for(var d=Ht(t,"letterSpacing",0),f=Ht(t,"hAlign",0),y=Ht(t,"vAlign",0),g=Ht(t,"charWrap",!1),v={callback:"runWordWrap",start:e,isLastPage:!1,padding:this.wrapPadding,ascent:h,lineHeight:s,maxLines:i,wrapWidth:c,letterSpacing:d,hAlign:f,vAlign:y,charWrap:g,children:[],lines:[],maxLineWidth:0,linesHeight:0},p=this.children,k=0,w=p.length;k0&&(Y.push({children:X,width:R}),B=Math.max(B,R)),v.start+=_.length,v.isLastPage=!A&&v.start===T,v.maxLineWidth=B,v.linesHeight=Y.length*s;var j=this.fixedWidth>0?this.fixedWidth:v.maxLineWidth+n,z=this.fixedHeight>0?this.fixedHeight:v.linesHeight+r;!function(t,e,i){var r,n,s=t.hAlign,h=t.vAlign,o=t.linesHeight;switch(h){case 1:case"center":n=(i-o)/2;break;case 2:case"bottom":n=i-o;break;default:n=0;}for(var a=t.lines,l=0,u=a.length;l0?(h=this.fixedWidth-n)/i:0;else if(this.fixedWidth>0){if(void 0===(i=jt(t,"maxLines",void 0))){var h=this.fixedWidth-n;i=Math.floor(h/s)+1;}}else i=jt(t,"maxLines",0);var o=0===i,a=jt(t,"fixedChildHeight",void 0);if(void 0===a){var l=jt(t,"charPerLine",void 0);if(void 0!==l){var u=this.fixedHeight-r;a=Math.floor(u/l);}}var c=jt(t,"wrapHeight",void 0);void 0===c&&(c=this.fixedHeight>0?this.fixedHeight-r:1/0);for(var d=jt(t,"letterSpacing",0),f=jt(t,"rtl",!0),y=jt(t,"hAlign",f?2:0),g=jt(t,"vAlign",0),v={callback:"runVerticalWrap",start:e,isLastPage:!1,padding:this.wrapPadding,lineWidth:s,maxLines:i,fixedChildHeight:a,wrapHeight:c,letterSpacing:d,hAlign:y,vAlign:g,rtl:f,children:[],lines:[],maxLineHeight:0,linesWidth:0},p=this.children,k=0,w=p.length;k0&&(Y.push({children:X,height:R}),B=Math.max(B,R)),v.start+=_.length,v.isLastPage=v.start===T,v.maxLineHeight=B,v.linesWidth=Y.length*s;var M=this.fixedWidth>0?this.fixedWidth:v.linesWidth+n,F=this.fixedHeight>0?this.fixedHeight:v.maxLineHeight+r;!function(t,e,i){var r,n,s=t.hAlign,h=t.vAlign,o=t.rtl,a=t.lines,l=t.lineWidth,u=t.linesWidth;switch(s){case 1:case"center":r=(e-u)/2;break;case 2:case"right":r=e-u;break;default:r=0;}o&&(r+=l);for(var c=0,d=a.length;c0?t:this.width,e>0?e:this.height),this):this},setPadding:function(t,e){var i=this.padding,r=i.left,n=i.right,s=i.top,h=i.bottom;return P(i,t,e),this.dirty=this.dirty||r!=i.left||n!=i.right||s!=i.top||h!=i.bottom,this},getPadding:function(t){return function(t,e){return void 0===e?t:t[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),gt(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 vt(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,r,n,s=Array.isArray(t);void 0===e||e===this.children.length?s?(i=this.children).push.apply(i,f(t)):this.children.push(t):s?(r=this.children).splice.apply(r,[e,0].concat(f(t))):this.children.splice(e,0,t);(this.lastAppendedChildren.length=0,s)?(n=this.lastAppendedChildren).push.apply(n,f(t)):this.lastAppendedChildren.push(t);return this},createCharChild:function(t,e){e&&this.textStyle.modify(e);var i=this.poolManager.allocate(pt);return null===i?i=new Ot(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=[],r=0,n=t.length;re&&(r=e,n=t);})),n},getCharWorldPosition:function(t,e,i,r){return "number"==typeof t&&(t=this.getCharChild(t,!0)),U(this,t,e,i,r)},setToMinSize:function(){for(var t=this.children,e=0,i=0,r=0,n=t.length;r=i.length&&(t=i.length);for(var r=0,n=0;n0?this.items.pop():null}},{key:"push",value:function(t){return this.items.push(t),this}},{key:"pushMultiple",value:function(t){return this.items.push.apply(this.items,t),t.length=0,this}},{key:"clear",value:function(){return this.items.length=0,this}}]),t}(),oe=Phaser.Utils.Objects.GetFastValue,ae={},le=function(){function t(i){e(this,t),this.pools=oe(i,"pools",ae);}return r(t,[{key:"free",value:function(t){if(!this.pools)return this;var e=t.type;return this.pools.hasOwnProperty(e)||(this.pools[e]=new he),this.pools[e].push(t),t.onFree(),this}},{key:"freeMultiple",value:function(t){if(!this.pools)return this;for(var e=0,i=t.length;et.length)&&(e=t.length);for(var i=0,r=new Array(e);i0}},{key:"drawX",get:function(){var t=this.x+this.leftSpace+this.offsetX-this.originX*this.width;return this.parent._textOX*this.scrollFactorX+t}},{key:"drawY",get:function(){var t=this.y+this.offsetY;return this.parent._textOY*this.scrollFactorY+t}},{key:"drawTLX",get:function(){return 0}},{key:"drawTLY",get:function(){return 0}},{key:"drawBLX",get:function(){return 0}},{key:"drawBLY",get:function(){return 0}},{key:"drawTRX",get:function(){return 0}},{key:"drawTRY",get:function(){return 0}},{key:"drawBRX",get:function(){return 0}},{key:"drawBRY",get:function(){return 0}},{key:"drawCenterX",get:function(){return (this.drawTRX+this.drawTLX)/2}},{key:"drawCenterY",get:function(){return (this.drawBLY+this.drawTLY)/2}}]),s}(Y);Object.assign(q.prototype,E);var $=Phaser.Utils.String.Pad,K=function(e,i,r){if(null==e)return e;switch(t(e)){case"string":default:return e;case"number":return "#".concat($(Math.floor(e).toString(16),6,"0",1));case"function":return e(i,r);case"object":return e.hasOwnProperty("r")?e.hasOwnProperty("a")?"rgba(".concat(e.r,",").concat(e.g,",").concat(e.b,",").concat(e.a,")"):"rgb(".concat(e.r,",").concat(e.g,",").concat(e.b,")"):e.hasOwnProperty("h")?e.hasOwnProperty("a")?"hsla(".concat(e.h,",").concat(e.s,",").concat(e.l,",").concat(e.a,")"):"hsl(".concat(e.h,",").concat(e.s,",").concat(e.l,")"):e}},Q=function(t,e,i){return e.hasOwnProperty(t)?e[t]:i[t]},Z=Phaser.Utils.Objects.GetValue,tt=function(){function t(i,r,n,s,h){e(this,t),void 0===i&&(i=0),void 0===r&&(r=i),void 0===n&&(n=0),void 0===s&&(s=0),void 0===h&&(h=0),this.cornerRadius={},this._width=0,this._height=0,this.setTo(i,r,n,s,h);}return r(t,[{key:"setTo",value:function(t,e,i,r,n){return this.setPosition(t,e),this.setRadius(n),this.setSize(i,r),this}},{key:"setPosition",value:function(t,e){return this.x=t,this.y=e,this}},{key:"setRadius",value:function(t){return void 0===t&&(t=0),this.radius=t,this}},{key:"setSize",value:function(t,e){return this.width=t,this.height=e,this}},{key:"minWidth",get:function(){var t=this.cornerRadius;return Math.max(t.tl.x+t.tr.x,t.bl.x+t.br.x)}},{key:"minHeight",get:function(){var t=this.cornerRadius;return Math.max(t.tl.y+t.bl.y,t.tr.y+t.br.y)}},{key:"width",get:function(){return this._width},set:function(t){null==t&&(t=0),this._width=Math.max(t,this.minWidth);}},{key:"height",get:function(){return this._height},set:function(t){null==t&&(t=0),this._height=Math.max(t,this.minHeight);}},{key:"radius",get:function(){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:function(t){var e,i;"number"==typeof t?(e=t,i=t):(e=Z(t,"x",0),i=Z(t,"y",0));var r=this.cornerRadius;r.tl=et(Z(t,"tl",void 0),e,i),r.tr=et(Z(t,"tr",void 0),e,i),r.bl=et(Z(t,"bl",void 0),e,i),r.br=et(Z(t,"br",void 0),e,i);}},{key:"radiusTL",get:function(){var t=this.cornerRadius.tl;return Math.max(t.x,t.y)},set:function(t){it(this.cornerRadius.tl,t);}},{key:"radiusTR",get:function(){var t=this.cornerRadius.tr;return Math.max(t.x,t.y)},set:function(t){it(this.cornerRadius.tr,t);}},{key:"radiusBL",get:function(){var t=this.cornerRadius.bl;return Math.max(t.x,t.y)},set:function(t){it(this.cornerRadius.bl,t);}},{key:"radiusBR",get:function(){var t=this.cornerRadius.br;return Math.max(t.x,t.y)},set:function(t){it(this.cornerRadius.br,t);}}]),t}(),et=function(t,e,i){return void 0===t?t={x:e,y:i}:"number"==typeof t&&(t={x:t,y:t}),rt(t),t},it=function(t,e){"number"==typeof e?(t.x=e,t.y=e):(t.x=Z(e,"x",0),t.y=Z(e,"y",0)),rt(t);},rt=function(t){t.convex=t.x>=0||t.y>=0,t.x=Math.abs(t.x),t.y=Math.abs(t.y);},nt=Phaser.Math.DegToRad,st=function(t){return !t.hasOwnProperty("convex")||t.convex},ht=function(t){return t.x>0&&t.y>0},ot=function(t,e,i,r,n,s,h,o,a){if(o&&h>s?h-=360:!o&&h=f?1:r/f,v=n>=y?1:n/y,p=d.cornerRadius;t.save(),t.beginPath(),t.translate(e,i),o=p.tl,ht(o)?(a=o.x*g,l=o.y*v,st(o)?ot(t,a,l,a,l,180,270,!1,h):ot(t,0,0,a,l,90,0,!0,h),u=0,c=l):(t.lineTo(0,0),u=0,c=0),o=p.tr,ht(o)?(a=o.x*g,l=o.y*v,st(o)?ot(t,r-a,l,a,l,270,360,!1,h):ot(t,r,0,a,l,180,90,!0,h)):t.lineTo(r,0),o=p.br,ht(o)?(a=o.x*g,l=o.y*v,st(o)?ot(t,r-a,n-l,a,l,0,90,!1,h):ot(t,r,n,a,l,270,180,!0,h)):t.lineTo(r,n),o=p.bl,ht(o)?(a=o.x*g,l=o.y*v,st(o)?ot(t,a,n-l,a,l,90,180,!1,h):ot(t,0,n,a,l,360,270,!0,h)):t.lineTo(0,n),t.lineTo(u,c),t.closePath(),t.restore();}(e,i,r,n,s,h,d),null!=o){var f;if(null!=u)(f=c?e.createLinearGradient(0,0,n,0):e.createLinearGradient(0,0,0,s)).addColorStop(0,o),f.addColorStop(1,u),o=f;e.fillStyle=o,e.fill();}null!=a&&l>0&&(e.strokeStyle=a,e.lineWidth=l,e.stroke());},lt=Phaser.Utils.Objects.GetValue,ut=function(t){n(h,t);var i=a(h);function h(t,r){var n;return e(this,h),(n=i.call(this,t,"background")).setScrollFactor(0),n.setColor(lt(r,"color",null),lt(r,"color2",null),lt(r,"horizontalGradient",!0)),n.setStroke(lt(r,"stroke",null),lt(r,"strokeThickness",2)),n.setCornerRadius(lt(r,"cornerRadius",0),lt(r,"cornerIteration",null)),n}return r(h,[{key:"color",get:function(){return this._color},set:function(t){t=K(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t;}},{key:"color2",get:function(){return this._color2},set:function(t){t=K(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t;}},{key:"horizontalGradient",get:function(){return this._horizontalGradient},set:function(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t;}},{key:"setColor",value:function(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}},{key:"stroke",get:function(){return this._stroke},set:function(t){t=K(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t;}},{key:"strokeThickness",get:function(){return this._strokeThickness},set:function(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t;}},{key:"setStroke",value:function(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}},{key:"cornerRadius",get:function(){return this._cornerRadius},set:function(t){this.setDirty(this._cornerRadius!=t),this._cornerRadius=t;}},{key:"cornerIteration",get:function(){return this._cornerIteration},set:function(t){this.setDirty(this._cornerIteration!=t),this._cornerIteration=t;}},{key:"modifyStyle",value:function(t){return t.hasOwnProperty("color")&&this.setColor(t.color,Q("color2",t,this),Q("horizontalGradient",t,this)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,Q("strokeThickness",t,this)),t.hasOwnProperty("cornerRadius")&&this.setCornerRadius(t.cornerRadius,Q("cornerIteration",t,this)),this}},{key:"modifyPorperties",value:function(t){return u(s(h.prototype),"modifyPorperties",this).call(this,t),this.modifyStyle(t),this}},{key:"setCornerRadius",value:function(t,e){return this.cornerRadius=t,this.cornerIteration=e,this}},{key:"renderContent",value:function(){!function(t,e,i,r,n,s,h,o){if(null!=e||null!=i){var a=t.canvas.width,l=t.canvas.height;null==i&&(r=0);var u=r/2;a=Math.max(1,a-r),l=Math.max(1,l-r),at(t.canvas,t.context,u,u,a,l,n,e,i,r,s,h,o);}}(this.parent,this.color,this.stroke,this.strokeThickness,this.cornerRadius,this.color2,this.horizontalGradient,this.cornerIteration);}}]),h}(q),ct=Phaser.Utils.Objects.GetValue,dt=function(t){n(h,t);var i=a(h);function h(t,r){var n;return e(this,h),(n=i.call(this,t,"innerbounds")).setScrollFactor(0),n.setColor(ct(r,"color",null),ct(r,"color2",null),ct(r,"horizontalGradient",!0)),n.setStroke(ct(r,"stroke",null),ct(r,"strokeThickness",2)),n}return r(h,[{key:"color",get:function(){return this._color},set:function(t){t=K(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t;}},{key:"color2",get:function(){return this._color2},set:function(t){t=K(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t;}},{key:"horizontalGradient",get:function(){return this._horizontalGradient},set:function(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t;}},{key:"setColor",value:function(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}},{key:"stroke",get:function(){return this._stroke},set:function(t){t=K(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t;}},{key:"strokeThickness",get:function(){return this._strokeThickness},set:function(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t;}},{key:"setStroke",value:function(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}},{key:"modifyPorperties",value:function(t){u(s(h.prototype),"modifyPorperties",this).call(this,t),t.hasOwnProperty("color")&&this.setColor(t.color,ct(t,"color2",null),ct(t,"horizontalGradient",!0)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,ct(t,"strokeThickness",2));}},{key:"renderContent",value:function(){var t=this.parent.padding,e=t.left,i=t.top,r=this.parent.width-t.left-t.right,n=this.parent.height-t.top-t.bottom,s=this.context;if(null!=this.color){var h,o;if(null!=this.color2)(o=this.horizontalGradient?s.createLinearGradient(0,0,r,0):s.createLinearGradient(0,0,0,n)).addColorStop(0,this.color),o.addColorStop(1,this.color2),h=o;else h=this.color;s.fillStyle=h,s.fillRect(e,i,r,n);}null!=this.stroke&&this.strokeThickness>0&&(s.strokeStyle=this.stroke,s.lineWidth=this.strokeThickness,s.strokeRect(e,i,r,n));}}]),h}(q),ft=Phaser.Utils.Objects.GetValue,yt=function(){function t(i,r){e(this,t),this.parent=i,this.set(r);}return r(t,[{key:"toJSON",value:function(){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}}},{key:"set",value:function(t){return this.setBold(ft(t,"bold",!1)),this.setItalic(ft(t,"italic",!1)),this.setFontSize(ft(t,"fontSize","16px")),this.setFontFamily(ft(t,"fontFamily","Courier")),this.setColor(ft(t,"color","#fff")),this.setStrokeStyle(ft(t,"stroke",null),ft(t,"strokeThickness",0)),this.setShadow(ft(t,"shadowColor",null),ft(t,"shadowOffsetX",0),ft(t,"shadowOffsetY",0),ft(t,"shadowBlur",0)),this.setOffset(ft(t,"offsetX",0),ft(t,"offsetY",0)),this.setSpace(ft(t,"leftSpace",0),ft(t,"rightSpace",0)),this.setAlign(ft(t,"align",void 0)),this.setBackgroundColor(ft(t,"backgroundColor",null)),this.setBackgroundHeight(ft(t,"backgroundHeight",void 0)),this.setBackgroundBottomY(ft(t,"backgroundBottomY",void 0)),this}},{key:"modify",value:function(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(Q("stroke",t,this),Q("strokeThickness",t,this)),t.hasOwnProperty("shadowColor")&&this.setShadowColor(t.shadowColor),(t.hasOwnProperty("shadowOffsetX")||t.hasOwnProperty("shadowOffsetY"))&&this.setShadowOffset(Q("shadowOffsetX",t,this),Q("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}},{key:"setUpdateTextFlag",value:function(){return this.parent&&(this.parent.updateTextFlag=!0),this}},{key:"clone",value:function(){return new t(null,this.toJSON())}},{key:"copyFrom",value:function(t){return this.set(t.toJSON()),this}},{key:"copyTo",value:function(t){return t.set(this.toJSON()),this}},{key:"setBold",value:function(t){return void 0===t&&(t=!0),this.bold=t,this.setUpdateTextFlag(),this}},{key:"setItalic",value:function(t){return void 0===t&&(t=!0),this.italic=t,this.setUpdateTextFlag(),this}},{key:"fontStyle",get:function(){return this.bold&&this.italic?"bold italic":this.bold?"bold":this.italic?"italic":""}},{key:"setFontSize",value:function(t){return "number"==typeof t&&(t="".concat(t,"px")),this.fontSize=t,this.setUpdateTextFlag(),this}},{key:"setFontFamily",value:function(t){return this.fontFamily=t,this.setUpdateTextFlag(),this}},{key:"font",get:function(){return "".concat(this.fontStyle," ").concat(this.fontSize," ").concat(this.fontFamily)}},{key:"setColor",value:function(t){return this.color=K(t),this}},{key:"hasFill",get:function(){return null!=this.color}},{key:"setStrokeStyle",value:function(t,e){return this.stroke=K(t),void 0!==e&&(this.strokeThickness=e),this}},{key:"setStrokeThickness",value:function(t){return this.strokeThickness=t,this}},{key:"hasStroke",get:function(){return null!=this.stroke&&this.strokeThickness>0}},{key:"setShadowColor",value:function(t){return this.shadowColor=K(t),this}},{key:"setShadowOffset",value:function(t,e){return void 0===t&&(t=0),void 0===e&&(e=0),this.shadowOffsetX=t,this.shadowOffsetY=e,this}},{key:"setShadowBlur",value:function(t){return void 0===t&&(t=0),this.shaodwBlur=t,this}},{key:"setShadow",value:function(t,e,i,r){return this.setShadowColor(t).setShadowOffset(e,i).setShadowBlur(r),this}},{key:"setBackgroundColor",value:function(t){return this.backgroundColor=K(t),this}},{key:"hasBackgroundColor",get:function(){return null!=this.backgroundColor}},{key:"setBackgroundHeight",value:function(t){return this.backgroundHeight=t,this}},{key:"setBackgroundBottomY",value:function(t){return this.backgroundBottomY=t,this}},{key:"setOffsetX",value:function(t){return void 0===t&&(t=0),this.offsetX=t,this}},{key:"setOffsetY",value:function(t){return void 0===t&&(t=0),this.offsetY=t,this}},{key:"setOffset",value:function(t,e){return this.setOffsetX(t).setOffsetY(e),this}},{key:"setLeftSpace",value:function(t){return void 0===t&&(t=0),this.leftSpace=t,this}},{key:"setRightSpace",value:function(t){return void 0===t&&(t=0),this.rightSpace=t,this}},{key:"setSpace",value:function(t,e){return this.setLeftSpace(t).setRightSpace(e),this}},{key:"setAlign",value:function(t){return this.align=t,this}},{key:"syncFont",value:function(t){return t.font=this.font,this}},{key:"syncStyle",value:function(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}},{key:"syncShadow",value:function(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);}},{key:"getTextMetrics",value:function(t,e){return this.syncFont(t).syncStyle(t),t.measureText(e)}}]),t}(),gt=Phaser.Utils.Array.Remove,vt=Phaser.Utils.Array.Remove,pt="text",kt="image",wt="drawer",xt="space",mt="command",bt=function(t){return t.type===pt&&"\n"===t.text},St=function(t){return t.type===pt&&"\f"===t.text},Ct=function(t){return t.type===pt},Ot=function(t){n(h,t);var i=a(h);function h(t,r,n){var s;return e(this,h),(s=i.call(this,t,pt)).updateTextFlag=!1,s.style=new yt(o(s),n),s.setText(r),s}return r(h,[{key:"autoRound",get:function(){return this.parent.autoRound}},{key:"offsetX",get:function(){return this.style.offsetX},set:function(t){this.style&&(this.style.offsetX=t);}},{key:"offsetY",get:function(){return this.style.offsetY},set:function(t){this.style&&(this.style.offsetY=t);}},{key:"leftSpace",get:function(){return this.style.leftSpace*this.scaleX},set:function(t){this.style&&(this.style.leftSpace=t),d(s(h.prototype),"leftSpace",t,this,!0);}},{key:"rightSpace",get:function(){return this.style.rightSpace*this.scaleX},set:function(t){this.style&&(this.style.rightSpace=t),d(s(h.prototype),"rightSpace",t,this,!0);}},{key:"align",get:function(){return this.style.align},set:function(t){this.style&&(this.style.align=t);}},{key:"modifyStyle",value:function(t){return this.setDirty(!0),this.style.modify(t),this.updateTextFlag&&this.updateTextSize(),this}},{key:"modifyPorperties",value:function(t){return t?(this.modifyStyle(t),u(s(h.prototype),"modifyPorperties",this).call(this,t),this):this}},{key:"setText",value:function(t){return this.setDirty(this.text!=t),this.text=t,this.updateTextSize(),this}},{key:"updateTextSize",value:function(){var t=this.text;if("\n"===t||"\f"===t||""===t)this.clearTextSize();else {var e,i,r=this.style.getTextMetrics(this.context,this.text);this.textWidth=r.width,"actualBoundingBoxAscent"in r?(e=r.actualBoundingBoxAscent,i=r.actualBoundingBoxDescent):(e=0,i=0),this.textHeight=e+i,this.ascent=e,this.descent=i;}return this.updateTextFlag=!1,this}},{key:"clearTextSize",value:function(){return this.textWidth=0,this.textHeight=0,this.ascent=0,this.descent=0,this}},{key:"copyTextSize",value:function(t){return this.textWidth=t.textWidth,this.textHeight=t.textHeight,this.ascent=t.ascent,this.descent=t.descent,this}},{key:"width",get:function(){return this.textWidth*this.scaleX},set:function(t){this.textWidth>0?this.scaleX=t/this.textWidth:this.scaleX=1;}},{key:"height",get:function(){return this.textHeight*this.scaleY},set:function(t){this.textHeight>0?this.scaleY=t/this.textHeight:this.scaleY=1;}},{key:"willRender",get:function(){return 0!==this.textWidth&&u(s(h.prototype),"willRender",this)}},{key:"renderContent",value:function(){var t=this.context,e=this.style;if(e.hasBackgroundColor){t.fillStyle=e.backgroundColor;var i=this.drawTLX,r=this.drawTRX-i,n=e.backgroundBottomY;null==n&&(n=this.drawBLY);var s=e.backgroundHeight;null==s&&(s=n-this.drawTLY);var h=n-s;t.fillRect(i,h,r,s);}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)));}},{key:"drawTLX",get:function(){return -this.leftSpace}},{key:"drawTLY",get:function(){return -this.ascent}},{key:"drawBLX",get:function(){return -this.leftSpace}},{key:"drawBLY",get:function(){return this.descent}},{key:"drawTRX",get:function(){return this.textWidth+this.rightSpace}},{key:"drawTRY",get:function(){return -this.ascent}},{key:"drawBRX",get:function(){return this.textWidth+this.rightSpace}},{key:"drawBRY",get:function(){return this.descent}}]),h}(q),Pt=function(t,e){var i=this.createCharChildren(t,e);return this.addChild(i),this},Tt=function(t){n(s,t);var i=a(s);function s(t,r,n){var h;return e(this,s),(h=i.call(this,t,kt)).setTexture(r,n),h}return r(s,[{key:"frameWidth",get:function(){return this.frameObj?this.frameObj.cutWidth:0}},{key:"frameHeight",get:function(){return this.frameObj?this.frameObj.cutHeight:0}},{key:"offsetY",get:function(){return -this.height},set:function(t){}},{key:"key",get:function(){return this._key},set:function(t){this.setDirty(this._key!=t),this._key=t;}},{key:"frame",get:function(){return this._frame},set:function(t){this.setDirty(this._frame!=t),this._frame=t;}},{key:"setTexture",value:function(t,e){return this.key=t,this.frame=e,this.frameObj=this.scene.sys.textures.getFrame(t,e),this}},{key:"width",get:function(){return this.frameWidth*this.scaleX},set:function(t){this.setDirty(this.width!==t),this.scaleX=t/this.frameWidth;}},{key:"height",get:function(){return this.frameHeight*this.scaleY},set:function(t){this.setDirty(this.height!==t),this.scaleY=t/this.frameHeight;}},{key:"setHeight",value:function(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}},{key:"renderContent",value:function(){var t=this.context,e=this.frameObj,i=this.frameWidth,r=this.frameHeight;t.drawImage(e.source.image,e.cutX,e.cutY,i,r,0,0,i,r);}},{key:"drawTLX",get:function(){return -this.leftSpace}},{key:"drawTLY",get:function(){return 0}},{key:"drawBLX",get:function(){return -this.leftSpace}},{key:"drawBLY",get:function(){return this.frameHeight}},{key:"drawTRX",get:function(){return this.frameWidth+this.rightSpace}},{key:"drawTRY",get:function(){return 0}},{key:"drawBRX",get:function(){return this.frameWidth+this.rightSpace}},{key:"drawBRY",get:function(){return this.frameHeight}}]),s}(q),_t=function(t){n(h,t);var i=a(h);function h(t,r,n,s){var o;return e(this,h),(o=i.call(this,t,wt)).setRenderCallback(r),o.setDrawerSize(n,s),o}return r(h,[{key:"setRenderCallback",value:function(t){return t?this.renderContent=t.bind(this):delete this.renderContent,this}},{key:"setDrawerSize",value:function(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}},{key:"onFree",value:function(){u(s(h.prototype),"onFree",this).call(this),this.setRenderCallback();}},{key:"width",get:function(){return this.drawerWidth*this.scaleX},set:function(t){this.setDirty(this.width!==t),this.scaleX=this.drawerWidth>0?t/this.drawerWidth:1;}},{key:"height",get:function(){return this.drawerHeight*this.scaleY},set:function(t){this.setDirty(this.height!==t),this.scaleY=this.drawerHeight>0?t/this.drawerHeight:1;}},{key:"offsetY",get:function(){return -this.height},set:function(t){}},{key:"drawTLX",get:function(){return -this.leftSpace}},{key:"drawTLY",get:function(){return 0}},{key:"drawBLX",get:function(){return -this.leftSpace}},{key:"drawBLY",get:function(){return this.drawerHeight}},{key:"drawTRX",get:function(){return this.drawerWidth+this.rightSpace}},{key:"drawTRY",get:function(){return 0}},{key:"drawBRX",get:function(){return this.drawerWidth+this.rightSpace}},{key:"drawBRY",get:function(){return this.drawerHeight}}]),h}(q),Yt=function(t){n(s,t);var i=a(s);function s(t,r){var n;return e(this,s),(n=i.call(this,t,xt)).setSpaceWidth(r),n}return r(s,[{key:"width",get:function(){return this.spaceWidth*this.scaleX},set:function(t){this.spaceWidth>0?this.scaleX=t/this.spaceWidth:this.scaleX=1;}},{key:"setSpaceWidth",value:function(t){return this.spaceWidth=t,this}}]),s}(q),Xt=function(t){n(h,t);var i=a(h);function h(t,r,n,s,o){var a;return e(this,h),(a=i.call(this,t,mt)).setName(r).setParameter(s).setCallback(n,o),a}return r(h,[{key:"setName",value:function(t){return this.name=t,this}},{key:"setParameter",value:function(t){return this.param=t,this}},{key:"setCallback",value:function(t,e){return this.callback=t,this.scope=e,this}},{key:"exec",value:function(){return this.scope?this.callback.call(this.scope,this.param,this.name):this.callback(this.param,this.name)}},{key:"onFree",value:function(){u(s(h.prototype),"onFree",this).call(this),this.setName().setCallback().setParameter();}}]),h}(Y),Rt=function e(i){var r,n,s;if(null==i||"object"!==t(i))return i;if(r=Array.isArray(i)?[]:{},function(e){if("object"!==t(e)||e.nodeType||e===e.window)return !1;try{if(e.constructor&&!{}.hasOwnProperty.call(e.constructor.prototype,"isPrototypeOf"))return !1}catch(t){return !1}return !0}(i))for(s in i)n=i[s],r[s]=e(n);else r=i;return r},Bt=function(t,e,i,r){void 0===r&&(r={word:[],width:0}),r.word.length=0;for(var n=t.length,s=e,h=r.word,o=0;s0&&!o){var a=this.fixedHeight-r;if(i>0)s=a/i;else s=(l=Dt.call(this)).height,h=l.ascent,i=Math.floor((a-h)/s);}else {var l;s=(l=Dt.call(this)).height,h=l.ascent;}}else if(this.fixedHeight>0){if(void 0===(i=Ht(t,"maxLines"))){a=this.fixedHeight-r;i=Math.floor(a/s);}}else i=Ht(t,"maxLines",0);void 0===h&&(h=s);var u=0===i,c=Ht(t,"wrapWidth",void 0);void 0===c&&(c=this.fixedWidth>0?this.fixedWidth-n:1/0);for(var d=Ht(t,"letterSpacing",0),f=Ht(t,"hAlign",0),y=Ht(t,"vAlign",0),g=Ht(t,"charWrap",!1),v={callback:"runWordWrap",start:e,isLastPage:!1,padding:this.wrapPadding,ascent:h,lineHeight:s,maxLines:i,wrapWidth:c,letterSpacing:d,hAlign:f,vAlign:y,charWrap:g,children:[],lines:[],maxLineWidth:0,linesHeight:0},p=this.children,k=0,w=p.length;k0&&(Y.push({children:X,width:R}),B=Math.max(B,R)),v.start+=_.length,v.isLastPage=!A&&v.start===P,v.maxLineWidth=B,v.linesHeight=Y.length*s;var j=this.fixedWidth>0?this.fixedWidth:v.maxLineWidth+n,z=this.fixedHeight>0?this.fixedHeight:v.linesHeight+r;!function(t,e,i){var r,n,s=t.hAlign,h=t.vAlign,o=t.linesHeight;switch(h){case 1:case"center":n=(i-o)/2;break;case 2:case"bottom":n=i-o;break;default:n=0;}for(var a=t.lines,l=0,u=a.length;l0?(h=this.fixedWidth-n)/i:0;else if(this.fixedWidth>0){if(void 0===(i=jt(t,"maxLines",void 0))){var h=this.fixedWidth-n;i=Math.floor(h/s)+1;}}else i=jt(t,"maxLines",0);var o=0===i,a=jt(t,"fixedChildHeight",void 0);if(void 0===a){var l=jt(t,"charPerLine",void 0);if(void 0!==l){var u=this.fixedHeight-r;a=Math.floor(u/l);}}var c=jt(t,"wrapHeight",void 0);void 0===c&&(c=this.fixedHeight>0?this.fixedHeight-r:1/0);for(var d=jt(t,"letterSpacing",0),f=jt(t,"rtl",!0),y=jt(t,"hAlign",f?2:0),g=jt(t,"vAlign",0),v={callback:"runVerticalWrap",start:e,isLastPage:!1,padding:this.wrapPadding,lineWidth:s,maxLines:i,fixedChildHeight:a,wrapHeight:c,letterSpacing:d,hAlign:y,vAlign:g,rtl:f,children:[],lines:[],maxLineHeight:0,linesWidth:0},p=this.children,k=0,w=p.length;k0&&(Y.push({children:X,height:R}),B=Math.max(B,R)),v.start+=_.length,v.isLastPage=v.start===P,v.maxLineHeight=B,v.linesWidth=Y.length*s;var M=this.fixedWidth>0?this.fixedWidth:v.linesWidth+n,F=this.fixedHeight>0?this.fixedHeight:v.maxLineHeight+r;!function(t,e,i){var r,n,s=t.hAlign,h=t.vAlign,o=t.rtl,a=t.lines,l=t.lineWidth,u=t.linesWidth;switch(s){case 1:case"center":r=(e-u)/2;break;case 2:case"right":r=e-u;break;default:r=0;}o&&(r+=l);for(var c=0,d=a.length;c0?t:this.width,e>0?e:this.height),this):this},setPadding:function(t,e){var i=this.padding,r=i.left,n=i.right,s=i.top,h=i.bottom;return T(i,t,e),this.dirty=this.dirty||r!=i.left||n!=i.right||s!=i.top||h!=i.bottom,this},getPadding:function(t){return function(t,e){return void 0===e?t:t[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),gt(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 vt(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,r,n,s=Array.isArray(t);void 0===e||e===this.children.length?s?(i=this.children).push.apply(i,f(t)):this.children.push(t):s?(r=this.children).splice.apply(r,[e,0].concat(f(t))):this.children.splice(e,0,t);(this.lastAppendedChildren.length=0,s)?(n=this.lastAppendedChildren).push.apply(n,f(t)):this.lastAppendedChildren.push(t);return this},createCharChild:function(t,e){e&&this.textStyle.modify(e);var i=this.poolManager.allocate(pt);return null===i?i=new Ot(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=[],r=0,n=t.length;re&&(r=e,n=t);})),n},getCharWorldPosition:function(t,e,i,r){return "number"==typeof t&&(t=this.getCharChild(t,!0)),U(this,t,e,i,r)},setToMinSize:function(){for(var t=this.children,e=0,i=0,r=0,n=t.length;r=i.length&&(t=i.length);for(var r=0,n=0;n0?this.items.pop():null}},{key:"push",value:function(t){return this.items.push(t),this}},{key:"pushMultiple",value:function(t){return this.items.push.apply(this.items,t),t.length=0,this}},{key:"clear",value:function(){return this.items.length=0,this}}]),t}(),oe=Phaser.Utils.Objects.GetFastValue,ae={},le=function(){function t(i){e(this,t),this.pools=oe(i,"pools",ae);}return r(t,[{key:"free",value:function(t){if(!this.pools)return this;var e=t.type;return this.pools.hasOwnProperty(e)||(this.pools[e]=new he),this.pools[e].push(t),t.onFree(),this}},{key:"freeMultiple",value:function(t){if(!this.pools)return this;for(var e=0,i=t.length;e textObject.width) { - dx = textObject.width - childRightX; - } else { - dx = 0; - } - var childTopY = this.drawY + this.drawTLY; - var childBottomY = childTopY + this.height; - if (childTopY < 0) { - dy = 0 - childTopY; - } else if (childBottomY > textObject.height) { - dy = textObject.height - childBottomY; - } else { - dy = 0; - } - textObject._textOX += dx; - textObject._textOY += dy; - return this; - }; - var Methods$1 = { contains: Contains, - getWorldPosition: GetWorldPosition, - scrollTo: ScrollTo + getWorldPosition: GetWorldPosition }; Object.assign(Methods$1, RenderMethods); @@ -4060,7 +4033,6 @@ return this; } this._textOX = ox; - this.updateTexture(); return this; }, setTextOY: function setTextOY(oy) { @@ -4068,7 +4040,6 @@ return this; } this._textOY = oy; - this.updateTexture(); return this; }, setTextOXY: function setTextOXY(ox, oy) { @@ -4077,7 +4048,6 @@ } this._textOX = ox; this._textOY = oy; - this.updateTexture(); return this; }, addTextOX: function addTextOX(incX) { diff --git a/dist/rexdynamictextplugin.min.js b/dist/rexdynamictextplugin.min.js index 40a453f099..55d3510e8e 100644 --- a/dist/rexdynamictextplugin.min.js +++ b/dist/rexdynamictextplugin.min.js @@ -1 +1 @@ -!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).rexdynamictextplugin=e();}(undefined,(function(){function t(e){return t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},t(e)}function e(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){for(var i=0;it.length)&&(e=t.length);for(var i=0,r=new Array(e);ii.width?i.width-n:0;var s=this.drawY+this.drawTLY,h=s+this.height;return e=s<0?0-s:h>i.height?i.height-h:0,i._textOX+=t,i._textOY+=e,this}};Object.assign(E,D);var V=Phaser.Math.DegToRad,N=Phaser.Math.RadToDeg,J=Phaser.Utils.Objects.GetValue,q=function(t){n(s,t);var i=a(s);function s(t,r){var n;return e(this,s),(n=i.call(this,t,r)).renderable=!0,n.scrollFactorX=1,n.scrollFactorY=1,n.toLocalPosition=!0,n.originX=0,n.offsetX=0,n.offsetY=0,n}return r(s,[{key:"visible",get:function(){return this._visible},set:function(t){this.setDirty(this._visible!=t),this._visible=t;}},{key:"setVisible",value:function(t){return void 0===t&&(t=!0),this.visible=t,this}},{key:"alpha",get:function(){return this._alpha},set:function(t){this.setDirty(this._alpha!=t),this._alpha=t;}},{key:"setAlpha",value:function(t){return this.alpha=t,this}},{key:"x",get:function(){return this._x},set:function(t){this.setDirty(this._x!=t),this._x=t;}},{key:"setX",value:function(t){return this.x=t,this}},{key:"y",get:function(){return this._y},set:function(t){this.setDirty(this._y!=t),this._y=t;}},{key:"setY",value:function(t){return this.y=t,this}},{key:"setPosition",value:function(t,e){return this.x=t,this.y=e,this}},{key:"setInitialPosition",value:function(t,e){return this.x0=t,this.y0=e,this}},{key:"setScrollFactorX",value:function(t){return this.scrollFactorX=t,this}},{key:"setScrollFactorY",value:function(t){return this.scrollFactorY=t,this}},{key:"setScrollFactor",value:function(t,e){return void 0===e&&(e=t),this.scrollFactorX=t,this.scrollFactorY=e,this}},{key:"rotation",get:function(){return this._rotation},set:function(t){this.setDirty(this._rotation!=t),this._rotation=t;}},{key:"setRotation",value:function(t){return this.rotation=t,this}},{key:"angle",get:function(){return N(this._rotation)},set:function(t){this.rotation=V(t);}},{key:"setAngle",value:function(t){return this.angle=t,this}},{key:"scaleX",get:function(){return this._scaleX},set:function(t){this.setDirty(this._scaleX!==t),this._scaleX=t;}},{key:"setScaleX",value:function(t){return this.scaleX=t,this}},{key:"width",get:function(){return 0},set:function(t){}},{key:"setWidth",value:function(t,e){return void 0===e&&(e=!1),this.width=t,e&&(this.scaleY=this.scaleX),this}},{key:"leftSpace",get:function(){return this._leftSpace},set:function(t){this.setDirty(this._leftSpace!==t),this._leftSpace=t;}},{key:"setLeftSpace",value:function(t){return this.leftSpace=t,this}},{key:"rightSpace",get:function(){return this._rightSpace},set:function(t){this.setDirty(this._rightSpace!==t),this._rightSpace=t;}},{key:"setRightSpace",value:function(t){return this.rightSpace=t,this}},{key:"outerWidth",get:function(){return this.width+this.leftSpace+this.rightSpace}},{key:"scaleY",get:function(){return this._scaleY},set:function(t){this.setDirty(this._scaleY!==t),this._scaleY=t;}},{key:"setScaleY",value:function(t){return this.scaleY=t,this}},{key:"height",get:function(){return 0},set:function(t){}},{key:"setHeight",value:function(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}},{key:"setScale",value:function(t,e){return void 0===e&&(e=t),this.scaleX=t,this.scaleY=e,this}},{key:"setOrigin",value:function(t){return this.originX=t,this}},{key:"setAlign",value:function(t){return this.align=t,this}},{key:"modifyPorperties",value:function(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=J(t,"width",void 0),i=J(t,"height",void 0),r=J(t,"scaleX",void 0),n=J(t,"scaleY",void 0);return void 0!==e?void 0===i&&void 0===n?this.setWidth(e,!0):this.setWidth(e):void 0!==r&&this.setScaleX(r),void 0!==i?void 0===e&&void 0===r?this.setHeight(i,!0):this.setHeight(i):void 0!==n&&this.setScaleY(n),t.hasOwnProperty("leftSpace")&&this.setLeftSpace(t.leftSpace),t.hasOwnProperty("rightSpace")&&this.setRightSpace(t.rightSpace),t.hasOwnProperty("align")&&this.setAlign(t.align),this}},{key:"setDrawBelowCallback",value:function(t){return this.drawBelowCallback=t,this}},{key:"setDrawAboveCallback",value:function(t){return this.drawAboveCallback=t,this}},{key:"reset",value:function(){return this.setVisible().setAlpha(1).setPosition(0,0).setRotation(0).setScale(1,1).setLeftSpace(0).setRightSpace(0).setOrigin(0).setAlign().setDrawBelowCallback().setDrawAboveCallback(),this}},{key:"willRender",get:function(){return this.visible&&this.alpha>0}},{key:"drawX",get:function(){var t=this.x+this.leftSpace+this.offsetX-this.originX*this.width;return this.parent._textOX*this.scrollFactorX+t}},{key:"drawY",get:function(){var t=this.y+this.offsetY;return this.parent._textOY*this.scrollFactorY+t}},{key:"drawTLX",get:function(){return 0}},{key:"drawTLY",get:function(){return 0}},{key:"drawBLX",get:function(){return 0}},{key:"drawBLY",get:function(){return 0}},{key:"drawTRX",get:function(){return 0}},{key:"drawTRY",get:function(){return 0}},{key:"drawBRX",get:function(){return 0}},{key:"drawBRY",get:function(){return 0}},{key:"drawCenterX",get:function(){return (this.drawTRX+this.drawTLX)/2}},{key:"drawCenterY",get:function(){return (this.drawBLY+this.drawTLY)/2}}]),s}(Y);Object.assign(q.prototype,E);var $=Phaser.Utils.String.Pad,K=function(e,i,r){if(null==e)return e;switch(t(e)){case"string":default:return e;case"number":return "#".concat($(Math.floor(e).toString(16),6,"0",1));case"function":return e(i,r);case"object":return e.hasOwnProperty("r")?e.hasOwnProperty("a")?"rgba(".concat(e.r,",").concat(e.g,",").concat(e.b,",").concat(e.a,")"):"rgb(".concat(e.r,",").concat(e.g,",").concat(e.b,")"):e.hasOwnProperty("h")?e.hasOwnProperty("a")?"hsla(".concat(e.h,",").concat(e.s,",").concat(e.l,",").concat(e.a,")"):"hsl(".concat(e.h,",").concat(e.s,",").concat(e.l,")"):e}},Q=function(t,e,i){return e.hasOwnProperty(t)?e[t]:i[t]},Z=Phaser.Utils.Objects.GetValue,tt=function(){function t(i,r,n,s,h){e(this,t),void 0===i&&(i=0),void 0===r&&(r=i),void 0===n&&(n=0),void 0===s&&(s=0),void 0===h&&(h=0),this.cornerRadius={},this._width=0,this._height=0,this.setTo(i,r,n,s,h);}return r(t,[{key:"setTo",value:function(t,e,i,r,n){return this.setPosition(t,e),this.setRadius(n),this.setSize(i,r),this}},{key:"setPosition",value:function(t,e){return this.x=t,this.y=e,this}},{key:"setRadius",value:function(t){return void 0===t&&(t=0),this.radius=t,this}},{key:"setSize",value:function(t,e){return this.width=t,this.height=e,this}},{key:"minWidth",get:function(){var t=this.cornerRadius;return Math.max(t.tl.x+t.tr.x,t.bl.x+t.br.x)}},{key:"minHeight",get:function(){var t=this.cornerRadius;return Math.max(t.tl.y+t.bl.y,t.tr.y+t.br.y)}},{key:"width",get:function(){return this._width},set:function(t){null==t&&(t=0),this._width=Math.max(t,this.minWidth);}},{key:"height",get:function(){return this._height},set:function(t){null==t&&(t=0),this._height=Math.max(t,this.minHeight);}},{key:"radius",get:function(){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:function(t){var e,i;"number"==typeof t?(e=t,i=t):(e=Z(t,"x",0),i=Z(t,"y",0));var r=this.cornerRadius;r.tl=et(Z(t,"tl",void 0),e,i),r.tr=et(Z(t,"tr",void 0),e,i),r.bl=et(Z(t,"bl",void 0),e,i),r.br=et(Z(t,"br",void 0),e,i);}},{key:"radiusTL",get:function(){var t=this.cornerRadius.tl;return Math.max(t.x,t.y)},set:function(t){it(this.cornerRadius.tl,t);}},{key:"radiusTR",get:function(){var t=this.cornerRadius.tr;return Math.max(t.x,t.y)},set:function(t){it(this.cornerRadius.tr,t);}},{key:"radiusBL",get:function(){var t=this.cornerRadius.bl;return Math.max(t.x,t.y)},set:function(t){it(this.cornerRadius.bl,t);}},{key:"radiusBR",get:function(){var t=this.cornerRadius.br;return Math.max(t.x,t.y)},set:function(t){it(this.cornerRadius.br,t);}}]),t}(),et=function(t,e,i){return void 0===t?t={x:e,y:i}:"number"==typeof t&&(t={x:t,y:t}),rt(t),t},it=function(t,e){"number"==typeof e?(t.x=e,t.y=e):(t.x=Z(e,"x",0),t.y=Z(e,"y",0)),rt(t);},rt=function(t){t.convex=t.x>=0||t.y>=0,t.x=Math.abs(t.x),t.y=Math.abs(t.y);},nt=Phaser.Math.DegToRad,st=function(t){return !t.hasOwnProperty("convex")||t.convex},ht=function(t){return t.x>0&&t.y>0},ot=function(t,e,i,r,n,s,h,o,a){if(o&&h>s?h-=360:!o&&h=f?1:r/f,v=n>=y?1:n/y,p=d.cornerRadius;t.save(),t.beginPath(),t.translate(e,i),o=p.tl,ht(o)?(a=o.x*g,l=o.y*v,st(o)?ot(t,a,l,a,l,180,270,!1,h):ot(t,0,0,a,l,90,0,!0,h),u=0,c=l):(t.lineTo(0,0),u=0,c=0),o=p.tr,ht(o)?(a=o.x*g,l=o.y*v,st(o)?ot(t,r-a,l,a,l,270,360,!1,h):ot(t,r,0,a,l,180,90,!0,h)):t.lineTo(r,0),o=p.br,ht(o)?(a=o.x*g,l=o.y*v,st(o)?ot(t,r-a,n-l,a,l,0,90,!1,h):ot(t,r,n,a,l,270,180,!0,h)):t.lineTo(r,n),o=p.bl,ht(o)?(a=o.x*g,l=o.y*v,st(o)?ot(t,a,n-l,a,l,90,180,!1,h):ot(t,0,n,a,l,360,270,!0,h)):t.lineTo(0,n),t.lineTo(u,c),t.closePath(),t.restore();}(e,i,r,n,s,h,d),null!=o){var f;if(null!=u)(f=c?e.createLinearGradient(0,0,n,0):e.createLinearGradient(0,0,0,s)).addColorStop(0,o),f.addColorStop(1,u),o=f;e.fillStyle=o,e.fill();}null!=a&&l>0&&(e.strokeStyle=a,e.lineWidth=l,e.stroke());},lt=Phaser.Utils.Objects.GetValue,ut=function(t){n(h,t);var i=a(h);function h(t,r){var n;return e(this,h),(n=i.call(this,t,"background")).setScrollFactor(0),n.setColor(lt(r,"color",null),lt(r,"color2",null),lt(r,"horizontalGradient",!0)),n.setStroke(lt(r,"stroke",null),lt(r,"strokeThickness",2)),n.setCornerRadius(lt(r,"cornerRadius",0),lt(r,"cornerIteration",null)),n}return r(h,[{key:"color",get:function(){return this._color},set:function(t){t=K(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t;}},{key:"color2",get:function(){return this._color2},set:function(t){t=K(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t;}},{key:"horizontalGradient",get:function(){return this._horizontalGradient},set:function(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t;}},{key:"setColor",value:function(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}},{key:"stroke",get:function(){return this._stroke},set:function(t){t=K(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t;}},{key:"strokeThickness",get:function(){return this._strokeThickness},set:function(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t;}},{key:"setStroke",value:function(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}},{key:"cornerRadius",get:function(){return this._cornerRadius},set:function(t){this.setDirty(this._cornerRadius!=t),this._cornerRadius=t;}},{key:"cornerIteration",get:function(){return this._cornerIteration},set:function(t){this.setDirty(this._cornerIteration!=t),this._cornerIteration=t;}},{key:"modifyStyle",value:function(t){return t.hasOwnProperty("color")&&this.setColor(t.color,Q("color2",t,this),Q("horizontalGradient",t,this)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,Q("strokeThickness",t,this)),t.hasOwnProperty("cornerRadius")&&this.setCornerRadius(t.cornerRadius,Q("cornerIteration",t,this)),this}},{key:"modifyPorperties",value:function(t){return u(s(h.prototype),"modifyPorperties",this).call(this,t),this.modifyStyle(t),this}},{key:"setCornerRadius",value:function(t,e){return this.cornerRadius=t,this.cornerIteration=e,this}},{key:"renderContent",value:function(){!function(t,e,i,r,n,s,h,o){if(null!=e||null!=i){var a=t.canvas.width,l=t.canvas.height;null==i&&(r=0);var u=r/2;a=Math.max(1,a-r),l=Math.max(1,l-r),at(t.canvas,t.context,u,u,a,l,n,e,i,r,s,h,o);}}(this.parent,this.color,this.stroke,this.strokeThickness,this.cornerRadius,this.color2,this.horizontalGradient,this.cornerIteration);}}]),h}(q),ct=Phaser.Utils.Objects.GetValue,dt=function(t){n(h,t);var i=a(h);function h(t,r){var n;return e(this,h),(n=i.call(this,t,"innerbounds")).setScrollFactor(0),n.setColor(ct(r,"color",null),ct(r,"color2",null),ct(r,"horizontalGradient",!0)),n.setStroke(ct(r,"stroke",null),ct(r,"strokeThickness",2)),n}return r(h,[{key:"color",get:function(){return this._color},set:function(t){t=K(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t;}},{key:"color2",get:function(){return this._color2},set:function(t){t=K(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t;}},{key:"horizontalGradient",get:function(){return this._horizontalGradient},set:function(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t;}},{key:"setColor",value:function(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}},{key:"stroke",get:function(){return this._stroke},set:function(t){t=K(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t;}},{key:"strokeThickness",get:function(){return this._strokeThickness},set:function(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t;}},{key:"setStroke",value:function(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}},{key:"modifyPorperties",value:function(t){u(s(h.prototype),"modifyPorperties",this).call(this,t),t.hasOwnProperty("color")&&this.setColor(t.color,ct(t,"color2",null),ct(t,"horizontalGradient",!0)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,ct(t,"strokeThickness",2));}},{key:"renderContent",value:function(){var t=this.parent.padding,e=t.left,i=t.top,r=this.parent.width-t.left-t.right,n=this.parent.height-t.top-t.bottom,s=this.context;if(null!=this.color){var h,o;if(null!=this.color2)(o=this.horizontalGradient?s.createLinearGradient(0,0,r,0):s.createLinearGradient(0,0,0,n)).addColorStop(0,this.color),o.addColorStop(1,this.color2),h=o;else h=this.color;s.fillStyle=h,s.fillRect(e,i,r,n);}null!=this.stroke&&this.strokeThickness>0&&(s.strokeStyle=this.stroke,s.lineWidth=this.strokeThickness,s.strokeRect(e,i,r,n));}}]),h}(q),ft=Phaser.Utils.Objects.GetValue,yt=function(){function t(i,r){e(this,t),this.parent=i,this.set(r);}return r(t,[{key:"toJSON",value:function(){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}}},{key:"set",value:function(t){return this.setBold(ft(t,"bold",!1)),this.setItalic(ft(t,"italic",!1)),this.setFontSize(ft(t,"fontSize","16px")),this.setFontFamily(ft(t,"fontFamily","Courier")),this.setColor(ft(t,"color","#fff")),this.setStrokeStyle(ft(t,"stroke",null),ft(t,"strokeThickness",0)),this.setShadow(ft(t,"shadowColor",null),ft(t,"shadowOffsetX",0),ft(t,"shadowOffsetY",0),ft(t,"shadowBlur",0)),this.setOffset(ft(t,"offsetX",0),ft(t,"offsetY",0)),this.setSpace(ft(t,"leftSpace",0),ft(t,"rightSpace",0)),this.setAlign(ft(t,"align",void 0)),this.setBackgroundColor(ft(t,"backgroundColor",null)),this.setBackgroundHeight(ft(t,"backgroundHeight",void 0)),this.setBackgroundBottomY(ft(t,"backgroundBottomY",void 0)),this}},{key:"modify",value:function(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(Q("stroke",t,this),Q("strokeThickness",t,this)),t.hasOwnProperty("shadowColor")&&this.setShadowColor(t.shadowColor),(t.hasOwnProperty("shadowOffsetX")||t.hasOwnProperty("shadowOffsetY"))&&this.setShadowOffset(Q("shadowOffsetX",t,this),Q("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}},{key:"setUpdateTextFlag",value:function(){return this.parent&&(this.parent.updateTextFlag=!0),this}},{key:"clone",value:function(){return new t(null,this.toJSON())}},{key:"copyFrom",value:function(t){return this.set(t.toJSON()),this}},{key:"copyTo",value:function(t){return t.set(this.toJSON()),this}},{key:"setBold",value:function(t){return void 0===t&&(t=!0),this.bold=t,this.setUpdateTextFlag(),this}},{key:"setItalic",value:function(t){return void 0===t&&(t=!0),this.italic=t,this.setUpdateTextFlag(),this}},{key:"fontStyle",get:function(){return this.bold&&this.italic?"bold italic":this.bold?"bold":this.italic?"italic":""}},{key:"setFontSize",value:function(t){return "number"==typeof t&&(t="".concat(t,"px")),this.fontSize=t,this.setUpdateTextFlag(),this}},{key:"setFontFamily",value:function(t){return this.fontFamily=t,this.setUpdateTextFlag(),this}},{key:"font",get:function(){return "".concat(this.fontStyle," ").concat(this.fontSize," ").concat(this.fontFamily)}},{key:"setColor",value:function(t){return this.color=K(t),this}},{key:"hasFill",get:function(){return null!=this.color}},{key:"setStrokeStyle",value:function(t,e){return this.stroke=K(t),void 0!==e&&(this.strokeThickness=e),this}},{key:"setStrokeThickness",value:function(t){return this.strokeThickness=t,this}},{key:"hasStroke",get:function(){return null!=this.stroke&&this.strokeThickness>0}},{key:"setShadowColor",value:function(t){return this.shadowColor=K(t),this}},{key:"setShadowOffset",value:function(t,e){return void 0===t&&(t=0),void 0===e&&(e=0),this.shadowOffsetX=t,this.shadowOffsetY=e,this}},{key:"setShadowBlur",value:function(t){return void 0===t&&(t=0),this.shaodwBlur=t,this}},{key:"setShadow",value:function(t,e,i,r){return this.setShadowColor(t).setShadowOffset(e,i).setShadowBlur(r),this}},{key:"setBackgroundColor",value:function(t){return this.backgroundColor=K(t),this}},{key:"hasBackgroundColor",get:function(){return null!=this.backgroundColor}},{key:"setBackgroundHeight",value:function(t){return this.backgroundHeight=t,this}},{key:"setBackgroundBottomY",value:function(t){return this.backgroundBottomY=t,this}},{key:"setOffsetX",value:function(t){return void 0===t&&(t=0),this.offsetX=t,this}},{key:"setOffsetY",value:function(t){return void 0===t&&(t=0),this.offsetY=t,this}},{key:"setOffset",value:function(t,e){return this.setOffsetX(t).setOffsetY(e),this}},{key:"setLeftSpace",value:function(t){return void 0===t&&(t=0),this.leftSpace=t,this}},{key:"setRightSpace",value:function(t){return void 0===t&&(t=0),this.rightSpace=t,this}},{key:"setSpace",value:function(t,e){return this.setLeftSpace(t).setRightSpace(e),this}},{key:"setAlign",value:function(t){return this.align=t,this}},{key:"syncFont",value:function(t){return t.font=this.font,this}},{key:"syncStyle",value:function(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}},{key:"syncShadow",value:function(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);}},{key:"getTextMetrics",value:function(t,e){return this.syncFont(t).syncStyle(t),t.measureText(e)}}]),t}(),gt=Phaser.Utils.Array.Remove,vt=Phaser.Utils.Array.Remove,pt="text",kt="image",wt="drawer",xt="space",mt="command",bt=function(t){return t.type===pt&&"\n"===t.text},St=function(t){return t.type===pt&&"\f"===t.text},Ct=function(t){return t.type===pt},Ot=function(t){n(h,t);var i=a(h);function h(t,r,n){var s;return e(this,h),(s=i.call(this,t,pt)).updateTextFlag=!1,s.style=new yt(o(s),n),s.setText(r),s}return r(h,[{key:"autoRound",get:function(){return this.parent.autoRound}},{key:"offsetX",get:function(){return this.style.offsetX},set:function(t){this.style&&(this.style.offsetX=t);}},{key:"offsetY",get:function(){return this.style.offsetY},set:function(t){this.style&&(this.style.offsetY=t);}},{key:"leftSpace",get:function(){return this.style.leftSpace*this.scaleX},set:function(t){this.style&&(this.style.leftSpace=t),d(s(h.prototype),"leftSpace",t,this,!0);}},{key:"rightSpace",get:function(){return this.style.rightSpace*this.scaleX},set:function(t){this.style&&(this.style.rightSpace=t),d(s(h.prototype),"rightSpace",t,this,!0);}},{key:"align",get:function(){return this.style.align},set:function(t){this.style&&(this.style.align=t);}},{key:"modifyStyle",value:function(t){return this.setDirty(!0),this.style.modify(t),this.updateTextFlag&&this.updateTextSize(),this}},{key:"modifyPorperties",value:function(t){return t?(this.modifyStyle(t),u(s(h.prototype),"modifyPorperties",this).call(this,t),this):this}},{key:"setText",value:function(t){return this.setDirty(this.text!=t),this.text=t,this.updateTextSize(),this}},{key:"updateTextSize",value:function(){var t=this.text;if("\n"===t||"\f"===t||""===t)this.clearTextSize();else {var e,i,r=this.style.getTextMetrics(this.context,this.text);this.textWidth=r.width,"actualBoundingBoxAscent"in r?(e=r.actualBoundingBoxAscent,i=r.actualBoundingBoxDescent):(e=0,i=0),this.textHeight=e+i,this.ascent=e,this.descent=i;}return this.updateTextFlag=!1,this}},{key:"clearTextSize",value:function(){return this.textWidth=0,this.textHeight=0,this.ascent=0,this.descent=0,this}},{key:"copyTextSize",value:function(t){return this.textWidth=t.textWidth,this.textHeight=t.textHeight,this.ascent=t.ascent,this.descent=t.descent,this}},{key:"width",get:function(){return this.textWidth*this.scaleX},set:function(t){this.textWidth>0?this.scaleX=t/this.textWidth:this.scaleX=1;}},{key:"height",get:function(){return this.textHeight*this.scaleY},set:function(t){this.textHeight>0?this.scaleY=t/this.textHeight:this.scaleY=1;}},{key:"willRender",get:function(){return 0!==this.textWidth&&u(s(h.prototype),"willRender",this)}},{key:"renderContent",value:function(){var t=this.context,e=this.style;if(e.hasBackgroundColor){t.fillStyle=e.backgroundColor;var i=this.drawTLX,r=this.drawTRX-i,n=e.backgroundBottomY;null==n&&(n=this.drawBLY);var s=e.backgroundHeight;null==s&&(s=n-this.drawTLY);var h=n-s;t.fillRect(i,h,r,s);}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)));}},{key:"drawTLX",get:function(){return -this.leftSpace}},{key:"drawTLY",get:function(){return -this.ascent}},{key:"drawBLX",get:function(){return -this.leftSpace}},{key:"drawBLY",get:function(){return this.descent}},{key:"drawTRX",get:function(){return this.textWidth+this.rightSpace}},{key:"drawTRY",get:function(){return -this.ascent}},{key:"drawBRX",get:function(){return this.textWidth+this.rightSpace}},{key:"drawBRY",get:function(){return this.descent}}]),h}(q),Pt=function(t,e){var i=this.createCharChildren(t,e);return this.addChild(i),this},Tt=function(t){n(s,t);var i=a(s);function s(t,r,n){var h;return e(this,s),(h=i.call(this,t,kt)).setTexture(r,n),h}return r(s,[{key:"frameWidth",get:function(){return this.frameObj?this.frameObj.cutWidth:0}},{key:"frameHeight",get:function(){return this.frameObj?this.frameObj.cutHeight:0}},{key:"offsetY",get:function(){return -this.height},set:function(t){}},{key:"key",get:function(){return this._key},set:function(t){this.setDirty(this._key!=t),this._key=t;}},{key:"frame",get:function(){return this._frame},set:function(t){this.setDirty(this._frame!=t),this._frame=t;}},{key:"setTexture",value:function(t,e){return this.key=t,this.frame=e,this.frameObj=this.scene.sys.textures.getFrame(t,e),this}},{key:"width",get:function(){return this.frameWidth*this.scaleX},set:function(t){this.setDirty(this.width!==t),this.scaleX=t/this.frameWidth;}},{key:"height",get:function(){return this.frameHeight*this.scaleY},set:function(t){this.setDirty(this.height!==t),this.scaleY=t/this.frameHeight;}},{key:"setHeight",value:function(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}},{key:"renderContent",value:function(){var t=this.context,e=this.frameObj,i=this.frameWidth,r=this.frameHeight;t.drawImage(e.source.image,e.cutX,e.cutY,i,r,0,0,i,r);}},{key:"drawTLX",get:function(){return -this.leftSpace}},{key:"drawTLY",get:function(){return 0}},{key:"drawBLX",get:function(){return -this.leftSpace}},{key:"drawBLY",get:function(){return this.frameHeight}},{key:"drawTRX",get:function(){return this.frameWidth+this.rightSpace}},{key:"drawTRY",get:function(){return 0}},{key:"drawBRX",get:function(){return this.frameWidth+this.rightSpace}},{key:"drawBRY",get:function(){return this.frameHeight}}]),s}(q),_t=function(t){n(h,t);var i=a(h);function h(t,r,n,s){var o;return e(this,h),(o=i.call(this,t,wt)).setRenderCallback(r),o.setDrawerSize(n,s),o}return r(h,[{key:"setRenderCallback",value:function(t){return t?this.renderContent=t.bind(this):delete this.renderContent,this}},{key:"setDrawerSize",value:function(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}},{key:"onFree",value:function(){u(s(h.prototype),"onFree",this).call(this),this.setRenderCallback();}},{key:"width",get:function(){return this.drawerWidth*this.scaleX},set:function(t){this.setDirty(this.width!==t),this.scaleX=this.drawerWidth>0?t/this.drawerWidth:1;}},{key:"height",get:function(){return this.drawerHeight*this.scaleY},set:function(t){this.setDirty(this.height!==t),this.scaleY=this.drawerHeight>0?t/this.drawerHeight:1;}},{key:"offsetY",get:function(){return -this.height},set:function(t){}},{key:"drawTLX",get:function(){return -this.leftSpace}},{key:"drawTLY",get:function(){return 0}},{key:"drawBLX",get:function(){return -this.leftSpace}},{key:"drawBLY",get:function(){return this.drawerHeight}},{key:"drawTRX",get:function(){return this.drawerWidth+this.rightSpace}},{key:"drawTRY",get:function(){return 0}},{key:"drawBRX",get:function(){return this.drawerWidth+this.rightSpace}},{key:"drawBRY",get:function(){return this.drawerHeight}}]),h}(q),Yt=function(t){n(s,t);var i=a(s);function s(t,r){var n;return e(this,s),(n=i.call(this,t,xt)).setSpaceWidth(r),n}return r(s,[{key:"width",get:function(){return this.spaceWidth*this.scaleX},set:function(t){this.spaceWidth>0?this.scaleX=t/this.spaceWidth:this.scaleX=1;}},{key:"setSpaceWidth",value:function(t){return this.spaceWidth=t,this}}]),s}(q),Xt=function(t){n(h,t);var i=a(h);function h(t,r,n,s,o){var a;return e(this,h),(a=i.call(this,t,mt)).setName(r).setParameter(s).setCallback(n,o),a}return r(h,[{key:"setName",value:function(t){return this.name=t,this}},{key:"setParameter",value:function(t){return this.param=t,this}},{key:"setCallback",value:function(t,e){return this.callback=t,this.scope=e,this}},{key:"exec",value:function(){return this.scope?this.callback.call(this.scope,this.param,this.name):this.callback(this.param,this.name)}},{key:"onFree",value:function(){u(s(h.prototype),"onFree",this).call(this),this.setName().setCallback().setParameter();}}]),h}(Y),Rt=function e(i){var r,n,s;if(null==i||"object"!==t(i))return i;if(r=Array.isArray(i)?[]:{},function(e){if("object"!==t(e)||e.nodeType||e===e.window)return !1;try{if(e.constructor&&!{}.hasOwnProperty.call(e.constructor.prototype,"isPrototypeOf"))return !1}catch(t){return !1}return !0}(i))for(s in i)n=i[s],r[s]=e(n);else r=i;return r},Bt=function(t,e,i,r){void 0===r&&(r={word:[],width:0}),r.word.length=0;for(var n=t.length,s=e,h=r.word,o=0;s0&&!o){var a=this.fixedHeight-r;if(i>0)s=a/i;else s=(l=Dt.call(this)).height,h=l.ascent,i=Math.floor((a-h)/s);}else {var l;s=(l=Dt.call(this)).height,h=l.ascent;}}else if(this.fixedHeight>0){if(void 0===(i=Ht(t,"maxLines"))){a=this.fixedHeight-r;i=Math.floor(a/s);}}else i=Ht(t,"maxLines",0);void 0===h&&(h=s);var u=0===i,c=Ht(t,"wrapWidth",void 0);void 0===c&&(c=this.fixedWidth>0?this.fixedWidth-n:1/0);for(var d=Ht(t,"letterSpacing",0),f=Ht(t,"hAlign",0),y=Ht(t,"vAlign",0),g=Ht(t,"charWrap",!1),v={callback:"runWordWrap",start:e,isLastPage:!1,padding:this.wrapPadding,ascent:h,lineHeight:s,maxLines:i,wrapWidth:c,letterSpacing:d,hAlign:f,vAlign:y,charWrap:g,children:[],lines:[],maxLineWidth:0,linesHeight:0},p=this.children,k=0,w=p.length;k0&&(Y.push({children:X,width:R}),B=Math.max(B,R)),v.start+=_.length,v.isLastPage=!A&&v.start===P,v.maxLineWidth=B,v.linesHeight=Y.length*s;var j=this.fixedWidth>0?this.fixedWidth:v.maxLineWidth+n,z=this.fixedHeight>0?this.fixedHeight:v.linesHeight+r;!function(t,e,i){var r,n,s=t.hAlign,h=t.vAlign,o=t.linesHeight;switch(h){case 1:case"center":n=(i-o)/2;break;case 2:case"bottom":n=i-o;break;default:n=0;}for(var a=t.lines,l=0,u=a.length;l0?(h=this.fixedWidth-n)/i:0;else if(this.fixedWidth>0){if(void 0===(i=jt(t,"maxLines",void 0))){var h=this.fixedWidth-n;i=Math.floor(h/s)+1;}}else i=jt(t,"maxLines",0);var o=0===i,a=jt(t,"fixedChildHeight",void 0);if(void 0===a){var l=jt(t,"charPerLine",void 0);if(void 0!==l){var u=this.fixedHeight-r;a=Math.floor(u/l);}}var c=jt(t,"wrapHeight",void 0);void 0===c&&(c=this.fixedHeight>0?this.fixedHeight-r:1/0);for(var d=jt(t,"letterSpacing",0),f=jt(t,"rtl",!0),y=jt(t,"hAlign",f?2:0),g=jt(t,"vAlign",0),v={callback:"runVerticalWrap",start:e,isLastPage:!1,padding:this.wrapPadding,lineWidth:s,maxLines:i,fixedChildHeight:a,wrapHeight:c,letterSpacing:d,hAlign:y,vAlign:g,rtl:f,children:[],lines:[],maxLineHeight:0,linesWidth:0},p=this.children,k=0,w=p.length;k0&&(Y.push({children:X,height:R}),B=Math.max(B,R)),v.start+=_.length,v.isLastPage=v.start===P,v.maxLineHeight=B,v.linesWidth=Y.length*s;var M=this.fixedWidth>0?this.fixedWidth:v.linesWidth+n,F=this.fixedHeight>0?this.fixedHeight:v.maxLineHeight+r;!function(t,e,i){var r,n,s=t.hAlign,h=t.vAlign,o=t.rtl,a=t.lines,l=t.lineWidth,u=t.linesWidth;switch(s){case 1:case"center":r=(e-u)/2;break;case 2:case"right":r=e-u;break;default:r=0;}o&&(r+=l);for(var c=0,d=a.length;c0?t:this.width,e>0?e:this.height),this):this},setPadding:function(t,e){var i=this.padding,r=i.left,n=i.right,s=i.top,h=i.bottom;return T(i,t,e),this.dirty=this.dirty||r!=i.left||n!=i.right||s!=i.top||h!=i.bottom,this},getPadding:function(t){return function(t,e){return void 0===e?t:t[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),gt(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 vt(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,r,n,s=Array.isArray(t);void 0===e||e===this.children.length?s?(i=this.children).push.apply(i,f(t)):this.children.push(t):s?(r=this.children).splice.apply(r,[e,0].concat(f(t))):this.children.splice(e,0,t);(this.lastAppendedChildren.length=0,s)?(n=this.lastAppendedChildren).push.apply(n,f(t)):this.lastAppendedChildren.push(t);return this},createCharChild:function(t,e){e&&this.textStyle.modify(e);var i=this.poolManager.allocate(pt);return null===i?i=new Ot(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=[],r=0,n=t.length;re&&(r=e,n=t);})),n},getCharWorldPosition:function(t,e,i,r){return "number"==typeof t&&(t=this.getCharChild(t,!0)),U(this,t,e,i,r)},setToMinSize:function(){for(var t=this.children,e=0,i=0,r=0,n=t.length;r=i.length&&(t=i.length);for(var r=0,n=0;n0?this.items.pop():null}},{key:"push",value:function(t){return this.items.push(t),this}},{key:"pushMultiple",value:function(t){return this.items.push.apply(this.items,t),t.length=0,this}},{key:"clear",value:function(){return this.items.length=0,this}}]),t}(),oe=Phaser.Utils.Objects.GetFastValue,ae={},le=function(){function t(i){e(this,t),this.pools=oe(i,"pools",ae);}return r(t,[{key:"free",value:function(t){if(!this.pools)return this;var e=t.type;return this.pools.hasOwnProperty(e)||(this.pools[e]=new he),this.pools[e].push(t),t.onFree(),this}},{key:"freeMultiple",value:function(t){if(!this.pools)return this;for(var e=0,i=t.length;et.length)&&(e=t.length);for(var i=0,r=new Array(e);i0}},{key:"drawX",get:function(){var t=this.x+this.leftSpace+this.offsetX-this.originX*this.width;return this.parent._textOX*this.scrollFactorX+t}},{key:"drawY",get:function(){var t=this.y+this.offsetY;return this.parent._textOY*this.scrollFactorY+t}},{key:"drawTLX",get:function(){return 0}},{key:"drawTLY",get:function(){return 0}},{key:"drawBLX",get:function(){return 0}},{key:"drawBLY",get:function(){return 0}},{key:"drawTRX",get:function(){return 0}},{key:"drawTRY",get:function(){return 0}},{key:"drawBRX",get:function(){return 0}},{key:"drawBRY",get:function(){return 0}},{key:"drawCenterX",get:function(){return (this.drawTRX+this.drawTLX)/2}},{key:"drawCenterY",get:function(){return (this.drawBLY+this.drawTLY)/2}}]),s}(Y);Object.assign(q.prototype,E);var $=Phaser.Utils.String.Pad,K=function(e,i,r){if(null==e)return e;switch(t(e)){case"string":default:return e;case"number":return "#".concat($(Math.floor(e).toString(16),6,"0",1));case"function":return e(i,r);case"object":return e.hasOwnProperty("r")?e.hasOwnProperty("a")?"rgba(".concat(e.r,",").concat(e.g,",").concat(e.b,",").concat(e.a,")"):"rgb(".concat(e.r,",").concat(e.g,",").concat(e.b,")"):e.hasOwnProperty("h")?e.hasOwnProperty("a")?"hsla(".concat(e.h,",").concat(e.s,",").concat(e.l,",").concat(e.a,")"):"hsl(".concat(e.h,",").concat(e.s,",").concat(e.l,")"):e}},Q=function(t,e,i){return e.hasOwnProperty(t)?e[t]:i[t]},Z=Phaser.Utils.Objects.GetValue,tt=function(){function t(i,r,n,s,h){e(this,t),void 0===i&&(i=0),void 0===r&&(r=i),void 0===n&&(n=0),void 0===s&&(s=0),void 0===h&&(h=0),this.cornerRadius={},this._width=0,this._height=0,this.setTo(i,r,n,s,h);}return r(t,[{key:"setTo",value:function(t,e,i,r,n){return this.setPosition(t,e),this.setRadius(n),this.setSize(i,r),this}},{key:"setPosition",value:function(t,e){return this.x=t,this.y=e,this}},{key:"setRadius",value:function(t){return void 0===t&&(t=0),this.radius=t,this}},{key:"setSize",value:function(t,e){return this.width=t,this.height=e,this}},{key:"minWidth",get:function(){var t=this.cornerRadius;return Math.max(t.tl.x+t.tr.x,t.bl.x+t.br.x)}},{key:"minHeight",get:function(){var t=this.cornerRadius;return Math.max(t.tl.y+t.bl.y,t.tr.y+t.br.y)}},{key:"width",get:function(){return this._width},set:function(t){null==t&&(t=0),this._width=Math.max(t,this.minWidth);}},{key:"height",get:function(){return this._height},set:function(t){null==t&&(t=0),this._height=Math.max(t,this.minHeight);}},{key:"radius",get:function(){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:function(t){var e,i;"number"==typeof t?(e=t,i=t):(e=Z(t,"x",0),i=Z(t,"y",0));var r=this.cornerRadius;r.tl=et(Z(t,"tl",void 0),e,i),r.tr=et(Z(t,"tr",void 0),e,i),r.bl=et(Z(t,"bl",void 0),e,i),r.br=et(Z(t,"br",void 0),e,i);}},{key:"radiusTL",get:function(){var t=this.cornerRadius.tl;return Math.max(t.x,t.y)},set:function(t){it(this.cornerRadius.tl,t);}},{key:"radiusTR",get:function(){var t=this.cornerRadius.tr;return Math.max(t.x,t.y)},set:function(t){it(this.cornerRadius.tr,t);}},{key:"radiusBL",get:function(){var t=this.cornerRadius.bl;return Math.max(t.x,t.y)},set:function(t){it(this.cornerRadius.bl,t);}},{key:"radiusBR",get:function(){var t=this.cornerRadius.br;return Math.max(t.x,t.y)},set:function(t){it(this.cornerRadius.br,t);}}]),t}(),et=function(t,e,i){return void 0===t?t={x:e,y:i}:"number"==typeof t&&(t={x:t,y:t}),rt(t),t},it=function(t,e){"number"==typeof e?(t.x=e,t.y=e):(t.x=Z(e,"x",0),t.y=Z(e,"y",0)),rt(t);},rt=function(t){t.convex=t.x>=0||t.y>=0,t.x=Math.abs(t.x),t.y=Math.abs(t.y);},nt=Phaser.Math.DegToRad,st=function(t){return !t.hasOwnProperty("convex")||t.convex},ht=function(t){return t.x>0&&t.y>0},ot=function(t,e,i,r,n,s,h,o,a){if(o&&h>s?h-=360:!o&&h=f?1:r/f,v=n>=y?1:n/y,p=d.cornerRadius;t.save(),t.beginPath(),t.translate(e,i),o=p.tl,ht(o)?(a=o.x*g,l=o.y*v,st(o)?ot(t,a,l,a,l,180,270,!1,h):ot(t,0,0,a,l,90,0,!0,h),u=0,c=l):(t.lineTo(0,0),u=0,c=0),o=p.tr,ht(o)?(a=o.x*g,l=o.y*v,st(o)?ot(t,r-a,l,a,l,270,360,!1,h):ot(t,r,0,a,l,180,90,!0,h)):t.lineTo(r,0),o=p.br,ht(o)?(a=o.x*g,l=o.y*v,st(o)?ot(t,r-a,n-l,a,l,0,90,!1,h):ot(t,r,n,a,l,270,180,!0,h)):t.lineTo(r,n),o=p.bl,ht(o)?(a=o.x*g,l=o.y*v,st(o)?ot(t,a,n-l,a,l,90,180,!1,h):ot(t,0,n,a,l,360,270,!0,h)):t.lineTo(0,n),t.lineTo(u,c),t.closePath(),t.restore();}(e,i,r,n,s,h,d),null!=o){var f;if(null!=u)(f=c?e.createLinearGradient(0,0,n,0):e.createLinearGradient(0,0,0,s)).addColorStop(0,o),f.addColorStop(1,u),o=f;e.fillStyle=o,e.fill();}null!=a&&l>0&&(e.strokeStyle=a,e.lineWidth=l,e.stroke());},lt=Phaser.Utils.Objects.GetValue,ut=function(t){n(h,t);var i=a(h);function h(t,r){var n;return e(this,h),(n=i.call(this,t,"background")).setScrollFactor(0),n.setColor(lt(r,"color",null),lt(r,"color2",null),lt(r,"horizontalGradient",!0)),n.setStroke(lt(r,"stroke",null),lt(r,"strokeThickness",2)),n.setCornerRadius(lt(r,"cornerRadius",0),lt(r,"cornerIteration",null)),n}return r(h,[{key:"color",get:function(){return this._color},set:function(t){t=K(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t;}},{key:"color2",get:function(){return this._color2},set:function(t){t=K(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t;}},{key:"horizontalGradient",get:function(){return this._horizontalGradient},set:function(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t;}},{key:"setColor",value:function(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}},{key:"stroke",get:function(){return this._stroke},set:function(t){t=K(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t;}},{key:"strokeThickness",get:function(){return this._strokeThickness},set:function(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t;}},{key:"setStroke",value:function(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}},{key:"cornerRadius",get:function(){return this._cornerRadius},set:function(t){this.setDirty(this._cornerRadius!=t),this._cornerRadius=t;}},{key:"cornerIteration",get:function(){return this._cornerIteration},set:function(t){this.setDirty(this._cornerIteration!=t),this._cornerIteration=t;}},{key:"modifyStyle",value:function(t){return t.hasOwnProperty("color")&&this.setColor(t.color,Q("color2",t,this),Q("horizontalGradient",t,this)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,Q("strokeThickness",t,this)),t.hasOwnProperty("cornerRadius")&&this.setCornerRadius(t.cornerRadius,Q("cornerIteration",t,this)),this}},{key:"modifyPorperties",value:function(t){return u(s(h.prototype),"modifyPorperties",this).call(this,t),this.modifyStyle(t),this}},{key:"setCornerRadius",value:function(t,e){return this.cornerRadius=t,this.cornerIteration=e,this}},{key:"renderContent",value:function(){!function(t,e,i,r,n,s,h,o){if(null!=e||null!=i){var a=t.canvas.width,l=t.canvas.height;null==i&&(r=0);var u=r/2;a=Math.max(1,a-r),l=Math.max(1,l-r),at(t.canvas,t.context,u,u,a,l,n,e,i,r,s,h,o);}}(this.parent,this.color,this.stroke,this.strokeThickness,this.cornerRadius,this.color2,this.horizontalGradient,this.cornerIteration);}}]),h}(q),ct=Phaser.Utils.Objects.GetValue,dt=function(t){n(h,t);var i=a(h);function h(t,r){var n;return e(this,h),(n=i.call(this,t,"innerbounds")).setScrollFactor(0),n.setColor(ct(r,"color",null),ct(r,"color2",null),ct(r,"horizontalGradient",!0)),n.setStroke(ct(r,"stroke",null),ct(r,"strokeThickness",2)),n}return r(h,[{key:"color",get:function(){return this._color},set:function(t){t=K(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t;}},{key:"color2",get:function(){return this._color2},set:function(t){t=K(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t;}},{key:"horizontalGradient",get:function(){return this._horizontalGradient},set:function(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t;}},{key:"setColor",value:function(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}},{key:"stroke",get:function(){return this._stroke},set:function(t){t=K(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t;}},{key:"strokeThickness",get:function(){return this._strokeThickness},set:function(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t;}},{key:"setStroke",value:function(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}},{key:"modifyPorperties",value:function(t){u(s(h.prototype),"modifyPorperties",this).call(this,t),t.hasOwnProperty("color")&&this.setColor(t.color,ct(t,"color2",null),ct(t,"horizontalGradient",!0)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,ct(t,"strokeThickness",2));}},{key:"renderContent",value:function(){var t=this.parent.padding,e=t.left,i=t.top,r=this.parent.width-t.left-t.right,n=this.parent.height-t.top-t.bottom,s=this.context;if(null!=this.color){var h,o;if(null!=this.color2)(o=this.horizontalGradient?s.createLinearGradient(0,0,r,0):s.createLinearGradient(0,0,0,n)).addColorStop(0,this.color),o.addColorStop(1,this.color2),h=o;else h=this.color;s.fillStyle=h,s.fillRect(e,i,r,n);}null!=this.stroke&&this.strokeThickness>0&&(s.strokeStyle=this.stroke,s.lineWidth=this.strokeThickness,s.strokeRect(e,i,r,n));}}]),h}(q),ft=Phaser.Utils.Objects.GetValue,yt=function(){function t(i,r){e(this,t),this.parent=i,this.set(r);}return r(t,[{key:"toJSON",value:function(){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}}},{key:"set",value:function(t){return this.setBold(ft(t,"bold",!1)),this.setItalic(ft(t,"italic",!1)),this.setFontSize(ft(t,"fontSize","16px")),this.setFontFamily(ft(t,"fontFamily","Courier")),this.setColor(ft(t,"color","#fff")),this.setStrokeStyle(ft(t,"stroke",null),ft(t,"strokeThickness",0)),this.setShadow(ft(t,"shadowColor",null),ft(t,"shadowOffsetX",0),ft(t,"shadowOffsetY",0),ft(t,"shadowBlur",0)),this.setOffset(ft(t,"offsetX",0),ft(t,"offsetY",0)),this.setSpace(ft(t,"leftSpace",0),ft(t,"rightSpace",0)),this.setAlign(ft(t,"align",void 0)),this.setBackgroundColor(ft(t,"backgroundColor",null)),this.setBackgroundHeight(ft(t,"backgroundHeight",void 0)),this.setBackgroundBottomY(ft(t,"backgroundBottomY",void 0)),this}},{key:"modify",value:function(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(Q("stroke",t,this),Q("strokeThickness",t,this)),t.hasOwnProperty("shadowColor")&&this.setShadowColor(t.shadowColor),(t.hasOwnProperty("shadowOffsetX")||t.hasOwnProperty("shadowOffsetY"))&&this.setShadowOffset(Q("shadowOffsetX",t,this),Q("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}},{key:"setUpdateTextFlag",value:function(){return this.parent&&(this.parent.updateTextFlag=!0),this}},{key:"clone",value:function(){return new t(null,this.toJSON())}},{key:"copyFrom",value:function(t){return this.set(t.toJSON()),this}},{key:"copyTo",value:function(t){return t.set(this.toJSON()),this}},{key:"setBold",value:function(t){return void 0===t&&(t=!0),this.bold=t,this.setUpdateTextFlag(),this}},{key:"setItalic",value:function(t){return void 0===t&&(t=!0),this.italic=t,this.setUpdateTextFlag(),this}},{key:"fontStyle",get:function(){return this.bold&&this.italic?"bold italic":this.bold?"bold":this.italic?"italic":""}},{key:"setFontSize",value:function(t){return "number"==typeof t&&(t="".concat(t,"px")),this.fontSize=t,this.setUpdateTextFlag(),this}},{key:"setFontFamily",value:function(t){return this.fontFamily=t,this.setUpdateTextFlag(),this}},{key:"font",get:function(){return "".concat(this.fontStyle," ").concat(this.fontSize," ").concat(this.fontFamily)}},{key:"setColor",value:function(t){return this.color=K(t),this}},{key:"hasFill",get:function(){return null!=this.color}},{key:"setStrokeStyle",value:function(t,e){return this.stroke=K(t),void 0!==e&&(this.strokeThickness=e),this}},{key:"setStrokeThickness",value:function(t){return this.strokeThickness=t,this}},{key:"hasStroke",get:function(){return null!=this.stroke&&this.strokeThickness>0}},{key:"setShadowColor",value:function(t){return this.shadowColor=K(t),this}},{key:"setShadowOffset",value:function(t,e){return void 0===t&&(t=0),void 0===e&&(e=0),this.shadowOffsetX=t,this.shadowOffsetY=e,this}},{key:"setShadowBlur",value:function(t){return void 0===t&&(t=0),this.shaodwBlur=t,this}},{key:"setShadow",value:function(t,e,i,r){return this.setShadowColor(t).setShadowOffset(e,i).setShadowBlur(r),this}},{key:"setBackgroundColor",value:function(t){return this.backgroundColor=K(t),this}},{key:"hasBackgroundColor",get:function(){return null!=this.backgroundColor}},{key:"setBackgroundHeight",value:function(t){return this.backgroundHeight=t,this}},{key:"setBackgroundBottomY",value:function(t){return this.backgroundBottomY=t,this}},{key:"setOffsetX",value:function(t){return void 0===t&&(t=0),this.offsetX=t,this}},{key:"setOffsetY",value:function(t){return void 0===t&&(t=0),this.offsetY=t,this}},{key:"setOffset",value:function(t,e){return this.setOffsetX(t).setOffsetY(e),this}},{key:"setLeftSpace",value:function(t){return void 0===t&&(t=0),this.leftSpace=t,this}},{key:"setRightSpace",value:function(t){return void 0===t&&(t=0),this.rightSpace=t,this}},{key:"setSpace",value:function(t,e){return this.setLeftSpace(t).setRightSpace(e),this}},{key:"setAlign",value:function(t){return this.align=t,this}},{key:"syncFont",value:function(t){return t.font=this.font,this}},{key:"syncStyle",value:function(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}},{key:"syncShadow",value:function(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);}},{key:"getTextMetrics",value:function(t,e){return this.syncFont(t).syncStyle(t),t.measureText(e)}}]),t}(),gt=Phaser.Utils.Array.Remove,vt=Phaser.Utils.Array.Remove,pt="text",kt="image",wt="drawer",xt="space",mt="command",bt=function(t){return t.type===pt&&"\n"===t.text},St=function(t){return t.type===pt&&"\f"===t.text},Ct=function(t){return t.type===pt},Ot=function(t){n(h,t);var i=a(h);function h(t,r,n){var s;return e(this,h),(s=i.call(this,t,pt)).updateTextFlag=!1,s.style=new yt(o(s),n),s.setText(r),s}return r(h,[{key:"autoRound",get:function(){return this.parent.autoRound}},{key:"offsetX",get:function(){return this.style.offsetX},set:function(t){this.style&&(this.style.offsetX=t);}},{key:"offsetY",get:function(){return this.style.offsetY},set:function(t){this.style&&(this.style.offsetY=t);}},{key:"leftSpace",get:function(){return this.style.leftSpace*this.scaleX},set:function(t){this.style&&(this.style.leftSpace=t),d(s(h.prototype),"leftSpace",t,this,!0);}},{key:"rightSpace",get:function(){return this.style.rightSpace*this.scaleX},set:function(t){this.style&&(this.style.rightSpace=t),d(s(h.prototype),"rightSpace",t,this,!0);}},{key:"align",get:function(){return this.style.align},set:function(t){this.style&&(this.style.align=t);}},{key:"modifyStyle",value:function(t){return this.setDirty(!0),this.style.modify(t),this.updateTextFlag&&this.updateTextSize(),this}},{key:"modifyPorperties",value:function(t){return t?(this.modifyStyle(t),u(s(h.prototype),"modifyPorperties",this).call(this,t),this):this}},{key:"setText",value:function(t){return this.setDirty(this.text!=t),this.text=t,this.updateTextSize(),this}},{key:"updateTextSize",value:function(){var t=this.text;if("\n"===t||"\f"===t||""===t)this.clearTextSize();else {var e,i,r=this.style.getTextMetrics(this.context,this.text);this.textWidth=r.width,"actualBoundingBoxAscent"in r?(e=r.actualBoundingBoxAscent,i=r.actualBoundingBoxDescent):(e=0,i=0),this.textHeight=e+i,this.ascent=e,this.descent=i;}return this.updateTextFlag=!1,this}},{key:"clearTextSize",value:function(){return this.textWidth=0,this.textHeight=0,this.ascent=0,this.descent=0,this}},{key:"copyTextSize",value:function(t){return this.textWidth=t.textWidth,this.textHeight=t.textHeight,this.ascent=t.ascent,this.descent=t.descent,this}},{key:"width",get:function(){return this.textWidth*this.scaleX},set:function(t){this.textWidth>0?this.scaleX=t/this.textWidth:this.scaleX=1;}},{key:"height",get:function(){return this.textHeight*this.scaleY},set:function(t){this.textHeight>0?this.scaleY=t/this.textHeight:this.scaleY=1;}},{key:"willRender",get:function(){return 0!==this.textWidth&&u(s(h.prototype),"willRender",this)}},{key:"renderContent",value:function(){var t=this.context,e=this.style;if(e.hasBackgroundColor){t.fillStyle=e.backgroundColor;var i=this.drawTLX,r=this.drawTRX-i,n=e.backgroundBottomY;null==n&&(n=this.drawBLY);var s=e.backgroundHeight;null==s&&(s=n-this.drawTLY);var h=n-s;t.fillRect(i,h,r,s);}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)));}},{key:"drawTLX",get:function(){return -this.leftSpace}},{key:"drawTLY",get:function(){return -this.ascent}},{key:"drawBLX",get:function(){return -this.leftSpace}},{key:"drawBLY",get:function(){return this.descent}},{key:"drawTRX",get:function(){return this.textWidth+this.rightSpace}},{key:"drawTRY",get:function(){return -this.ascent}},{key:"drawBRX",get:function(){return this.textWidth+this.rightSpace}},{key:"drawBRY",get:function(){return this.descent}}]),h}(q),Pt=function(t,e){var i=this.createCharChildren(t,e);return this.addChild(i),this},Tt=function(t){n(s,t);var i=a(s);function s(t,r,n){var h;return e(this,s),(h=i.call(this,t,kt)).setTexture(r,n),h}return r(s,[{key:"frameWidth",get:function(){return this.frameObj?this.frameObj.cutWidth:0}},{key:"frameHeight",get:function(){return this.frameObj?this.frameObj.cutHeight:0}},{key:"offsetY",get:function(){return -this.height},set:function(t){}},{key:"key",get:function(){return this._key},set:function(t){this.setDirty(this._key!=t),this._key=t;}},{key:"frame",get:function(){return this._frame},set:function(t){this.setDirty(this._frame!=t),this._frame=t;}},{key:"setTexture",value:function(t,e){return this.key=t,this.frame=e,this.frameObj=this.scene.sys.textures.getFrame(t,e),this}},{key:"width",get:function(){return this.frameWidth*this.scaleX},set:function(t){this.setDirty(this.width!==t),this.scaleX=t/this.frameWidth;}},{key:"height",get:function(){return this.frameHeight*this.scaleY},set:function(t){this.setDirty(this.height!==t),this.scaleY=t/this.frameHeight;}},{key:"setHeight",value:function(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}},{key:"renderContent",value:function(){var t=this.context,e=this.frameObj,i=this.frameWidth,r=this.frameHeight;t.drawImage(e.source.image,e.cutX,e.cutY,i,r,0,0,i,r);}},{key:"drawTLX",get:function(){return -this.leftSpace}},{key:"drawTLY",get:function(){return 0}},{key:"drawBLX",get:function(){return -this.leftSpace}},{key:"drawBLY",get:function(){return this.frameHeight}},{key:"drawTRX",get:function(){return this.frameWidth+this.rightSpace}},{key:"drawTRY",get:function(){return 0}},{key:"drawBRX",get:function(){return this.frameWidth+this.rightSpace}},{key:"drawBRY",get:function(){return this.frameHeight}}]),s}(q),_t=function(t){n(h,t);var i=a(h);function h(t,r,n,s){var o;return e(this,h),(o=i.call(this,t,wt)).setRenderCallback(r),o.setDrawerSize(n,s),o}return r(h,[{key:"setRenderCallback",value:function(t){return t?this.renderContent=t.bind(this):delete this.renderContent,this}},{key:"setDrawerSize",value:function(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}},{key:"onFree",value:function(){u(s(h.prototype),"onFree",this).call(this),this.setRenderCallback();}},{key:"width",get:function(){return this.drawerWidth*this.scaleX},set:function(t){this.setDirty(this.width!==t),this.scaleX=this.drawerWidth>0?t/this.drawerWidth:1;}},{key:"height",get:function(){return this.drawerHeight*this.scaleY},set:function(t){this.setDirty(this.height!==t),this.scaleY=this.drawerHeight>0?t/this.drawerHeight:1;}},{key:"offsetY",get:function(){return -this.height},set:function(t){}},{key:"drawTLX",get:function(){return -this.leftSpace}},{key:"drawTLY",get:function(){return 0}},{key:"drawBLX",get:function(){return -this.leftSpace}},{key:"drawBLY",get:function(){return this.drawerHeight}},{key:"drawTRX",get:function(){return this.drawerWidth+this.rightSpace}},{key:"drawTRY",get:function(){return 0}},{key:"drawBRX",get:function(){return this.drawerWidth+this.rightSpace}},{key:"drawBRY",get:function(){return this.drawerHeight}}]),h}(q),Yt=function(t){n(s,t);var i=a(s);function s(t,r){var n;return e(this,s),(n=i.call(this,t,xt)).setSpaceWidth(r),n}return r(s,[{key:"width",get:function(){return this.spaceWidth*this.scaleX},set:function(t){this.spaceWidth>0?this.scaleX=t/this.spaceWidth:this.scaleX=1;}},{key:"setSpaceWidth",value:function(t){return this.spaceWidth=t,this}}]),s}(q),Xt=function(t){n(h,t);var i=a(h);function h(t,r,n,s,o){var a;return e(this,h),(a=i.call(this,t,mt)).setName(r).setParameter(s).setCallback(n,o),a}return r(h,[{key:"setName",value:function(t){return this.name=t,this}},{key:"setParameter",value:function(t){return this.param=t,this}},{key:"setCallback",value:function(t,e){return this.callback=t,this.scope=e,this}},{key:"exec",value:function(){return this.scope?this.callback.call(this.scope,this.param,this.name):this.callback(this.param,this.name)}},{key:"onFree",value:function(){u(s(h.prototype),"onFree",this).call(this),this.setName().setCallback().setParameter();}}]),h}(Y),Rt=function e(i){var r,n,s;if(null==i||"object"!==t(i))return i;if(r=Array.isArray(i)?[]:{},function(e){if("object"!==t(e)||e.nodeType||e===e.window)return !1;try{if(e.constructor&&!{}.hasOwnProperty.call(e.constructor.prototype,"isPrototypeOf"))return !1}catch(t){return !1}return !0}(i))for(s in i)n=i[s],r[s]=e(n);else r=i;return r},Bt=function(t,e,i,r){void 0===r&&(r={word:[],width:0}),r.word.length=0;for(var n=t.length,s=e,h=r.word,o=0;s0&&!o){var a=this.fixedHeight-r;if(i>0)s=a/i;else s=(l=Dt.call(this)).height,h=l.ascent,i=Math.floor((a-h)/s);}else {var l;s=(l=Dt.call(this)).height,h=l.ascent;}}else if(this.fixedHeight>0){if(void 0===(i=Ht(t,"maxLines"))){a=this.fixedHeight-r;i=Math.floor(a/s);}}else i=Ht(t,"maxLines",0);void 0===h&&(h=s);var u=0===i,c=Ht(t,"wrapWidth",void 0);void 0===c&&(c=this.fixedWidth>0?this.fixedWidth-n:1/0);for(var d=Ht(t,"letterSpacing",0),f=Ht(t,"hAlign",0),y=Ht(t,"vAlign",0),g=Ht(t,"charWrap",!1),v={callback:"runWordWrap",start:e,isLastPage:!1,padding:this.wrapPadding,ascent:h,lineHeight:s,maxLines:i,wrapWidth:c,letterSpacing:d,hAlign:f,vAlign:y,charWrap:g,children:[],lines:[],maxLineWidth:0,linesHeight:0},p=this.children,k=0,w=p.length;k0&&(Y.push({children:X,width:R}),B=Math.max(B,R)),v.start+=_.length,v.isLastPage=!A&&v.start===P,v.maxLineWidth=B,v.linesHeight=Y.length*s;var j=this.fixedWidth>0?this.fixedWidth:v.maxLineWidth+n,z=this.fixedHeight>0?this.fixedHeight:v.linesHeight+r;!function(t,e,i){var r,n,s=t.hAlign,h=t.vAlign,o=t.linesHeight;switch(h){case 1:case"center":n=(i-o)/2;break;case 2:case"bottom":n=i-o;break;default:n=0;}for(var a=t.lines,l=0,u=a.length;l0?(h=this.fixedWidth-n)/i:0;else if(this.fixedWidth>0){if(void 0===(i=jt(t,"maxLines",void 0))){var h=this.fixedWidth-n;i=Math.floor(h/s)+1;}}else i=jt(t,"maxLines",0);var o=0===i,a=jt(t,"fixedChildHeight",void 0);if(void 0===a){var l=jt(t,"charPerLine",void 0);if(void 0!==l){var u=this.fixedHeight-r;a=Math.floor(u/l);}}var c=jt(t,"wrapHeight",void 0);void 0===c&&(c=this.fixedHeight>0?this.fixedHeight-r:1/0);for(var d=jt(t,"letterSpacing",0),f=jt(t,"rtl",!0),y=jt(t,"hAlign",f?2:0),g=jt(t,"vAlign",0),v={callback:"runVerticalWrap",start:e,isLastPage:!1,padding:this.wrapPadding,lineWidth:s,maxLines:i,fixedChildHeight:a,wrapHeight:c,letterSpacing:d,hAlign:y,vAlign:g,rtl:f,children:[],lines:[],maxLineHeight:0,linesWidth:0},p=this.children,k=0,w=p.length;k0&&(Y.push({children:X,height:R}),B=Math.max(B,R)),v.start+=_.length,v.isLastPage=v.start===P,v.maxLineHeight=B,v.linesWidth=Y.length*s;var M=this.fixedWidth>0?this.fixedWidth:v.linesWidth+n,F=this.fixedHeight>0?this.fixedHeight:v.maxLineHeight+r;!function(t,e,i){var r,n,s=t.hAlign,h=t.vAlign,o=t.rtl,a=t.lines,l=t.lineWidth,u=t.linesWidth;switch(s){case 1:case"center":r=(e-u)/2;break;case 2:case"right":r=e-u;break;default:r=0;}o&&(r+=l);for(var c=0,d=a.length;c0?t:this.width,e>0?e:this.height),this):this},setPadding:function(t,e){var i=this.padding,r=i.left,n=i.right,s=i.top,h=i.bottom;return T(i,t,e),this.dirty=this.dirty||r!=i.left||n!=i.right||s!=i.top||h!=i.bottom,this},getPadding:function(t){return function(t,e){return void 0===e?t:t[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),gt(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 vt(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,r,n,s=Array.isArray(t);void 0===e||e===this.children.length?s?(i=this.children).push.apply(i,f(t)):this.children.push(t):s?(r=this.children).splice.apply(r,[e,0].concat(f(t))):this.children.splice(e,0,t);(this.lastAppendedChildren.length=0,s)?(n=this.lastAppendedChildren).push.apply(n,f(t)):this.lastAppendedChildren.push(t);return this},createCharChild:function(t,e){e&&this.textStyle.modify(e);var i=this.poolManager.allocate(pt);return null===i?i=new Ot(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=[],r=0,n=t.length;re&&(r=e,n=t);})),n},getCharWorldPosition:function(t,e,i,r){return "number"==typeof t&&(t=this.getCharChild(t,!0)),U(this,t,e,i,r)},setToMinSize:function(){for(var t=this.children,e=0,i=0,r=0,n=t.length;r=i.length&&(t=i.length);for(var r=0,n=0;n0?this.items.pop():null}},{key:"push",value:function(t){return this.items.push(t),this}},{key:"pushMultiple",value:function(t){return this.items.push.apply(this.items,t),t.length=0,this}},{key:"clear",value:function(){return this.items.length=0,this}}]),t}(),oe=Phaser.Utils.Objects.GetFastValue,ae={},le=function(){function t(i){e(this,t),this.pools=oe(i,"pools",ae);}return r(t,[{key:"free",value:function(t){if(!this.pools)return this;var e=t.type;return this.pools.hasOwnProperty(e)||(this.pools[e]=new he),this.pools[e].push(t),t.onFree(),this}},{key:"freeMultiple",value:function(t){if(!this.pools)return this;for(var e=0,i=t.length;e textObject.width) { - dx = textObject.width - childRightX; - } else { - dx = 0; - } - var childTopY = this.drawY + this.drawTLY; - var childBottomY = childTopY + this.height; - if (childTopY < 0) { - dy = 0 - childTopY; - } else if (childBottomY > textObject.height) { - dy = textObject.height - childBottomY; - } else { - dy = 0; - } - textObject._textOX += dx; - textObject._textOY += dy; - return this; - }; - var Methods$1 = { contains: Contains, - getWorldPosition: GetWorldPosition, - scrollTo: ScrollTo + getWorldPosition: GetWorldPosition }; Object.assign(Methods$1, RenderMethods); @@ -24314,7 +24287,6 @@ return this; } this._textOX = ox; - this.updateTexture(); return this; }, setTextOY: function setTextOY(oy) { @@ -24322,7 +24294,6 @@ return this; } this._textOY = oy; - this.updateTexture(); return this; }, setTextOXY: function setTextOXY(ox, oy) { @@ -24331,7 +24302,6 @@ } this._textOX = ox; this._textOY = oy; - this.updateTexture(); return this; }, addTextOX: function addTextOX(incX) { diff --git a/dist/rexsimpledropdownlist.min.js b/dist/rexsimpledropdownlist.min.js index 6ae0d35806..06a49e0b15 100644 --- a/dist/rexsimpledropdownlist.min.js +++ b/dist/rexsimpledropdownlist.min.js @@ -10,4 +10,4 @@ var Na=function e(i){var n,r,s;if(null==i||"object"!==t(i))return i;if(n=Array.i * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Zh=Phaser.Renderer.WebGL.Utils,$h={renderWebGL:function(t,e,i,n){if(0!==e.width&&0!==e.height){i.addToRenderList(e);var r=e.frame,s=r.width,o=r.height,a=Zh.getTintAppendFloatAlpha,h=t.pipelines.set(e.pipeline,e),l=h.setTexture2D(r.glTexture,e);t.pipelines.preBatch(e),h.batchTexture(e,r.glTexture,s,o,e.x,e.y,s/e.style.resolution,o/e.style.resolution,e.scaleX,e.scaleY,e.rotation,e.flipX,e.flipY,e.scrollFactorX,e.scrollFactorY,e.displayOriginX,e.displayOriginY,0,0,s,o,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,n,!1,l),t.pipelines.postBatch(e);}},renderCanvas:function(t,e,i,n){0!==e.width&&0!==e.height&&(i.addToRenderList(e),t.batchSprite(e,e.frame,i,n));}},Qh=Phaser.Display.Canvas.CanvasPool;m();var tl=function(t){r(s,t);var i=l(s);function s(){return e(this,s),i.apply(this,arguments)}return n(s,[{key:"setStyle",value:function(t){return this.style.setStyle(t)}},{key:"setFont",value:function(t){return this.style.setFont(t)}},{key:"setFontFamily",value:function(t){return this.style.setFontFamily(t)}},{key:"setFontSize",value:function(t){return this.style.setFontSize(t)}},{key:"setFontStyle",value:function(t){return this.style.setFontStyle(t)}},{key:"setTestString",value:function(t){return this.style.setTestString(t)}},{key:"setFixedSize",value:function(t,e){return this.style.setFixedSize(t,e)}},{key:"setBackgroundColor",value:function(t,e,i){return this.style.setBackgroundColor(t,e,i)}},{key:"setBackgroundStrokeColor",value:function(t,e){return this.style.setBackgroundStrokeColor(t,e)}},{key:"setBackgroundCornerRadius",value:function(t,e){return this.style.setBackgroundCornerRadius(t,e)}},{key:"setFill",value:function(t){return this.style.setFill(t)}},{key:"setColor",value:function(t){return this.style.setColor(t)}},{key:"setStroke",value:function(t,e){return this.style.setStroke(t,e)}},{key:"setShadow",value:function(t,e,i,n,r,s){return this.style.setShadow(t,e,i,n,r,s)}},{key:"setShadowOffset",value:function(t,e){return this.style.setShadowOffset(t,e)}},{key:"setShadowColor",value:function(t){return this.style.setShadowColor(t)}},{key:"setShadowBlur",value:function(t){return this.style.setShadowBlur(t)}},{key:"setShadowStroke",value:function(t){return this.style.setShadowStroke(t)}},{key:"setShadowFill",value:function(t){return this.style.setShadowFill(t)}},{key:"setWrapMode",value:function(t){return this.style.setWrapMode(t)}},{key:"setWrapWidth",value:function(t){return this.style.setWrapWidth(t)}},{key:"setWordWrapWidth",value:function(t){return this.style.setWrapWidth(t)}},{key:"setAlign",value:function(t){return this.style.setHAlign(t)}},{key:"setHAlign",value:function(t){return this.style.setHAlign(t)}},{key:"setVAlign",value:function(t){return this.style.setVAlign(t)}},{key:"setLineSpacing",value:function(t){return this.style.setLineSpacing(t)}},{key:"lineSpacing",get:function(){return this.style.lineSpacing},set:function(t){this.setLineSpacing(t);}},{key:"setXOffset",value:function(t){return this.style.setXOffset(t)}},{key:"setMaxLines",value:function(t){return this.style.setMaxLines(t)}},{key:"setResolution",value:function(t){return this.style.setResolution(t)}},{key:"getTextMetrics",value:function(){return this.style.getTextMetrics()}},{key:"setTextMetrics",value:function(t,e){return this.style.setTextMetrics(t,e)}},{key:"measureTextMargins",value:function(t,e){return function(t,e,i){void 0===i&&(i={});var n=Qh.create(this),r=n.getContext("2d",{willReadFrequently:!0});t.syncFont(n,r);var s=r.measureText(e),o=Math.ceil(s.width*t.baselineX),a=o,h=2*a;if(a=a*t.baselineY|0,n.width=o,n.height=h,r.fillStyle="#f00",r.fillRect(0,0,o,h),r.font=t._font,r.textBaseline="alphabetic",r.fillStyle="#000",r.fillText(t.testString,0,a),i.left=0,0===o||0===h||!r.getImageData(0,0,o,h))return Qh.remove(n),i;for(var l=r.getImageData(0,0,o,h).data,u=!1,c=0;ch;u--){for(c=0;c0&&this.wrapMode!==ul&&0===this.wrapWidth}},{key:"setStyle",value:function(t,e,i){if(void 0===e&&(e=!0),void 0===i&&(i=!1),t&&t.hasOwnProperty("wrap")){var n=t.wrap;if(n.hasOwnProperty("mode")){var r=n.mode;"string"==typeof r&&(n.mode=yl[r]);}else n.hasOwnProperty("width")&&(n.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 s=this.propertyMap;for(var o in s){var a=s[o],h=a[0],l=i?a[1]:this[o],u=a[2];if("wrapCallback"===o||"wrapCallbackScope"===o)this[o]=pl(t,h,l);else {var c=vl(t,h,l);u&&(c=u(c)),this[o]=c;}}var d=pl(t,"font",null);this._font=null===d?this.fontStyle+" "+this.fontSize+" "+this.fontFamily:d;var f=pl(t,"fill",null);null!==f&&(this.color=nl(f));var v=pl(t,"metrics",!1);return v?this.metrics={ascent:pl(v,"ascent",0),descent:pl(v,"descent",0),fontSize:pl(v,"fontSize",0)}:!e&&this.metrics||(this.metrics=ol(this)),e?this.parent.updateText():this.parent}},{key:"syncFont",value:function(t,e){e.font=this._font;}},{key:"syncStyle",value:function(t,e){e.textBaseline="alphabetic",e.fillStyle=this.color,e.strokeStyle=this.stroke,e.lineWidth=this.strokeThickness,e.lineCap="round",e.lineJoin="round";}},{key:"syncShadow",value:function(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);}},{key:"update",value:function(t){return t&&(this._font="".concat(this.fontStyle," ").concat(this.fontSize," ").concat(this.fontFamily).trim(),this.metrics=ol(this)),this.parent.updateText(t)}},{key:"buildFont",value:function(){var t="".concat(this.fontStyle," ").concat(this.fontSize," ").concat(this.fontFamily).trim();return t!==this._font&&(this._font=t),this}},{key:"setFont",value:function(t){return "string"==typeof t?(this.fontFamily=t,this.fontSize="",this.fontStyle=""):(this.fontFamily=pl(t,"fontFamily","Courier"),this.fontSize=pl(t,"fontSize","16px"),this.fontStyle=pl(t,"fontStyle","")),this.update(!0)}},{key:"setFontFamily",value:function(t){return this.fontFamily=t,this.update(!0)}},{key:"setFontStyle",value:function(t){return this.fontStyle=t,this.update(!0)}},{key:"setFontSize",value:function(t){return "number"==typeof t&&(t=t.toString()+"px"),this.fontSize=t,this.update(!0)}},{key:"setTestString",value:function(t){return this.testString=t,this.update(!0)}},{key:"setFixedSize",value:function(t,e){return this.fixedWidth=t,this.fixedHeight=e,t&&(this.parent.width=t),e&&(this.parent.height=e),this.update(this.isWrapFitMode)}},{key:"setResolution",value:function(t){return this.resolution=t,this.update(!1)}},{key:"setLineSpacing",value:function(t){return this.lineSpacing=t,this.update(!1)}},{key:"setXOffset",value:function(t){return this.xOffset=t,this.update(!1)}},{key:"setBackgroundColor",value:function(t,e,i){return void 0===i&&(i=!0),this.backgroundColor=nl(t,this.parent.canvas,this.parent.context),this.backgroundColor2=nl(e,this.parent.canvas,this.parent.context),this.backgroundHorizontalGradient=i,this.update(!1)}},{key:"setBackgroundStrokeColor",value:function(t,e){return this.backgroundStrokeColor=nl(t,this.parent.canvas,this.parent.context),this.backgroundStrokeLineWidth=e,this.update(!1)}},{key:"setBackgroundCornerRadius",value:function(t,e){return this.backgroundCornerRadius=t,this.backgroundCornerIteration=e,this.update(!1)}},{key:"setFill",value:function(t){return this.color=nl(t,this.parent.canvas,this.parent.context),this.update(!1)}},{key:"setColor",value:function(t){return this.color=nl(t,this.parent.canvas,this.parent.context),this.update(!1)}},{key:"setStroke",value:function(t,e){return void 0===t?this.strokeThickness=0:(void 0===e&&(e=this.strokeThickness),this.stroke=nl(t,this.parent.canvas,this.parent.context),this.strokeThickness=e),this.update(!0)}},{key:"setShadow",value:function(t,e,i,n,r,s){return void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i="#000"),void 0===n&&(n=0),void 0===r&&(r=!1),void 0===s&&(s=!0),this.shadowOffsetX=t,this.shadowOffsetY=e,this.shadowColor=nl(i,this.parent.canvas,this.parent.context),this.shadowBlur=n,this.shadowStroke=r,this.shadowFill=s,this.update(!1)}},{key:"setShadowOffset",value:function(t,e){return void 0===t&&(t=0),void 0===e&&(e=t),this.shadowOffsetX=t,this.shadowOffsetY=e,this.update(!1)}},{key:"setShadowColor",value:function(t){return void 0===t&&(t="#000"),this.shadowColor=nl(t,this.parent.canvas,this.parent.context),this.update(!1)}},{key:"setShadowBlur",value:function(t){return void 0===t&&(t=0),this.shadowBlur=t,this.update(!1)}},{key:"setShadowStroke",value:function(t){return this.shadowStroke=t,this.update(!1)}},{key:"setShadowFill",value:function(t){return this.shadowFill=t,this.update(!1)}},{key:"setUnderline",value:function(t,e,i){return void 0===t&&(t="#000"),void 0===e&&(e=0),void 0===i&&(i=0),this.underlineColor=nl(t,this.parent.canvas,this.parent.context),this.underlineThickness=e,this.underlineOffset=i,this.update(!1)}},{key:"setUnderlineColor",value:function(t){return void 0===t&&(t="#000"),this.underlineColor=nl(t,this.parent.canvas,this.parent.context),this.update(!1)}},{key:"setUnderlineThickness",value:function(t){return void 0===t&&(t=0),this.underlineThickness=t,this.update(!1)}},{key:"setUnderlineOffset",value:function(t){return void 0===t&&(t=0),this.underlineOffset=t,this.update(!1)}},{key:"setStrikethrough",value:function(t,e,i){return void 0===t&&(t="#000"),void 0===e&&(e=0),void 0===i&&(i=0),this.strikethroughColor=nl(t,this.parent.canvas,this.parent.context),this.strikethroughThickness=e,this.strikethroughOffset=i,this.update(!1)}},{key:"setStrikethroughColor",value:function(t){return void 0===t&&(t="#000"),this.strikethroughColor=nl(t,this.parent.canvas,this.parent.context),this.update(!1)}},{key:"setStrikethroughThickness",value:function(t){return void 0===t&&(t=0),this.strikethroughThickness=t,this.update(!1)}},{key:"setStrikethroughOffset",value:function(t){return void 0===t&&(t=0),this.strikethroughOffset=t,this.update(!1)}},{key:"setWrapMode",value:function(t){return "string"==typeof t&&(t=yl[t.toLowerCase()]||0),this.wrapMode=t,this.update(!0)}},{key:"setWrapWidth",value:function(t){return this.wrapWidth=t,this.update(!1)}},{key:"setAlign",value:function(t,e){return void 0===t&&(t="left"),void 0===e&&(e="top"),this.halign=t,this.valign=e,this.update(!1)}},{key:"setHAlign",value:function(t){return void 0===t&&(t="left"),this.halign=t,this.update(!1)}},{key:"setVAlign",value:function(t){return void 0===t&&(t="top"),this.valign=t,this.update(!1)}},{key:"setMaxLines",value:function(t){return void 0===t&&(t=0),this.maxLines=t,this.update(!1)}},{key:"getTextMetrics",value:function(){var t=this.metrics;return {ascent:t.ascent,descent:t.descent,fontSize:t.fontSize}}},{key:"setTextMetrics",value:function(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=pl(e,"fontFamily",this.fontFamily),this.fontSize=pl(e,"fontSize",this.fontSize),this.fontStyle=pl(e,"fontStyle",this.fontStyle))),this.parent.updateText(!0)}},{key:"lineHeight",get:function(){return this.metrics.fontSize+this.strokeThickness+this.lineSpacing}},{key:"toJSON",value:function(){var t={},e=this.propertyMap;for(var i in e)t[i]=this[i];return t.metrics=this.getTextMetrics(),t}},{key:"destroy",value:function(){this.parent=void 0;}}]),t}(),yl={none:ul,word:cl,char:dl,character:dl},ml=Phaser.Math.DegToRad,kl=function(t){return !t.hasOwnProperty("convex")||t.convex},bl=function(t){return t.x>0&&t.y>0},wl=function(t,e,i,n,r,s,o,a,h){if(a&&o>s?o-=360:!a&&o=f?1:n/f,g=r>=v?1:r/v,y=d.cornerRadius;t.save(),t.beginPath(),t.translate(e,i),a=y.tl,bl(a)?(h=a.x*p,l=a.y*g,kl(a)?wl(t,h,l,h,l,180,270,!1,o):wl(t,0,0,h,l,90,0,!0,o),u=0,c=l):(t.lineTo(0,0),u=0,c=0),a=y.tr,bl(a)?(h=a.x*p,l=a.y*g,kl(a)?wl(t,n-h,l,h,l,270,360,!1,o):wl(t,n,0,h,l,180,90,!0,o)):t.lineTo(n,0),a=y.br,bl(a)?(h=a.x*p,l=a.y*g,kl(a)?wl(t,n-h,r-l,h,l,0,90,!1,o):wl(t,n,r,h,l,270,180,!0,o)):t.lineTo(n,r),a=y.bl,bl(a)?(h=a.x*p,l=a.y*g,kl(a)?wl(t,h,r-l,h,l,90,180,!1,o):wl(t,0,r,h,l,360,270,!0,o)):t.lineTo(0,r),t.lineTo(u,c),t.closePath(),t.restore();}(e,i,n,r,s,o,d),null!=a){var f;if(null!=u)(f=c?e.createLinearGradient(0,0,r,0):e.createLinearGradient(0,0,0,s)).addColorStop(0,a),f.addColorStop(1,u),a=f;e.fillStyle=a,e.fill();}null!=h&&l>0&&(e.strokeStyle=h,e.lineWidth=l,e.stroke());},Sl=function(t,e,i,n,r,s,o,a){if(null!=e||null!=i){var h=t.canvas.width,l=t.canvas.height;null==i&&(n=0);var u=n/2;h=Math.max(1,h-n),l=Math.max(1,l-n),xl(t.canvas,t.context,u,u,h,l,r,e,i,n,s,o,a);}},Cl={draw:function(t,e,i,n){var r=this.penManager;this.hitAreaManager.clear();var s=this.context;s.save();var o=this.defaultStyle;this.clear(),Sl(this,o.backgroundColor,o.backgroundStrokeColor,o.backgroundStrokeLineWidth,o.backgroundCornerRadius,o.backgroundColor2,o.backgroundHorizontalGradient,o.backgroundCornerIteration),t+=this.startXOffset,e+=this.startYOffset;var a,h,l,u,c,d,f=o.halign,v=o.valign,p=o.lineHeight,g=r.lines,y=g.length,m=o.maxLines;m>0&&y>m?(h=m,l="center"===v?Math.floor((y-h)/2):"bottom"===v?y-h:0):(h=y,l=0),u=l+h;var k=this.rtl,b=k?this.parent.width:void 0;d="center"===v?Math.max((n-h*p)/2,0):"bottom"===v?Math.max(n-h*p-2,0):0,d+=e;for(var w=l;w0&&t.width>0){var a=i+o.underlineOffset-o.underlineThickness/2;this.drawLine(e,a,t.width,o.underlineThickness,o.underlineColor);}if(t.isTextPen&&this.drawText(e,i,t.text,o),t.isImagePen&&this.drawImage(e,i,t.prop.img,o),o.strikethroughThickness>0&&t.width>0){a=i+o.strikethroughOffset-o.strikethroughThickness/2;this.drawLine(e,a,t.width,o.strikethroughThickness,o.strikethroughColor);}if(s.restore(),t.hasAreaMarker&&t.width>0){var h,l=t.prop.area;if(l)h={key:l};else {var u=t.prop.url;h={key:"url:".concat(u),url:u};}this.hitAreaManager.add(e,i-this.startYOffset,t.width,this.defaultStyle.lineHeight,h);}},clear:function(){var t=this.canvas;this.context.clearRect(0,0,t.width,t.height);},drawLine:function(t,e,i,n,r){this.autoRound&&(t=Math.round(t),e=Math.round(e));var s=this.context,o=s.lineCap;s.lineCap="butt",s.strokeStyle=r,s.lineWidth=n,s.beginPath(),s.moveTo(t,e),s.lineTo(t+i,e),s.stroke(),s.lineCap=o;},drawText:function(t,e,i,n){this.autoRound&&(t=Math.round(t),e=Math.round(e));var r=this.context;n.stroke&&"none"!==n.stroke&&n.strokeThickness>0&&(n.syncShadow(r,n.shadowStroke),r.strokeText(i,t,e)),n.color&&"none"!==n.color&&(n.syncShadow(r,n.shadowFill),r.fillText(i,t,e));},drawImage:function(t,e,i,n){e-=this.startYOffset,this.parent.imageManager.draw(i,this.context,t,e,this.autoRound);}},Ol=Phaser.Utils.Objects.GetValue,_l=al,Pl=hl,Tl=function(){function t(i){e(this,t),this.prop={},this.resetFromJSON(i);}return n(t,[{key:"resetFromJSON",value:function(t){this.text=Ol(t,"text",""),this.x=Ol(t,"x",0),this.y=Ol(t,"y",0),this.width=Ol(t,"width",0);var e=Ol(t,"prop",null);null===e&&(e={}),this.prop=e,this.newLineMode=Ol(t,"newLineMode",0),this.startIndex=Ol(t,"startIndex",0);}},{key:"plainText",get:function(){var t=this.text;return this.newLineMode===Pl&&(t+="\n"),t}},{key:"wrapText",get:function(){var t=this.text;return this.newLineMode!==_l&&(t+="\n"),t}},{key:"rawTextLength",get:function(){var t=this.text.length;return this.newLineMode===Pl&&(t+=1),t}},{key:"endIndex",get:function(){return this.startIndex+this.rawTextLength}},{key:"lastX",get:function(){return this.x+this.width}},{key:"isTextPen",get:function(){return ""!==this.text}},{key:"isImagePen",get:function(){return !!this.prop.img}},{key:"hasAreaMarker",get:function(){return !!this.prop.area||!!this.prop.url}}]),t}(),El=Phaser.Utils.Objects.GetFastValue,Rl=al,Ll=ll,Ml=function(){function t(i){e(this,t),this.pens=[],this.lines=[],this.maxLinesWidth=void 0,this.pensPool=i.pensPool,this.linesPool=i.linesPool,this.tagToText=El(i,"tagToText",Qt),this.tagToTextScope=El(i,"tagToTextScope",void 0);}return n(t,[{key:"destroy",value:function(){this.clear(),this.tagToText=void 0,this.tagToTextScope=void 0;}},{key:"clear",value:function(){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}},{key:"getLineEndIndex",value:function(t){t>=this.lines.length&&(t=this.lines.length-1);var e,i,n=!1;for(e=t;e>=0&&!(n=null!=(i=this.lines[e])&&i.length>0);e--);return n?i[i.length-1].endIndex:0}},{key:"getLineWidth",value:function(t){var e=this.lines[t];if(!e)return 0;var i=e[e.length-1];return null==i?0:i.lastX}},{key:"getMaxLineWidth",value:function(){if(void 0!==this.maxLinesWidth)return this.maxLinesWidth;for(var t,e=0,i=0,n=this.lines.length;ie&&(e=t);return this.maxLinesWidth=e,e}},{key:"getLineWidths",value:function(){for(var t=[],e=0,i=this.lines.length;e=t&&h<=e||(o=o.substring(t-a,e-a)),this.tagToTextScope?c+=this.tagToText.call(this.tagToTextScope,o,l,u):c+=this.tagToText(o,l,u),u=l,!(h>=e)));d++);return c}},{key:"length",get:function(){return this.lines.length},set:function(t){this.clear();}}]),t}(),Al={},Dl=function(){function t(){e(this,t),this.items=[];}return n(t,[{key:"destroy",value:function(){this.clear(),this.items=void 0;}},{key:"pop",value:function(){return this.items.length>0?this.items.pop():null}},{key:"push",value:function(t){return this.items.push(t),this}},{key:"pushMultiple",value:function(t){return this.items.push.apply(this.items,t),t.length=0,this}},{key:"clear",value:function(){return this.items.length=0,this}}]),t}(),zl=Phaser.Geom.Rectangle,Bl=new Dl,jl=function(){function t(){e(this,t),this.hitAreas=[];}return n(t,[{key:"destroy",value:function(){this.clear();}},{key:"clear",value:function(){for(var t=0,e=this.hitAreas.length;tr){""!==C?a.push(o.getLine(C,O,Gl)):0===P&&s>0&&a.push(o.getLine("",0,Gl)),a.push.apply(a,v(t(b,i,Vl,r,0,o)));var E=a.pop();C=E.text,O=E.width,o.freeLine(E)," "===C&&(C="",O=0);}else (S=O+w)>l?(a.push(o.getLine(C,O,Gl)),C=b,O=w,l=r):(C+=b,O=S),x&&a.push(o.getLine(C,O,u));}return a},ql=Phaser.Utils.Objects.GetValue,Zl=ul,$l=al,Ql=function(){function t(i){e(this,t),this.parent=i.parent,this.scene=this.parent.scene,this.context=ql(i,"context",null),this.canvas=this.context.canvas,this.parser=ql(i,"parser",null),this.defaultStyle=ql(i,"style",null),this.autoRound=!0,this.pensPool=i.pensPool,this.linesPool=i.linesPool,this.wrapTextLinesPool=i.wrapTextLinesPool,this.penManager=this.newPenManager(),this._tmpPenManager=null,this.hitAreaManager=new jl,this.lastHitAreaKey=null,this.urlTagCursorStyle=null;var n=this.context;this.getTextWidth=function(t){return n.measureText(t).width};}return n(t,[{key:"destroy",value:function(){this.parent=void 0,this.scene=void 0,this.context=void 0,this.canvas=void 0,this.parser=void 0,this.defaultStyle=void 0,this.penManager&&(this.penManager.destroy(),this.penManager=void 0),this._tmpPenManager&&(this._tmpPenManager.destroy(),this._tmpPenManager=void 0),this.hitAreaManager&&(this.hitAreaManager.destroy(),this.hitAreaManager=void 0),this.pensPool=void 0,this.linesPool=void 0,this.wrapTextLinesPool=void 0;}},{key:"updatePenManager",value:function(t,e,i,n,r){if(void 0===r&&(r=this.penManager),r.clear(),""===t)return r;var s=this.parent.style;if(s.isWrapFitMode){var o=this.parent.padding;i=s.fixedWidth-o.left-o.right;}for(var a,h,l,u,c,d=this.canvas,f=this.context,v=function(t){return f.measureText(t).width},p=0,g=0,y=s.wrapCallback,m=s.wrapCallbackScope,k=!0,b=this.parser.splitText(t),w=this.wrapTextLinesPool,x=0,S=b.length;x0&&e!==Zl&&i0&&t>e&&(t=e),t}},{key:"linesWidth",get:function(){return Math.ceil(this.penManager.getMaxLineWidth())}},{key:"linesHeight",get:function(){var t=this.desplayLinesCount,e=this.defaultStyle.lineHeight*t;return t>0&&(e-=this.defaultStyle.lineSpacing),e}},{key:"imageManager",get:function(){return this.parent.imageManager}},{key:"rtl",get:function(){return this.parent.style.rtl}},{key:"newPenManager",value:function(){return new Ml({pensPool:this.pensPool,linesPool:this.linesPool,tagToText:this.parser.propToTagText,tagToTextScope:this.parser})}},{key:"tmpPenManager",get:function(){return null===this._tmpPenManager&&(this._tmpPenManager=this.newPenManager()),this._tmpPenManager}},{key:"getPlainText",value:function(t,e,i){var n;if(null==t)n=this.penManager.plainText;else {var r=this.parser.splitText(t,1);n="";for(var s=0,o=r.length;si.width?i.width-r:0;var s=this.drawY+this.drawTLY,o=s+this.height;return e=s<0?0-s:o>i.height?i.height-o:0,i._textOX+=t,i._textOY+=e,this}};Object.assign(mc,hc);var kc=Phaser.Math.DegToRad,bc=Phaser.Math.RadToDeg,wc=Phaser.Utils.Objects.GetValue,xc=function(t){r(s,t);var i=l(s);function s(t,n){var r;return e(this,s),(r=i.call(this,t,n)).renderable=!0,r.scrollFactorX=1,r.scrollFactorY=1,r.toLocalPosition=!0,r.originX=0,r.offsetX=0,r.offsetY=0,r}return n(s,[{key:"visible",get:function(){return this._visible},set:function(t){this.setDirty(this._visible!=t),this._visible=t;}},{key:"setVisible",value:function(t){return void 0===t&&(t=!0),this.visible=t,this}},{key:"alpha",get:function(){return this._alpha},set:function(t){this.setDirty(this._alpha!=t),this._alpha=t;}},{key:"setAlpha",value:function(t){return this.alpha=t,this}},{key:"x",get:function(){return this._x},set:function(t){this.setDirty(this._x!=t),this._x=t;}},{key:"setX",value:function(t){return this.x=t,this}},{key:"y",get:function(){return this._y},set:function(t){this.setDirty(this._y!=t),this._y=t;}},{key:"setY",value:function(t){return this.y=t,this}},{key:"setPosition",value:function(t,e){return this.x=t,this.y=e,this}},{key:"setInitialPosition",value:function(t,e){return this.x0=t,this.y0=e,this}},{key:"setScrollFactorX",value:function(t){return this.scrollFactorX=t,this}},{key:"setScrollFactorY",value:function(t){return this.scrollFactorY=t,this}},{key:"setScrollFactor",value:function(t,e){return void 0===e&&(e=t),this.scrollFactorX=t,this.scrollFactorY=e,this}},{key:"rotation",get:function(){return this._rotation},set:function(t){this.setDirty(this._rotation!=t),this._rotation=t;}},{key:"setRotation",value:function(t){return this.rotation=t,this}},{key:"angle",get:function(){return bc(this._rotation)},set:function(t){this.rotation=kc(t);}},{key:"setAngle",value:function(t){return this.angle=t,this}},{key:"scaleX",get:function(){return this._scaleX},set:function(t){this.setDirty(this._scaleX!==t),this._scaleX=t;}},{key:"setScaleX",value:function(t){return this.scaleX=t,this}},{key:"width",get:function(){return 0},set:function(t){}},{key:"setWidth",value:function(t,e){return void 0===e&&(e=!1),this.width=t,e&&(this.scaleY=this.scaleX),this}},{key:"leftSpace",get:function(){return this._leftSpace},set:function(t){this.setDirty(this._leftSpace!==t),this._leftSpace=t;}},{key:"setLeftSpace",value:function(t){return this.leftSpace=t,this}},{key:"rightSpace",get:function(){return this._rightSpace},set:function(t){this.setDirty(this._rightSpace!==t),this._rightSpace=t;}},{key:"setRightSpace",value:function(t){return this.rightSpace=t,this}},{key:"outerWidth",get:function(){return this.width+this.leftSpace+this.rightSpace}},{key:"scaleY",get:function(){return this._scaleY},set:function(t){this.setDirty(this._scaleY!==t),this._scaleY=t;}},{key:"setScaleY",value:function(t){return this.scaleY=t,this}},{key:"height",get:function(){return 0},set:function(t){}},{key:"setHeight",value:function(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}},{key:"setScale",value:function(t,e){return void 0===e&&(e=t),this.scaleX=t,this.scaleY=e,this}},{key:"setOrigin",value:function(t){return this.originX=t,this}},{key:"setAlign",value:function(t){return this.align=t,this}},{key:"modifyPorperties",value:function(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=wc(t,"width",void 0),i=wc(t,"height",void 0),n=wc(t,"scaleX",void 0),r=wc(t,"scaleY",void 0);return void 0!==e?void 0===i&&void 0===r?this.setWidth(e,!0):this.setWidth(e):void 0!==n&&this.setScaleX(n),void 0!==i?void 0===e&&void 0===n?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}},{key:"setDrawBelowCallback",value:function(t){return this.drawBelowCallback=t,this}},{key:"setDrawAboveCallback",value:function(t){return this.drawAboveCallback=t,this}},{key:"reset",value:function(){return this.setVisible().setAlpha(1).setPosition(0,0).setRotation(0).setScale(1,1).setLeftSpace(0).setRightSpace(0).setOrigin(0).setAlign().setDrawBelowCallback().setDrawAboveCallback(),this}},{key:"willRender",get:function(){return this.visible&&this.alpha>0}},{key:"drawX",get:function(){var t=this.x+this.leftSpace+this.offsetX-this.originX*this.width;return this.parent._textOX*this.scrollFactorX+t}},{key:"drawY",get:function(){var t=this.y+this.offsetY;return this.parent._textOY*this.scrollFactorY+t}},{key:"drawTLX",get:function(){return 0}},{key:"drawTLY",get:function(){return 0}},{key:"drawBLX",get:function(){return 0}},{key:"drawBLY",get:function(){return 0}},{key:"drawTRX",get:function(){return 0}},{key:"drawTRY",get:function(){return 0}},{key:"drawBRX",get:function(){return 0}},{key:"drawBRY",get:function(){return 0}},{key:"drawCenterX",get:function(){return (this.drawTRX+this.drawTLX)/2}},{key:"drawCenterY",get:function(){return (this.drawBLY+this.drawTLY)/2}}]),s}(ic);Object.assign(xc.prototype,mc);var Sc=function(t,e,i){return e.hasOwnProperty(t)?e[t]:i[t]},Cc=Phaser.Utils.Objects.GetValue,Oc=function(t){r(o,t);var i=l(o);function o(t,n){var r;return e(this,o),(r=i.call(this,t,"background")).setScrollFactor(0),r.setColor(Cc(n,"color",null),Cc(n,"color2",null),Cc(n,"horizontalGradient",!0)),r.setStroke(Cc(n,"stroke",null),Cc(n,"strokeThickness",2)),r.setCornerRadius(Cc(n,"cornerRadius",0),Cc(n,"cornerIteration",null)),r}return n(o,[{key:"color",get:function(){return this._color},set:function(t){t=nl(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t;}},{key:"color2",get:function(){return this._color2},set:function(t){t=nl(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t;}},{key:"horizontalGradient",get:function(){return this._horizontalGradient},set:function(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t;}},{key:"setColor",value:function(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}},{key:"stroke",get:function(){return this._stroke},set:function(t){t=nl(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t;}},{key:"strokeThickness",get:function(){return this._strokeThickness},set:function(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t;}},{key:"setStroke",value:function(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}},{key:"cornerRadius",get:function(){return this._cornerRadius},set:function(t){this.setDirty(this._cornerRadius!=t),this._cornerRadius=t;}},{key:"cornerIteration",get:function(){return this._cornerIteration},set:function(t){this.setDirty(this._cornerIteration!=t),this._cornerIteration=t;}},{key:"modifyStyle",value:function(t){return t.hasOwnProperty("color")&&this.setColor(t.color,Sc("color2",t,this),Sc("horizontalGradient",t,this)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,Sc("strokeThickness",t,this)),t.hasOwnProperty("cornerRadius")&&this.setCornerRadius(t.cornerRadius,Sc("cornerIteration",t,this)),this}},{key:"modifyPorperties",value:function(t){return c(s(o.prototype),"modifyPorperties",this).call(this,t),this.modifyStyle(t),this}},{key:"setCornerRadius",value:function(t,e){return this.cornerRadius=t,this.cornerIteration=e,this}},{key:"renderContent",value:function(){Sl(this.parent,this.color,this.stroke,this.strokeThickness,this.cornerRadius,this.color2,this.horizontalGradient,this.cornerIteration);}}]),o}(xc),_c=Phaser.Utils.Objects.GetValue,Pc=function(t){r(o,t);var i=l(o);function o(t,n){var r;return e(this,o),(r=i.call(this,t,"innerbounds")).setScrollFactor(0),r.setColor(_c(n,"color",null),_c(n,"color2",null),_c(n,"horizontalGradient",!0)),r.setStroke(_c(n,"stroke",null),_c(n,"strokeThickness",2)),r}return n(o,[{key:"color",get:function(){return this._color},set:function(t){t=nl(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t;}},{key:"color2",get:function(){return this._color2},set:function(t){t=nl(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t;}},{key:"horizontalGradient",get:function(){return this._horizontalGradient},set:function(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t;}},{key:"setColor",value:function(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}},{key:"stroke",get:function(){return this._stroke},set:function(t){t=nl(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t;}},{key:"strokeThickness",get:function(){return this._strokeThickness},set:function(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t;}},{key:"setStroke",value:function(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}},{key:"modifyPorperties",value:function(t){c(s(o.prototype),"modifyPorperties",this).call(this,t),t.hasOwnProperty("color")&&this.setColor(t.color,_c(t,"color2",null),_c(t,"horizontalGradient",!0)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,_c(t,"strokeThickness",2));}},{key:"renderContent",value:function(){var t=this.parent.padding,e=t.left,i=t.top,n=this.parent.width-t.left-t.right,r=this.parent.height-t.top-t.bottom,s=this.context;if(null!=this.color){var o,a;if(null!=this.color2)(a=this.horizontalGradient?s.createLinearGradient(0,0,n,0):s.createLinearGradient(0,0,0,r)).addColorStop(0,this.color),a.addColorStop(1,this.color2),o=a;else o=this.color;s.fillStyle=o,s.fillRect(e,i,n,r);}null!=this.stroke&&this.strokeThickness>0&&(s.strokeStyle=this.stroke,s.lineWidth=this.strokeThickness,s.strokeRect(e,i,n,r));}}]),o}(xc),Tc=Phaser.Utils.Objects.GetValue,Ec=function(){function t(i,n){e(this,t),this.parent=i,this.set(n);}return n(t,[{key:"toJSON",value:function(){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}}},{key:"set",value:function(t){return this.setBold(Tc(t,"bold",!1)),this.setItalic(Tc(t,"italic",!1)),this.setFontSize(Tc(t,"fontSize","16px")),this.setFontFamily(Tc(t,"fontFamily","Courier")),this.setColor(Tc(t,"color","#fff")),this.setStrokeStyle(Tc(t,"stroke",null),Tc(t,"strokeThickness",0)),this.setShadow(Tc(t,"shadowColor",null),Tc(t,"shadowOffsetX",0),Tc(t,"shadowOffsetY",0),Tc(t,"shadowBlur",0)),this.setOffset(Tc(t,"offsetX",0),Tc(t,"offsetY",0)),this.setSpace(Tc(t,"leftSpace",0),Tc(t,"rightSpace",0)),this.setAlign(Tc(t,"align",void 0)),this.setBackgroundColor(Tc(t,"backgroundColor",null)),this.setBackgroundHeight(Tc(t,"backgroundHeight",void 0)),this.setBackgroundBottomY(Tc(t,"backgroundBottomY",void 0)),this}},{key:"modify",value:function(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(Sc("stroke",t,this),Sc("strokeThickness",t,this)),t.hasOwnProperty("shadowColor")&&this.setShadowColor(t.shadowColor),(t.hasOwnProperty("shadowOffsetX")||t.hasOwnProperty("shadowOffsetY"))&&this.setShadowOffset(Sc("shadowOffsetX",t,this),Sc("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}},{key:"setUpdateTextFlag",value:function(){return this.parent&&(this.parent.updateTextFlag=!0),this}},{key:"clone",value:function(){return new t(null,this.toJSON())}},{key:"copyFrom",value:function(t){return this.set(t.toJSON()),this}},{key:"copyTo",value:function(t){return t.set(this.toJSON()),this}},{key:"setBold",value:function(t){return void 0===t&&(t=!0),this.bold=t,this.setUpdateTextFlag(),this}},{key:"setItalic",value:function(t){return void 0===t&&(t=!0),this.italic=t,this.setUpdateTextFlag(),this}},{key:"fontStyle",get:function(){return this.bold&&this.italic?"bold italic":this.bold?"bold":this.italic?"italic":""}},{key:"setFontSize",value:function(t){return "number"==typeof t&&(t="".concat(t,"px")),this.fontSize=t,this.setUpdateTextFlag(),this}},{key:"setFontFamily",value:function(t){return this.fontFamily=t,this.setUpdateTextFlag(),this}},{key:"font",get:function(){return "".concat(this.fontStyle," ").concat(this.fontSize," ").concat(this.fontFamily)}},{key:"setColor",value:function(t){return this.color=nl(t),this}},{key:"hasFill",get:function(){return null!=this.color}},{key:"setStrokeStyle",value:function(t,e){return this.stroke=nl(t),void 0!==e&&(this.strokeThickness=e),this}},{key:"setStrokeThickness",value:function(t){return this.strokeThickness=t,this}},{key:"hasStroke",get:function(){return null!=this.stroke&&this.strokeThickness>0}},{key:"setShadowColor",value:function(t){return this.shadowColor=nl(t),this}},{key:"setShadowOffset",value:function(t,e){return void 0===t&&(t=0),void 0===e&&(e=0),this.shadowOffsetX=t,this.shadowOffsetY=e,this}},{key:"setShadowBlur",value:function(t){return void 0===t&&(t=0),this.shaodwBlur=t,this}},{key:"setShadow",value:function(t,e,i,n){return this.setShadowColor(t).setShadowOffset(e,i).setShadowBlur(n),this}},{key:"setBackgroundColor",value:function(t){return this.backgroundColor=nl(t),this}},{key:"hasBackgroundColor",get:function(){return null!=this.backgroundColor}},{key:"setBackgroundHeight",value:function(t){return this.backgroundHeight=t,this}},{key:"setBackgroundBottomY",value:function(t){return this.backgroundBottomY=t,this}},{key:"setOffsetX",value:function(t){return void 0===t&&(t=0),this.offsetX=t,this}},{key:"setOffsetY",value:function(t){return void 0===t&&(t=0),this.offsetY=t,this}},{key:"setOffset",value:function(t,e){return this.setOffsetX(t).setOffsetY(e),this}},{key:"setLeftSpace",value:function(t){return void 0===t&&(t=0),this.leftSpace=t,this}},{key:"setRightSpace",value:function(t){return void 0===t&&(t=0),this.rightSpace=t,this}},{key:"setSpace",value:function(t,e){return this.setLeftSpace(t).setRightSpace(e),this}},{key:"setAlign",value:function(t){return this.align=t,this}},{key:"syncFont",value:function(t){return t.font=this.font,this}},{key:"syncStyle",value:function(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}},{key:"syncShadow",value:function(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);}},{key:"getTextMetrics",value:function(t,e){return this.syncFont(t).syncStyle(t),t.measureText(e)}}]),t}(),Rc=Phaser.Utils.Array.Remove,Lc=Phaser.Utils.Array.Remove,Mc="text",Ac="image",Dc="drawer",zc="space",Bc="command",jc=function(t){return t.type===Mc&&"\n"===t.text},Wc=function(t){return t.type===Mc&&"\f"===t.text},Fc=function(t){return t.type===Mc},Ic=function(t){r(o,t);var i=l(o);function o(t,n,r){var s;return e(this,o),(s=i.call(this,t,Mc)).updateTextFlag=!1,s.style=new Ec(a(s),r),s.setText(n),s}return n(o,[{key:"autoRound",get:function(){return this.parent.autoRound}},{key:"offsetX",get:function(){return this.style.offsetX},set:function(t){this.style&&(this.style.offsetX=t);}},{key:"offsetY",get:function(){return this.style.offsetY},set:function(t){this.style&&(this.style.offsetY=t);}},{key:"leftSpace",get:function(){return this.style.leftSpace*this.scaleX},set:function(t){this.style&&(this.style.leftSpace=t),f(s(o.prototype),"leftSpace",t,this,!0);}},{key:"rightSpace",get:function(){return this.style.rightSpace*this.scaleX},set:function(t){this.style&&(this.style.rightSpace=t),f(s(o.prototype),"rightSpace",t,this,!0);}},{key:"align",get:function(){return this.style.align},set:function(t){this.style&&(this.style.align=t);}},{key:"modifyStyle",value:function(t){return this.setDirty(!0),this.style.modify(t),this.updateTextFlag&&this.updateTextSize(),this}},{key:"modifyPorperties",value:function(t){return t?(this.modifyStyle(t),c(s(o.prototype),"modifyPorperties",this).call(this,t),this):this}},{key:"setText",value:function(t){return this.setDirty(this.text!=t),this.text=t,this.updateTextSize(),this}},{key:"updateTextSize",value:function(){var t=this.text;if("\n"===t||"\f"===t||""===t)this.clearTextSize();else {var e,i,n=this.style.getTextMetrics(this.context,this.text);this.textWidth=n.width,"actualBoundingBoxAscent"in n?(e=n.actualBoundingBoxAscent,i=n.actualBoundingBoxDescent):(e=0,i=0),this.textHeight=e+i,this.ascent=e,this.descent=i;}return this.updateTextFlag=!1,this}},{key:"clearTextSize",value:function(){return this.textWidth=0,this.textHeight=0,this.ascent=0,this.descent=0,this}},{key:"copyTextSize",value:function(t){return this.textWidth=t.textWidth,this.textHeight=t.textHeight,this.ascent=t.ascent,this.descent=t.descent,this}},{key:"width",get:function(){return this.textWidth*this.scaleX},set:function(t){this.textWidth>0?this.scaleX=t/this.textWidth:this.scaleX=1;}},{key:"height",get:function(){return this.textHeight*this.scaleY},set:function(t){this.textHeight>0?this.scaleY=t/this.textHeight:this.scaleY=1;}},{key:"willRender",get:function(){return 0!==this.textWidth&&c(s(o.prototype),"willRender",this)}},{key:"renderContent",value:function(){var t=this.context,e=this.style;if(e.hasBackgroundColor){t.fillStyle=e.backgroundColor;var i=this.drawTLX,n=this.drawTRX-i,r=e.backgroundBottomY;null==r&&(r=this.drawBLY);var s=e.backgroundHeight;null==s&&(s=r-this.drawTLY);var o=r-s;t.fillRect(i,o,n,s);}var a=e.hasFill,h=e.hasStroke;(a||h)&&(e.syncFont(t).syncStyle(t),h&&(e.syncShadow(t),t.strokeText(this.text,0,0)),a&&(e.syncShadow(t),t.fillText(this.text,0,0)));}},{key:"drawTLX",get:function(){return -this.leftSpace}},{key:"drawTLY",get:function(){return -this.ascent}},{key:"drawBLX",get:function(){return -this.leftSpace}},{key:"drawBLY",get:function(){return this.descent}},{key:"drawTRX",get:function(){return this.textWidth+this.rightSpace}},{key:"drawTRY",get:function(){return -this.ascent}},{key:"drawBRX",get:function(){return this.textWidth+this.rightSpace}},{key:"drawBRY",get:function(){return this.descent}}]),o}(xc),Xc=function(t,e){var i=this.createCharChildren(t,e);return this.addChild(i),this},Yc=function(t){r(s,t);var i=l(s);function s(t,n,r){var o;return e(this,s),(o=i.call(this,t,Ac)).setTexture(n,r),o}return n(s,[{key:"frameWidth",get:function(){return this.frameObj?this.frameObj.cutWidth:0}},{key:"frameHeight",get:function(){return this.frameObj?this.frameObj.cutHeight:0}},{key:"offsetY",get:function(){return -this.height},set:function(t){}},{key:"key",get:function(){return this._key},set:function(t){this.setDirty(this._key!=t),this._key=t;}},{key:"frame",get:function(){return this._frame},set:function(t){this.setDirty(this._frame!=t),this._frame=t;}},{key:"setTexture",value:function(t,e){return this.key=t,this.frame=e,this.frameObj=this.scene.sys.textures.getFrame(t,e),this}},{key:"width",get:function(){return this.frameWidth*this.scaleX},set:function(t){this.setDirty(this.width!==t),this.scaleX=t/this.frameWidth;}},{key:"height",get:function(){return this.frameHeight*this.scaleY},set:function(t){this.setDirty(this.height!==t),this.scaleY=t/this.frameHeight;}},{key:"setHeight",value:function(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}},{key:"renderContent",value:function(){var t=this.context,e=this.frameObj,i=this.frameWidth,n=this.frameHeight;t.drawImage(e.source.image,e.cutX,e.cutY,i,n,0,0,i,n);}},{key:"drawTLX",get:function(){return -this.leftSpace}},{key:"drawTLY",get:function(){return 0}},{key:"drawBLX",get:function(){return -this.leftSpace}},{key:"drawBLY",get:function(){return this.frameHeight}},{key:"drawTRX",get:function(){return this.frameWidth+this.rightSpace}},{key:"drawTRY",get:function(){return 0}},{key:"drawBRX",get:function(){return this.frameWidth+this.rightSpace}},{key:"drawBRY",get:function(){return this.frameHeight}}]),s}(xc),Nc=function(t){r(o,t);var i=l(o);function o(t,n,r,s){var a;return e(this,o),(a=i.call(this,t,Dc)).setRenderCallback(n),a.setDrawerSize(r,s),a}return n(o,[{key:"setRenderCallback",value:function(t){return t?this.renderContent=t.bind(this):delete this.renderContent,this}},{key:"setDrawerSize",value:function(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}},{key:"onFree",value:function(){c(s(o.prototype),"onFree",this).call(this),this.setRenderCallback();}},{key:"width",get:function(){return this.drawerWidth*this.scaleX},set:function(t){this.setDirty(this.width!==t),this.scaleX=this.drawerWidth>0?t/this.drawerWidth:1;}},{key:"height",get:function(){return this.drawerHeight*this.scaleY},set:function(t){this.setDirty(this.height!==t),this.scaleY=this.drawerHeight>0?t/this.drawerHeight:1;}},{key:"offsetY",get:function(){return -this.height},set:function(t){}},{key:"drawTLX",get:function(){return -this.leftSpace}},{key:"drawTLY",get:function(){return 0}},{key:"drawBLX",get:function(){return -this.leftSpace}},{key:"drawBLY",get:function(){return this.drawerHeight}},{key:"drawTRX",get:function(){return this.drawerWidth+this.rightSpace}},{key:"drawTRY",get:function(){return 0}},{key:"drawBRX",get:function(){return this.drawerWidth+this.rightSpace}},{key:"drawBRY",get:function(){return this.drawerHeight}}]),o}(xc),Gc=function(t){r(s,t);var i=l(s);function s(t,n){var r;return e(this,s),(r=i.call(this,t,zc)).setSpaceWidth(n),r}return n(s,[{key:"width",get:function(){return this.spaceWidth*this.scaleX},set:function(t){this.spaceWidth>0?this.scaleX=t/this.spaceWidth:this.scaleX=1;}},{key:"setSpaceWidth",value:function(t){return this.spaceWidth=t,this}}]),s}(xc),Hc=function(t){r(o,t);var i=l(o);function o(t,n,r,s,a){var h;return e(this,o),(h=i.call(this,t,Bc)).setName(n).setParameter(s).setCallback(r,a),h}return n(o,[{key:"setName",value:function(t){return this.name=t,this}},{key:"setParameter",value:function(t){return this.param=t,this}},{key:"setCallback",value:function(t,e){return this.callback=t,this.scope=e,this}},{key:"exec",value:function(){return this.scope?this.callback.call(this.scope,this.param,this.name):this.callback(this.param,this.name)}},{key:"onFree",value:function(){c(s(o.prototype),"onFree",this).call(this),this.setName().setCallback().setParameter();}}]),o}(ic),Uc=function(t,e,i,n){void 0===n&&(n={word:[],width:0}),n.word.length=0;for(var r=t.length,s=e,o=n.word,a=0;s0&&!a){var h=this.fixedHeight-n;if(i>0)s=h/i;else s=(l=Kc.call(this)).height,o=l.ascent,i=Math.floor((h-o)/s);}else {var l;s=(l=Kc.call(this)).height,o=l.ascent;}}else if(this.fixedHeight>0){if(void 0===(i=Zc(t,"maxLines"))){h=this.fixedHeight-n;i=Math.floor(h/s);}}else i=Zc(t,"maxLines",0);void 0===o&&(o=s);var u=0===i,c=Zc(t,"wrapWidth",void 0);void 0===c&&(c=this.fixedWidth>0?this.fixedWidth-r:1/0);for(var d=Zc(t,"letterSpacing",0),f=Zc(t,"hAlign",0),v=Zc(t,"vAlign",0),p=Zc(t,"charWrap",!1),g={callback:"runWordWrap",start:e,isLastPage:!1,padding:this.wrapPadding,ascent:o,lineHeight:s,maxLines:i,wrapWidth:c,letterSpacing:d,hAlign:f,vAlign:v,charWrap:p,children:[],lines:[],maxLineWidth:0,linesHeight:0},y=this.children,m=0,k=y.length;m0&&(T.push({children:E,width:R}),L=Math.max(L,R)),g.start+=P.length,g.isLastPage=!M&&g.start===_,g.maxLineWidth=L,g.linesHeight=T.length*s;var F=this.fixedWidth>0?this.fixedWidth:g.maxLineWidth+r,I=this.fixedHeight>0?this.fixedHeight:g.linesHeight+n;!function(t,e,i){var n,r,s=t.hAlign,o=t.vAlign,a=t.linesHeight;switch(o){case 1:case"center":r=(i-a)/2;break;case 2:case"bottom":r=i-a;break;default:r=0;}for(var h=t.lines,l=0,u=h.length;l0?(o=this.fixedWidth-r)/i:0;else if(this.fixedWidth>0){if(void 0===(i=td(t,"maxLines",void 0))){var o=this.fixedWidth-r;i=Math.floor(o/s)+1;}}else i=td(t,"maxLines",0);var a=0===i,h=td(t,"fixedChildHeight",void 0);if(void 0===h){var l=td(t,"charPerLine",void 0);if(void 0!==l){var u=this.fixedHeight-n;h=Math.floor(u/l);}}var c=td(t,"wrapHeight",void 0);void 0===c&&(c=this.fixedHeight>0?this.fixedHeight-n:1/0);for(var d=td(t,"letterSpacing",0),f=td(t,"rtl",!0),v=td(t,"hAlign",f?2:0),p=td(t,"vAlign",0),g={callback:"runVerticalWrap",start:e,isLastPage:!1,padding:this.wrapPadding,lineWidth:s,maxLines:i,fixedChildHeight:h,wrapHeight:c,letterSpacing:d,hAlign:v,vAlign:p,rtl:f,children:[],lines:[],maxLineHeight:0,linesWidth:0},y=this.children,m=0,k=y.length;m0&&(T.push({children:E,height:R}),L=Math.max(L,R)),g.start+=P.length,g.isLastPage=g.start===_,g.maxLineHeight=L,g.linesWidth=T.length*s;var j=this.fixedWidth>0?this.fixedWidth:g.linesWidth+r,W=this.fixedHeight>0?this.fixedHeight:g.maxLineHeight+n;!function(t,e,i){var n,r,s=t.hAlign,o=t.vAlign,a=t.rtl,h=t.lines,l=t.lineWidth,u=t.linesWidth;switch(s){case 1:case"center":n=(e-u)/2;break;case 2:case"right":n=e-u;break;default:n=0;}a&&(n+=l);for(var c=0,d=h.length;c0?t:this.width,e>0?e:this.height),this):this},setPadding:function(t,e){var i=this.padding,n=i.left,r=i.right,s=i.top,o=i.bottom;return Ne(i,t,e),this.dirty=this.dirty||n!=i.left||r!=i.right||s!=i.top||o!=i.bottom,this},getPadding:function(t){return Ye(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),Rc(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 Lc(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,n,r,s=Array.isArray(t);void 0===e||e===this.children.length?s?(i=this.children).push.apply(i,v(t)):this.children.push(t):s?(n=this.children).splice.apply(n,[e,0].concat(v(t))):this.children.splice(e,0,t);(this.lastAppendedChildren.length=0,s)?(r=this.lastAppendedChildren).push.apply(r,v(t)):this.lastAppendedChildren.push(t);return this},createCharChild:function(t,e){e&&this.textStyle.modify(e);var i=this.poolManager.allocate(Mc);return null===i?i=new Ic(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=[],n=0,r=t.length;ne&&(n=e,r=t);})),r},getCharWorldPosition:function(t,e,i,n){return "number"==typeof t&&(t=this.getCharChild(t,!0)),yc(this,t,e,i,n)},setToMinSize:function(){for(var t=this.children,e=0,i=0,n=0,r=t.length;n=i.length&&(t=i.length);for(var n=0,r=0;rh;u--){for(c=0;c0&&this.wrapMode!==ul&&0===this.wrapWidth}},{key:"setStyle",value:function(t,e,i){if(void 0===e&&(e=!0),void 0===i&&(i=!1),t&&t.hasOwnProperty("wrap")){var n=t.wrap;if(n.hasOwnProperty("mode")){var r=n.mode;"string"==typeof r&&(n.mode=yl[r]);}else n.hasOwnProperty("width")&&(n.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 s=this.propertyMap;for(var o in s){var a=s[o],h=a[0],l=i?a[1]:this[o],u=a[2];if("wrapCallback"===o||"wrapCallbackScope"===o)this[o]=pl(t,h,l);else {var c=vl(t,h,l);u&&(c=u(c)),this[o]=c;}}var d=pl(t,"font",null);this._font=null===d?this.fontStyle+" "+this.fontSize+" "+this.fontFamily:d;var f=pl(t,"fill",null);null!==f&&(this.color=nl(f));var v=pl(t,"metrics",!1);return v?this.metrics={ascent:pl(v,"ascent",0),descent:pl(v,"descent",0),fontSize:pl(v,"fontSize",0)}:!e&&this.metrics||(this.metrics=ol(this)),e?this.parent.updateText():this.parent}},{key:"syncFont",value:function(t,e){e.font=this._font;}},{key:"syncStyle",value:function(t,e){e.textBaseline="alphabetic",e.fillStyle=this.color,e.strokeStyle=this.stroke,e.lineWidth=this.strokeThickness,e.lineCap="round",e.lineJoin="round";}},{key:"syncShadow",value:function(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);}},{key:"update",value:function(t){return t&&(this._font="".concat(this.fontStyle," ").concat(this.fontSize," ").concat(this.fontFamily).trim(),this.metrics=ol(this)),this.parent.updateText(t)}},{key:"buildFont",value:function(){var t="".concat(this.fontStyle," ").concat(this.fontSize," ").concat(this.fontFamily).trim();return t!==this._font&&(this._font=t),this}},{key:"setFont",value:function(t){return "string"==typeof t?(this.fontFamily=t,this.fontSize="",this.fontStyle=""):(this.fontFamily=pl(t,"fontFamily","Courier"),this.fontSize=pl(t,"fontSize","16px"),this.fontStyle=pl(t,"fontStyle","")),this.update(!0)}},{key:"setFontFamily",value:function(t){return this.fontFamily=t,this.update(!0)}},{key:"setFontStyle",value:function(t){return this.fontStyle=t,this.update(!0)}},{key:"setFontSize",value:function(t){return "number"==typeof t&&(t=t.toString()+"px"),this.fontSize=t,this.update(!0)}},{key:"setTestString",value:function(t){return this.testString=t,this.update(!0)}},{key:"setFixedSize",value:function(t,e){return this.fixedWidth=t,this.fixedHeight=e,t&&(this.parent.width=t),e&&(this.parent.height=e),this.update(this.isWrapFitMode)}},{key:"setResolution",value:function(t){return this.resolution=t,this.update(!1)}},{key:"setLineSpacing",value:function(t){return this.lineSpacing=t,this.update(!1)}},{key:"setXOffset",value:function(t){return this.xOffset=t,this.update(!1)}},{key:"setBackgroundColor",value:function(t,e,i){return void 0===i&&(i=!0),this.backgroundColor=nl(t,this.parent.canvas,this.parent.context),this.backgroundColor2=nl(e,this.parent.canvas,this.parent.context),this.backgroundHorizontalGradient=i,this.update(!1)}},{key:"setBackgroundStrokeColor",value:function(t,e){return this.backgroundStrokeColor=nl(t,this.parent.canvas,this.parent.context),this.backgroundStrokeLineWidth=e,this.update(!1)}},{key:"setBackgroundCornerRadius",value:function(t,e){return this.backgroundCornerRadius=t,this.backgroundCornerIteration=e,this.update(!1)}},{key:"setFill",value:function(t){return this.color=nl(t,this.parent.canvas,this.parent.context),this.update(!1)}},{key:"setColor",value:function(t){return this.color=nl(t,this.parent.canvas,this.parent.context),this.update(!1)}},{key:"setStroke",value:function(t,e){return void 0===t?this.strokeThickness=0:(void 0===e&&(e=this.strokeThickness),this.stroke=nl(t,this.parent.canvas,this.parent.context),this.strokeThickness=e),this.update(!0)}},{key:"setShadow",value:function(t,e,i,n,r,s){return void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i="#000"),void 0===n&&(n=0),void 0===r&&(r=!1),void 0===s&&(s=!0),this.shadowOffsetX=t,this.shadowOffsetY=e,this.shadowColor=nl(i,this.parent.canvas,this.parent.context),this.shadowBlur=n,this.shadowStroke=r,this.shadowFill=s,this.update(!1)}},{key:"setShadowOffset",value:function(t,e){return void 0===t&&(t=0),void 0===e&&(e=t),this.shadowOffsetX=t,this.shadowOffsetY=e,this.update(!1)}},{key:"setShadowColor",value:function(t){return void 0===t&&(t="#000"),this.shadowColor=nl(t,this.parent.canvas,this.parent.context),this.update(!1)}},{key:"setShadowBlur",value:function(t){return void 0===t&&(t=0),this.shadowBlur=t,this.update(!1)}},{key:"setShadowStroke",value:function(t){return this.shadowStroke=t,this.update(!1)}},{key:"setShadowFill",value:function(t){return this.shadowFill=t,this.update(!1)}},{key:"setUnderline",value:function(t,e,i){return void 0===t&&(t="#000"),void 0===e&&(e=0),void 0===i&&(i=0),this.underlineColor=nl(t,this.parent.canvas,this.parent.context),this.underlineThickness=e,this.underlineOffset=i,this.update(!1)}},{key:"setUnderlineColor",value:function(t){return void 0===t&&(t="#000"),this.underlineColor=nl(t,this.parent.canvas,this.parent.context),this.update(!1)}},{key:"setUnderlineThickness",value:function(t){return void 0===t&&(t=0),this.underlineThickness=t,this.update(!1)}},{key:"setUnderlineOffset",value:function(t){return void 0===t&&(t=0),this.underlineOffset=t,this.update(!1)}},{key:"setStrikethrough",value:function(t,e,i){return void 0===t&&(t="#000"),void 0===e&&(e=0),void 0===i&&(i=0),this.strikethroughColor=nl(t,this.parent.canvas,this.parent.context),this.strikethroughThickness=e,this.strikethroughOffset=i,this.update(!1)}},{key:"setStrikethroughColor",value:function(t){return void 0===t&&(t="#000"),this.strikethroughColor=nl(t,this.parent.canvas,this.parent.context),this.update(!1)}},{key:"setStrikethroughThickness",value:function(t){return void 0===t&&(t=0),this.strikethroughThickness=t,this.update(!1)}},{key:"setStrikethroughOffset",value:function(t){return void 0===t&&(t=0),this.strikethroughOffset=t,this.update(!1)}},{key:"setWrapMode",value:function(t){return "string"==typeof t&&(t=yl[t.toLowerCase()]||0),this.wrapMode=t,this.update(!0)}},{key:"setWrapWidth",value:function(t){return this.wrapWidth=t,this.update(!1)}},{key:"setAlign",value:function(t,e){return void 0===t&&(t="left"),void 0===e&&(e="top"),this.halign=t,this.valign=e,this.update(!1)}},{key:"setHAlign",value:function(t){return void 0===t&&(t="left"),this.halign=t,this.update(!1)}},{key:"setVAlign",value:function(t){return void 0===t&&(t="top"),this.valign=t,this.update(!1)}},{key:"setMaxLines",value:function(t){return void 0===t&&(t=0),this.maxLines=t,this.update(!1)}},{key:"getTextMetrics",value:function(){var t=this.metrics;return {ascent:t.ascent,descent:t.descent,fontSize:t.fontSize}}},{key:"setTextMetrics",value:function(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=pl(e,"fontFamily",this.fontFamily),this.fontSize=pl(e,"fontSize",this.fontSize),this.fontStyle=pl(e,"fontStyle",this.fontStyle))),this.parent.updateText(!0)}},{key:"lineHeight",get:function(){return this.metrics.fontSize+this.strokeThickness+this.lineSpacing}},{key:"toJSON",value:function(){var t={},e=this.propertyMap;for(var i in e)t[i]=this[i];return t.metrics=this.getTextMetrics(),t}},{key:"destroy",value:function(){this.parent=void 0;}}]),t}(),yl={none:ul,word:cl,char:dl,character:dl},ml=Phaser.Math.DegToRad,kl=function(t){return !t.hasOwnProperty("convex")||t.convex},bl=function(t){return t.x>0&&t.y>0},wl=function(t,e,i,n,r,s,o,a,h){if(a&&o>s?o-=360:!a&&o=f?1:n/f,g=r>=v?1:r/v,y=d.cornerRadius;t.save(),t.beginPath(),t.translate(e,i),a=y.tl,bl(a)?(h=a.x*p,l=a.y*g,kl(a)?wl(t,h,l,h,l,180,270,!1,o):wl(t,0,0,h,l,90,0,!0,o),u=0,c=l):(t.lineTo(0,0),u=0,c=0),a=y.tr,bl(a)?(h=a.x*p,l=a.y*g,kl(a)?wl(t,n-h,l,h,l,270,360,!1,o):wl(t,n,0,h,l,180,90,!0,o)):t.lineTo(n,0),a=y.br,bl(a)?(h=a.x*p,l=a.y*g,kl(a)?wl(t,n-h,r-l,h,l,0,90,!1,o):wl(t,n,r,h,l,270,180,!0,o)):t.lineTo(n,r),a=y.bl,bl(a)?(h=a.x*p,l=a.y*g,kl(a)?wl(t,h,r-l,h,l,90,180,!1,o):wl(t,0,r,h,l,360,270,!0,o)):t.lineTo(0,r),t.lineTo(u,c),t.closePath(),t.restore();}(e,i,n,r,s,o,d),null!=a){var f;if(null!=u)(f=c?e.createLinearGradient(0,0,r,0):e.createLinearGradient(0,0,0,s)).addColorStop(0,a),f.addColorStop(1,u),a=f;e.fillStyle=a,e.fill();}null!=h&&l>0&&(e.strokeStyle=h,e.lineWidth=l,e.stroke());},Sl=function(t,e,i,n,r,s,o,a){if(null!=e||null!=i){var h=t.canvas.width,l=t.canvas.height;null==i&&(n=0);var u=n/2;h=Math.max(1,h-n),l=Math.max(1,l-n),xl(t.canvas,t.context,u,u,h,l,r,e,i,n,s,o,a);}},Cl={draw:function(t,e,i,n){var r=this.penManager;this.hitAreaManager.clear();var s=this.context;s.save();var o=this.defaultStyle;this.clear(),Sl(this,o.backgroundColor,o.backgroundStrokeColor,o.backgroundStrokeLineWidth,o.backgroundCornerRadius,o.backgroundColor2,o.backgroundHorizontalGradient,o.backgroundCornerIteration),t+=this.startXOffset,e+=this.startYOffset;var a,h,l,u,c,d,f=o.halign,v=o.valign,p=o.lineHeight,g=r.lines,y=g.length,m=o.maxLines;m>0&&y>m?(h=m,l="center"===v?Math.floor((y-h)/2):"bottom"===v?y-h:0):(h=y,l=0),u=l+h;var k=this.rtl,b=k?this.parent.width:void 0;d="center"===v?Math.max((n-h*p)/2,0):"bottom"===v?Math.max(n-h*p-2,0):0,d+=e;for(var w=l;w0&&t.width>0){var a=i+o.underlineOffset-o.underlineThickness/2;this.drawLine(e,a,t.width,o.underlineThickness,o.underlineColor);}if(t.isTextPen&&this.drawText(e,i,t.text,o),t.isImagePen&&this.drawImage(e,i,t.prop.img,o),o.strikethroughThickness>0&&t.width>0){a=i+o.strikethroughOffset-o.strikethroughThickness/2;this.drawLine(e,a,t.width,o.strikethroughThickness,o.strikethroughColor);}if(s.restore(),t.hasAreaMarker&&t.width>0){var h,l=t.prop.area;if(l)h={key:l};else {var u=t.prop.url;h={key:"url:".concat(u),url:u};}this.hitAreaManager.add(e,i-this.startYOffset,t.width,this.defaultStyle.lineHeight,h);}},clear:function(){var t=this.canvas;this.context.clearRect(0,0,t.width,t.height);},drawLine:function(t,e,i,n,r){this.autoRound&&(t=Math.round(t),e=Math.round(e));var s=this.context,o=s.lineCap;s.lineCap="butt",s.strokeStyle=r,s.lineWidth=n,s.beginPath(),s.moveTo(t,e),s.lineTo(t+i,e),s.stroke(),s.lineCap=o;},drawText:function(t,e,i,n){this.autoRound&&(t=Math.round(t),e=Math.round(e));var r=this.context;n.stroke&&"none"!==n.stroke&&n.strokeThickness>0&&(n.syncShadow(r,n.shadowStroke),r.strokeText(i,t,e)),n.color&&"none"!==n.color&&(n.syncShadow(r,n.shadowFill),r.fillText(i,t,e));},drawImage:function(t,e,i,n){e-=this.startYOffset,this.parent.imageManager.draw(i,this.context,t,e,this.autoRound);}},Ol=Phaser.Utils.Objects.GetValue,_l=al,Pl=hl,Tl=function(){function t(i){e(this,t),this.prop={},this.resetFromJSON(i);}return n(t,[{key:"resetFromJSON",value:function(t){this.text=Ol(t,"text",""),this.x=Ol(t,"x",0),this.y=Ol(t,"y",0),this.width=Ol(t,"width",0);var e=Ol(t,"prop",null);null===e&&(e={}),this.prop=e,this.newLineMode=Ol(t,"newLineMode",0),this.startIndex=Ol(t,"startIndex",0);}},{key:"plainText",get:function(){var t=this.text;return this.newLineMode===Pl&&(t+="\n"),t}},{key:"wrapText",get:function(){var t=this.text;return this.newLineMode!==_l&&(t+="\n"),t}},{key:"rawTextLength",get:function(){var t=this.text.length;return this.newLineMode===Pl&&(t+=1),t}},{key:"endIndex",get:function(){return this.startIndex+this.rawTextLength}},{key:"lastX",get:function(){return this.x+this.width}},{key:"isTextPen",get:function(){return ""!==this.text}},{key:"isImagePen",get:function(){return !!this.prop.img}},{key:"hasAreaMarker",get:function(){return !!this.prop.area||!!this.prop.url}}]),t}(),El=Phaser.Utils.Objects.GetFastValue,Rl=al,Ll=ll,Ml=function(){function t(i){e(this,t),this.pens=[],this.lines=[],this.maxLinesWidth=void 0,this.pensPool=i.pensPool,this.linesPool=i.linesPool,this.tagToText=El(i,"tagToText",Qt),this.tagToTextScope=El(i,"tagToTextScope",void 0);}return n(t,[{key:"destroy",value:function(){this.clear(),this.tagToText=void 0,this.tagToTextScope=void 0;}},{key:"clear",value:function(){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}},{key:"getLineEndIndex",value:function(t){t>=this.lines.length&&(t=this.lines.length-1);var e,i,n=!1;for(e=t;e>=0&&!(n=null!=(i=this.lines[e])&&i.length>0);e--);return n?i[i.length-1].endIndex:0}},{key:"getLineWidth",value:function(t){var e=this.lines[t];if(!e)return 0;var i=e[e.length-1];return null==i?0:i.lastX}},{key:"getMaxLineWidth",value:function(){if(void 0!==this.maxLinesWidth)return this.maxLinesWidth;for(var t,e=0,i=0,n=this.lines.length;ie&&(e=t);return this.maxLinesWidth=e,e}},{key:"getLineWidths",value:function(){for(var t=[],e=0,i=this.lines.length;e=t&&h<=e||(o=o.substring(t-a,e-a)),this.tagToTextScope?c+=this.tagToText.call(this.tagToTextScope,o,l,u):c+=this.tagToText(o,l,u),u=l,!(h>=e)));d++);return c}},{key:"length",get:function(){return this.lines.length},set:function(t){this.clear();}}]),t}(),Al={},Dl=function(){function t(){e(this,t),this.items=[];}return n(t,[{key:"destroy",value:function(){this.clear(),this.items=void 0;}},{key:"pop",value:function(){return this.items.length>0?this.items.pop():null}},{key:"push",value:function(t){return this.items.push(t),this}},{key:"pushMultiple",value:function(t){return this.items.push.apply(this.items,t),t.length=0,this}},{key:"clear",value:function(){return this.items.length=0,this}}]),t}(),zl=Phaser.Geom.Rectangle,Bl=new Dl,jl=function(){function t(){e(this,t),this.hitAreas=[];}return n(t,[{key:"destroy",value:function(){this.clear();}},{key:"clear",value:function(){for(var t=0,e=this.hitAreas.length;tr){""!==C?a.push(o.getLine(C,O,Gl)):0===P&&s>0&&a.push(o.getLine("",0,Gl)),a.push.apply(a,v(t(b,i,Vl,r,0,o)));var E=a.pop();C=E.text,O=E.width,o.freeLine(E)," "===C&&(C="",O=0);}else (S=O+w)>l?(a.push(o.getLine(C,O,Gl)),C=b,O=w,l=r):(C+=b,O=S),x&&a.push(o.getLine(C,O,u));}return a},ql=Phaser.Utils.Objects.GetValue,Zl=ul,$l=al,Ql=function(){function t(i){e(this,t),this.parent=i.parent,this.scene=this.parent.scene,this.context=ql(i,"context",null),this.canvas=this.context.canvas,this.parser=ql(i,"parser",null),this.defaultStyle=ql(i,"style",null),this.autoRound=!0,this.pensPool=i.pensPool,this.linesPool=i.linesPool,this.wrapTextLinesPool=i.wrapTextLinesPool,this.penManager=this.newPenManager(),this._tmpPenManager=null,this.hitAreaManager=new jl,this.lastHitAreaKey=null,this.urlTagCursorStyle=null;var n=this.context;this.getTextWidth=function(t){return n.measureText(t).width};}return n(t,[{key:"destroy",value:function(){this.parent=void 0,this.scene=void 0,this.context=void 0,this.canvas=void 0,this.parser=void 0,this.defaultStyle=void 0,this.penManager&&(this.penManager.destroy(),this.penManager=void 0),this._tmpPenManager&&(this._tmpPenManager.destroy(),this._tmpPenManager=void 0),this.hitAreaManager&&(this.hitAreaManager.destroy(),this.hitAreaManager=void 0),this.pensPool=void 0,this.linesPool=void 0,this.wrapTextLinesPool=void 0;}},{key:"updatePenManager",value:function(t,e,i,n,r){if(void 0===r&&(r=this.penManager),r.clear(),""===t)return r;var s=this.parent.style;if(s.isWrapFitMode){var o=this.parent.padding;i=s.fixedWidth-o.left-o.right;}for(var a,h,l,u,c,d=this.canvas,f=this.context,v=function(t){return f.measureText(t).width},p=0,g=0,y=s.wrapCallback,m=s.wrapCallbackScope,k=!0,b=this.parser.splitText(t),w=this.wrapTextLinesPool,x=0,S=b.length;x0&&e!==Zl&&i0&&t>e&&(t=e),t}},{key:"linesWidth",get:function(){return Math.ceil(this.penManager.getMaxLineWidth())}},{key:"linesHeight",get:function(){var t=this.desplayLinesCount,e=this.defaultStyle.lineHeight*t;return t>0&&(e-=this.defaultStyle.lineSpacing),e}},{key:"imageManager",get:function(){return this.parent.imageManager}},{key:"rtl",get:function(){return this.parent.style.rtl}},{key:"newPenManager",value:function(){return new Ml({pensPool:this.pensPool,linesPool:this.linesPool,tagToText:this.parser.propToTagText,tagToTextScope:this.parser})}},{key:"tmpPenManager",get:function(){return null===this._tmpPenManager&&(this._tmpPenManager=this.newPenManager()),this._tmpPenManager}},{key:"getPlainText",value:function(t,e,i){var n;if(null==t)n=this.penManager.plainText;else {var r=this.parser.splitText(t,1);n="";for(var s=0,o=r.length;s0}},{key:"drawX",get:function(){var t=this.x+this.leftSpace+this.offsetX-this.originX*this.width;return this.parent._textOX*this.scrollFactorX+t}},{key:"drawY",get:function(){var t=this.y+this.offsetY;return this.parent._textOY*this.scrollFactorY+t}},{key:"drawTLX",get:function(){return 0}},{key:"drawTLY",get:function(){return 0}},{key:"drawBLX",get:function(){return 0}},{key:"drawBLY",get:function(){return 0}},{key:"drawTRX",get:function(){return 0}},{key:"drawTRY",get:function(){return 0}},{key:"drawBRX",get:function(){return 0}},{key:"drawBRY",get:function(){return 0}},{key:"drawCenterX",get:function(){return (this.drawTRX+this.drawTLX)/2}},{key:"drawCenterY",get:function(){return (this.drawBLY+this.drawTLY)/2}}]),s}(ic);Object.assign(xc.prototype,mc);var Sc=function(t,e,i){return e.hasOwnProperty(t)?e[t]:i[t]},Cc=Phaser.Utils.Objects.GetValue,Oc=function(t){r(o,t);var i=l(o);function o(t,n){var r;return e(this,o),(r=i.call(this,t,"background")).setScrollFactor(0),r.setColor(Cc(n,"color",null),Cc(n,"color2",null),Cc(n,"horizontalGradient",!0)),r.setStroke(Cc(n,"stroke",null),Cc(n,"strokeThickness",2)),r.setCornerRadius(Cc(n,"cornerRadius",0),Cc(n,"cornerIteration",null)),r}return n(o,[{key:"color",get:function(){return this._color},set:function(t){t=nl(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t;}},{key:"color2",get:function(){return this._color2},set:function(t){t=nl(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t;}},{key:"horizontalGradient",get:function(){return this._horizontalGradient},set:function(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t;}},{key:"setColor",value:function(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}},{key:"stroke",get:function(){return this._stroke},set:function(t){t=nl(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t;}},{key:"strokeThickness",get:function(){return this._strokeThickness},set:function(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t;}},{key:"setStroke",value:function(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}},{key:"cornerRadius",get:function(){return this._cornerRadius},set:function(t){this.setDirty(this._cornerRadius!=t),this._cornerRadius=t;}},{key:"cornerIteration",get:function(){return this._cornerIteration},set:function(t){this.setDirty(this._cornerIteration!=t),this._cornerIteration=t;}},{key:"modifyStyle",value:function(t){return t.hasOwnProperty("color")&&this.setColor(t.color,Sc("color2",t,this),Sc("horizontalGradient",t,this)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,Sc("strokeThickness",t,this)),t.hasOwnProperty("cornerRadius")&&this.setCornerRadius(t.cornerRadius,Sc("cornerIteration",t,this)),this}},{key:"modifyPorperties",value:function(t){return c(s(o.prototype),"modifyPorperties",this).call(this,t),this.modifyStyle(t),this}},{key:"setCornerRadius",value:function(t,e){return this.cornerRadius=t,this.cornerIteration=e,this}},{key:"renderContent",value:function(){Sl(this.parent,this.color,this.stroke,this.strokeThickness,this.cornerRadius,this.color2,this.horizontalGradient,this.cornerIteration);}}]),o}(xc),_c=Phaser.Utils.Objects.GetValue,Pc=function(t){r(o,t);var i=l(o);function o(t,n){var r;return e(this,o),(r=i.call(this,t,"innerbounds")).setScrollFactor(0),r.setColor(_c(n,"color",null),_c(n,"color2",null),_c(n,"horizontalGradient",!0)),r.setStroke(_c(n,"stroke",null),_c(n,"strokeThickness",2)),r}return n(o,[{key:"color",get:function(){return this._color},set:function(t){t=nl(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t;}},{key:"color2",get:function(){return this._color2},set:function(t){t=nl(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t;}},{key:"horizontalGradient",get:function(){return this._horizontalGradient},set:function(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t;}},{key:"setColor",value:function(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}},{key:"stroke",get:function(){return this._stroke},set:function(t){t=nl(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t;}},{key:"strokeThickness",get:function(){return this._strokeThickness},set:function(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t;}},{key:"setStroke",value:function(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}},{key:"modifyPorperties",value:function(t){c(s(o.prototype),"modifyPorperties",this).call(this,t),t.hasOwnProperty("color")&&this.setColor(t.color,_c(t,"color2",null),_c(t,"horizontalGradient",!0)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,_c(t,"strokeThickness",2));}},{key:"renderContent",value:function(){var t=this.parent.padding,e=t.left,i=t.top,n=this.parent.width-t.left-t.right,r=this.parent.height-t.top-t.bottom,s=this.context;if(null!=this.color){var o,a;if(null!=this.color2)(a=this.horizontalGradient?s.createLinearGradient(0,0,n,0):s.createLinearGradient(0,0,0,r)).addColorStop(0,this.color),a.addColorStop(1,this.color2),o=a;else o=this.color;s.fillStyle=o,s.fillRect(e,i,n,r);}null!=this.stroke&&this.strokeThickness>0&&(s.strokeStyle=this.stroke,s.lineWidth=this.strokeThickness,s.strokeRect(e,i,n,r));}}]),o}(xc),Tc=Phaser.Utils.Objects.GetValue,Ec=function(){function t(i,n){e(this,t),this.parent=i,this.set(n);}return n(t,[{key:"toJSON",value:function(){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}}},{key:"set",value:function(t){return this.setBold(Tc(t,"bold",!1)),this.setItalic(Tc(t,"italic",!1)),this.setFontSize(Tc(t,"fontSize","16px")),this.setFontFamily(Tc(t,"fontFamily","Courier")),this.setColor(Tc(t,"color","#fff")),this.setStrokeStyle(Tc(t,"stroke",null),Tc(t,"strokeThickness",0)),this.setShadow(Tc(t,"shadowColor",null),Tc(t,"shadowOffsetX",0),Tc(t,"shadowOffsetY",0),Tc(t,"shadowBlur",0)),this.setOffset(Tc(t,"offsetX",0),Tc(t,"offsetY",0)),this.setSpace(Tc(t,"leftSpace",0),Tc(t,"rightSpace",0)),this.setAlign(Tc(t,"align",void 0)),this.setBackgroundColor(Tc(t,"backgroundColor",null)),this.setBackgroundHeight(Tc(t,"backgroundHeight",void 0)),this.setBackgroundBottomY(Tc(t,"backgroundBottomY",void 0)),this}},{key:"modify",value:function(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(Sc("stroke",t,this),Sc("strokeThickness",t,this)),t.hasOwnProperty("shadowColor")&&this.setShadowColor(t.shadowColor),(t.hasOwnProperty("shadowOffsetX")||t.hasOwnProperty("shadowOffsetY"))&&this.setShadowOffset(Sc("shadowOffsetX",t,this),Sc("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}},{key:"setUpdateTextFlag",value:function(){return this.parent&&(this.parent.updateTextFlag=!0),this}},{key:"clone",value:function(){return new t(null,this.toJSON())}},{key:"copyFrom",value:function(t){return this.set(t.toJSON()),this}},{key:"copyTo",value:function(t){return t.set(this.toJSON()),this}},{key:"setBold",value:function(t){return void 0===t&&(t=!0),this.bold=t,this.setUpdateTextFlag(),this}},{key:"setItalic",value:function(t){return void 0===t&&(t=!0),this.italic=t,this.setUpdateTextFlag(),this}},{key:"fontStyle",get:function(){return this.bold&&this.italic?"bold italic":this.bold?"bold":this.italic?"italic":""}},{key:"setFontSize",value:function(t){return "number"==typeof t&&(t="".concat(t,"px")),this.fontSize=t,this.setUpdateTextFlag(),this}},{key:"setFontFamily",value:function(t){return this.fontFamily=t,this.setUpdateTextFlag(),this}},{key:"font",get:function(){return "".concat(this.fontStyle," ").concat(this.fontSize," ").concat(this.fontFamily)}},{key:"setColor",value:function(t){return this.color=nl(t),this}},{key:"hasFill",get:function(){return null!=this.color}},{key:"setStrokeStyle",value:function(t,e){return this.stroke=nl(t),void 0!==e&&(this.strokeThickness=e),this}},{key:"setStrokeThickness",value:function(t){return this.strokeThickness=t,this}},{key:"hasStroke",get:function(){return null!=this.stroke&&this.strokeThickness>0}},{key:"setShadowColor",value:function(t){return this.shadowColor=nl(t),this}},{key:"setShadowOffset",value:function(t,e){return void 0===t&&(t=0),void 0===e&&(e=0),this.shadowOffsetX=t,this.shadowOffsetY=e,this}},{key:"setShadowBlur",value:function(t){return void 0===t&&(t=0),this.shaodwBlur=t,this}},{key:"setShadow",value:function(t,e,i,n){return this.setShadowColor(t).setShadowOffset(e,i).setShadowBlur(n),this}},{key:"setBackgroundColor",value:function(t){return this.backgroundColor=nl(t),this}},{key:"hasBackgroundColor",get:function(){return null!=this.backgroundColor}},{key:"setBackgroundHeight",value:function(t){return this.backgroundHeight=t,this}},{key:"setBackgroundBottomY",value:function(t){return this.backgroundBottomY=t,this}},{key:"setOffsetX",value:function(t){return void 0===t&&(t=0),this.offsetX=t,this}},{key:"setOffsetY",value:function(t){return void 0===t&&(t=0),this.offsetY=t,this}},{key:"setOffset",value:function(t,e){return this.setOffsetX(t).setOffsetY(e),this}},{key:"setLeftSpace",value:function(t){return void 0===t&&(t=0),this.leftSpace=t,this}},{key:"setRightSpace",value:function(t){return void 0===t&&(t=0),this.rightSpace=t,this}},{key:"setSpace",value:function(t,e){return this.setLeftSpace(t).setRightSpace(e),this}},{key:"setAlign",value:function(t){return this.align=t,this}},{key:"syncFont",value:function(t){return t.font=this.font,this}},{key:"syncStyle",value:function(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}},{key:"syncShadow",value:function(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);}},{key:"getTextMetrics",value:function(t,e){return this.syncFont(t).syncStyle(t),t.measureText(e)}}]),t}(),Rc=Phaser.Utils.Array.Remove,Lc=Phaser.Utils.Array.Remove,Mc="text",Ac="image",Dc="drawer",zc="space",Bc="command",jc=function(t){return t.type===Mc&&"\n"===t.text},Wc=function(t){return t.type===Mc&&"\f"===t.text},Fc=function(t){return t.type===Mc},Ic=function(t){r(o,t);var i=l(o);function o(t,n,r){var s;return e(this,o),(s=i.call(this,t,Mc)).updateTextFlag=!1,s.style=new Ec(a(s),r),s.setText(n),s}return n(o,[{key:"autoRound",get:function(){return this.parent.autoRound}},{key:"offsetX",get:function(){return this.style.offsetX},set:function(t){this.style&&(this.style.offsetX=t);}},{key:"offsetY",get:function(){return this.style.offsetY},set:function(t){this.style&&(this.style.offsetY=t);}},{key:"leftSpace",get:function(){return this.style.leftSpace*this.scaleX},set:function(t){this.style&&(this.style.leftSpace=t),f(s(o.prototype),"leftSpace",t,this,!0);}},{key:"rightSpace",get:function(){return this.style.rightSpace*this.scaleX},set:function(t){this.style&&(this.style.rightSpace=t),f(s(o.prototype),"rightSpace",t,this,!0);}},{key:"align",get:function(){return this.style.align},set:function(t){this.style&&(this.style.align=t);}},{key:"modifyStyle",value:function(t){return this.setDirty(!0),this.style.modify(t),this.updateTextFlag&&this.updateTextSize(),this}},{key:"modifyPorperties",value:function(t){return t?(this.modifyStyle(t),c(s(o.prototype),"modifyPorperties",this).call(this,t),this):this}},{key:"setText",value:function(t){return this.setDirty(this.text!=t),this.text=t,this.updateTextSize(),this}},{key:"updateTextSize",value:function(){var t=this.text;if("\n"===t||"\f"===t||""===t)this.clearTextSize();else {var e,i,n=this.style.getTextMetrics(this.context,this.text);this.textWidth=n.width,"actualBoundingBoxAscent"in n?(e=n.actualBoundingBoxAscent,i=n.actualBoundingBoxDescent):(e=0,i=0),this.textHeight=e+i,this.ascent=e,this.descent=i;}return this.updateTextFlag=!1,this}},{key:"clearTextSize",value:function(){return this.textWidth=0,this.textHeight=0,this.ascent=0,this.descent=0,this}},{key:"copyTextSize",value:function(t){return this.textWidth=t.textWidth,this.textHeight=t.textHeight,this.ascent=t.ascent,this.descent=t.descent,this}},{key:"width",get:function(){return this.textWidth*this.scaleX},set:function(t){this.textWidth>0?this.scaleX=t/this.textWidth:this.scaleX=1;}},{key:"height",get:function(){return this.textHeight*this.scaleY},set:function(t){this.textHeight>0?this.scaleY=t/this.textHeight:this.scaleY=1;}},{key:"willRender",get:function(){return 0!==this.textWidth&&c(s(o.prototype),"willRender",this)}},{key:"renderContent",value:function(){var t=this.context,e=this.style;if(e.hasBackgroundColor){t.fillStyle=e.backgroundColor;var i=this.drawTLX,n=this.drawTRX-i,r=e.backgroundBottomY;null==r&&(r=this.drawBLY);var s=e.backgroundHeight;null==s&&(s=r-this.drawTLY);var o=r-s;t.fillRect(i,o,n,s);}var a=e.hasFill,h=e.hasStroke;(a||h)&&(e.syncFont(t).syncStyle(t),h&&(e.syncShadow(t),t.strokeText(this.text,0,0)),a&&(e.syncShadow(t),t.fillText(this.text,0,0)));}},{key:"drawTLX",get:function(){return -this.leftSpace}},{key:"drawTLY",get:function(){return -this.ascent}},{key:"drawBLX",get:function(){return -this.leftSpace}},{key:"drawBLY",get:function(){return this.descent}},{key:"drawTRX",get:function(){return this.textWidth+this.rightSpace}},{key:"drawTRY",get:function(){return -this.ascent}},{key:"drawBRX",get:function(){return this.textWidth+this.rightSpace}},{key:"drawBRY",get:function(){return this.descent}}]),o}(xc),Xc=function(t,e){var i=this.createCharChildren(t,e);return this.addChild(i),this},Yc=function(t){r(s,t);var i=l(s);function s(t,n,r){var o;return e(this,s),(o=i.call(this,t,Ac)).setTexture(n,r),o}return n(s,[{key:"frameWidth",get:function(){return this.frameObj?this.frameObj.cutWidth:0}},{key:"frameHeight",get:function(){return this.frameObj?this.frameObj.cutHeight:0}},{key:"offsetY",get:function(){return -this.height},set:function(t){}},{key:"key",get:function(){return this._key},set:function(t){this.setDirty(this._key!=t),this._key=t;}},{key:"frame",get:function(){return this._frame},set:function(t){this.setDirty(this._frame!=t),this._frame=t;}},{key:"setTexture",value:function(t,e){return this.key=t,this.frame=e,this.frameObj=this.scene.sys.textures.getFrame(t,e),this}},{key:"width",get:function(){return this.frameWidth*this.scaleX},set:function(t){this.setDirty(this.width!==t),this.scaleX=t/this.frameWidth;}},{key:"height",get:function(){return this.frameHeight*this.scaleY},set:function(t){this.setDirty(this.height!==t),this.scaleY=t/this.frameHeight;}},{key:"setHeight",value:function(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}},{key:"renderContent",value:function(){var t=this.context,e=this.frameObj,i=this.frameWidth,n=this.frameHeight;t.drawImage(e.source.image,e.cutX,e.cutY,i,n,0,0,i,n);}},{key:"drawTLX",get:function(){return -this.leftSpace}},{key:"drawTLY",get:function(){return 0}},{key:"drawBLX",get:function(){return -this.leftSpace}},{key:"drawBLY",get:function(){return this.frameHeight}},{key:"drawTRX",get:function(){return this.frameWidth+this.rightSpace}},{key:"drawTRY",get:function(){return 0}},{key:"drawBRX",get:function(){return this.frameWidth+this.rightSpace}},{key:"drawBRY",get:function(){return this.frameHeight}}]),s}(xc),Nc=function(t){r(o,t);var i=l(o);function o(t,n,r,s){var a;return e(this,o),(a=i.call(this,t,Dc)).setRenderCallback(n),a.setDrawerSize(r,s),a}return n(o,[{key:"setRenderCallback",value:function(t){return t?this.renderContent=t.bind(this):delete this.renderContent,this}},{key:"setDrawerSize",value:function(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}},{key:"onFree",value:function(){c(s(o.prototype),"onFree",this).call(this),this.setRenderCallback();}},{key:"width",get:function(){return this.drawerWidth*this.scaleX},set:function(t){this.setDirty(this.width!==t),this.scaleX=this.drawerWidth>0?t/this.drawerWidth:1;}},{key:"height",get:function(){return this.drawerHeight*this.scaleY},set:function(t){this.setDirty(this.height!==t),this.scaleY=this.drawerHeight>0?t/this.drawerHeight:1;}},{key:"offsetY",get:function(){return -this.height},set:function(t){}},{key:"drawTLX",get:function(){return -this.leftSpace}},{key:"drawTLY",get:function(){return 0}},{key:"drawBLX",get:function(){return -this.leftSpace}},{key:"drawBLY",get:function(){return this.drawerHeight}},{key:"drawTRX",get:function(){return this.drawerWidth+this.rightSpace}},{key:"drawTRY",get:function(){return 0}},{key:"drawBRX",get:function(){return this.drawerWidth+this.rightSpace}},{key:"drawBRY",get:function(){return this.drawerHeight}}]),o}(xc),Gc=function(t){r(s,t);var i=l(s);function s(t,n){var r;return e(this,s),(r=i.call(this,t,zc)).setSpaceWidth(n),r}return n(s,[{key:"width",get:function(){return this.spaceWidth*this.scaleX},set:function(t){this.spaceWidth>0?this.scaleX=t/this.spaceWidth:this.scaleX=1;}},{key:"setSpaceWidth",value:function(t){return this.spaceWidth=t,this}}]),s}(xc),Hc=function(t){r(o,t);var i=l(o);function o(t,n,r,s,a){var h;return e(this,o),(h=i.call(this,t,Bc)).setName(n).setParameter(s).setCallback(r,a),h}return n(o,[{key:"setName",value:function(t){return this.name=t,this}},{key:"setParameter",value:function(t){return this.param=t,this}},{key:"setCallback",value:function(t,e){return this.callback=t,this.scope=e,this}},{key:"exec",value:function(){return this.scope?this.callback.call(this.scope,this.param,this.name):this.callback(this.param,this.name)}},{key:"onFree",value:function(){c(s(o.prototype),"onFree",this).call(this),this.setName().setCallback().setParameter();}}]),o}(ic),Uc=function(t,e,i,n){void 0===n&&(n={word:[],width:0}),n.word.length=0;for(var r=t.length,s=e,o=n.word,a=0;s0&&!a){var h=this.fixedHeight-n;if(i>0)s=h/i;else s=(l=Kc.call(this)).height,o=l.ascent,i=Math.floor((h-o)/s);}else {var l;s=(l=Kc.call(this)).height,o=l.ascent;}}else if(this.fixedHeight>0){if(void 0===(i=Zc(t,"maxLines"))){h=this.fixedHeight-n;i=Math.floor(h/s);}}else i=Zc(t,"maxLines",0);void 0===o&&(o=s);var u=0===i,c=Zc(t,"wrapWidth",void 0);void 0===c&&(c=this.fixedWidth>0?this.fixedWidth-r:1/0);for(var d=Zc(t,"letterSpacing",0),f=Zc(t,"hAlign",0),v=Zc(t,"vAlign",0),p=Zc(t,"charWrap",!1),g={callback:"runWordWrap",start:e,isLastPage:!1,padding:this.wrapPadding,ascent:o,lineHeight:s,maxLines:i,wrapWidth:c,letterSpacing:d,hAlign:f,vAlign:v,charWrap:p,children:[],lines:[],maxLineWidth:0,linesHeight:0},y=this.children,m=0,k=y.length;m0&&(T.push({children:E,width:R}),L=Math.max(L,R)),g.start+=P.length,g.isLastPage=!M&&g.start===_,g.maxLineWidth=L,g.linesHeight=T.length*s;var F=this.fixedWidth>0?this.fixedWidth:g.maxLineWidth+r,I=this.fixedHeight>0?this.fixedHeight:g.linesHeight+n;!function(t,e,i){var n,r,s=t.hAlign,o=t.vAlign,a=t.linesHeight;switch(o){case 1:case"center":r=(i-a)/2;break;case 2:case"bottom":r=i-a;break;default:r=0;}for(var h=t.lines,l=0,u=h.length;l0?(o=this.fixedWidth-r)/i:0;else if(this.fixedWidth>0){if(void 0===(i=td(t,"maxLines",void 0))){var o=this.fixedWidth-r;i=Math.floor(o/s)+1;}}else i=td(t,"maxLines",0);var a=0===i,h=td(t,"fixedChildHeight",void 0);if(void 0===h){var l=td(t,"charPerLine",void 0);if(void 0!==l){var u=this.fixedHeight-n;h=Math.floor(u/l);}}var c=td(t,"wrapHeight",void 0);void 0===c&&(c=this.fixedHeight>0?this.fixedHeight-n:1/0);for(var d=td(t,"letterSpacing",0),f=td(t,"rtl",!0),v=td(t,"hAlign",f?2:0),p=td(t,"vAlign",0),g={callback:"runVerticalWrap",start:e,isLastPage:!1,padding:this.wrapPadding,lineWidth:s,maxLines:i,fixedChildHeight:h,wrapHeight:c,letterSpacing:d,hAlign:v,vAlign:p,rtl:f,children:[],lines:[],maxLineHeight:0,linesWidth:0},y=this.children,m=0,k=y.length;m0&&(T.push({children:E,height:R}),L=Math.max(L,R)),g.start+=P.length,g.isLastPage=g.start===_,g.maxLineHeight=L,g.linesWidth=T.length*s;var j=this.fixedWidth>0?this.fixedWidth:g.linesWidth+r,W=this.fixedHeight>0?this.fixedHeight:g.maxLineHeight+n;!function(t,e,i){var n,r,s=t.hAlign,o=t.vAlign,a=t.rtl,h=t.lines,l=t.lineWidth,u=t.linesWidth;switch(s){case 1:case"center":n=(e-u)/2;break;case 2:case"right":n=e-u;break;default:n=0;}a&&(n+=l);for(var c=0,d=h.length;c0?t:this.width,e>0?e:this.height),this):this},setPadding:function(t,e){var i=this.padding,n=i.left,r=i.right,s=i.top,o=i.bottom;return Ne(i,t,e),this.dirty=this.dirty||n!=i.left||r!=i.right||s!=i.top||o!=i.bottom,this},getPadding:function(t){return Ye(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),Rc(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 Lc(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,n,r,s=Array.isArray(t);void 0===e||e===this.children.length?s?(i=this.children).push.apply(i,v(t)):this.children.push(t):s?(n=this.children).splice.apply(n,[e,0].concat(v(t))):this.children.splice(e,0,t);(this.lastAppendedChildren.length=0,s)?(r=this.lastAppendedChildren).push.apply(r,v(t)):this.lastAppendedChildren.push(t);return this},createCharChild:function(t,e){e&&this.textStyle.modify(e);var i=this.poolManager.allocate(Mc);return null===i?i=new Ic(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=[],n=0,r=t.length;ne&&(n=e,r=t);})),r},getCharWorldPosition:function(t,e,i,n){return "number"==typeof t&&(t=this.getCharChild(t,!0)),yc(this,t,e,i,n)},setToMinSize:function(){for(var t=this.children,e=0,i=0,n=0,r=t.length;n=i.length&&(t=i.length);for(var n=0,r=0;r textObject.width) { - dx = textObject.width - childRightX; - } else { - dx = 0; - } - var childTopY = this.drawY + this.drawTLY; - var childBottomY = childTopY + this.height; - if (childTopY < 0) { - dy = 0 - childTopY; - } else if (childBottomY > textObject.height) { - dy = textObject.height - childBottomY; - } else { - dy = 0; - } - textObject._textOX += dx; - textObject._textOY += dy; - return this; - }; - var Methods$1 = { contains: Contains, - getWorldPosition: GetWorldPosition, - scrollTo: ScrollTo + getWorldPosition: GetWorldPosition }; Object.assign(Methods$1, RenderMethods); @@ -22428,7 +22401,6 @@ return this; } this._textOX = ox; - this.updateTexture(); return this; }, setTextOY: function setTextOY(oy) { @@ -22436,7 +22408,6 @@ return this; } this._textOY = oy; - this.updateTexture(); return this; }, setTextOXY: function setTextOXY(ox, oy) { @@ -22445,7 +22416,6 @@ } this._textOX = ox; this._textOY = oy; - this.updateTexture(); return this; }, addTextOX: function addTextOX(incX) { diff --git a/dist/rexsimplelabel.min.js b/dist/rexsimplelabel.min.js index 334a6f79cf..1a4def77c0 100644 --- a/dist/rexsimplelabel.min.js +++ b/dist/rexsimplelabel.min.js @@ -1,7 +1,7 @@ -!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).rexsimplelabel=e();}(undefined,(function(){function t(e){return t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},t(e)}function e(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){for(var i=0;it.length)&&(e=t.length);for(var i=0,n=new Array(e);i=0;i--)(e=this.children[i]).parentContainer||e.displayList||e.destroy(t);this.clear(!t),c(s(o.prototype),"destroy",this).call(this,t);}}},{key:"contains",value:function(t){return -1!==this.children.indexOf(t)}},{key:"add",value:function(t){var e=this;return b(this.children,t,0,(function(t){t.once("destroy",e.onChildDestroy,e);}),this),this}},{key:"remove",value:function(t,e){var i=this;return w(this.children,t,(function(t){t.off("destroy",i.onChildDestroy,i),e&&t.destroy();})),this}},{key:"onChildDestroy",value:function(t,e){this.remove(t,!1);}},{key:"clear",value:function(t){for(var e,i=0,n=this.children.length;i0;){var n=i.shift();!e(n)&&n.isRexContainerLite&&i.push.apply(i,v(n.children));}},it=Phaser.Utils.Array,nt={getChildren:function(t){if(t)for(var e=0,i=this.children.length;e=0;e--)this.remove(this.backgroundChildren[e],t);return this}},Xe=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},Ye=/(\S+)\[(\d+)\]/i,Ie=Phaser.Utils.Objects.GetValue,Be=function(t,e){return void 0===e?t:t[e]},Ne=function(e,i,n){void 0===e&&(e={}),void 0===i&&(i=0);var r=t(i);return "string"===r?e[i]=n:"number"===r?(e.left=i,e.right=i,e.top=i,e.bottom=i):(e.left=Ie(i,"left",0),e.right=Ie(i,"right",0),e.top=Ie(i,"top",0),e.bottom=Ie(i,"bottom",0)),e},He={getInnerPadding:function(t){return Be(this.space,t)},setInnerPadding:function(t,e){return Ne(this.space,t,e),this},getOuterPadding:function(t){return Be(this.getSizerConfig(this).padding,t)},setOuterPadding:function(t,e){return Ne(this.getSizerConfig(this).padding,t,e),this},getChildOuterPadding:function(t,e){return "string"==typeof t&&(t=this.getElement(t)),Be(this.getSizerConfig(t).padding,e)},setChildOuterPadding:function(t,e,i){return "string"==typeof t&&(t=this.getElement(t)),Ne(this.getSizerConfig(t).padding,e,i),this}},Ge=function(t){var e=this.childrenWidth,i=void 0!==this.minWidth?this.minWidth:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn("Layout width warn: ".concat(this.constructor.name,"'s minWidth (").concat(i,") < childrenWidth (").concat(e,")"))):this.layoutWarnEnable&&(i>t||e>t)&&console.warn("Layout width warn: ".concat(this.constructor.name,"'s minWidth (").concat(i,") or childrenWidth (").concat(e," > targetWidth ").concat(t,")")),t},Ue=function(t){var e=this.childrenHeight,i=void 0!==this.minHeight?this.minHeight:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn("Layout height warn: ".concat(this.constructor.name,"'s minHeight (").concat(i,") < childrenHeight (").concat(e,")"))):this.layoutWarnEnable&&(i>t||e>t)&&console.warn("Layout height warn: ".concat(this.constructor.name,"'s minHeight (").concat(i,") or childrenHeight (").concat(e,") > targetHeight (").concat(t,")")),t},Ve={getShownChildren:function(t){void 0===t&&(t=[]);for(var e,i=this.children,n=0,r=i.length;n0;){var i=e.shift();i.rexSizer&&i.rexSizer.hidden||(i!==this&&t.push(i),i.isRexContainerLite&&e.push.apply(e,v(i.children)));}return t}},Je=function(){this._childrenWidth=void 0,this._childrenHeight=void 0;for(var t,e=this.getChildrenSizers(),i=0,n=e.length;i0?-this.delay:0,this.state=this.nowTime>=0?gi:pi,this.repeatCounter=0,this}},{key:"stop",value:function(){return this.state=vi,this}},{key:"update",value:function(t,e){this.state!==vi&&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=yi)):(this.nowTime=this.duration,this.state=mi):this.nowTime>=0&&(this.state=gi));}},{key:"t",get:function(){var t;switch(this.state){case vi:case pi:case yi:t=0;break;case gi:t=this.nowTime/this.duration;break;case mi:t=1;}return di(t,0,1)},set:function(t){(t=di(t,-1,1))<0?(this.state=pi,this.nowTime=-this.delay*t):(this.state=gi,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++);}},{key:"setT",value:function(t){return this.t=t,this}},{key:"isIdle",get:function(){return this.state===vi}},{key:"isDelay",get:function(){return this.state===pi}},{key:"isCountDown",get:function(){return this.state===gi}},{key:"isRunning",get:function(){return this.state===pi||this.state===gi}},{key:"isDone",get:function(){return this.state===mi}},{key:"isOddIteration",get:function(){return 1==(1&this.repeatCounter)}},{key:"isEvenIteration",get:function(){return 0==(1&this.repeatCounter)}}]),t}(),vi=0,pi=1,gi=2,yi=3,mi=-1,ki=function(t){r(o,t);var i=l(o);function o(t,n){var r;return e(this,o),(r=i.call(this,t,n)).timer=new fi,r}return n(o,[{key:"shutdown",value:function(t){this.isShutdown||(c(s(o.prototype),"shutdown",this).call(this,t),this.timer.destroy(),this.timer=void 0);}},{key:"start",value:function(){return this.timer.start(),c(s(o.prototype),"start",this).call(this),this}},{key:"stop",value:function(){return this.timer.stop(),c(s(o.prototype),"stop",this).call(this),this}},{key:"complete",value:function(){return this.timer.stop(),c(s(o.prototype),"complete",this).call(this),this}}]),o}(li),bi=Phaser.Utils.Objects.GetValue,wi=Phaser.Utils.Objects.GetAdvancedValue,xi=Phaser.Tweens.Builders.GetEaseFunction,Si=function(t){r(o,t);var i=l(o);function o(){return e(this,o),i.apply(this,arguments)}return n(o,[{key:"resetFromJSON",value:function(t){return this.timer.resetFromJSON(bi(t,"timer")),this.setEnable(bi(t,"enable",!0)),this.setTarget(bi(t,"target",this.parent)),this.setDelay(wi(t,"delay",0)),this.setDuration(wi(t,"duration",1e3)),this.setEase(bi(t,"ease","Linear")),this.setRepeat(bi(t,"repeat",0)),this}},{key:"setEnable",value:function(t){return null==t&&(t=!0),this.enable=t,this}},{key:"setTarget",value:function(t){return void 0===t&&(t=this.parent),this.target=t,this}},{key:"setDelay",value:function(t){return this.delay=t,this}},{key:"setDuration",value:function(t){return this.duration=t,this}},{key:"setRepeat",value:function(t){return this.repeat=t,this}},{key:"setRepeatDelay",value:function(t){return this.repeatDelay=t,this}},{key:"setEase",value:function(t){return void 0===t&&(t="Linear"),this.ease=t,this.easeFn=xi(t),this}},{key:"start",value:function(){return this.timer.isRunning||c(s(o.prototype),"start",this).call(this),this}},{key:"restart",value:function(){return this.timer.stop(),this.start.apply(this,arguments),this}},{key:"stop",value:function(t){return void 0===t&&(t=!1),c(s(o.prototype),"stop",this).call(this),t&&(this.timer.setT(1),this.updateGameObject(this.target,this.timer),this.complete()),this}},{key:"update",value:function(t,e){if(!this.isRunning||!this.enable||!this.parent.active)return this;var i=this.target,n=this.timer;return n.update(t,e),n.isDelay||this.updateGameObject(i,n),this.emit("update",i,this),n.isDone&&this.complete(),this}},{key:"updateGameObject",value:function(t,e){}}]),o}(ki),Ci=Phaser.Utils.Objects.GetValue,_i=Phaser.Utils.Objects.GetAdvancedValue,Oi=Phaser.Math.Linear,Pi=function(t){r(o,t);var i=l(o);function o(t,n){var r;return e(this,o),(r=i.call(this,t,n)).scaleStart={},r.scaleEnd={},r.resetFromJSON(n),r.boot(),r}return n(o,[{key:"resetFromJSON",value:function(t){return c(s(o.prototype),"resetFromJSON",this).call(this,t),this.setMode(Ci(t,"mode",0)),this.setScaleRange(_i(t,"start",void 0),_i(t,"end",0)),this}},{key:"setMode",value:function(t){return "string"==typeof t&&(t=Ti[t]),this.mode=t,this}},{key:"setScaleRange",value:function(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}},{key:"start",value:function(){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),c(s(o.prototype),"start",this).call(this),this}},{key:"updateGameObject",value:function(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));}},{key:"complete",value:function(){return c(s(o.prototype),"complete",this).call(this),1===this.mode&&this.parent.destroy(),this}}]),o}(Si),Ti={stop:0,destroy:1,yoyo:2},Ei=function(t,e,i,n,r){var s,o;switch(void 0===n&&(n="Cubic"),i){case 0:case"x":s={x:0},o={x:t.scaleX};break;case 1:case"y":s={y:0},o={y:t.scaleY};break;default:s=0,o=t.scale;}var a={mode:0,start:s,end:o,duration:e,ease:n};return void 0===r?r=new Pi(t,a):r.resetFromJSON(a),r.restart(),r},Ri=function(t,e,i,n,r,s){void 0===n&&(n="Linear"),r instanceof Pi&&(s=r,r=void 0),void 0===r&&(r=!0);var o={};switch(o.mode=r?1:0,i){case 0:case"x":o.end={x:0};break;case 1:case"y":o.end={y:0};break;default:o.end=0;}return o.duration=e,o.ease=n,void 0===s?s=new Pi(t,o):s.resetFromJSON(o),s.restart(),s},Mi=function(t,e){return new Promise((function(i,n){t.once(e,(function(){i();}));}))},Li=function(t){return Mi(t,"complete")},Ai=Phaser.Utils.Objects.IsPlainObject,Di=function(t,e){e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0);})),e.on("update",(function(){var e=je.getParentSizer(t);e&&e.resetChildPositionState(t);}));},zi={popUp:function(t,e,i){if(Ai(t)){var n=t;t=n.duration,e=n.orientation,i=n.ease;}var r=void 0===this._scaleBehavior;return this._scaleBehavior=Ei(this,t,e,i,this._scaleBehavior),r&&Di(this,this._scaleBehavior),this._scaleBehavior.completeEventName="popup.complete",this},popUpPromise:function(t,e,i){return this.popUp(t,e,i),Li(this._scaleBehavior)},scaleDownDestroy:function(t,e,i,n){if(Ai(t)){var r=t;t=r.duration,e=r.orientation,i=r.ease,n=r.destroy;}var s=void 0===this._scaleBehavior;return this._scaleBehavior=Ri(this,t,e,i,n,this._scaleBehavior),s&&Di(this,this._scaleBehavior),this._scaleBehavior.completeEventName="scaledown.complete",this},scaleDownDestroyPromise:function(t,e,i,n){return this.scaleDownDestroy(t,e,i,n),Li(this._scaleBehavior)},scaleDown:function(t,e,i){return this.scaleDownDestroy(t,e,i,!1),this},scaleDownPromise:function(t,e,i){return this.scaleDown(t,e,i),Li(this._scaleBehavior)},scaleYoyo:function(t,e,i,n,r){if(Ai(t)){var s=t;t=s.duration,e=s.peakValue,i=s.repeat,n=s.orientation,r=s.ease;}var o=void 0===this._scaleBehavior;return this._scaleBehavior=function(t,e,i,n,r,s,o){var a,h;switch(void 0===i&&(i=1.2),void 0===n&&(n=0),void 0===s&&(s="Cubic"),r){case 0:case"x":a={x:t.scaleX},h={x:i};break;case 1:case"y":a={y:t.scaleX},h={y:i};break;default:a=t.scaleX,h=i;}var l={mode:2,start:a,end:h,duration:e/2,ease:s,repeat:n};return void 0===o?o=new Pi(t,l):o.resetFromJSON(l),o.restart(),o}(this,t,e,i,n,r,this._scaleBehavior),o&&Di(this,this._scaleBehavior),this._scaleBehavior.completeEventName="scaleyoyo.complete",this},scaleYoyoPromise:function(t,e,i,n,r){return this.scaleYoyo(t,e,i,n,r),Li(this._scaleBehavior)}},ji=Phaser.Utils.Objects.GetValue,Fi=Phaser.Utils.Objects.GetAdvancedValue,Wi=Phaser.Math.Linear,Xi=function(t){r(o,t);var i=l(o);function o(t,n){var r;return e(this,o),(r=i.call(this,t,n)).resetFromJSON(n),r.boot(),r}return n(o,[{key:"resetFromJSON",value:function(t){return c(s(o.prototype),"resetFromJSON",this).call(this,t),this.setMode(ji(t,"mode",0)),this.setAlphaRange(Fi(t,"start",this.parent.alpha),Fi(t,"end",0)),this}},{key:"setMode",value:function(t){return "string"==typeof t&&(t=Yi[t]),this.mode=t,this}},{key:"setAlphaRange",value:function(t,e){return this.alphaStart=t,this.alphaEnd=e,this}},{key:"start",value:function(){return this.timer.isRunning||(this.parent.setAlpha(this.alphaStart),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),c(s(o.prototype),"start",this).call(this)),this}},{key:"updateGameObject",value:function(t,e){var i=e.t;e.isOddIteration&&(i=1-i),t.alpha=Wi(this.alphaStart,this.alphaEnd,i);}},{key:"complete",value:function(){return c(s(o.prototype),"complete",this).call(this),1===this.mode&&this.parent.destroy(),this}}]),o}(Si),Yi={stop:0,destroy:1,yoyo:2},Ii=Phaser.Utils.Objects.IsPlainObject,Bi=function(t,e,i,n){var r,s;Ii(i)?(r=i.start,s=i.end):s=i,void 0===r&&(r=0),void 0===s&&(s=1);var o={mode:0,start:r,end:s,duration:e};return void 0===n?n=new Xi(t,o):n.resetFromJSON(o),n.restart(),n},Ni=function(t,e,i,n){i instanceof Xi&&(n=i,i=void 0),void 0===i&&(i=!0);var r={mode:i?1:0,end:0,duration:e};return void 0===n?n=new Xi(t,r):n.resetFromJSON(r),n.restart(),n},Hi=Phaser.Utils.Objects.IsPlainObject,Gi=function(t,e){e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0);})),e.on("update",(function(){var e=je.getParentSizer(t);e&&e.resetChildAlphaState(t);}));},Ui={fadeIn:function(t,e){if(Hi(t)){var i=t;t=i.duration,e=i.alpha;}var n=void 0===this._fade;return this._fade=Bi(this,t,e,this._fade),n&&Gi(this,this._fade),this._fade.completeEventName="fadein.complete",this},fadeInPromise:function(t,e){return this.fadeIn(t,e),Li(this._fade)},fadeOutDestroy:function(t,e){if(Hi(t)){var i=t;t=i.duration,e=i.destroy;}var n=void 0===this._fade;return this._fade=Ni(this,t,e,this._fade),n&&Gi(this,this._fade),this._fade.completeEventName="fadeout.complete",this},fadeOutDestroyPromise:function(t,e){return this.fadeOutDestroy(t,e),Li(this._fade)},fadeOut:function(t){return this.fadeOutDestroy(t,!1),this},fadeOutPromise:function(t){return this.fadeOut(t),Li(this._fade)}},Vi=Phaser.Utils.Objects.GetValue,Ji=Phaser.Utils.Objects.GetAdvancedValue,Ki=Phaser.Math.Linear,qi=function(t){r(o,t);var i=l(o);function o(t,n){var r;return e(this,o),(r=i.call(this,t,n)).resetFromJSON(n),r.boot(),r}return n(o,[{key:"resetFromJSON",value:function(t){if(c(s(o.prototype),"resetFromJSON",this).call(this,t),this.setMode(Vi(t,"mode",0)),t&&(t.hasOwnProperty("x")||t.hasOwnProperty("y"))){var e=Ji(t,"x",void 0),i=Ji(t,"y",void 0);this.setTargetPosition(e,i);}else this.setTargetPosition(t);return this}},{key:"setMode",value:function(t){return "string"==typeof t&&(t=Zi[t]),this.mode=t,this}},{key:"setTargetPosition",value:function(t,e){if("number"==typeof t||"number"==typeof e)this.startX=this.parent.x,this.startY=this.parent.y,this.endX=t,this.endY=e;else {var i=t;this.startX=Ji(i,"startX",void 0),this.startY=Ji(i,"startY",void 0),this.endX=Ji(i,"endX",void 0),this.endY=Ji(i,"endY",void 0);}return this.hasMoveX=void 0!==this.startX&&void 0!==this.endX,this.hasMoveY=void 0!==this.startY&&void 0!==this.endY,this}},{key:"start",value:function(){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),c(s(o.prototype),"start",this).call(this),this}},{key:"updateGameObject",value:function(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasMoveX&&(t.x=Ki(this.startX,this.endX,i)),this.hasMoveY&&(t.y=Ki(this.startY,this.endY,i));}},{key:"complete",value:function(){return c(s(o.prototype),"complete",this).call(this),1===this.mode&&this.parent.destroy(),this}}]),o}(Si),Zi={stop:0,destroy:1,yoyo:2},$i=function(t,e){if("number"==typeof t)return t;var i=t[0],n=parseFloat(t.substr(2));switch(i){case"+":return e+n;case"-":return e-n;case"*":return e*n;case"/":return e/n}},Qi=Phaser.Utils.Objects.IsPlainObject,tn=Phaser.Math.Distance.Between,en=function(t,e){e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0);})),e.on("update",(function(){var e=je.getParentSizer(t);e&&e.resetChildPositionState(t);}));},nn={moveFrom:function(t,e,i,n,r){if(Qi(t)){var s=t;e=s.x,i=s.y,t=s.hasOwnProperty("speed")?1e3*tn(e,i,this.x,this.y)/s.speed:s.duration,n=s.ease;}var o=void 0===this._easeMove;return this._easeMove=function(t,e,i,n,r,s,o){s instanceof qi&&(o=s,s=void 0),void 0===s&&(s=!1);var a={};return a.mode=s?1:0,void 0!==i&&(a.startX=$i(i,t.x),a.endX=t.x),void 0!==n&&(a.startY=$i(n,t.y),a.endY=t.y),a.duration=e,a.ease=void 0===r?"Linear":r,void 0===o?o=new qi(t,a):o.resetFromJSON(a),o.restart(),o}(this,t,e,i,n,r,this._easeMove),o&&en(this,this._easeMove),this._easeMove.completeEventName="movefrom.complete",this},moveFromPromise:function(t,e,i,n,r){return this.moveFrom(t,e,i,n,r),Li(this._easeMove)},moveFromDestroy:function(t,e,i,n){return this.moveFrom(t,e,i,n,!0),this},moveFromDestroyPromise:function(t,e,i,n){return this.moveFromDestroy(t,e,i,n),Li(this._easeMove)},moveTo:function(t,e,i,n,r){if(Qi(t)){var s=t;e=s.x,i=s.y,t=s.hasOwnProperty("speed")?1e3*tn(e,i,this.x,this.y)/s.speed:s.duration,n=s.ease;}var o=void 0===this._easeMove;return this._easeMove=function(t,e,i,n,r,s,o){s instanceof qi&&(o=s,s=void 0),void 0===s&&(s=!1);var a={};return a.mode=s?1:0,void 0!==i&&(a.startX=t.x,a.endX=$i(i,t.x)),void 0!==n&&(a.startY=t.y,a.endY=$i(n,t.y)),a.duration=e,a.ease=void 0===r?"Linear":r,void 0===o?o=new qi(t,a):o.resetFromJSON(a),o.restart(),o}(this,t,e,i,n,r,this._easeMove),o&&en(this,this._easeMove),this._easeMove.completeEventName="moveto.complete",this},moveToPromise:function(t,e,i,n,r){return this.moveTo(t,e,i,n,r),Li(this._easeMove)},moveToDestroy:function(t,e,i,n){return this.moveTo(t,e,i,n,!0),this},moveToDestroyPromise:function(t,e,i,n){return this.moveToDestroy(t,e,i,n,!0),Li(this._easeMove)},moveStop:function(t){return this._easeMove?(this._easeMove.stop(t),this):this}},rn=Phaser.Utils.Objects.GetValue,sn=function(t){r(o,t);var i=l(o);function o(t,n){var r;return e(this,o),(r=i.call(this,t,n)).timer=new fi,r.resetFromJSON(n),r.boot(),r}return n(o,[{key:"resetFromJSON",value:function(t){return this.timer.resetFromJSON(rn(t,"timer")),this.setEnable(rn(t,"enable",!0)),this.setMode(rn(t,"mode",1)),this.isRunning=rn(t,"isRunning",!1),this.setMagnitudeMode(rn(t,"magnitudeMode",1)),this.setAxisMode(rn(t,"axis",0)),this.setDuration(rn(t,"duration",500)),this.setMagnitude(rn(t,"magnitude",10)),this.ox=rn(t,"ox",void 0),this.oy=rn(t,"oy",void 0),this}},{key:"toJSON",value:function(){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}}},{key:"shutdown",value:function(t){this.isShutdown||(c(s(o.prototype),"shutdown",this).call(this,t),this.timer.destroy(),this.timer=void 0);}},{key:"startTicking",value:function(){c(s(o.prototype),"startTicking",this).call(this),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);}},{key:"stopTicking",value:function(){c(s(o.prototype),"stopTicking",this).call(this),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));}},{key:"setEnable",value:function(t){return null==t&&(t=!0),this.enable=t,this}},{key:"setMode",value:function(t){return "string"==typeof t&&(t=on[t]),this.mode=t,this}},{key:"setMagnitudeMode",value:function(t){return "string"==typeof t&&(t=hn[t]),this.magnitudeMode=t,this}},{key:"setAxisMode",value:function(t){return "string"==typeof t&&(t=an[t]),this.axisMode=t,this}},{key:"setDuration",value:function(t){return this.duration=t,this}},{key:"setMagnitude",value:function(t){return this.magnitude=t,this}},{key:"start",value:function(t,e){if("number"!=typeof t){var i=t;e=rn(i,"magnitude",void 0),t=rn(i,"duration",void 0);}return void 0!==e&&this.setMagnitude(e),void 0!==t&&this.setDuration(t),this.timer.setDuration(this.duration).start(),c(s(o.prototype),"start",this).call(this),this}},{key:"shake",value:function(t,e){return this.start(t,e),this}},{key:"update",value:function(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 n=this.magnitude;1===this.magnitudeMode&&(n*=1-this.timer.t);var r=Math.random()*Math.PI*2,s=this.ox+Math.cos(r)*n,o=this.oy+Math.sin(r)*n;switch(this.axisMode){case 1:i.x=s;break;case 2:i.y=o;break;default:i.x=s,i.y=o;}}return this}},{key:"backToOrigin",value:function(){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}}]),o}(oi),on={effect:0,behavior:1},an={both:0,"h&v":0,"x&y":0,horizontal:1,h:1,x:1,vertical:2,v:2,y:2},hn={constant:0,decay:1},ln=Phaser.Utils.Objects.IsPlainObject,un={shake:function(t,e,i){if(ln(t)){var n=t;t=n.duration,e=n.magnitude,i=n.magnitudeMode;}return void 0===this._shake&&(this._shake=new sn(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:function(t,e){return this.shake(t,e),Li(this._shake)}},cn=Phaser.Utils.Objects.GetValue,dn=Phaser.Math.Linear,fn=function(t){r(o,t);var i=l(o);function o(t,n){var r;return e(this,o),(r=i.call(this,t,n)).resetFromJSON(),r.boot(),r}return n(o,[{key:"start",value:function(t){if(this.timer.isRunning)return this;var e=this.target;this.propertyKey=cn(t,"key","value");var i=e[this.propertyKey];return this.fromValue=cn(t,"from",i),this.toValue=cn(t,"to",i),this.setEase(cn(t,"ease",this.ease)),this.setDuration(cn(t,"duration",this.duration)),this.setRepeat(cn(t,"repeat",0)),this.setDelay(cn(t,"delay",0)),this.setRepeatDelay(cn(t,"repeatDelay",0)),this.timer.setDuration(this.duration).setRepeat(this.repeat).setDelay(this.delay).setRepeatDelay(this.repeatDelay),e[this.propertyKey]=this.fromValue,c(s(o.prototype),"start",this).call(this),this}},{key:"updateGameObject",value:function(t,e){var i=e.t;i=this.easeFn(i),t[this.propertyKey]=dn(this.fromValue,this.toValue,i);}}]),o}(Si),vn=Phaser.Utils.Objects.IsPlainObject,pn=function(t){r(s,t);var i=l(s);function s(t,n){var r;return e(this,s),(r=i.call(this,t,n)).parent.setDataEnabled(),r.easeTasks={},r}return n(s,[{key:"complete",value:function(t){this.emit("complete-".concat(t),this.parent,this),this.emit("complete",t,this.parent,this);}},{key:"getEaseTask",value:function(t){var e=this.easeTasks[t];return void 0===e&&(e=new fn(this.parent),this.easeTasks[t]=e,e.setTarget(this.parent.data.values).on("complete",(function(){this.complete(t);}),this)),e}},{key:"easeTo",value:function(t,e,i,n){if(vn(t)){var r=t;t=r.key,e=r.value,i=r.duration,n=r.ease;var s=r.speed;void 0===i&&void 0!==s&&(i=Math.abs(e-this.parent.data.values[t])/s*1e3);}return void 0===i&&(i=1e3),void 0===n&&(n="Linear"),this.getEaseTask(t).restart({key:t,to:e,duration:i,ease:n}),this}},{key:"easeFrom",value:function(t,e,i,n){if(vn(t)){var r=t;t=r.key,e=r.value,i=r.duration,n=r.ease;var s=r.speed;void 0===i&&void 0!==s&&(i=Math.abs(e-this.parent.data.values[t])/s*1e3);}return void 0===i&&(i=1e3),void 0===n&&(n="Linear"),this.getEaseTask(t).restart({key:t,from:e,duration:i,ease:n}),this}},{key:"stopEase",value:function(t,e){void 0===e&&(e=!0);var i=this.easeTasks[t];return i&&i.stop(e),this}},{key:"stopAll",value:function(t){for(var e in void 0===t&&(t=!0),this.easeTasks)this.stopEase(e,t);return this}}]),s}(ni),gn={easeDataTo:function(t,e,i,n){return this._easeData||(this._easeData=new pn(this),function(t,e){e.on("complete",(function(e){t.emit("easedata.".concat(e,".complete"),t),t.emit("easedata.complete",e,t);}));}(this,this._easeData)),this._easeData.easeTo(t,e,i,n),this},easeDataToPromise:function(t,e,i,n){return this.easeDataTo(t,e,i,n),Mi(this._easeData,"complete-".concat(t))},stopEaseData:function(t,e){return this._easeData?(this._easeData.stopEase(t,e),this):this},stopAllEaseData:function(t){return this._easeData?(this._easeData.stopAll(t),this):this}},yn=function(t,e){if(t){Ut(t).hidden=e;var i=_(t);i?i.setChildVisible(t,!e):t.setVisible(!e);}},mn={show:function(t){return void 0===t&&(t=this),function(t){yn(t,!1);}(t),this},hide:function(t){return void 0===t&&(t=this),function(t){yn(t,!0);}(t),this},isShow:function(t){return void 0===t&&(t=this),function(t){return !!t&&!Ut(t).hidden}(t)}};function kn(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var bn={exports:{}};!function(t){var e=Object.prototype.hasOwnProperty,i="~";function n(){}function r(t,e,i){this.fn=t,this.context=e,this.once=i||!1;}function s(t,e,n,s,o){if("function"!=typeof n)throw new TypeError("The listener must be a function");var a=new r(n,s||t,o),h=i?i+e:e;return t._events[h]?t._events[h].fn?t._events[h]=[t._events[h],a]:t._events[h].push(a):(t._events[h]=a,t._eventsCount++),t}function o(t,e){0==--t._eventsCount?t._events=new n:delete t._events[e];}function a(){this._events=new n,this._eventsCount=0;}Object.create&&(n.prototype=Object.create(null),(new n).__proto__||(i=!1)),a.prototype.eventNames=function(){var t,n,r=[];if(0===this._eventsCount)return r;for(n in t=this._events)e.call(t,n)&&r.push(i?n.slice(1):n);return Object.getOwnPropertySymbols?r.concat(Object.getOwnPropertySymbols(t)):r},a.prototype.listeners=function(t){var e=i?i+t:t,n=this._events[e];if(!n)return [];if(n.fn)return [n.fn];for(var r=0,s=n.length,o=new Array(s);r0){var e=t.runTransitionInCallback();t.delayCall(e,this.next,this);}else this.next();}},{key:"exit_TRANS_OPNE",value:function(){this.parent.removeDelayCall();}},{key:"next_OPEN",value:function(){return "TRANS_CLOSE"}},{key:"enter_OPEN",value:function(){this.parent.onOpen();}},{key:"exit_OPEN",value:function(){this.parent.removeDelayCall();}},{key:"next_TRANS_CLOSE",value:function(){return "CLOSE"}},{key:"enter_TRANS_CLOSE",value:function(){var t=this.parent;if(t.transitOutTime>0){var e=t.runTransitionOutCallback();t.delayCall(e,this.next,this);}else this.next();}},{key:"exit_TRANS_CLOSE",value:function(){this.parent.removeDelayCall();}},{key:"next_CLOSE",value:function(){return "TRANS_OPNE"}},{key:"enter_CLOSE",value:function(){this.parent.onClose();}},{key:"exit_CLOSE",value:function(){}},{key:"canOpen",value:function(){return "IDLE"===this.state||"CLOSE"===this.state}},{key:"canClose",value:function(){return "IDLE"===this.state||"OPEN"===this.state}}]),s}(Tn),Rn={delayCall:function(t,e,i){return this.delayCallTimer=function(t,e,i,n,r){var s=$e(t);return s.time.delayedCall(e,(function(){s.game.events.once("poststep",(function(){i.call(n,r);}));}))}(this,t,e,i),this},removeDelayCall:function(){return this.delayCallTimer&&(this.delayCallTimer.remove(!1),this.delayCallTimer=void 0),this}},Mn={setTransitInTime:function(t){return this.transitInTime=t,this},setTransitOutTime:function(t){return this.transitOutTime=t,this},setTransitInCallback:function(t){return t||(t=Qt),this.transitInCallback=t,this},setTransitOutCallback:function(t){return t||(t=Qt),this.transitOutCallback=t,this}},Ln={runTransitionInCallback:function(){return this.transitInCallback(this.parent,this.transitInTime),this.transitInTime},onOpen:function(){},requestOpen:function(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}},An={runTransitionOutCallback:function(){return this.transitOutCallback(this.parent,this.transitOutTime),this.transitOutTime},onClose:function(){this.oneShotMode&&this.parent.destroy();},requestClose:function(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}},Dn={};Object.assign(Dn,Rn,Mn,Ln,An);var zn=Phaser.Utils.Objects.GetValue,jn=function(t){r(o,t);var i=l(o);function o(t,n){var r;return e(this,o),(r=i.call(this,t,n)).setTransitInTime(zn(n,"duration.in",200)),r.setTransitOutTime(zn(n,"duration.out",200)),r.setTransitInCallback(zn(n,"transitIn")),r.setTransitOutCallback(zn(n,"transitOut")),r.oneShotMode=zn(n,"destroy",!1),r.delayCallTimer=void 0,r._state=new En(a(r),{eventEmitter:!1,initState:zn(n,"initState","IDLE")}),r.openEventData=void 0,r.closeEventData=void 0,r}return n(o,[{key:"state",get:function(){return this._state.state}},{key:"shutdown",value:function(t){this.isShutdown||(this.transitInCallback=void 0,this.transitOutCallback=void 0,this.openEventData=void 0,this.closeEventData=void 0,this.removeDelayCall(),c(s(o.prototype),"shutdown",this).call(this,t));}}]),o}(ni);Object.assign(jn.prototype,Dn);var Fn=function(t){r(o,t);var i=l(o);function o(t,n,r){var s;return e(this,o),(s=i.call(this,t,0,0,2,2,n,1)).setAlpha(r),s.setScrollFactor(0),s.boot(),s}return n(o,[{key:"boot",value:function(){this.scene.sys.events.on("prerender",this.resize,this);}},{key:"destroy",value:function(t){this.scene&&!this.ignoreDestroy&&(this.scene.sys.events.off("prerender",this.resize,this),c(s(o.prototype),"destroy",this).call(this,t));}},{key:"tint",get:function(){return this.fillColor},set:function(t){this.setFillStyle(t,this.fillAlpha);}},{key:"resize",value:function(){var t=this.scene,e=t.sys.scale.gameSize,i=t.sys.cameras.main,n=e.width,r=e.height,s=1/i.zoom,o=n/2,a=r/2,h=n*s,l=r*s;this.x===o&&this.y===a||this.setPosition(o,a),this.width===h&&this.height===l||this.setSize(h,l).setOrigin(.5);}}]),o}(Phaser.GameObjects.Rectangle),Wn=Phaser.Utils.Objects.GetValue,Xn=function(t){r(s,t);var i=l(s);function s(t,n){var r;return e(this,s),(r=i.call(this,t,{eventEmitter:!1})).resetFromJSON(n),r.boot(),r}return n(s,[{key:"resetFromJSON",value:function(t){return this.setHitAreaMode(Wn(t,"hitAreaMode",0)),this.setEnable(Wn(t,"enable",!0)),this.setStopMode(Wn(t,"stopAllLevels",!0)),this}},{key:"boot",value:function(){this.parent.on("pointerdown",(function(t,e,i,n){this.stopAllLevels&&n.stopPropagation();}),this).on("pointerup",(function(t,e,i,n){this.stopAllLevels&&n.stopPropagation();}),this).on("pointermove",(function(t,e,i,n){this.stopAllLevels&&n.stopPropagation();}),this).on("pointerover",(function(t,e,i,n){this.stopAllLevels&&n.stopPropagation();}),this).on("pointerout",(function(t,e){this.stopAllLevels&&e.stopPropagation();}),this);}},{key:"setHitAreaMode",value:function(t){"string"==typeof t&&(t=Yn[t]);var e=this.parent;return e.input&&e.removeInteractive(),0===t?e.setInteractive():e.setInteractive({hitArea:{},hitAreaCallback:function(){return !0}}),this}},{key:"setEnable",value:function(t){return void 0===t&&(t=!0),t?this.parent.setInteractive():this.parent.disableInteractive(),this.enable=t,this}},{key:"setStopMode",value:function(t){return void 0===t&&(t=!0),this.stopAllLevels=t,this}},{key:"toggleEnable",value:function(){return this.setEnable(!this.enable),this}}]),s}(ni),Yn={default:0,fullWindow:1},In=Phaser.Utils.Objects.GetValue,Bn=function(t){r(s,t);var i=l(s);function s(t,n){var r;e(this,s);var o=In(n,"color",0),h=In(n,"alpha",.8);return (r=i.call(this,t,o,h)).touchEventStop=new Xn(a(r),{hitAreaMode:1}),r}return n(s)}(Fn),Nn=function(t,e){void 0!==t._modalScaleSave?(t.scaleX=t._modalScaleSave,t.scaleY=t._modalScaleSave):t._modalScaleSave=t.scaleX,Ei(t,e);},Hn=function(t,e){Ri(t,e,void 0,void 0,!1);},Gn=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Bi(t,e);},Un=function(t,e){Ni(t,e,!1);},Vn=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Bi(t,e,t.alpha);},Jn=function(t,e){Ni(t,e,!1);},Kn=function(t,e,i,n,r){return !!t&&(!(n&&!n(t,e,i))&&(!!bt(t,!0).contains(e,i)&&!(r&&!r(t,e,i))))},qn=Phaser.Utils.Objects.GetValue,Zn=function(t){r(o,t);var i=l(o);function o(t,n){var r;e(this,o),void 0===n&&(n={}),null==n.transitIn&&(n.transitIn=$n.popUp),null==n.transitOut&&(n.transitOut=$n.scaleDown),n.destroy=qn(n,"destroy",!0),r=i.call(this,t,n);var s=qn(n,"cover");r.cover=!1!==s?function(t,e){var i=t.scene,n=new Bn(i,e);return i.add.existing(n),t.isRexContainerLite?(t.pin(n,{syncPosition:!1,syncRotation:!1,syncScale:!1,syncAlpha:!1,syncScrollFactor:!1}),t.moveDepthBelow(n)):i.children.moveBelow(n,t),n}(t,s):void 0,r.cover&&(r.setCoverTransitInCallback(qn(s,"transitIn",Vn)),r.setCoverTransitOutCallback(qn(s,"transitOut",Jn)));var h=qn(n,"touchOutsideClose",!1),l=qn(n,"duration.hold",-1),u=qn(n,"timeOutClose",l>=0),c=qn(n,"anyTouchClose",!1);return qn(n,"manualClose",!1)&&(h=!1,c=!1,u=!1),c&&(h=!1),u?r.setDisplayTime(l):r.setDisplayTime(-1),c?r.once("open",r.anyTouchClose,a(r)):h&&r.once("open",r.touchOutsideClose,a(r)),qn(n,"openOnStart",!0)&&r.delayCall(0,r.requestOpen,a(r)),r}return n(o,[{key:"shutdown",value:function(t){this.isShutdown||(this.cover||this.scene.input.off("pointerup",this.touchCloseCallback,this),this.cover&&!t&&(this.cover.destroy(),this.cover=void 0),c(s(o.prototype),"shutdown",this).call(this,t));}},{key:"touchOutsideClose",value:function(){return this.cover?this.cover.on("pointerup",this.touchCloseCallback,this):this.scene.input.on("pointerup",this.touchCloseCallback,this),this.clickOutsideTest=!0,this}},{key:"anyTouchClose",value:function(){return this.cover?this.cover.once("pointerup",this.touchCloseCallback,this):this.scene.input.once("pointerup",this.touchCloseCallback,this),this}},{key:"touchCloseCallback",value:function(t){this.clickOutsideTest&&Kn(this.parent,t.worldX,t.worldY)||this.requestClose();}},{key:"runTransitionInCallback",value:function(){var t=c(s(o.prototype),"runTransitionInCallback",this).call(this),e=this.cover;return e&&this.coverTransitInCallback&&this.coverTransitInCallback(e,t),t}},{key:"runTransitionOutCallback",value:function(){var t=c(s(o.prototype),"runTransitionOutCallback",this).call(this),e=this.cover;return e&&this.coverTransitOutCallback&&this.coverTransitOutCallback(e,t),t}},{key:"onOpen",value:function(){var t=this.displayTime;t>=0&&this.delayCall(t,this.requestClose,this),this.emit("open",this.parent,this),c(s(o.prototype),"onOpen",this).call(this);}},{key:"onClose",value:function(){this.emit("close",this.closeEventData),c(s(o.prototype),"onClose",this).call(this);}},{key:"setDisplayTime",value:function(t){return this.displayTime=t,this}},{key:"setTransitInCallback",value:function(t){switch("string"==typeof t&&(t=$n[t]),t){case $n.popUp:t=Nn;break;case $n.fadeIn:t=Gn;}return c(s(o.prototype),"setTransitInCallback",this).call(this,t),this}},{key:"setTransitOutCallback",value:function(t){switch("string"==typeof t&&(t=$n[t]),t){case $n.scaleDown:t=Hn;break;case $n.fadeOut:t=Un;}return c(s(o.prototype),"setTransitOutCallback",this).call(this,t),this}},{key:"setCoverTransitInCallback",value:function(t){return this.coverTransitInCallback=t,this}},{key:"setCoverTransitOutCallback",value:function(t){return this.coverTransitOutCallback=t,this}}]),o}(jn),$n={popUp:0,fadeIn:1,scaleDown:0,fadeOut:1},Qn=function(t){return t&&"function"==typeof t},tr={modal:function(t,e){return Qn(t)&&(e=t,t=void 0),void 0===this._modalBehavior&&(this.onCreateModalBehavior&&this.onCreateModalBehavior(this,t),this._modalBehavior=function(t,e){var i=new Zn(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:function(t){var e=this;return new Promise((function(i,n){e.modal(t,i);}))},modalClose:function(t){return function(t,e){t.emit("modal.requestClose",e);}(this,t),this}},er=function(t,e,i,n){if(e)return Kn(t,e.worldX,e.worldY,i,n);for(var r=t.scene.input.manager,s=r.pointersTotal,o=r.pointers,a=0;a=this.dragThreshold&&this.cancel();}},{key:"click",value:function(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 n=this.lastClickTime;return void 0!==n&&t-n<=this.clickInterval||(this.lastClickTime=t,this.emit("click",this,this.parent,e,i)),this}},{key:"cancel",value:function(){return this.pointer=void 0,this}},{key:"onOver",value:function(t,e,i,n){return this.enable?(this.emit("over",this,this.parent,t,n),this):this}},{key:"onOut",value:function(t,e){return this.enable?(this.emit("out",this,this.parent,t,e),this):this}}]),o}(ni),pr={press:0,pointerdown:0,release:1,pointerup:1},gr={onClick:function(t,e,i,n){return t?("function"==typeof t&&(n=i,i=e,e=t,t=this),void 0===t._click&&(t._click=new vr(t,n)),t._click.on("click",e,i),this):this},offClick:function(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:function(e,i){return e&&"object"!==t(e)&&(i=e,e=this),void 0===e._click||e._click.setEnable(i),this},disableClick:function(e){return e&&"object"!==t(e)&&(e=this),void 0===e._click||e._click.setEnable(!1),this}},yr=function(t,e,i,n){if(e)return !(i&&!i(t,e))&&(!!mr(t,e)&&!(n&&!n(t,e)));for(var r=t.scene.input.manager,s=r.pointersTotal,o=r.pointers,a=0;a0)return kr.length=0,!0;return kr.length=0,!1},kr=[],br=Phaser.Utils.Objects.GetValue,wr=function(t){r(o,t);var i=l(o);function o(t,n){var r;e(this,o),(r=i.call(this,t,n))._enable=void 0;var s=br(n,"inputConfig",void 0);return s&&t.setInteractive(s),r.resetFromJSON(n),r.boot(),r}return n(o,[{key:"resetFromJSON",value:function(t){return this.pointer=void 0,this.lastClickTime=void 0,this.setEnable(br(t,"enable",!0)),this.setMode(br(t,"mode",1)),this.setClickInterval(br(t,"clickInterval",100)),this.setDragThreshold(br(t,"threshold",void 0)),this}},{key:"boot",value:function(){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);}},{key:"shutdown",value:function(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,c(s(o.prototype),"shutdown",this).call(this,t);}}},{key:"enable",get:function(){return this._enable},set:function(t){if(this._enable!==t){t||this.cancel(),this._enable=t;var e=t?"enable":"disable";this.emit(e,this,this.parent);}}},{key:"setEnable",value:function(t){return void 0===t&&(t=!0),this.enable=t,this}},{key:"toggleEnable",value:function(){return this.setEnable(!this.enable),this}},{key:"setMode",value:function(t){return "string"==typeof t&&(t=xr[t]),this.mode=t,this}},{key:"setClickInterval",value:function(t){return this.clickInterval=t,this}},{key:"setDragThreshold",value:function(t){return this.dragThreshold=t,this}},{key:"isPointerInside",value:function(t){var e=this.parent;return (e.input?yr:er)(e,t)}},{key:"onPress",value:function(t){this.parent.willRender(t.camera)&&void 0===this.pointer&&(this.pointer=t,0===this.mode&&(this.isPointerInside(t)||this.click(t.downTime,t)));}},{key:"onRelease",value:function(t){this.parent.willRender(t.camera)&&this.pointer===t&&(1===this.mode&&(this.isPointerInside(t)||this.click(t.upTime,t)),this.pointer=void 0);}},{key:"onMove",value:function(t,e,i,n){this.pointer===t&&void 0!==this.dragThreshold&&1===this.mode&&(t.getDistance()>=this.dragThreshold||this.isPointerInside(t))&&this.cancel();}},{key:"click",value:function(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}},{key:"cancel",value:function(){return this.pointer=void 0,this}}]),o}(ni),xr={press:0,pointerdown:0,release:1,pointerup:1},Sr={onClickOutside:function(t,e,i,n){return t?("function"==typeof t&&(n=i,i=e,e=t,t=this),void 0===t._clickOutside&&(t._clickOutside=new wr(t,n)),t._clickOutside.on("clickoutside",e,i),this):this},offClickOutside:function(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:function(e,i){return e&&"object"!==t(e)&&(i=e,e=this),void 0===e._clickOutside||e._clickOutside.setEnable(i),this},disableClickOutside:function(e){return e&&"object"!==t(e)&&(e=this),void 0===e._clickOutside||e._clickOutside.setEnable(!1),this}},Cr=function(t){r(s,t);var i=l(s);function s(){var t;return e(this,s),(t=i.call(this,{eventEmitter:!1})).goto("IDLE"),t}return n(s,[{key:"setCooldownTime",value:function(t){return this.cooldownTime=t,this.cooldownMode=void 0!==t,this}},{key:"request",value:function(){return this.runMethod("request")}},{key:"update_IDLE",value:function(){this.compensationTime=0;}},{key:"request_IDLE",value:function(){return this.next(),!0}},{key:"next_IDLE",value:function(){if(this.cooldownMode)return "COOLDOWN"}},{key:"enter_COOLDOWN",value:function(){this.remainderTime=this.cooldownTime+this.compensationTime;}},{key:"update_COOLDOWN",value:function(t,e){this.remainderTime-=e,this.remainderTime<0&&(this.compensationTime=this.cooldownTime>e?-this.remainderTime:0,this.goto("IDLE"));}},{key:"request_COOLDOWN",value:function(){return !1}}]),s}(Tn),_r=Phaser.Utils.Objects.GetValue,Or=function(t){r(o,t);var i=l(o);function o(t,n){var r;return e(this,o),(r=i.call(this,t,n))._enable=void 0,r.cooldown=new Cr,r.parent.setInteractive(_r(n,"inputConfig",void 0)),r.resetFromJSON(n),r.boot(),r}return n(o,[{key:"resetFromJSON",value:function(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}},{key:"boot",value:function(){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);}},{key:"shutdown",value:function(t){this.isShutdown||(this.scene.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,c(s(o.prototype),"shutdown",this).call(this,t));}},{key:"enable",get:function(){return this._enable},set:function(t){if(this._enable!==t)return t||(this.prevIsInTouch=!1,this.isInTouching=!1,this.pointer=void 0),this._enable=t,this}},{key:"setEnable",value:function(t){return void 0===t&&(t=!0),this.enable=t,this}},{key:"cooldownTime",get:function(){return this.cooldown.cooldownTime},set:function(t){this.cooldown.setCooldownTime(t);}},{key:"setCooldown",value:function(t){return this.cooldownTime=t,this}},{key:"toggleEnable",value:function(){return this.setEnable(!this.enable),this}},{key:"onPointIn",value:function(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.pointer=t,this.isInTouching=!0);}},{key:"onPointOut",value:function(t){this.enable&&this.pointer===t&&(this.pointer=void 0,this.isInTouching=!1);}},{key:"preupdate",value:function(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;}}]),o}(ni),Pr={isPointerInBounds:function(t){return void 0===t?t=this:"string"==typeof t&&(t=this.getElement(t)),!!t&&er(t)},onTouching:function(t,e,i,n){return t?("function"==typeof t&&(n=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new Or(t,n)),t._inTouching.on("intouch",e,i),this):this},offTouching:function(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:function(t,e,i,n){return t?("function"==typeof t&&(n=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new Or(t,n)),t._inTouching.on("touchend",e,i),this):this},offTouchingEnd:function(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:function(e,i){return e&&"object"!==t(e)&&(i=e,e=this),void 0===e._inTouching||e._inTouching.setEnable(i),this},disableTouching:function(e){return e&&"object"!==t(e)&&(e=this),void 0===e._inTouching||e._inTouching.setEnable(!1),this}},Tr=function(t,e,i){for(var n,r=0,s=t.length;r0),this.onDragStart()));}},{key:"onPointerUp",value:function(t){this.enable&&((!this.bounds||this.bounds.contains(t.x,t.y))&&this.pointer===t&&(this.pointer=void 0,this.movedState=!1,this.tracerState=Hr,this.onDragEnd()));}},{key:"onPointerMove",value:function(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()));}}},{key:"dragCancel",value:function(){return this.tracerState===Gr&&this.onDragEnd(),this.pointer=void 0,this.tracerState=Hr,this}},{key:"onDragStart",value:function(){this.emit("dragstart",this);}},{key:"onDragEnd",value:function(){this.emit("dragend",this);}},{key:"onDrag",value:function(){this.emit("drag",this);}},{key:"preUpdate",value:function(t,e){}},{key:"postUpdate",value:function(t,e){}},{key:"startTicking",value:function(){c(s(o.prototype),"startTicking",this).call(this),this.scene.sys.events.on("preupdate",this.preUpdate,this),this.scene.sys.events.on("postupdate",this.postUpdate,this);}},{key:"stopTicking",value:function(){c(s(o.prototype),"stopTicking",this).call(this),this.scene&&(this.scene.sys.events.off("preupdate",this.preUpdate,this),this.scene.sys.events.off("postupdate",this.postUpdate,this));}},{key:"setRecongizedStateObject",value:function(t){return this.recongizedState=t,this}},{key:"state",get:function(){return this.recongizedState.state},set:function(t){this.recongizedState.state=t;}},{key:"cancel",value:function(){return this.state=Ur,this}}]),o}(oi),Hr=0,Gr=1,Ur="IDLE",Vr=Phaser.Utils.Objects.GetValue,Jr=Phaser.Math.Distance.Between,Kr=function(t){r(o,t);var i=l(o);function o(t,n){var r;e(this,o);var s=a(r=i.call(this,t,n)),h={states:{IDLE:{enter:function(){s.stop(),s.tapsCount=0,s.x=0,s.y=0,s.worldX=0,s.worldY=0;},exit:function(){var t=s.lastPointer;s.x=t.x,s.y=t.y,s.worldX=t.worldX,s.worldY=t.worldY;}},BEGIN:{enter:function(){s.start(),s.tapsCount=0,s.emit("tappingstart",s,s.gameObject,s.lastPointer);}},RECOGNIZED:{enter:function(){s.start(),s.emit("tap",s,s.gameObject,s.lastPointer),s.emit("".concat(s.tapsCount,"tap"),s,s.gameObject,s.lastPointer);}}},init:function(){this.state=qr;},eventEmitter:!1};return r.setRecongizedStateObject(new Tn(h)),r}return n(o,[{key:"resetFromJSON",value:function(t){c(s(o.prototype),"resetFromJSON",this).call(this,t),this.setHoldTime(Vr(t,"time",250)),this.setTapInterval(Vr(t,"tapInterval",200)),this.setDragThreshold(Vr(t,"threshold",9)),this.setTapOffset(Vr(t,"tapOffset",10));var e=Vr(t,"taps",void 0);return void 0!==e?this.setTaps(e):(this.setMaxTaps(Vr(t,"maxTaps",void 0)),this.setMinTaps(Vr(t,"minTaps",void 0))),this}},{key:"onDragStart",value:function(){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=$r,this.state=Zr);break;case $r:this.state=Zr;}}},{key:"onDragEnd",value:function(){this.state===Zr&&(this.tapsCount++,this.emit("tapping",this,this.gameObject,this.lastPointer),void 0!==this.maxTaps&&this.tapsCount===this.maxTaps&&(this.state=$r));}},{key:"onDrag",value:function(){this.state!==qr&&this.pointer.getDistance()>this.dragThreshold&&(this.state=qr);}},{key:"preUpdate",value:function(t,e){if(this.isRunning&&this.enable&&this.state===Zr){var i=this.lastPointer;if(i.isDown)t-i.downTime>this.holdTime&&(this.state=qr);else t-i.upTime>this.tapInterval&&(void 0===this.minTaps||this.tapsCount>=this.minTaps?this.state=$r:this.state=qr);}}},{key:"postUpdate",value:function(t,e){this.isRunning&&this.enable&&this.state===$r&&(this.state=qr);}},{key:"isTapped",get:function(){return this.state===$r}},{key:"setHoldTime",value:function(t){return this.holdTime=t,this}},{key:"setTapInterval",value:function(t){return this.tapInterval=t,this}},{key:"setDragThreshold",value:function(t){return this.dragThreshold=t,this}},{key:"setTapOffset",value:function(t){return this.tapOffset=t,this}},{key:"setMaxTaps",value:function(t){return this.maxTaps=t,this}},{key:"setMinTaps",value:function(t){return this.minTaps=t,this}},{key:"setTaps",value:function(t,e){return void 0===e&&(e=t),this.setMinTaps(t).setMaxTaps(e),this}}]),o}(Nr),qr="IDLE",Zr="BEGIN",$r="RECOGNIZED",Qr=Phaser.Utils.Objects.GetValue,ts=function(t){r(o,t);var i=l(o);function o(t,n){var r;e(this,o);var s=a(r=i.call(this,t,n)),h={states:{IDLE:{enter:function(){s.x=0,s.y=0,s.worldX=0,s.worldY=0;},exit:function(){var t=s.lastPointer;s.x=t.x,s.y=t.y,s.worldX=t.worldX,s.worldY=t.worldY;}},BEGIN:{enter:function(){s.start();},exit:function(){s.stop();}},RECOGNIZED:{enter:function(){s.emit("pressstart",s,s.gameObject,s.lastPointer);},exit:function(){s.emit("pressend",s,s.gameObject,s.lastPointer);}}},init:function(){this.state=es;},eventEmitter:!1};return r.setRecongizedStateObject(new Tn(h)),r}return n(o,[{key:"resetFromJSON",value:function(t){return c(s(o.prototype),"resetFromJSON",this).call(this,t),this.setDragThreshold(Qr(t,"threshold",9)),this.setHoldTime(Qr(t,"time",251)),this}},{key:"onDragStart",value:function(){this.state=is,0===this.holdTime&&(this.state=ns);}},{key:"onDragEnd",value:function(){this.state=es;}},{key:"onDrag",value:function(){this.state!==es&&this.pointer.getDistance()>this.dragThreshold&&(this.state=es);}},{key:"preUpdate",value:function(t,e){this.isRunning&&this.enable&&(this.state===is&&t-this.pointer.downTime>=this.holdTime&&(this.state=ns));}},{key:"isPressed",get:function(){return this.state===ns}},{key:"setHoldTime",value:function(t){return this.holdTime=t,this}},{key:"setDragThreshold",value:function(t){return this.dragThreshold=t,this}}]),o}(Nr),es="IDLE",is="BEGIN",ns="RECOGNIZED";Phaser.Utils.Objects.GetValue;var rs=Phaser.Math.Distance.Between,ss=Phaser.Math.Angle.Between,os={getDt:function(){var t;return t=this.scene,ei(t).loop.delta},getVelocity:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return rs(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 ss(e.x,e.y,t.x,t.y)}},as={"up&down":0,"left&right":1,"4dir":2,"8dir":3},hs={},ls=Phaser.Utils.Objects.GetValue,us=Phaser.Math.RadToDeg,cs=function(t){r(o,t);var i=l(o);function o(t,n){var r;e(this,o);var s=a(r=i.call(this,t,n)),h={states:{IDLE:{enter:function(){s.x=0,s.y=0,s.worldX=0,s.worldY=0;},exit:function(){var t=s.lastPointer;s.x=t.x,s.y=t.y,s.worldX=t.worldX,s.worldY=t.worldY;}},BEGIN:{enter:function(){s.validDrag=!1;}},RECOGNIZED:{enter:function(){s.start(),s.updateDirectionStates(),s.emit("swipe",s,s.gameObject,s.lastPointer);},exit:function(){s.stop(),s.clearDirectionStates();}}},init:function(){this.state=ds;},eventEmitter:!1};return r.setRecongizedStateObject(new Tn(h)),r.clearDirectionStates(),r}return n(o,[{key:"resetFromJSON",value:function(t){return c(s(o.prototype),"resetFromJSON",this).call(this,t),this.setDragThreshold(ls(t,"threshold",10)),this.setVelocityThreshold(ls(t,"velocityThreshold",1e3)),this.setDirectionMode(ls(t,"dir","8dir")),this}},{key:"onDragStart",value:function(){this.state=fs;}},{key:"onDragEnd",value:function(){this.state=ds;}},{key:"onDrag",value:function(){this.state===fs&&(this.validDrag||(this.validDrag=0===this.dragThreshold||this.pointer.getDistance()>=this.dragThreshold),this.validDrag&&this.dragVelocity>this.velocityThreshold&&(this.state=vs));}},{key:"postUpdate",value:function(t,e){this.isRunning&&this.enable&&this.state===vs&&(this.state=ds);}},{key:"isSwiped",get:function(){return this.state===vs}},{key:"dragVelocity",get:function(){var t;switch(this.dirMode){case 0:t=this.getVelocityY();break;case 1:t=this.getVelocityX();break;default:t=this.getVelocity();}return t}},{key:"setDragThreshold",value:function(t){return this.dragThreshold=t,this}},{key:"setVelocityThreshold",value:function(t){return this.velocityThreshold=t,this}},{key:"setDirectionMode",value:function(t){return "string"==typeof t&&(t=as[t]),this.dirMode=t,this}},{key:"updateDirectionStates",value:function(){return function(t,e,i){switch(void 0===i?i={}:!0===i&&(i=hs),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;}}(us(this.getVelocityAngle()),this.dirMode,this),this}},{key:"clearDirectionStates",value:function(){return this.left=!1,this.right=!1,this.up=!1,this.down=!1,this}}]),o}(Nr);Object.assign(cs.prototype,os);var ds="IDLE",fs="BEGIN",vs="RECOGNIZED",ps=Phaser.Utils.Objects.GetValue,gs=Phaser.Utils.Array.SpliceOne,ys=Phaser.Math.Distance.Between,ms=Phaser.Math.Angle.Between,ks=function(){function t(i,n){e(this,t);var r=i.input.manager.pointersTotal-1;r<2&&i.input.addPointer(2-r),this.scene=i,this.setEventEmitter(ps(n,"eventEmitter",void 0)),this._enable=void 0,this.pointers=[],this.movedState={},this.resetFromJSON(n),this.boot();}return n(t,[{key:"resetFromJSON",value:function(t){return this.setEnable(ps(t,"enable",!0)),this.bounds=ps(t,"bounds",void 0),this.tracerState=ws,this.pointers.length=0,Rt(this.movedState),this}},{key:"boot",value:function(){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);}},{key:"shutdown",value:function(){this.scene&&(this.destroyEventEmitter(),this.pointers.length=0,Rt(this.movedState),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);}},{key:"destroy",value:function(){this.shutdown();}},{key:"enable",get:function(){return this._enable},set:function(t){if(this._enable!==t)return t||this.dragCancel(),this._enable=t,this}},{key:"setEnable",value:function(t){return void 0===t&&(t=!0),this.enable=t,this}},{key:"toggleEnable",value:function(){return this.setEnable(!this.enable),this}},{key:"onPointerDown",value:function(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.tracerState){case ws:this.tracerState=xs,this.onDrag1Start();break;case xs:this.tracerState=Ss,this.onDrag2Start();}}},{key:"onPointerUp",value:function(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],gs(this.pointers,e),this.tracerState){case xs:this.tracerState=ws,this.onDrag1End();break;case Ss:this.tracerState=xs,this.onDrag2End(),this.onDrag1Start();}}}},{key:"onPointerMove",value:function(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 xs:this.onDrag1();break;case Ss:this.onDrag2();}}}},{key:"dragCancel",value:function(){return this.tracerState===Ss&&this.onDrag2End(),this.pointers.length=0,Rt(this.movedState),this.tracerState=ws,this}},{key:"onDrag1Start",value:function(){this.emit("drag1start",this);}},{key:"onDrag1End",value:function(){this.emit("drag1end",this);}},{key:"onDrag1",value:function(){this.emit("drag1",this);}},{key:"onDrag2Start",value:function(){this.emit("drag2start",this);}},{key:"onDrag2End",value:function(){this.emit("drag2end",this);}},{key:"onDrag2",value:function(){this.emit("drag2",this);}},{key:"distanceBetween",get:function(){if(this.tracerState!==Ss)return 0;var t=this.pointers[0],e=this.pointers[1];return ys(t.x,t.y,e.x,e.y)}},{key:"angleBetween",get:function(){if(this.tracerState!==Ss)return 0;var t=this.pointers[0],e=this.pointers[1];return ms(t.x,t.y,e.x,e.y)}},{key:"drag1Vector",get:function(){var t=this.pointers[0];if(t&&this.movedState[t.id]){var e=t.position,i=t.prevPosition;bs.x=e.x-i.x,bs.y=e.y-i.y;}else bs.x=0,bs.y=0;return bs}},{key:"centerX",get:function(){if(this.tracerState!==Ss)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return (t.x+e.x)/2}},{key:"centerY",get:function(){if(this.tracerState!==Ss)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return (t.y+e.y)/2}},{key:"prevCenterX",get:function(){if(this.tracerState!==Ss)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}},{key:"prevCenterY",get:function(){if(this.tracerState!==Ss)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}},{key:"movementCenterX",get:function(){return this.centerX-this.prevCenterX}},{key:"movementCenterY",get:function(){return this.centerY-this.prevCenterY}},{key:"setRecongizedStateObject",value:function(t){return this.recongizedState=t,this}},{key:"state",get:function(){return this.recongizedState.state},set:function(t){this.recongizedState.state=t;}},{key:"cancel",value:function(){return this.state=Cs,this}}]),t}();Object.assign(ks.prototype,Ke);var bs={},ws=0,xs=1,Ss=2,Cs="IDLE";Phaser.Utils.Objects.GetValue;var _s=Phaser.Math.RotateAround,Os=function(t,e,i,n){return _s(t,e,i,n),t.rotation+=n,t},Ps={},Ts=Phaser.Utils.Objects.GetValue,Es=Phaser.Math.Angle.WrapDegrees,Rs=Phaser.Math.Angle.ShortestBetween,Ms=Phaser.Math.RadToDeg,Ls=Phaser.Math.DegToRad,As=function(t){r(o,t);var i=l(o);function o(t,n){var r;e(this,o);var s=a(r=i.call(this,t,n)),h={states:{IDLE:{enter:function(){s.prevAngle=void 0,s.angle=0;}},BEGIN:{},RECOGNIZED:{enter:function(){s.emit("rotatestart",s);},exit:function(){s.emit("rotateend",s);}}},init:function(){this.state=zs;},eventEmitter:!1};return r.setRecongizedStateObject(new Tn(h)),r}return n(o,[{key:"resetFromJSON",value:function(t){return c(s(o.prototype),"resetFromJSON",this).call(this,t),this.setDragThreshold(Ts(t,"threshold",0)),this}},{key:"onDrag2Start",value:function(){this.prevAngle=Es(Ms(this.angleBetween)),this.state=js,0===this.dragThreshold&&(this.state=Fs);}},{key:"onDrag2End",value:function(){this.state=zs;}},{key:"onDrag2",value:function(){switch(this.state){case js:if(this.pointers[0].getDistance()>=this.dragThreshold&&this.pointers[1].getDistance()>=this.dragThreshold){var t=Es(Ms(this.angleBetween));this.angle=Rs(this.prevAngle,t),this.prevAngle=t,this.state=Fs;}break;case Fs:t=Es(Ms(this.angleBetween));this.angle=Rs(this.prevAngle,t),this.prevAngle=t,this.emit("rotate",this);}}},{key:"isRotated",get:function(){return this.state===Fs}},{key:"rotation",get:function(){return Ls(this.angle)}},{key:"setDragThreshold",value:function(t){return this.dragThreshold=t,this}}]),o}(ks),Ds={spinObject:function(t,e){if(!this.isRotation)return this;void 0===e&&(e=this.pointers[0].camera);var i=this.movementCenterX,n=this.movementCenterY,r=function(t,e,i,n){return void 0===n?n={}:!0===n&&(n=Ps),i.getWorldPoint(t,e,n),n}(this.centerX,this.centerY,e,!0),s=r.x,o=r.y,a=this.rotation;if(Array.isArray(t))for(var h=t,l=0,u=h.length;l=this.sizerChildren.length?this.sizerChildren.push(e):this.sizerChildren.splice(a,0,e),e.isRexSizer||(i>0&&(0===this.orientation?e.minWidth=void 0===h?pt(e):h:e.minHeight=void 0===l?gt(e):l),s&&(0===this.orientation?e.minHeight=l:e.minWidth=h)),void 0!==o&&this.addChildrenMap(o,e),this},ro={add:no,addSpace:function(t){return this.insertSpace(void 0,t),this},insertSpace:function(t,e){return void 0===e&&(e=1),no.call(this,new Zs(this.scene),{proportion:e,minWidth:0,minHeight:0,index:t}),this},insert:function(t,e,i,n,r,s,o,a){return Qs(i)&&(i.index=t),no.call(this,e,i,n,r,s,o,t,a),this},insertAtPosition:function(t,e,i,n,r,s,o,a,h){var l=$s.call(this,t,e);return -1===l&&(l=void 0),this.insert(l,i,n,r,s,o,a,h),this}},so=Gt.prototype.clear,oo=function(t){this.backgroundChildren&&(this.backgroundChildren.length=0);var e,i=!t&&this.sizerEventsEnable;if(i&&(e=this.getChildren([])),so.call(this,t),i)for(var n,r=0,s=e.length;r=0;e--)this.remove(this.sizerChildren[e],t);return this},clear:function(t){return this.sizerChildren.length=0,oo.call(this,t),this}},lo={getChildAlign:function(t){return this.getSizerConfig(t).align},setChildAlign:function(t,e){return "string"==typeof e&&(e=$t[e]),this.getSizerConfig(t).align=e,this}},uo={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,n,r=0,s=this.sizerChildren;if(0===this.orientation)for(var o=this.space.item,a=!0,h=0,l=s.length;h0&&this.proportionLength>0&&(i=n.proportion*this.proportionLength):n.expand&&(i=e-this.space.left-this.space.right-r.left-r.right);return i},getExpandedChildHeight:function(t,e){var i;void 0===e&&(e=this.height);var n=t.rexSizer,r=n.padding;0===this.orientation?n.expand&&(i=e-this.space.top-this.space.bottom-r.top-r.bottom):n.proportion>0&&this.proportionLength>0&&(i=n.proportion*this.proportionLength);return i},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,n=0,r=i.length;n0?(e=t-this.getChildrenWidth(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0;}return t},resolveHeight:function(t){t=Ue.call(this,t);if(void 0===this.proportionLength&&1===this.orientation){var e=t-this.childrenHeight;e>0?(e=t-this.getChildrenHeight(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0;}return t}};Object.assign(uo,ro,ho,lo,{getChildProportion:function(t){return this.getSizerConfig(t).proportion},setChildProportion:function(t,e){return this.getSizerConfig(t).proportion=e,this}},{getChildExpand:function(t){return this.getSizerConfig(t).expand},setChildExpand:function(t,e){return this.getSizerConfig(t).expand=e,this}});var co=function(){for(var t,e,i=0,n=this.sizerChildren,r=0,s=n.length;r0&&(i+=e);return i},fo={x:0,h:0,horizontal:0,"left-to-right":0,y:1,v:1,vertical:1,"top-to-bottom":1},vo=Phaser.Utils.Objects.IsPlainObject,po=Phaser.Utils.Objects.GetValue,go=function(t){r(s,t);var i=l(s);function s(t,n,r,o,a,h,l){var u;return e(this,s),vo(n)?(n=po(l=n,"x",0),r=po(l,"y",0),o=po(l,"width",void 0),a=po(l,"height",void 0),h=po(l,"orientation",0)):vo(o)?(o=po(l=o,"width",void 0),a=po(l,"height",void 0),h=po(l,"orientation",0)):vo(h)&&(h=po(l=h,"orientation",0)),void 0===h&&(h=0),(u=i.call(this,t,n,r,o,a,l)).type="rexSizer",u.sizerChildren=[],u.setOrientation(h),u.setItemSpacing(po(l,"space.item",0)),u.setStartChildIndex(po(l,"startChildIndex",0)),u.setRTL(po(l,"rtl",!1)),u.addChildrenMap("items",u.sizerChildren),u}return n(s,[{key:"setOrientation",value:function(t){return this.orientation=function(t){return "string"==typeof t&&(t=fo[t]),t}(t),this}},{key:"setItemSpacing",value:function(t){return this.space.item=t,this}},{key:"setStartChildIndex",value:function(t){return this.startChildIndex=t,this}},{key:"setRTL",value:function(t){return void 0===t&&(t=!0),this.rtl=t,this}},{key:"childrenProportion",get:function(){return void 0===this._childrenProportion&&(this._childrenProportion=co.call(this)),this._childrenProportion}}]),s}(Js);Object.assign(go.prototype,uo);var yo=function(t,e,i){if(t){var n=null==e,r=null==i;return n&&r||(n||(t.displayWidth=e),r||(t.displayHeight=i),n&&(t.scaleX=t.scaleY),r&&(t.scaleY=t.scaleX)),t}},mo=function(t,e){var i;return t||0===t||(t=""),void 0===e&&(e=!0),Array.isArray(t)&&(t=t.join("\n")),(i=e?"".concat(this.text,"\n").concat(t):"".concat(this.text).concat(t))!=this.text&&this.setText(i),this},ko={appendText:mo,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 n=t.iconSize;n&&(this.setChildDisplaySize(i,n,n),void 0!==this.iconWidth&&this.setIconSize(n)),!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 s=t.actionSize;s&&(this.setChildDisplaySize(r,s,s),void 0!==this.actionWidth&&this.setActionSize(s)),!0!==t.action&&this.setActionTexture(t.action,t.actionFrame);}return this}},bo=function(t){r(o,t);var i=l(o);function o(){return e(this,o),i.apply(this,arguments)}return n(o,[{key:"text",get:function(){var t=this.childrenMap.text;return t?t.text:""},set:function(t){var e=this.childrenMap.text;e&&e.setText(t);}},{key:"setText",value:function(t){return this.text=t,this}},{key:"setIconTexture",value:function(t,e){var i=this.childrenMap.icon;return i?(i.setTexture(t,e),void 0!==this.iconWidth&&(yo(i,this.iconWidth,this.iconHeight),this.resetChildScaleState(i)),this):this}},{key:"setTexture",value:function(t,e){return this.setIconTexture(t,e),this}},{key:"setIconSize",value:function(t,e){return void 0===e&&(e=t),this.iconWidth=t,this.iconHeight=e,this}},{key:"texture",get:function(){var t=this.childrenMap.icon;if(t)return t.texture}},{key:"frame",get:function(){var t=this.childrenMap.icon;if(t)return t.frame}},{key:"setActionTexture",value:function(t,e){var i=this.childrenMap.action;return void 0===i||(i.setTexture(t,e),void 0!==this.actionWidth&&(yo(i,this.actionWidth,this.actionHeight),this.resetChildScaleState(i))),this}},{key:"actionTexture",get:function(){var t=this.childrenMap.action;if(t)return t.texture}},{key:"actionFrame",get:function(){var t=this.childrenMap.action;if(t)return t.frame}},{key:"setActionSize",value:function(t,e){return void 0===e&&(e=t),this.actionWidth=t,this.actionHeight=e,this}},{key:"preLayout",value:function(){var t=this.childrenMap.icon;t&&void 0!==this.iconWidth&&yo(t,this.iconWidth,this.iconHeight);var e=this.childrenMap.action;e&&void 0!==this.actionWidth&&yo(e,this.actionWidth,this.actionHeight),c(s(o.prototype),"preLayout",this).call(this);}},{key:"runLayout",value:function(t,e,i){if(this.ignoreLayout)return this;c(s(o.prototype),"runLayout",this).call(this,t,e,i);var n=this.childrenMap.iconMask;n&&(n.setPosition(),this.resetChildPositionState(n));var r=this.childrenMap.actionMask;return r&&(r.setPosition(),this.resetChildPositionState(r)),this}},{key:"resize",value:function(t,e){c(s(o.prototype),"resize",this).call(this,t,e);var i=this.childrenMap.iconMask;i&&i.resize();var n=this.childrenMap.actionMask;return n&&n.resize(),this}}]),o}(go);Object.assign(bo.prototype,ko);var wo=function(t,e,i,n,r){if(this.clear().fillStyle(16777215),1===this.shapeType){i=i.left;var s=Math.min(t,e)/2;this.fillCircle(-t*(n-.5),-e*(r-.5),s+i);}else this.fillRect(-t*n-i.left,-e*r-i.top,t+i.left+i.right,e+i.top+i.bottom);},xo=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},So=function(t){r(o,t);var i=l(o);function o(t,n,r){var s;return e(this,o),void 0===n&&(n=0),"string"==typeof n&&(n=Co[n]),(s=i.call(this,t.scene)).parent=t,s.shapeType=n,s.padding=Te(r),s.setPosition().resize().setVisible(!1),s}return n(o,[{key:"destroy",value:function(){return this.parent=void 0,c(s(o.prototype),"destroy",this).call(this),this}},{key:"setPosition",value:function(t,e){var i=this.parent;return void 0===t&&(t=i.x),void 0===e&&(e=i.y),c(s(o.prototype),"setPosition",this).call(this,t,e),this}},{key:"resize",value:function(t,e,i){var n=this.parent;void 0===t&&(t=n.width),void 0===e&&(e=n.height),void 0===i?i=this.padding:"number"==typeof i&&(i=Te(i));var r=this.width!==t||this.height!==e,s=this.padding!==i&&!xo(this.padding,i);return r||s?(this.width=t,this.height=e,s&&Mt(i,this.padding),this.originX=n.originX,this.originY=n.originY,wo.call(this,t,e,i,n.originX,n.originY),this):this}},{key:"setOrigin",value:function(t,e){void 0===e&&(e=t);var i=this.parent;return void 0===t&&(t=i.originX),void 0===e&&(e=i.originY),this.originX===t&&this.originY===e||(this.originX=t,this.originY=e,wo.call(this,this.width,this.height,this.padding,t,e)),this}}]),o}(Phaser.GameObjects.Graphics),Co={rectangle:0,circle:1},_o=function(t,e,i,n){var r=new So(e,i,n);if(t&&!t.isRexSizer){var s=r.createGeometryMask();t.setMask(s),this.once("destroy",(function(){t.setMask(),s.destroy();}));}return this.pin(r),r},Oo=Phaser.Utils.Objects.GetValue,Po=function(t){r(s,t);var i=l(s);function s(t,n){var r;e(this,s),(r=i.call(this,t,n)).type="rexLabel";var o=Oo(n,"background",void 0),h=Oo(n,"icon",void 0),l=Oo(n,"iconMask",void 0),u=Oo(n,"text",void 0),c=Oo(n,"action",void 0),d=Oo(n,"actionMask",void 0),f=Oo(n,"align",void 0);if(o&&r.addBackground(o),"right"!==f&&"bottom"!==f&&"center"!==f||r.addSpace(),h){0===r.orientation?(u||c)&&(w={right:Oo(n,"space.icon",0),top:Oo(n,"space.iconTop",0),bottom:Oo(n,"space.iconBottom",0),left:Oo(n,"space.iconLeft",0)}):(u||c)&&(w={bottom:Oo(n,"space.icon",0),left:Oo(n,"space.iconLeft",0),right:Oo(n,"space.iconRight",0),top:Oo(n,"space.iconTop",0)});var v=Oo(n,"squareFitIcon",!1)?1:0;if(r.add(h,{proportion:0,padding:w,fitRatio:v}),l&&(l=_o.call(a(r),h,h,1)),!v){var p=Oo(n,"iconSize",void 0);r.setIconSize(Oo(n,"iconWidth",p),Oo(n,"iconHeight",p));}}if(u){var g,y,m=Oo(n,"space.text",0),k=Oo(n,"expandTextWidth",!1),b=Oo(n,"expandTextHeight",!1);0===r.orientation?(g=k?1:0,c&&(w={right:m}),y=b):(g=b?1:0,c&&(w={bottom:m}),y=k),r.add(u,{proportion:g,expand:y,padding:w});}if(c){var w;w=0===r.orientation?{top:Oo(n,"space.actionTop",0),bottom:Oo(n,"space.actionBottom",0),right:Oo(n,"space.actionRight",0)}:{left:Oo(n,"space.actionLeft",0),right:Oo(n,"space.actionRight",0),bottom:Oo(n,"space.actionBottom",0)};v=Oo(n,"squareFitAction",!1)?1:0;if(r.add(c,{proportion:0,padding:w,fitRatio:v}),d&&(d=_o.call(a(r),c,c,1)),!v){var x=Oo(n,"actionSize");r.setActionSize(Oo(n,"actionWidth",x),Oo(n,"actionHeight",x));}}return "center"===f&&r.addSpace(),r.addChildrenMap("background",o),r.addChildrenMap("icon",h),r.addChildrenMap("iconMask",l),r.addChildrenMap("text",u),r.addChildrenMap("action",c),r.addChildrenMap("actionMask",d),r}return n(s)}(bo),To=function e(i){var n,r,s;if(null==i||"object"!==t(i))return i;if(n=Array.isArray(i)?[]:{},function(e){if("object"!==t(e)||e.nodeType||e===e.window)return !1;try{if(e.constructor&&!{}.hasOwnProperty.call(e.constructor.prototype,"isPrototypeOf"))return !1}catch(t){return !1}return !0}(i))for(s in i)r=i[s],n[s]=e(r);else n=i;return n},Eo=function(t){return null==t||""===t||0===t.length},Ro=function(e,i,n,r){if(void 0===r&&(r="."),"object"===t(e)){if(Eo(i)){if(null==n)return;"object"===t(n)&&(e=n);}else {"string"==typeof i&&(i=i.split(r));var s=i.pop(),o=function(e,i,n){var r=e;if(Eo(i));else {var s;"string"==typeof i&&(i=i.split("."));for(var o=0,a=i.length;o=0||t.y>=0,t.x=Math.abs(t.x),t.y=Math.abs(t.y);},jo=function(t,e,i){var n=i.length;if(n>=2){var r=i[n-2],s=i[n-1];if(t===r&&e===s)return i}return i.push(t,e),i},Fo=Phaser.Math.DegToRad,Wo=function(t,e,i,n,r,s,o,a,h){o&&s>r?s-=360:!o&&s>>16,a=(65280&r)>>>8,h=255&r;t.fillStyle="rgba("+o+","+a+","+h+","+s+")";}(r,e),r.fill()),e.isStroked&&(!function(t,e,i,n){var r=i||e.strokeColor,s=n||e.strokeAlpha,o=(16711680&r)>>>16,a=(65280&r)>>>8,h=255&r;t.strokeStyle="rgba("+o+","+a+","+h+","+s+")",t.lineWidth=e.lineWidth;}(r,e),r.stroke()),r.restore();}}},Ho=Phaser.GameObjects.Shape,Go=Phaser.Utils.Objects.IsPlainObject,Uo=Phaser.Utils.Objects.GetValue,Vo=Phaser.Geom.Polygon.Earcut,Jo=function(t){r(s,t);var i=l(s);function s(t,n,r,o,a,h,l,u){var c,d,f,v,p;if(e(this,s),Go(n)){var g=n;n=g.x,r=g.y,o=g.width,a=g.height,h=g.radius,l=g.color,u=g.alpha,d=g.strokeColor,f=g.strokeAlpha,v=g.strokeWidth,p=g.shape;}void 0===n&&(n=0),void 0===r&&(r=0),void 0===o&&(o=1),void 0===a&&(a=o),void 0===h&&(h=0),void 0===p&&(p=0);var y=new Lo;if((c=i.call(this,t,"rexRoundRectangleShape",y)).setShapeType(p),0===c.shapeType){var m=Uo(h,"radius",h);y.setTo(0,0,o,a,m);}else {m={x:o/2,y:a/2};y.setTo(0,0,o,a,m);}var k=Uo(h,"iteration",void 0);return c.setIteration(k),c.setPosition(n,r),c.setFillStyle(l,u),void 0!==d&&void 0===v&&(v=2),c.setStrokeStyle(v,d,f),c.updateDisplayOrigin(),c.dirty=!0,c}return n(s,[{key:"fillColor",get:function(){return this._fillColor},set:function(t){this._fillColor=t,this.isFilled=null!=t&&this._fillAlpha>0;}},{key:"fillAlpha",get:function(){return this._fillAlpha},set:function(t){this._fillAlpha=t,this.isFilled=t>0&&null!=this._fillColor;}},{key:"setFillStyle",value:function(t,e){return void 0===e&&(e=1),this.fillColor=t,this.fillAlpha=e,this}},{key:"strokeColor",get:function(){return this._strokeColor},set:function(t){this._strokeColor=t,this.isStroked=null!=t&&this._strokeAlpha>0&&this._lineWidth>0;}},{key:"strokeAlpha",get:function(){return this._strokeAlpha},set:function(t){this._strokeAlpha=t,this.isStroked=t>0&&null!=this._strokeColor&&this._lineWidth>0;}},{key:"lineWidth",get:function(){return this._lineWidth},set:function(t){this._lineWidth=t,this.isStroked=t>0&&null!=this._strokeColor;}},{key:"setStrokeStyle",value:function(t,e,i){return void 0===i&&(i=1),this.lineWidth=t,this.strokeColor=e,this.strokeAlpha=i,this}},{key:"updateData",value:function(){var t=this.geom,e=this.pathData;e.length=0;var i,n=t.width,r=t.height,s=t.cornerRadius,o=this.iteration+1;if(i=s.tl,Ko(i))if(i.convex){var a=i.x,h=i.y;Wo(a,h,i.x,i.y,180,270,!1,o,e);}else {Wo(a=0,h=0,i.x,i.y,90,0,!0,o,e);}else jo(0,0,e);if(i=s.tr,Ko(i))if(i.convex){a=n-i.x,h=i.y;Wo(a,h,i.x,i.y,270,360,!1,o,e);}else {Wo(a=n,h=0,i.x,i.y,180,90,!0,o,e);}else jo(n,0,e);if(i=s.br,Ko(i))if(i.convex){a=n-i.x,h=r-i.y;Wo(a,h,i.x,i.y,0,90,!1,o,e);}else {Wo(a=n,h=r,i.x,i.y,270,180,!0,o,e);}else jo(n,r,e);if(i=s.bl,Ko(i))if(i.convex){a=i.x,h=r-i.y;Wo(a,h,i.x,i.y,90,180,!1,o,e);}else {Wo(a=0,h=r,i.x,i.y,360,270,!0,o,e);}else jo(0,r,e);return e.push(e[0],e[1]),this.pathIndexes=Vo(e),this}},{key:"setShapeType",value:function(t){return "string"==typeof t&&(t=qo[t]),this.shapeType=t,this}},{key:"width",get:function(){return this.geom.width},set:function(t){this.resize(t,this.height);}},{key:"height",get:function(){return this.geom.height},set:function(t){this.resize(this.width,t);}},{key:"setSize",value:function(t,e){if(void 0===e&&(e=t),this.geom.width===t&&this.geom.height===e)return this;this.geom.setSize(t,e),1===this.shapeType&&this.setRadius({x:t/2,y:e/2}),this.updateDisplayOrigin(),this.dirty=!0;var i=this.input;return i&&!i.customHitArea&&(i.hitArea.width=t,i.hitArea.height=e),this}},{key:"resize",value:function(t,e){return this.setSize(t,e),this}},{key:"radius",get:function(){return this.geom.radius},set:function(t){this.geom.setRadius(t),this.updateDisplayOrigin(),this.dirty=!0;}},{key:"radiusTL",get:function(){return this.geom.radiusTL},set:function(t){this.geom.radiusTL=t,this.dirty=!0;}},{key:"radiusTR",get:function(){return this.geom.radiusTR},set:function(t){this.geom.radiusTR=t,this.dirty=!0;}},{key:"radiusBL",get:function(){return this.geom.radiusBL},set:function(t){this.geom.radiusBL=t,this.dirty=!0;}},{key:"radiusBR",get:function(){return this.geom.radiusBR},set:function(t){this.geom.radiusBR=t,this.dirty=!0;}},{key:"setRadius",value:function(t){return void 0===t&&(t=0),this.radius=t,this}},{key:"setRadiusTL",value:function(t){return void 0===t&&(t=0),this.radiusTL=t,this}},{key:"setRadiusTR",value:function(t){return void 0===t&&(t=0),this.radiusTR=t,this}},{key:"setRadiusBL",value:function(t){return void 0===t&&(t=0),this.radiusBL=t,this}},{key:"setRadiusBR",value:function(t){return void 0===t&&(t=0),this.radiusBR=t,this}},{key:"cornerRadius",get:function(){return this.geom.cornerRadius},set:function(t){this.radius=t;}},{key:"setCornerRadius",value:function(t){return this.setRadius(t)}},{key:"iteration",get:function(){return this._iteration},set:function(t){void 0!==this._iteration?this._iteration!==t&&(this._iteration=t,this.dirty=!0):this._iteration=t;}},{key:"setIteration",value:function(t){return void 0===t&&(t=6),this.iteration=t,this}}]),s}(Ho),Ko=function(t){return t.x>0&&t.y>0},qo={rectangle:0,circle:1};Object.assign(Jo.prototype,No);var Zo=Phaser.Utils.Objects.GetValue,$o=function(t){r(s,t);var i=l(s);function s(t,n){var r;e(this,s),(r=i.call(this,t,n)).style=Zo(n,"style",a(r));var o=Zo(n,"propertiesMap");return r.activeStyle=Qo(n,"active",o),r.hoverStyle=Qo(n,"hover",o),r.disableStyle=Qo(n,"disable",o),r.onModifyStyle=Zo(n,"onModifyStyle"),r}return n(s,[{key:"getStyle",value:function(t){return function(t,e,i){if(void 0===i&&(i={}),Array.isArray(e))for(var n=0,r=e.length;n=6?(n=[arguments[2],void 0,arguments[3]],r=[arguments[4],void 0,arguments[5]]):(n=To(n),r=To(r)),this.textureKey=e,this.baseFrameName=i,this.columns.data=n,this.columns.count=n?n.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 s=this.scene.sys.textures.get(e);if(!s)return this.clear(),this;if(!n||!r)return this.clear(),this;for(var o=s.get(i),a=o.width,h=0,l=0,u=n.length;l0?0:g,b=0;l=0;for(var C=n.length;l0?0:y),y>=1&&g>=1){var _=t(m=this.getFrameNameCallback(l,x,i));"string"!==_&&"number"!==_||s.add(m,0,b+o.cutX,w+o.cutY,y,g);}b+=y;}w+=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,n,r,s,o,a,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,f=c>=0?this.maxFixedPartScaleY:this.height/l;if(this.preserveRatio){var v=Math.min(d,f);if(d>v){var p=(d-v)*h;u>=0?u+=p:u=p,d=v;}if(f>v){var g=(f-v)*l;c>=0?c+=g:c=g,f=v;}}this.columns.scale=d,this.rows.scale=f,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 y=0,m=0;this._beginDraw();for(var k=0,b=this.rows.count;k0&&a>0&&(0===(0===s.stretch&&0===r.stretch||0===this.getStretchMode(w,k)?0:1)?this._drawImage(this.textureKey,n,y,m,o,a):this._drawTileSprite(this.textureKey,n,y,m,o,a)),y+=o;m+=a;}this._endDraw();},setStretchMode:function(t){return ka(t)?(this.stretchMode.edge=wa(ba(t,"edge",0)),this.stretchMode.internal=wa(ba(t,"internal",0))):(t=wa(t),this.stretchMode.edge=t,this.stretchMode.internal=t),this},getStretchMode:function(t,e){return Sa.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}},_a=Phaser.Utils.Objects.IsPlainObject,Oa=Phaser.Utils.Objects.GetValue,Pa=Phaser.GameObjects,Ta=void 0,Ea=function(t,e){if(Ta||(Ta={},ei(t).events.once("destroy",(function(){for(var t in Ta)Ta[t].destroy();Ta=void 0;}))),!Ta.hasOwnProperty(e)){var i=ei(t).scene.systemScene;(t=new Pa[e](i)).setOrigin(0),Ta[e]=t;}return Ta[e]},Ra=function(t){r(s,t);var i=l(s);function s(){return e(this,s),i.apply(this,arguments)}return n(s)}(function(t,i){var o=function(t){r(a,t);var o=l(a);function a(t,n,r,s,h,l,u,c,d,f){var v;if(e(this,a),_a(n)?(n=Oa(f=n,"x",0),r=Oa(f,"y",0),s=Oa(f,"width",1),h=Oa(f,"height",1),l=Oa(f,"key",void 0),u=Oa(f,"baseFrame",void 0),c=Oa(f,"columns",void 0),d=Oa(f,"rows",void 0)):_a(s)?(s=Oa(f=s,"width",1),h=Oa(f,"height",1),l=Oa(f,"key",void 0),u=Oa(f,"baseFrame",void 0),c=Oa(f,"columns",void 0),d=Oa(f,"rows",void 0)):_a(l)?(l=Oa(f=l,"key",void 0),u=Oa(f,"baseFrame",void 0),c=Oa(f,"columns",void 0),d=Oa(f,"rows",void 0)):_a(u)?(u=Oa(f=u,"baseFrame",void 0),c=Oa(f,"columns",void 0),d=Oa(f,"rows",void 0)):Array.isArray(u)?(f=d,d=c,c=u,u=Oa(f,"baseFrame",void 0)):_a(c)&&(c=Oa(f=c,"columns",void 0),d=Oa(f,"rows",void 0)),void 0===c){var p=Oa(f,"leftWidth",void 0),g=Oa(f,"rightWidth",void 0);void 0!==p&&void 0!==g&&(c=[p,void 0,g]);}if(void 0===d){var y=Oa(f,"topHeight",void 0),m=Oa(f,"bottomHeight",void 0);void 0!==y&&void 0!==m&&(d=[y,void 0,m]);}(v=o.call(this,t)).type=i,v.setPosition(n,r).setSize(s,h).setOrigin(.5,.5),v.columns={},v.rows={},v.stretchMode={},v._tileSprite=void 0,v._image=void 0,v.setGetFrameNameCallback(Oa(f,"getFrameNameCallback",void 0)),v.setStretchMode(Oa(f,"stretchMode",0)),v.setPreserveRatio(Oa(f,"preserveRatio",!0));var k=Oa(f,"maxFixedPartScale",1),b=Oa(f,"maxFixedPartScaleX",k),w=Oa(f,"maxFixedPartScaleY",void 0);return v.setMaxFixedPartScale(b,w),v.setBaseTexture(l,u,c,d),v}return n(a,[{key:"minWidth",get:function(){return this.columns.minWidth}},{key:"minHeight",get:function(){return this.rows.minHeight}},{key:"fixedPartScaleX",get:function(){return this.columns.scale}},{key:"fixedPartScaleY",get:function(){return this.rows.scale}},{key:"resize",value:function(t,e){return this.width===t&&this.height===e||(c(s(a.prototype),"resize",this)?c(s(a.prototype),"resize",this).call(this,t,e):c(s(a.prototype),"setSize",this).call(this,t,e),this.updateTexture()),this}}]),a}(t);return Object.assign(o.prototype,Ca),o}(Phaser.GameObjects.RenderTexture,"rexNinePatch")),Ma={_drawImage:function(t,e,i,n,r,s){var o=Ea(this,"Image").setTexture(t,e).setDisplaySize(r,s);this.draw(o,i,n);},_drawTileSprite:function(t,e,i,n,r,s){var o=Ea(this,"TileSprite").setTexture(t,e).setSize(r,s);this.draw(o,i,n);}};Object.assign(Ra.prototype,Ma);var La=function(t,e){var i,n;switch(e&&(e.hasOwnProperty("type")?i=e.type:e.hasOwnProperty("leftWidth")?i="nineSlice":e.hasOwnProperty("key")&&(i="image")),i){case"image":n=new ya(t,e);break;case"nineSlice":n=e.hasOwnProperty("stretchMode")?new Ra(t,e):new fa(t,e);break;default:n=new ia(t,e);}return t.add.existing(n),n},Aa=Phaser.GameObjects.Text,Da=Phaser.Utils.Objects.GetValue,za=function(t){r(s,t);var i=l(s);function s(t,n){var r;e(this,s),void 0===n&&(n={});var o=Da(n,"x",0),a=Da(n,"y",0),h=Da(n,"text","");return (r=i.call(this,t,o,a,h,n)).type="rexStatesText",n.style=r.style,n.onModifyStyle=function(t,e){var i=e.hasOwnProperty("fontStyle")||e.hasOwnProperty("fontSize")||e.hasOwnProperty("fontFamily");t.style.update(i);},r.addStyleManager(n),delete n.style,r}return n(s)}(Aa);Object.assign(za.prototype,ea); +!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).rexsimplelabel=e();}(undefined,(function(){function t(e){return t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},t(e)}function e(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){for(var i=0;it.length)&&(e=t.length);for(var i=0,n=new Array(e);i=0;i--)(e=this.children[i]).parentContainer||e.displayList||e.destroy(t);this.clear(!t),c(s(o.prototype),"destroy",this).call(this,t);}}},{key:"contains",value:function(t){return -1!==this.children.indexOf(t)}},{key:"add",value:function(t){var e=this;return b(this.children,t,0,(function(t){t.once("destroy",e.onChildDestroy,e);}),this),this}},{key:"remove",value:function(t,e){var i=this;return w(this.children,t,(function(t){t.off("destroy",i.onChildDestroy,i),e&&t.destroy();})),this}},{key:"onChildDestroy",value:function(t,e){this.remove(t,!1);}},{key:"clear",value:function(t){for(var e,i=0,n=this.children.length;i0;){var n=i.shift();!e(n)&&n.isRexContainerLite&&i.push.apply(i,v(n.children));}},it=Phaser.Utils.Array,nt={getChildren:function(t){if(t)for(var e=0,i=this.children.length;e=0;e--)this.remove(this.backgroundChildren[e],t);return this}},Xe=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},Ie=/(\S+)\[(\d+)\]/i,Ye=Phaser.Utils.Objects.GetValue,Be=function(t,e){return void 0===e?t:t[e]},Ne=function(e,i,n){void 0===e&&(e={}),void 0===i&&(i=0);var r=t(i);return "string"===r?e[i]=n:"number"===r?(e.left=i,e.right=i,e.top=i,e.bottom=i):(e.left=Ye(i,"left",0),e.right=Ye(i,"right",0),e.top=Ye(i,"top",0),e.bottom=Ye(i,"bottom",0)),e},He={getInnerPadding:function(t){return Be(this.space,t)},setInnerPadding:function(t,e){return Ne(this.space,t,e),this},getOuterPadding:function(t){return Be(this.getSizerConfig(this).padding,t)},setOuterPadding:function(t,e){return Ne(this.getSizerConfig(this).padding,t,e),this},getChildOuterPadding:function(t,e){return "string"==typeof t&&(t=this.getElement(t)),Be(this.getSizerConfig(t).padding,e)},setChildOuterPadding:function(t,e,i){return "string"==typeof t&&(t=this.getElement(t)),Ne(this.getSizerConfig(t).padding,e,i),this}},Ge=function(t){var e=this.childrenWidth,i=void 0!==this.minWidth?this.minWidth:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn("Layout width warn: ".concat(this.constructor.name,"'s minWidth (").concat(i,") < childrenWidth (").concat(e,")"))):this.layoutWarnEnable&&(i>t||e>t)&&console.warn("Layout width warn: ".concat(this.constructor.name,"'s minWidth (").concat(i,") or childrenWidth (").concat(e," > targetWidth ").concat(t,")")),t},Ue=function(t){var e=this.childrenHeight,i=void 0!==this.minHeight?this.minHeight:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn("Layout height warn: ".concat(this.constructor.name,"'s minHeight (").concat(i,") < childrenHeight (").concat(e,")"))):this.layoutWarnEnable&&(i>t||e>t)&&console.warn("Layout height warn: ".concat(this.constructor.name,"'s minHeight (").concat(i,") or childrenHeight (").concat(e,") > targetHeight (").concat(t,")")),t},Ve={getShownChildren:function(t){void 0===t&&(t=[]);for(var e,i=this.children,n=0,r=i.length;n0;){var i=e.shift();i.rexSizer&&i.rexSizer.hidden||(i!==this&&t.push(i),i.isRexContainerLite&&e.push.apply(e,v(i.children)));}return t}},Je=function(){this._childrenWidth=void 0,this._childrenHeight=void 0;for(var t,e=this.getChildrenSizers(),i=0,n=e.length;i0?-this.delay:0,this.state=this.nowTime>=0?gi:pi,this.repeatCounter=0,this}},{key:"stop",value:function(){return this.state=vi,this}},{key:"update",value:function(t,e){this.state!==vi&&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=yi)):(this.nowTime=this.duration,this.state=mi):this.nowTime>=0&&(this.state=gi));}},{key:"t",get:function(){var t;switch(this.state){case vi:case pi:case yi:t=0;break;case gi:t=this.nowTime/this.duration;break;case mi:t=1;}return di(t,0,1)},set:function(t){(t=di(t,-1,1))<0?(this.state=pi,this.nowTime=-this.delay*t):(this.state=gi,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++);}},{key:"setT",value:function(t){return this.t=t,this}},{key:"isIdle",get:function(){return this.state===vi}},{key:"isDelay",get:function(){return this.state===pi}},{key:"isCountDown",get:function(){return this.state===gi}},{key:"isRunning",get:function(){return this.state===pi||this.state===gi}},{key:"isDone",get:function(){return this.state===mi}},{key:"isOddIteration",get:function(){return 1==(1&this.repeatCounter)}},{key:"isEvenIteration",get:function(){return 0==(1&this.repeatCounter)}}]),t}(),vi=0,pi=1,gi=2,yi=3,mi=-1,ki=function(t){r(o,t);var i=l(o);function o(t,n){var r;return e(this,o),(r=i.call(this,t,n)).timer=new fi,r}return n(o,[{key:"shutdown",value:function(t){this.isShutdown||(c(s(o.prototype),"shutdown",this).call(this,t),this.timer.destroy(),this.timer=void 0);}},{key:"start",value:function(){return this.timer.start(),c(s(o.prototype),"start",this).call(this),this}},{key:"stop",value:function(){return this.timer.stop(),c(s(o.prototype),"stop",this).call(this),this}},{key:"complete",value:function(){return this.timer.stop(),c(s(o.prototype),"complete",this).call(this),this}}]),o}(li),bi=Phaser.Utils.Objects.GetValue,wi=Phaser.Utils.Objects.GetAdvancedValue,xi=Phaser.Tweens.Builders.GetEaseFunction,Si=function(t){r(o,t);var i=l(o);function o(){return e(this,o),i.apply(this,arguments)}return n(o,[{key:"resetFromJSON",value:function(t){return this.timer.resetFromJSON(bi(t,"timer")),this.setEnable(bi(t,"enable",!0)),this.setTarget(bi(t,"target",this.parent)),this.setDelay(wi(t,"delay",0)),this.setDuration(wi(t,"duration",1e3)),this.setEase(bi(t,"ease","Linear")),this.setRepeat(bi(t,"repeat",0)),this}},{key:"setEnable",value:function(t){return null==t&&(t=!0),this.enable=t,this}},{key:"setTarget",value:function(t){return void 0===t&&(t=this.parent),this.target=t,this}},{key:"setDelay",value:function(t){return this.delay=t,this}},{key:"setDuration",value:function(t){return this.duration=t,this}},{key:"setRepeat",value:function(t){return this.repeat=t,this}},{key:"setRepeatDelay",value:function(t){return this.repeatDelay=t,this}},{key:"setEase",value:function(t){return void 0===t&&(t="Linear"),this.ease=t,this.easeFn=xi(t),this}},{key:"start",value:function(){return this.timer.isRunning||c(s(o.prototype),"start",this).call(this),this}},{key:"restart",value:function(){return this.timer.stop(),this.start.apply(this,arguments),this}},{key:"stop",value:function(t){return void 0===t&&(t=!1),c(s(o.prototype),"stop",this).call(this),t&&(this.timer.setT(1),this.updateGameObject(this.target,this.timer),this.complete()),this}},{key:"update",value:function(t,e){if(!this.isRunning||!this.enable||!this.parent.active)return this;var i=this.target,n=this.timer;return n.update(t,e),n.isDelay||this.updateGameObject(i,n),this.emit("update",i,this),n.isDone&&this.complete(),this}},{key:"updateGameObject",value:function(t,e){}}]),o}(ki),Ci=Phaser.Utils.Objects.GetValue,_i=Phaser.Utils.Objects.GetAdvancedValue,Oi=Phaser.Math.Linear,Pi=function(t){r(o,t);var i=l(o);function o(t,n){var r;return e(this,o),(r=i.call(this,t,n)).scaleStart={},r.scaleEnd={},r.resetFromJSON(n),r.boot(),r}return n(o,[{key:"resetFromJSON",value:function(t){return c(s(o.prototype),"resetFromJSON",this).call(this,t),this.setMode(Ci(t,"mode",0)),this.setScaleRange(_i(t,"start",void 0),_i(t,"end",0)),this}},{key:"setMode",value:function(t){return "string"==typeof t&&(t=Ti[t]),this.mode=t,this}},{key:"setScaleRange",value:function(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}},{key:"start",value:function(){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),c(s(o.prototype),"start",this).call(this),this}},{key:"updateGameObject",value:function(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));}},{key:"complete",value:function(){return c(s(o.prototype),"complete",this).call(this),1===this.mode&&this.parent.destroy(),this}}]),o}(Si),Ti={stop:0,destroy:1,yoyo:2},Ei=function(t,e,i,n,r){var s,o;switch(void 0===n&&(n="Cubic"),i){case 0:case"x":s={x:0},o={x:t.scaleX};break;case 1:case"y":s={y:0},o={y:t.scaleY};break;default:s=0,o=t.scale;}var a={mode:0,start:s,end:o,duration:e,ease:n};return void 0===r?r=new Pi(t,a):r.resetFromJSON(a),r.restart(),r},Ri=function(t,e,i,n,r,s){void 0===n&&(n="Linear"),r instanceof Pi&&(s=r,r=void 0),void 0===r&&(r=!0);var o={};switch(o.mode=r?1:0,i){case 0:case"x":o.end={x:0};break;case 1:case"y":o.end={y:0};break;default:o.end=0;}return o.duration=e,o.ease=n,void 0===s?s=new Pi(t,o):s.resetFromJSON(o),s.restart(),s},Mi=function(t,e){return new Promise((function(i,n){t.once(e,(function(){i();}));}))},Li=function(t){return Mi(t,"complete")},Ai=Phaser.Utils.Objects.IsPlainObject,Di=function(t,e){e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0);})),e.on("update",(function(){var e=je.getParentSizer(t);e&&e.resetChildPositionState(t);}));},zi={popUp:function(t,e,i){if(Ai(t)){var n=t;t=n.duration,e=n.orientation,i=n.ease;}var r=void 0===this._scaleBehavior;return this._scaleBehavior=Ei(this,t,e,i,this._scaleBehavior),r&&Di(this,this._scaleBehavior),this._scaleBehavior.completeEventName="popup.complete",this},popUpPromise:function(t,e,i){return this.popUp(t,e,i),Li(this._scaleBehavior)},scaleDownDestroy:function(t,e,i,n){if(Ai(t)){var r=t;t=r.duration,e=r.orientation,i=r.ease,n=r.destroy;}var s=void 0===this._scaleBehavior;return this._scaleBehavior=Ri(this,t,e,i,n,this._scaleBehavior),s&&Di(this,this._scaleBehavior),this._scaleBehavior.completeEventName="scaledown.complete",this},scaleDownDestroyPromise:function(t,e,i,n){return this.scaleDownDestroy(t,e,i,n),Li(this._scaleBehavior)},scaleDown:function(t,e,i){return this.scaleDownDestroy(t,e,i,!1),this},scaleDownPromise:function(t,e,i){return this.scaleDown(t,e,i),Li(this._scaleBehavior)},scaleYoyo:function(t,e,i,n,r){if(Ai(t)){var s=t;t=s.duration,e=s.peakValue,i=s.repeat,n=s.orientation,r=s.ease;}var o=void 0===this._scaleBehavior;return this._scaleBehavior=function(t,e,i,n,r,s,o){var a,h;switch(void 0===i&&(i=1.2),void 0===n&&(n=0),void 0===s&&(s="Cubic"),r){case 0:case"x":a={x:t.scaleX},h={x:i};break;case 1:case"y":a={y:t.scaleX},h={y:i};break;default:a=t.scaleX,h=i;}var l={mode:2,start:a,end:h,duration:e/2,ease:s,repeat:n};return void 0===o?o=new Pi(t,l):o.resetFromJSON(l),o.restart(),o}(this,t,e,i,n,r,this._scaleBehavior),o&&Di(this,this._scaleBehavior),this._scaleBehavior.completeEventName="scaleyoyo.complete",this},scaleYoyoPromise:function(t,e,i,n,r){return this.scaleYoyo(t,e,i,n,r),Li(this._scaleBehavior)}},ji=Phaser.Utils.Objects.GetValue,Fi=Phaser.Utils.Objects.GetAdvancedValue,Wi=Phaser.Math.Linear,Xi=function(t){r(o,t);var i=l(o);function o(t,n){var r;return e(this,o),(r=i.call(this,t,n)).resetFromJSON(n),r.boot(),r}return n(o,[{key:"resetFromJSON",value:function(t){return c(s(o.prototype),"resetFromJSON",this).call(this,t),this.setMode(ji(t,"mode",0)),this.setAlphaRange(Fi(t,"start",this.parent.alpha),Fi(t,"end",0)),this}},{key:"setMode",value:function(t){return "string"==typeof t&&(t=Ii[t]),this.mode=t,this}},{key:"setAlphaRange",value:function(t,e){return this.alphaStart=t,this.alphaEnd=e,this}},{key:"start",value:function(){return this.timer.isRunning||(this.parent.setAlpha(this.alphaStart),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),c(s(o.prototype),"start",this).call(this)),this}},{key:"updateGameObject",value:function(t,e){var i=e.t;e.isOddIteration&&(i=1-i),t.alpha=Wi(this.alphaStart,this.alphaEnd,i);}},{key:"complete",value:function(){return c(s(o.prototype),"complete",this).call(this),1===this.mode&&this.parent.destroy(),this}}]),o}(Si),Ii={stop:0,destroy:1,yoyo:2},Yi=Phaser.Utils.Objects.IsPlainObject,Bi=function(t,e,i,n){var r,s;Yi(i)?(r=i.start,s=i.end):s=i,void 0===r&&(r=0),void 0===s&&(s=1);var o={mode:0,start:r,end:s,duration:e};return void 0===n?n=new Xi(t,o):n.resetFromJSON(o),n.restart(),n},Ni=function(t,e,i,n){i instanceof Xi&&(n=i,i=void 0),void 0===i&&(i=!0);var r={mode:i?1:0,end:0,duration:e};return void 0===n?n=new Xi(t,r):n.resetFromJSON(r),n.restart(),n},Hi=Phaser.Utils.Objects.IsPlainObject,Gi=function(t,e){e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0);})),e.on("update",(function(){var e=je.getParentSizer(t);e&&e.resetChildAlphaState(t);}));},Ui={fadeIn:function(t,e){if(Hi(t)){var i=t;t=i.duration,e=i.alpha;}var n=void 0===this._fade;return this._fade=Bi(this,t,e,this._fade),n&&Gi(this,this._fade),this._fade.completeEventName="fadein.complete",this},fadeInPromise:function(t,e){return this.fadeIn(t,e),Li(this._fade)},fadeOutDestroy:function(t,e){if(Hi(t)){var i=t;t=i.duration,e=i.destroy;}var n=void 0===this._fade;return this._fade=Ni(this,t,e,this._fade),n&&Gi(this,this._fade),this._fade.completeEventName="fadeout.complete",this},fadeOutDestroyPromise:function(t,e){return this.fadeOutDestroy(t,e),Li(this._fade)},fadeOut:function(t){return this.fadeOutDestroy(t,!1),this},fadeOutPromise:function(t){return this.fadeOut(t),Li(this._fade)}},Vi=Phaser.Utils.Objects.GetValue,Ji=Phaser.Utils.Objects.GetAdvancedValue,Ki=Phaser.Math.Linear,qi=function(t){r(o,t);var i=l(o);function o(t,n){var r;return e(this,o),(r=i.call(this,t,n)).resetFromJSON(n),r.boot(),r}return n(o,[{key:"resetFromJSON",value:function(t){if(c(s(o.prototype),"resetFromJSON",this).call(this,t),this.setMode(Vi(t,"mode",0)),t&&(t.hasOwnProperty("x")||t.hasOwnProperty("y"))){var e=Ji(t,"x",void 0),i=Ji(t,"y",void 0);this.setTargetPosition(e,i);}else this.setTargetPosition(t);return this}},{key:"setMode",value:function(t){return "string"==typeof t&&(t=Zi[t]),this.mode=t,this}},{key:"setTargetPosition",value:function(t,e){if("number"==typeof t||"number"==typeof e)this.startX=this.parent.x,this.startY=this.parent.y,this.endX=t,this.endY=e;else {var i=t;this.startX=Ji(i,"startX",void 0),this.startY=Ji(i,"startY",void 0),this.endX=Ji(i,"endX",void 0),this.endY=Ji(i,"endY",void 0);}return this.hasMoveX=void 0!==this.startX&&void 0!==this.endX,this.hasMoveY=void 0!==this.startY&&void 0!==this.endY,this}},{key:"start",value:function(){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),c(s(o.prototype),"start",this).call(this),this}},{key:"updateGameObject",value:function(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasMoveX&&(t.x=Ki(this.startX,this.endX,i)),this.hasMoveY&&(t.y=Ki(this.startY,this.endY,i));}},{key:"complete",value:function(){return c(s(o.prototype),"complete",this).call(this),1===this.mode&&this.parent.destroy(),this}}]),o}(Si),Zi={stop:0,destroy:1,yoyo:2},$i=function(t,e){if("number"==typeof t)return t;var i=t[0],n=parseFloat(t.substr(2));switch(i){case"+":return e+n;case"-":return e-n;case"*":return e*n;case"/":return e/n}},Qi=Phaser.Utils.Objects.IsPlainObject,tn=Phaser.Math.Distance.Between,en=function(t,e){e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0);})),e.on("update",(function(){var e=je.getParentSizer(t);e&&e.resetChildPositionState(t);}));},nn={moveFrom:function(t,e,i,n,r){if(Qi(t)){var s=t;e=s.x,i=s.y,t=s.hasOwnProperty("speed")?1e3*tn(e,i,this.x,this.y)/s.speed:s.duration,n=s.ease;}var o=void 0===this._easeMove;return this._easeMove=function(t,e,i,n,r,s,o){s instanceof qi&&(o=s,s=void 0),void 0===s&&(s=!1);var a={};return a.mode=s?1:0,void 0!==i&&(a.startX=$i(i,t.x),a.endX=t.x),void 0!==n&&(a.startY=$i(n,t.y),a.endY=t.y),a.duration=e,a.ease=void 0===r?"Linear":r,void 0===o?o=new qi(t,a):o.resetFromJSON(a),o.restart(),o}(this,t,e,i,n,r,this._easeMove),o&&en(this,this._easeMove),this._easeMove.completeEventName="movefrom.complete",this},moveFromPromise:function(t,e,i,n,r){return this.moveFrom(t,e,i,n,r),Li(this._easeMove)},moveFromDestroy:function(t,e,i,n){return this.moveFrom(t,e,i,n,!0),this},moveFromDestroyPromise:function(t,e,i,n){return this.moveFromDestroy(t,e,i,n),Li(this._easeMove)},moveTo:function(t,e,i,n,r){if(Qi(t)){var s=t;e=s.x,i=s.y,t=s.hasOwnProperty("speed")?1e3*tn(e,i,this.x,this.y)/s.speed:s.duration,n=s.ease;}var o=void 0===this._easeMove;return this._easeMove=function(t,e,i,n,r,s,o){s instanceof qi&&(o=s,s=void 0),void 0===s&&(s=!1);var a={};return a.mode=s?1:0,void 0!==i&&(a.startX=t.x,a.endX=$i(i,t.x)),void 0!==n&&(a.startY=t.y,a.endY=$i(n,t.y)),a.duration=e,a.ease=void 0===r?"Linear":r,void 0===o?o=new qi(t,a):o.resetFromJSON(a),o.restart(),o}(this,t,e,i,n,r,this._easeMove),o&&en(this,this._easeMove),this._easeMove.completeEventName="moveto.complete",this},moveToPromise:function(t,e,i,n,r){return this.moveTo(t,e,i,n,r),Li(this._easeMove)},moveToDestroy:function(t,e,i,n){return this.moveTo(t,e,i,n,!0),this},moveToDestroyPromise:function(t,e,i,n){return this.moveToDestroy(t,e,i,n,!0),Li(this._easeMove)},moveStop:function(t){return this._easeMove?(this._easeMove.stop(t),this):this}},rn=Phaser.Utils.Objects.GetValue,sn=function(t){r(o,t);var i=l(o);function o(t,n){var r;return e(this,o),(r=i.call(this,t,n)).timer=new fi,r.resetFromJSON(n),r.boot(),r}return n(o,[{key:"resetFromJSON",value:function(t){return this.timer.resetFromJSON(rn(t,"timer")),this.setEnable(rn(t,"enable",!0)),this.setMode(rn(t,"mode",1)),this.isRunning=rn(t,"isRunning",!1),this.setMagnitudeMode(rn(t,"magnitudeMode",1)),this.setAxisMode(rn(t,"axis",0)),this.setDuration(rn(t,"duration",500)),this.setMagnitude(rn(t,"magnitude",10)),this.ox=rn(t,"ox",void 0),this.oy=rn(t,"oy",void 0),this}},{key:"toJSON",value:function(){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}}},{key:"shutdown",value:function(t){this.isShutdown||(c(s(o.prototype),"shutdown",this).call(this,t),this.timer.destroy(),this.timer=void 0);}},{key:"startTicking",value:function(){c(s(o.prototype),"startTicking",this).call(this),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);}},{key:"stopTicking",value:function(){c(s(o.prototype),"stopTicking",this).call(this),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));}},{key:"setEnable",value:function(t){return null==t&&(t=!0),this.enable=t,this}},{key:"setMode",value:function(t){return "string"==typeof t&&(t=on[t]),this.mode=t,this}},{key:"setMagnitudeMode",value:function(t){return "string"==typeof t&&(t=hn[t]),this.magnitudeMode=t,this}},{key:"setAxisMode",value:function(t){return "string"==typeof t&&(t=an[t]),this.axisMode=t,this}},{key:"setDuration",value:function(t){return this.duration=t,this}},{key:"setMagnitude",value:function(t){return this.magnitude=t,this}},{key:"start",value:function(t,e){if("number"!=typeof t){var i=t;e=rn(i,"magnitude",void 0),t=rn(i,"duration",void 0);}return void 0!==e&&this.setMagnitude(e),void 0!==t&&this.setDuration(t),this.timer.setDuration(this.duration).start(),c(s(o.prototype),"start",this).call(this),this}},{key:"shake",value:function(t,e){return this.start(t,e),this}},{key:"update",value:function(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 n=this.magnitude;1===this.magnitudeMode&&(n*=1-this.timer.t);var r=Math.random()*Math.PI*2,s=this.ox+Math.cos(r)*n,o=this.oy+Math.sin(r)*n;switch(this.axisMode){case 1:i.x=s;break;case 2:i.y=o;break;default:i.x=s,i.y=o;}}return this}},{key:"backToOrigin",value:function(){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}}]),o}(oi),on={effect:0,behavior:1},an={both:0,"h&v":0,"x&y":0,horizontal:1,h:1,x:1,vertical:2,v:2,y:2},hn={constant:0,decay:1},ln=Phaser.Utils.Objects.IsPlainObject,un={shake:function(t,e,i){if(ln(t)){var n=t;t=n.duration,e=n.magnitude,i=n.magnitudeMode;}return void 0===this._shake&&(this._shake=new sn(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:function(t,e){return this.shake(t,e),Li(this._shake)}},cn=Phaser.Utils.Objects.GetValue,dn=Phaser.Math.Linear,fn=function(t){r(o,t);var i=l(o);function o(t,n){var r;return e(this,o),(r=i.call(this,t,n)).resetFromJSON(),r.boot(),r}return n(o,[{key:"start",value:function(t){if(this.timer.isRunning)return this;var e=this.target;this.propertyKey=cn(t,"key","value");var i=e[this.propertyKey];return this.fromValue=cn(t,"from",i),this.toValue=cn(t,"to",i),this.setEase(cn(t,"ease",this.ease)),this.setDuration(cn(t,"duration",this.duration)),this.setRepeat(cn(t,"repeat",0)),this.setDelay(cn(t,"delay",0)),this.setRepeatDelay(cn(t,"repeatDelay",0)),this.timer.setDuration(this.duration).setRepeat(this.repeat).setDelay(this.delay).setRepeatDelay(this.repeatDelay),e[this.propertyKey]=this.fromValue,c(s(o.prototype),"start",this).call(this),this}},{key:"updateGameObject",value:function(t,e){var i=e.t;i=this.easeFn(i),t[this.propertyKey]=dn(this.fromValue,this.toValue,i);}}]),o}(Si),vn=Phaser.Utils.Objects.IsPlainObject,pn=function(t){r(s,t);var i=l(s);function s(t,n){var r;return e(this,s),(r=i.call(this,t,n)).parent.setDataEnabled(),r.easeTasks={},r}return n(s,[{key:"complete",value:function(t){this.emit("complete-".concat(t),this.parent,this),this.emit("complete",t,this.parent,this);}},{key:"getEaseTask",value:function(t){var e=this.easeTasks[t];return void 0===e&&(e=new fn(this.parent),this.easeTasks[t]=e,e.setTarget(this.parent.data.values).on("complete",(function(){this.complete(t);}),this)),e}},{key:"easeTo",value:function(t,e,i,n){if(vn(t)){var r=t;t=r.key,e=r.value,i=r.duration,n=r.ease;var s=r.speed;void 0===i&&void 0!==s&&(i=Math.abs(e-this.parent.data.values[t])/s*1e3);}return void 0===i&&(i=1e3),void 0===n&&(n="Linear"),this.getEaseTask(t).restart({key:t,to:e,duration:i,ease:n}),this}},{key:"easeFrom",value:function(t,e,i,n){if(vn(t)){var r=t;t=r.key,e=r.value,i=r.duration,n=r.ease;var s=r.speed;void 0===i&&void 0!==s&&(i=Math.abs(e-this.parent.data.values[t])/s*1e3);}return void 0===i&&(i=1e3),void 0===n&&(n="Linear"),this.getEaseTask(t).restart({key:t,from:e,duration:i,ease:n}),this}},{key:"stopEase",value:function(t,e){void 0===e&&(e=!0);var i=this.easeTasks[t];return i&&i.stop(e),this}},{key:"stopAll",value:function(t){for(var e in void 0===t&&(t=!0),this.easeTasks)this.stopEase(e,t);return this}}]),s}(ni),gn={easeDataTo:function(t,e,i,n){return this._easeData||(this._easeData=new pn(this),function(t,e){e.on("complete",(function(e){t.emit("easedata.".concat(e,".complete"),t),t.emit("easedata.complete",e,t);}));}(this,this._easeData)),this._easeData.easeTo(t,e,i,n),this},easeDataToPromise:function(t,e,i,n){return this.easeDataTo(t,e,i,n),Mi(this._easeData,"complete-".concat(t))},stopEaseData:function(t,e){return this._easeData?(this._easeData.stopEase(t,e),this):this},stopAllEaseData:function(t){return this._easeData?(this._easeData.stopAll(t),this):this}},yn=function(t,e){if(t){Ut(t).hidden=e;var i=_(t);i?i.setChildVisible(t,!e):t.setVisible(!e);}},mn={show:function(t){return void 0===t&&(t=this),function(t){yn(t,!1);}(t),this},hide:function(t){return void 0===t&&(t=this),function(t){yn(t,!0);}(t),this},isShow:function(t){return void 0===t&&(t=this),function(t){return !!t&&!Ut(t).hidden}(t)}};function kn(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var bn={exports:{}};!function(t){var e=Object.prototype.hasOwnProperty,i="~";function n(){}function r(t,e,i){this.fn=t,this.context=e,this.once=i||!1;}function s(t,e,n,s,o){if("function"!=typeof n)throw new TypeError("The listener must be a function");var a=new r(n,s||t,o),h=i?i+e:e;return t._events[h]?t._events[h].fn?t._events[h]=[t._events[h],a]:t._events[h].push(a):(t._events[h]=a,t._eventsCount++),t}function o(t,e){0==--t._eventsCount?t._events=new n:delete t._events[e];}function a(){this._events=new n,this._eventsCount=0;}Object.create&&(n.prototype=Object.create(null),(new n).__proto__||(i=!1)),a.prototype.eventNames=function(){var t,n,r=[];if(0===this._eventsCount)return r;for(n in t=this._events)e.call(t,n)&&r.push(i?n.slice(1):n);return Object.getOwnPropertySymbols?r.concat(Object.getOwnPropertySymbols(t)):r},a.prototype.listeners=function(t){var e=i?i+t:t,n=this._events[e];if(!n)return [];if(n.fn)return [n.fn];for(var r=0,s=n.length,o=new Array(s);r0){var e=t.runTransitionInCallback();t.delayCall(e,this.next,this);}else this.next();}},{key:"exit_TRANS_OPNE",value:function(){this.parent.removeDelayCall();}},{key:"next_OPEN",value:function(){return "TRANS_CLOSE"}},{key:"enter_OPEN",value:function(){this.parent.onOpen();}},{key:"exit_OPEN",value:function(){this.parent.removeDelayCall();}},{key:"next_TRANS_CLOSE",value:function(){return "CLOSE"}},{key:"enter_TRANS_CLOSE",value:function(){var t=this.parent;if(t.transitOutTime>0){var e=t.runTransitionOutCallback();t.delayCall(e,this.next,this);}else this.next();}},{key:"exit_TRANS_CLOSE",value:function(){this.parent.removeDelayCall();}},{key:"next_CLOSE",value:function(){return "TRANS_OPNE"}},{key:"enter_CLOSE",value:function(){this.parent.onClose();}},{key:"exit_CLOSE",value:function(){}},{key:"canOpen",value:function(){return "IDLE"===this.state||"CLOSE"===this.state}},{key:"canClose",value:function(){return "IDLE"===this.state||"OPEN"===this.state}}]),s}(Tn),Rn={delayCall:function(t,e,i){return this.delayCallTimer=function(t,e,i,n,r){var s=$e(t);return s.time.delayedCall(e,(function(){s.game.events.once("poststep",(function(){i.call(n,r);}));}))}(this,t,e,i),this},removeDelayCall:function(){return this.delayCallTimer&&(this.delayCallTimer.remove(!1),this.delayCallTimer=void 0),this}},Mn={setTransitInTime:function(t){return this.transitInTime=t,this},setTransitOutTime:function(t){return this.transitOutTime=t,this},setTransitInCallback:function(t){return t||(t=Qt),this.transitInCallback=t,this},setTransitOutCallback:function(t){return t||(t=Qt),this.transitOutCallback=t,this}},Ln={runTransitionInCallback:function(){return this.transitInCallback(this.parent,this.transitInTime),this.transitInTime},onOpen:function(){},requestOpen:function(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}},An={runTransitionOutCallback:function(){return this.transitOutCallback(this.parent,this.transitOutTime),this.transitOutTime},onClose:function(){this.oneShotMode&&this.parent.destroy();},requestClose:function(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}},Dn={};Object.assign(Dn,Rn,Mn,Ln,An);var zn=Phaser.Utils.Objects.GetValue,jn=function(t){r(o,t);var i=l(o);function o(t,n){var r;return e(this,o),(r=i.call(this,t,n)).setTransitInTime(zn(n,"duration.in",200)),r.setTransitOutTime(zn(n,"duration.out",200)),r.setTransitInCallback(zn(n,"transitIn")),r.setTransitOutCallback(zn(n,"transitOut")),r.oneShotMode=zn(n,"destroy",!1),r.delayCallTimer=void 0,r._state=new En(a(r),{eventEmitter:!1,initState:zn(n,"initState","IDLE")}),r.openEventData=void 0,r.closeEventData=void 0,r}return n(o,[{key:"state",get:function(){return this._state.state}},{key:"shutdown",value:function(t){this.isShutdown||(this.transitInCallback=void 0,this.transitOutCallback=void 0,this.openEventData=void 0,this.closeEventData=void 0,this.removeDelayCall(),c(s(o.prototype),"shutdown",this).call(this,t));}}]),o}(ni);Object.assign(jn.prototype,Dn);var Fn=function(t){r(o,t);var i=l(o);function o(t,n,r){var s;return e(this,o),(s=i.call(this,t,0,0,2,2,n,1)).setAlpha(r),s.setScrollFactor(0),s.boot(),s}return n(o,[{key:"boot",value:function(){this.scene.sys.events.on("prerender",this.resize,this);}},{key:"destroy",value:function(t){this.scene&&!this.ignoreDestroy&&(this.scene.sys.events.off("prerender",this.resize,this),c(s(o.prototype),"destroy",this).call(this,t));}},{key:"tint",get:function(){return this.fillColor},set:function(t){this.setFillStyle(t,this.fillAlpha);}},{key:"resize",value:function(){var t=this.scene,e=t.sys.scale.gameSize,i=t.sys.cameras.main,n=e.width,r=e.height,s=1/i.zoom,o=n/2,a=r/2,h=n*s,l=r*s;this.x===o&&this.y===a||this.setPosition(o,a),this.width===h&&this.height===l||this.setSize(h,l).setOrigin(.5);}}]),o}(Phaser.GameObjects.Rectangle),Wn=Phaser.Utils.Objects.GetValue,Xn=function(t){r(s,t);var i=l(s);function s(t,n){var r;return e(this,s),(r=i.call(this,t,{eventEmitter:!1})).resetFromJSON(n),r.boot(),r}return n(s,[{key:"resetFromJSON",value:function(t){return this.setHitAreaMode(Wn(t,"hitAreaMode",0)),this.setEnable(Wn(t,"enable",!0)),this.setStopMode(Wn(t,"stopAllLevels",!0)),this}},{key:"boot",value:function(){this.parent.on("pointerdown",(function(t,e,i,n){this.stopAllLevels&&n.stopPropagation();}),this).on("pointerup",(function(t,e,i,n){this.stopAllLevels&&n.stopPropagation();}),this).on("pointermove",(function(t,e,i,n){this.stopAllLevels&&n.stopPropagation();}),this).on("pointerover",(function(t,e,i,n){this.stopAllLevels&&n.stopPropagation();}),this).on("pointerout",(function(t,e){this.stopAllLevels&&e.stopPropagation();}),this);}},{key:"setHitAreaMode",value:function(t){"string"==typeof t&&(t=In[t]);var e=this.parent;return e.input&&e.removeInteractive(),0===t?e.setInteractive():e.setInteractive({hitArea:{},hitAreaCallback:function(){return !0}}),this}},{key:"setEnable",value:function(t){return void 0===t&&(t=!0),t?this.parent.setInteractive():this.parent.disableInteractive(),this.enable=t,this}},{key:"setStopMode",value:function(t){return void 0===t&&(t=!0),this.stopAllLevels=t,this}},{key:"toggleEnable",value:function(){return this.setEnable(!this.enable),this}}]),s}(ni),In={default:0,fullWindow:1},Yn=Phaser.Utils.Objects.GetValue,Bn=function(t){r(s,t);var i=l(s);function s(t,n){var r;e(this,s);var o=Yn(n,"color",0),h=Yn(n,"alpha",.8);return (r=i.call(this,t,o,h)).touchEventStop=new Xn(a(r),{hitAreaMode:1}),r}return n(s)}(Fn),Nn=function(t,e){void 0!==t._modalScaleSave?(t.scaleX=t._modalScaleSave,t.scaleY=t._modalScaleSave):t._modalScaleSave=t.scaleX,Ei(t,e);},Hn=function(t,e){Ri(t,e,void 0,void 0,!1);},Gn=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Bi(t,e);},Un=function(t,e){Ni(t,e,!1);},Vn=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Bi(t,e,t.alpha);},Jn=function(t,e){Ni(t,e,!1);},Kn=function(t,e,i,n,r){return !!t&&(!(n&&!n(t,e,i))&&(!!bt(t,!0).contains(e,i)&&!(r&&!r(t,e,i))))},qn=Phaser.Utils.Objects.GetValue,Zn=function(t){r(o,t);var i=l(o);function o(t,n){var r;e(this,o),void 0===n&&(n={}),null==n.transitIn&&(n.transitIn=$n.popUp),null==n.transitOut&&(n.transitOut=$n.scaleDown),n.destroy=qn(n,"destroy",!0),r=i.call(this,t,n);var s=qn(n,"cover");r.cover=!1!==s?function(t,e){var i=t.scene,n=new Bn(i,e);return i.add.existing(n),t.isRexContainerLite?(t.pin(n,{syncPosition:!1,syncRotation:!1,syncScale:!1,syncAlpha:!1,syncScrollFactor:!1}),t.moveDepthBelow(n)):i.children.moveBelow(n,t),n}(t,s):void 0,r.cover&&(r.setCoverTransitInCallback(qn(s,"transitIn",Vn)),r.setCoverTransitOutCallback(qn(s,"transitOut",Jn)));var h=qn(n,"touchOutsideClose",!1),l=qn(n,"duration.hold",-1),u=qn(n,"timeOutClose",l>=0),c=qn(n,"anyTouchClose",!1);return qn(n,"manualClose",!1)&&(h=!1,c=!1,u=!1),c&&(h=!1),u?r.setDisplayTime(l):r.setDisplayTime(-1),c?r.once("open",r.anyTouchClose,a(r)):h&&r.once("open",r.touchOutsideClose,a(r)),qn(n,"openOnStart",!0)&&r.delayCall(0,r.requestOpen,a(r)),r}return n(o,[{key:"shutdown",value:function(t){this.isShutdown||(this.cover||this.scene.input.off("pointerup",this.touchCloseCallback,this),this.cover&&!t&&(this.cover.destroy(),this.cover=void 0),c(s(o.prototype),"shutdown",this).call(this,t));}},{key:"touchOutsideClose",value:function(){return this.cover?this.cover.on("pointerup",this.touchCloseCallback,this):this.scene.input.on("pointerup",this.touchCloseCallback,this),this.clickOutsideTest=!0,this}},{key:"anyTouchClose",value:function(){return this.cover?this.cover.once("pointerup",this.touchCloseCallback,this):this.scene.input.once("pointerup",this.touchCloseCallback,this),this}},{key:"touchCloseCallback",value:function(t){this.clickOutsideTest&&Kn(this.parent,t.worldX,t.worldY)||this.requestClose();}},{key:"runTransitionInCallback",value:function(){var t=c(s(o.prototype),"runTransitionInCallback",this).call(this),e=this.cover;return e&&this.coverTransitInCallback&&this.coverTransitInCallback(e,t),t}},{key:"runTransitionOutCallback",value:function(){var t=c(s(o.prototype),"runTransitionOutCallback",this).call(this),e=this.cover;return e&&this.coverTransitOutCallback&&this.coverTransitOutCallback(e,t),t}},{key:"onOpen",value:function(){var t=this.displayTime;t>=0&&this.delayCall(t,this.requestClose,this),this.emit("open",this.parent,this),c(s(o.prototype),"onOpen",this).call(this);}},{key:"onClose",value:function(){this.emit("close",this.closeEventData),c(s(o.prototype),"onClose",this).call(this);}},{key:"setDisplayTime",value:function(t){return this.displayTime=t,this}},{key:"setTransitInCallback",value:function(t){switch("string"==typeof t&&(t=$n[t]),t){case $n.popUp:t=Nn;break;case $n.fadeIn:t=Gn;}return c(s(o.prototype),"setTransitInCallback",this).call(this,t),this}},{key:"setTransitOutCallback",value:function(t){switch("string"==typeof t&&(t=$n[t]),t){case $n.scaleDown:t=Hn;break;case $n.fadeOut:t=Un;}return c(s(o.prototype),"setTransitOutCallback",this).call(this,t),this}},{key:"setCoverTransitInCallback",value:function(t){return this.coverTransitInCallback=t,this}},{key:"setCoverTransitOutCallback",value:function(t){return this.coverTransitOutCallback=t,this}}]),o}(jn),$n={popUp:0,fadeIn:1,scaleDown:0,fadeOut:1},Qn=function(t){return t&&"function"==typeof t},tr={modal:function(t,e){return Qn(t)&&(e=t,t=void 0),void 0===this._modalBehavior&&(this.onCreateModalBehavior&&this.onCreateModalBehavior(this,t),this._modalBehavior=function(t,e){var i=new Zn(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:function(t){var e=this;return new Promise((function(i,n){e.modal(t,i);}))},modalClose:function(t){return function(t,e){t.emit("modal.requestClose",e);}(this,t),this}},er=function(t,e,i,n){if(e)return Kn(t,e.worldX,e.worldY,i,n);for(var r=t.scene.input.manager,s=r.pointersTotal,o=r.pointers,a=0;a=this.dragThreshold&&this.cancel();}},{key:"click",value:function(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 n=this.lastClickTime;return void 0!==n&&t-n<=this.clickInterval||(this.lastClickTime=t,this.emit("click",this,this.parent,e,i)),this}},{key:"cancel",value:function(){return this.pointer=void 0,this}},{key:"onOver",value:function(t,e,i,n){return this.enable?(this.emit("over",this,this.parent,t,n),this):this}},{key:"onOut",value:function(t,e){return this.enable?(this.emit("out",this,this.parent,t,e),this):this}}]),o}(ni),pr={press:0,pointerdown:0,release:1,pointerup:1},gr={onClick:function(t,e,i,n){return t?("function"==typeof t&&(n=i,i=e,e=t,t=this),void 0===t._click&&(t._click=new vr(t,n)),t._click.on("click",e,i),this):this},offClick:function(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:function(e,i){return e&&"object"!==t(e)&&(i=e,e=this),void 0===e._click||e._click.setEnable(i),this},disableClick:function(e){return e&&"object"!==t(e)&&(e=this),void 0===e._click||e._click.setEnable(!1),this}},yr=function(t,e,i,n){if(e)return !(i&&!i(t,e))&&(!!mr(t,e)&&!(n&&!n(t,e)));for(var r=t.scene.input.manager,s=r.pointersTotal,o=r.pointers,a=0;a0)return kr.length=0,!0;return kr.length=0,!1},kr=[],br=Phaser.Utils.Objects.GetValue,wr=function(t){r(o,t);var i=l(o);function o(t,n){var r;e(this,o),(r=i.call(this,t,n))._enable=void 0;var s=br(n,"inputConfig",void 0);return s&&t.setInteractive(s),r.resetFromJSON(n),r.boot(),r}return n(o,[{key:"resetFromJSON",value:function(t){return this.pointer=void 0,this.lastClickTime=void 0,this.setEnable(br(t,"enable",!0)),this.setMode(br(t,"mode",1)),this.setClickInterval(br(t,"clickInterval",100)),this.setDragThreshold(br(t,"threshold",void 0)),this}},{key:"boot",value:function(){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);}},{key:"shutdown",value:function(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,c(s(o.prototype),"shutdown",this).call(this,t);}}},{key:"enable",get:function(){return this._enable},set:function(t){if(this._enable!==t){t||this.cancel(),this._enable=t;var e=t?"enable":"disable";this.emit(e,this,this.parent);}}},{key:"setEnable",value:function(t){return void 0===t&&(t=!0),this.enable=t,this}},{key:"toggleEnable",value:function(){return this.setEnable(!this.enable),this}},{key:"setMode",value:function(t){return "string"==typeof t&&(t=xr[t]),this.mode=t,this}},{key:"setClickInterval",value:function(t){return this.clickInterval=t,this}},{key:"setDragThreshold",value:function(t){return this.dragThreshold=t,this}},{key:"isPointerInside",value:function(t){var e=this.parent;return (e.input?yr:er)(e,t)}},{key:"onPress",value:function(t){this.parent.willRender(t.camera)&&void 0===this.pointer&&(this.pointer=t,0===this.mode&&(this.isPointerInside(t)||this.click(t.downTime,t)));}},{key:"onRelease",value:function(t){this.parent.willRender(t.camera)&&this.pointer===t&&(1===this.mode&&(this.isPointerInside(t)||this.click(t.upTime,t)),this.pointer=void 0);}},{key:"onMove",value:function(t,e,i,n){this.pointer===t&&void 0!==this.dragThreshold&&1===this.mode&&(t.getDistance()>=this.dragThreshold||this.isPointerInside(t))&&this.cancel();}},{key:"click",value:function(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}},{key:"cancel",value:function(){return this.pointer=void 0,this}}]),o}(ni),xr={press:0,pointerdown:0,release:1,pointerup:1},Sr={onClickOutside:function(t,e,i,n){return t?("function"==typeof t&&(n=i,i=e,e=t,t=this),void 0===t._clickOutside&&(t._clickOutside=new wr(t,n)),t._clickOutside.on("clickoutside",e,i),this):this},offClickOutside:function(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:function(e,i){return e&&"object"!==t(e)&&(i=e,e=this),void 0===e._clickOutside||e._clickOutside.setEnable(i),this},disableClickOutside:function(e){return e&&"object"!==t(e)&&(e=this),void 0===e._clickOutside||e._clickOutside.setEnable(!1),this}},Cr=function(t){r(s,t);var i=l(s);function s(){var t;return e(this,s),(t=i.call(this,{eventEmitter:!1})).goto("IDLE"),t}return n(s,[{key:"setCooldownTime",value:function(t){return this.cooldownTime=t,this.cooldownMode=void 0!==t,this}},{key:"request",value:function(){return this.runMethod("request")}},{key:"update_IDLE",value:function(){this.compensationTime=0;}},{key:"request_IDLE",value:function(){return this.next(),!0}},{key:"next_IDLE",value:function(){if(this.cooldownMode)return "COOLDOWN"}},{key:"enter_COOLDOWN",value:function(){this.remainderTime=this.cooldownTime+this.compensationTime;}},{key:"update_COOLDOWN",value:function(t,e){this.remainderTime-=e,this.remainderTime<0&&(this.compensationTime=this.cooldownTime>e?-this.remainderTime:0,this.goto("IDLE"));}},{key:"request_COOLDOWN",value:function(){return !1}}]),s}(Tn),_r=Phaser.Utils.Objects.GetValue,Or=function(t){r(o,t);var i=l(o);function o(t,n){var r;return e(this,o),(r=i.call(this,t,n))._enable=void 0,r.cooldown=new Cr,r.parent.setInteractive(_r(n,"inputConfig",void 0)),r.resetFromJSON(n),r.boot(),r}return n(o,[{key:"resetFromJSON",value:function(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}},{key:"boot",value:function(){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);}},{key:"shutdown",value:function(t){this.isShutdown||(this.scene.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,c(s(o.prototype),"shutdown",this).call(this,t));}},{key:"enable",get:function(){return this._enable},set:function(t){if(this._enable!==t)return t||(this.prevIsInTouch=!1,this.isInTouching=!1,this.pointer=void 0),this._enable=t,this}},{key:"setEnable",value:function(t){return void 0===t&&(t=!0),this.enable=t,this}},{key:"cooldownTime",get:function(){return this.cooldown.cooldownTime},set:function(t){this.cooldown.setCooldownTime(t);}},{key:"setCooldown",value:function(t){return this.cooldownTime=t,this}},{key:"toggleEnable",value:function(){return this.setEnable(!this.enable),this}},{key:"onPointIn",value:function(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.pointer=t,this.isInTouching=!0);}},{key:"onPointOut",value:function(t){this.enable&&this.pointer===t&&(this.pointer=void 0,this.isInTouching=!1);}},{key:"preupdate",value:function(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;}}]),o}(ni),Pr={isPointerInBounds:function(t){return void 0===t?t=this:"string"==typeof t&&(t=this.getElement(t)),!!t&&er(t)},onTouching:function(t,e,i,n){return t?("function"==typeof t&&(n=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new Or(t,n)),t._inTouching.on("intouch",e,i),this):this},offTouching:function(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:function(t,e,i,n){return t?("function"==typeof t&&(n=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new Or(t,n)),t._inTouching.on("touchend",e,i),this):this},offTouchingEnd:function(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:function(e,i){return e&&"object"!==t(e)&&(i=e,e=this),void 0===e._inTouching||e._inTouching.setEnable(i),this},disableTouching:function(e){return e&&"object"!==t(e)&&(e=this),void 0===e._inTouching||e._inTouching.setEnable(!1),this}},Tr=function(t,e,i){for(var n,r=0,s=t.length;r0),this.onDragStart()));}},{key:"onPointerUp",value:function(t){this.enable&&((!this.bounds||this.bounds.contains(t.x,t.y))&&this.pointer===t&&(this.pointer=void 0,this.movedState=!1,this.tracerState=Hr,this.onDragEnd()));}},{key:"onPointerMove",value:function(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()));}}},{key:"dragCancel",value:function(){return this.tracerState===Gr&&this.onDragEnd(),this.pointer=void 0,this.tracerState=Hr,this}},{key:"onDragStart",value:function(){this.emit("dragstart",this);}},{key:"onDragEnd",value:function(){this.emit("dragend",this);}},{key:"onDrag",value:function(){this.emit("drag",this);}},{key:"preUpdate",value:function(t,e){}},{key:"postUpdate",value:function(t,e){}},{key:"startTicking",value:function(){c(s(o.prototype),"startTicking",this).call(this),this.scene.sys.events.on("preupdate",this.preUpdate,this),this.scene.sys.events.on("postupdate",this.postUpdate,this);}},{key:"stopTicking",value:function(){c(s(o.prototype),"stopTicking",this).call(this),this.scene&&(this.scene.sys.events.off("preupdate",this.preUpdate,this),this.scene.sys.events.off("postupdate",this.postUpdate,this));}},{key:"setRecongizedStateObject",value:function(t){return this.recongizedState=t,this}},{key:"state",get:function(){return this.recongizedState.state},set:function(t){this.recongizedState.state=t;}},{key:"cancel",value:function(){return this.state=Ur,this}}]),o}(oi),Hr=0,Gr=1,Ur="IDLE",Vr=Phaser.Utils.Objects.GetValue,Jr=Phaser.Math.Distance.Between,Kr=function(t){r(o,t);var i=l(o);function o(t,n){var r;e(this,o);var s=a(r=i.call(this,t,n)),h={states:{IDLE:{enter:function(){s.stop(),s.tapsCount=0,s.x=0,s.y=0,s.worldX=0,s.worldY=0;},exit:function(){var t=s.lastPointer;s.x=t.x,s.y=t.y,s.worldX=t.worldX,s.worldY=t.worldY;}},BEGIN:{enter:function(){s.start(),s.tapsCount=0,s.emit("tappingstart",s,s.gameObject,s.lastPointer);}},RECOGNIZED:{enter:function(){s.start(),s.emit("tap",s,s.gameObject,s.lastPointer),s.emit("".concat(s.tapsCount,"tap"),s,s.gameObject,s.lastPointer);}}},init:function(){this.state=qr;},eventEmitter:!1};return r.setRecongizedStateObject(new Tn(h)),r}return n(o,[{key:"resetFromJSON",value:function(t){c(s(o.prototype),"resetFromJSON",this).call(this,t),this.setHoldTime(Vr(t,"time",250)),this.setTapInterval(Vr(t,"tapInterval",200)),this.setDragThreshold(Vr(t,"threshold",9)),this.setTapOffset(Vr(t,"tapOffset",10));var e=Vr(t,"taps",void 0);return void 0!==e?this.setTaps(e):(this.setMaxTaps(Vr(t,"maxTaps",void 0)),this.setMinTaps(Vr(t,"minTaps",void 0))),this}},{key:"onDragStart",value:function(){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=$r,this.state=Zr);break;case $r:this.state=Zr;}}},{key:"onDragEnd",value:function(){this.state===Zr&&(this.tapsCount++,this.emit("tapping",this,this.gameObject,this.lastPointer),void 0!==this.maxTaps&&this.tapsCount===this.maxTaps&&(this.state=$r));}},{key:"onDrag",value:function(){this.state!==qr&&this.pointer.getDistance()>this.dragThreshold&&(this.state=qr);}},{key:"preUpdate",value:function(t,e){if(this.isRunning&&this.enable&&this.state===Zr){var i=this.lastPointer;if(i.isDown)t-i.downTime>this.holdTime&&(this.state=qr);else t-i.upTime>this.tapInterval&&(void 0===this.minTaps||this.tapsCount>=this.minTaps?this.state=$r:this.state=qr);}}},{key:"postUpdate",value:function(t,e){this.isRunning&&this.enable&&this.state===$r&&(this.state=qr);}},{key:"isTapped",get:function(){return this.state===$r}},{key:"setHoldTime",value:function(t){return this.holdTime=t,this}},{key:"setTapInterval",value:function(t){return this.tapInterval=t,this}},{key:"setDragThreshold",value:function(t){return this.dragThreshold=t,this}},{key:"setTapOffset",value:function(t){return this.tapOffset=t,this}},{key:"setMaxTaps",value:function(t){return this.maxTaps=t,this}},{key:"setMinTaps",value:function(t){return this.minTaps=t,this}},{key:"setTaps",value:function(t,e){return void 0===e&&(e=t),this.setMinTaps(t).setMaxTaps(e),this}}]),o}(Nr),qr="IDLE",Zr="BEGIN",$r="RECOGNIZED",Qr=Phaser.Utils.Objects.GetValue,ts=function(t){r(o,t);var i=l(o);function o(t,n){var r;e(this,o);var s=a(r=i.call(this,t,n)),h={states:{IDLE:{enter:function(){s.x=0,s.y=0,s.worldX=0,s.worldY=0;},exit:function(){var t=s.lastPointer;s.x=t.x,s.y=t.y,s.worldX=t.worldX,s.worldY=t.worldY;}},BEGIN:{enter:function(){s.start();},exit:function(){s.stop();}},RECOGNIZED:{enter:function(){s.emit("pressstart",s,s.gameObject,s.lastPointer);},exit:function(){s.emit("pressend",s,s.gameObject,s.lastPointer);}}},init:function(){this.state=es;},eventEmitter:!1};return r.setRecongizedStateObject(new Tn(h)),r}return n(o,[{key:"resetFromJSON",value:function(t){return c(s(o.prototype),"resetFromJSON",this).call(this,t),this.setDragThreshold(Qr(t,"threshold",9)),this.setHoldTime(Qr(t,"time",251)),this}},{key:"onDragStart",value:function(){this.state=is,0===this.holdTime&&(this.state=ns);}},{key:"onDragEnd",value:function(){this.state=es;}},{key:"onDrag",value:function(){this.state!==es&&this.pointer.getDistance()>this.dragThreshold&&(this.state=es);}},{key:"preUpdate",value:function(t,e){this.isRunning&&this.enable&&(this.state===is&&t-this.pointer.downTime>=this.holdTime&&(this.state=ns));}},{key:"isPressed",get:function(){return this.state===ns}},{key:"setHoldTime",value:function(t){return this.holdTime=t,this}},{key:"setDragThreshold",value:function(t){return this.dragThreshold=t,this}}]),o}(Nr),es="IDLE",is="BEGIN",ns="RECOGNIZED";Phaser.Utils.Objects.GetValue;var rs=Phaser.Math.Distance.Between,ss=Phaser.Math.Angle.Between,os={getDt:function(){var t;return t=this.scene,ei(t).loop.delta},getVelocity:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return rs(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 ss(e.x,e.y,t.x,t.y)}},as={"up&down":0,"left&right":1,"4dir":2,"8dir":3},hs={},ls=Phaser.Utils.Objects.GetValue,us=Phaser.Math.RadToDeg,cs=function(t){r(o,t);var i=l(o);function o(t,n){var r;e(this,o);var s=a(r=i.call(this,t,n)),h={states:{IDLE:{enter:function(){s.x=0,s.y=0,s.worldX=0,s.worldY=0;},exit:function(){var t=s.lastPointer;s.x=t.x,s.y=t.y,s.worldX=t.worldX,s.worldY=t.worldY;}},BEGIN:{enter:function(){s.validDrag=!1;}},RECOGNIZED:{enter:function(){s.start(),s.updateDirectionStates(),s.emit("swipe",s,s.gameObject,s.lastPointer);},exit:function(){s.stop(),s.clearDirectionStates();}}},init:function(){this.state=ds;},eventEmitter:!1};return r.setRecongizedStateObject(new Tn(h)),r.clearDirectionStates(),r}return n(o,[{key:"resetFromJSON",value:function(t){return c(s(o.prototype),"resetFromJSON",this).call(this,t),this.setDragThreshold(ls(t,"threshold",10)),this.setVelocityThreshold(ls(t,"velocityThreshold",1e3)),this.setDirectionMode(ls(t,"dir","8dir")),this}},{key:"onDragStart",value:function(){this.state=fs;}},{key:"onDragEnd",value:function(){this.state=ds;}},{key:"onDrag",value:function(){this.state===fs&&(this.validDrag||(this.validDrag=0===this.dragThreshold||this.pointer.getDistance()>=this.dragThreshold),this.validDrag&&this.dragVelocity>this.velocityThreshold&&(this.state=vs));}},{key:"postUpdate",value:function(t,e){this.isRunning&&this.enable&&this.state===vs&&(this.state=ds);}},{key:"isSwiped",get:function(){return this.state===vs}},{key:"dragVelocity",get:function(){var t;switch(this.dirMode){case 0:t=this.getVelocityY();break;case 1:t=this.getVelocityX();break;default:t=this.getVelocity();}return t}},{key:"setDragThreshold",value:function(t){return this.dragThreshold=t,this}},{key:"setVelocityThreshold",value:function(t){return this.velocityThreshold=t,this}},{key:"setDirectionMode",value:function(t){return "string"==typeof t&&(t=as[t]),this.dirMode=t,this}},{key:"updateDirectionStates",value:function(){return function(t,e,i){switch(void 0===i?i={}:!0===i&&(i=hs),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;}}(us(this.getVelocityAngle()),this.dirMode,this),this}},{key:"clearDirectionStates",value:function(){return this.left=!1,this.right=!1,this.up=!1,this.down=!1,this}}]),o}(Nr);Object.assign(cs.prototype,os);var ds="IDLE",fs="BEGIN",vs="RECOGNIZED",ps=Phaser.Utils.Objects.GetValue,gs=Phaser.Utils.Array.SpliceOne,ys=Phaser.Math.Distance.Between,ms=Phaser.Math.Angle.Between,ks=function(){function t(i,n){e(this,t);var r=i.input.manager.pointersTotal-1;r<2&&i.input.addPointer(2-r),this.scene=i,this.setEventEmitter(ps(n,"eventEmitter",void 0)),this._enable=void 0,this.pointers=[],this.movedState={},this.resetFromJSON(n),this.boot();}return n(t,[{key:"resetFromJSON",value:function(t){return this.setEnable(ps(t,"enable",!0)),this.bounds=ps(t,"bounds",void 0),this.tracerState=ws,this.pointers.length=0,Rt(this.movedState),this}},{key:"boot",value:function(){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);}},{key:"shutdown",value:function(){this.scene&&(this.destroyEventEmitter(),this.pointers.length=0,Rt(this.movedState),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);}},{key:"destroy",value:function(){this.shutdown();}},{key:"enable",get:function(){return this._enable},set:function(t){if(this._enable!==t)return t||this.dragCancel(),this._enable=t,this}},{key:"setEnable",value:function(t){return void 0===t&&(t=!0),this.enable=t,this}},{key:"toggleEnable",value:function(){return this.setEnable(!this.enable),this}},{key:"onPointerDown",value:function(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.tracerState){case ws:this.tracerState=xs,this.onDrag1Start();break;case xs:this.tracerState=Ss,this.onDrag2Start();}}},{key:"onPointerUp",value:function(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],gs(this.pointers,e),this.tracerState){case xs:this.tracerState=ws,this.onDrag1End();break;case Ss:this.tracerState=xs,this.onDrag2End(),this.onDrag1Start();}}}},{key:"onPointerMove",value:function(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 xs:this.onDrag1();break;case Ss:this.onDrag2();}}}},{key:"dragCancel",value:function(){return this.tracerState===Ss&&this.onDrag2End(),this.pointers.length=0,Rt(this.movedState),this.tracerState=ws,this}},{key:"onDrag1Start",value:function(){this.emit("drag1start",this);}},{key:"onDrag1End",value:function(){this.emit("drag1end",this);}},{key:"onDrag1",value:function(){this.emit("drag1",this);}},{key:"onDrag2Start",value:function(){this.emit("drag2start",this);}},{key:"onDrag2End",value:function(){this.emit("drag2end",this);}},{key:"onDrag2",value:function(){this.emit("drag2",this);}},{key:"distanceBetween",get:function(){if(this.tracerState!==Ss)return 0;var t=this.pointers[0],e=this.pointers[1];return ys(t.x,t.y,e.x,e.y)}},{key:"angleBetween",get:function(){if(this.tracerState!==Ss)return 0;var t=this.pointers[0],e=this.pointers[1];return ms(t.x,t.y,e.x,e.y)}},{key:"drag1Vector",get:function(){var t=this.pointers[0];if(t&&this.movedState[t.id]){var e=t.position,i=t.prevPosition;bs.x=e.x-i.x,bs.y=e.y-i.y;}else bs.x=0,bs.y=0;return bs}},{key:"centerX",get:function(){if(this.tracerState!==Ss)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return (t.x+e.x)/2}},{key:"centerY",get:function(){if(this.tracerState!==Ss)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return (t.y+e.y)/2}},{key:"prevCenterX",get:function(){if(this.tracerState!==Ss)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}},{key:"prevCenterY",get:function(){if(this.tracerState!==Ss)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}},{key:"movementCenterX",get:function(){return this.centerX-this.prevCenterX}},{key:"movementCenterY",get:function(){return this.centerY-this.prevCenterY}},{key:"setRecongizedStateObject",value:function(t){return this.recongizedState=t,this}},{key:"state",get:function(){return this.recongizedState.state},set:function(t){this.recongizedState.state=t;}},{key:"cancel",value:function(){return this.state=Cs,this}}]),t}();Object.assign(ks.prototype,Ke);var bs={},ws=0,xs=1,Ss=2,Cs="IDLE";Phaser.Utils.Objects.GetValue;var _s=Phaser.Math.RotateAround,Os=function(t,e,i,n){return _s(t,e,i,n),t.rotation+=n,t},Ps={},Ts=Phaser.Utils.Objects.GetValue,Es=Phaser.Math.Angle.WrapDegrees,Rs=Phaser.Math.Angle.ShortestBetween,Ms=Phaser.Math.RadToDeg,Ls=Phaser.Math.DegToRad,As=function(t){r(o,t);var i=l(o);function o(t,n){var r;e(this,o);var s=a(r=i.call(this,t,n)),h={states:{IDLE:{enter:function(){s.prevAngle=void 0,s.angle=0;}},BEGIN:{},RECOGNIZED:{enter:function(){s.emit("rotatestart",s);},exit:function(){s.emit("rotateend",s);}}},init:function(){this.state=zs;},eventEmitter:!1};return r.setRecongizedStateObject(new Tn(h)),r}return n(o,[{key:"resetFromJSON",value:function(t){return c(s(o.prototype),"resetFromJSON",this).call(this,t),this.setDragThreshold(Ts(t,"threshold",0)),this}},{key:"onDrag2Start",value:function(){this.prevAngle=Es(Ms(this.angleBetween)),this.state=js,0===this.dragThreshold&&(this.state=Fs);}},{key:"onDrag2End",value:function(){this.state=zs;}},{key:"onDrag2",value:function(){switch(this.state){case js:if(this.pointers[0].getDistance()>=this.dragThreshold&&this.pointers[1].getDistance()>=this.dragThreshold){var t=Es(Ms(this.angleBetween));this.angle=Rs(this.prevAngle,t),this.prevAngle=t,this.state=Fs;}break;case Fs:t=Es(Ms(this.angleBetween));this.angle=Rs(this.prevAngle,t),this.prevAngle=t,this.emit("rotate",this);}}},{key:"isRotated",get:function(){return this.state===Fs}},{key:"rotation",get:function(){return Ls(this.angle)}},{key:"setDragThreshold",value:function(t){return this.dragThreshold=t,this}}]),o}(ks),Ds={spinObject:function(t,e){if(!this.isRotation)return this;void 0===e&&(e=this.pointers[0].camera);var i=this.movementCenterX,n=this.movementCenterY,r=function(t,e,i,n){return void 0===n?n={}:!0===n&&(n=Ps),i.getWorldPoint(t,e,n),n}(this.centerX,this.centerY,e,!0),s=r.x,o=r.y,a=this.rotation;if(Array.isArray(t))for(var h=t,l=0,u=h.length;l=this.sizerChildren.length?this.sizerChildren.push(e):this.sizerChildren.splice(a,0,e),e.isRexSizer||(i>0&&(0===this.orientation?e.minWidth=void 0===h?pt(e):h:e.minHeight=void 0===l?gt(e):l),s&&(0===this.orientation?e.minHeight=l:e.minWidth=h)),void 0!==o&&this.addChildrenMap(o,e),this},ro={add:no,addSpace:function(t){return this.insertSpace(void 0,t),this},insertSpace:function(t,e){return void 0===e&&(e=1),no.call(this,new Zs(this.scene),{proportion:e,minWidth:0,minHeight:0,index:t}),this},insert:function(t,e,i,n,r,s,o,a){return Qs(i)&&(i.index=t),no.call(this,e,i,n,r,s,o,t,a),this},insertAtPosition:function(t,e,i,n,r,s,o,a,h){var l=$s.call(this,t,e);return -1===l&&(l=void 0),this.insert(l,i,n,r,s,o,a,h),this}},so=Gt.prototype.clear,oo=function(t){this.backgroundChildren&&(this.backgroundChildren.length=0);var e,i=!t&&this.sizerEventsEnable;if(i&&(e=this.getChildren([])),so.call(this,t),i)for(var n,r=0,s=e.length;r=0;e--)this.remove(this.sizerChildren[e],t);return this},clear:function(t){return this.sizerChildren.length=0,oo.call(this,t),this}},lo={getChildAlign:function(t){return this.getSizerConfig(t).align},setChildAlign:function(t,e){return "string"==typeof e&&(e=$t[e]),this.getSizerConfig(t).align=e,this}},uo={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,n,r=0,s=this.sizerChildren;if(0===this.orientation)for(var o=this.space.item,a=!0,h=0,l=s.length;h0&&this.proportionLength>0&&(i=n.proportion*this.proportionLength):n.expand&&(i=e-this.space.left-this.space.right-r.left-r.right);return i},getExpandedChildHeight:function(t,e){var i;void 0===e&&(e=this.height);var n=t.rexSizer,r=n.padding;0===this.orientation?n.expand&&(i=e-this.space.top-this.space.bottom-r.top-r.bottom):n.proportion>0&&this.proportionLength>0&&(i=n.proportion*this.proportionLength);return i},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,n=0,r=i.length;n0?(e=t-this.getChildrenWidth(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0;}return t},resolveHeight:function(t){t=Ue.call(this,t);if(void 0===this.proportionLength&&1===this.orientation){var e=t-this.childrenHeight;e>0?(e=t-this.getChildrenHeight(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0;}return t}};Object.assign(uo,ro,ho,lo,{getChildProportion:function(t){return this.getSizerConfig(t).proportion},setChildProportion:function(t,e){return this.getSizerConfig(t).proportion=e,this}},{getChildExpand:function(t){return this.getSizerConfig(t).expand},setChildExpand:function(t,e){return this.getSizerConfig(t).expand=e,this}});var co=function(){for(var t,e,i=0,n=this.sizerChildren,r=0,s=n.length;r0&&(i+=e);return i},fo={x:0,h:0,horizontal:0,"left-to-right":0,y:1,v:1,vertical:1,"top-to-bottom":1},vo=Phaser.Utils.Objects.IsPlainObject,po=Phaser.Utils.Objects.GetValue,go=function(t){r(s,t);var i=l(s);function s(t,n,r,o,a,h,l){var u;return e(this,s),vo(n)?(n=po(l=n,"x",0),r=po(l,"y",0),o=po(l,"width",void 0),a=po(l,"height",void 0),h=po(l,"orientation",0)):vo(o)?(o=po(l=o,"width",void 0),a=po(l,"height",void 0),h=po(l,"orientation",0)):vo(h)&&(h=po(l=h,"orientation",0)),void 0===h&&(h=0),(u=i.call(this,t,n,r,o,a,l)).type="rexSizer",u.sizerChildren=[],u.setOrientation(h),u.setItemSpacing(po(l,"space.item",0)),u.setStartChildIndex(po(l,"startChildIndex",0)),u.setRTL(po(l,"rtl",!1)),u.addChildrenMap("items",u.sizerChildren),u}return n(s,[{key:"setOrientation",value:function(t){return this.orientation=function(t){return "string"==typeof t&&(t=fo[t]),t}(t),this}},{key:"setItemSpacing",value:function(t){return this.space.item=t,this}},{key:"setStartChildIndex",value:function(t){return this.startChildIndex=t,this}},{key:"setRTL",value:function(t){return void 0===t&&(t=!0),this.rtl=t,this}},{key:"childrenProportion",get:function(){return void 0===this._childrenProportion&&(this._childrenProportion=co.call(this)),this._childrenProportion}}]),s}(Js);Object.assign(go.prototype,uo);var yo=function(t,e,i){if(t){var n=null==e,r=null==i;return n&&r||(n||(t.displayWidth=e),r||(t.displayHeight=i),n&&(t.scaleX=t.scaleY),r&&(t.scaleY=t.scaleX)),t}},mo=function(t,e){var i;return t||0===t||(t=""),void 0===e&&(e=!0),Array.isArray(t)&&(t=t.join("\n")),(i=e?"".concat(this.text,"\n").concat(t):"".concat(this.text).concat(t))!=this.text&&this.setText(i),this},ko={appendText:mo,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 n=t.iconSize;n&&(this.setChildDisplaySize(i,n,n),void 0!==this.iconWidth&&this.setIconSize(n)),!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 s=t.actionSize;s&&(this.setChildDisplaySize(r,s,s),void 0!==this.actionWidth&&this.setActionSize(s)),!0!==t.action&&this.setActionTexture(t.action,t.actionFrame);}return this}},bo=function(t){r(o,t);var i=l(o);function o(){return e(this,o),i.apply(this,arguments)}return n(o,[{key:"text",get:function(){var t=this.childrenMap.text;return t?t.text:""},set:function(t){var e=this.childrenMap.text;e&&e.setText(t);}},{key:"setText",value:function(t){return this.text=t,this}},{key:"setIconTexture",value:function(t,e){var i=this.childrenMap.icon;return i?(i.setTexture(t,e),void 0!==this.iconWidth&&(yo(i,this.iconWidth,this.iconHeight),this.resetChildScaleState(i)),this):this}},{key:"setTexture",value:function(t,e){return this.setIconTexture(t,e),this}},{key:"setIconSize",value:function(t,e){return void 0===e&&(e=t),this.iconWidth=t,this.iconHeight=e,this}},{key:"texture",get:function(){var t=this.childrenMap.icon;if(t)return t.texture}},{key:"frame",get:function(){var t=this.childrenMap.icon;if(t)return t.frame}},{key:"setActionTexture",value:function(t,e){var i=this.childrenMap.action;return void 0===i||(i.setTexture(t,e),void 0!==this.actionWidth&&(yo(i,this.actionWidth,this.actionHeight),this.resetChildScaleState(i))),this}},{key:"actionTexture",get:function(){var t=this.childrenMap.action;if(t)return t.texture}},{key:"actionFrame",get:function(){var t=this.childrenMap.action;if(t)return t.frame}},{key:"setActionSize",value:function(t,e){return void 0===e&&(e=t),this.actionWidth=t,this.actionHeight=e,this}},{key:"preLayout",value:function(){var t=this.childrenMap.icon;t&&void 0!==this.iconWidth&&yo(t,this.iconWidth,this.iconHeight);var e=this.childrenMap.action;e&&void 0!==this.actionWidth&&yo(e,this.actionWidth,this.actionHeight),c(s(o.prototype),"preLayout",this).call(this);}},{key:"runLayout",value:function(t,e,i){if(this.ignoreLayout)return this;c(s(o.prototype),"runLayout",this).call(this,t,e,i);var n=this.childrenMap.iconMask;n&&(n.setPosition(),this.resetChildPositionState(n));var r=this.childrenMap.actionMask;return r&&(r.setPosition(),this.resetChildPositionState(r)),this}},{key:"resize",value:function(t,e){c(s(o.prototype),"resize",this).call(this,t,e);var i=this.childrenMap.iconMask;i&&i.resize();var n=this.childrenMap.actionMask;return n&&n.resize(),this}}]),o}(go);Object.assign(bo.prototype,ko);var wo=function(t,e,i,n,r){if(this.clear().fillStyle(16777215),1===this.shapeType){i=i.left;var s=Math.min(t,e)/2;this.fillCircle(-t*(n-.5),-e*(r-.5),s+i);}else this.fillRect(-t*n-i.left,-e*r-i.top,t+i.left+i.right,e+i.top+i.bottom);},xo=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},So=function(t){r(o,t);var i=l(o);function o(t,n,r){var s;return e(this,o),void 0===n&&(n=0),"string"==typeof n&&(n=Co[n]),(s=i.call(this,t.scene)).parent=t,s.shapeType=n,s.padding=Te(r),s.setPosition().resize().setVisible(!1),s}return n(o,[{key:"destroy",value:function(){return this.parent=void 0,c(s(o.prototype),"destroy",this).call(this),this}},{key:"setPosition",value:function(t,e){var i=this.parent;return void 0===t&&(t=i.x),void 0===e&&(e=i.y),c(s(o.prototype),"setPosition",this).call(this,t,e),this}},{key:"resize",value:function(t,e,i){var n=this.parent;void 0===t&&(t=n.width),void 0===e&&(e=n.height),void 0===i?i=this.padding:"number"==typeof i&&(i=Te(i));var r=this.width!==t||this.height!==e,s=this.padding!==i&&!xo(this.padding,i);return r||s?(this.width=t,this.height=e,s&&Mt(i,this.padding),this.originX=n.originX,this.originY=n.originY,wo.call(this,t,e,i,n.originX,n.originY),this):this}},{key:"setOrigin",value:function(t,e){void 0===e&&(e=t);var i=this.parent;return void 0===t&&(t=i.originX),void 0===e&&(e=i.originY),this.originX===t&&this.originY===e||(this.originX=t,this.originY=e,wo.call(this,this.width,this.height,this.padding,t,e)),this}}]),o}(Phaser.GameObjects.Graphics),Co={rectangle:0,circle:1},_o=function(t,e,i,n){var r=new So(e,i,n);if(t&&!t.isRexSizer){var s=r.createGeometryMask();t.setMask(s),this.once("destroy",(function(){t.setMask(),s.destroy();}));}return this.pin(r),r},Oo=Phaser.Utils.Objects.GetValue,Po=function(t){r(s,t);var i=l(s);function s(t,n){var r;e(this,s),(r=i.call(this,t,n)).type="rexLabel";var o=Oo(n,"background",void 0),h=Oo(n,"icon",void 0),l=Oo(n,"iconMask",void 0),u=Oo(n,"text",void 0),c=Oo(n,"action",void 0),d=Oo(n,"actionMask",void 0),f=Oo(n,"align",void 0);if(o&&r.addBackground(o),"right"!==f&&"bottom"!==f&&"center"!==f||r.addSpace(),h){0===r.orientation?(u||c)&&(w={right:Oo(n,"space.icon",0),top:Oo(n,"space.iconTop",0),bottom:Oo(n,"space.iconBottom",0),left:Oo(n,"space.iconLeft",0)}):(u||c)&&(w={bottom:Oo(n,"space.icon",0),left:Oo(n,"space.iconLeft",0),right:Oo(n,"space.iconRight",0),top:Oo(n,"space.iconTop",0)});var v=Oo(n,"squareFitIcon",!1)?1:0;if(r.add(h,{proportion:0,padding:w,fitRatio:v}),l&&(l=_o.call(a(r),h,h,1)),!v){var p=Oo(n,"iconSize",void 0);r.setIconSize(Oo(n,"iconWidth",p),Oo(n,"iconHeight",p));}}if(u){var g,y,m=Oo(n,"space.text",0),k=Oo(n,"expandTextWidth",!1),b=Oo(n,"expandTextHeight",!1);0===r.orientation?(g=k?1:0,c&&(w={right:m}),y=b):(g=b?1:0,c&&(w={bottom:m}),y=k),r.add(u,{proportion:g,expand:y,padding:w});}if(c){var w;w=0===r.orientation?{top:Oo(n,"space.actionTop",0),bottom:Oo(n,"space.actionBottom",0),right:Oo(n,"space.actionRight",0)}:{left:Oo(n,"space.actionLeft",0),right:Oo(n,"space.actionRight",0),bottom:Oo(n,"space.actionBottom",0)};v=Oo(n,"squareFitAction",!1)?1:0;if(r.add(c,{proportion:0,padding:w,fitRatio:v}),d&&(d=_o.call(a(r),c,c,1)),!v){var x=Oo(n,"actionSize");r.setActionSize(Oo(n,"actionWidth",x),Oo(n,"actionHeight",x));}}return "center"===f&&r.addSpace(),r.addChildrenMap("background",o),r.addChildrenMap("icon",h),r.addChildrenMap("iconMask",l),r.addChildrenMap("text",u),r.addChildrenMap("action",c),r.addChildrenMap("actionMask",d),r}return n(s)}(bo),To=function e(i){var n,r,s;if(null==i||"object"!==t(i))return i;if(n=Array.isArray(i)?[]:{},function(e){if("object"!==t(e)||e.nodeType||e===e.window)return !1;try{if(e.constructor&&!{}.hasOwnProperty.call(e.constructor.prototype,"isPrototypeOf"))return !1}catch(t){return !1}return !0}(i))for(s in i)r=i[s],n[s]=e(r);else n=i;return n},Eo=function(t){return null==t||""===t||0===t.length},Ro=function(e,i,n,r){if(void 0===r&&(r="."),"object"===t(e)){if(Eo(i)){if(null==n)return;"object"===t(n)&&(e=n);}else {"string"==typeof i&&(i=i.split(r));var s=i.pop(),o=function(e,i,n){var r=e;if(Eo(i));else {var s;"string"==typeof i&&(i=i.split("."));for(var o=0,a=i.length;o=0||t.y>=0,t.x=Math.abs(t.x),t.y=Math.abs(t.y);},jo=function(t,e,i){var n=i.length;if(n>=2){var r=i[n-2],s=i[n-1];if(t===r&&e===s)return i}return i.push(t,e),i},Fo=Phaser.Math.DegToRad,Wo=function(t,e,i,n,r,s,o,a,h){o&&s>r?s-=360:!o&&s>>16,a=(65280&r)>>>8,h=255&r;t.fillStyle="rgba("+o+","+a+","+h+","+s+")";}(r,e),r.fill()),e.isStroked&&(!function(t,e,i,n){var r=i||e.strokeColor,s=n||e.strokeAlpha,o=(16711680&r)>>>16,a=(65280&r)>>>8,h=255&r;t.strokeStyle="rgba("+o+","+a+","+h+","+s+")",t.lineWidth=e.lineWidth;}(r,e),r.stroke()),r.restore();}}},Ho=Phaser.GameObjects.Shape,Go=Phaser.Utils.Objects.IsPlainObject,Uo=Phaser.Utils.Objects.GetValue,Vo=Phaser.Geom.Polygon.Earcut,Jo=function(t){r(s,t);var i=l(s);function s(t,n,r,o,a,h,l,u){var c,d,f,v,p;if(e(this,s),Go(n)){var g=n;n=g.x,r=g.y,o=g.width,a=g.height,h=g.radius,l=g.color,u=g.alpha,d=g.strokeColor,f=g.strokeAlpha,v=g.strokeWidth,p=g.shape;}void 0===n&&(n=0),void 0===r&&(r=0),void 0===o&&(o=1),void 0===a&&(a=o),void 0===h&&(h=0),void 0===p&&(p=0);var y=new Lo;if((c=i.call(this,t,"rexRoundRectangleShape",y)).setShapeType(p),0===c.shapeType){var m=Uo(h,"radius",h);y.setTo(0,0,o,a,m);}else {m={x:o/2,y:a/2};y.setTo(0,0,o,a,m);}var k=Uo(h,"iteration",void 0);return c.setIteration(k),c.setPosition(n,r),c.setFillStyle(l,u),void 0!==d&&void 0===v&&(v=2),c.setStrokeStyle(v,d,f),c.updateDisplayOrigin(),c.dirty=!0,c}return n(s,[{key:"fillColor",get:function(){return this._fillColor},set:function(t){this._fillColor=t,this.isFilled=null!=t&&this._fillAlpha>0;}},{key:"fillAlpha",get:function(){return this._fillAlpha},set:function(t){this._fillAlpha=t,this.isFilled=t>0&&null!=this._fillColor;}},{key:"setFillStyle",value:function(t,e){return void 0===e&&(e=1),this.fillColor=t,this.fillAlpha=e,this}},{key:"strokeColor",get:function(){return this._strokeColor},set:function(t){this._strokeColor=t,this.isStroked=null!=t&&this._strokeAlpha>0&&this._lineWidth>0;}},{key:"strokeAlpha",get:function(){return this._strokeAlpha},set:function(t){this._strokeAlpha=t,this.isStroked=t>0&&null!=this._strokeColor&&this._lineWidth>0;}},{key:"lineWidth",get:function(){return this._lineWidth},set:function(t){this._lineWidth=t,this.isStroked=t>0&&null!=this._strokeColor;}},{key:"setStrokeStyle",value:function(t,e,i){return void 0===i&&(i=1),this.lineWidth=t,this.strokeColor=e,this.strokeAlpha=i,this}},{key:"updateData",value:function(){var t=this.geom,e=this.pathData;e.length=0;var i,n=t.width,r=t.height,s=t.cornerRadius,o=this.iteration+1;if(i=s.tl,Ko(i))if(i.convex){var a=i.x,h=i.y;Wo(a,h,i.x,i.y,180,270,!1,o,e);}else {Wo(a=0,h=0,i.x,i.y,90,0,!0,o,e);}else jo(0,0,e);if(i=s.tr,Ko(i))if(i.convex){a=n-i.x,h=i.y;Wo(a,h,i.x,i.y,270,360,!1,o,e);}else {Wo(a=n,h=0,i.x,i.y,180,90,!0,o,e);}else jo(n,0,e);if(i=s.br,Ko(i))if(i.convex){a=n-i.x,h=r-i.y;Wo(a,h,i.x,i.y,0,90,!1,o,e);}else {Wo(a=n,h=r,i.x,i.y,270,180,!0,o,e);}else jo(n,r,e);if(i=s.bl,Ko(i))if(i.convex){a=i.x,h=r-i.y;Wo(a,h,i.x,i.y,90,180,!1,o,e);}else {Wo(a=0,h=r,i.x,i.y,360,270,!0,o,e);}else jo(0,r,e);return e.push(e[0],e[1]),this.pathIndexes=Vo(e),this}},{key:"setShapeType",value:function(t){return "string"==typeof t&&(t=qo[t]),this.shapeType=t,this}},{key:"width",get:function(){return this.geom.width},set:function(t){this.resize(t,this.height);}},{key:"height",get:function(){return this.geom.height},set:function(t){this.resize(this.width,t);}},{key:"setSize",value:function(t,e){if(void 0===e&&(e=t),this.geom.width===t&&this.geom.height===e)return this;this.geom.setSize(t,e),1===this.shapeType&&this.setRadius({x:t/2,y:e/2}),this.updateDisplayOrigin(),this.dirty=!0;var i=this.input;return i&&!i.customHitArea&&(i.hitArea.width=t,i.hitArea.height=e),this}},{key:"resize",value:function(t,e){return this.setSize(t,e),this}},{key:"radius",get:function(){return this.geom.radius},set:function(t){this.geom.setRadius(t),this.updateDisplayOrigin(),this.dirty=!0;}},{key:"radiusTL",get:function(){return this.geom.radiusTL},set:function(t){this.geom.radiusTL=t,this.dirty=!0;}},{key:"radiusTR",get:function(){return this.geom.radiusTR},set:function(t){this.geom.radiusTR=t,this.dirty=!0;}},{key:"radiusBL",get:function(){return this.geom.radiusBL},set:function(t){this.geom.radiusBL=t,this.dirty=!0;}},{key:"radiusBR",get:function(){return this.geom.radiusBR},set:function(t){this.geom.radiusBR=t,this.dirty=!0;}},{key:"setRadius",value:function(t){return void 0===t&&(t=0),this.radius=t,this}},{key:"setRadiusTL",value:function(t){return void 0===t&&(t=0),this.radiusTL=t,this}},{key:"setRadiusTR",value:function(t){return void 0===t&&(t=0),this.radiusTR=t,this}},{key:"setRadiusBL",value:function(t){return void 0===t&&(t=0),this.radiusBL=t,this}},{key:"setRadiusBR",value:function(t){return void 0===t&&(t=0),this.radiusBR=t,this}},{key:"cornerRadius",get:function(){return this.geom.cornerRadius},set:function(t){this.radius=t;}},{key:"setCornerRadius",value:function(t){return this.setRadius(t)}},{key:"iteration",get:function(){return this._iteration},set:function(t){void 0!==this._iteration?this._iteration!==t&&(this._iteration=t,this.dirty=!0):this._iteration=t;}},{key:"setIteration",value:function(t){return void 0===t&&(t=6),this.iteration=t,this}}]),s}(Ho),Ko=function(t){return t.x>0&&t.y>0},qo={rectangle:0,circle:1};Object.assign(Jo.prototype,No);var Zo=Phaser.Utils.Objects.GetValue,$o=function(t){r(s,t);var i=l(s);function s(t,n){var r;e(this,s),(r=i.call(this,t,n)).style=Zo(n,"style",a(r));var o=Zo(n,"propertiesMap");return r.activeStyle=Qo(n,"active",o),r.hoverStyle=Qo(n,"hover",o),r.disableStyle=Qo(n,"disable",o),r.onModifyStyle=Zo(n,"onModifyStyle"),r}return n(s,[{key:"getStyle",value:function(t){return function(t,e,i){if(void 0===i&&(i={}),Array.isArray(e))for(var n=0,r=e.length;n=6?(n=[arguments[2],void 0,arguments[3]],r=[arguments[4],void 0,arguments[5]]):(n=To(n),r=To(r)),this.textureKey=e,this.baseFrameName=i,this.columns.data=n,this.columns.count=n?n.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 s=this.scene.sys.textures.get(e);if(!s)return this.clear(),this;if(!n||!r)return this.clear(),this;for(var o=s.get(i),a=o.width,h=0,l=0,u=n.length;l0?0:g,b=0;l=0;for(var C=n.length;l0?0:y),y>=1&&g>=1){var _=t(m=this.getFrameNameCallback(l,x,i));"string"!==_&&"number"!==_||s.add(m,0,b+o.cutX,w+o.cutY,y,g);}b+=y;}w+=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,n,r,s,o,a,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,f=c>=0?this.maxFixedPartScaleY:this.height/l;if(this.preserveRatio){var v=Math.min(d,f);if(d>v){var p=(d-v)*h;u>=0?u+=p:u=p,d=v;}if(f>v){var g=(f-v)*l;c>=0?c+=g:c=g,f=v;}}this.columns.scale=d,this.rows.scale=f,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 y=0,m=0;this._beginDraw();for(var k=0,b=this.rows.count;k0&&a>0&&(0===(0===s.stretch&&0===r.stretch||0===this.getStretchMode(w,k)?0:1)?this._drawImage(this.textureKey,n,y,m,o,a):this._drawTileSprite(this.textureKey,n,y,m,o,a)),y+=o;m+=a;}this._endDraw();},setStretchMode:function(t){return ka(t)?(this.stretchMode.edge=wa(ba(t,"edge",0)),this.stretchMode.internal=wa(ba(t,"internal",0))):(t=wa(t),this.stretchMode.edge=t,this.stretchMode.internal=t),this},getStretchMode:function(t,e){return Sa.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}},_a=Phaser.Utils.Objects.IsPlainObject,Oa=Phaser.Utils.Objects.GetValue,Pa=Phaser.GameObjects,Ta=void 0,Ea=function(t,e){if(Ta||(Ta={},ei(t).events.once("destroy",(function(){for(var t in Ta)Ta[t].destroy();Ta=void 0;}))),!Ta.hasOwnProperty(e)){var i=ei(t).scene.systemScene;(t=new Pa[e](i)).setOrigin(0),Ta[e]=t;}return Ta[e]},Ra=function(t){r(s,t);var i=l(s);function s(){return e(this,s),i.apply(this,arguments)}return n(s)}(function(t,i){var o=function(t){r(a,t);var o=l(a);function a(t,n,r,s,h,l,u,c,d,f){var v;if(e(this,a),_a(n)?(n=Oa(f=n,"x",0),r=Oa(f,"y",0),s=Oa(f,"width",1),h=Oa(f,"height",1),l=Oa(f,"key",void 0),u=Oa(f,"baseFrame",void 0),c=Oa(f,"columns",void 0),d=Oa(f,"rows",void 0)):_a(s)?(s=Oa(f=s,"width",1),h=Oa(f,"height",1),l=Oa(f,"key",void 0),u=Oa(f,"baseFrame",void 0),c=Oa(f,"columns",void 0),d=Oa(f,"rows",void 0)):_a(l)?(l=Oa(f=l,"key",void 0),u=Oa(f,"baseFrame",void 0),c=Oa(f,"columns",void 0),d=Oa(f,"rows",void 0)):_a(u)?(u=Oa(f=u,"baseFrame",void 0),c=Oa(f,"columns",void 0),d=Oa(f,"rows",void 0)):Array.isArray(u)?(f=d,d=c,c=u,u=Oa(f,"baseFrame",void 0)):_a(c)&&(c=Oa(f=c,"columns",void 0),d=Oa(f,"rows",void 0)),void 0===c){var p=Oa(f,"leftWidth",void 0),g=Oa(f,"rightWidth",void 0);void 0!==p&&void 0!==g&&(c=[p,void 0,g]);}if(void 0===d){var y=Oa(f,"topHeight",void 0),m=Oa(f,"bottomHeight",void 0);void 0!==y&&void 0!==m&&(d=[y,void 0,m]);}(v=o.call(this,t)).type=i,v.setPosition(n,r).setSize(s,h).setOrigin(.5,.5),v.columns={},v.rows={},v.stretchMode={},v._tileSprite=void 0,v._image=void 0,v.setGetFrameNameCallback(Oa(f,"getFrameNameCallback",void 0)),v.setStretchMode(Oa(f,"stretchMode",0)),v.setPreserveRatio(Oa(f,"preserveRatio",!0));var k=Oa(f,"maxFixedPartScale",1),b=Oa(f,"maxFixedPartScaleX",k),w=Oa(f,"maxFixedPartScaleY",void 0);return v.setMaxFixedPartScale(b,w),v.setBaseTexture(l,u,c,d),v}return n(a,[{key:"minWidth",get:function(){return this.columns.minWidth}},{key:"minHeight",get:function(){return this.rows.minHeight}},{key:"fixedPartScaleX",get:function(){return this.columns.scale}},{key:"fixedPartScaleY",get:function(){return this.rows.scale}},{key:"resize",value:function(t,e){return this.width===t&&this.height===e||(c(s(a.prototype),"resize",this)?c(s(a.prototype),"resize",this).call(this,t,e):c(s(a.prototype),"setSize",this).call(this,t,e),this.updateTexture()),this}}]),a}(t);return Object.assign(o.prototype,Ca),o}(Phaser.GameObjects.RenderTexture,"rexNinePatch")),Ma={_drawImage:function(t,e,i,n,r,s){var o=Ea(this,"Image").setTexture(t,e).setDisplaySize(r,s);this.draw(o,i,n);},_drawTileSprite:function(t,e,i,n,r,s){var o=Ea(this,"TileSprite").setTexture(t,e).setSize(r,s);this.draw(o,i,n);}};Object.assign(Ra.prototype,Ma);var La=function(t,e){var i,n;switch(e&&(e.hasOwnProperty("type")?i=e.type:e.hasOwnProperty("leftWidth")?i="nineSlice":e.hasOwnProperty("key")&&(i="image")),i){case"image":n=new ya(t,e);break;case"nineSlice":n=e.hasOwnProperty("stretchMode")?new Ra(t,e):new fa(t,e);break;default:n=new ia(t,e);}return t.add.existing(n),n},Aa=Phaser.GameObjects.Text,Da=Phaser.Utils.Objects.GetValue,za=function(t){r(s,t);var i=l(s);function s(t,n){var r;e(this,s),void 0===n&&(n={});var o=Da(n,"x",0),a=Da(n,"y",0),h=Da(n,"text","");return (r=i.call(this,t,o,a,h,n)).type="rexStatesText",n.style=r.style,n.onModifyStyle=function(t,e){var i=e.hasOwnProperty("fontStyle")||e.hasOwnProperty("fontSize")||e.hasOwnProperty("fontFamily");t.style.update(i);},r.addStyleManager(n),delete n.style,r}return n(s)}(Aa);Object.assign(za.prototype,ea); /** * @author Richard Davey * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var ja=Phaser.Renderer.WebGL.Utils,Fa={renderWebGL:function(t,e,i,n){if(0!==e.width&&0!==e.height){i.addToRenderList(e);var r=e.frame,s=r.width,o=r.height,a=ja.getTintAppendFloatAlpha,h=t.pipelines.set(e.pipeline,e),l=h.setTexture2D(r.glTexture,e);t.pipelines.preBatch(e),h.batchTexture(e,r.glTexture,s,o,e.x,e.y,s/e.style.resolution,o/e.style.resolution,e.scaleX,e.scaleY,e.rotation,e.flipX,e.flipY,e.scrollFactorX,e.scrollFactorY,e.displayOriginX,e.displayOriginY,0,0,s,o,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,n,!1,l),t.pipelines.postBatch(e);}},renderCanvas:function(t,e,i,n){0!==e.width&&0!==e.height&&(i.addToRenderList(e),t.batchSprite(e,e.frame,i,n));}},Wa=Phaser.Display.Canvas.CanvasPool;m();var Xa=function(t){r(s,t);var i=l(s);function s(){return e(this,s),i.apply(this,arguments)}return n(s,[{key:"setStyle",value:function(t){return this.style.setStyle(t)}},{key:"setFont",value:function(t){return this.style.setFont(t)}},{key:"setFontFamily",value:function(t){return this.style.setFontFamily(t)}},{key:"setFontSize",value:function(t){return this.style.setFontSize(t)}},{key:"setFontStyle",value:function(t){return this.style.setFontStyle(t)}},{key:"setTestString",value:function(t){return this.style.setTestString(t)}},{key:"setFixedSize",value:function(t,e){return this.style.setFixedSize(t,e)}},{key:"setBackgroundColor",value:function(t,e,i){return this.style.setBackgroundColor(t,e,i)}},{key:"setBackgroundStrokeColor",value:function(t,e){return this.style.setBackgroundStrokeColor(t,e)}},{key:"setBackgroundCornerRadius",value:function(t,e){return this.style.setBackgroundCornerRadius(t,e)}},{key:"setFill",value:function(t){return this.style.setFill(t)}},{key:"setColor",value:function(t){return this.style.setColor(t)}},{key:"setStroke",value:function(t,e){return this.style.setStroke(t,e)}},{key:"setShadow",value:function(t,e,i,n,r,s){return this.style.setShadow(t,e,i,n,r,s)}},{key:"setShadowOffset",value:function(t,e){return this.style.setShadowOffset(t,e)}},{key:"setShadowColor",value:function(t){return this.style.setShadowColor(t)}},{key:"setShadowBlur",value:function(t){return this.style.setShadowBlur(t)}},{key:"setShadowStroke",value:function(t){return this.style.setShadowStroke(t)}},{key:"setShadowFill",value:function(t){return this.style.setShadowFill(t)}},{key:"setWrapMode",value:function(t){return this.style.setWrapMode(t)}},{key:"setWrapWidth",value:function(t){return this.style.setWrapWidth(t)}},{key:"setWordWrapWidth",value:function(t){return this.style.setWrapWidth(t)}},{key:"setAlign",value:function(t){return this.style.setHAlign(t)}},{key:"setHAlign",value:function(t){return this.style.setHAlign(t)}},{key:"setVAlign",value:function(t){return this.style.setVAlign(t)}},{key:"setLineSpacing",value:function(t){return this.style.setLineSpacing(t)}},{key:"lineSpacing",get:function(){return this.style.lineSpacing},set:function(t){this.setLineSpacing(t);}},{key:"setXOffset",value:function(t){return this.style.setXOffset(t)}},{key:"setMaxLines",value:function(t){return this.style.setMaxLines(t)}},{key:"setResolution",value:function(t){return this.style.setResolution(t)}},{key:"getTextMetrics",value:function(){return this.style.getTextMetrics()}},{key:"setTextMetrics",value:function(t,e){return this.style.setTextMetrics(t,e)}},{key:"measureTextMargins",value:function(t,e){return function(t,e,i){void 0===i&&(i={});var n=Wa.create(this),r=n.getContext("2d",{willReadFrequently:!0});t.syncFont(n,r);var s=r.measureText(e),o=Math.ceil(s.width*t.baselineX),a=o,h=2*a;if(a=a*t.baselineY|0,n.width=o,n.height=h,r.fillStyle="#f00",r.fillRect(0,0,o,h),r.font=t._font,r.textBaseline="alphabetic",r.fillStyle="#000",r.fillText(t.testString,0,a),i.left=0,0===o||0===h||!r.getImageData(0,0,o,h))return Wa.remove(n),i;for(var l=r.getImageData(0,0,o,h).data,u=!1,c=0;ch;u--){for(c=0;c0&&this.wrapMode!==Ka&&0===this.wrapWidth}},{key:"setStyle",value:function(t,e,i){if(void 0===e&&(e=!0),void 0===i&&(i=!1),t&&t.hasOwnProperty("wrap")){var n=t.wrap;if(n.hasOwnProperty("mode")){var r=n.mode;"string"==typeof r&&(n.mode=ih[r]);}else n.hasOwnProperty("width")&&(n.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 s=this.propertyMap;for(var o in s){var a=s[o],h=a[0],l=i?a[1]:this[o],u=a[2];if("wrapCallback"===o||"wrapCallbackScope"===o)this[o]=th(t,h,l);else {var c=Qa(t,h,l);u&&(c=u(c)),this[o]=c;}}var d=th(t,"font",null);this._font=null===d?this.fontStyle+" "+this.fontSize+" "+this.fontFamily:d;var f=th(t,"fill",null);null!==f&&(this.color=Ba(f));var v=th(t,"metrics",!1);return v?this.metrics={ascent:th(v,"ascent",0),descent:th(v,"descent",0),fontSize:th(v,"fontSize",0)}:!e&&this.metrics||(this.metrics=Ga(this)),e?this.parent.updateText():this.parent}},{key:"syncFont",value:function(t,e){e.font=this._font;}},{key:"syncStyle",value:function(t,e){e.textBaseline="alphabetic",e.fillStyle=this.color,e.strokeStyle=this.stroke,e.lineWidth=this.strokeThickness,e.lineCap="round",e.lineJoin="round";}},{key:"syncShadow",value:function(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);}},{key:"update",value:function(t){return t&&(this._font="".concat(this.fontStyle," ").concat(this.fontSize," ").concat(this.fontFamily).trim(),this.metrics=Ga(this)),this.parent.updateText(t)}},{key:"buildFont",value:function(){var t="".concat(this.fontStyle," ").concat(this.fontSize," ").concat(this.fontFamily).trim();return t!==this._font&&(this._font=t),this}},{key:"setFont",value:function(t){return "string"==typeof t?(this.fontFamily=t,this.fontSize="",this.fontStyle=""):(this.fontFamily=th(t,"fontFamily","Courier"),this.fontSize=th(t,"fontSize","16px"),this.fontStyle=th(t,"fontStyle","")),this.update(!0)}},{key:"setFontFamily",value:function(t){return this.fontFamily=t,this.update(!0)}},{key:"setFontStyle",value:function(t){return this.fontStyle=t,this.update(!0)}},{key:"setFontSize",value:function(t){return "number"==typeof t&&(t=t.toString()+"px"),this.fontSize=t,this.update(!0)}},{key:"setTestString",value:function(t){return this.testString=t,this.update(!0)}},{key:"setFixedSize",value:function(t,e){return this.fixedWidth=t,this.fixedHeight=e,t&&(this.parent.width=t),e&&(this.parent.height=e),this.update(this.isWrapFitMode)}},{key:"setResolution",value:function(t){return this.resolution=t,this.update(!1)}},{key:"setLineSpacing",value:function(t){return this.lineSpacing=t,this.update(!1)}},{key:"setXOffset",value:function(t){return this.xOffset=t,this.update(!1)}},{key:"setBackgroundColor",value:function(t,e,i){return void 0===i&&(i=!0),this.backgroundColor=Ba(t,this.parent.canvas,this.parent.context),this.backgroundColor2=Ba(e,this.parent.canvas,this.parent.context),this.backgroundHorizontalGradient=i,this.update(!1)}},{key:"setBackgroundStrokeColor",value:function(t,e){return this.backgroundStrokeColor=Ba(t,this.parent.canvas,this.parent.context),this.backgroundStrokeLineWidth=e,this.update(!1)}},{key:"setBackgroundCornerRadius",value:function(t,e){return this.backgroundCornerRadius=t,this.backgroundCornerIteration=e,this.update(!1)}},{key:"setFill",value:function(t){return this.color=Ba(t,this.parent.canvas,this.parent.context),this.update(!1)}},{key:"setColor",value:function(t){return this.color=Ba(t,this.parent.canvas,this.parent.context),this.update(!1)}},{key:"setStroke",value:function(t,e){return void 0===t?this.strokeThickness=0:(void 0===e&&(e=this.strokeThickness),this.stroke=Ba(t,this.parent.canvas,this.parent.context),this.strokeThickness=e),this.update(!0)}},{key:"setShadow",value:function(t,e,i,n,r,s){return void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i="#000"),void 0===n&&(n=0),void 0===r&&(r=!1),void 0===s&&(s=!0),this.shadowOffsetX=t,this.shadowOffsetY=e,this.shadowColor=Ba(i,this.parent.canvas,this.parent.context),this.shadowBlur=n,this.shadowStroke=r,this.shadowFill=s,this.update(!1)}},{key:"setShadowOffset",value:function(t,e){return void 0===t&&(t=0),void 0===e&&(e=t),this.shadowOffsetX=t,this.shadowOffsetY=e,this.update(!1)}},{key:"setShadowColor",value:function(t){return void 0===t&&(t="#000"),this.shadowColor=Ba(t,this.parent.canvas,this.parent.context),this.update(!1)}},{key:"setShadowBlur",value:function(t){return void 0===t&&(t=0),this.shadowBlur=t,this.update(!1)}},{key:"setShadowStroke",value:function(t){return this.shadowStroke=t,this.update(!1)}},{key:"setShadowFill",value:function(t){return this.shadowFill=t,this.update(!1)}},{key:"setUnderline",value:function(t,e,i){return void 0===t&&(t="#000"),void 0===e&&(e=0),void 0===i&&(i=0),this.underlineColor=Ba(t,this.parent.canvas,this.parent.context),this.underlineThickness=e,this.underlineOffset=i,this.update(!1)}},{key:"setUnderlineColor",value:function(t){return void 0===t&&(t="#000"),this.underlineColor=Ba(t,this.parent.canvas,this.parent.context),this.update(!1)}},{key:"setUnderlineThickness",value:function(t){return void 0===t&&(t=0),this.underlineThickness=t,this.update(!1)}},{key:"setUnderlineOffset",value:function(t){return void 0===t&&(t=0),this.underlineOffset=t,this.update(!1)}},{key:"setStrikethrough",value:function(t,e,i){return void 0===t&&(t="#000"),void 0===e&&(e=0),void 0===i&&(i=0),this.strikethroughColor=Ba(t,this.parent.canvas,this.parent.context),this.strikethroughThickness=e,this.strikethroughOffset=i,this.update(!1)}},{key:"setStrikethroughColor",value:function(t){return void 0===t&&(t="#000"),this.strikethroughColor=Ba(t,this.parent.canvas,this.parent.context),this.update(!1)}},{key:"setStrikethroughThickness",value:function(t){return void 0===t&&(t=0),this.strikethroughThickness=t,this.update(!1)}},{key:"setStrikethroughOffset",value:function(t){return void 0===t&&(t=0),this.strikethroughOffset=t,this.update(!1)}},{key:"setWrapMode",value:function(t){return "string"==typeof t&&(t=ih[t.toLowerCase()]||0),this.wrapMode=t,this.update(!0)}},{key:"setWrapWidth",value:function(t){return this.wrapWidth=t,this.update(!1)}},{key:"setAlign",value:function(t,e){return void 0===t&&(t="left"),void 0===e&&(e="top"),this.halign=t,this.valign=e,this.update(!1)}},{key:"setHAlign",value:function(t){return void 0===t&&(t="left"),this.halign=t,this.update(!1)}},{key:"setVAlign",value:function(t){return void 0===t&&(t="top"),this.valign=t,this.update(!1)}},{key:"setMaxLines",value:function(t){return void 0===t&&(t=0),this.maxLines=t,this.update(!1)}},{key:"getTextMetrics",value:function(){var t=this.metrics;return {ascent:t.ascent,descent:t.descent,fontSize:t.fontSize}}},{key:"setTextMetrics",value:function(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=th(e,"fontFamily",this.fontFamily),this.fontSize=th(e,"fontSize",this.fontSize),this.fontStyle=th(e,"fontStyle",this.fontStyle))),this.parent.updateText(!0)}},{key:"lineHeight",get:function(){return this.metrics.fontSize+this.strokeThickness+this.lineSpacing}},{key:"toJSON",value:function(){var t={},e=this.propertyMap;for(var i in e)t[i]=this[i];return t.metrics=this.getTextMetrics(),t}},{key:"destroy",value:function(){this.parent=void 0;}}]),t}(),ih={none:Ka,word:qa,char:Za,character:Za},nh=Phaser.Math.DegToRad,rh=function(t){return !t.hasOwnProperty("convex")||t.convex},sh=function(t){return t.x>0&&t.y>0},oh=function(t,e,i,n,r,s,o,a,h){if(a&&o>s?o-=360:!a&&o=f?1:n/f,g=r>=v?1:r/v,y=d.cornerRadius;t.save(),t.beginPath(),t.translate(e,i),a=y.tl,sh(a)?(h=a.x*p,l=a.y*g,rh(a)?oh(t,h,l,h,l,180,270,!1,o):oh(t,0,0,h,l,90,0,!0,o),u=0,c=l):(t.lineTo(0,0),u=0,c=0),a=y.tr,sh(a)?(h=a.x*p,l=a.y*g,rh(a)?oh(t,n-h,l,h,l,270,360,!1,o):oh(t,n,0,h,l,180,90,!0,o)):t.lineTo(n,0),a=y.br,sh(a)?(h=a.x*p,l=a.y*g,rh(a)?oh(t,n-h,r-l,h,l,0,90,!1,o):oh(t,n,r,h,l,270,180,!0,o)):t.lineTo(n,r),a=y.bl,sh(a)?(h=a.x*p,l=a.y*g,rh(a)?oh(t,h,r-l,h,l,90,180,!1,o):oh(t,0,r,h,l,360,270,!0,o)):t.lineTo(0,r),t.lineTo(u,c),t.closePath(),t.restore();}(e,i,n,r,s,o,d),null!=a){var f;if(null!=u)(f=c?e.createLinearGradient(0,0,r,0):e.createLinearGradient(0,0,0,s)).addColorStop(0,a),f.addColorStop(1,u),a=f;e.fillStyle=a,e.fill();}null!=h&&l>0&&(e.strokeStyle=h,e.lineWidth=l,e.stroke());},hh=function(t,e,i,n,r,s,o,a){if(null!=e||null!=i){var h=t.canvas.width,l=t.canvas.height;null==i&&(n=0);var u=n/2;h=Math.max(1,h-n),l=Math.max(1,l-n),ah(t.canvas,t.context,u,u,h,l,r,e,i,n,s,o,a);}},lh={draw:function(t,e,i,n){var r=this.penManager;this.hitAreaManager.clear();var s=this.context;s.save();var o=this.defaultStyle;this.clear(),hh(this,o.backgroundColor,o.backgroundStrokeColor,o.backgroundStrokeLineWidth,o.backgroundCornerRadius,o.backgroundColor2,o.backgroundHorizontalGradient,o.backgroundCornerIteration),t+=this.startXOffset,e+=this.startYOffset;var a,h,l,u,c,d,f=o.halign,v=o.valign,p=o.lineHeight,g=r.lines,y=g.length,m=o.maxLines;m>0&&y>m?(h=m,l="center"===v?Math.floor((y-h)/2):"bottom"===v?y-h:0):(h=y,l=0),u=l+h;var k=this.rtl,b=k?this.parent.width:void 0;d="center"===v?Math.max((n-h*p)/2,0):"bottom"===v?Math.max(n-h*p-2,0):0,d+=e;for(var w=l;w0&&t.width>0){var a=i+o.underlineOffset-o.underlineThickness/2;this.drawLine(e,a,t.width,o.underlineThickness,o.underlineColor);}if(t.isTextPen&&this.drawText(e,i,t.text,o),t.isImagePen&&this.drawImage(e,i,t.prop.img,o),o.strikethroughThickness>0&&t.width>0){a=i+o.strikethroughOffset-o.strikethroughThickness/2;this.drawLine(e,a,t.width,o.strikethroughThickness,o.strikethroughColor);}if(s.restore(),t.hasAreaMarker&&t.width>0){var h,l=t.prop.area;if(l)h={key:l};else {var u=t.prop.url;h={key:"url:".concat(u),url:u};}this.hitAreaManager.add(e,i-this.startYOffset,t.width,this.defaultStyle.lineHeight,h);}},clear:function(){var t=this.canvas;this.context.clearRect(0,0,t.width,t.height);},drawLine:function(t,e,i,n,r){this.autoRound&&(t=Math.round(t),e=Math.round(e));var s=this.context,o=s.lineCap;s.lineCap="butt",s.strokeStyle=r,s.lineWidth=n,s.beginPath(),s.moveTo(t,e),s.lineTo(t+i,e),s.stroke(),s.lineCap=o;},drawText:function(t,e,i,n){this.autoRound&&(t=Math.round(t),e=Math.round(e));var r=this.context;n.stroke&&"none"!==n.stroke&&n.strokeThickness>0&&(n.syncShadow(r,n.shadowStroke),r.strokeText(i,t,e)),n.color&&"none"!==n.color&&(n.syncShadow(r,n.shadowFill),r.fillText(i,t,e));},drawImage:function(t,e,i,n){e-=this.startYOffset,this.parent.imageManager.draw(i,this.context,t,e,this.autoRound);}},uh=Phaser.Utils.Objects.GetValue,ch=Ua,dh=Va,fh=function(){function t(i){e(this,t),this.prop={},this.resetFromJSON(i);}return n(t,[{key:"resetFromJSON",value:function(t){this.text=uh(t,"text",""),this.x=uh(t,"x",0),this.y=uh(t,"y",0),this.width=uh(t,"width",0);var e=uh(t,"prop",null);null===e&&(e={}),this.prop=e,this.newLineMode=uh(t,"newLineMode",0),this.startIndex=uh(t,"startIndex",0);}},{key:"plainText",get:function(){var t=this.text;return this.newLineMode===dh&&(t+="\n"),t}},{key:"wrapText",get:function(){var t=this.text;return this.newLineMode!==ch&&(t+="\n"),t}},{key:"rawTextLength",get:function(){var t=this.text.length;return this.newLineMode===dh&&(t+=1),t}},{key:"endIndex",get:function(){return this.startIndex+this.rawTextLength}},{key:"lastX",get:function(){return this.x+this.width}},{key:"isTextPen",get:function(){return ""!==this.text}},{key:"isImagePen",get:function(){return !!this.prop.img}},{key:"hasAreaMarker",get:function(){return !!this.prop.area||!!this.prop.url}}]),t}(),vh=Phaser.Utils.Objects.GetFastValue,ph=Ua,gh=Ja,yh=function(){function t(i){e(this,t),this.pens=[],this.lines=[],this.maxLinesWidth=void 0,this.pensPool=i.pensPool,this.linesPool=i.linesPool,this.tagToText=vh(i,"tagToText",Qt),this.tagToTextScope=vh(i,"tagToTextScope",void 0);}return n(t,[{key:"destroy",value:function(){this.clear(),this.tagToText=void 0,this.tagToTextScope=void 0;}},{key:"clear",value:function(){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}},{key:"getLineEndIndex",value:function(t){t>=this.lines.length&&(t=this.lines.length-1);var e,i,n=!1;for(e=t;e>=0&&!(n=null!=(i=this.lines[e])&&i.length>0);e--);return n?i[i.length-1].endIndex:0}},{key:"getLineWidth",value:function(t){var e=this.lines[t];if(!e)return 0;var i=e[e.length-1];return null==i?0:i.lastX}},{key:"getMaxLineWidth",value:function(){if(void 0!==this.maxLinesWidth)return this.maxLinesWidth;for(var t,e=0,i=0,n=this.lines.length;ie&&(e=t);return this.maxLinesWidth=e,e}},{key:"getLineWidths",value:function(){for(var t=[],e=0,i=this.lines.length;e=t&&h<=e||(o=o.substring(t-a,e-a)),this.tagToTextScope?c+=this.tagToText.call(this.tagToTextScope,o,l,u):c+=this.tagToText(o,l,u),u=l,!(h>=e)));d++);return c}},{key:"length",get:function(){return this.lines.length},set:function(t){this.clear();}}]),t}(),mh={},kh=function(){function t(){e(this,t),this.items=[];}return n(t,[{key:"destroy",value:function(){this.clear(),this.items=void 0;}},{key:"pop",value:function(){return this.items.length>0?this.items.pop():null}},{key:"push",value:function(t){return this.items.push(t),this}},{key:"pushMultiple",value:function(t){return this.items.push.apply(this.items,t),t.length=0,this}},{key:"clear",value:function(){return this.items.length=0,this}}]),t}(),bh=Phaser.Geom.Rectangle,wh=new kh,xh=function(){function t(){e(this,t),this.hitAreas=[];}return n(t,[{key:"destroy",value:function(){this.clear();}},{key:"clear",value:function(){for(var t=0,e=this.hitAreas.length;tr){""!==C?a.push(o.getLine(C,_,Eh)):0===P&&s>0&&a.push(o.getLine("",0,Eh)),a.push.apply(a,v(t(b,i,Lh,r,0,o)));var E=a.pop();C=E.text,_=E.width,o.freeLine(E)," "===C&&(C="",_=0);}else (S=_+w)>l?(a.push(o.getLine(C,_,Eh)),C=b,_=w,l=r):(C+=b,_=S),x&&a.push(o.getLine(C,_,u));}return a},zh=Phaser.Utils.Objects.GetValue,jh=Ka,Fh=Ua,Wh=function(){function t(i){e(this,t),this.parent=i.parent,this.scene=this.parent.scene,this.context=zh(i,"context",null),this.canvas=this.context.canvas,this.parser=zh(i,"parser",null),this.defaultStyle=zh(i,"style",null),this.autoRound=!0,this.pensPool=i.pensPool,this.linesPool=i.linesPool,this.wrapTextLinesPool=i.wrapTextLinesPool,this.penManager=this.newPenManager(),this._tmpPenManager=null,this.hitAreaManager=new xh,this.lastHitAreaKey=null,this.urlTagCursorStyle=null;var n=this.context;this.getTextWidth=function(t){return n.measureText(t).width};}return n(t,[{key:"destroy",value:function(){this.parent=void 0,this.scene=void 0,this.context=void 0,this.canvas=void 0,this.parser=void 0,this.defaultStyle=void 0,this.penManager&&(this.penManager.destroy(),this.penManager=void 0),this._tmpPenManager&&(this._tmpPenManager.destroy(),this._tmpPenManager=void 0),this.hitAreaManager&&(this.hitAreaManager.destroy(),this.hitAreaManager=void 0),this.pensPool=void 0,this.linesPool=void 0,this.wrapTextLinesPool=void 0;}},{key:"updatePenManager",value:function(t,e,i,n,r){if(void 0===r&&(r=this.penManager),r.clear(),""===t)return r;var s=this.parent.style;if(s.isWrapFitMode){var o=this.parent.padding;i=s.fixedWidth-o.left-o.right;}for(var a,h,l,u,c,d=this.canvas,f=this.context,v=function(t){return f.measureText(t).width},p=0,g=0,y=s.wrapCallback,m=s.wrapCallbackScope,k=!0,b=this.parser.splitText(t),w=this.wrapTextLinesPool,x=0,S=b.length;x0&&e!==jh&&i0&&t>e&&(t=e),t}},{key:"linesWidth",get:function(){return Math.ceil(this.penManager.getMaxLineWidth())}},{key:"linesHeight",get:function(){var t=this.desplayLinesCount,e=this.defaultStyle.lineHeight*t;return t>0&&(e-=this.defaultStyle.lineSpacing),e}},{key:"imageManager",get:function(){return this.parent.imageManager}},{key:"rtl",get:function(){return this.parent.style.rtl}},{key:"newPenManager",value:function(){return new yh({pensPool:this.pensPool,linesPool:this.linesPool,tagToText:this.parser.propToTagText,tagToTextScope:this.parser})}},{key:"tmpPenManager",get:function(){return null===this._tmpPenManager&&(this._tmpPenManager=this.newPenManager()),this._tmpPenManager}},{key:"getPlainText",value:function(t,e,i){var n;if(null==t)n=this.penManager.plainText;else {var r=this.parser.splitText(t,1);n="";for(var s=0,o=r.length;si.width?i.width-r:0;var s=this.drawY+this.drawTLY,o=s+this.height;return e=s<0?0-s:o>i.height?i.height-o:0,i._textOX+=t,i._textOY+=e,this}};Object.assign(nu,Vl);var ru=Phaser.Math.DegToRad,su=Phaser.Math.RadToDeg,ou=Phaser.Utils.Objects.GetValue,au=function(t){r(s,t);var i=l(s);function s(t,n){var r;return e(this,s),(r=i.call(this,t,n)).renderable=!0,r.scrollFactorX=1,r.scrollFactorY=1,r.toLocalPosition=!0,r.originX=0,r.offsetX=0,r.offsetY=0,r}return n(s,[{key:"visible",get:function(){return this._visible},set:function(t){this.setDirty(this._visible!=t),this._visible=t;}},{key:"setVisible",value:function(t){return void 0===t&&(t=!0),this.visible=t,this}},{key:"alpha",get:function(){return this._alpha},set:function(t){this.setDirty(this._alpha!=t),this._alpha=t;}},{key:"setAlpha",value:function(t){return this.alpha=t,this}},{key:"x",get:function(){return this._x},set:function(t){this.setDirty(this._x!=t),this._x=t;}},{key:"setX",value:function(t){return this.x=t,this}},{key:"y",get:function(){return this._y},set:function(t){this.setDirty(this._y!=t),this._y=t;}},{key:"setY",value:function(t){return this.y=t,this}},{key:"setPosition",value:function(t,e){return this.x=t,this.y=e,this}},{key:"setInitialPosition",value:function(t,e){return this.x0=t,this.y0=e,this}},{key:"setScrollFactorX",value:function(t){return this.scrollFactorX=t,this}},{key:"setScrollFactorY",value:function(t){return this.scrollFactorY=t,this}},{key:"setScrollFactor",value:function(t,e){return void 0===e&&(e=t),this.scrollFactorX=t,this.scrollFactorY=e,this}},{key:"rotation",get:function(){return this._rotation},set:function(t){this.setDirty(this._rotation!=t),this._rotation=t;}},{key:"setRotation",value:function(t){return this.rotation=t,this}},{key:"angle",get:function(){return su(this._rotation)},set:function(t){this.rotation=ru(t);}},{key:"setAngle",value:function(t){return this.angle=t,this}},{key:"scaleX",get:function(){return this._scaleX},set:function(t){this.setDirty(this._scaleX!==t),this._scaleX=t;}},{key:"setScaleX",value:function(t){return this.scaleX=t,this}},{key:"width",get:function(){return 0},set:function(t){}},{key:"setWidth",value:function(t,e){return void 0===e&&(e=!1),this.width=t,e&&(this.scaleY=this.scaleX),this}},{key:"leftSpace",get:function(){return this._leftSpace},set:function(t){this.setDirty(this._leftSpace!==t),this._leftSpace=t;}},{key:"setLeftSpace",value:function(t){return this.leftSpace=t,this}},{key:"rightSpace",get:function(){return this._rightSpace},set:function(t){this.setDirty(this._rightSpace!==t),this._rightSpace=t;}},{key:"setRightSpace",value:function(t){return this.rightSpace=t,this}},{key:"outerWidth",get:function(){return this.width+this.leftSpace+this.rightSpace}},{key:"scaleY",get:function(){return this._scaleY},set:function(t){this.setDirty(this._scaleY!==t),this._scaleY=t;}},{key:"setScaleY",value:function(t){return this.scaleY=t,this}},{key:"height",get:function(){return 0},set:function(t){}},{key:"setHeight",value:function(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}},{key:"setScale",value:function(t,e){return void 0===e&&(e=t),this.scaleX=t,this.scaleY=e,this}},{key:"setOrigin",value:function(t){return this.originX=t,this}},{key:"setAlign",value:function(t){return this.align=t,this}},{key:"modifyPorperties",value:function(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=ou(t,"width",void 0),i=ou(t,"height",void 0),n=ou(t,"scaleX",void 0),r=ou(t,"scaleY",void 0);return void 0!==e?void 0===i&&void 0===r?this.setWidth(e,!0):this.setWidth(e):void 0!==n&&this.setScaleX(n),void 0!==i?void 0===e&&void 0===n?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}},{key:"setDrawBelowCallback",value:function(t){return this.drawBelowCallback=t,this}},{key:"setDrawAboveCallback",value:function(t){return this.drawAboveCallback=t,this}},{key:"reset",value:function(){return this.setVisible().setAlpha(1).setPosition(0,0).setRotation(0).setScale(1,1).setLeftSpace(0).setRightSpace(0).setOrigin(0).setAlign().setDrawBelowCallback().setDrawAboveCallback(),this}},{key:"willRender",get:function(){return this.visible&&this.alpha>0}},{key:"drawX",get:function(){var t=this.x+this.leftSpace+this.offsetX-this.originX*this.width;return this.parent._textOX*this.scrollFactorX+t}},{key:"drawY",get:function(){var t=this.y+this.offsetY;return this.parent._textOY*this.scrollFactorY+t}},{key:"drawTLX",get:function(){return 0}},{key:"drawTLY",get:function(){return 0}},{key:"drawBLX",get:function(){return 0}},{key:"drawBLY",get:function(){return 0}},{key:"drawTRX",get:function(){return 0}},{key:"drawTRY",get:function(){return 0}},{key:"drawBRX",get:function(){return 0}},{key:"drawBRY",get:function(){return 0}},{key:"drawCenterX",get:function(){return (this.drawTRX+this.drawTLX)/2}},{key:"drawCenterY",get:function(){return (this.drawBLY+this.drawTLY)/2}}]),s}(Il);Object.assign(au.prototype,nu);var hu=function(t,e,i){return e.hasOwnProperty(t)?e[t]:i[t]},lu=Phaser.Utils.Objects.GetValue,uu=function(t){r(o,t);var i=l(o);function o(t,n){var r;return e(this,o),(r=i.call(this,t,"background")).setScrollFactor(0),r.setColor(lu(n,"color",null),lu(n,"color2",null),lu(n,"horizontalGradient",!0)),r.setStroke(lu(n,"stroke",null),lu(n,"strokeThickness",2)),r.setCornerRadius(lu(n,"cornerRadius",0),lu(n,"cornerIteration",null)),r}return n(o,[{key:"color",get:function(){return this._color},set:function(t){t=Ba(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t;}},{key:"color2",get:function(){return this._color2},set:function(t){t=Ba(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t;}},{key:"horizontalGradient",get:function(){return this._horizontalGradient},set:function(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t;}},{key:"setColor",value:function(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}},{key:"stroke",get:function(){return this._stroke},set:function(t){t=Ba(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t;}},{key:"strokeThickness",get:function(){return this._strokeThickness},set:function(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t;}},{key:"setStroke",value:function(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}},{key:"cornerRadius",get:function(){return this._cornerRadius},set:function(t){this.setDirty(this._cornerRadius!=t),this._cornerRadius=t;}},{key:"cornerIteration",get:function(){return this._cornerIteration},set:function(t){this.setDirty(this._cornerIteration!=t),this._cornerIteration=t;}},{key:"modifyStyle",value:function(t){return t.hasOwnProperty("color")&&this.setColor(t.color,hu("color2",t,this),hu("horizontalGradient",t,this)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,hu("strokeThickness",t,this)),t.hasOwnProperty("cornerRadius")&&this.setCornerRadius(t.cornerRadius,hu("cornerIteration",t,this)),this}},{key:"modifyPorperties",value:function(t){return c(s(o.prototype),"modifyPorperties",this).call(this,t),this.modifyStyle(t),this}},{key:"setCornerRadius",value:function(t,e){return this.cornerRadius=t,this.cornerIteration=e,this}},{key:"renderContent",value:function(){hh(this.parent,this.color,this.stroke,this.strokeThickness,this.cornerRadius,this.color2,this.horizontalGradient,this.cornerIteration);}}]),o}(au),cu=Phaser.Utils.Objects.GetValue,du=function(t){r(o,t);var i=l(o);function o(t,n){var r;return e(this,o),(r=i.call(this,t,"innerbounds")).setScrollFactor(0),r.setColor(cu(n,"color",null),cu(n,"color2",null),cu(n,"horizontalGradient",!0)),r.setStroke(cu(n,"stroke",null),cu(n,"strokeThickness",2)),r}return n(o,[{key:"color",get:function(){return this._color},set:function(t){t=Ba(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t;}},{key:"color2",get:function(){return this._color2},set:function(t){t=Ba(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t;}},{key:"horizontalGradient",get:function(){return this._horizontalGradient},set:function(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t;}},{key:"setColor",value:function(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}},{key:"stroke",get:function(){return this._stroke},set:function(t){t=Ba(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t;}},{key:"strokeThickness",get:function(){return this._strokeThickness},set:function(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t;}},{key:"setStroke",value:function(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}},{key:"modifyPorperties",value:function(t){c(s(o.prototype),"modifyPorperties",this).call(this,t),t.hasOwnProperty("color")&&this.setColor(t.color,cu(t,"color2",null),cu(t,"horizontalGradient",!0)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,cu(t,"strokeThickness",2));}},{key:"renderContent",value:function(){var t=this.parent.padding,e=t.left,i=t.top,n=this.parent.width-t.left-t.right,r=this.parent.height-t.top-t.bottom,s=this.context;if(null!=this.color){var o,a;if(null!=this.color2)(a=this.horizontalGradient?s.createLinearGradient(0,0,n,0):s.createLinearGradient(0,0,0,r)).addColorStop(0,this.color),a.addColorStop(1,this.color2),o=a;else o=this.color;s.fillStyle=o,s.fillRect(e,i,n,r);}null!=this.stroke&&this.strokeThickness>0&&(s.strokeStyle=this.stroke,s.lineWidth=this.strokeThickness,s.strokeRect(e,i,n,r));}}]),o}(au),fu=Phaser.Utils.Objects.GetValue,vu=function(){function t(i,n){e(this,t),this.parent=i,this.set(n);}return n(t,[{key:"toJSON",value:function(){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}}},{key:"set",value:function(t){return this.setBold(fu(t,"bold",!1)),this.setItalic(fu(t,"italic",!1)),this.setFontSize(fu(t,"fontSize","16px")),this.setFontFamily(fu(t,"fontFamily","Courier")),this.setColor(fu(t,"color","#fff")),this.setStrokeStyle(fu(t,"stroke",null),fu(t,"strokeThickness",0)),this.setShadow(fu(t,"shadowColor",null),fu(t,"shadowOffsetX",0),fu(t,"shadowOffsetY",0),fu(t,"shadowBlur",0)),this.setOffset(fu(t,"offsetX",0),fu(t,"offsetY",0)),this.setSpace(fu(t,"leftSpace",0),fu(t,"rightSpace",0)),this.setAlign(fu(t,"align",void 0)),this.setBackgroundColor(fu(t,"backgroundColor",null)),this.setBackgroundHeight(fu(t,"backgroundHeight",void 0)),this.setBackgroundBottomY(fu(t,"backgroundBottomY",void 0)),this}},{key:"modify",value:function(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(hu("stroke",t,this),hu("strokeThickness",t,this)),t.hasOwnProperty("shadowColor")&&this.setShadowColor(t.shadowColor),(t.hasOwnProperty("shadowOffsetX")||t.hasOwnProperty("shadowOffsetY"))&&this.setShadowOffset(hu("shadowOffsetX",t,this),hu("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}},{key:"setUpdateTextFlag",value:function(){return this.parent&&(this.parent.updateTextFlag=!0),this}},{key:"clone",value:function(){return new t(null,this.toJSON())}},{key:"copyFrom",value:function(t){return this.set(t.toJSON()),this}},{key:"copyTo",value:function(t){return t.set(this.toJSON()),this}},{key:"setBold",value:function(t){return void 0===t&&(t=!0),this.bold=t,this.setUpdateTextFlag(),this}},{key:"setItalic",value:function(t){return void 0===t&&(t=!0),this.italic=t,this.setUpdateTextFlag(),this}},{key:"fontStyle",get:function(){return this.bold&&this.italic?"bold italic":this.bold?"bold":this.italic?"italic":""}},{key:"setFontSize",value:function(t){return "number"==typeof t&&(t="".concat(t,"px")),this.fontSize=t,this.setUpdateTextFlag(),this}},{key:"setFontFamily",value:function(t){return this.fontFamily=t,this.setUpdateTextFlag(),this}},{key:"font",get:function(){return "".concat(this.fontStyle," ").concat(this.fontSize," ").concat(this.fontFamily)}},{key:"setColor",value:function(t){return this.color=Ba(t),this}},{key:"hasFill",get:function(){return null!=this.color}},{key:"setStrokeStyle",value:function(t,e){return this.stroke=Ba(t),void 0!==e&&(this.strokeThickness=e),this}},{key:"setStrokeThickness",value:function(t){return this.strokeThickness=t,this}},{key:"hasStroke",get:function(){return null!=this.stroke&&this.strokeThickness>0}},{key:"setShadowColor",value:function(t){return this.shadowColor=Ba(t),this}},{key:"setShadowOffset",value:function(t,e){return void 0===t&&(t=0),void 0===e&&(e=0),this.shadowOffsetX=t,this.shadowOffsetY=e,this}},{key:"setShadowBlur",value:function(t){return void 0===t&&(t=0),this.shaodwBlur=t,this}},{key:"setShadow",value:function(t,e,i,n){return this.setShadowColor(t).setShadowOffset(e,i).setShadowBlur(n),this}},{key:"setBackgroundColor",value:function(t){return this.backgroundColor=Ba(t),this}},{key:"hasBackgroundColor",get:function(){return null!=this.backgroundColor}},{key:"setBackgroundHeight",value:function(t){return this.backgroundHeight=t,this}},{key:"setBackgroundBottomY",value:function(t){return this.backgroundBottomY=t,this}},{key:"setOffsetX",value:function(t){return void 0===t&&(t=0),this.offsetX=t,this}},{key:"setOffsetY",value:function(t){return void 0===t&&(t=0),this.offsetY=t,this}},{key:"setOffset",value:function(t,e){return this.setOffsetX(t).setOffsetY(e),this}},{key:"setLeftSpace",value:function(t){return void 0===t&&(t=0),this.leftSpace=t,this}},{key:"setRightSpace",value:function(t){return void 0===t&&(t=0),this.rightSpace=t,this}},{key:"setSpace",value:function(t,e){return this.setLeftSpace(t).setRightSpace(e),this}},{key:"setAlign",value:function(t){return this.align=t,this}},{key:"syncFont",value:function(t){return t.font=this.font,this}},{key:"syncStyle",value:function(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}},{key:"syncShadow",value:function(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);}},{key:"getTextMetrics",value:function(t,e){return this.syncFont(t).syncStyle(t),t.measureText(e)}}]),t}(),pu=Phaser.Utils.Array.Remove,gu=Phaser.Utils.Array.Remove,yu="text",mu="image",ku="drawer",bu="space",wu="command",xu=function(t){return t.type===yu&&"\n"===t.text},Su=function(t){return t.type===yu&&"\f"===t.text},Cu=function(t){return t.type===yu},_u=function(t){r(o,t);var i=l(o);function o(t,n,r){var s;return e(this,o),(s=i.call(this,t,yu)).updateTextFlag=!1,s.style=new vu(a(s),r),s.setText(n),s}return n(o,[{key:"autoRound",get:function(){return this.parent.autoRound}},{key:"offsetX",get:function(){return this.style.offsetX},set:function(t){this.style&&(this.style.offsetX=t);}},{key:"offsetY",get:function(){return this.style.offsetY},set:function(t){this.style&&(this.style.offsetY=t);}},{key:"leftSpace",get:function(){return this.style.leftSpace*this.scaleX},set:function(t){this.style&&(this.style.leftSpace=t),f(s(o.prototype),"leftSpace",t,this,!0);}},{key:"rightSpace",get:function(){return this.style.rightSpace*this.scaleX},set:function(t){this.style&&(this.style.rightSpace=t),f(s(o.prototype),"rightSpace",t,this,!0);}},{key:"align",get:function(){return this.style.align},set:function(t){this.style&&(this.style.align=t);}},{key:"modifyStyle",value:function(t){return this.setDirty(!0),this.style.modify(t),this.updateTextFlag&&this.updateTextSize(),this}},{key:"modifyPorperties",value:function(t){return t?(this.modifyStyle(t),c(s(o.prototype),"modifyPorperties",this).call(this,t),this):this}},{key:"setText",value:function(t){return this.setDirty(this.text!=t),this.text=t,this.updateTextSize(),this}},{key:"updateTextSize",value:function(){var t=this.text;if("\n"===t||"\f"===t||""===t)this.clearTextSize();else {var e,i,n=this.style.getTextMetrics(this.context,this.text);this.textWidth=n.width,"actualBoundingBoxAscent"in n?(e=n.actualBoundingBoxAscent,i=n.actualBoundingBoxDescent):(e=0,i=0),this.textHeight=e+i,this.ascent=e,this.descent=i;}return this.updateTextFlag=!1,this}},{key:"clearTextSize",value:function(){return this.textWidth=0,this.textHeight=0,this.ascent=0,this.descent=0,this}},{key:"copyTextSize",value:function(t){return this.textWidth=t.textWidth,this.textHeight=t.textHeight,this.ascent=t.ascent,this.descent=t.descent,this}},{key:"width",get:function(){return this.textWidth*this.scaleX},set:function(t){this.textWidth>0?this.scaleX=t/this.textWidth:this.scaleX=1;}},{key:"height",get:function(){return this.textHeight*this.scaleY},set:function(t){this.textHeight>0?this.scaleY=t/this.textHeight:this.scaleY=1;}},{key:"willRender",get:function(){return 0!==this.textWidth&&c(s(o.prototype),"willRender",this)}},{key:"renderContent",value:function(){var t=this.context,e=this.style;if(e.hasBackgroundColor){t.fillStyle=e.backgroundColor;var i=this.drawTLX,n=this.drawTRX-i,r=e.backgroundBottomY;null==r&&(r=this.drawBLY);var s=e.backgroundHeight;null==s&&(s=r-this.drawTLY);var o=r-s;t.fillRect(i,o,n,s);}var a=e.hasFill,h=e.hasStroke;(a||h)&&(e.syncFont(t).syncStyle(t),h&&(e.syncShadow(t),t.strokeText(this.text,0,0)),a&&(e.syncShadow(t),t.fillText(this.text,0,0)));}},{key:"drawTLX",get:function(){return -this.leftSpace}},{key:"drawTLY",get:function(){return -this.ascent}},{key:"drawBLX",get:function(){return -this.leftSpace}},{key:"drawBLY",get:function(){return this.descent}},{key:"drawTRX",get:function(){return this.textWidth+this.rightSpace}},{key:"drawTRY",get:function(){return -this.ascent}},{key:"drawBRX",get:function(){return this.textWidth+this.rightSpace}},{key:"drawBRY",get:function(){return this.descent}}]),o}(au),Ou=function(t,e){var i=this.createCharChildren(t,e);return this.addChild(i),this},Pu=function(t){r(s,t);var i=l(s);function s(t,n,r){var o;return e(this,s),(o=i.call(this,t,mu)).setTexture(n,r),o}return n(s,[{key:"frameWidth",get:function(){return this.frameObj?this.frameObj.cutWidth:0}},{key:"frameHeight",get:function(){return this.frameObj?this.frameObj.cutHeight:0}},{key:"offsetY",get:function(){return -this.height},set:function(t){}},{key:"key",get:function(){return this._key},set:function(t){this.setDirty(this._key!=t),this._key=t;}},{key:"frame",get:function(){return this._frame},set:function(t){this.setDirty(this._frame!=t),this._frame=t;}},{key:"setTexture",value:function(t,e){return this.key=t,this.frame=e,this.frameObj=this.scene.sys.textures.getFrame(t,e),this}},{key:"width",get:function(){return this.frameWidth*this.scaleX},set:function(t){this.setDirty(this.width!==t),this.scaleX=t/this.frameWidth;}},{key:"height",get:function(){return this.frameHeight*this.scaleY},set:function(t){this.setDirty(this.height!==t),this.scaleY=t/this.frameHeight;}},{key:"setHeight",value:function(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}},{key:"renderContent",value:function(){var t=this.context,e=this.frameObj,i=this.frameWidth,n=this.frameHeight;t.drawImage(e.source.image,e.cutX,e.cutY,i,n,0,0,i,n);}},{key:"drawTLX",get:function(){return -this.leftSpace}},{key:"drawTLY",get:function(){return 0}},{key:"drawBLX",get:function(){return -this.leftSpace}},{key:"drawBLY",get:function(){return this.frameHeight}},{key:"drawTRX",get:function(){return this.frameWidth+this.rightSpace}},{key:"drawTRY",get:function(){return 0}},{key:"drawBRX",get:function(){return this.frameWidth+this.rightSpace}},{key:"drawBRY",get:function(){return this.frameHeight}}]),s}(au),Tu=function(t){r(o,t);var i=l(o);function o(t,n,r,s){var a;return e(this,o),(a=i.call(this,t,ku)).setRenderCallback(n),a.setDrawerSize(r,s),a}return n(o,[{key:"setRenderCallback",value:function(t){return t?this.renderContent=t.bind(this):delete this.renderContent,this}},{key:"setDrawerSize",value:function(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}},{key:"onFree",value:function(){c(s(o.prototype),"onFree",this).call(this),this.setRenderCallback();}},{key:"width",get:function(){return this.drawerWidth*this.scaleX},set:function(t){this.setDirty(this.width!==t),this.scaleX=this.drawerWidth>0?t/this.drawerWidth:1;}},{key:"height",get:function(){return this.drawerHeight*this.scaleY},set:function(t){this.setDirty(this.height!==t),this.scaleY=this.drawerHeight>0?t/this.drawerHeight:1;}},{key:"offsetY",get:function(){return -this.height},set:function(t){}},{key:"drawTLX",get:function(){return -this.leftSpace}},{key:"drawTLY",get:function(){return 0}},{key:"drawBLX",get:function(){return -this.leftSpace}},{key:"drawBLY",get:function(){return this.drawerHeight}},{key:"drawTRX",get:function(){return this.drawerWidth+this.rightSpace}},{key:"drawTRY",get:function(){return 0}},{key:"drawBRX",get:function(){return this.drawerWidth+this.rightSpace}},{key:"drawBRY",get:function(){return this.drawerHeight}}]),o}(au),Eu=function(t){r(s,t);var i=l(s);function s(t,n){var r;return e(this,s),(r=i.call(this,t,bu)).setSpaceWidth(n),r}return n(s,[{key:"width",get:function(){return this.spaceWidth*this.scaleX},set:function(t){this.spaceWidth>0?this.scaleX=t/this.spaceWidth:this.scaleX=1;}},{key:"setSpaceWidth",value:function(t){return this.spaceWidth=t,this}}]),s}(au),Ru=function(t){r(o,t);var i=l(o);function o(t,n,r,s,a){var h;return e(this,o),(h=i.call(this,t,wu)).setName(n).setParameter(s).setCallback(r,a),h}return n(o,[{key:"setName",value:function(t){return this.name=t,this}},{key:"setParameter",value:function(t){return this.param=t,this}},{key:"setCallback",value:function(t,e){return this.callback=t,this.scope=e,this}},{key:"exec",value:function(){return this.scope?this.callback.call(this.scope,this.param,this.name):this.callback(this.param,this.name)}},{key:"onFree",value:function(){c(s(o.prototype),"onFree",this).call(this),this.setName().setCallback().setParameter();}}]),o}(Il),Mu=function(t,e,i,n){void 0===n&&(n={word:[],width:0}),n.word.length=0;for(var r=t.length,s=e,o=n.word,a=0;s0&&!a){var h=this.fixedHeight-n;if(i>0)s=h/i;else s=(l=Du.call(this)).height,o=l.ascent,i=Math.floor((h-o)/s);}else {var l;s=(l=Du.call(this)).height,o=l.ascent;}}else if(this.fixedHeight>0){if(void 0===(i=ju(t,"maxLines"))){h=this.fixedHeight-n;i=Math.floor(h/s);}}else i=ju(t,"maxLines",0);void 0===o&&(o=s);var u=0===i,c=ju(t,"wrapWidth",void 0);void 0===c&&(c=this.fixedWidth>0?this.fixedWidth-r:1/0);for(var d=ju(t,"letterSpacing",0),f=ju(t,"hAlign",0),v=ju(t,"vAlign",0),p=ju(t,"charWrap",!1),g={callback:"runWordWrap",start:e,isLastPage:!1,padding:this.wrapPadding,ascent:o,lineHeight:s,maxLines:i,wrapWidth:c,letterSpacing:d,hAlign:f,vAlign:v,charWrap:p,children:[],lines:[],maxLineWidth:0,linesHeight:0},y=this.children,m=0,k=y.length;m0&&(T.push({children:E,width:R}),M=Math.max(M,R)),g.start+=P.length,g.isLastPage=!L&&g.start===O,g.maxLineWidth=M,g.linesHeight=T.length*s;var X=this.fixedWidth>0?this.fixedWidth:g.maxLineWidth+r,Y=this.fixedHeight>0?this.fixedHeight:g.linesHeight+n;!function(t,e,i){var n,r,s=t.hAlign,o=t.vAlign,a=t.linesHeight;switch(o){case 1:case"center":r=(i-a)/2;break;case 2:case"bottom":r=i-a;break;default:r=0;}for(var h=t.lines,l=0,u=h.length;l0?(o=this.fixedWidth-r)/i:0;else if(this.fixedWidth>0){if(void 0===(i=Xu(t,"maxLines",void 0))){var o=this.fixedWidth-r;i=Math.floor(o/s)+1;}}else i=Xu(t,"maxLines",0);var a=0===i,h=Xu(t,"fixedChildHeight",void 0);if(void 0===h){var l=Xu(t,"charPerLine",void 0);if(void 0!==l){var u=this.fixedHeight-n;h=Math.floor(u/l);}}var c=Xu(t,"wrapHeight",void 0);void 0===c&&(c=this.fixedHeight>0?this.fixedHeight-n:1/0);for(var d=Xu(t,"letterSpacing",0),f=Xu(t,"rtl",!0),v=Xu(t,"hAlign",f?2:0),p=Xu(t,"vAlign",0),g={callback:"runVerticalWrap",start:e,isLastPage:!1,padding:this.wrapPadding,lineWidth:s,maxLines:i,fixedChildHeight:h,wrapHeight:c,letterSpacing:d,hAlign:v,vAlign:p,rtl:f,children:[],lines:[],maxLineHeight:0,linesWidth:0},y=this.children,m=0,k=y.length;m0&&(T.push({children:E,height:R}),M=Math.max(M,R)),g.start+=P.length,g.isLastPage=g.start===O,g.maxLineHeight=M,g.linesWidth=T.length*s;var F=this.fixedWidth>0?this.fixedWidth:g.linesWidth+r,W=this.fixedHeight>0?this.fixedHeight:g.maxLineHeight+n;!function(t,e,i){var n,r,s=t.hAlign,o=t.vAlign,a=t.rtl,h=t.lines,l=t.lineWidth,u=t.linesWidth;switch(s){case 1:case"center":n=(e-u)/2;break;case 2:case"right":n=e-u;break;default:n=0;}a&&(n+=l);for(var c=0,d=h.length;c0?t:this.width,e>0?e:this.height),this):this},setPadding:function(t,e){var i=this.padding,n=i.left,r=i.right,s=i.top,o=i.bottom;return Ne(i,t,e),this.dirty=this.dirty||n!=i.left||r!=i.right||s!=i.top||o!=i.bottom,this},getPadding:function(t){return Be(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),pu(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 gu(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,n,r,s=Array.isArray(t);void 0===e||e===this.children.length?s?(i=this.children).push.apply(i,v(t)):this.children.push(t):s?(n=this.children).splice.apply(n,[e,0].concat(v(t))):this.children.splice(e,0,t);(this.lastAppendedChildren.length=0,s)?(r=this.lastAppendedChildren).push.apply(r,v(t)):this.lastAppendedChildren.push(t);return this},createCharChild:function(t,e){e&&this.textStyle.modify(e);var i=this.poolManager.allocate(yu);return null===i?i=new _u(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=[],n=0,r=t.length;ne&&(n=e,r=t);})),r},getCharWorldPosition:function(t,e,i,n){return "number"==typeof t&&(t=this.getCharChild(t,!0)),iu(this,t,e,i,n)},setToMinSize:function(){for(var t=this.children,e=0,i=0,n=0,r=t.length;n=i.length&&(t=i.length);for(var n=0,r=0;rh;u--){for(c=0;c0&&this.wrapMode!==Ka&&0===this.wrapWidth}},{key:"setStyle",value:function(t,e,i){if(void 0===e&&(e=!0),void 0===i&&(i=!1),t&&t.hasOwnProperty("wrap")){var n=t.wrap;if(n.hasOwnProperty("mode")){var r=n.mode;"string"==typeof r&&(n.mode=ih[r]);}else n.hasOwnProperty("width")&&(n.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 s=this.propertyMap;for(var o in s){var a=s[o],h=a[0],l=i?a[1]:this[o],u=a[2];if("wrapCallback"===o||"wrapCallbackScope"===o)this[o]=th(t,h,l);else {var c=Qa(t,h,l);u&&(c=u(c)),this[o]=c;}}var d=th(t,"font",null);this._font=null===d?this.fontStyle+" "+this.fontSize+" "+this.fontFamily:d;var f=th(t,"fill",null);null!==f&&(this.color=Ba(f));var v=th(t,"metrics",!1);return v?this.metrics={ascent:th(v,"ascent",0),descent:th(v,"descent",0),fontSize:th(v,"fontSize",0)}:!e&&this.metrics||(this.metrics=Ga(this)),e?this.parent.updateText():this.parent}},{key:"syncFont",value:function(t,e){e.font=this._font;}},{key:"syncStyle",value:function(t,e){e.textBaseline="alphabetic",e.fillStyle=this.color,e.strokeStyle=this.stroke,e.lineWidth=this.strokeThickness,e.lineCap="round",e.lineJoin="round";}},{key:"syncShadow",value:function(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);}},{key:"update",value:function(t){return t&&(this._font="".concat(this.fontStyle," ").concat(this.fontSize," ").concat(this.fontFamily).trim(),this.metrics=Ga(this)),this.parent.updateText(t)}},{key:"buildFont",value:function(){var t="".concat(this.fontStyle," ").concat(this.fontSize," ").concat(this.fontFamily).trim();return t!==this._font&&(this._font=t),this}},{key:"setFont",value:function(t){return "string"==typeof t?(this.fontFamily=t,this.fontSize="",this.fontStyle=""):(this.fontFamily=th(t,"fontFamily","Courier"),this.fontSize=th(t,"fontSize","16px"),this.fontStyle=th(t,"fontStyle","")),this.update(!0)}},{key:"setFontFamily",value:function(t){return this.fontFamily=t,this.update(!0)}},{key:"setFontStyle",value:function(t){return this.fontStyle=t,this.update(!0)}},{key:"setFontSize",value:function(t){return "number"==typeof t&&(t=t.toString()+"px"),this.fontSize=t,this.update(!0)}},{key:"setTestString",value:function(t){return this.testString=t,this.update(!0)}},{key:"setFixedSize",value:function(t,e){return this.fixedWidth=t,this.fixedHeight=e,t&&(this.parent.width=t),e&&(this.parent.height=e),this.update(this.isWrapFitMode)}},{key:"setResolution",value:function(t){return this.resolution=t,this.update(!1)}},{key:"setLineSpacing",value:function(t){return this.lineSpacing=t,this.update(!1)}},{key:"setXOffset",value:function(t){return this.xOffset=t,this.update(!1)}},{key:"setBackgroundColor",value:function(t,e,i){return void 0===i&&(i=!0),this.backgroundColor=Ba(t,this.parent.canvas,this.parent.context),this.backgroundColor2=Ba(e,this.parent.canvas,this.parent.context),this.backgroundHorizontalGradient=i,this.update(!1)}},{key:"setBackgroundStrokeColor",value:function(t,e){return this.backgroundStrokeColor=Ba(t,this.parent.canvas,this.parent.context),this.backgroundStrokeLineWidth=e,this.update(!1)}},{key:"setBackgroundCornerRadius",value:function(t,e){return this.backgroundCornerRadius=t,this.backgroundCornerIteration=e,this.update(!1)}},{key:"setFill",value:function(t){return this.color=Ba(t,this.parent.canvas,this.parent.context),this.update(!1)}},{key:"setColor",value:function(t){return this.color=Ba(t,this.parent.canvas,this.parent.context),this.update(!1)}},{key:"setStroke",value:function(t,e){return void 0===t?this.strokeThickness=0:(void 0===e&&(e=this.strokeThickness),this.stroke=Ba(t,this.parent.canvas,this.parent.context),this.strokeThickness=e),this.update(!0)}},{key:"setShadow",value:function(t,e,i,n,r,s){return void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i="#000"),void 0===n&&(n=0),void 0===r&&(r=!1),void 0===s&&(s=!0),this.shadowOffsetX=t,this.shadowOffsetY=e,this.shadowColor=Ba(i,this.parent.canvas,this.parent.context),this.shadowBlur=n,this.shadowStroke=r,this.shadowFill=s,this.update(!1)}},{key:"setShadowOffset",value:function(t,e){return void 0===t&&(t=0),void 0===e&&(e=t),this.shadowOffsetX=t,this.shadowOffsetY=e,this.update(!1)}},{key:"setShadowColor",value:function(t){return void 0===t&&(t="#000"),this.shadowColor=Ba(t,this.parent.canvas,this.parent.context),this.update(!1)}},{key:"setShadowBlur",value:function(t){return void 0===t&&(t=0),this.shadowBlur=t,this.update(!1)}},{key:"setShadowStroke",value:function(t){return this.shadowStroke=t,this.update(!1)}},{key:"setShadowFill",value:function(t){return this.shadowFill=t,this.update(!1)}},{key:"setUnderline",value:function(t,e,i){return void 0===t&&(t="#000"),void 0===e&&(e=0),void 0===i&&(i=0),this.underlineColor=Ba(t,this.parent.canvas,this.parent.context),this.underlineThickness=e,this.underlineOffset=i,this.update(!1)}},{key:"setUnderlineColor",value:function(t){return void 0===t&&(t="#000"),this.underlineColor=Ba(t,this.parent.canvas,this.parent.context),this.update(!1)}},{key:"setUnderlineThickness",value:function(t){return void 0===t&&(t=0),this.underlineThickness=t,this.update(!1)}},{key:"setUnderlineOffset",value:function(t){return void 0===t&&(t=0),this.underlineOffset=t,this.update(!1)}},{key:"setStrikethrough",value:function(t,e,i){return void 0===t&&(t="#000"),void 0===e&&(e=0),void 0===i&&(i=0),this.strikethroughColor=Ba(t,this.parent.canvas,this.parent.context),this.strikethroughThickness=e,this.strikethroughOffset=i,this.update(!1)}},{key:"setStrikethroughColor",value:function(t){return void 0===t&&(t="#000"),this.strikethroughColor=Ba(t,this.parent.canvas,this.parent.context),this.update(!1)}},{key:"setStrikethroughThickness",value:function(t){return void 0===t&&(t=0),this.strikethroughThickness=t,this.update(!1)}},{key:"setStrikethroughOffset",value:function(t){return void 0===t&&(t=0),this.strikethroughOffset=t,this.update(!1)}},{key:"setWrapMode",value:function(t){return "string"==typeof t&&(t=ih[t.toLowerCase()]||0),this.wrapMode=t,this.update(!0)}},{key:"setWrapWidth",value:function(t){return this.wrapWidth=t,this.update(!1)}},{key:"setAlign",value:function(t,e){return void 0===t&&(t="left"),void 0===e&&(e="top"),this.halign=t,this.valign=e,this.update(!1)}},{key:"setHAlign",value:function(t){return void 0===t&&(t="left"),this.halign=t,this.update(!1)}},{key:"setVAlign",value:function(t){return void 0===t&&(t="top"),this.valign=t,this.update(!1)}},{key:"setMaxLines",value:function(t){return void 0===t&&(t=0),this.maxLines=t,this.update(!1)}},{key:"getTextMetrics",value:function(){var t=this.metrics;return {ascent:t.ascent,descent:t.descent,fontSize:t.fontSize}}},{key:"setTextMetrics",value:function(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=th(e,"fontFamily",this.fontFamily),this.fontSize=th(e,"fontSize",this.fontSize),this.fontStyle=th(e,"fontStyle",this.fontStyle))),this.parent.updateText(!0)}},{key:"lineHeight",get:function(){return this.metrics.fontSize+this.strokeThickness+this.lineSpacing}},{key:"toJSON",value:function(){var t={},e=this.propertyMap;for(var i in e)t[i]=this[i];return t.metrics=this.getTextMetrics(),t}},{key:"destroy",value:function(){this.parent=void 0;}}]),t}(),ih={none:Ka,word:qa,char:Za,character:Za},nh=Phaser.Math.DegToRad,rh=function(t){return !t.hasOwnProperty("convex")||t.convex},sh=function(t){return t.x>0&&t.y>0},oh=function(t,e,i,n,r,s,o,a,h){if(a&&o>s?o-=360:!a&&o=f?1:n/f,g=r>=v?1:r/v,y=d.cornerRadius;t.save(),t.beginPath(),t.translate(e,i),a=y.tl,sh(a)?(h=a.x*p,l=a.y*g,rh(a)?oh(t,h,l,h,l,180,270,!1,o):oh(t,0,0,h,l,90,0,!0,o),u=0,c=l):(t.lineTo(0,0),u=0,c=0),a=y.tr,sh(a)?(h=a.x*p,l=a.y*g,rh(a)?oh(t,n-h,l,h,l,270,360,!1,o):oh(t,n,0,h,l,180,90,!0,o)):t.lineTo(n,0),a=y.br,sh(a)?(h=a.x*p,l=a.y*g,rh(a)?oh(t,n-h,r-l,h,l,0,90,!1,o):oh(t,n,r,h,l,270,180,!0,o)):t.lineTo(n,r),a=y.bl,sh(a)?(h=a.x*p,l=a.y*g,rh(a)?oh(t,h,r-l,h,l,90,180,!1,o):oh(t,0,r,h,l,360,270,!0,o)):t.lineTo(0,r),t.lineTo(u,c),t.closePath(),t.restore();}(e,i,n,r,s,o,d),null!=a){var f;if(null!=u)(f=c?e.createLinearGradient(0,0,r,0):e.createLinearGradient(0,0,0,s)).addColorStop(0,a),f.addColorStop(1,u),a=f;e.fillStyle=a,e.fill();}null!=h&&l>0&&(e.strokeStyle=h,e.lineWidth=l,e.stroke());},hh=function(t,e,i,n,r,s,o,a){if(null!=e||null!=i){var h=t.canvas.width,l=t.canvas.height;null==i&&(n=0);var u=n/2;h=Math.max(1,h-n),l=Math.max(1,l-n),ah(t.canvas,t.context,u,u,h,l,r,e,i,n,s,o,a);}},lh={draw:function(t,e,i,n){var r=this.penManager;this.hitAreaManager.clear();var s=this.context;s.save();var o=this.defaultStyle;this.clear(),hh(this,o.backgroundColor,o.backgroundStrokeColor,o.backgroundStrokeLineWidth,o.backgroundCornerRadius,o.backgroundColor2,o.backgroundHorizontalGradient,o.backgroundCornerIteration),t+=this.startXOffset,e+=this.startYOffset;var a,h,l,u,c,d,f=o.halign,v=o.valign,p=o.lineHeight,g=r.lines,y=g.length,m=o.maxLines;m>0&&y>m?(h=m,l="center"===v?Math.floor((y-h)/2):"bottom"===v?y-h:0):(h=y,l=0),u=l+h;var k=this.rtl,b=k?this.parent.width:void 0;d="center"===v?Math.max((n-h*p)/2,0):"bottom"===v?Math.max(n-h*p-2,0):0,d+=e;for(var w=l;w0&&t.width>0){var a=i+o.underlineOffset-o.underlineThickness/2;this.drawLine(e,a,t.width,o.underlineThickness,o.underlineColor);}if(t.isTextPen&&this.drawText(e,i,t.text,o),t.isImagePen&&this.drawImage(e,i,t.prop.img,o),o.strikethroughThickness>0&&t.width>0){a=i+o.strikethroughOffset-o.strikethroughThickness/2;this.drawLine(e,a,t.width,o.strikethroughThickness,o.strikethroughColor);}if(s.restore(),t.hasAreaMarker&&t.width>0){var h,l=t.prop.area;if(l)h={key:l};else {var u=t.prop.url;h={key:"url:".concat(u),url:u};}this.hitAreaManager.add(e,i-this.startYOffset,t.width,this.defaultStyle.lineHeight,h);}},clear:function(){var t=this.canvas;this.context.clearRect(0,0,t.width,t.height);},drawLine:function(t,e,i,n,r){this.autoRound&&(t=Math.round(t),e=Math.round(e));var s=this.context,o=s.lineCap;s.lineCap="butt",s.strokeStyle=r,s.lineWidth=n,s.beginPath(),s.moveTo(t,e),s.lineTo(t+i,e),s.stroke(),s.lineCap=o;},drawText:function(t,e,i,n){this.autoRound&&(t=Math.round(t),e=Math.round(e));var r=this.context;n.stroke&&"none"!==n.stroke&&n.strokeThickness>0&&(n.syncShadow(r,n.shadowStroke),r.strokeText(i,t,e)),n.color&&"none"!==n.color&&(n.syncShadow(r,n.shadowFill),r.fillText(i,t,e));},drawImage:function(t,e,i,n){e-=this.startYOffset,this.parent.imageManager.draw(i,this.context,t,e,this.autoRound);}},uh=Phaser.Utils.Objects.GetValue,ch=Ua,dh=Va,fh=function(){function t(i){e(this,t),this.prop={},this.resetFromJSON(i);}return n(t,[{key:"resetFromJSON",value:function(t){this.text=uh(t,"text",""),this.x=uh(t,"x",0),this.y=uh(t,"y",0),this.width=uh(t,"width",0);var e=uh(t,"prop",null);null===e&&(e={}),this.prop=e,this.newLineMode=uh(t,"newLineMode",0),this.startIndex=uh(t,"startIndex",0);}},{key:"plainText",get:function(){var t=this.text;return this.newLineMode===dh&&(t+="\n"),t}},{key:"wrapText",get:function(){var t=this.text;return this.newLineMode!==ch&&(t+="\n"),t}},{key:"rawTextLength",get:function(){var t=this.text.length;return this.newLineMode===dh&&(t+=1),t}},{key:"endIndex",get:function(){return this.startIndex+this.rawTextLength}},{key:"lastX",get:function(){return this.x+this.width}},{key:"isTextPen",get:function(){return ""!==this.text}},{key:"isImagePen",get:function(){return !!this.prop.img}},{key:"hasAreaMarker",get:function(){return !!this.prop.area||!!this.prop.url}}]),t}(),vh=Phaser.Utils.Objects.GetFastValue,ph=Ua,gh=Ja,yh=function(){function t(i){e(this,t),this.pens=[],this.lines=[],this.maxLinesWidth=void 0,this.pensPool=i.pensPool,this.linesPool=i.linesPool,this.tagToText=vh(i,"tagToText",Qt),this.tagToTextScope=vh(i,"tagToTextScope",void 0);}return n(t,[{key:"destroy",value:function(){this.clear(),this.tagToText=void 0,this.tagToTextScope=void 0;}},{key:"clear",value:function(){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}},{key:"getLineEndIndex",value:function(t){t>=this.lines.length&&(t=this.lines.length-1);var e,i,n=!1;for(e=t;e>=0&&!(n=null!=(i=this.lines[e])&&i.length>0);e--);return n?i[i.length-1].endIndex:0}},{key:"getLineWidth",value:function(t){var e=this.lines[t];if(!e)return 0;var i=e[e.length-1];return null==i?0:i.lastX}},{key:"getMaxLineWidth",value:function(){if(void 0!==this.maxLinesWidth)return this.maxLinesWidth;for(var t,e=0,i=0,n=this.lines.length;ie&&(e=t);return this.maxLinesWidth=e,e}},{key:"getLineWidths",value:function(){for(var t=[],e=0,i=this.lines.length;e=t&&h<=e||(o=o.substring(t-a,e-a)),this.tagToTextScope?c+=this.tagToText.call(this.tagToTextScope,o,l,u):c+=this.tagToText(o,l,u),u=l,!(h>=e)));d++);return c}},{key:"length",get:function(){return this.lines.length},set:function(t){this.clear();}}]),t}(),mh={},kh=function(){function t(){e(this,t),this.items=[];}return n(t,[{key:"destroy",value:function(){this.clear(),this.items=void 0;}},{key:"pop",value:function(){return this.items.length>0?this.items.pop():null}},{key:"push",value:function(t){return this.items.push(t),this}},{key:"pushMultiple",value:function(t){return this.items.push.apply(this.items,t),t.length=0,this}},{key:"clear",value:function(){return this.items.length=0,this}}]),t}(),bh=Phaser.Geom.Rectangle,wh=new kh,xh=function(){function t(){e(this,t),this.hitAreas=[];}return n(t,[{key:"destroy",value:function(){this.clear();}},{key:"clear",value:function(){for(var t=0,e=this.hitAreas.length;tr){""!==C?a.push(o.getLine(C,_,Eh)):0===P&&s>0&&a.push(o.getLine("",0,Eh)),a.push.apply(a,v(t(b,i,Lh,r,0,o)));var E=a.pop();C=E.text,_=E.width,o.freeLine(E)," "===C&&(C="",_=0);}else (S=_+w)>l?(a.push(o.getLine(C,_,Eh)),C=b,_=w,l=r):(C+=b,_=S),x&&a.push(o.getLine(C,_,u));}return a},zh=Phaser.Utils.Objects.GetValue,jh=Ka,Fh=Ua,Wh=function(){function t(i){e(this,t),this.parent=i.parent,this.scene=this.parent.scene,this.context=zh(i,"context",null),this.canvas=this.context.canvas,this.parser=zh(i,"parser",null),this.defaultStyle=zh(i,"style",null),this.autoRound=!0,this.pensPool=i.pensPool,this.linesPool=i.linesPool,this.wrapTextLinesPool=i.wrapTextLinesPool,this.penManager=this.newPenManager(),this._tmpPenManager=null,this.hitAreaManager=new xh,this.lastHitAreaKey=null,this.urlTagCursorStyle=null;var n=this.context;this.getTextWidth=function(t){return n.measureText(t).width};}return n(t,[{key:"destroy",value:function(){this.parent=void 0,this.scene=void 0,this.context=void 0,this.canvas=void 0,this.parser=void 0,this.defaultStyle=void 0,this.penManager&&(this.penManager.destroy(),this.penManager=void 0),this._tmpPenManager&&(this._tmpPenManager.destroy(),this._tmpPenManager=void 0),this.hitAreaManager&&(this.hitAreaManager.destroy(),this.hitAreaManager=void 0),this.pensPool=void 0,this.linesPool=void 0,this.wrapTextLinesPool=void 0;}},{key:"updatePenManager",value:function(t,e,i,n,r){if(void 0===r&&(r=this.penManager),r.clear(),""===t)return r;var s=this.parent.style;if(s.isWrapFitMode){var o=this.parent.padding;i=s.fixedWidth-o.left-o.right;}for(var a,h,l,u,c,d=this.canvas,f=this.context,v=function(t){return f.measureText(t).width},p=0,g=0,y=s.wrapCallback,m=s.wrapCallbackScope,k=!0,b=this.parser.splitText(t),w=this.wrapTextLinesPool,x=0,S=b.length;x0&&e!==jh&&i0&&t>e&&(t=e),t}},{key:"linesWidth",get:function(){return Math.ceil(this.penManager.getMaxLineWidth())}},{key:"linesHeight",get:function(){var t=this.desplayLinesCount,e=this.defaultStyle.lineHeight*t;return t>0&&(e-=this.defaultStyle.lineSpacing),e}},{key:"imageManager",get:function(){return this.parent.imageManager}},{key:"rtl",get:function(){return this.parent.style.rtl}},{key:"newPenManager",value:function(){return new yh({pensPool:this.pensPool,linesPool:this.linesPool,tagToText:this.parser.propToTagText,tagToTextScope:this.parser})}},{key:"tmpPenManager",get:function(){return null===this._tmpPenManager&&(this._tmpPenManager=this.newPenManager()),this._tmpPenManager}},{key:"getPlainText",value:function(t,e,i){var n;if(null==t)n=this.penManager.plainText;else {var r=this.parser.splitText(t,1);n="";for(var s=0,o=r.length;s0}},{key:"drawX",get:function(){var t=this.x+this.leftSpace+this.offsetX-this.originX*this.width;return this.parent._textOX*this.scrollFactorX+t}},{key:"drawY",get:function(){var t=this.y+this.offsetY;return this.parent._textOY*this.scrollFactorY+t}},{key:"drawTLX",get:function(){return 0}},{key:"drawTLY",get:function(){return 0}},{key:"drawBLX",get:function(){return 0}},{key:"drawBLY",get:function(){return 0}},{key:"drawTRX",get:function(){return 0}},{key:"drawTRY",get:function(){return 0}},{key:"drawBRX",get:function(){return 0}},{key:"drawBRY",get:function(){return 0}},{key:"drawCenterX",get:function(){return (this.drawTRX+this.drawTLX)/2}},{key:"drawCenterY",get:function(){return (this.drawBLY+this.drawTLY)/2}}]),s}(Yl);Object.assign(au.prototype,nu);var hu=function(t,e,i){return e.hasOwnProperty(t)?e[t]:i[t]},lu=Phaser.Utils.Objects.GetValue,uu=function(t){r(o,t);var i=l(o);function o(t,n){var r;return e(this,o),(r=i.call(this,t,"background")).setScrollFactor(0),r.setColor(lu(n,"color",null),lu(n,"color2",null),lu(n,"horizontalGradient",!0)),r.setStroke(lu(n,"stroke",null),lu(n,"strokeThickness",2)),r.setCornerRadius(lu(n,"cornerRadius",0),lu(n,"cornerIteration",null)),r}return n(o,[{key:"color",get:function(){return this._color},set:function(t){t=Ba(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t;}},{key:"color2",get:function(){return this._color2},set:function(t){t=Ba(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t;}},{key:"horizontalGradient",get:function(){return this._horizontalGradient},set:function(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t;}},{key:"setColor",value:function(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}},{key:"stroke",get:function(){return this._stroke},set:function(t){t=Ba(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t;}},{key:"strokeThickness",get:function(){return this._strokeThickness},set:function(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t;}},{key:"setStroke",value:function(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}},{key:"cornerRadius",get:function(){return this._cornerRadius},set:function(t){this.setDirty(this._cornerRadius!=t),this._cornerRadius=t;}},{key:"cornerIteration",get:function(){return this._cornerIteration},set:function(t){this.setDirty(this._cornerIteration!=t),this._cornerIteration=t;}},{key:"modifyStyle",value:function(t){return t.hasOwnProperty("color")&&this.setColor(t.color,hu("color2",t,this),hu("horizontalGradient",t,this)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,hu("strokeThickness",t,this)),t.hasOwnProperty("cornerRadius")&&this.setCornerRadius(t.cornerRadius,hu("cornerIteration",t,this)),this}},{key:"modifyPorperties",value:function(t){return c(s(o.prototype),"modifyPorperties",this).call(this,t),this.modifyStyle(t),this}},{key:"setCornerRadius",value:function(t,e){return this.cornerRadius=t,this.cornerIteration=e,this}},{key:"renderContent",value:function(){hh(this.parent,this.color,this.stroke,this.strokeThickness,this.cornerRadius,this.color2,this.horizontalGradient,this.cornerIteration);}}]),o}(au),cu=Phaser.Utils.Objects.GetValue,du=function(t){r(o,t);var i=l(o);function o(t,n){var r;return e(this,o),(r=i.call(this,t,"innerbounds")).setScrollFactor(0),r.setColor(cu(n,"color",null),cu(n,"color2",null),cu(n,"horizontalGradient",!0)),r.setStroke(cu(n,"stroke",null),cu(n,"strokeThickness",2)),r}return n(o,[{key:"color",get:function(){return this._color},set:function(t){t=Ba(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t;}},{key:"color2",get:function(){return this._color2},set:function(t){t=Ba(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t;}},{key:"horizontalGradient",get:function(){return this._horizontalGradient},set:function(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t;}},{key:"setColor",value:function(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}},{key:"stroke",get:function(){return this._stroke},set:function(t){t=Ba(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t;}},{key:"strokeThickness",get:function(){return this._strokeThickness},set:function(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t;}},{key:"setStroke",value:function(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}},{key:"modifyPorperties",value:function(t){c(s(o.prototype),"modifyPorperties",this).call(this,t),t.hasOwnProperty("color")&&this.setColor(t.color,cu(t,"color2",null),cu(t,"horizontalGradient",!0)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,cu(t,"strokeThickness",2));}},{key:"renderContent",value:function(){var t=this.parent.padding,e=t.left,i=t.top,n=this.parent.width-t.left-t.right,r=this.parent.height-t.top-t.bottom,s=this.context;if(null!=this.color){var o,a;if(null!=this.color2)(a=this.horizontalGradient?s.createLinearGradient(0,0,n,0):s.createLinearGradient(0,0,0,r)).addColorStop(0,this.color),a.addColorStop(1,this.color2),o=a;else o=this.color;s.fillStyle=o,s.fillRect(e,i,n,r);}null!=this.stroke&&this.strokeThickness>0&&(s.strokeStyle=this.stroke,s.lineWidth=this.strokeThickness,s.strokeRect(e,i,n,r));}}]),o}(au),fu=Phaser.Utils.Objects.GetValue,vu=function(){function t(i,n){e(this,t),this.parent=i,this.set(n);}return n(t,[{key:"toJSON",value:function(){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}}},{key:"set",value:function(t){return this.setBold(fu(t,"bold",!1)),this.setItalic(fu(t,"italic",!1)),this.setFontSize(fu(t,"fontSize","16px")),this.setFontFamily(fu(t,"fontFamily","Courier")),this.setColor(fu(t,"color","#fff")),this.setStrokeStyle(fu(t,"stroke",null),fu(t,"strokeThickness",0)),this.setShadow(fu(t,"shadowColor",null),fu(t,"shadowOffsetX",0),fu(t,"shadowOffsetY",0),fu(t,"shadowBlur",0)),this.setOffset(fu(t,"offsetX",0),fu(t,"offsetY",0)),this.setSpace(fu(t,"leftSpace",0),fu(t,"rightSpace",0)),this.setAlign(fu(t,"align",void 0)),this.setBackgroundColor(fu(t,"backgroundColor",null)),this.setBackgroundHeight(fu(t,"backgroundHeight",void 0)),this.setBackgroundBottomY(fu(t,"backgroundBottomY",void 0)),this}},{key:"modify",value:function(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(hu("stroke",t,this),hu("strokeThickness",t,this)),t.hasOwnProperty("shadowColor")&&this.setShadowColor(t.shadowColor),(t.hasOwnProperty("shadowOffsetX")||t.hasOwnProperty("shadowOffsetY"))&&this.setShadowOffset(hu("shadowOffsetX",t,this),hu("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}},{key:"setUpdateTextFlag",value:function(){return this.parent&&(this.parent.updateTextFlag=!0),this}},{key:"clone",value:function(){return new t(null,this.toJSON())}},{key:"copyFrom",value:function(t){return this.set(t.toJSON()),this}},{key:"copyTo",value:function(t){return t.set(this.toJSON()),this}},{key:"setBold",value:function(t){return void 0===t&&(t=!0),this.bold=t,this.setUpdateTextFlag(),this}},{key:"setItalic",value:function(t){return void 0===t&&(t=!0),this.italic=t,this.setUpdateTextFlag(),this}},{key:"fontStyle",get:function(){return this.bold&&this.italic?"bold italic":this.bold?"bold":this.italic?"italic":""}},{key:"setFontSize",value:function(t){return "number"==typeof t&&(t="".concat(t,"px")),this.fontSize=t,this.setUpdateTextFlag(),this}},{key:"setFontFamily",value:function(t){return this.fontFamily=t,this.setUpdateTextFlag(),this}},{key:"font",get:function(){return "".concat(this.fontStyle," ").concat(this.fontSize," ").concat(this.fontFamily)}},{key:"setColor",value:function(t){return this.color=Ba(t),this}},{key:"hasFill",get:function(){return null!=this.color}},{key:"setStrokeStyle",value:function(t,e){return this.stroke=Ba(t),void 0!==e&&(this.strokeThickness=e),this}},{key:"setStrokeThickness",value:function(t){return this.strokeThickness=t,this}},{key:"hasStroke",get:function(){return null!=this.stroke&&this.strokeThickness>0}},{key:"setShadowColor",value:function(t){return this.shadowColor=Ba(t),this}},{key:"setShadowOffset",value:function(t,e){return void 0===t&&(t=0),void 0===e&&(e=0),this.shadowOffsetX=t,this.shadowOffsetY=e,this}},{key:"setShadowBlur",value:function(t){return void 0===t&&(t=0),this.shaodwBlur=t,this}},{key:"setShadow",value:function(t,e,i,n){return this.setShadowColor(t).setShadowOffset(e,i).setShadowBlur(n),this}},{key:"setBackgroundColor",value:function(t){return this.backgroundColor=Ba(t),this}},{key:"hasBackgroundColor",get:function(){return null!=this.backgroundColor}},{key:"setBackgroundHeight",value:function(t){return this.backgroundHeight=t,this}},{key:"setBackgroundBottomY",value:function(t){return this.backgroundBottomY=t,this}},{key:"setOffsetX",value:function(t){return void 0===t&&(t=0),this.offsetX=t,this}},{key:"setOffsetY",value:function(t){return void 0===t&&(t=0),this.offsetY=t,this}},{key:"setOffset",value:function(t,e){return this.setOffsetX(t).setOffsetY(e),this}},{key:"setLeftSpace",value:function(t){return void 0===t&&(t=0),this.leftSpace=t,this}},{key:"setRightSpace",value:function(t){return void 0===t&&(t=0),this.rightSpace=t,this}},{key:"setSpace",value:function(t,e){return this.setLeftSpace(t).setRightSpace(e),this}},{key:"setAlign",value:function(t){return this.align=t,this}},{key:"syncFont",value:function(t){return t.font=this.font,this}},{key:"syncStyle",value:function(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}},{key:"syncShadow",value:function(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);}},{key:"getTextMetrics",value:function(t,e){return this.syncFont(t).syncStyle(t),t.measureText(e)}}]),t}(),pu=Phaser.Utils.Array.Remove,gu=Phaser.Utils.Array.Remove,yu="text",mu="image",ku="drawer",bu="space",wu="command",xu=function(t){return t.type===yu&&"\n"===t.text},Su=function(t){return t.type===yu&&"\f"===t.text},Cu=function(t){return t.type===yu},_u=function(t){r(o,t);var i=l(o);function o(t,n,r){var s;return e(this,o),(s=i.call(this,t,yu)).updateTextFlag=!1,s.style=new vu(a(s),r),s.setText(n),s}return n(o,[{key:"autoRound",get:function(){return this.parent.autoRound}},{key:"offsetX",get:function(){return this.style.offsetX},set:function(t){this.style&&(this.style.offsetX=t);}},{key:"offsetY",get:function(){return this.style.offsetY},set:function(t){this.style&&(this.style.offsetY=t);}},{key:"leftSpace",get:function(){return this.style.leftSpace*this.scaleX},set:function(t){this.style&&(this.style.leftSpace=t),f(s(o.prototype),"leftSpace",t,this,!0);}},{key:"rightSpace",get:function(){return this.style.rightSpace*this.scaleX},set:function(t){this.style&&(this.style.rightSpace=t),f(s(o.prototype),"rightSpace",t,this,!0);}},{key:"align",get:function(){return this.style.align},set:function(t){this.style&&(this.style.align=t);}},{key:"modifyStyle",value:function(t){return this.setDirty(!0),this.style.modify(t),this.updateTextFlag&&this.updateTextSize(),this}},{key:"modifyPorperties",value:function(t){return t?(this.modifyStyle(t),c(s(o.prototype),"modifyPorperties",this).call(this,t),this):this}},{key:"setText",value:function(t){return this.setDirty(this.text!=t),this.text=t,this.updateTextSize(),this}},{key:"updateTextSize",value:function(){var t=this.text;if("\n"===t||"\f"===t||""===t)this.clearTextSize();else {var e,i,n=this.style.getTextMetrics(this.context,this.text);this.textWidth=n.width,"actualBoundingBoxAscent"in n?(e=n.actualBoundingBoxAscent,i=n.actualBoundingBoxDescent):(e=0,i=0),this.textHeight=e+i,this.ascent=e,this.descent=i;}return this.updateTextFlag=!1,this}},{key:"clearTextSize",value:function(){return this.textWidth=0,this.textHeight=0,this.ascent=0,this.descent=0,this}},{key:"copyTextSize",value:function(t){return this.textWidth=t.textWidth,this.textHeight=t.textHeight,this.ascent=t.ascent,this.descent=t.descent,this}},{key:"width",get:function(){return this.textWidth*this.scaleX},set:function(t){this.textWidth>0?this.scaleX=t/this.textWidth:this.scaleX=1;}},{key:"height",get:function(){return this.textHeight*this.scaleY},set:function(t){this.textHeight>0?this.scaleY=t/this.textHeight:this.scaleY=1;}},{key:"willRender",get:function(){return 0!==this.textWidth&&c(s(o.prototype),"willRender",this)}},{key:"renderContent",value:function(){var t=this.context,e=this.style;if(e.hasBackgroundColor){t.fillStyle=e.backgroundColor;var i=this.drawTLX,n=this.drawTRX-i,r=e.backgroundBottomY;null==r&&(r=this.drawBLY);var s=e.backgroundHeight;null==s&&(s=r-this.drawTLY);var o=r-s;t.fillRect(i,o,n,s);}var a=e.hasFill,h=e.hasStroke;(a||h)&&(e.syncFont(t).syncStyle(t),h&&(e.syncShadow(t),t.strokeText(this.text,0,0)),a&&(e.syncShadow(t),t.fillText(this.text,0,0)));}},{key:"drawTLX",get:function(){return -this.leftSpace}},{key:"drawTLY",get:function(){return -this.ascent}},{key:"drawBLX",get:function(){return -this.leftSpace}},{key:"drawBLY",get:function(){return this.descent}},{key:"drawTRX",get:function(){return this.textWidth+this.rightSpace}},{key:"drawTRY",get:function(){return -this.ascent}},{key:"drawBRX",get:function(){return this.textWidth+this.rightSpace}},{key:"drawBRY",get:function(){return this.descent}}]),o}(au),Ou=function(t,e){var i=this.createCharChildren(t,e);return this.addChild(i),this},Pu=function(t){r(s,t);var i=l(s);function s(t,n,r){var o;return e(this,s),(o=i.call(this,t,mu)).setTexture(n,r),o}return n(s,[{key:"frameWidth",get:function(){return this.frameObj?this.frameObj.cutWidth:0}},{key:"frameHeight",get:function(){return this.frameObj?this.frameObj.cutHeight:0}},{key:"offsetY",get:function(){return -this.height},set:function(t){}},{key:"key",get:function(){return this._key},set:function(t){this.setDirty(this._key!=t),this._key=t;}},{key:"frame",get:function(){return this._frame},set:function(t){this.setDirty(this._frame!=t),this._frame=t;}},{key:"setTexture",value:function(t,e){return this.key=t,this.frame=e,this.frameObj=this.scene.sys.textures.getFrame(t,e),this}},{key:"width",get:function(){return this.frameWidth*this.scaleX},set:function(t){this.setDirty(this.width!==t),this.scaleX=t/this.frameWidth;}},{key:"height",get:function(){return this.frameHeight*this.scaleY},set:function(t){this.setDirty(this.height!==t),this.scaleY=t/this.frameHeight;}},{key:"setHeight",value:function(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}},{key:"renderContent",value:function(){var t=this.context,e=this.frameObj,i=this.frameWidth,n=this.frameHeight;t.drawImage(e.source.image,e.cutX,e.cutY,i,n,0,0,i,n);}},{key:"drawTLX",get:function(){return -this.leftSpace}},{key:"drawTLY",get:function(){return 0}},{key:"drawBLX",get:function(){return -this.leftSpace}},{key:"drawBLY",get:function(){return this.frameHeight}},{key:"drawTRX",get:function(){return this.frameWidth+this.rightSpace}},{key:"drawTRY",get:function(){return 0}},{key:"drawBRX",get:function(){return this.frameWidth+this.rightSpace}},{key:"drawBRY",get:function(){return this.frameHeight}}]),s}(au),Tu=function(t){r(o,t);var i=l(o);function o(t,n,r,s){var a;return e(this,o),(a=i.call(this,t,ku)).setRenderCallback(n),a.setDrawerSize(r,s),a}return n(o,[{key:"setRenderCallback",value:function(t){return t?this.renderContent=t.bind(this):delete this.renderContent,this}},{key:"setDrawerSize",value:function(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}},{key:"onFree",value:function(){c(s(o.prototype),"onFree",this).call(this),this.setRenderCallback();}},{key:"width",get:function(){return this.drawerWidth*this.scaleX},set:function(t){this.setDirty(this.width!==t),this.scaleX=this.drawerWidth>0?t/this.drawerWidth:1;}},{key:"height",get:function(){return this.drawerHeight*this.scaleY},set:function(t){this.setDirty(this.height!==t),this.scaleY=this.drawerHeight>0?t/this.drawerHeight:1;}},{key:"offsetY",get:function(){return -this.height},set:function(t){}},{key:"drawTLX",get:function(){return -this.leftSpace}},{key:"drawTLY",get:function(){return 0}},{key:"drawBLX",get:function(){return -this.leftSpace}},{key:"drawBLY",get:function(){return this.drawerHeight}},{key:"drawTRX",get:function(){return this.drawerWidth+this.rightSpace}},{key:"drawTRY",get:function(){return 0}},{key:"drawBRX",get:function(){return this.drawerWidth+this.rightSpace}},{key:"drawBRY",get:function(){return this.drawerHeight}}]),o}(au),Eu=function(t){r(s,t);var i=l(s);function s(t,n){var r;return e(this,s),(r=i.call(this,t,bu)).setSpaceWidth(n),r}return n(s,[{key:"width",get:function(){return this.spaceWidth*this.scaleX},set:function(t){this.spaceWidth>0?this.scaleX=t/this.spaceWidth:this.scaleX=1;}},{key:"setSpaceWidth",value:function(t){return this.spaceWidth=t,this}}]),s}(au),Ru=function(t){r(o,t);var i=l(o);function o(t,n,r,s,a){var h;return e(this,o),(h=i.call(this,t,wu)).setName(n).setParameter(s).setCallback(r,a),h}return n(o,[{key:"setName",value:function(t){return this.name=t,this}},{key:"setParameter",value:function(t){return this.param=t,this}},{key:"setCallback",value:function(t,e){return this.callback=t,this.scope=e,this}},{key:"exec",value:function(){return this.scope?this.callback.call(this.scope,this.param,this.name):this.callback(this.param,this.name)}},{key:"onFree",value:function(){c(s(o.prototype),"onFree",this).call(this),this.setName().setCallback().setParameter();}}]),o}(Yl),Mu=function(t,e,i,n){void 0===n&&(n={word:[],width:0}),n.word.length=0;for(var r=t.length,s=e,o=n.word,a=0;s0&&!a){var h=this.fixedHeight-n;if(i>0)s=h/i;else s=(l=Du.call(this)).height,o=l.ascent,i=Math.floor((h-o)/s);}else {var l;s=(l=Du.call(this)).height,o=l.ascent;}}else if(this.fixedHeight>0){if(void 0===(i=ju(t,"maxLines"))){h=this.fixedHeight-n;i=Math.floor(h/s);}}else i=ju(t,"maxLines",0);void 0===o&&(o=s);var u=0===i,c=ju(t,"wrapWidth",void 0);void 0===c&&(c=this.fixedWidth>0?this.fixedWidth-r:1/0);for(var d=ju(t,"letterSpacing",0),f=ju(t,"hAlign",0),v=ju(t,"vAlign",0),p=ju(t,"charWrap",!1),g={callback:"runWordWrap",start:e,isLastPage:!1,padding:this.wrapPadding,ascent:o,lineHeight:s,maxLines:i,wrapWidth:c,letterSpacing:d,hAlign:f,vAlign:v,charWrap:p,children:[],lines:[],maxLineWidth:0,linesHeight:0},y=this.children,m=0,k=y.length;m0&&(T.push({children:E,width:R}),M=Math.max(M,R)),g.start+=P.length,g.isLastPage=!L&&g.start===O,g.maxLineWidth=M,g.linesHeight=T.length*s;var X=this.fixedWidth>0?this.fixedWidth:g.maxLineWidth+r,I=this.fixedHeight>0?this.fixedHeight:g.linesHeight+n;!function(t,e,i){var n,r,s=t.hAlign,o=t.vAlign,a=t.linesHeight;switch(o){case 1:case"center":r=(i-a)/2;break;case 2:case"bottom":r=i-a;break;default:r=0;}for(var h=t.lines,l=0,u=h.length;l0?(o=this.fixedWidth-r)/i:0;else if(this.fixedWidth>0){if(void 0===(i=Xu(t,"maxLines",void 0))){var o=this.fixedWidth-r;i=Math.floor(o/s)+1;}}else i=Xu(t,"maxLines",0);var a=0===i,h=Xu(t,"fixedChildHeight",void 0);if(void 0===h){var l=Xu(t,"charPerLine",void 0);if(void 0!==l){var u=this.fixedHeight-n;h=Math.floor(u/l);}}var c=Xu(t,"wrapHeight",void 0);void 0===c&&(c=this.fixedHeight>0?this.fixedHeight-n:1/0);for(var d=Xu(t,"letterSpacing",0),f=Xu(t,"rtl",!0),v=Xu(t,"hAlign",f?2:0),p=Xu(t,"vAlign",0),g={callback:"runVerticalWrap",start:e,isLastPage:!1,padding:this.wrapPadding,lineWidth:s,maxLines:i,fixedChildHeight:h,wrapHeight:c,letterSpacing:d,hAlign:v,vAlign:p,rtl:f,children:[],lines:[],maxLineHeight:0,linesWidth:0},y=this.children,m=0,k=y.length;m0&&(T.push({children:E,height:R}),M=Math.max(M,R)),g.start+=P.length,g.isLastPage=g.start===O,g.maxLineHeight=M,g.linesWidth=T.length*s;var F=this.fixedWidth>0?this.fixedWidth:g.linesWidth+r,W=this.fixedHeight>0?this.fixedHeight:g.maxLineHeight+n;!function(t,e,i){var n,r,s=t.hAlign,o=t.vAlign,a=t.rtl,h=t.lines,l=t.lineWidth,u=t.linesWidth;switch(s){case 1:case"center":n=(e-u)/2;break;case 2:case"right":n=e-u;break;default:n=0;}a&&(n+=l);for(var c=0,d=h.length;c0?t:this.width,e>0?e:this.height),this):this},setPadding:function(t,e){var i=this.padding,n=i.left,r=i.right,s=i.top,o=i.bottom;return Ne(i,t,e),this.dirty=this.dirty||n!=i.left||r!=i.right||s!=i.top||o!=i.bottom,this},getPadding:function(t){return Be(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),pu(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 gu(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,n,r,s=Array.isArray(t);void 0===e||e===this.children.length?s?(i=this.children).push.apply(i,v(t)):this.children.push(t):s?(n=this.children).splice.apply(n,[e,0].concat(v(t))):this.children.splice(e,0,t);(this.lastAppendedChildren.length=0,s)?(r=this.lastAppendedChildren).push.apply(r,v(t)):this.lastAppendedChildren.push(t);return this},createCharChild:function(t,e){e&&this.textStyle.modify(e);var i=this.poolManager.allocate(yu);return null===i?i=new _u(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=[],n=0,r=t.length;ne&&(n=e,r=t);})),r},getCharWorldPosition:function(t,e,i,n){return "number"==typeof t&&(t=this.getCharChild(t,!0)),iu(this,t,e,i,n)},setToMinSize:function(){for(var t=this.children,e=0,i=0,n=0,r=t.length;n=i.length&&(t=i.length);for(var n=0,r=0;rt.length)&&(e=t.length);for(var i=0,n=new Array(e);i=0;i--)(e=this.children[i]).parentContainer||e.displayList||e.destroy(t);this.clear(!t),c(s(o.prototype),"destroy",this).call(this,t);}}},{key:"contains",value:function(t){return -1!==this.children.indexOf(t)}},{key:"add",value:function(t){var e=this;return k(this.children,t,0,(function(t){t.once("destroy",e.onChildDestroy,e);}),this),this}},{key:"remove",value:function(t,e){var i=this;return C(this.children,t,(function(t){t.off("destroy",i.onChildDestroy,i),e&&t.destroy();})),this}},{key:"onChildDestroy",value:function(t,e){this.remove(t,!1);}},{key:"clear",value:function(t){for(var e,i=0,n=this.children.length;i0;){var n=i.shift();!e(n)&&n.isRexContainerLite&&i.push.apply(i,v(n.children));}},it=Phaser.Utils.Array,nt={getChildren:function(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},Ve=/(\S+)\[(\d+)\]/i,Ne=Phaser.Utils.Objects.GetValue,Fe=function(t,e){return void 0===e?t:t[e]},He=function(e,i,n){void 0===e&&(e={}),void 0===i&&(i=0);var r=t(i);return "string"===r?e[i]=n:"number"===r?(e.left=i,e.right=i,e.top=i,e.bottom=i):(e.left=Ne(i,"left",0),e.right=Ne(i,"right",0),e.top=Ne(i,"top",0),e.bottom=Ne(i,"bottom",0)),e},Be={getInnerPadding:function(t){return Fe(this.space,t)},setInnerPadding:function(t,e){return He(this.space,t,e),this},getOuterPadding:function(t){return Fe(this.getSizerConfig(this).padding,t)},setOuterPadding:function(t,e){return He(this.getSizerConfig(this).padding,t,e),this},getChildOuterPadding:function(t,e){return "string"==typeof t&&(t=this.getElement(t)),Fe(this.getSizerConfig(t).padding,e)},setChildOuterPadding:function(t,e,i){return "string"==typeof t&&(t=this.getElement(t)),He(this.getSizerConfig(t).padding,e,i),this}},Ge=function(t){var e=this.childrenWidth,i=void 0!==this.minWidth?this.minWidth:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn("Layout width warn: ".concat(this.constructor.name,"'s minWidth (").concat(i,") < childrenWidth (").concat(e,")"))):this.layoutWarnEnable&&(i>t||e>t)&&console.warn("Layout width warn: ".concat(this.constructor.name,"'s minWidth (").concat(i,") or childrenWidth (").concat(e," > targetWidth ").concat(t,")")),t},Ue=function(t){var e=this.childrenHeight,i=void 0!==this.minHeight?this.minHeight:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn("Layout height warn: ".concat(this.constructor.name,"'s minHeight (").concat(i,") < childrenHeight (").concat(e,")"))):this.layoutWarnEnable&&(i>t||e>t)&&console.warn("Layout height warn: ".concat(this.constructor.name,"'s minHeight (").concat(i,") or childrenHeight (").concat(e,") > targetHeight (").concat(t,")")),t},Je={getShownChildren:function(t){void 0===t&&(t=[]);for(var e,i=this.children,n=0,r=i.length;n0;){var i=e.shift();i.rexSizer&&i.rexSizer.hidden||(i!==this&&t.push(i),i.isRexContainerLite&&e.push.apply(e,v(i.children)));}return t}},Ke=function(){this._childrenWidth=void 0,this._childrenHeight=void 0;for(var t,e=this.getChildrenSizers(),i=0,n=e.length;i0?-this.delay:0,this.state=this.nowTime>=0?yi:gi,this.repeatCounter=0,this}},{key:"stop",value:function(){return this.state=pi,this}},{key:"update",value:function(t,e){this.state!==pi&&this.state!==bi&&0!==e&&0!==this.timeScale&&(this.nowTime+=e*this.timeScale,this.justRestart=!1,this.nowTime>=this.duration?-1===this.repeat||this.repeatCounter0&&(this.nowTime-=this.repeatDelay,this.state=mi)):(this.nowTime=this.duration,this.state=bi):this.nowTime>=0&&(this.state=yi));}},{key:"t",get:function(){var t;switch(this.state){case pi:case gi:case mi:t=0;break;case yi:t=this.nowTime/this.duration;break;case bi:t=1;}return fi(t,0,1)},set:function(t){(t=fi(t,-1,1))<0?(this.state=gi,this.nowTime=-this.delay*t):(this.state=yi,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++);}},{key:"setT",value:function(t){return this.t=t,this}},{key:"isIdle",get:function(){return this.state===pi}},{key:"isDelay",get:function(){return this.state===gi}},{key:"isCountDown",get:function(){return this.state===yi}},{key:"isRunning",get:function(){return this.state===gi||this.state===yi}},{key:"isDone",get:function(){return this.state===bi}},{key:"isOddIteration",get:function(){return 1==(1&this.repeatCounter)}},{key:"isEvenIteration",get:function(){return 0==(1&this.repeatCounter)}}]),t}(),pi=0,gi=1,yi=2,mi=3,bi=-1,ki=function(t){r(o,t);var i=l(o);function o(t,n){var r;return e(this,o),(r=i.call(this,t,n)).timer=new vi,r}return n(o,[{key:"shutdown",value:function(t){this.isShutdown||(c(s(o.prototype),"shutdown",this).call(this,t),this.timer.destroy(),this.timer=void 0);}},{key:"start",value:function(){return this.timer.start(),c(s(o.prototype),"start",this).call(this),this}},{key:"stop",value:function(){return this.timer.stop(),c(s(o.prototype),"stop",this).call(this),this}},{key:"complete",value:function(){return this.timer.stop(),c(s(o.prototype),"complete",this).call(this),this}}]),o}(ui),Ci=Phaser.Utils.Objects.GetValue,xi=Phaser.Utils.Objects.GetAdvancedValue,Si=Phaser.Tweens.Builders.GetEaseFunction,wi=function(t){r(o,t);var i=l(o);function o(){return e(this,o),i.apply(this,arguments)}return n(o,[{key:"resetFromJSON",value:function(t){return this.timer.resetFromJSON(Ci(t,"timer")),this.setEnable(Ci(t,"enable",!0)),this.setTarget(Ci(t,"target",this.parent)),this.setDelay(xi(t,"delay",0)),this.setDuration(xi(t,"duration",1e3)),this.setEase(Ci(t,"ease","Linear")),this.setRepeat(Ci(t,"repeat",0)),this}},{key:"setEnable",value:function(t){return null==t&&(t=!0),this.enable=t,this}},{key:"setTarget",value:function(t){return void 0===t&&(t=this.parent),this.target=t,this}},{key:"setDelay",value:function(t){return this.delay=t,this}},{key:"setDuration",value:function(t){return this.duration=t,this}},{key:"setRepeat",value:function(t){return this.repeat=t,this}},{key:"setRepeatDelay",value:function(t){return this.repeatDelay=t,this}},{key:"setEase",value:function(t){return void 0===t&&(t="Linear"),this.ease=t,this.easeFn=Si(t),this}},{key:"start",value:function(){return this.timer.isRunning||c(s(o.prototype),"start",this).call(this),this}},{key:"restart",value:function(){return this.timer.stop(),this.start.apply(this,arguments),this}},{key:"stop",value:function(t){return void 0===t&&(t=!1),c(s(o.prototype),"stop",this).call(this),t&&(this.timer.setT(1),this.updateGameObject(this.target,this.timer),this.complete()),this}},{key:"update",value:function(t,e){if(!this.isRunning||!this.enable||!this.parent.active)return this;var i=this.target,n=this.timer;return n.update(t,e),n.isDelay||this.updateGameObject(i,n),this.emit("update",i,this),n.isDone&&this.complete(),this}},{key:"updateGameObject",value:function(t,e){}}]),o}(ki),_i=Phaser.Utils.Objects.GetValue,Oi=Phaser.Utils.Objects.GetAdvancedValue,Pi=Phaser.Math.Linear,Ei=function(t){r(o,t);var i=l(o);function o(t,n){var r;return e(this,o),(r=i.call(this,t,n)).scaleStart={},r.scaleEnd={},r.resetFromJSON(n),r.boot(),r}return n(o,[{key:"resetFromJSON",value:function(t){return c(s(o.prototype),"resetFromJSON",this).call(this,t),this.setMode(_i(t,"mode",0)),this.setScaleRange(Oi(t,"start",void 0),Oi(t,"end",0)),this}},{key:"setMode",value:function(t){return "string"==typeof t&&(t=Ti[t]),this.mode=t,this}},{key:"setScaleRange",value:function(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}},{key:"start",value:function(){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),c(s(o.prototype),"start",this).call(this),this}},{key:"updateGameObject",value:function(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));}},{key:"complete",value:function(){return c(s(o.prototype),"complete",this).call(this),1===this.mode&&this.parent.destroy(),this}}]),o}(wi),Ti={stop:0,destroy:1,yoyo:2},Mi=function(t,e,i,n,r){var s,o;switch(void 0===n&&(n="Cubic"),i){case 0:case"x":s={x:0},o={x:t.scaleX};break;case 1:case"y":s={y:0},o={y:t.scaleY};break;default:s=0,o=t.scale;}var a={mode:0,start:s,end:o,duration:e,ease:n};return void 0===r?r=new Ei(t,a):r.resetFromJSON(a),r.restart(),r},Di=function(t,e,i,n,r,s){void 0===n&&(n="Linear"),r instanceof Ei&&(s=r,r=void 0),void 0===r&&(r=!0);var o={};switch(o.mode=r?1:0,i){case 0:case"x":o.end={x:0};break;case 1:case"y":o.end={y:0};break;default:o.end=0;}return o.duration=e,o.ease=n,void 0===s?s=new Ei(t,o):s.resetFromJSON(o),s.restart(),s},Ri=function(t,e){return new Promise((function(i,n){t.once(e,(function(){i();}));}))},ji=function(t){return Ri(t,"complete")},Li=Phaser.Utils.Objects.IsPlainObject,zi=function(t,e){e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0);})),e.on("update",(function(){var e=Ye.getParentSizer(t);e&&e.resetChildPositionState(t);}));},Ai={popUp:function(t,e,i){if(Li(t)){var n=t;t=n.duration,e=n.orientation,i=n.ease;}var r=void 0===this._scaleBehavior;return this._scaleBehavior=Mi(this,t,e,i,this._scaleBehavior),r&&zi(this,this._scaleBehavior),this._scaleBehavior.completeEventName="popup.complete",this},popUpPromise:function(t,e,i){return this.popUp(t,e,i),ji(this._scaleBehavior)},scaleDownDestroy:function(t,e,i,n){if(Li(t)){var r=t;t=r.duration,e=r.orientation,i=r.ease,n=r.destroy;}var s=void 0===this._scaleBehavior;return this._scaleBehavior=Di(this,t,e,i,n,this._scaleBehavior),s&&zi(this,this._scaleBehavior),this._scaleBehavior.completeEventName="scaledown.complete",this},scaleDownDestroyPromise:function(t,e,i,n){return this.scaleDownDestroy(t,e,i,n),ji(this._scaleBehavior)},scaleDown:function(t,e,i){return this.scaleDownDestroy(t,e,i,!1),this},scaleDownPromise:function(t,e,i){return this.scaleDown(t,e,i),ji(this._scaleBehavior)},scaleYoyo:function(t,e,i,n,r){if(Li(t)){var s=t;t=s.duration,e=s.peakValue,i=s.repeat,n=s.orientation,r=s.ease;}var o=void 0===this._scaleBehavior;return this._scaleBehavior=function(t,e,i,n,r,s,o){var a,h;switch(void 0===i&&(i=1.2),void 0===n&&(n=0),void 0===s&&(s="Cubic"),r){case 0:case"x":a={x:t.scaleX},h={x:i};break;case 1:case"y":a={y:t.scaleX},h={y:i};break;default:a=t.scaleX,h=i;}var l={mode:2,start:a,end:h,duration:e/2,ease:s,repeat:n};return void 0===o?o=new Ei(t,l):o.resetFromJSON(l),o.restart(),o}(this,t,e,i,n,r,this._scaleBehavior),o&&zi(this,this._scaleBehavior),this._scaleBehavior.completeEventName="scaleyoyo.complete",this},scaleYoyoPromise:function(t,e,i,n,r){return this.scaleYoyo(t,e,i,n,r),ji(this._scaleBehavior)}},Yi=Phaser.Utils.Objects.GetValue,Ii=Phaser.Utils.Objects.GetAdvancedValue,Xi=Phaser.Math.Linear,Wi=function(t){r(o,t);var i=l(o);function o(t,n){var r;return e(this,o),(r=i.call(this,t,n)).resetFromJSON(n),r.boot(),r}return n(o,[{key:"resetFromJSON",value:function(t){return c(s(o.prototype),"resetFromJSON",this).call(this,t),this.setMode(Yi(t,"mode",0)),this.setAlphaRange(Ii(t,"start",this.parent.alpha),Ii(t,"end",0)),this}},{key:"setMode",value:function(t){return "string"==typeof t&&(t=Vi[t]),this.mode=t,this}},{key:"setAlphaRange",value:function(t,e){return this.alphaStart=t,this.alphaEnd=e,this}},{key:"start",value:function(){return this.timer.isRunning||(this.parent.setAlpha(this.alphaStart),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),c(s(o.prototype),"start",this).call(this)),this}},{key:"updateGameObject",value:function(t,e){var i=e.t;e.isOddIteration&&(i=1-i),t.alpha=Xi(this.alphaStart,this.alphaEnd,i);}},{key:"complete",value:function(){return c(s(o.prototype),"complete",this).call(this),1===this.mode&&this.parent.destroy(),this}}]),o}(wi),Vi={stop:0,destroy:1,yoyo:2},Ni=Phaser.Utils.Objects.IsPlainObject,Fi=function(t,e,i,n){var r,s;Ni(i)?(r=i.start,s=i.end):s=i,void 0===r&&(r=0),void 0===s&&(s=1);var o={mode:0,start:r,end:s,duration:e};return void 0===n?n=new Wi(t,o):n.resetFromJSON(o),n.restart(),n},Hi=function(t,e,i,n){i instanceof Wi&&(n=i,i=void 0),void 0===i&&(i=!0);var r={mode:i?1:0,end:0,duration:e};return void 0===n?n=new Wi(t,r):n.resetFromJSON(r),n.restart(),n},Bi=Phaser.Utils.Objects.IsPlainObject,Gi=function(t,e){e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0);})),e.on("update",(function(){var e=Ye.getParentSizer(t);e&&e.resetChildAlphaState(t);}));},Ui={fadeIn:function(t,e){if(Bi(t)){var i=t;t=i.duration,e=i.alpha;}var n=void 0===this._fade;return this._fade=Fi(this,t,e,this._fade),n&&Gi(this,this._fade),this._fade.completeEventName="fadein.complete",this},fadeInPromise:function(t,e){return this.fadeIn(t,e),ji(this._fade)},fadeOutDestroy:function(t,e){if(Bi(t)){var i=t;t=i.duration,e=i.destroy;}var n=void 0===this._fade;return this._fade=Hi(this,t,e,this._fade),n&&Gi(this,this._fade),this._fade.completeEventName="fadeout.complete",this},fadeOutDestroyPromise:function(t,e){return this.fadeOutDestroy(t,e),ji(this._fade)},fadeOut:function(t){return this.fadeOutDestroy(t,!1),this},fadeOutPromise:function(t){return this.fadeOut(t),ji(this._fade)}},Ji=Phaser.Utils.Objects.GetValue,Ki=Phaser.Utils.Objects.GetAdvancedValue,qi=Phaser.Math.Linear,Zi=function(t){r(o,t);var i=l(o);function o(t,n){var r;return e(this,o),(r=i.call(this,t,n)).resetFromJSON(n),r.boot(),r}return n(o,[{key:"resetFromJSON",value:function(t){if(c(s(o.prototype),"resetFromJSON",this).call(this,t),this.setMode(Ji(t,"mode",0)),t&&(t.hasOwnProperty("x")||t.hasOwnProperty("y"))){var e=Ki(t,"x",void 0),i=Ki(t,"y",void 0);this.setTargetPosition(e,i);}else this.setTargetPosition(t);return this}},{key:"setMode",value:function(t){return "string"==typeof t&&(t=Qi[t]),this.mode=t,this}},{key:"setTargetPosition",value:function(t,e){if("number"==typeof t||"number"==typeof e)this.startX=this.parent.x,this.startY=this.parent.y,this.endX=t,this.endY=e;else {var i=t;this.startX=Ki(i,"startX",void 0),this.startY=Ki(i,"startY",void 0),this.endX=Ki(i,"endX",void 0),this.endY=Ki(i,"endY",void 0);}return this.hasMoveX=void 0!==this.startX&&void 0!==this.endX,this.hasMoveY=void 0!==this.startY&&void 0!==this.endY,this}},{key:"start",value:function(){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),c(s(o.prototype),"start",this).call(this),this}},{key:"updateGameObject",value:function(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasMoveX&&(t.x=qi(this.startX,this.endX,i)),this.hasMoveY&&(t.y=qi(this.startY,this.endY,i));}},{key:"complete",value:function(){return c(s(o.prototype),"complete",this).call(this),1===this.mode&&this.parent.destroy(),this}}]),o}(wi),Qi={stop:0,destroy:1,yoyo:2},$i=function(t,e){if("number"==typeof t)return t;var i=t[0],n=parseFloat(t.substr(2));switch(i){case"+":return e+n;case"-":return e-n;case"*":return e*n;case"/":return e/n}},tn=Phaser.Utils.Objects.IsPlainObject,en=Phaser.Math.Distance.Between,nn=function(t,e){e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0);})),e.on("update",(function(){var e=Ye.getParentSizer(t);e&&e.resetChildPositionState(t);}));},rn={moveFrom:function(t,e,i,n,r){if(tn(t)){var s=t;e=s.x,i=s.y,t=s.hasOwnProperty("speed")?1e3*en(e,i,this.x,this.y)/s.speed:s.duration,n=s.ease;}var o=void 0===this._easeMove;return this._easeMove=function(t,e,i,n,r,s,o){s instanceof Zi&&(o=s,s=void 0),void 0===s&&(s=!1);var a={};return a.mode=s?1:0,void 0!==i&&(a.startX=$i(i,t.x),a.endX=t.x),void 0!==n&&(a.startY=$i(n,t.y),a.endY=t.y),a.duration=e,a.ease=void 0===r?"Linear":r,void 0===o?o=new Zi(t,a):o.resetFromJSON(a),o.restart(),o}(this,t,e,i,n,r,this._easeMove),o&&nn(this,this._easeMove),this._easeMove.completeEventName="movefrom.complete",this},moveFromPromise:function(t,e,i,n,r){return this.moveFrom(t,e,i,n,r),ji(this._easeMove)},moveFromDestroy:function(t,e,i,n){return this.moveFrom(t,e,i,n,!0),this},moveFromDestroyPromise:function(t,e,i,n){return this.moveFromDestroy(t,e,i,n),ji(this._easeMove)},moveTo:function(t,e,i,n,r){if(tn(t)){var s=t;e=s.x,i=s.y,t=s.hasOwnProperty("speed")?1e3*en(e,i,this.x,this.y)/s.speed:s.duration,n=s.ease;}var o=void 0===this._easeMove;return this._easeMove=function(t,e,i,n,r,s,o){s instanceof Zi&&(o=s,s=void 0),void 0===s&&(s=!1);var a={};return a.mode=s?1:0,void 0!==i&&(a.startX=t.x,a.endX=$i(i,t.x)),void 0!==n&&(a.startY=t.y,a.endY=$i(n,t.y)),a.duration=e,a.ease=void 0===r?"Linear":r,void 0===o?o=new Zi(t,a):o.resetFromJSON(a),o.restart(),o}(this,t,e,i,n,r,this._easeMove),o&&nn(this,this._easeMove),this._easeMove.completeEventName="moveto.complete",this},moveToPromise:function(t,e,i,n,r){return this.moveTo(t,e,i,n,r),ji(this._easeMove)},moveToDestroy:function(t,e,i,n){return this.moveTo(t,e,i,n,!0),this},moveToDestroyPromise:function(t,e,i,n){return this.moveToDestroy(t,e,i,n,!0),ji(this._easeMove)},moveStop:function(t){return this._easeMove?(this._easeMove.stop(t),this):this}},sn=Phaser.Utils.Objects.GetValue,on=function(t){r(o,t);var i=l(o);function o(t,n){var r;return e(this,o),(r=i.call(this,t,n)).timer=new vi,r.resetFromJSON(n),r.boot(),r}return n(o,[{key:"resetFromJSON",value:function(t){return this.timer.resetFromJSON(sn(t,"timer")),this.setEnable(sn(t,"enable",!0)),this.setMode(sn(t,"mode",1)),this.isRunning=sn(t,"isRunning",!1),this.setMagnitudeMode(sn(t,"magnitudeMode",1)),this.setAxisMode(sn(t,"axis",0)),this.setDuration(sn(t,"duration",500)),this.setMagnitude(sn(t,"magnitude",10)),this.ox=sn(t,"ox",void 0),this.oy=sn(t,"oy",void 0),this}},{key:"toJSON",value:function(){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}}},{key:"shutdown",value:function(t){this.isShutdown||(c(s(o.prototype),"shutdown",this).call(this,t),this.timer.destroy(),this.timer=void 0);}},{key:"startTicking",value:function(){c(s(o.prototype),"startTicking",this).call(this),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);}},{key:"stopTicking",value:function(){c(s(o.prototype),"stopTicking",this).call(this),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));}},{key:"setEnable",value:function(t){return null==t&&(t=!0),this.enable=t,this}},{key:"setMode",value:function(t){return "string"==typeof t&&(t=an[t]),this.mode=t,this}},{key:"setMagnitudeMode",value:function(t){return "string"==typeof t&&(t=ln[t]),this.magnitudeMode=t,this}},{key:"setAxisMode",value:function(t){return "string"==typeof t&&(t=hn[t]),this.axisMode=t,this}},{key:"setDuration",value:function(t){return this.duration=t,this}},{key:"setMagnitude",value:function(t){return this.magnitude=t,this}},{key:"start",value:function(t,e){if("number"!=typeof t){var i=t;e=sn(i,"magnitude",void 0),t=sn(i,"duration",void 0);}return void 0!==e&&this.setMagnitude(e),void 0!==t&&this.setDuration(t),this.timer.setDuration(this.duration).start(),c(s(o.prototype),"start",this).call(this),this}},{key:"shake",value:function(t,e){return this.start(t,e),this}},{key:"update",value:function(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 n=this.magnitude;1===this.magnitudeMode&&(n*=1-this.timer.t);var r=Math.random()*Math.PI*2,s=this.ox+Math.cos(r)*n,o=this.oy+Math.sin(r)*n;switch(this.axisMode){case 1:i.x=s;break;case 2:i.y=o;break;default:i.x=s,i.y=o;}}return this}},{key:"backToOrigin",value:function(){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}}]),o}(ai),an={effect:0,behavior:1},hn={both:0,"h&v":0,"x&y":0,horizontal:1,h:1,x:1,vertical:2,v:2,y:2},ln={constant:0,decay:1},un=Phaser.Utils.Objects.IsPlainObject,cn={shake:function(t,e,i){if(un(t)){var n=t;t=n.duration,e=n.magnitude,i=n.magnitudeMode;}return void 0===this._shake&&(this._shake=new on(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:function(t,e){return this.shake(t,e),ji(this._shake)}},dn=Phaser.Utils.Objects.GetValue,fn=Phaser.Math.Linear,vn=function(t){r(o,t);var i=l(o);function o(t,n){var r;return e(this,o),(r=i.call(this,t,n)).resetFromJSON(),r.boot(),r}return n(o,[{key:"start",value:function(t){if(this.timer.isRunning)return this;var e=this.target;this.propertyKey=dn(t,"key","value");var i=e[this.propertyKey];return this.fromValue=dn(t,"from",i),this.toValue=dn(t,"to",i),this.setEase(dn(t,"ease",this.ease)),this.setDuration(dn(t,"duration",this.duration)),this.setRepeat(dn(t,"repeat",0)),this.setDelay(dn(t,"delay",0)),this.setRepeatDelay(dn(t,"repeatDelay",0)),this.timer.setDuration(this.duration).setRepeat(this.repeat).setDelay(this.delay).setRepeatDelay(this.repeatDelay),e[this.propertyKey]=this.fromValue,c(s(o.prototype),"start",this).call(this),this}},{key:"updateGameObject",value:function(t,e){var i=e.t;i=this.easeFn(i),t[this.propertyKey]=fn(this.fromValue,this.toValue,i);}}]),o}(wi),pn=Phaser.Utils.Objects.IsPlainObject,gn=function(t){r(s,t);var i=l(s);function s(t,n){var r;return e(this,s),(r=i.call(this,t,n)).parent.setDataEnabled(),r.easeTasks={},r}return n(s,[{key:"complete",value:function(t){this.emit("complete-".concat(t),this.parent,this),this.emit("complete",t,this.parent,this);}},{key:"getEaseTask",value:function(t){var e=this.easeTasks[t];return void 0===e&&(e=new vn(this.parent),this.easeTasks[t]=e,e.setTarget(this.parent.data.values).on("complete",(function(){this.complete(t);}),this)),e}},{key:"easeTo",value:function(t,e,i,n){if(pn(t)){var r=t;t=r.key,e=r.value,i=r.duration,n=r.ease;var s=r.speed;void 0===i&&void 0!==s&&(i=Math.abs(e-this.parent.data.values[t])/s*1e3);}return void 0===i&&(i=1e3),void 0===n&&(n="Linear"),this.getEaseTask(t).restart({key:t,to:e,duration:i,ease:n}),this}},{key:"easeFrom",value:function(t,e,i,n){if(pn(t)){var r=t;t=r.key,e=r.value,i=r.duration,n=r.ease;var s=r.speed;void 0===i&&void 0!==s&&(i=Math.abs(e-this.parent.data.values[t])/s*1e3);}return void 0===i&&(i=1e3),void 0===n&&(n="Linear"),this.getEaseTask(t).restart({key:t,from:e,duration:i,ease:n}),this}},{key:"stopEase",value:function(t,e){void 0===e&&(e=!0);var i=this.easeTasks[t];return i&&i.stop(e),this}},{key:"stopAll",value:function(t){for(var e in void 0===t&&(t=!0),this.easeTasks)this.stopEase(e,t);return this}}]),s}(ri),yn={easeDataTo:function(t,e,i,n){return this._easeData||(this._easeData=new gn(this),function(t,e){e.on("complete",(function(e){t.emit("easedata.".concat(e,".complete"),t),t.emit("easedata.complete",e,t);}));}(this,this._easeData)),this._easeData.easeTo(t,e,i,n),this},easeDataToPromise:function(t,e,i,n){return this.easeDataTo(t,e,i,n),Ri(this._easeData,"complete-".concat(t))},stopEaseData:function(t,e){return this._easeData?(this._easeData.stopEase(t,e),this):this},stopAllEaseData:function(t){return this._easeData?(this._easeData.stopAll(t),this):this}},mn=function(t,e){if(t){Gt(t).hidden=e;var i=_(t);i?i.setChildVisible(t,!e):t.setVisible(!e);}},bn={show:function(t){return void 0===t&&(t=this),function(t){mn(t,!1);}(t),this},hide:function(t){return void 0===t&&(t=this),function(t){mn(t,!0);}(t),this},isShow:function(t){return void 0===t&&(t=this),function(t){return !!t&&!Gt(t).hidden}(t)}};function kn(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Cn={exports:{}};!function(t){var e=Object.prototype.hasOwnProperty,i="~";function n(){}function r(t,e,i){this.fn=t,this.context=e,this.once=i||!1;}function s(t,e,n,s,o){if("function"!=typeof n)throw new TypeError("The listener must be a function");var a=new r(n,s||t,o),h=i?i+e:e;return t._events[h]?t._events[h].fn?t._events[h]=[t._events[h],a]:t._events[h].push(a):(t._events[h]=a,t._eventsCount++),t}function o(t,e){0==--t._eventsCount?t._events=new n:delete t._events[e];}function a(){this._events=new n,this._eventsCount=0;}Object.create&&(n.prototype=Object.create(null),(new n).__proto__||(i=!1)),a.prototype.eventNames=function(){var t,n,r=[];if(0===this._eventsCount)return r;for(n in t=this._events)e.call(t,n)&&r.push(i?n.slice(1):n);return Object.getOwnPropertySymbols?r.concat(Object.getOwnPropertySymbols(t)):r},a.prototype.listeners=function(t){var e=i?i+t:t,n=this._events[e];if(!n)return [];if(n.fn)return [n.fn];for(var r=0,s=n.length,o=new Array(s);r0){var e=t.runTransitionInCallback();t.delayCall(e,this.next,this);}else this.next();}},{key:"exit_TRANS_OPNE",value:function(){this.parent.removeDelayCall();}},{key:"next_OPEN",value:function(){return "TRANS_CLOSE"}},{key:"enter_OPEN",value:function(){this.parent.onOpen();}},{key:"exit_OPEN",value:function(){this.parent.removeDelayCall();}},{key:"next_TRANS_CLOSE",value:function(){return "CLOSE"}},{key:"enter_TRANS_CLOSE",value:function(){var t=this.parent;if(t.transitOutTime>0){var e=t.runTransitionOutCallback();t.delayCall(e,this.next,this);}else this.next();}},{key:"exit_TRANS_CLOSE",value:function(){this.parent.removeDelayCall();}},{key:"next_CLOSE",value:function(){return "TRANS_OPNE"}},{key:"enter_CLOSE",value:function(){this.parent.onClose();}},{key:"exit_CLOSE",value:function(){}},{key:"canOpen",value:function(){return "IDLE"===this.state||"CLOSE"===this.state}},{key:"canClose",value:function(){return "IDLE"===this.state||"OPEN"===this.state}}]),s}(Tn),Dn={delayCall:function(t,e,i){return this.delayCallTimer=function(t,e,i,n,r){var s=$e(t);return s.time.delayedCall(e,(function(){s.game.events.once("poststep",(function(){i.call(n,r);}));}))}(this,t,e,i),this},removeDelayCall:function(){return this.delayCallTimer&&(this.delayCallTimer.remove(!1),this.delayCallTimer=void 0),this}},Rn={setTransitInTime:function(t){return this.transitInTime=t,this},setTransitOutTime:function(t){return this.transitOutTime=t,this},setTransitInCallback:function(t){return t||(t=$t),this.transitInCallback=t,this},setTransitOutCallback:function(t){return t||(t=$t),this.transitOutCallback=t,this}},jn={runTransitionInCallback:function(){return this.transitInCallback(this.parent,this.transitInTime),this.transitInTime},onOpen:function(){},requestOpen:function(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}},Ln={runTransitionOutCallback:function(){return this.transitOutCallback(this.parent,this.transitOutTime),this.transitOutTime},onClose:function(){this.oneShotMode&&this.parent.destroy();},requestClose:function(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}},zn={};Object.assign(zn,Dn,Rn,jn,Ln);var An=Phaser.Utils.Objects.GetValue,Yn=function(t){r(o,t);var i=l(o);function o(t,n){var r;return e(this,o),(r=i.call(this,t,n)).setTransitInTime(An(n,"duration.in",200)),r.setTransitOutTime(An(n,"duration.out",200)),r.setTransitInCallback(An(n,"transitIn")),r.setTransitOutCallback(An(n,"transitOut")),r.oneShotMode=An(n,"destroy",!1),r.delayCallTimer=void 0,r._state=new Mn(a(r),{eventEmitter:!1,initState:An(n,"initState","IDLE")}),r.openEventData=void 0,r.closeEventData=void 0,r}return n(o,[{key:"state",get:function(){return this._state.state}},{key:"shutdown",value:function(t){this.isShutdown||(this.transitInCallback=void 0,this.transitOutCallback=void 0,this.openEventData=void 0,this.closeEventData=void 0,this.removeDelayCall(),c(s(o.prototype),"shutdown",this).call(this,t));}}]),o}(ri);Object.assign(Yn.prototype,zn);var In=function(t){r(o,t);var i=l(o);function o(t,n,r){var s;return e(this,o),(s=i.call(this,t,0,0,2,2,n,1)).setAlpha(r),s.setScrollFactor(0),s.boot(),s}return n(o,[{key:"boot",value:function(){this.scene.sys.events.on("prerender",this.resize,this);}},{key:"destroy",value:function(t){this.scene&&!this.ignoreDestroy&&(this.scene.sys.events.off("prerender",this.resize,this),c(s(o.prototype),"destroy",this).call(this,t));}},{key:"tint",get:function(){return this.fillColor},set:function(t){this.setFillStyle(t,this.fillAlpha);}},{key:"resize",value:function(){var t=this.scene,e=t.sys.scale.gameSize,i=t.sys.cameras.main,n=e.width,r=e.height,s=1/i.zoom,o=n/2,a=r/2,h=n*s,l=r*s;this.x===o&&this.y===a||this.setPosition(o,a),this.width===h&&this.height===l||this.setSize(h,l).setOrigin(.5);}}]),o}(Phaser.GameObjects.Rectangle),Xn=Phaser.Utils.Objects.GetValue,Wn=function(t){r(s,t);var i=l(s);function s(t,n){var r;return e(this,s),(r=i.call(this,t,{eventEmitter:!1})).resetFromJSON(n),r.boot(),r}return n(s,[{key:"resetFromJSON",value:function(t){return this.setHitAreaMode(Xn(t,"hitAreaMode",0)),this.setEnable(Xn(t,"enable",!0)),this.setStopMode(Xn(t,"stopAllLevels",!0)),this}},{key:"boot",value:function(){this.parent.on("pointerdown",(function(t,e,i,n){this.stopAllLevels&&n.stopPropagation();}),this).on("pointerup",(function(t,e,i,n){this.stopAllLevels&&n.stopPropagation();}),this).on("pointermove",(function(t,e,i,n){this.stopAllLevels&&n.stopPropagation();}),this).on("pointerover",(function(t,e,i,n){this.stopAllLevels&&n.stopPropagation();}),this).on("pointerout",(function(t,e){this.stopAllLevels&&e.stopPropagation();}),this);}},{key:"setHitAreaMode",value:function(t){"string"==typeof t&&(t=Vn[t]);var e=this.parent;return e.input&&e.removeInteractive(),0===t?e.setInteractive():e.setInteractive({hitArea:{},hitAreaCallback:function(){return !0}}),this}},{key:"setEnable",value:function(t){return void 0===t&&(t=!0),t?this.parent.setInteractive():this.parent.disableInteractive(),this.enable=t,this}},{key:"setStopMode",value:function(t){return void 0===t&&(t=!0),this.stopAllLevels=t,this}},{key:"toggleEnable",value:function(){return this.setEnable(!this.enable),this}}]),s}(ri),Vn={default:0,fullWindow:1},Nn=Phaser.Utils.Objects.GetValue,Fn=function(t){r(s,t);var i=l(s);function s(t,n){var r;e(this,s);var o=Nn(n,"color",0),h=Nn(n,"alpha",.8);return (r=i.call(this,t,o,h)).touchEventStop=new Wn(a(r),{hitAreaMode:1}),r}return n(s)}(In),Hn=function(t,e){void 0!==t._modalScaleSave?(t.scaleX=t._modalScaleSave,t.scaleY=t._modalScaleSave):t._modalScaleSave=t.scaleX,Mi(t,e);},Bn=function(t,e){Di(t,e,void 0,void 0,!1);},Gn=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Fi(t,e);},Un=function(t,e){Hi(t,e,!1);},Jn=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Fi(t,e,t.alpha);},Kn=function(t,e){Hi(t,e,!1);},qn=function(t,e,i,n,r){return !!t&&(!(n&&!n(t,e,i))&&(!!kt(t,!0).contains(e,i)&&!(r&&!r(t,e,i))))},Zn=Phaser.Utils.Objects.GetValue,Qn=function(t){r(o,t);var i=l(o);function o(t,n){var r;e(this,o),void 0===n&&(n={}),null==n.transitIn&&(n.transitIn=$n.popUp),null==n.transitOut&&(n.transitOut=$n.scaleDown),n.destroy=Zn(n,"destroy",!0),r=i.call(this,t,n);var s=Zn(n,"cover");r.cover=!1!==s?function(t,e){var i=t.scene,n=new Fn(i,e);return i.add.existing(n),t.isRexContainerLite?(t.pin(n,{syncPosition:!1,syncRotation:!1,syncScale:!1,syncAlpha:!1,syncScrollFactor:!1}),t.moveDepthBelow(n)):i.children.moveBelow(n,t),n}(t,s):void 0,r.cover&&(r.setCoverTransitInCallback(Zn(s,"transitIn",Jn)),r.setCoverTransitOutCallback(Zn(s,"transitOut",Kn)));var h=Zn(n,"touchOutsideClose",!1),l=Zn(n,"duration.hold",-1),u=Zn(n,"timeOutClose",l>=0),c=Zn(n,"anyTouchClose",!1);return Zn(n,"manualClose",!1)&&(h=!1,c=!1,u=!1),c&&(h=!1),u?r.setDisplayTime(l):r.setDisplayTime(-1),c?r.once("open",r.anyTouchClose,a(r)):h&&r.once("open",r.touchOutsideClose,a(r)),Zn(n,"openOnStart",!0)&&r.delayCall(0,r.requestOpen,a(r)),r}return n(o,[{key:"shutdown",value:function(t){this.isShutdown||(this.cover||this.scene.input.off("pointerup",this.touchCloseCallback,this),this.cover&&!t&&(this.cover.destroy(),this.cover=void 0),c(s(o.prototype),"shutdown",this).call(this,t));}},{key:"touchOutsideClose",value:function(){return this.cover?this.cover.on("pointerup",this.touchCloseCallback,this):this.scene.input.on("pointerup",this.touchCloseCallback,this),this.clickOutsideTest=!0,this}},{key:"anyTouchClose",value:function(){return this.cover?this.cover.once("pointerup",this.touchCloseCallback,this):this.scene.input.once("pointerup",this.touchCloseCallback,this),this}},{key:"touchCloseCallback",value:function(t){this.clickOutsideTest&&qn(this.parent,t.worldX,t.worldY)||this.requestClose();}},{key:"runTransitionInCallback",value:function(){var t=c(s(o.prototype),"runTransitionInCallback",this).call(this),e=this.cover;return e&&this.coverTransitInCallback&&this.coverTransitInCallback(e,t),t}},{key:"runTransitionOutCallback",value:function(){var t=c(s(o.prototype),"runTransitionOutCallback",this).call(this),e=this.cover;return e&&this.coverTransitOutCallback&&this.coverTransitOutCallback(e,t),t}},{key:"onOpen",value:function(){var t=this.displayTime;t>=0&&this.delayCall(t,this.requestClose,this),this.emit("open",this.parent,this),c(s(o.prototype),"onOpen",this).call(this);}},{key:"onClose",value:function(){this.emit("close",this.closeEventData),c(s(o.prototype),"onClose",this).call(this);}},{key:"setDisplayTime",value:function(t){return this.displayTime=t,this}},{key:"setTransitInCallback",value:function(t){switch("string"==typeof t&&(t=$n[t]),t){case $n.popUp:t=Hn;break;case $n.fadeIn:t=Gn;}return c(s(o.prototype),"setTransitInCallback",this).call(this,t),this}},{key:"setTransitOutCallback",value:function(t){switch("string"==typeof t&&(t=$n[t]),t){case $n.scaleDown:t=Bn;break;case $n.fadeOut:t=Un;}return c(s(o.prototype),"setTransitOutCallback",this).call(this,t),this}},{key:"setCoverTransitInCallback",value:function(t){return this.coverTransitInCallback=t,this}},{key:"setCoverTransitOutCallback",value:function(t){return this.coverTransitOutCallback=t,this}}]),o}(Yn),$n={popUp:0,fadeIn:1,scaleDown:0,fadeOut:1},tr=function(t){return t&&"function"==typeof t},er={modal:function(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 Qn(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:function(t){var e=this;return new Promise((function(i,n){e.modal(t,i);}))},modalClose:function(t){return function(t,e){t.emit("modal.requestClose",e);}(this,t),this}},ir=function(t,e,i,n){if(e)return qn(t,e.worldX,e.worldY,i,n);for(var r=t.scene.input.manager,s=r.pointersTotal,o=r.pointers,a=0;a=this.dragThreshold&&this.cancel();}},{key:"click",value:function(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 n=this.lastClickTime;return void 0!==n&&t-n<=this.clickInterval||(this.lastClickTime=t,this.emit("click",this,this.parent,e,i)),this}},{key:"cancel",value:function(){return this.pointer=void 0,this}},{key:"onOver",value:function(t,e,i,n){return this.enable?(this.emit("over",this,this.parent,t,n),this):this}},{key:"onOut",value:function(t,e){return this.enable?(this.emit("out",this,this.parent,t,e),this):this}}]),o}(ri),gr={press:0,pointerdown:0,release:1,pointerup:1},yr={onClick:function(t,e,i,n){return t?("function"==typeof t&&(n=i,i=e,e=t,t=this),void 0===t._click&&(t._click=new pr(t,n)),t._click.on("click",e,i),this):this},offClick:function(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:function(e,i){return e&&"object"!==t(e)&&(i=e,e=this),void 0===e._click||e._click.setEnable(i),this},disableClick:function(e){return e&&"object"!==t(e)&&(e=this),void 0===e._click||e._click.setEnable(!1),this}},mr=function(t,e,i,n){if(e)return !(i&&!i(t,e))&&(!!br(t,e)&&!(n&&!n(t,e)));for(var r=t.scene.input.manager,s=r.pointersTotal,o=r.pointers,a=0;a0)return kr.length=0,!0;return kr.length=0,!1},kr=[],Cr=Phaser.Utils.Objects.GetValue,xr=function(t){r(o,t);var i=l(o);function o(t,n){var r;e(this,o),(r=i.call(this,t,n))._enable=void 0;var s=Cr(n,"inputConfig",void 0);return s&&t.setInteractive(s),r.resetFromJSON(n),r.boot(),r}return n(o,[{key:"resetFromJSON",value:function(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}},{key:"boot",value:function(){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);}},{key:"shutdown",value:function(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,c(s(o.prototype),"shutdown",this).call(this,t);}}},{key:"enable",get:function(){return this._enable},set:function(t){if(this._enable!==t){t||this.cancel(),this._enable=t;var e=t?"enable":"disable";this.emit(e,this,this.parent);}}},{key:"setEnable",value:function(t){return void 0===t&&(t=!0),this.enable=t,this}},{key:"toggleEnable",value:function(){return this.setEnable(!this.enable),this}},{key:"setMode",value:function(t){return "string"==typeof t&&(t=Sr[t]),this.mode=t,this}},{key:"setClickInterval",value:function(t){return this.clickInterval=t,this}},{key:"setDragThreshold",value:function(t){return this.dragThreshold=t,this}},{key:"isPointerInside",value:function(t){var e=this.parent;return (e.input?mr:ir)(e,t)}},{key:"onPress",value:function(t){this.parent.willRender(t.camera)&&void 0===this.pointer&&(this.pointer=t,0===this.mode&&(this.isPointerInside(t)||this.click(t.downTime,t)));}},{key:"onRelease",value:function(t){this.parent.willRender(t.camera)&&this.pointer===t&&(1===this.mode&&(this.isPointerInside(t)||this.click(t.upTime,t)),this.pointer=void 0);}},{key:"onMove",value:function(t,e,i,n){this.pointer===t&&void 0!==this.dragThreshold&&1===this.mode&&(t.getDistance()>=this.dragThreshold||this.isPointerInside(t))&&this.cancel();}},{key:"click",value:function(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}},{key:"cancel",value:function(){return this.pointer=void 0,this}}]),o}(ri),Sr={press:0,pointerdown:0,release:1,pointerup:1},wr={onClickOutside:function(t,e,i,n){return t?("function"==typeof t&&(n=i,i=e,e=t,t=this),void 0===t._clickOutside&&(t._clickOutside=new xr(t,n)),t._clickOutside.on("clickoutside",e,i),this):this},offClickOutside:function(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:function(e,i){return e&&"object"!==t(e)&&(i=e,e=this),void 0===e._clickOutside||e._clickOutside.setEnable(i),this},disableClickOutside:function(e){return e&&"object"!==t(e)&&(e=this),void 0===e._clickOutside||e._clickOutside.setEnable(!1),this}},_r=function(t){r(s,t);var i=l(s);function s(){var t;return e(this,s),(t=i.call(this,{eventEmitter:!1})).goto("IDLE"),t}return n(s,[{key:"setCooldownTime",value:function(t){return this.cooldownTime=t,this.cooldownMode=void 0!==t,this}},{key:"request",value:function(){return this.runMethod("request")}},{key:"update_IDLE",value:function(){this.compensationTime=0;}},{key:"request_IDLE",value:function(){return this.next(),!0}},{key:"next_IDLE",value:function(){if(this.cooldownMode)return "COOLDOWN"}},{key:"enter_COOLDOWN",value:function(){this.remainderTime=this.cooldownTime+this.compensationTime;}},{key:"update_COOLDOWN",value:function(t,e){this.remainderTime-=e,this.remainderTime<0&&(this.compensationTime=this.cooldownTime>e?-this.remainderTime:0,this.goto("IDLE"));}},{key:"request_COOLDOWN",value:function(){return !1}}]),s}(Tn),Or=Phaser.Utils.Objects.GetValue,Pr=function(t){r(o,t);var i=l(o);function o(t,n){var r;return e(this,o),(r=i.call(this,t,n))._enable=void 0,r.cooldown=new _r,r.parent.setInteractive(Or(n,"inputConfig",void 0)),r.resetFromJSON(n),r.boot(),r}return n(o,[{key:"resetFromJSON",value:function(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}},{key:"boot",value:function(){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);}},{key:"shutdown",value:function(t){this.isShutdown||(this.scene.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,c(s(o.prototype),"shutdown",this).call(this,t));}},{key:"enable",get:function(){return this._enable},set:function(t){if(this._enable!==t)return t||(this.prevIsInTouch=!1,this.isInTouching=!1,this.pointer=void 0),this._enable=t,this}},{key:"setEnable",value:function(t){return void 0===t&&(t=!0),this.enable=t,this}},{key:"cooldownTime",get:function(){return this.cooldown.cooldownTime},set:function(t){this.cooldown.setCooldownTime(t);}},{key:"setCooldown",value:function(t){return this.cooldownTime=t,this}},{key:"toggleEnable",value:function(){return this.setEnable(!this.enable),this}},{key:"onPointIn",value:function(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.pointer=t,this.isInTouching=!0);}},{key:"onPointOut",value:function(t){this.enable&&this.pointer===t&&(this.pointer=void 0,this.isInTouching=!1);}},{key:"preupdate",value:function(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;}}]),o}(ri),Er={isPointerInBounds:function(t){return void 0===t?t=this:"string"==typeof t&&(t=this.getElement(t)),!!t&&ir(t)},onTouching:function(t,e,i,n){return t?("function"==typeof t&&(n=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new Pr(t,n)),t._inTouching.on("intouch",e,i),this):this},offTouching:function(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:function(t,e,i,n){return t?("function"==typeof t&&(n=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new Pr(t,n)),t._inTouching.on("touchend",e,i),this):this},offTouchingEnd:function(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:function(e,i){return e&&"object"!==t(e)&&(i=e,e=this),void 0===e._inTouching||e._inTouching.setEnable(i),this},disableTouching:function(e){return e&&"object"!==t(e)&&(e=this),void 0===e._inTouching||e._inTouching.setEnable(!1),this}},Tr=function(t,e,i){for(var n,r=0,s=t.length;r0),this.onDragStart()));}},{key:"onPointerUp",value:function(t){this.enable&&((!this.bounds||this.bounds.contains(t.x,t.y))&&this.pointer===t&&(this.pointer=void 0,this.movedState=!1,this.tracerState=Br,this.onDragEnd()));}},{key:"onPointerMove",value:function(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()));}}},{key:"dragCancel",value:function(){return this.tracerState===Gr&&this.onDragEnd(),this.pointer=void 0,this.tracerState=Br,this}},{key:"onDragStart",value:function(){this.emit("dragstart",this);}},{key:"onDragEnd",value:function(){this.emit("dragend",this);}},{key:"onDrag",value:function(){this.emit("drag",this);}},{key:"preUpdate",value:function(t,e){}},{key:"postUpdate",value:function(t,e){}},{key:"startTicking",value:function(){c(s(o.prototype),"startTicking",this).call(this),this.scene.sys.events.on("preupdate",this.preUpdate,this),this.scene.sys.events.on("postupdate",this.postUpdate,this);}},{key:"stopTicking",value:function(){c(s(o.prototype),"stopTicking",this).call(this),this.scene&&(this.scene.sys.events.off("preupdate",this.preUpdate,this),this.scene.sys.events.off("postupdate",this.postUpdate,this));}},{key:"setRecongizedStateObject",value:function(t){return this.recongizedState=t,this}},{key:"state",get:function(){return this.recongizedState.state},set:function(t){this.recongizedState.state=t;}},{key:"cancel",value:function(){return this.state=Ur,this}}]),o}(ai),Br=0,Gr=1,Ur="IDLE",Jr=Phaser.Utils.Objects.GetValue,Kr=Phaser.Math.Distance.Between,qr=function(t){r(o,t);var i=l(o);function o(t,n){var r;e(this,o);var s=a(r=i.call(this,t,n)),h={states:{IDLE:{enter:function(){s.stop(),s.tapsCount=0,s.x=0,s.y=0,s.worldX=0,s.worldY=0;},exit:function(){var t=s.lastPointer;s.x=t.x,s.y=t.y,s.worldX=t.worldX,s.worldY=t.worldY;}},BEGIN:{enter:function(){s.start(),s.tapsCount=0,s.emit("tappingstart",s,s.gameObject,s.lastPointer);}},RECOGNIZED:{enter:function(){s.start(),s.emit("tap",s,s.gameObject,s.lastPointer),s.emit("".concat(s.tapsCount,"tap"),s,s.gameObject,s.lastPointer);}}},init:function(){this.state=Zr;},eventEmitter:!1};return r.setRecongizedStateObject(new Tn(h)),r}return n(o,[{key:"resetFromJSON",value:function(t){c(s(o.prototype),"resetFromJSON",this).call(this,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}},{key:"onDragStart",value:function(){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=$r,this.state=Qr);break;case $r:this.state=Qr;}}},{key:"onDragEnd",value:function(){this.state===Qr&&(this.tapsCount++,this.emit("tapping",this,this.gameObject,this.lastPointer),void 0!==this.maxTaps&&this.tapsCount===this.maxTaps&&(this.state=$r));}},{key:"onDrag",value:function(){this.state!==Zr&&this.pointer.getDistance()>this.dragThreshold&&(this.state=Zr);}},{key:"preUpdate",value:function(t,e){if(this.isRunning&&this.enable&&this.state===Qr){var i=this.lastPointer;if(i.isDown)t-i.downTime>this.holdTime&&(this.state=Zr);else t-i.upTime>this.tapInterval&&(void 0===this.minTaps||this.tapsCount>=this.minTaps?this.state=$r:this.state=Zr);}}},{key:"postUpdate",value:function(t,e){this.isRunning&&this.enable&&this.state===$r&&(this.state=Zr);}},{key:"isTapped",get:function(){return this.state===$r}},{key:"setHoldTime",value:function(t){return this.holdTime=t,this}},{key:"setTapInterval",value:function(t){return this.tapInterval=t,this}},{key:"setDragThreshold",value:function(t){return this.dragThreshold=t,this}},{key:"setTapOffset",value:function(t){return this.tapOffset=t,this}},{key:"setMaxTaps",value:function(t){return this.maxTaps=t,this}},{key:"setMinTaps",value:function(t){return this.minTaps=t,this}},{key:"setTaps",value:function(t,e){return void 0===e&&(e=t),this.setMinTaps(t).setMaxTaps(e),this}}]),o}(Hr),Zr="IDLE",Qr="BEGIN",$r="RECOGNIZED",ts=Phaser.Utils.Objects.GetValue,es=function(t){r(o,t);var i=l(o);function o(t,n){var r;e(this,o);var s=a(r=i.call(this,t,n)),h={states:{IDLE:{enter:function(){s.x=0,s.y=0,s.worldX=0,s.worldY=0;},exit:function(){var t=s.lastPointer;s.x=t.x,s.y=t.y,s.worldX=t.worldX,s.worldY=t.worldY;}},BEGIN:{enter:function(){s.start();},exit:function(){s.stop();}},RECOGNIZED:{enter:function(){s.emit("pressstart",s,s.gameObject,s.lastPointer);},exit:function(){s.emit("pressend",s,s.gameObject,s.lastPointer);}}},init:function(){this.state=is;},eventEmitter:!1};return r.setRecongizedStateObject(new Tn(h)),r}return n(o,[{key:"resetFromJSON",value:function(t){return c(s(o.prototype),"resetFromJSON",this).call(this,t),this.setDragThreshold(ts(t,"threshold",9)),this.setHoldTime(ts(t,"time",251)),this}},{key:"onDragStart",value:function(){this.state=ns,0===this.holdTime&&(this.state=rs);}},{key:"onDragEnd",value:function(){this.state=is;}},{key:"onDrag",value:function(){this.state!==is&&this.pointer.getDistance()>this.dragThreshold&&(this.state=is);}},{key:"preUpdate",value:function(t,e){this.isRunning&&this.enable&&(this.state===ns&&t-this.pointer.downTime>=this.holdTime&&(this.state=rs));}},{key:"isPressed",get:function(){return this.state===rs}},{key:"setHoldTime",value:function(t){return this.holdTime=t,this}},{key:"setDragThreshold",value:function(t){return this.dragThreshold=t,this}}]),o}(Hr),is="IDLE",ns="BEGIN",rs="RECOGNIZED";Phaser.Utils.Objects.GetValue;var ss=function(t){return ii(t).loop.delta},os=Phaser.Math.Distance.Between,as=Phaser.Math.Angle.Between,hs={getDt:function(){return ss(this.scene)},getVelocity:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return os(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 as(e.x,e.y,t.x,t.y)}},ls={"up&down":0,"left&right":1,"4dir":2,"8dir":3},us={},cs=Phaser.Utils.Objects.GetValue,ds=Phaser.Math.RadToDeg,fs=function(t){r(o,t);var i=l(o);function o(t,n){var r;e(this,o);var s=a(r=i.call(this,t,n)),h={states:{IDLE:{enter:function(){s.x=0,s.y=0,s.worldX=0,s.worldY=0;},exit:function(){var t=s.lastPointer;s.x=t.x,s.y=t.y,s.worldX=t.worldX,s.worldY=t.worldY;}},BEGIN:{enter:function(){s.validDrag=!1;}},RECOGNIZED:{enter:function(){s.start(),s.updateDirectionStates(),s.emit("swipe",s,s.gameObject,s.lastPointer);},exit:function(){s.stop(),s.clearDirectionStates();}}},init:function(){this.state=vs;},eventEmitter:!1};return r.setRecongizedStateObject(new Tn(h)),r.clearDirectionStates(),r}return n(o,[{key:"resetFromJSON",value:function(t){return c(s(o.prototype),"resetFromJSON",this).call(this,t),this.setDragThreshold(cs(t,"threshold",10)),this.setVelocityThreshold(cs(t,"velocityThreshold",1e3)),this.setDirectionMode(cs(t,"dir","8dir")),this}},{key:"onDragStart",value:function(){this.state=ps;}},{key:"onDragEnd",value:function(){this.state=vs;}},{key:"onDrag",value:function(){this.state===ps&&(this.validDrag||(this.validDrag=0===this.dragThreshold||this.pointer.getDistance()>=this.dragThreshold),this.validDrag&&this.dragVelocity>this.velocityThreshold&&(this.state=gs));}},{key:"postUpdate",value:function(t,e){this.isRunning&&this.enable&&this.state===gs&&(this.state=vs);}},{key:"isSwiped",get:function(){return this.state===gs}},{key:"dragVelocity",get:function(){var t;switch(this.dirMode){case 0:t=this.getVelocityY();break;case 1:t=this.getVelocityX();break;default:t=this.getVelocity();}return t}},{key:"setDragThreshold",value:function(t){return this.dragThreshold=t,this}},{key:"setVelocityThreshold",value:function(t){return this.velocityThreshold=t,this}},{key:"setDirectionMode",value:function(t){return "string"==typeof t&&(t=ls[t]),this.dirMode=t,this}},{key:"updateDirectionStates",value:function(){return function(t,e,i){switch(void 0===i?i={}:!0===i&&(i=us),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;}}(ds(this.getVelocityAngle()),this.dirMode,this),this}},{key:"clearDirectionStates",value:function(){return this.left=!1,this.right=!1,this.up=!1,this.down=!1,this}}]),o}(Hr);Object.assign(fs.prototype,hs);var vs="IDLE",ps="BEGIN",gs="RECOGNIZED",ys=Phaser.Utils.Objects.GetValue,ms=Phaser.Utils.Array.SpliceOne,bs=Phaser.Math.Distance.Between,ks=Phaser.Math.Angle.Between,Cs=function(){function t(i,n){e(this,t);var r=i.input.manager.pointersTotal-1;r<2&&i.input.addPointer(2-r),this.scene=i,this.setEventEmitter(ys(n,"eventEmitter",void 0)),this._enable=void 0,this.pointers=[],this.movedState={},this.resetFromJSON(n),this.boot();}return n(t,[{key:"resetFromJSON",value:function(t){return this.setEnable(ys(t,"enable",!0)),this.bounds=ys(t,"bounds",void 0),this.tracerState=Ss,this.pointers.length=0,Mt(this.movedState),this}},{key:"boot",value:function(){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);}},{key:"shutdown",value:function(){this.scene&&(this.destroyEventEmitter(),this.pointers.length=0,Mt(this.movedState),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);}},{key:"destroy",value:function(){this.shutdown();}},{key:"enable",get:function(){return this._enable},set:function(t){if(this._enable!==t)return t||this.dragCancel(),this._enable=t,this}},{key:"setEnable",value:function(t){return void 0===t&&(t=!0),this.enable=t,this}},{key:"toggleEnable",value:function(){return this.setEnable(!this.enable),this}},{key:"onPointerDown",value:function(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.tracerState){case Ss:this.tracerState=ws,this.onDrag1Start();break;case ws:this.tracerState=_s,this.onDrag2Start();}}},{key:"onPointerUp",value:function(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],ms(this.pointers,e),this.tracerState){case ws:this.tracerState=Ss,this.onDrag1End();break;case _s:this.tracerState=ws,this.onDrag2End(),this.onDrag1Start();}}}},{key:"onPointerMove",value:function(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 ws:this.onDrag1();break;case _s:this.onDrag2();}}}},{key:"dragCancel",value:function(){return this.tracerState===_s&&this.onDrag2End(),this.pointers.length=0,Mt(this.movedState),this.tracerState=Ss,this}},{key:"onDrag1Start",value:function(){this.emit("drag1start",this);}},{key:"onDrag1End",value:function(){this.emit("drag1end",this);}},{key:"onDrag1",value:function(){this.emit("drag1",this);}},{key:"onDrag2Start",value:function(){this.emit("drag2start",this);}},{key:"onDrag2End",value:function(){this.emit("drag2end",this);}},{key:"onDrag2",value:function(){this.emit("drag2",this);}},{key:"distanceBetween",get:function(){if(this.tracerState!==_s)return 0;var t=this.pointers[0],e=this.pointers[1];return bs(t.x,t.y,e.x,e.y)}},{key:"angleBetween",get:function(){if(this.tracerState!==_s)return 0;var t=this.pointers[0],e=this.pointers[1];return ks(t.x,t.y,e.x,e.y)}},{key:"drag1Vector",get:function(){var t=this.pointers[0];if(t&&this.movedState[t.id]){var e=t.position,i=t.prevPosition;xs.x=e.x-i.x,xs.y=e.y-i.y;}else xs.x=0,xs.y=0;return xs}},{key:"centerX",get:function(){if(this.tracerState!==_s)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return (t.x+e.x)/2}},{key:"centerY",get:function(){if(this.tracerState!==_s)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return (t.y+e.y)/2}},{key:"prevCenterX",get:function(){if(this.tracerState!==_s)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}},{key:"prevCenterY",get:function(){if(this.tracerState!==_s)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}},{key:"movementCenterX",get:function(){return this.centerX-this.prevCenterX}},{key:"movementCenterY",get:function(){return this.centerY-this.prevCenterY}},{key:"setRecongizedStateObject",value:function(t){return this.recongizedState=t,this}},{key:"state",get:function(){return this.recongizedState.state},set:function(t){this.recongizedState.state=t;}},{key:"cancel",value:function(){return this.state=Os,this}}]),t}();Object.assign(Cs.prototype,qe);var xs={},Ss=0,ws=1,_s=2,Os="IDLE";Phaser.Utils.Objects.GetValue;var Ps=Phaser.Math.RotateAround,Es=function(t,e,i,n){return Ps(t,e,i,n),t.rotation+=n,t},Ts={},Ms=Phaser.Utils.Objects.GetValue,Ds=Phaser.Math.Angle.WrapDegrees,Rs=Phaser.Math.Angle.ShortestBetween,js=Phaser.Math.RadToDeg,Ls=Phaser.Math.DegToRad,zs=function(t){r(o,t);var i=l(o);function o(t,n){var r;e(this,o);var s=a(r=i.call(this,t,n)),h={states:{IDLE:{enter:function(){s.prevAngle=void 0,s.angle=0;}},BEGIN:{},RECOGNIZED:{enter:function(){s.emit("rotatestart",s);},exit:function(){s.emit("rotateend",s);}}},init:function(){this.state=Ys;},eventEmitter:!1};return r.setRecongizedStateObject(new Tn(h)),r}return n(o,[{key:"resetFromJSON",value:function(t){return c(s(o.prototype),"resetFromJSON",this).call(this,t),this.setDragThreshold(Ms(t,"threshold",0)),this}},{key:"onDrag2Start",value:function(){this.prevAngle=Ds(js(this.angleBetween)),this.state=Is,0===this.dragThreshold&&(this.state=Xs);}},{key:"onDrag2End",value:function(){this.state=Ys;}},{key:"onDrag2",value:function(){switch(this.state){case Is:if(this.pointers[0].getDistance()>=this.dragThreshold&&this.pointers[1].getDistance()>=this.dragThreshold){var t=Ds(js(this.angleBetween));this.angle=Rs(this.prevAngle,t),this.prevAngle=t,this.state=Xs;}break;case Xs:t=Ds(js(this.angleBetween));this.angle=Rs(this.prevAngle,t),this.prevAngle=t,this.emit("rotate",this);}}},{key:"isRotated",get:function(){return this.state===Xs}},{key:"rotation",get:function(){return Ls(this.angle)}},{key:"setDragThreshold",value:function(t){return this.dragThreshold=t,this}}]),o}(Cs),As={spinObject:function(t,e){if(!this.isRotation)return this;void 0===e&&(e=this.pointers[0].camera);var i=this.movementCenterX,n=this.movementCenterY,r=function(t,e,i,n){return void 0===n?n={}:!0===n&&(n=Ts),i.getWorldPoint(t,e,n),n}(this.centerX,this.centerY,e,!0),s=r.x,o=r.y,a=this.rotation;if(Array.isArray(t))for(var h=t,l=0,u=h.length;l=this.sizerChildren.length?this.sizerChildren.push(e):this.sizerChildren.splice(a,0,e),e.isRexSizer||(i>0&&(0===this.orientation?e.minWidth=void 0===h?pt(e):h:e.minHeight=void 0===l?gt(e):l),s&&(0===this.orientation?e.minHeight=l:e.minWidth=h)),void 0!==o&&this.addChildrenMap(o,e),this},oo={add:so,addSpace:function(t){return this.insertSpace(void 0,t),this},insertSpace:function(t,e){return void 0===e&&(e=1),so.call(this,new $s(this.scene),{proportion:e,minWidth:0,minHeight:0,index:t}),this},insert:function(t,e,i,n,r,s,o,a){return eo(i)&&(i.index=t),so.call(this,e,i,n,r,s,o,t,a),this},insertAtPosition:function(t,e,i,n,r,s,o,a,h){var l=to.call(this,t,e);return -1===l&&(l=void 0),this.insert(l,i,n,r,s,o,a,h),this}},ao=Bt.prototype.clear,ho=function(t){this.backgroundChildren&&(this.backgroundChildren.length=0);var e,i=!t&&this.sizerEventsEnable;if(i&&(e=this.getChildren([])),ao.call(this,t),i)for(var n,r=0,s=e.length;r=0;e--)this.remove(this.sizerChildren[e],t);return this},clear:function(t){return this.sizerChildren.length=0,ho.call(this,t),this}},co={getChildAlign:function(t){return this.getSizerConfig(t).align},setChildAlign:function(t,e){return "string"==typeof e&&(e=Qt[e]),this.getSizerConfig(t).align=e,this}},fo={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,n,r=0,s=this.sizerChildren;if(0===this.orientation)for(var o=this.space.item,a=!0,h=0,l=s.length;h0&&this.proportionLength>0&&(i=n.proportion*this.proportionLength):n.expand&&(i=e-this.space.left-this.space.right-r.left-r.right);return i},getExpandedChildHeight:function(t,e){var i;void 0===e&&(e=this.height);var n=t.rexSizer,r=n.padding;0===this.orientation?n.expand&&(i=e-this.space.top-this.space.bottom-r.top-r.bottom):n.proportion>0&&this.proportionLength>0&&(i=n.proportion*this.proportionLength);return i},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,n=0,r=i.length;n0?(e=t-this.getChildrenWidth(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0;}return t},resolveHeight:function(t){t=Ue.call(this,t);if(void 0===this.proportionLength&&1===this.orientation){var e=t-this.childrenHeight;e>0?(e=t-this.getChildrenHeight(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0;}return t}};Object.assign(fo,oo,uo,co,{getChildProportion:function(t){return this.getSizerConfig(t).proportion},setChildProportion:function(t,e){return this.getSizerConfig(t).proportion=e,this}},{getChildExpand:function(t){return this.getSizerConfig(t).expand},setChildExpand:function(t,e){return this.getSizerConfig(t).expand=e,this}});var vo=function(){for(var t,e,i=0,n=this.sizerChildren,r=0,s=n.length;r0&&(i+=e);return i},po={x:0,h:0,horizontal:0,"left-to-right":0,y:1,v:1,vertical:1,"top-to-bottom":1},go=Phaser.Utils.Objects.IsPlainObject,yo=Phaser.Utils.Objects.GetValue,mo=function(t){r(s,t);var i=l(s);function s(t,n,r,o,a,h,l){var u;return e(this,s),go(n)?(n=yo(l=n,"x",0),r=yo(l,"y",0),o=yo(l,"width",void 0),a=yo(l,"height",void 0),h=yo(l,"orientation",0)):go(o)?(o=yo(l=o,"width",void 0),a=yo(l,"height",void 0),h=yo(l,"orientation",0)):go(h)&&(h=yo(l=h,"orientation",0)),void 0===h&&(h=0),(u=i.call(this,t,n,r,o,a,l)).type="rexSizer",u.sizerChildren=[],u.setOrientation(h),u.setItemSpacing(yo(l,"space.item",0)),u.setStartChildIndex(yo(l,"startChildIndex",0)),u.setRTL(yo(l,"rtl",!1)),u.addChildrenMap("items",u.sizerChildren),u}return n(s,[{key:"setOrientation",value:function(t){return this.orientation=function(t){return "string"==typeof t&&(t=po[t]),t}(t),this}},{key:"setItemSpacing",value:function(t){return this.space.item=t,this}},{key:"setStartChildIndex",value:function(t){return this.startChildIndex=t,this}},{key:"setRTL",value:function(t){return void 0===t&&(t=!0),this.rtl=t,this}},{key:"childrenProportion",get:function(){return void 0===this._childrenProportion&&(this._childrenProportion=vo.call(this)),this._childrenProportion}}]),s}(qs);Object.assign(mo.prototype,fo);var bo={v:0,vertical:0,y:0,h:1,horizontal:1,x:1,xy:2,vh:2},ko=function(t){var e=!!t.sliderY||!!t.scrollerY,i=!!t.sliderX||!!t.scrollerX;return e&&i?2:e?0:i?1:0},Co=function(){return Array.prototype.reduce.call(arguments,xo,0)},xo=function(t,e){return t+e},So=Phaser.Utils.Objects.IsPlainObject,wo=Phaser.Utils.Objects.GetValue,_o=Phaser.Display.Align.CENTER,Oo=function(t,e,i,n,r){if("number"==typeof t||"number"==typeof e)if(void 0===t){for(var s=0;s=0;e--){var i=this.sizerChildren[e];i&&this.remove(i,t);}return this},clear:function(t){return Eo(this.sizerChildren,null),ho.call(this,t),this}},Mo={setColumnSpace:function(t){if(this.space.column||(this.space.column=[]),this.space.column.length=this.columnCount-1,"number"==typeof t)Eo(this.space.column,t);else for(var e=0,i=this.columnCount-1;e=0;n--){var r=n*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},Lo={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);for(var e,i,n,r,s=0,o=this.sizerChildren,a=0;a0){var i=t-this.getChildrenWidth(!1);i>=0&&(this.proportionWidthLength=i/e);}else this.proportionWidthLength=0;}return t},resolveHeight:function(t){t=Ue.call(this,t);if(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,n;for(var r in this.sizerChildren)(e=this.sizerChildren[r])&&e.isRexSizer&&!e.ignoreLayout&&(n=this.getColumnWidth(parseInt(r)%this.columnCount),i=this.getExpandedChildWidth(e,n),i=e.resolveWidth(i),e.resolveChildrenWidth(i));},runWidthWrap:function(t){var e,i,n;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(n=this.getColumnWidth(parseInt(r)%this.columnCount),i=this.getExpandedChildWidth(e,n),e.isRexSizer&&(i=e.resolveWidth(i)),e.runWidthWrap(i));return this},resetGrid:function(t,e,i,n,r){if(void 0===i&&(i=0),void 0===n&&(n=0),this.columnCount=t,this.rowCount=e,this.gridCount=t*e,this.removeAll(),this.sizerChildren.length=t*e,Eo(this.sizerChildren,null),this.columnProportions=[],this.columnProportions.length=t,"number"==typeof i)Eo(this.columnProportions,i);else for(var s=0;s0&&(e+=t);return e},Ao=function(){for(var t,e=0,i=0;i0&&(e+=t);return e},Yo=Phaser.Utils.Objects.IsPlainObject,Io=Phaser.Utils.Objects.GetValue,Xo=function(t){r(o,t);var i=l(o);function o(t,n,r,s,a,h,l,u,c,d){var f;return e(this,o),Yo(n)?(n=Io(d=n,"x",0),r=Io(d,"y",0),s=Io(d,"width",void 0),a=Io(d,"height",void 0),h=Io(d,"column",d.col||0),l=Io(d,"row",0),u=Io(d,"columnProportions",0),c=Io(d,"rowProportions",0)):Yo(s)?(s=Io(d=s,"width",void 0),a=Io(d,"height",void 0),h=Io(d,"column",d.col||0),l=Io(d,"row",0),u=Io(d,"columnProportions",0),c=Io(d,"rowProportions",0)):Yo(h)?(h=Io(d=h,"column",d.col||0),l=Io(d,"row",0),u=Io(d,"columnProportions",0),c=Io(d,"rowProportions",0)):Yo(u)&&(u=Io(d=u,"columnProportions",0),c=Io(d,"rowProportions",0)),(f=i.call(this,t,n,r,s,a,d)).type="rexGridSizer",f.sizerChildren=[],f.addChildrenMap("items",f.sizerChildren),f.setCreateCellContainerCallback(Io(d,"createCellContainerCallback")),f.setIndentLeft(Io(d,"space.indentLeftOdd",0),Io(d,"space.indentLeftEven",0)),f.setIndentTop(Io(d,"space.indentTopOdd",0),Io(d,"space.indentTopEven",0)),f.resetGrid(h,l,u,c,Io(d,"space",void 0)),f}return n(o,[{key:"destroy",value:function(t){this.scene&&!this.ignoreDestroy&&(c(s(o.prototype),"destroy",this).call(this,t),this.columnProportions=void 0,this.rowProportions=void 0,this.columnWidth=void 0,this.rowHeight=void 0,this.createCellContainerCallback=void 0);}},{key:"setColumnProportion",value:function(t,e){return t>=this.columnProportions.length||(this.columnProportions[t]=e),this}},{key:"setRowProportion",value:function(t,e){return t>=this.rowProportions.length||(this.rowProportions[t]=e),this}},{key:"totalColumnProportions",get:function(){return void 0===this._totalColumnProportions&&(this._totalColumnProportions=zo.call(this)),this._totalColumnProportions}},{key:"totalRowProportions",get:function(){return void 0===this._totalRowProportions&&(this._totalRowProportions=Ao.call(this)),this._totalRowProportions}},{key:"getChildAt",value:function(t,e){return this.sizerChildren[e*this.columnCount+t]}},{key:"childToGridIndex",value:function(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)}},{key:"getColumnWidth",value:function(t){var e=this.columnProportions[t];return 0===e?this.columnWidth[t]:e*this.proportionWidthLength}},{key:"getRowHeight",value:function(t){var e=this.rowProportions[t];return 0===e?this.rowHeight[t]:e*this.proportionHeightLength}},{key:"setCreateCellContainerCallback",value:function(t){return this.createCellContainerCallback=t,this}}]),o}(qs);Object.assign(Xo.prototype,Lo);var Wo=Phaser.Utils.Objects.GetValue,Vo=Phaser.Utils.Objects.GetValue,No=function(){function t(i,n,r,s,o){e(this,t),void 0===i&&(i=0),void 0===n&&(n=i),void 0===r&&(r=0),void 0===s&&(s=0),void 0===o&&(o=0),this.cornerRadius={},this._width=0,this._height=0,this.setTo(i,n,r,s,o);}return n(t,[{key:"setTo",value:function(t,e,i,n,r){return this.setPosition(t,e),this.setRadius(r),this.setSize(i,n),this}},{key:"setPosition",value:function(t,e){return this.x=t,this.y=e,this}},{key:"setRadius",value:function(t){return void 0===t&&(t=0),this.radius=t,this}},{key:"setSize",value:function(t,e){return this.width=t,this.height=e,this}},{key:"minWidth",get:function(){var t=this.cornerRadius;return Math.max(t.tl.x+t.tr.x,t.bl.x+t.br.x)}},{key:"minHeight",get:function(){var t=this.cornerRadius;return Math.max(t.tl.y+t.bl.y,t.tr.y+t.br.y)}},{key:"width",get:function(){return this._width},set:function(t){null==t&&(t=0),this._width=Math.max(t,this.minWidth);}},{key:"height",get:function(){return this._height},set:function(t){null==t&&(t=0),this._height=Math.max(t,this.minHeight);}},{key:"radius",get:function(){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:function(t){var e,i;"number"==typeof t?(e=t,i=t):(e=Vo(t,"x",0),i=Vo(t,"y",0));var n=this.cornerRadius;n.tl=Fo(Vo(t,"tl",void 0),e,i),n.tr=Fo(Vo(t,"tr",void 0),e,i),n.bl=Fo(Vo(t,"bl",void 0),e,i),n.br=Fo(Vo(t,"br",void 0),e,i);}},{key:"radiusTL",get:function(){var t=this.cornerRadius.tl;return Math.max(t.x,t.y)},set:function(t){Ho(this.cornerRadius.tl,t);}},{key:"radiusTR",get:function(){var t=this.cornerRadius.tr;return Math.max(t.x,t.y)},set:function(t){Ho(this.cornerRadius.tr,t);}},{key:"radiusBL",get:function(){var t=this.cornerRadius.bl;return Math.max(t.x,t.y)},set:function(t){Ho(this.cornerRadius.bl,t);}},{key:"radiusBR",get:function(){var t=this.cornerRadius.br;return Math.max(t.x,t.y)},set:function(t){Ho(this.cornerRadius.br,t);}}]),t}(),Fo=function(t,e,i){return void 0===t?t={x:e,y:i}:"number"==typeof t&&(t={x:t,y:t}),Bo(t),t},Ho=function(t,e){"number"==typeof e?(t.x=e,t.y=e):(t.x=Vo(e,"x",0),t.y=Vo(e,"y",0)),Bo(t);},Bo=function(t){t.convex=t.x>=0||t.y>=0,t.x=Math.abs(t.x),t.y=Math.abs(t.y);},Go=function(t,e,i){var n=i.length;if(n>=2){var r=i[n-2],s=i[n-1];if(t===r&&e===s)return i}return i.push(t,e),i},Uo=Phaser.Math.DegToRad,Jo=function(t,e,i,n,r,s,o,a,h){o&&s>r?s-=360:!o&&s>>16,a=(65280&r)>>>8,h=255&r;t.fillStyle="rgba("+o+","+a+","+h+","+s+")";}(r,e),r.fill()),e.isStroked&&(!function(t,e,i,n){var r=i||e.strokeColor,s=n||e.strokeAlpha,o=(16711680&r)>>>16,a=(65280&r)>>>8,h=255&r;t.strokeStyle="rgba("+o+","+a+","+h+","+s+")",t.lineWidth=e.lineWidth;}(r,e),r.stroke()),r.restore();}}},ta=Phaser.GameObjects.Shape,ea=Phaser.Utils.Objects.IsPlainObject,ia=Phaser.Utils.Objects.GetValue,na=Phaser.Geom.Polygon.Earcut,ra=function(t){r(s,t);var i=l(s);function s(t,n,r,o,a,h,l,u){var c,d,f,v,p;if(e(this,s),ea(n)){var g=n;n=g.x,r=g.y,o=g.width,a=g.height,h=g.radius,l=g.color,u=g.alpha,d=g.strokeColor,f=g.strokeAlpha,v=g.strokeWidth,p=g.shape;}void 0===n&&(n=0),void 0===r&&(r=0),void 0===o&&(o=1),void 0===a&&(a=o),void 0===h&&(h=0),void 0===p&&(p=0);var y=new No;if((c=i.call(this,t,"rexRoundRectangleShape",y)).setShapeType(p),0===c.shapeType){var m=ia(h,"radius",h);y.setTo(0,0,o,a,m);}else {m={x:o/2,y:a/2};y.setTo(0,0,o,a,m);}var b=ia(h,"iteration",void 0);return c.setIteration(b),c.setPosition(n,r),c.setFillStyle(l,u),void 0!==d&&void 0===v&&(v=2),c.setStrokeStyle(v,d,f),c.updateDisplayOrigin(),c.dirty=!0,c}return n(s,[{key:"fillColor",get:function(){return this._fillColor},set:function(t){this._fillColor=t,this.isFilled=null!=t&&this._fillAlpha>0;}},{key:"fillAlpha",get:function(){return this._fillAlpha},set:function(t){this._fillAlpha=t,this.isFilled=t>0&&null!=this._fillColor;}},{key:"setFillStyle",value:function(t,e){return void 0===e&&(e=1),this.fillColor=t,this.fillAlpha=e,this}},{key:"strokeColor",get:function(){return this._strokeColor},set:function(t){this._strokeColor=t,this.isStroked=null!=t&&this._strokeAlpha>0&&this._lineWidth>0;}},{key:"strokeAlpha",get:function(){return this._strokeAlpha},set:function(t){this._strokeAlpha=t,this.isStroked=t>0&&null!=this._strokeColor&&this._lineWidth>0;}},{key:"lineWidth",get:function(){return this._lineWidth},set:function(t){this._lineWidth=t,this.isStroked=t>0&&null!=this._strokeColor;}},{key:"setStrokeStyle",value:function(t,e,i){return void 0===i&&(i=1),this.lineWidth=t,this.strokeColor=e,this.strokeAlpha=i,this}},{key:"updateData",value:function(){var t=this.geom,e=this.pathData;e.length=0;var i,n=t.width,r=t.height,s=t.cornerRadius,o=this.iteration+1;if(i=s.tl,sa(i))if(i.convex){var a=i.x,h=i.y;Jo(a,h,i.x,i.y,180,270,!1,o,e);}else {Jo(a=0,h=0,i.x,i.y,90,0,!0,o,e);}else Go(0,0,e);if(i=s.tr,sa(i))if(i.convex){a=n-i.x,h=i.y;Jo(a,h,i.x,i.y,270,360,!1,o,e);}else {Jo(a=n,h=0,i.x,i.y,180,90,!0,o,e);}else Go(n,0,e);if(i=s.br,sa(i))if(i.convex){a=n-i.x,h=r-i.y;Jo(a,h,i.x,i.y,0,90,!1,o,e);}else {Jo(a=n,h=r,i.x,i.y,270,180,!0,o,e);}else Go(n,r,e);if(i=s.bl,sa(i))if(i.convex){a=i.x,h=r-i.y;Jo(a,h,i.x,i.y,90,180,!1,o,e);}else {Jo(a=0,h=r,i.x,i.y,360,270,!0,o,e);}else Go(0,r,e);return e.push(e[0],e[1]),this.pathIndexes=na(e),this}},{key:"setShapeType",value:function(t){return "string"==typeof t&&(t=oa[t]),this.shapeType=t,this}},{key:"width",get:function(){return this.geom.width},set:function(t){this.resize(t,this.height);}},{key:"height",get:function(){return this.geom.height},set:function(t){this.resize(this.width,t);}},{key:"setSize",value:function(t,e){if(void 0===e&&(e=t),this.geom.width===t&&this.geom.height===e)return this;this.geom.setSize(t,e),1===this.shapeType&&this.setRadius({x:t/2,y:e/2}),this.updateDisplayOrigin(),this.dirty=!0;var i=this.input;return i&&!i.customHitArea&&(i.hitArea.width=t,i.hitArea.height=e),this}},{key:"resize",value:function(t,e){return this.setSize(t,e),this}},{key:"radius",get:function(){return this.geom.radius},set:function(t){this.geom.setRadius(t),this.updateDisplayOrigin(),this.dirty=!0;}},{key:"radiusTL",get:function(){return this.geom.radiusTL},set:function(t){this.geom.radiusTL=t,this.dirty=!0;}},{key:"radiusTR",get:function(){return this.geom.radiusTR},set:function(t){this.geom.radiusTR=t,this.dirty=!0;}},{key:"radiusBL",get:function(){return this.geom.radiusBL},set:function(t){this.geom.radiusBL=t,this.dirty=!0;}},{key:"radiusBR",get:function(){return this.geom.radiusBR},set:function(t){this.geom.radiusBR=t,this.dirty=!0;}},{key:"setRadius",value:function(t){return void 0===t&&(t=0),this.radius=t,this}},{key:"setRadiusTL",value:function(t){return void 0===t&&(t=0),this.radiusTL=t,this}},{key:"setRadiusTR",value:function(t){return void 0===t&&(t=0),this.radiusTR=t,this}},{key:"setRadiusBL",value:function(t){return void 0===t&&(t=0),this.radiusBL=t,this}},{key:"setRadiusBR",value:function(t){return void 0===t&&(t=0),this.radiusBR=t,this}},{key:"cornerRadius",get:function(){return this.geom.cornerRadius},set:function(t){this.radius=t;}},{key:"setCornerRadius",value:function(t){return this.setRadius(t)}},{key:"iteration",get:function(){return this._iteration},set:function(t){void 0!==this._iteration?this._iteration!==t&&(this._iteration=t,this.dirty=!0):this._iteration=t;}},{key:"setIteration",value:function(t){return void 0===t&&(t=6),this.iteration=t,this}}]),s}(ta),sa=function(t){return t.x>0&&t.y>0},oa={rectangle:0,circle:1};Object.assign(ra.prototype,$o);var aa=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},ha=Phaser.Utils.Objects.GetValue,la=function(t){r(s,t);var i=l(s);function s(t,n){var r;e(this,s),(r=i.call(this,t,n)).style=ha(n,"style",a(r));var o=ha(n,"propertiesMap");return r.activeStyle=ua(n,"active",o),r.hoverStyle=ua(n,"hover",o),r.disableStyle=ua(n,"disable",o),r.onModifyStyle=ha(n,"onModifyStyle"),r}return n(s,[{key:"getStyle",value:function(t){return function(t,e,i){if(void 0===i&&(i={}),Array.isArray(e))for(var n=0,r=e.length;n=6?(n=[arguments[2],void 0,arguments[3]],r=[arguments[4],void 0,arguments[5]]):(n=Ma(n),r=Ma(r)),this.textureKey=e,this.baseFrameName=i,this.columns.data=n,this.columns.count=n?n.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 s=this.scene.sys.textures.get(e);if(!s)return this.clear(),this;if(!n||!r)return this.clear(),this;for(var o=s.get(i),a=o.width,h=0,l=0,u=n.length;l0?0:g,k=0;l=0;for(var w=n.length;l0?0:y),y>=1&&g>=1){var _=t(m=this.getFrameNameCallback(l,x,i));"string"!==_&&"number"!==_||s.add(m,0,k+o.cutX,C+o.cutY,y,g);}k+=y;}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,n,r,s,o,a,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,f=c>=0?this.maxFixedPartScaleY:this.height/l;if(this.preserveRatio){var v=Math.min(d,f);if(d>v){var p=(d-v)*h;u>=0?u+=p:u=p,d=v;}if(f>v){var g=(f-v)*l;c>=0?c+=g:c=g,f=v;}}this.columns.scale=d,this.rows.scale=f,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 y=0,m=0;this._beginDraw();for(var b=0,k=this.rows.count;b0&&a>0&&(0===(0===s.stretch&&0===r.stretch||0===this.getStretchMode(C,b)?0:1)?this._drawImage(this.textureKey,n,y,m,o,a):this._drawTileSprite(this.textureKey,n,y,m,o,a)),y+=o;m+=a;}this._endDraw();},setStretchMode:function(t){return Da(t)?(this.stretchMode.edge=ja(Ra(t,"edge",0)),this.stretchMode.internal=ja(Ra(t,"internal",0))):(t=ja(t),this.stretchMode.edge=t,this.stretchMode.internal=t),this},getStretchMode:function(t,e){return za.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}},Ya=Phaser.Utils.Objects.IsPlainObject,Ia=Phaser.Utils.Objects.GetValue,Xa=Phaser.GameObjects,Wa=void 0,Va=function(t,e){if(Wa||(Wa={},ii(t).events.once("destroy",(function(){for(var t in Wa)Wa[t].destroy();Wa=void 0;}))),!Wa.hasOwnProperty(e)){var i=ii(t).scene.systemScene;(t=new Xa[e](i)).setOrigin(0),Wa[e]=t;}return Wa[e]},Na=function(t){r(s,t);var i=l(s);function s(){return e(this,s),i.apply(this,arguments)}return n(s)}(function(t,i){var o=function(t){r(a,t);var o=l(a);function a(t,n,r,s,h,l,u,c,d,f){var v;if(e(this,a),Ya(n)?(n=Ia(f=n,"x",0),r=Ia(f,"y",0),s=Ia(f,"width",1),h=Ia(f,"height",1),l=Ia(f,"key",void 0),u=Ia(f,"baseFrame",void 0),c=Ia(f,"columns",void 0),d=Ia(f,"rows",void 0)):Ya(s)?(s=Ia(f=s,"width",1),h=Ia(f,"height",1),l=Ia(f,"key",void 0),u=Ia(f,"baseFrame",void 0),c=Ia(f,"columns",void 0),d=Ia(f,"rows",void 0)):Ya(l)?(l=Ia(f=l,"key",void 0),u=Ia(f,"baseFrame",void 0),c=Ia(f,"columns",void 0),d=Ia(f,"rows",void 0)):Ya(u)?(u=Ia(f=u,"baseFrame",void 0),c=Ia(f,"columns",void 0),d=Ia(f,"rows",void 0)):Array.isArray(u)?(f=d,d=c,c=u,u=Ia(f,"baseFrame",void 0)):Ya(c)&&(c=Ia(f=c,"columns",void 0),d=Ia(f,"rows",void 0)),void 0===c){var p=Ia(f,"leftWidth",void 0),g=Ia(f,"rightWidth",void 0);void 0!==p&&void 0!==g&&(c=[p,void 0,g]);}if(void 0===d){var y=Ia(f,"topHeight",void 0),m=Ia(f,"bottomHeight",void 0);void 0!==y&&void 0!==m&&(d=[y,void 0,m]);}(v=o.call(this,t)).type=i,v.setPosition(n,r).setSize(s,h).setOrigin(.5,.5),v.columns={},v.rows={},v.stretchMode={},v._tileSprite=void 0,v._image=void 0,v.setGetFrameNameCallback(Ia(f,"getFrameNameCallback",void 0)),v.setStretchMode(Ia(f,"stretchMode",0)),v.setPreserveRatio(Ia(f,"preserveRatio",!0));var b=Ia(f,"maxFixedPartScale",1),k=Ia(f,"maxFixedPartScaleX",b),C=Ia(f,"maxFixedPartScaleY",void 0);return v.setMaxFixedPartScale(k,C),v.setBaseTexture(l,u,c,d),v}return n(a,[{key:"minWidth",get:function(){return this.columns.minWidth}},{key:"minHeight",get:function(){return this.rows.minHeight}},{key:"fixedPartScaleX",get:function(){return this.columns.scale}},{key:"fixedPartScaleY",get:function(){return this.rows.scale}},{key:"resize",value:function(t,e){return this.width===t&&this.height===e||(c(s(a.prototype),"resize",this)?c(s(a.prototype),"resize",this).call(this,t,e):c(s(a.prototype),"setSize",this).call(this,t,e),this.updateTexture()),this}}]),a}(t);return Object.assign(o.prototype,Aa),o}(Phaser.GameObjects.RenderTexture,"rexNinePatch")),Fa={_drawImage:function(t,e,i,n,r,s){var o=Va(this,"Image").setTexture(t,e).setDisplaySize(r,s);this.draw(o,i,n);},_drawTileSprite:function(t,e,i,n,r,s){var o=Va(this,"TileSprite").setTexture(t,e).setSize(r,s);this.draw(o,i,n);}};Object.assign(Na.prototype,Fa);var Ha=function(t,e){var i,n;switch(e&&(e.hasOwnProperty("type")?i=e.type:e.hasOwnProperty("leftWidth")?i="nineSlice":e.hasOwnProperty("key")&&(i="image")),i){case"image":n=new Ea(t,e);break;case"nineSlice":n=e.hasOwnProperty("stretchMode")?new Na(t,e):new wa(t,e);break;default:n=new fa(t,e);}return t.add.existing(n),n},Ba=Phaser.Math.Linear,Ga=Phaser.Math.Percent,Ua={setValue:function(t,e,i){return null==t||(void 0!==e&&(t=Ga(t,e,i)),this.value=t),this},addValue:function(t,e,i){return void 0!==e&&(t=Ga(t,e,i)),this.value+=t,this},getValue:function(t,e){var i=this.value;return void 0!==t&&(i=Ba(t,e,i)),i}},Ja=Phaser.Math.Percent,Ka={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=Ja(t,e,i)),void 0===this.easeValueTask&&(this.easeValueTask=new vn(this,{eventEmitter:null})),this.easeValueTask.restart({key:this.easeValuePropName,to:t,duration:this.easeValueDuration,ease:this.easeFunction})),this},easeValueRepeat:function(t,e,i,n){return void 0===i&&(i=-1),void 0===n&&(n=0),void 0===this.easeValueTask&&(this.easeValueTask=new vn(this,{eventEmitter:null})),this.easeValueTask.restart({key:this.easeValuePropName,from:t,to:e,duration:this.easeValueDuration,ease:this.easeFunction,repeat:i,repeatDelay:n}),this}},qa=Phaser.Utils.Objects.GetValue,Za=Phaser.Math.Clamp;var Qa=Phaser.Math.Percent,$a=function(t,e,i){var n;return t.y===e.y?n=Qa(i.x,t.x,e.x):t.x===e.x&&(n=Qa(i.y,t.y,e.y)),n},th=function(t,e,i){var n,r;this.enable&&(eh.x=e,eh.y=i,this.reverseAxis?(n=this.getEndPoint(),r=this.getStartPoint()):(n=this.getStartPoint(),r=this.getEndPoint()),this.value=$a(n,r,eh));},eh={},ih=function(t,e,i){if(this.enable&&t.isDown){var n,r;nh.x=t.worldX,nh.y=t.worldY,this.reverseAxis?(n=this.getEndPoint(),r=this.getStartPoint()):(n=this.getStartPoint(),r=this.getEndPoint());var s=$a(n,r,nh);this.stopEaseValue(),0===this.easeValueDuration||Math.abs(this.value-s)<.1?this.value=s:this.easeValueTo(s);}},nh={},rh=function(t,e){void 0===e&&(e=sh);var i=this.childrenMap.thumb,n=i.x,r=i.y;return Se(i,this.innerLeft,this.innerTop,this.innerWidth,this.innerHeight,t),e.x=i.x,e.y=i.y,i.x=n,i.y=r,e},sh={},oh=Phaser.Display.Align.LEFT_CENTER,ah=Phaser.Display.Align.TOP_CENTER,hh={},lh=Phaser.Display.Align.RIGHT_CENTER,uh=Phaser.Display.Align.BOTTOM_CENTER,ch={},dh=Phaser.Math.Linear,fh={},vh=Phaser.Display.Align.LEFT_CENTER,ph=Phaser.Display.Align.TOP_CENTER,gh=Phaser.Display.Align.RIGHT_CENTER,yh=Phaser.Display.Align.BOTTOM_CENTER,mh=Phaser.Utils.Objects.GetValue,bh=Phaser.Utils.Objects.IsPlainObject,kh=Phaser.Math.Clamp,Ch=Phaser.Math.Snap.To,xh=function(t){r(o,t);var i=l(o);function o(t,n){var r;e(this,o),(r=i.call(this,t,n)).type="rexSlider",r.bootProgressBase(n),r.reverseAxis=mh(n,"reverseAxis",!1);var s=mh(n,"background",void 0),h=mh(n,"track",void 0),l=mh(n,"indicator",void 0),u=mh(n,"thumb",void 0);s&&(bh(s)&&(s=Ha(t,s)),r.addBackground(s)),h&&(bh(h)&&(h=Ha(t,h)),r.add(h,{proportion:1,expand:!0,minWidth:0===r.orientation?0:void 0,minHeight:1===r.orientation?0:void 0})),l&&(bh(l)&&(l=Ha(t,l)),r.pin(l)),u&&(bh(u)&&(u=Ha(t,u)),r.pin(u));var c=mh(n,"input",0);switch("string"==typeof c&&(c=Sh[c]),c){case 0:u&&(u.setInteractive(),r.scene.input.setDraggable(u),u.on("drag",th,a(r)).on("dragstart",(function(t){this.eventEmitter.emit("inputstart",t);}),a(r)).on("dragend",(function(t){this.eventEmitter.emit("inputend",t);}),a(r)));break;case 1:r.on("pointerdown",ih,a(r)).on("pointermove",ih,a(r)).on("pointerdown",(function(t){this.eventEmitter.emit("inputstart",t);}),a(r)).on("pointerup",(function(t){this.eventEmitter.emit("inputend",t);}),a(r)).on("pointerover",(function(t){t.isDown&&this.eventEmitter.emit("inputstart",t);}),a(r)).on("pointerout",(function(t){t.isDown&&this.eventEmitter.emit("inputend",t);}),a(r)).setInteractive();}return r.addChildrenMap("background",s),r.addChildrenMap("track",h),r.addChildrenMap("indicator",l),r.addChildrenMap("thumb",u),r.setEnable(mh(n,"enable",void 0)),r.setGap(mh(n,"gap",void 0)),r.setValue(mh(n,"value",0),mh(n,"min",void 0),mh(n,"max",void 0)),r}return n(o,[{key:"setEnable",value:function(t){return void 0===t&&(t=!0),this.enable=t,this}},{key:"setGap",value:function(t,e,i){return t&&void 0!==e&&(t/=i-e),this.gap=t,this}},{key:"value",get:function(){return this._value},set:function(t){void 0!==this.gap&&(t=Ch(t,this.gap));var e=this._value;this._value=kh(t,0,1),e!==this._value&&(this.updateThumb(this._value),this.updateIndicator(this._value),this.eventEmitter.emit("valuechange",this._value,e,this.eventEmitter));}},{key:"runLayout",value:function(t,e,i){return this.ignoreLayout||(c(s(o.prototype),"runLayout",this).call(this,t,e,i),this.updateThumb(),this.updateIndicator()),this}}]),o}(function(t){var i=function(t){r(s,t);var i=l(s);function s(){return e(this,s),i.apply(this,arguments)}return n(s,[{key:"bootProgressBase",value:function(t){this.eventEmitter=qa(t,"eventEmitter",this);var e=qa(t,"valuechangeCallback",null);if(null!==e){var i=qa(t,"valuechangeCallbackScope",void 0);this.eventEmitter.on("valuechange",e,i);}return this.setEaseValuePropName("value").setEaseValueDuration(qa(t,"easeValue.duration",0)).setEaseValueFunction(qa(t,"easeValue.ease","Linear")),this}},{key:"value",get:function(){return this._value},set:function(t){t=Za(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);}}]),s}(t);return Object.assign(i.prototype,Ua,Ka),i}(mo)),Sh={pan:0,drag:0,click:1,none:-1},wh={getStartPoint:function(t){if(void 0===t&&(t=hh),this.childrenMap.thumb){var e=0===this.orientation?oh:ah;rh.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=ch),this.childrenMap.thumb){var e=0===this.orientation?lh:uh;rh.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,n=this.childrenMap.thumb;return void 0===n||(void 0===t&&(t=this.value),this.reverseAxis?(e=this.getEndPoint(),i=this.getStartPoint()):(e=this.getStartPoint(),i=this.getEndPoint()),function(t,e,i,n){void 0===n&&(n=fh),n.x=dh(e.x,i.x,t),n.y=dh(e.y,i.y,t);}(t,e,i,n),this.resetChildPositionState(n)),this},updateIndicator:function(t){var e=this.childrenMap.indicator;if(void 0===e)return this;void 0===t&&(t=this.value);var i,n,r,s=this.reverseAxis,o=this.childrenMap.thumb;if(o)if(0===this.orientation){var a=pt(o);if(s){h=o.x-a*o.originX;i=this.right-h;}else {var h;i=(h=o.x-a*o.originX)+a-this.left;}}else {var l=gt(o);if(s){u=o.y-l*o.originY;n=this.bottom-u;}else {var u;n=(u=o.y-l*o.originY)+l-this.top;}}else 0===this.orientation?i=this.width*t:n=this.height*t;ar(e,i,n),r=s?0===this.orientation?gh:yh:0===this.orientation?vh:ph,xe(e,this,r),this.resetChildPositionState(e);}};Object.assign(xh.prototype,wh);var _h=Phaser.Utils.Objects.GetValue,Oh=function(t){r(s,t);var i=l(s);function s(t,n){var r;e(this,s),(r=i.call(this,t,n)).type="rexScrollBar";var o,h=_h(n,"background",void 0),l=_h(n,"buttons",void 0),u=_h(l,"top",_h(l,"left",void 0)),c=_h(l,"bottom",_h(l,"right",void 0)),d=_h(n,"slider",void 0);(h&&r.addBackground(h),u)&&(r.add(u),new Pr(u).on("intouch",(function(){if(this.enable){var t=o.reverseAxis?this.scrollStep:-this.scrollStep;this.value+=t;}}),a(r)));if(d){var f;if(d.orientation=r.orientation,d.eventEmitter=a(r),d.value=null,0===r.orientation)f=void 0===_h(d,"width",void 0)?1:0;else f=void 0===_h(d,"height",void 0)?1:0;o=new xh(t,d),t.add.existing(o),r.add(o,{proportion:f});}c&&(r.add(c),new Pr(c).on("intouch",(function(){if(this.enable){var t=o.reverseAxis?-this.scrollStep:this.scrollStep;this.value+=t;}}),a(r)));var v=[u,c];r.addChildrenMap("background",h),r.addChildrenMap("slider",o),r.addChildrenMap("buttons",v);var p=_h(n,"valuechangeCallback",null);if(null!==p){var g=_h(n,"valuechangeCallbackScope",void 0);r.on("valuechange",p,g);}return r.setEnable(_h(n,"enable",void 0)),r.setValue(_h(n,"value",0)),r.setScrollStep(_h(l,"step",.01)),r}return n(s,[{key:"setScrollStep",value:function(t){return this.scrollStep=t,this}},{key:"enable",get:function(){return !!this.childrenMap.slider&&this.childrenMap.slider.enable},set:function(t){this.childrenMap.slider&&this.childrenMap.slider.setEnable(t);}},{key:"setEnable",value:function(t){return void 0===t&&(t=!0),this.enable=t,this}},{key:"value",get:function(){return this.childrenMap.slider?this.childrenMap.slider.value:0},set:function(t){this.childrenMap.slider&&(this.childrenMap.slider.value=t);}},{key:"setValue",value:function(t,e,i){return this.childrenMap.slider&&this.childrenMap.slider.setValue(t,e,i),this}},{key:"addValue",value:function(t,e,i){return this.childrenMap.slider&&this.childrenMap.slider.addValue(t,e,i),this}},{key:"getValue",value:function(t,e){return this.childrenMap.slider?this.childrenMap.slider.getValue(t,e):0}},{key:"easeValueTo",value:function(t,e,i){return this.childrenMap.slider&&this.childrenMap.slider.easeValueTo(t,e,i),this}},{key:"stopEaseValue",value:function(){return this.childrenMap.slider&&this.childrenMap.slider.stopEaseValue(),this}},{key:"setEaseValueDuration",value:function(t){return this.childrenMap.slider&&this.childrenMap.slider.setEaseValueDuration(t),this}},{key:"setEaseValueFunction",value:function(t){return this.childrenMap.slider&&this.childrenMap.slider.setEaseValueFunction(t),this}}]),s}(mo),Ph=function(t){r(s,t);var i=l(s);function s(t,n){var r;return e(this,s),(r=i.call(this,n)).parent=t,r.init(),r}return n(s,[{key:"init",value:function(){this.start("IDLE");}},{key:"next_IDLE",value:function(){var t,e=this.parent;return e.dragState.isDown&&(t=0===e.dragThreshold?"DRAG":"DRAGBEGIN"),t}},{key:"update_IDLE",value:function(t,e){this.next();}},{key:"next_DRAGBEGIN",value:function(){var t=this.parent,e=t.dragState;return e.isDown?e.pointer.getDistance()>=t.dragThreshold?"DRAG":"DRAGBEGIN":"IDLE"}},{key:"update_DRAGBEGIN",value:function(t,e){this.next();}},{key:"next_DRAG",value:function(){var t,e=this.parent;return e.dragState.isUp&&(t=e.outOfBounds?"BACK":e.slidingEnable?"SLIDE":"IDLE"),t}},{key:"update_DRAG",value:function(t,e){var i=this.parent;i.dragState.justMoved&&i.dragging(),this.next();}},{key:"enter_DRAG",value:function(){this.parent.onDragStart();}},{key:"exit_DRAG",value:function(){this.parent.onDragEnd();}},{key:"next_SLIDE",value:function(){var t,e=this.parent;return e.dragState.isDown?t="DRAG":e.isSliding||(t="IDLE"),t}},{key:"enter_SLIDE",value:function(){this.parent.onSliding();}},{key:"exit_SLIDE",value:function(){this.parent.stop();}},{key:"update_SLIDE",value:function(t,e){this.parent.sliding(t,e),this.next();}},{key:"next_BACK",value:function(){var t,e=this.parent;return e.dragState.isDown?t="DRAG":e.isPullBack||(t="IDLE"),t}},{key:"enter_BACK",value:function(){this.parent.onPullBack();}},{key:"exit_BACK",value:function(){this.parent.stop();}},{key:"update_BACK",value:function(t,e){this.parent.pullBack(t,e),this.next();}}]),s}(Tn),Eh=Phaser.Utils.Objects.GetValue,Th=Phaser.Math.Distance.Between,Mh=function(t){r(o,t);var i=l(o);function o(t,n){var r;return e(this,o),(r=i.call(this,t,n))._enable=void 0,t.setInteractive(Eh(n,"inputConfig",void 0)),r.resetFromJSON(n),r.boot(),r}return n(o,[{key:"resetFromJSON",value:function(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(Eh(t,"enable",!0)),this.holdThreshold=Eh(t,"holdThreshold",50),this.pointerOutReleaseEnable=Eh(t,"pointerOutRelease",!0),this}},{key:"boot",value:function(){this.parent.on("pointerdown",this.onPointIn,this),this.parent.on("pointerup",this.onPointOut,this),this.pointerOutReleaseEnable&&this.parent.on("pointerout",this.onPointOut,this),this.parent.on("pointermove",this.onPointerMove,this),this.scene.sys.events.on("preupdate",this.preupdate,this);}},{key:"shutdown",value:function(t){this.isShutdown||(this.scene.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,c(s(o.prototype),"shutdown",this).call(this,t));}},{key:"enable",get:function(){return this._enable},set:function(t){this._enable!==t&&(t||(this.isInTouched=!1,this.pointer=void 0),this._enable=t);}},{key:"setEnable",value:function(t){return void 0===t&&(t=!0),this.enable=t,this}},{key:"toggleEnable",value:function(){return this.setEnable(!this.enable),this}},{key:"setPointerOutReleaseEnable",value:function(t){return void 0===t&&(t=!0),this.pointerOutReleaseEnable=t,this}},{key:"isDown",get:function(){return this.pointer&&this.pointer.isDown}},{key:"isUp",get:function(){return !this.isDown}},{key:"dx",get:function(){return this.x-this.preX}},{key:"dy",get:function(){return this.y-this.preY}},{key:"dt",get:function(){return ss(this.scene)}},{key:"speed",get:function(){return this.x===this.preX&&this.y===this.preY?0:Th(this.preX,this.preY,this.x,this.y)/(.001*this.dt)}},{key:"speedX",get:function(){return this.dx/(.001*this.dt)}},{key:"speedY",get:function(){return this.dy/(.001*this.dt)}},{key:"onPointIn",value:function(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.pointer=t,this.localX=e,this.localY=i);}},{key:"onPointOut",value:function(t){this.enable&&this.pointer===t&&(this.pointer=void 0);}},{key:"onPointerMove",value:function(t,e,i){this.enable&&t.isDown&&this.pointer===t&&(this.localX=e,this.localY=i);}},{key:"preupdate",value:function(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));}}}]),o}(ri),Dh=Phaser.Utils.Objects.GetValue,Rh=function(){function t(i){e(this,t),this.resetFromJSON(i);}return n(t,[{key:"resetFromJSON",value:function(t){return this.setValue(Dh(t,"value",0)),this.setSpeed(Dh(t,"speed",0)),this.setAcceleration(Dh(t,"acceleration",0)),this}},{key:"reset",value:function(){this.setValue(0),this.setSpeed(0),this.setAcceleration(0);}},{key:"setValue",value:function(t){return this.value=t,this}},{key:"setSpeed",value:function(t){return this.speed=t,this}},{key:"setAcceleration",value:function(t){return this.acceleration=t,this}},{key:"updateSpeed",value:function(t){return 0!==this.acceleration&&(this.speed+=this.acceleration*t,this.speed<0&&(this.speed=0)),this}},{key:"getDeltaValue",value:function(t){return this.updateSpeed(t),this.speed<=0?0:this.speed*t}},{key:"update",value:function(t){return this.updateSpeed(t),this.speed>0&&(this.value+=this.getDeltaValue(t)),this}},{key:"isMoving",get:function(){return this.speed>0}}]),t}(),jh=function(){function t(){e(this,t),this.value,this.dir,this.movement=new Rh;}return n(t,[{key:"init",value:function(t,e,i,n,r){return this.value=t,this.end=r,this.dir=void 0!==r?tthis.end&&(this.value=this.end):this.valuethis.maxValue}},{key:"overMin",value:function(t){return null!=this.minValue&&t0,Math.abs(e),i);}},{key:"sliding",value:function(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;}},{key:"onPullBack",value:function(){var t=this.value,e=this.outOfMinBound?this.minValue:this.maxValue,i=Math.abs(e-t),n=this.backDeceleration,r=Math.sqrt(2*n*i);this._slowDown.init(t,void 0,r,n,e);}},{key:"pullBack",value:function(t,e){e*=.001,this.value=this._slowDown.update(e).value,this._slowDown.isMoving||this._state.next();}},{key:"stop",value:function(){this._slowDown.stop();}}]),o}(ri),Yh={y:0,v:0,vertical:0,x:1,h:1,horizontal:1},Ih=Phaser.Utils.Objects.GetValue,Xh=function(t){r(s,t);var i=l(s);function s(t,n){var r;(e(this,s),(r=i.call(this,t,n)).parent!==r.scene?r.focusMode=Ih(n,"focus",!1):r.focusMode=!1,r.setSpeed(Ih(n,"speed",.1)),r.setEnable(Ih(n,"enable",!0)),r.focusMode)?(t=r.parent).setInteractive(Ih(n,"inputConfig",void 0)).on("wheel",(function(t,e,i,n,r){this.enable&&this.scroll(i);}),a(r)):r.scene.input.on("wheel",r.onSceneScroll,a(r));return r}return n(s,[{key:"destroy",value:function(){this.focusMode||this.scene.input.off("wheel",this.onSceneScroll,this);}},{key:"onSceneScroll",value:function(t,e,i,n,r,s){this.enable&&this.scroll(n);}},{key:"setEnable",value:function(t){return void 0===t&&(t=!0),this.enable=t,this}},{key:"setSpeed",value:function(t){return this.speed=t,this}},{key:"scroll",value:function(t){t*=this.speed,this.emit("scroll",t,this.parent,this);}}]),s}(ri),Wh=Phaser.Utils.Objects.GetValue,Vh=function(t,e,i,n){var r,s,o,a,h="Y"===(i=i.toUpperCase()),l=2===t.scrollMode,u=t.childrenMap.child,c="slider".concat(i);if(r=l||n.hasOwnProperty(c)?Wh(n,c,void 0):Wh(n,"slider",void 0)){var d,f,v;!0===r&&(r={}),r.orientation=h?1:0,s=function(t,e){void 0===e&&(e={});var i=Dt(e);(e={slider:i}).orientation=i.orientation,delete i.orientation,e.background=i.background,delete i.background,e.buttons=i.buttons,delete i.buttons;var n=new Oh(t,e);t.add.existing(n);var r=n.childrenMap.slider;return n.addChildrenMap("track",r.childrenMap.track),n.addChildrenMap("indicator",r.childrenMap.indicator),n.addChildrenMap("thumb",r.childrenMap.thumb),n}(t.scene,r);var p=Wh(r,"position",0);"string"==typeof p&&(p=Nh[p]);var g=Wh(n,"space.slider".concat(i),void 0);void 0===g&&void 0===(g=Wh(n,"space.slider",void 0))&&(g=l?0:Wh(n,"space.child",0));var y="number"==typeof g;h?0===p?(d=2,f=1,v=y?{left:g}:g):(d=0,f=1,v=y?{right:g}:g):0===p?(d=1,f=2,v=y?{top:g}:g):(d=1,f=0,v=y?{bottom:g}:g),e.add(s,{column:d,row:f,align:"center",padding:v,expand:!0}),t["hideUnscrollableSlider".concat(i)]=Wh(r,"hideUnscrollableSlider",!1),t["adaptThumb".concat(i,"SizeMode")]=Wh(r,"adaptThumbSize",!1),t["minThumb".concat(i,"Size")]=Wh(r,"minThumbSize",void 0);}else t["hideUnscrollableSlider".concat(i)]=!1,t["adaptThumb".concat(i,"SizeMode")]=!1,t["minThumb".concat(i,"Size")]=void 0;var m="scroller".concat(i);(o=l||n.hasOwnProperty(m)?Wh(n,m,!0):Wh(n,"scroller",!0))&&u&&(!0===o&&(o={}),o.orientation=h?0:1,a=new Ah(u,o));var b,k,C,x,S=Wh(n,l?"mouseWheelScroller".concat(i):"mouseWheelScroller",!1);(S&&u&&(b=new Xh(u,S)),t.addChildrenMap("slider".concat(i),s),t.addChildrenMap("scroller".concat(i),a),t.addChildrenMap("mouseWheelScroller".concat(i),b),l&&!h||(t.hideUnscrollableSlider=t["hideUnscrollableSlider".concat(i)],t.adaptThumbSizeMode=t["adaptThumb".concat(i,"SizeMode")],t.minThumbSize=t["minThumb".concat(i,"Size")],t.addChildrenMap("slider",s),t.addChildrenMap("scroller",a),t.addChildrenMap("mouseWheelScroller",b)),s)&&(l?(k=h?"t":"s",x="scroll".concat(i)):(k="t",x="scroll"),s.on("valuechange",(function(e){t[k]=e,t.emit(x,t);})));a&&(l?(C="childO".concat(i),x="scroll".concat(i)):(C="childOY",x="scroll"),a.on("valuechange",(function(e){t[C]=e,t.emit(x,t);})));if(b){var w="addChildO".concat(i);b.on("scroll",(function(e){t[w](-e,!0);}));}},Nh={right:0,left:1,bottom:0,top:1},Fh=Phaser.Utils.Objects.GetValue,Hh=function(t,e){var i=t.scene,n=[0,1,0],r=[0,1,0],s=Fh(e,"width"),o=Fh(e,"height");s||(n[1]=0),o||(r[1]=0);var a=new Xo(i,{column:3,row:3,columnProportions:n,rowProportions:r});switch(function(t,e,i){var n=Wo(i,"child"),r=Wo(n,"gameObject",void 0);if(r){var s=Wo(i,"space.child",0);t.childMargin={};var o=t.childMargin,a={};if("number"==typeof s)switch(t.scrollMode){case 0:case 1:o.top=0,o.bottom=0,o.left=0,o.right=0;break;default:o.top=s,o.bottom=s,o.left=s,o.right=s;}else switch(t.scrollMode){case 0:o.top=Wo(s,"top",0),o.bottom=Wo(s,"bottom",0),a.left=Wo(s,"left",0),a.right=Wo(s,"right",0);break;case 1:o.top=Wo(s,"left",0),o.bottom=Wo(s,"right",0),a.top=Wo(s,"top",0),a.bottom=Wo(s,"bottom",0);break;default:o.top=Wo(s,"top",0),o.bottom=Wo(s,"bottom",0),o.left=Wo(s,"left",0),o.right=Wo(s,"right",0);}e.add(r,{column:1,row:1,align:Wo(n,"align","center"),padding:a,expand:{width:Wo(n,"expandWidth",!0),height:Wo(n,"expandHeight",!0)}});}t.addChildrenMap("child",r);}(t,a,e),t.scrollMode){case 0:Vh(t,a,"y",e);break;case 1:Vh(t,a,"x",e);break;default:Vh(t,a,"y",e),Vh(t,a,"x",e);}return a},Bh=function(t){var e,i,n,r;switch(this.scrollMode){case 0:case 1:e=this.topChildOY,i=this.bottomChildOY,n=this.childrenMap.scroller,r=this.childrenMap.slider;break;default:"Y"===(t=t.toUpperCase())?(e=this.topChildOY,i=this.bottomChildOY):(e=this.leftChildOX,i=this.rightChildOX),n=this.childrenMap["scroller".concat(t)],r=this.childrenMap["slider".concat(t)];}n&&n.setBounds(e,i),r&&r.setEnable(e!==i);},Gh=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".concat(t)],i=this["hideUnscrollableSlider".concat(t)],n=this["isOverflow".concat(t)];e&&i&&this.setChildVisible(e,n);}},Uh=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,n=a.childrenMap.thumb,r=this.minThumbSize;if(0===this.scrollMode){var s=i.displayHeight*e;void 0!==r&&s0?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(ol.call(this,-this.textOY)),0),e=al.call(this,t)+this.textOY,i=hl.call(this,t);return function(t,e){switch(el(t)){case 0:var i=(r=t.style).wordWrapWidth,n=r.wordWrapCallback;r.wordWrapWidth=0,r.wordWrapCallback=void 0,t.setText(e),r.wordWrapWidth=i,r.wordWrapCallback=n;break;case 1:var r,s=(r=t.style).wrapMode;r.wrapMode=0,t.setText(e),r.wrapMode=s;break;case 2:var o=t._maxWidth;t._maxWidth=0,t.setText(e),t._maxWidth=o;}}(this.textObject,i),this.textObject.rexSizer.offsetY=e,ll.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,Ke.call(this),this},layoutChildren:function(){var t,e,i,n,r,s,o,a=this.left,h=this.top;(t=this.textObject).rexSizer.hidden||(n=a+(i=(e=t.rexSizer).padding).left,r=h+i.top,s=this.width-i.left-i.right,o=this.height-i.top-i.bottom,cl.call(this,t,s,o),Se(t,n,r,s,o,e.align),e.preOffsetY=0,ll.call(this),this.textMask&&(this.textMask.setPosition().resize(),this.resetChildPositionState(this.textMask)));}},fl=Phaser.Utils.Objects.IsPlainObject,vl=Phaser.Utils.Objects.GetValue,pl=Phaser.Display.Align.TOP_LEFT,gl=function(t){r(o,t);var i=l(o);function o(t,n,r,s,h,l){var u;e(this,o),fl(n)?(n=vl(l=n,"x",0),r=vl(l,"y",0),s=vl(l,"width",void 0),h=vl(l,"height",void 0)):fl(s)&&(s=vl(l=s,"width",void 0),h=vl(l,"height",void 0)),(u=i.call(this,t,n,r,s,h,l)).type="rexTextBlock",u.textObject=void 0,u.linesCount=0,u.textMask=void 0,u.textObjectType=void 0,u._textLineHeight=void 0,u._textLineSpacing=void 0,u._visibleLinesCount=void 0,u._textHeight=void 0,u._textVisibleHeight=void 0,u._textObjectRealHeight=0,u.lines=void 0,u.text=vl(l,"content",""),u._textOY=0,u.execeedTopState=!1,u.execeedBottomState=!1,u.setClampMode(vl(l,"clamplTextOY",!0)),u.alwaysScrollable=vl(l,"alwaysScrollable",!1);var c=vl(l,"background",void 0),d=vl(l,"text",void 0);void 0===d&&(d=yl(t)),u.textCropEnable=vl(l,"textCrop",!!d.setCrop);var f=vl(l,"textMask",!u.textCropEnable);c&&u.addBackground(c),u.add(d),u.sizerChildren=[d];var v=u.getSizerConfig(d);return v.align=pl,v.padding=Te(0),v.expand=!0,u.textObject=d,u.textObjectType=el(d),v.preOffsetY=0,v.offsetY=0,f&&(u.textMask=sl.call(a(u),u.textObject,a(u))),u.addChildrenMap("background",c),u.addChildrenMap("text",d),u}return n(o,[{key:"destroy",value:function(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;}c(s(o.prototype),"destroy",this).call(this,t);}}},{key:"setClampMode",value:function(t){return void 0===t&&(t=!0),this.clampTextOY=t,this}},{key:"textLineHeight",get:function(){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}},{key:"textLineSpacing",get:function(){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}},{key:"visibleLinesCount",get:function(){return void 0===this._visibleLinesCount&&(this._visibleLinesCount=Math.floor(ol.call(this,this._textObjectRealHeight))),this._visibleLinesCount}},{key:"topTextOY",get:function(){return 0}},{key:"bottomTextOY",get:function(){return -this.textVisibleHeight}},{key:"textHeight",get:function(){return void 0===this._textHeight&&(this._textHeight=al.call(this,this.linesCount)),this._textHeight}},{key:"textObjectHeight",get:function(){return this._textObjectRealHeight-(this.textLineHeight+this.textLineSpacing)}},{key:"textVisibleHeight",get:function(){if(void 0===this._textVisibleHeight){var t=this.textHeight-this.textObjectHeight;!this.alwaysScrollable&&t<0&&(t=0),this._textVisibleHeight=t;}return this._textVisibleHeight}},{key:"textOYExceedTop",value:function(t){return void 0===t&&(t=this.textOY),t>this.topTextOY}},{key:"textOYExeceedBottom",value:function(t){return void 0===t&&(t=this.textOY),tthis.linesCount?t=0:n?t=e:r&&(t=i)),this._textOY!==t&&(this._textOY=t,this.updateTextObject()),n&&(this.execeedTopState||this.emit("execeedtop",this,t,e)),this.execeedTopState=n,r&&(this.execeedBottomState||this.emit("execeedbottom",this,t,i)),this.execeedBottomState=r;}},{key:"setTextOY",value:function(t){return this.textOY=t,this}},{key:"t",get:function(){var t=this.textVisibleHeight;return 0===t?0:this.textOY/-t},set:function(t){this.textOY=-this.textVisibleHeight*t;}},{key:"setTextOYByPercentage",value:function(t){return this.t=t,this}}]),o}(qs),yl=function(t){return t.add.text(0,0,"")};Object.assign(gl.prototype,dl);Phaser.Math.Clamp;var ml={scrollToLine:function(t){return this.setChildOY(-this.lineHeight*t),this},scrollToNextLine:function(t){void 0===t&&(t=1);var e=this.lineIndex+t;return this.scrollToLine(e),this}},bl=Phaser.Utils.Objects.GetValue,kl=function(t){r(s,t);var i=l(s);function s(t,n){var r;e(this,s),void 0===n&&(n={}),n.scrollMode=0;var o=bl(n,"text",void 0),a=bl(n,"textWidth",void 0),h=bl(n,"textHeight",void 0),l=bl(n,"textCrop",!!o.setCrop),u=bl(n,"textMask",!l),c=bl(n,"content",""),d=new gl(t,{width:a,height:h,text:o,textMask:u,textCrop:l&&!u,content:c,clamplTextOY:bl(n,"clamplChildOY",!1),alwaysScrollable:bl(n,"alwaysScrollable",!1)});t.add.existing(d),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}});}(d),n.scrollMode=0,n.type="rexTextArea",n.child={gameObject:d,expandWidth:void 0===a,expandHeight:void 0===h};var f=bl(n,"space",void 0);return f&&(f.child=bl(f,"text",0)),(r=i.call(this,t,n)).addChildrenMap("text",o),r}return n(s,[{key:"text",get:function(){return this.childrenMap.child.text}},{key:"lineHeight",get:function(){var t=this.childrenMap.child;return t.textLineHeight+t.textLineSpacing}},{key:"lineIndex",get:function(){return Math.floor(-this.childOY/this.lineHeight)}},{key:"linesCount",get:function(){return this.childrenMap.child.linesCount}},{key:"contentHeight",get:function(){return this.childrenMap.child.textHeight}}]),s}(Zh);return Object.assign(kl.prototype,{setText:function(t){return this.childrenMap.child.setText(t),this.resizeController(),this},appendText:function(t){return this.setText(this.text+t),this}},ml),kl})); +!function(t,e){"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();}(undefined,(function(){function t(e){return t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},t(e)}function e(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){for(var i=0;it.length)&&(e=t.length);for(var i=0,n=new Array(e);i=0;i--)(e=this.children[i]).parentContainer||e.displayList||e.destroy(t);this.clear(!t),c(s(o.prototype),"destroy",this).call(this,t);}}},{key:"contains",value:function(t){return -1!==this.children.indexOf(t)}},{key:"add",value:function(t){var e=this;return k(this.children,t,0,(function(t){t.once("destroy",e.onChildDestroy,e);}),this),this}},{key:"remove",value:function(t,e){var i=this;return C(this.children,t,(function(t){t.off("destroy",i.onChildDestroy,i),e&&t.destroy();})),this}},{key:"onChildDestroy",value:function(t,e){this.remove(t,!1);}},{key:"clear",value:function(t){for(var e,i=0,n=this.children.length;i0;){var n=i.shift();!e(n)&&n.isRexContainerLite&&i.push.apply(i,v(n.children));}},it=Phaser.Utils.Array,nt={getChildren:function(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},Ve=/(\S+)\[(\d+)\]/i,Ne=Phaser.Utils.Objects.GetValue,Fe=function(t,e){return void 0===e?t:t[e]},He=function(e,i,n){void 0===e&&(e={}),void 0===i&&(i=0);var r=t(i);return "string"===r?e[i]=n:"number"===r?(e.left=i,e.right=i,e.top=i,e.bottom=i):(e.left=Ne(i,"left",0),e.right=Ne(i,"right",0),e.top=Ne(i,"top",0),e.bottom=Ne(i,"bottom",0)),e},Be={getInnerPadding:function(t){return Fe(this.space,t)},setInnerPadding:function(t,e){return He(this.space,t,e),this},getOuterPadding:function(t){return Fe(this.getSizerConfig(this).padding,t)},setOuterPadding:function(t,e){return He(this.getSizerConfig(this).padding,t,e),this},getChildOuterPadding:function(t,e){return "string"==typeof t&&(t=this.getElement(t)),Fe(this.getSizerConfig(t).padding,e)},setChildOuterPadding:function(t,e,i){return "string"==typeof t&&(t=this.getElement(t)),He(this.getSizerConfig(t).padding,e,i),this}},Ge=function(t){var e=this.childrenWidth,i=void 0!==this.minWidth?this.minWidth:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn("Layout width warn: ".concat(this.constructor.name,"'s minWidth (").concat(i,") < childrenWidth (").concat(e,")"))):this.layoutWarnEnable&&(i>t||e>t)&&console.warn("Layout width warn: ".concat(this.constructor.name,"'s minWidth (").concat(i,") or childrenWidth (").concat(e," > targetWidth ").concat(t,")")),t},Ue=function(t){var e=this.childrenHeight,i=void 0!==this.minHeight?this.minHeight:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn("Layout height warn: ".concat(this.constructor.name,"'s minHeight (").concat(i,") < childrenHeight (").concat(e,")"))):this.layoutWarnEnable&&(i>t||e>t)&&console.warn("Layout height warn: ".concat(this.constructor.name,"'s minHeight (").concat(i,") or childrenHeight (").concat(e,") > targetHeight (").concat(t,")")),t},Je={getShownChildren:function(t){void 0===t&&(t=[]);for(var e,i=this.children,n=0,r=i.length;n0;){var i=e.shift();i.rexSizer&&i.rexSizer.hidden||(i!==this&&t.push(i),i.isRexContainerLite&&e.push.apply(e,v(i.children)));}return t}},Ke=function(){this._childrenWidth=void 0,this._childrenHeight=void 0;for(var t,e=this.getChildrenSizers(),i=0,n=e.length;i0?-this.delay:0,this.state=this.nowTime>=0?yi:gi,this.repeatCounter=0,this}},{key:"stop",value:function(){return this.state=pi,this}},{key:"update",value:function(t,e){this.state!==pi&&this.state!==bi&&0!==e&&0!==this.timeScale&&(this.nowTime+=e*this.timeScale,this.justRestart=!1,this.nowTime>=this.duration?-1===this.repeat||this.repeatCounter0&&(this.nowTime-=this.repeatDelay,this.state=mi)):(this.nowTime=this.duration,this.state=bi):this.nowTime>=0&&(this.state=yi));}},{key:"t",get:function(){var t;switch(this.state){case pi:case gi:case mi:t=0;break;case yi:t=this.nowTime/this.duration;break;case bi:t=1;}return fi(t,0,1)},set:function(t){(t=fi(t,-1,1))<0?(this.state=gi,this.nowTime=-this.delay*t):(this.state=yi,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++);}},{key:"setT",value:function(t){return this.t=t,this}},{key:"isIdle",get:function(){return this.state===pi}},{key:"isDelay",get:function(){return this.state===gi}},{key:"isCountDown",get:function(){return this.state===yi}},{key:"isRunning",get:function(){return this.state===gi||this.state===yi}},{key:"isDone",get:function(){return this.state===bi}},{key:"isOddIteration",get:function(){return 1==(1&this.repeatCounter)}},{key:"isEvenIteration",get:function(){return 0==(1&this.repeatCounter)}}]),t}(),pi=0,gi=1,yi=2,mi=3,bi=-1,ki=function(t){r(o,t);var i=l(o);function o(t,n){var r;return e(this,o),(r=i.call(this,t,n)).timer=new vi,r}return n(o,[{key:"shutdown",value:function(t){this.isShutdown||(c(s(o.prototype),"shutdown",this).call(this,t),this.timer.destroy(),this.timer=void 0);}},{key:"start",value:function(){return this.timer.start(),c(s(o.prototype),"start",this).call(this),this}},{key:"stop",value:function(){return this.timer.stop(),c(s(o.prototype),"stop",this).call(this),this}},{key:"complete",value:function(){return this.timer.stop(),c(s(o.prototype),"complete",this).call(this),this}}]),o}(ui),Ci=Phaser.Utils.Objects.GetValue,xi=Phaser.Utils.Objects.GetAdvancedValue,Si=Phaser.Tweens.Builders.GetEaseFunction,wi=function(t){r(o,t);var i=l(o);function o(){return e(this,o),i.apply(this,arguments)}return n(o,[{key:"resetFromJSON",value:function(t){return this.timer.resetFromJSON(Ci(t,"timer")),this.setEnable(Ci(t,"enable",!0)),this.setTarget(Ci(t,"target",this.parent)),this.setDelay(xi(t,"delay",0)),this.setDuration(xi(t,"duration",1e3)),this.setEase(Ci(t,"ease","Linear")),this.setRepeat(Ci(t,"repeat",0)),this}},{key:"setEnable",value:function(t){return null==t&&(t=!0),this.enable=t,this}},{key:"setTarget",value:function(t){return void 0===t&&(t=this.parent),this.target=t,this}},{key:"setDelay",value:function(t){return this.delay=t,this}},{key:"setDuration",value:function(t){return this.duration=t,this}},{key:"setRepeat",value:function(t){return this.repeat=t,this}},{key:"setRepeatDelay",value:function(t){return this.repeatDelay=t,this}},{key:"setEase",value:function(t){return void 0===t&&(t="Linear"),this.ease=t,this.easeFn=Si(t),this}},{key:"start",value:function(){return this.timer.isRunning||c(s(o.prototype),"start",this).call(this),this}},{key:"restart",value:function(){return this.timer.stop(),this.start.apply(this,arguments),this}},{key:"stop",value:function(t){return void 0===t&&(t=!1),c(s(o.prototype),"stop",this).call(this),t&&(this.timer.setT(1),this.updateGameObject(this.target,this.timer),this.complete()),this}},{key:"update",value:function(t,e){if(!this.isRunning||!this.enable||!this.parent.active)return this;var i=this.target,n=this.timer;return n.update(t,e),n.isDelay||this.updateGameObject(i,n),this.emit("update",i,this),n.isDone&&this.complete(),this}},{key:"updateGameObject",value:function(t,e){}}]),o}(ki),_i=Phaser.Utils.Objects.GetValue,Oi=Phaser.Utils.Objects.GetAdvancedValue,Pi=Phaser.Math.Linear,Ei=function(t){r(o,t);var i=l(o);function o(t,n){var r;return e(this,o),(r=i.call(this,t,n)).scaleStart={},r.scaleEnd={},r.resetFromJSON(n),r.boot(),r}return n(o,[{key:"resetFromJSON",value:function(t){return c(s(o.prototype),"resetFromJSON",this).call(this,t),this.setMode(_i(t,"mode",0)),this.setScaleRange(Oi(t,"start",void 0),Oi(t,"end",0)),this}},{key:"setMode",value:function(t){return "string"==typeof t&&(t=Ti[t]),this.mode=t,this}},{key:"setScaleRange",value:function(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}},{key:"start",value:function(){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),c(s(o.prototype),"start",this).call(this),this}},{key:"updateGameObject",value:function(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));}},{key:"complete",value:function(){return c(s(o.prototype),"complete",this).call(this),1===this.mode&&this.parent.destroy(),this}}]),o}(wi),Ti={stop:0,destroy:1,yoyo:2},Mi=function(t,e,i,n,r){var s,o;switch(void 0===n&&(n="Cubic"),i){case 0:case"x":s={x:0},o={x:t.scaleX};break;case 1:case"y":s={y:0},o={y:t.scaleY};break;default:s=0,o=t.scale;}var a={mode:0,start:s,end:o,duration:e,ease:n};return void 0===r?r=new Ei(t,a):r.resetFromJSON(a),r.restart(),r},Di=function(t,e,i,n,r,s){void 0===n&&(n="Linear"),r instanceof Ei&&(s=r,r=void 0),void 0===r&&(r=!0);var o={};switch(o.mode=r?1:0,i){case 0:case"x":o.end={x:0};break;case 1:case"y":o.end={y:0};break;default:o.end=0;}return o.duration=e,o.ease=n,void 0===s?s=new Ei(t,o):s.resetFromJSON(o),s.restart(),s},Ri=function(t,e){return new Promise((function(i,n){t.once(e,(function(){i();}));}))},ji=function(t){return Ri(t,"complete")},Li=Phaser.Utils.Objects.IsPlainObject,zi=function(t,e){e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0);})),e.on("update",(function(){var e=Ye.getParentSizer(t);e&&e.resetChildPositionState(t);}));},Ai={popUp:function(t,e,i){if(Li(t)){var n=t;t=n.duration,e=n.orientation,i=n.ease;}var r=void 0===this._scaleBehavior;return this._scaleBehavior=Mi(this,t,e,i,this._scaleBehavior),r&&zi(this,this._scaleBehavior),this._scaleBehavior.completeEventName="popup.complete",this},popUpPromise:function(t,e,i){return this.popUp(t,e,i),ji(this._scaleBehavior)},scaleDownDestroy:function(t,e,i,n){if(Li(t)){var r=t;t=r.duration,e=r.orientation,i=r.ease,n=r.destroy;}var s=void 0===this._scaleBehavior;return this._scaleBehavior=Di(this,t,e,i,n,this._scaleBehavior),s&&zi(this,this._scaleBehavior),this._scaleBehavior.completeEventName="scaledown.complete",this},scaleDownDestroyPromise:function(t,e,i,n){return this.scaleDownDestroy(t,e,i,n),ji(this._scaleBehavior)},scaleDown:function(t,e,i){return this.scaleDownDestroy(t,e,i,!1),this},scaleDownPromise:function(t,e,i){return this.scaleDown(t,e,i),ji(this._scaleBehavior)},scaleYoyo:function(t,e,i,n,r){if(Li(t)){var s=t;t=s.duration,e=s.peakValue,i=s.repeat,n=s.orientation,r=s.ease;}var o=void 0===this._scaleBehavior;return this._scaleBehavior=function(t,e,i,n,r,s,o){var a,h;switch(void 0===i&&(i=1.2),void 0===n&&(n=0),void 0===s&&(s="Cubic"),r){case 0:case"x":a={x:t.scaleX},h={x:i};break;case 1:case"y":a={y:t.scaleX},h={y:i};break;default:a=t.scaleX,h=i;}var l={mode:2,start:a,end:h,duration:e/2,ease:s,repeat:n};return void 0===o?o=new Ei(t,l):o.resetFromJSON(l),o.restart(),o}(this,t,e,i,n,r,this._scaleBehavior),o&&zi(this,this._scaleBehavior),this._scaleBehavior.completeEventName="scaleyoyo.complete",this},scaleYoyoPromise:function(t,e,i,n,r){return this.scaleYoyo(t,e,i,n,r),ji(this._scaleBehavior)}},Yi=Phaser.Utils.Objects.GetValue,Ii=Phaser.Utils.Objects.GetAdvancedValue,Xi=Phaser.Math.Linear,Wi=function(t){r(o,t);var i=l(o);function o(t,n){var r;return e(this,o),(r=i.call(this,t,n)).resetFromJSON(n),r.boot(),r}return n(o,[{key:"resetFromJSON",value:function(t){return c(s(o.prototype),"resetFromJSON",this).call(this,t),this.setMode(Yi(t,"mode",0)),this.setAlphaRange(Ii(t,"start",this.parent.alpha),Ii(t,"end",0)),this}},{key:"setMode",value:function(t){return "string"==typeof t&&(t=Vi[t]),this.mode=t,this}},{key:"setAlphaRange",value:function(t,e){return this.alphaStart=t,this.alphaEnd=e,this}},{key:"start",value:function(){return this.timer.isRunning||(this.parent.setAlpha(this.alphaStart),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),c(s(o.prototype),"start",this).call(this)),this}},{key:"updateGameObject",value:function(t,e){var i=e.t;e.isOddIteration&&(i=1-i),t.alpha=Xi(this.alphaStart,this.alphaEnd,i);}},{key:"complete",value:function(){return c(s(o.prototype),"complete",this).call(this),1===this.mode&&this.parent.destroy(),this}}]),o}(wi),Vi={stop:0,destroy:1,yoyo:2},Ni=Phaser.Utils.Objects.IsPlainObject,Fi=function(t,e,i,n){var r,s;Ni(i)?(r=i.start,s=i.end):s=i,void 0===r&&(r=0),void 0===s&&(s=1);var o={mode:0,start:r,end:s,duration:e};return void 0===n?n=new Wi(t,o):n.resetFromJSON(o),n.restart(),n},Hi=function(t,e,i,n){i instanceof Wi&&(n=i,i=void 0),void 0===i&&(i=!0);var r={mode:i?1:0,end:0,duration:e};return void 0===n?n=new Wi(t,r):n.resetFromJSON(r),n.restart(),n},Bi=Phaser.Utils.Objects.IsPlainObject,Gi=function(t,e){e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0);})),e.on("update",(function(){var e=Ye.getParentSizer(t);e&&e.resetChildAlphaState(t);}));},Ui={fadeIn:function(t,e){if(Bi(t)){var i=t;t=i.duration,e=i.alpha;}var n=void 0===this._fade;return this._fade=Fi(this,t,e,this._fade),n&&Gi(this,this._fade),this._fade.completeEventName="fadein.complete",this},fadeInPromise:function(t,e){return this.fadeIn(t,e),ji(this._fade)},fadeOutDestroy:function(t,e){if(Bi(t)){var i=t;t=i.duration,e=i.destroy;}var n=void 0===this._fade;return this._fade=Hi(this,t,e,this._fade),n&&Gi(this,this._fade),this._fade.completeEventName="fadeout.complete",this},fadeOutDestroyPromise:function(t,e){return this.fadeOutDestroy(t,e),ji(this._fade)},fadeOut:function(t){return this.fadeOutDestroy(t,!1),this},fadeOutPromise:function(t){return this.fadeOut(t),ji(this._fade)}},Ji=Phaser.Utils.Objects.GetValue,Ki=Phaser.Utils.Objects.GetAdvancedValue,qi=Phaser.Math.Linear,Zi=function(t){r(o,t);var i=l(o);function o(t,n){var r;return e(this,o),(r=i.call(this,t,n)).resetFromJSON(n),r.boot(),r}return n(o,[{key:"resetFromJSON",value:function(t){if(c(s(o.prototype),"resetFromJSON",this).call(this,t),this.setMode(Ji(t,"mode",0)),t&&(t.hasOwnProperty("x")||t.hasOwnProperty("y"))){var e=Ki(t,"x",void 0),i=Ki(t,"y",void 0);this.setTargetPosition(e,i);}else this.setTargetPosition(t);return this}},{key:"setMode",value:function(t){return "string"==typeof t&&(t=Qi[t]),this.mode=t,this}},{key:"setTargetPosition",value:function(t,e){if("number"==typeof t||"number"==typeof e)this.startX=this.parent.x,this.startY=this.parent.y,this.endX=t,this.endY=e;else {var i=t;this.startX=Ki(i,"startX",void 0),this.startY=Ki(i,"startY",void 0),this.endX=Ki(i,"endX",void 0),this.endY=Ki(i,"endY",void 0);}return this.hasMoveX=void 0!==this.startX&&void 0!==this.endX,this.hasMoveY=void 0!==this.startY&&void 0!==this.endY,this}},{key:"start",value:function(){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),c(s(o.prototype),"start",this).call(this),this}},{key:"updateGameObject",value:function(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasMoveX&&(t.x=qi(this.startX,this.endX,i)),this.hasMoveY&&(t.y=qi(this.startY,this.endY,i));}},{key:"complete",value:function(){return c(s(o.prototype),"complete",this).call(this),1===this.mode&&this.parent.destroy(),this}}]),o}(wi),Qi={stop:0,destroy:1,yoyo:2},$i=function(t,e){if("number"==typeof t)return t;var i=t[0],n=parseFloat(t.substr(2));switch(i){case"+":return e+n;case"-":return e-n;case"*":return e*n;case"/":return e/n}},tn=Phaser.Utils.Objects.IsPlainObject,en=Phaser.Math.Distance.Between,nn=function(t,e){e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0);})),e.on("update",(function(){var e=Ye.getParentSizer(t);e&&e.resetChildPositionState(t);}));},rn={moveFrom:function(t,e,i,n,r){if(tn(t)){var s=t;e=s.x,i=s.y,t=s.hasOwnProperty("speed")?1e3*en(e,i,this.x,this.y)/s.speed:s.duration,n=s.ease;}var o=void 0===this._easeMove;return this._easeMove=function(t,e,i,n,r,s,o){s instanceof Zi&&(o=s,s=void 0),void 0===s&&(s=!1);var a={};return a.mode=s?1:0,void 0!==i&&(a.startX=$i(i,t.x),a.endX=t.x),void 0!==n&&(a.startY=$i(n,t.y),a.endY=t.y),a.duration=e,a.ease=void 0===r?"Linear":r,void 0===o?o=new Zi(t,a):o.resetFromJSON(a),o.restart(),o}(this,t,e,i,n,r,this._easeMove),o&&nn(this,this._easeMove),this._easeMove.completeEventName="movefrom.complete",this},moveFromPromise:function(t,e,i,n,r){return this.moveFrom(t,e,i,n,r),ji(this._easeMove)},moveFromDestroy:function(t,e,i,n){return this.moveFrom(t,e,i,n,!0),this},moveFromDestroyPromise:function(t,e,i,n){return this.moveFromDestroy(t,e,i,n),ji(this._easeMove)},moveTo:function(t,e,i,n,r){if(tn(t)){var s=t;e=s.x,i=s.y,t=s.hasOwnProperty("speed")?1e3*en(e,i,this.x,this.y)/s.speed:s.duration,n=s.ease;}var o=void 0===this._easeMove;return this._easeMove=function(t,e,i,n,r,s,o){s instanceof Zi&&(o=s,s=void 0),void 0===s&&(s=!1);var a={};return a.mode=s?1:0,void 0!==i&&(a.startX=t.x,a.endX=$i(i,t.x)),void 0!==n&&(a.startY=t.y,a.endY=$i(n,t.y)),a.duration=e,a.ease=void 0===r?"Linear":r,void 0===o?o=new Zi(t,a):o.resetFromJSON(a),o.restart(),o}(this,t,e,i,n,r,this._easeMove),o&&nn(this,this._easeMove),this._easeMove.completeEventName="moveto.complete",this},moveToPromise:function(t,e,i,n,r){return this.moveTo(t,e,i,n,r),ji(this._easeMove)},moveToDestroy:function(t,e,i,n){return this.moveTo(t,e,i,n,!0),this},moveToDestroyPromise:function(t,e,i,n){return this.moveToDestroy(t,e,i,n,!0),ji(this._easeMove)},moveStop:function(t){return this._easeMove?(this._easeMove.stop(t),this):this}},sn=Phaser.Utils.Objects.GetValue,on=function(t){r(o,t);var i=l(o);function o(t,n){var r;return e(this,o),(r=i.call(this,t,n)).timer=new vi,r.resetFromJSON(n),r.boot(),r}return n(o,[{key:"resetFromJSON",value:function(t){return this.timer.resetFromJSON(sn(t,"timer")),this.setEnable(sn(t,"enable",!0)),this.setMode(sn(t,"mode",1)),this.isRunning=sn(t,"isRunning",!1),this.setMagnitudeMode(sn(t,"magnitudeMode",1)),this.setAxisMode(sn(t,"axis",0)),this.setDuration(sn(t,"duration",500)),this.setMagnitude(sn(t,"magnitude",10)),this.ox=sn(t,"ox",void 0),this.oy=sn(t,"oy",void 0),this}},{key:"toJSON",value:function(){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}}},{key:"shutdown",value:function(t){this.isShutdown||(c(s(o.prototype),"shutdown",this).call(this,t),this.timer.destroy(),this.timer=void 0);}},{key:"startTicking",value:function(){c(s(o.prototype),"startTicking",this).call(this),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);}},{key:"stopTicking",value:function(){c(s(o.prototype),"stopTicking",this).call(this),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));}},{key:"setEnable",value:function(t){return null==t&&(t=!0),this.enable=t,this}},{key:"setMode",value:function(t){return "string"==typeof t&&(t=an[t]),this.mode=t,this}},{key:"setMagnitudeMode",value:function(t){return "string"==typeof t&&(t=ln[t]),this.magnitudeMode=t,this}},{key:"setAxisMode",value:function(t){return "string"==typeof t&&(t=hn[t]),this.axisMode=t,this}},{key:"setDuration",value:function(t){return this.duration=t,this}},{key:"setMagnitude",value:function(t){return this.magnitude=t,this}},{key:"start",value:function(t,e){if("number"!=typeof t){var i=t;e=sn(i,"magnitude",void 0),t=sn(i,"duration",void 0);}return void 0!==e&&this.setMagnitude(e),void 0!==t&&this.setDuration(t),this.timer.setDuration(this.duration).start(),c(s(o.prototype),"start",this).call(this),this}},{key:"shake",value:function(t,e){return this.start(t,e),this}},{key:"update",value:function(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 n=this.magnitude;1===this.magnitudeMode&&(n*=1-this.timer.t);var r=Math.random()*Math.PI*2,s=this.ox+Math.cos(r)*n,o=this.oy+Math.sin(r)*n;switch(this.axisMode){case 1:i.x=s;break;case 2:i.y=o;break;default:i.x=s,i.y=o;}}return this}},{key:"backToOrigin",value:function(){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}}]),o}(ai),an={effect:0,behavior:1},hn={both:0,"h&v":0,"x&y":0,horizontal:1,h:1,x:1,vertical:2,v:2,y:2},ln={constant:0,decay:1},un=Phaser.Utils.Objects.IsPlainObject,cn={shake:function(t,e,i){if(un(t)){var n=t;t=n.duration,e=n.magnitude,i=n.magnitudeMode;}return void 0===this._shake&&(this._shake=new on(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:function(t,e){return this.shake(t,e),ji(this._shake)}},dn=Phaser.Utils.Objects.GetValue,fn=Phaser.Math.Linear,vn=function(t){r(o,t);var i=l(o);function o(t,n){var r;return e(this,o),(r=i.call(this,t,n)).resetFromJSON(),r.boot(),r}return n(o,[{key:"start",value:function(t){if(this.timer.isRunning)return this;var e=this.target;this.propertyKey=dn(t,"key","value");var i=e[this.propertyKey];return this.fromValue=dn(t,"from",i),this.toValue=dn(t,"to",i),this.setEase(dn(t,"ease",this.ease)),this.setDuration(dn(t,"duration",this.duration)),this.setRepeat(dn(t,"repeat",0)),this.setDelay(dn(t,"delay",0)),this.setRepeatDelay(dn(t,"repeatDelay",0)),this.timer.setDuration(this.duration).setRepeat(this.repeat).setDelay(this.delay).setRepeatDelay(this.repeatDelay),e[this.propertyKey]=this.fromValue,c(s(o.prototype),"start",this).call(this),this}},{key:"updateGameObject",value:function(t,e){var i=e.t;i=this.easeFn(i),t[this.propertyKey]=fn(this.fromValue,this.toValue,i);}}]),o}(wi),pn=Phaser.Utils.Objects.IsPlainObject,gn=function(t){r(s,t);var i=l(s);function s(t,n){var r;return e(this,s),(r=i.call(this,t,n)).parent.setDataEnabled(),r.easeTasks={},r}return n(s,[{key:"complete",value:function(t){this.emit("complete-".concat(t),this.parent,this),this.emit("complete",t,this.parent,this);}},{key:"getEaseTask",value:function(t){var e=this.easeTasks[t];return void 0===e&&(e=new vn(this.parent),this.easeTasks[t]=e,e.setTarget(this.parent.data.values).on("complete",(function(){this.complete(t);}),this)),e}},{key:"easeTo",value:function(t,e,i,n){if(pn(t)){var r=t;t=r.key,e=r.value,i=r.duration,n=r.ease;var s=r.speed;void 0===i&&void 0!==s&&(i=Math.abs(e-this.parent.data.values[t])/s*1e3);}return void 0===i&&(i=1e3),void 0===n&&(n="Linear"),this.getEaseTask(t).restart({key:t,to:e,duration:i,ease:n}),this}},{key:"easeFrom",value:function(t,e,i,n){if(pn(t)){var r=t;t=r.key,e=r.value,i=r.duration,n=r.ease;var s=r.speed;void 0===i&&void 0!==s&&(i=Math.abs(e-this.parent.data.values[t])/s*1e3);}return void 0===i&&(i=1e3),void 0===n&&(n="Linear"),this.getEaseTask(t).restart({key:t,from:e,duration:i,ease:n}),this}},{key:"stopEase",value:function(t,e){void 0===e&&(e=!0);var i=this.easeTasks[t];return i&&i.stop(e),this}},{key:"stopAll",value:function(t){for(var e in void 0===t&&(t=!0),this.easeTasks)this.stopEase(e,t);return this}}]),s}(ri),yn={easeDataTo:function(t,e,i,n){return this._easeData||(this._easeData=new gn(this),function(t,e){e.on("complete",(function(e){t.emit("easedata.".concat(e,".complete"),t),t.emit("easedata.complete",e,t);}));}(this,this._easeData)),this._easeData.easeTo(t,e,i,n),this},easeDataToPromise:function(t,e,i,n){return this.easeDataTo(t,e,i,n),Ri(this._easeData,"complete-".concat(t))},stopEaseData:function(t,e){return this._easeData?(this._easeData.stopEase(t,e),this):this},stopAllEaseData:function(t){return this._easeData?(this._easeData.stopAll(t),this):this}},mn=function(t,e){if(t){Gt(t).hidden=e;var i=_(t);i?i.setChildVisible(t,!e):t.setVisible(!e);}},bn={show:function(t){return void 0===t&&(t=this),function(t){mn(t,!1);}(t),this},hide:function(t){return void 0===t&&(t=this),function(t){mn(t,!0);}(t),this},isShow:function(t){return void 0===t&&(t=this),function(t){return !!t&&!Gt(t).hidden}(t)}};function kn(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Cn={exports:{}};!function(t){var e=Object.prototype.hasOwnProperty,i="~";function n(){}function r(t,e,i){this.fn=t,this.context=e,this.once=i||!1;}function s(t,e,n,s,o){if("function"!=typeof n)throw new TypeError("The listener must be a function");var a=new r(n,s||t,o),h=i?i+e:e;return t._events[h]?t._events[h].fn?t._events[h]=[t._events[h],a]:t._events[h].push(a):(t._events[h]=a,t._eventsCount++),t}function o(t,e){0==--t._eventsCount?t._events=new n:delete t._events[e];}function a(){this._events=new n,this._eventsCount=0;}Object.create&&(n.prototype=Object.create(null),(new n).__proto__||(i=!1)),a.prototype.eventNames=function(){var t,n,r=[];if(0===this._eventsCount)return r;for(n in t=this._events)e.call(t,n)&&r.push(i?n.slice(1):n);return Object.getOwnPropertySymbols?r.concat(Object.getOwnPropertySymbols(t)):r},a.prototype.listeners=function(t){var e=i?i+t:t,n=this._events[e];if(!n)return [];if(n.fn)return [n.fn];for(var r=0,s=n.length,o=new Array(s);r0){var e=t.runTransitionInCallback();t.delayCall(e,this.next,this);}else this.next();}},{key:"exit_TRANS_OPNE",value:function(){this.parent.removeDelayCall();}},{key:"next_OPEN",value:function(){return "TRANS_CLOSE"}},{key:"enter_OPEN",value:function(){this.parent.onOpen();}},{key:"exit_OPEN",value:function(){this.parent.removeDelayCall();}},{key:"next_TRANS_CLOSE",value:function(){return "CLOSE"}},{key:"enter_TRANS_CLOSE",value:function(){var t=this.parent;if(t.transitOutTime>0){var e=t.runTransitionOutCallback();t.delayCall(e,this.next,this);}else this.next();}},{key:"exit_TRANS_CLOSE",value:function(){this.parent.removeDelayCall();}},{key:"next_CLOSE",value:function(){return "TRANS_OPNE"}},{key:"enter_CLOSE",value:function(){this.parent.onClose();}},{key:"exit_CLOSE",value:function(){}},{key:"canOpen",value:function(){return "IDLE"===this.state||"CLOSE"===this.state}},{key:"canClose",value:function(){return "IDLE"===this.state||"OPEN"===this.state}}]),s}(Tn),Dn={delayCall:function(t,e,i){return this.delayCallTimer=function(t,e,i,n,r){var s=$e(t);return s.time.delayedCall(e,(function(){s.game.events.once("poststep",(function(){i.call(n,r);}));}))}(this,t,e,i),this},removeDelayCall:function(){return this.delayCallTimer&&(this.delayCallTimer.remove(!1),this.delayCallTimer=void 0),this}},Rn={setTransitInTime:function(t){return this.transitInTime=t,this},setTransitOutTime:function(t){return this.transitOutTime=t,this},setTransitInCallback:function(t){return t||(t=$t),this.transitInCallback=t,this},setTransitOutCallback:function(t){return t||(t=$t),this.transitOutCallback=t,this}},jn={runTransitionInCallback:function(){return this.transitInCallback(this.parent,this.transitInTime),this.transitInTime},onOpen:function(){},requestOpen:function(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}},Ln={runTransitionOutCallback:function(){return this.transitOutCallback(this.parent,this.transitOutTime),this.transitOutTime},onClose:function(){this.oneShotMode&&this.parent.destroy();},requestClose:function(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}},zn={};Object.assign(zn,Dn,Rn,jn,Ln);var An=Phaser.Utils.Objects.GetValue,Yn=function(t){r(o,t);var i=l(o);function o(t,n){var r;return e(this,o),(r=i.call(this,t,n)).setTransitInTime(An(n,"duration.in",200)),r.setTransitOutTime(An(n,"duration.out",200)),r.setTransitInCallback(An(n,"transitIn")),r.setTransitOutCallback(An(n,"transitOut")),r.oneShotMode=An(n,"destroy",!1),r.delayCallTimer=void 0,r._state=new Mn(a(r),{eventEmitter:!1,initState:An(n,"initState","IDLE")}),r.openEventData=void 0,r.closeEventData=void 0,r}return n(o,[{key:"state",get:function(){return this._state.state}},{key:"shutdown",value:function(t){this.isShutdown||(this.transitInCallback=void 0,this.transitOutCallback=void 0,this.openEventData=void 0,this.closeEventData=void 0,this.removeDelayCall(),c(s(o.prototype),"shutdown",this).call(this,t));}}]),o}(ri);Object.assign(Yn.prototype,zn);var In=function(t){r(o,t);var i=l(o);function o(t,n,r){var s;return e(this,o),(s=i.call(this,t,0,0,2,2,n,1)).setAlpha(r),s.setScrollFactor(0),s.boot(),s}return n(o,[{key:"boot",value:function(){this.scene.sys.events.on("prerender",this.resize,this);}},{key:"destroy",value:function(t){this.scene&&!this.ignoreDestroy&&(this.scene.sys.events.off("prerender",this.resize,this),c(s(o.prototype),"destroy",this).call(this,t));}},{key:"tint",get:function(){return this.fillColor},set:function(t){this.setFillStyle(t,this.fillAlpha);}},{key:"resize",value:function(){var t=this.scene,e=t.sys.scale.gameSize,i=t.sys.cameras.main,n=e.width,r=e.height,s=1/i.zoom,o=n/2,a=r/2,h=n*s,l=r*s;this.x===o&&this.y===a||this.setPosition(o,a),this.width===h&&this.height===l||this.setSize(h,l).setOrigin(.5);}}]),o}(Phaser.GameObjects.Rectangle),Xn=Phaser.Utils.Objects.GetValue,Wn=function(t){r(s,t);var i=l(s);function s(t,n){var r;return e(this,s),(r=i.call(this,t,{eventEmitter:!1})).resetFromJSON(n),r.boot(),r}return n(s,[{key:"resetFromJSON",value:function(t){return this.setHitAreaMode(Xn(t,"hitAreaMode",0)),this.setEnable(Xn(t,"enable",!0)),this.setStopMode(Xn(t,"stopAllLevels",!0)),this}},{key:"boot",value:function(){this.parent.on("pointerdown",(function(t,e,i,n){this.stopAllLevels&&n.stopPropagation();}),this).on("pointerup",(function(t,e,i,n){this.stopAllLevels&&n.stopPropagation();}),this).on("pointermove",(function(t,e,i,n){this.stopAllLevels&&n.stopPropagation();}),this).on("pointerover",(function(t,e,i,n){this.stopAllLevels&&n.stopPropagation();}),this).on("pointerout",(function(t,e){this.stopAllLevels&&e.stopPropagation();}),this);}},{key:"setHitAreaMode",value:function(t){"string"==typeof t&&(t=Vn[t]);var e=this.parent;return e.input&&e.removeInteractive(),0===t?e.setInteractive():e.setInteractive({hitArea:{},hitAreaCallback:function(){return !0}}),this}},{key:"setEnable",value:function(t){return void 0===t&&(t=!0),t?this.parent.setInteractive():this.parent.disableInteractive(),this.enable=t,this}},{key:"setStopMode",value:function(t){return void 0===t&&(t=!0),this.stopAllLevels=t,this}},{key:"toggleEnable",value:function(){return this.setEnable(!this.enable),this}}]),s}(ri),Vn={default:0,fullWindow:1},Nn=Phaser.Utils.Objects.GetValue,Fn=function(t){r(s,t);var i=l(s);function s(t,n){var r;e(this,s);var o=Nn(n,"color",0),h=Nn(n,"alpha",.8);return (r=i.call(this,t,o,h)).touchEventStop=new Wn(a(r),{hitAreaMode:1}),r}return n(s)}(In),Hn=function(t,e){void 0!==t._modalScaleSave?(t.scaleX=t._modalScaleSave,t.scaleY=t._modalScaleSave):t._modalScaleSave=t.scaleX,Mi(t,e);},Bn=function(t,e){Di(t,e,void 0,void 0,!1);},Gn=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Fi(t,e);},Un=function(t,e){Hi(t,e,!1);},Jn=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Fi(t,e,t.alpha);},Kn=function(t,e){Hi(t,e,!1);},qn=function(t,e,i,n,r){return !!t&&(!(n&&!n(t,e,i))&&(!!kt(t,!0).contains(e,i)&&!(r&&!r(t,e,i))))},Zn=Phaser.Utils.Objects.GetValue,Qn=function(t){r(o,t);var i=l(o);function o(t,n){var r;e(this,o),void 0===n&&(n={}),null==n.transitIn&&(n.transitIn=$n.popUp),null==n.transitOut&&(n.transitOut=$n.scaleDown),n.destroy=Zn(n,"destroy",!0),r=i.call(this,t,n);var s=Zn(n,"cover");r.cover=!1!==s?function(t,e){var i=t.scene,n=new Fn(i,e);return i.add.existing(n),t.isRexContainerLite?(t.pin(n,{syncPosition:!1,syncRotation:!1,syncScale:!1,syncAlpha:!1,syncScrollFactor:!1}),t.moveDepthBelow(n)):i.children.moveBelow(n,t),n}(t,s):void 0,r.cover&&(r.setCoverTransitInCallback(Zn(s,"transitIn",Jn)),r.setCoverTransitOutCallback(Zn(s,"transitOut",Kn)));var h=Zn(n,"touchOutsideClose",!1),l=Zn(n,"duration.hold",-1),u=Zn(n,"timeOutClose",l>=0),c=Zn(n,"anyTouchClose",!1);return Zn(n,"manualClose",!1)&&(h=!1,c=!1,u=!1),c&&(h=!1),u?r.setDisplayTime(l):r.setDisplayTime(-1),c?r.once("open",r.anyTouchClose,a(r)):h&&r.once("open",r.touchOutsideClose,a(r)),Zn(n,"openOnStart",!0)&&r.delayCall(0,r.requestOpen,a(r)),r}return n(o,[{key:"shutdown",value:function(t){this.isShutdown||(this.cover||this.scene.input.off("pointerup",this.touchCloseCallback,this),this.cover&&!t&&(this.cover.destroy(),this.cover=void 0),c(s(o.prototype),"shutdown",this).call(this,t));}},{key:"touchOutsideClose",value:function(){return this.cover?this.cover.on("pointerup",this.touchCloseCallback,this):this.scene.input.on("pointerup",this.touchCloseCallback,this),this.clickOutsideTest=!0,this}},{key:"anyTouchClose",value:function(){return this.cover?this.cover.once("pointerup",this.touchCloseCallback,this):this.scene.input.once("pointerup",this.touchCloseCallback,this),this}},{key:"touchCloseCallback",value:function(t){this.clickOutsideTest&&qn(this.parent,t.worldX,t.worldY)||this.requestClose();}},{key:"runTransitionInCallback",value:function(){var t=c(s(o.prototype),"runTransitionInCallback",this).call(this),e=this.cover;return e&&this.coverTransitInCallback&&this.coverTransitInCallback(e,t),t}},{key:"runTransitionOutCallback",value:function(){var t=c(s(o.prototype),"runTransitionOutCallback",this).call(this),e=this.cover;return e&&this.coverTransitOutCallback&&this.coverTransitOutCallback(e,t),t}},{key:"onOpen",value:function(){var t=this.displayTime;t>=0&&this.delayCall(t,this.requestClose,this),this.emit("open",this.parent,this),c(s(o.prototype),"onOpen",this).call(this);}},{key:"onClose",value:function(){this.emit("close",this.closeEventData),c(s(o.prototype),"onClose",this).call(this);}},{key:"setDisplayTime",value:function(t){return this.displayTime=t,this}},{key:"setTransitInCallback",value:function(t){switch("string"==typeof t&&(t=$n[t]),t){case $n.popUp:t=Hn;break;case $n.fadeIn:t=Gn;}return c(s(o.prototype),"setTransitInCallback",this).call(this,t),this}},{key:"setTransitOutCallback",value:function(t){switch("string"==typeof t&&(t=$n[t]),t){case $n.scaleDown:t=Bn;break;case $n.fadeOut:t=Un;}return c(s(o.prototype),"setTransitOutCallback",this).call(this,t),this}},{key:"setCoverTransitInCallback",value:function(t){return this.coverTransitInCallback=t,this}},{key:"setCoverTransitOutCallback",value:function(t){return this.coverTransitOutCallback=t,this}}]),o}(Yn),$n={popUp:0,fadeIn:1,scaleDown:0,fadeOut:1},tr=function(t){return t&&"function"==typeof t},er={modal:function(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 Qn(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:function(t){var e=this;return new Promise((function(i,n){e.modal(t,i);}))},modalClose:function(t){return function(t,e){t.emit("modal.requestClose",e);}(this,t),this}},ir=function(t,e,i,n){if(e)return qn(t,e.worldX,e.worldY,i,n);for(var r=t.scene.input.manager,s=r.pointersTotal,o=r.pointers,a=0;a=this.dragThreshold&&this.cancel();}},{key:"click",value:function(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 n=this.lastClickTime;return void 0!==n&&t-n<=this.clickInterval||(this.lastClickTime=t,this.emit("click",this,this.parent,e,i)),this}},{key:"cancel",value:function(){return this.pointer=void 0,this}},{key:"onOver",value:function(t,e,i,n){return this.enable?(this.emit("over",this,this.parent,t,n),this):this}},{key:"onOut",value:function(t,e){return this.enable?(this.emit("out",this,this.parent,t,e),this):this}}]),o}(ri),gr={press:0,pointerdown:0,release:1,pointerup:1},yr={onClick:function(t,e,i,n){return t?("function"==typeof t&&(n=i,i=e,e=t,t=this),void 0===t._click&&(t._click=new pr(t,n)),t._click.on("click",e,i),this):this},offClick:function(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:function(e,i){return e&&"object"!==t(e)&&(i=e,e=this),void 0===e._click||e._click.setEnable(i),this},disableClick:function(e){return e&&"object"!==t(e)&&(e=this),void 0===e._click||e._click.setEnable(!1),this}},mr=function(t,e,i,n){if(e)return !(i&&!i(t,e))&&(!!br(t,e)&&!(n&&!n(t,e)));for(var r=t.scene.input.manager,s=r.pointersTotal,o=r.pointers,a=0;a0)return kr.length=0,!0;return kr.length=0,!1},kr=[],Cr=Phaser.Utils.Objects.GetValue,xr=function(t){r(o,t);var i=l(o);function o(t,n){var r;e(this,o),(r=i.call(this,t,n))._enable=void 0;var s=Cr(n,"inputConfig",void 0);return s&&t.setInteractive(s),r.resetFromJSON(n),r.boot(),r}return n(o,[{key:"resetFromJSON",value:function(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}},{key:"boot",value:function(){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);}},{key:"shutdown",value:function(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,c(s(o.prototype),"shutdown",this).call(this,t);}}},{key:"enable",get:function(){return this._enable},set:function(t){if(this._enable!==t){t||this.cancel(),this._enable=t;var e=t?"enable":"disable";this.emit(e,this,this.parent);}}},{key:"setEnable",value:function(t){return void 0===t&&(t=!0),this.enable=t,this}},{key:"toggleEnable",value:function(){return this.setEnable(!this.enable),this}},{key:"setMode",value:function(t){return "string"==typeof t&&(t=Sr[t]),this.mode=t,this}},{key:"setClickInterval",value:function(t){return this.clickInterval=t,this}},{key:"setDragThreshold",value:function(t){return this.dragThreshold=t,this}},{key:"isPointerInside",value:function(t){var e=this.parent;return (e.input?mr:ir)(e,t)}},{key:"onPress",value:function(t){this.parent.willRender(t.camera)&&void 0===this.pointer&&(this.pointer=t,0===this.mode&&(this.isPointerInside(t)||this.click(t.downTime,t)));}},{key:"onRelease",value:function(t){this.parent.willRender(t.camera)&&this.pointer===t&&(1===this.mode&&(this.isPointerInside(t)||this.click(t.upTime,t)),this.pointer=void 0);}},{key:"onMove",value:function(t,e,i,n){this.pointer===t&&void 0!==this.dragThreshold&&1===this.mode&&(t.getDistance()>=this.dragThreshold||this.isPointerInside(t))&&this.cancel();}},{key:"click",value:function(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}},{key:"cancel",value:function(){return this.pointer=void 0,this}}]),o}(ri),Sr={press:0,pointerdown:0,release:1,pointerup:1},wr={onClickOutside:function(t,e,i,n){return t?("function"==typeof t&&(n=i,i=e,e=t,t=this),void 0===t._clickOutside&&(t._clickOutside=new xr(t,n)),t._clickOutside.on("clickoutside",e,i),this):this},offClickOutside:function(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:function(e,i){return e&&"object"!==t(e)&&(i=e,e=this),void 0===e._clickOutside||e._clickOutside.setEnable(i),this},disableClickOutside:function(e){return e&&"object"!==t(e)&&(e=this),void 0===e._clickOutside||e._clickOutside.setEnable(!1),this}},_r=function(t){r(s,t);var i=l(s);function s(){var t;return e(this,s),(t=i.call(this,{eventEmitter:!1})).goto("IDLE"),t}return n(s,[{key:"setCooldownTime",value:function(t){return this.cooldownTime=t,this.cooldownMode=void 0!==t,this}},{key:"request",value:function(){return this.runMethod("request")}},{key:"update_IDLE",value:function(){this.compensationTime=0;}},{key:"request_IDLE",value:function(){return this.next(),!0}},{key:"next_IDLE",value:function(){if(this.cooldownMode)return "COOLDOWN"}},{key:"enter_COOLDOWN",value:function(){this.remainderTime=this.cooldownTime+this.compensationTime;}},{key:"update_COOLDOWN",value:function(t,e){this.remainderTime-=e,this.remainderTime<0&&(this.compensationTime=this.cooldownTime>e?-this.remainderTime:0,this.goto("IDLE"));}},{key:"request_COOLDOWN",value:function(){return !1}}]),s}(Tn),Or=Phaser.Utils.Objects.GetValue,Pr=function(t){r(o,t);var i=l(o);function o(t,n){var r;return e(this,o),(r=i.call(this,t,n))._enable=void 0,r.cooldown=new _r,r.parent.setInteractive(Or(n,"inputConfig",void 0)),r.resetFromJSON(n),r.boot(),r}return n(o,[{key:"resetFromJSON",value:function(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}},{key:"boot",value:function(){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);}},{key:"shutdown",value:function(t){this.isShutdown||(this.scene.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,c(s(o.prototype),"shutdown",this).call(this,t));}},{key:"enable",get:function(){return this._enable},set:function(t){if(this._enable!==t)return t||(this.prevIsInTouch=!1,this.isInTouching=!1,this.pointer=void 0),this._enable=t,this}},{key:"setEnable",value:function(t){return void 0===t&&(t=!0),this.enable=t,this}},{key:"cooldownTime",get:function(){return this.cooldown.cooldownTime},set:function(t){this.cooldown.setCooldownTime(t);}},{key:"setCooldown",value:function(t){return this.cooldownTime=t,this}},{key:"toggleEnable",value:function(){return this.setEnable(!this.enable),this}},{key:"onPointIn",value:function(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.pointer=t,this.isInTouching=!0);}},{key:"onPointOut",value:function(t){this.enable&&this.pointer===t&&(this.pointer=void 0,this.isInTouching=!1);}},{key:"preupdate",value:function(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;}}]),o}(ri),Er={isPointerInBounds:function(t){return void 0===t?t=this:"string"==typeof t&&(t=this.getElement(t)),!!t&&ir(t)},onTouching:function(t,e,i,n){return t?("function"==typeof t&&(n=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new Pr(t,n)),t._inTouching.on("intouch",e,i),this):this},offTouching:function(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:function(t,e,i,n){return t?("function"==typeof t&&(n=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new Pr(t,n)),t._inTouching.on("touchend",e,i),this):this},offTouchingEnd:function(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:function(e,i){return e&&"object"!==t(e)&&(i=e,e=this),void 0===e._inTouching||e._inTouching.setEnable(i),this},disableTouching:function(e){return e&&"object"!==t(e)&&(e=this),void 0===e._inTouching||e._inTouching.setEnable(!1),this}},Tr=function(t,e,i){for(var n,r=0,s=t.length;r0),this.onDragStart()));}},{key:"onPointerUp",value:function(t){this.enable&&((!this.bounds||this.bounds.contains(t.x,t.y))&&this.pointer===t&&(this.pointer=void 0,this.movedState=!1,this.tracerState=Br,this.onDragEnd()));}},{key:"onPointerMove",value:function(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()));}}},{key:"dragCancel",value:function(){return this.tracerState===Gr&&this.onDragEnd(),this.pointer=void 0,this.tracerState=Br,this}},{key:"onDragStart",value:function(){this.emit("dragstart",this);}},{key:"onDragEnd",value:function(){this.emit("dragend",this);}},{key:"onDrag",value:function(){this.emit("drag",this);}},{key:"preUpdate",value:function(t,e){}},{key:"postUpdate",value:function(t,e){}},{key:"startTicking",value:function(){c(s(o.prototype),"startTicking",this).call(this),this.scene.sys.events.on("preupdate",this.preUpdate,this),this.scene.sys.events.on("postupdate",this.postUpdate,this);}},{key:"stopTicking",value:function(){c(s(o.prototype),"stopTicking",this).call(this),this.scene&&(this.scene.sys.events.off("preupdate",this.preUpdate,this),this.scene.sys.events.off("postupdate",this.postUpdate,this));}},{key:"setRecongizedStateObject",value:function(t){return this.recongizedState=t,this}},{key:"state",get:function(){return this.recongizedState.state},set:function(t){this.recongizedState.state=t;}},{key:"cancel",value:function(){return this.state=Ur,this}}]),o}(ai),Br=0,Gr=1,Ur="IDLE",Jr=Phaser.Utils.Objects.GetValue,Kr=Phaser.Math.Distance.Between,qr=function(t){r(o,t);var i=l(o);function o(t,n){var r;e(this,o);var s=a(r=i.call(this,t,n)),h={states:{IDLE:{enter:function(){s.stop(),s.tapsCount=0,s.x=0,s.y=0,s.worldX=0,s.worldY=0;},exit:function(){var t=s.lastPointer;s.x=t.x,s.y=t.y,s.worldX=t.worldX,s.worldY=t.worldY;}},BEGIN:{enter:function(){s.start(),s.tapsCount=0,s.emit("tappingstart",s,s.gameObject,s.lastPointer);}},RECOGNIZED:{enter:function(){s.start(),s.emit("tap",s,s.gameObject,s.lastPointer),s.emit("".concat(s.tapsCount,"tap"),s,s.gameObject,s.lastPointer);}}},init:function(){this.state=Zr;},eventEmitter:!1};return r.setRecongizedStateObject(new Tn(h)),r}return n(o,[{key:"resetFromJSON",value:function(t){c(s(o.prototype),"resetFromJSON",this).call(this,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}},{key:"onDragStart",value:function(){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=$r,this.state=Qr);break;case $r:this.state=Qr;}}},{key:"onDragEnd",value:function(){this.state===Qr&&(this.tapsCount++,this.emit("tapping",this,this.gameObject,this.lastPointer),void 0!==this.maxTaps&&this.tapsCount===this.maxTaps&&(this.state=$r));}},{key:"onDrag",value:function(){this.state!==Zr&&this.pointer.getDistance()>this.dragThreshold&&(this.state=Zr);}},{key:"preUpdate",value:function(t,e){if(this.isRunning&&this.enable&&this.state===Qr){var i=this.lastPointer;if(i.isDown)t-i.downTime>this.holdTime&&(this.state=Zr);else t-i.upTime>this.tapInterval&&(void 0===this.minTaps||this.tapsCount>=this.minTaps?this.state=$r:this.state=Zr);}}},{key:"postUpdate",value:function(t,e){this.isRunning&&this.enable&&this.state===$r&&(this.state=Zr);}},{key:"isTapped",get:function(){return this.state===$r}},{key:"setHoldTime",value:function(t){return this.holdTime=t,this}},{key:"setTapInterval",value:function(t){return this.tapInterval=t,this}},{key:"setDragThreshold",value:function(t){return this.dragThreshold=t,this}},{key:"setTapOffset",value:function(t){return this.tapOffset=t,this}},{key:"setMaxTaps",value:function(t){return this.maxTaps=t,this}},{key:"setMinTaps",value:function(t){return this.minTaps=t,this}},{key:"setTaps",value:function(t,e){return void 0===e&&(e=t),this.setMinTaps(t).setMaxTaps(e),this}}]),o}(Hr),Zr="IDLE",Qr="BEGIN",$r="RECOGNIZED",ts=Phaser.Utils.Objects.GetValue,es=function(t){r(o,t);var i=l(o);function o(t,n){var r;e(this,o);var s=a(r=i.call(this,t,n)),h={states:{IDLE:{enter:function(){s.x=0,s.y=0,s.worldX=0,s.worldY=0;},exit:function(){var t=s.lastPointer;s.x=t.x,s.y=t.y,s.worldX=t.worldX,s.worldY=t.worldY;}},BEGIN:{enter:function(){s.start();},exit:function(){s.stop();}},RECOGNIZED:{enter:function(){s.emit("pressstart",s,s.gameObject,s.lastPointer);},exit:function(){s.emit("pressend",s,s.gameObject,s.lastPointer);}}},init:function(){this.state=is;},eventEmitter:!1};return r.setRecongizedStateObject(new Tn(h)),r}return n(o,[{key:"resetFromJSON",value:function(t){return c(s(o.prototype),"resetFromJSON",this).call(this,t),this.setDragThreshold(ts(t,"threshold",9)),this.setHoldTime(ts(t,"time",251)),this}},{key:"onDragStart",value:function(){this.state=ns,0===this.holdTime&&(this.state=rs);}},{key:"onDragEnd",value:function(){this.state=is;}},{key:"onDrag",value:function(){this.state!==is&&this.pointer.getDistance()>this.dragThreshold&&(this.state=is);}},{key:"preUpdate",value:function(t,e){this.isRunning&&this.enable&&(this.state===ns&&t-this.pointer.downTime>=this.holdTime&&(this.state=rs));}},{key:"isPressed",get:function(){return this.state===rs}},{key:"setHoldTime",value:function(t){return this.holdTime=t,this}},{key:"setDragThreshold",value:function(t){return this.dragThreshold=t,this}}]),o}(Hr),is="IDLE",ns="BEGIN",rs="RECOGNIZED";Phaser.Utils.Objects.GetValue;var ss=function(t){return ii(t).loop.delta},os=Phaser.Math.Distance.Between,as=Phaser.Math.Angle.Between,hs={getDt:function(){return ss(this.scene)},getVelocity:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return os(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 as(e.x,e.y,t.x,t.y)}},ls={"up&down":0,"left&right":1,"4dir":2,"8dir":3},us={},cs=Phaser.Utils.Objects.GetValue,ds=Phaser.Math.RadToDeg,fs=function(t){r(o,t);var i=l(o);function o(t,n){var r;e(this,o);var s=a(r=i.call(this,t,n)),h={states:{IDLE:{enter:function(){s.x=0,s.y=0,s.worldX=0,s.worldY=0;},exit:function(){var t=s.lastPointer;s.x=t.x,s.y=t.y,s.worldX=t.worldX,s.worldY=t.worldY;}},BEGIN:{enter:function(){s.validDrag=!1;}},RECOGNIZED:{enter:function(){s.start(),s.updateDirectionStates(),s.emit("swipe",s,s.gameObject,s.lastPointer);},exit:function(){s.stop(),s.clearDirectionStates();}}},init:function(){this.state=vs;},eventEmitter:!1};return r.setRecongizedStateObject(new Tn(h)),r.clearDirectionStates(),r}return n(o,[{key:"resetFromJSON",value:function(t){return c(s(o.prototype),"resetFromJSON",this).call(this,t),this.setDragThreshold(cs(t,"threshold",10)),this.setVelocityThreshold(cs(t,"velocityThreshold",1e3)),this.setDirectionMode(cs(t,"dir","8dir")),this}},{key:"onDragStart",value:function(){this.state=ps;}},{key:"onDragEnd",value:function(){this.state=vs;}},{key:"onDrag",value:function(){this.state===ps&&(this.validDrag||(this.validDrag=0===this.dragThreshold||this.pointer.getDistance()>=this.dragThreshold),this.validDrag&&this.dragVelocity>this.velocityThreshold&&(this.state=gs));}},{key:"postUpdate",value:function(t,e){this.isRunning&&this.enable&&this.state===gs&&(this.state=vs);}},{key:"isSwiped",get:function(){return this.state===gs}},{key:"dragVelocity",get:function(){var t;switch(this.dirMode){case 0:t=this.getVelocityY();break;case 1:t=this.getVelocityX();break;default:t=this.getVelocity();}return t}},{key:"setDragThreshold",value:function(t){return this.dragThreshold=t,this}},{key:"setVelocityThreshold",value:function(t){return this.velocityThreshold=t,this}},{key:"setDirectionMode",value:function(t){return "string"==typeof t&&(t=ls[t]),this.dirMode=t,this}},{key:"updateDirectionStates",value:function(){return function(t,e,i){switch(void 0===i?i={}:!0===i&&(i=us),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;}}(ds(this.getVelocityAngle()),this.dirMode,this),this}},{key:"clearDirectionStates",value:function(){return this.left=!1,this.right=!1,this.up=!1,this.down=!1,this}}]),o}(Hr);Object.assign(fs.prototype,hs);var vs="IDLE",ps="BEGIN",gs="RECOGNIZED",ys=Phaser.Utils.Objects.GetValue,ms=Phaser.Utils.Array.SpliceOne,bs=Phaser.Math.Distance.Between,ks=Phaser.Math.Angle.Between,Cs=function(){function t(i,n){e(this,t);var r=i.input.manager.pointersTotal-1;r<2&&i.input.addPointer(2-r),this.scene=i,this.setEventEmitter(ys(n,"eventEmitter",void 0)),this._enable=void 0,this.pointers=[],this.movedState={},this.resetFromJSON(n),this.boot();}return n(t,[{key:"resetFromJSON",value:function(t){return this.setEnable(ys(t,"enable",!0)),this.bounds=ys(t,"bounds",void 0),this.tracerState=Ss,this.pointers.length=0,Mt(this.movedState),this}},{key:"boot",value:function(){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);}},{key:"shutdown",value:function(){this.scene&&(this.destroyEventEmitter(),this.pointers.length=0,Mt(this.movedState),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);}},{key:"destroy",value:function(){this.shutdown();}},{key:"enable",get:function(){return this._enable},set:function(t){if(this._enable!==t)return t||this.dragCancel(),this._enable=t,this}},{key:"setEnable",value:function(t){return void 0===t&&(t=!0),this.enable=t,this}},{key:"toggleEnable",value:function(){return this.setEnable(!this.enable),this}},{key:"onPointerDown",value:function(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.tracerState){case Ss:this.tracerState=ws,this.onDrag1Start();break;case ws:this.tracerState=_s,this.onDrag2Start();}}},{key:"onPointerUp",value:function(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],ms(this.pointers,e),this.tracerState){case ws:this.tracerState=Ss,this.onDrag1End();break;case _s:this.tracerState=ws,this.onDrag2End(),this.onDrag1Start();}}}},{key:"onPointerMove",value:function(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 ws:this.onDrag1();break;case _s:this.onDrag2();}}}},{key:"dragCancel",value:function(){return this.tracerState===_s&&this.onDrag2End(),this.pointers.length=0,Mt(this.movedState),this.tracerState=Ss,this}},{key:"onDrag1Start",value:function(){this.emit("drag1start",this);}},{key:"onDrag1End",value:function(){this.emit("drag1end",this);}},{key:"onDrag1",value:function(){this.emit("drag1",this);}},{key:"onDrag2Start",value:function(){this.emit("drag2start",this);}},{key:"onDrag2End",value:function(){this.emit("drag2end",this);}},{key:"onDrag2",value:function(){this.emit("drag2",this);}},{key:"distanceBetween",get:function(){if(this.tracerState!==_s)return 0;var t=this.pointers[0],e=this.pointers[1];return bs(t.x,t.y,e.x,e.y)}},{key:"angleBetween",get:function(){if(this.tracerState!==_s)return 0;var t=this.pointers[0],e=this.pointers[1];return ks(t.x,t.y,e.x,e.y)}},{key:"drag1Vector",get:function(){var t=this.pointers[0];if(t&&this.movedState[t.id]){var e=t.position,i=t.prevPosition;xs.x=e.x-i.x,xs.y=e.y-i.y;}else xs.x=0,xs.y=0;return xs}},{key:"centerX",get:function(){if(this.tracerState!==_s)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return (t.x+e.x)/2}},{key:"centerY",get:function(){if(this.tracerState!==_s)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return (t.y+e.y)/2}},{key:"prevCenterX",get:function(){if(this.tracerState!==_s)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}},{key:"prevCenterY",get:function(){if(this.tracerState!==_s)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}},{key:"movementCenterX",get:function(){return this.centerX-this.prevCenterX}},{key:"movementCenterY",get:function(){return this.centerY-this.prevCenterY}},{key:"setRecongizedStateObject",value:function(t){return this.recongizedState=t,this}},{key:"state",get:function(){return this.recongizedState.state},set:function(t){this.recongizedState.state=t;}},{key:"cancel",value:function(){return this.state=Os,this}}]),t}();Object.assign(Cs.prototype,qe);var xs={},Ss=0,ws=1,_s=2,Os="IDLE";Phaser.Utils.Objects.GetValue;var Ps=Phaser.Math.RotateAround,Es=function(t,e,i,n){return Ps(t,e,i,n),t.rotation+=n,t},Ts={},Ms=Phaser.Utils.Objects.GetValue,Ds=Phaser.Math.Angle.WrapDegrees,Rs=Phaser.Math.Angle.ShortestBetween,js=Phaser.Math.RadToDeg,Ls=Phaser.Math.DegToRad,zs=function(t){r(o,t);var i=l(o);function o(t,n){var r;e(this,o);var s=a(r=i.call(this,t,n)),h={states:{IDLE:{enter:function(){s.prevAngle=void 0,s.angle=0;}},BEGIN:{},RECOGNIZED:{enter:function(){s.emit("rotatestart",s);},exit:function(){s.emit("rotateend",s);}}},init:function(){this.state=Ys;},eventEmitter:!1};return r.setRecongizedStateObject(new Tn(h)),r}return n(o,[{key:"resetFromJSON",value:function(t){return c(s(o.prototype),"resetFromJSON",this).call(this,t),this.setDragThreshold(Ms(t,"threshold",0)),this}},{key:"onDrag2Start",value:function(){this.prevAngle=Ds(js(this.angleBetween)),this.state=Is,0===this.dragThreshold&&(this.state=Xs);}},{key:"onDrag2End",value:function(){this.state=Ys;}},{key:"onDrag2",value:function(){switch(this.state){case Is:if(this.pointers[0].getDistance()>=this.dragThreshold&&this.pointers[1].getDistance()>=this.dragThreshold){var t=Ds(js(this.angleBetween));this.angle=Rs(this.prevAngle,t),this.prevAngle=t,this.state=Xs;}break;case Xs:t=Ds(js(this.angleBetween));this.angle=Rs(this.prevAngle,t),this.prevAngle=t,this.emit("rotate",this);}}},{key:"isRotated",get:function(){return this.state===Xs}},{key:"rotation",get:function(){return Ls(this.angle)}},{key:"setDragThreshold",value:function(t){return this.dragThreshold=t,this}}]),o}(Cs),As={spinObject:function(t,e){if(!this.isRotation)return this;void 0===e&&(e=this.pointers[0].camera);var i=this.movementCenterX,n=this.movementCenterY,r=function(t,e,i,n){return void 0===n?n={}:!0===n&&(n=Ts),i.getWorldPoint(t,e,n),n}(this.centerX,this.centerY,e,!0),s=r.x,o=r.y,a=this.rotation;if(Array.isArray(t))for(var h=t,l=0,u=h.length;l=this.sizerChildren.length?this.sizerChildren.push(e):this.sizerChildren.splice(a,0,e),e.isRexSizer||(i>0&&(0===this.orientation?e.minWidth=void 0===h?pt(e):h:e.minHeight=void 0===l?gt(e):l),s&&(0===this.orientation?e.minHeight=l:e.minWidth=h)),void 0!==o&&this.addChildrenMap(o,e),this},oo={add:so,addSpace:function(t){return this.insertSpace(void 0,t),this},insertSpace:function(t,e){return void 0===e&&(e=1),so.call(this,new $s(this.scene),{proportion:e,minWidth:0,minHeight:0,index:t}),this},insert:function(t,e,i,n,r,s,o,a){return eo(i)&&(i.index=t),so.call(this,e,i,n,r,s,o,t,a),this},insertAtPosition:function(t,e,i,n,r,s,o,a,h){var l=to.call(this,t,e);return -1===l&&(l=void 0),this.insert(l,i,n,r,s,o,a,h),this}},ao=Bt.prototype.clear,ho=function(t){this.backgroundChildren&&(this.backgroundChildren.length=0);var e,i=!t&&this.sizerEventsEnable;if(i&&(e=this.getChildren([])),ao.call(this,t),i)for(var n,r=0,s=e.length;r=0;e--)this.remove(this.sizerChildren[e],t);return this},clear:function(t){return this.sizerChildren.length=0,ho.call(this,t),this}},co={getChildAlign:function(t){return this.getSizerConfig(t).align},setChildAlign:function(t,e){return "string"==typeof e&&(e=Qt[e]),this.getSizerConfig(t).align=e,this}},fo={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,n,r=0,s=this.sizerChildren;if(0===this.orientation)for(var o=this.space.item,a=!0,h=0,l=s.length;h0&&this.proportionLength>0&&(i=n.proportion*this.proportionLength):n.expand&&(i=e-this.space.left-this.space.right-r.left-r.right);return i},getExpandedChildHeight:function(t,e){var i;void 0===e&&(e=this.height);var n=t.rexSizer,r=n.padding;0===this.orientation?n.expand&&(i=e-this.space.top-this.space.bottom-r.top-r.bottom):n.proportion>0&&this.proportionLength>0&&(i=n.proportion*this.proportionLength);return i},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,n=0,r=i.length;n0?(e=t-this.getChildrenWidth(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0;}return t},resolveHeight:function(t){t=Ue.call(this,t);if(void 0===this.proportionLength&&1===this.orientation){var e=t-this.childrenHeight;e>0?(e=t-this.getChildrenHeight(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0;}return t}};Object.assign(fo,oo,uo,co,{getChildProportion:function(t){return this.getSizerConfig(t).proportion},setChildProportion:function(t,e){return this.getSizerConfig(t).proportion=e,this}},{getChildExpand:function(t){return this.getSizerConfig(t).expand},setChildExpand:function(t,e){return this.getSizerConfig(t).expand=e,this}});var vo=function(){for(var t,e,i=0,n=this.sizerChildren,r=0,s=n.length;r0&&(i+=e);return i},po={x:0,h:0,horizontal:0,"left-to-right":0,y:1,v:1,vertical:1,"top-to-bottom":1},go=Phaser.Utils.Objects.IsPlainObject,yo=Phaser.Utils.Objects.GetValue,mo=function(t){r(s,t);var i=l(s);function s(t,n,r,o,a,h,l){var u;return e(this,s),go(n)?(n=yo(l=n,"x",0),r=yo(l,"y",0),o=yo(l,"width",void 0),a=yo(l,"height",void 0),h=yo(l,"orientation",0)):go(o)?(o=yo(l=o,"width",void 0),a=yo(l,"height",void 0),h=yo(l,"orientation",0)):go(h)&&(h=yo(l=h,"orientation",0)),void 0===h&&(h=0),(u=i.call(this,t,n,r,o,a,l)).type="rexSizer",u.sizerChildren=[],u.setOrientation(h),u.setItemSpacing(yo(l,"space.item",0)),u.setStartChildIndex(yo(l,"startChildIndex",0)),u.setRTL(yo(l,"rtl",!1)),u.addChildrenMap("items",u.sizerChildren),u}return n(s,[{key:"setOrientation",value:function(t){return this.orientation=function(t){return "string"==typeof t&&(t=po[t]),t}(t),this}},{key:"setItemSpacing",value:function(t){return this.space.item=t,this}},{key:"setStartChildIndex",value:function(t){return this.startChildIndex=t,this}},{key:"setRTL",value:function(t){return void 0===t&&(t=!0),this.rtl=t,this}},{key:"childrenProportion",get:function(){return void 0===this._childrenProportion&&(this._childrenProportion=vo.call(this)),this._childrenProportion}}]),s}(qs);Object.assign(mo.prototype,fo);var bo={v:0,vertical:0,y:0,h:1,horizontal:1,x:1,xy:2,vh:2},ko=function(t){var e=!!t.sliderY||!!t.scrollerY,i=!!t.sliderX||!!t.scrollerX;return e&&i?2:e?0:i?1:0},Co=function(){return Array.prototype.reduce.call(arguments,xo,0)},xo=function(t,e){return t+e},So=Phaser.Utils.Objects.IsPlainObject,wo=Phaser.Utils.Objects.GetValue,_o=Phaser.Display.Align.CENTER,Oo=function(t,e,i,n,r){if("number"==typeof t||"number"==typeof e)if(void 0===t){for(var s=0;s=0;e--){var i=this.sizerChildren[e];i&&this.remove(i,t);}return this},clear:function(t){return Eo(this.sizerChildren,null),ho.call(this,t),this}},Mo={setColumnSpace:function(t){if(this.space.column||(this.space.column=[]),this.space.column.length=this.columnCount-1,"number"==typeof t)Eo(this.space.column,t);else for(var e=0,i=this.columnCount-1;e=0;n--){var r=n*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},Lo={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);for(var e,i,n,r,s=0,o=this.sizerChildren,a=0;a0){var i=t-this.getChildrenWidth(!1);i>=0&&(this.proportionWidthLength=i/e);}else this.proportionWidthLength=0;}return t},resolveHeight:function(t){t=Ue.call(this,t);if(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,n;for(var r in this.sizerChildren)(e=this.sizerChildren[r])&&e.isRexSizer&&!e.ignoreLayout&&(n=this.getColumnWidth(parseInt(r)%this.columnCount),i=this.getExpandedChildWidth(e,n),i=e.resolveWidth(i),e.resolveChildrenWidth(i));},runWidthWrap:function(t){var e,i,n;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(n=this.getColumnWidth(parseInt(r)%this.columnCount),i=this.getExpandedChildWidth(e,n),e.isRexSizer&&(i=e.resolveWidth(i)),e.runWidthWrap(i));return this},resetGrid:function(t,e,i,n,r){if(void 0===i&&(i=0),void 0===n&&(n=0),this.columnCount=t,this.rowCount=e,this.gridCount=t*e,this.removeAll(),this.sizerChildren.length=t*e,Eo(this.sizerChildren,null),this.columnProportions=[],this.columnProportions.length=t,"number"==typeof i)Eo(this.columnProportions,i);else for(var s=0;s0&&(e+=t);return e},Ao=function(){for(var t,e=0,i=0;i0&&(e+=t);return e},Yo=Phaser.Utils.Objects.IsPlainObject,Io=Phaser.Utils.Objects.GetValue,Xo=function(t){r(o,t);var i=l(o);function o(t,n,r,s,a,h,l,u,c,d){var f;return e(this,o),Yo(n)?(n=Io(d=n,"x",0),r=Io(d,"y",0),s=Io(d,"width",void 0),a=Io(d,"height",void 0),h=Io(d,"column",d.col||0),l=Io(d,"row",0),u=Io(d,"columnProportions",0),c=Io(d,"rowProportions",0)):Yo(s)?(s=Io(d=s,"width",void 0),a=Io(d,"height",void 0),h=Io(d,"column",d.col||0),l=Io(d,"row",0),u=Io(d,"columnProportions",0),c=Io(d,"rowProportions",0)):Yo(h)?(h=Io(d=h,"column",d.col||0),l=Io(d,"row",0),u=Io(d,"columnProportions",0),c=Io(d,"rowProportions",0)):Yo(u)&&(u=Io(d=u,"columnProportions",0),c=Io(d,"rowProportions",0)),(f=i.call(this,t,n,r,s,a,d)).type="rexGridSizer",f.sizerChildren=[],f.addChildrenMap("items",f.sizerChildren),f.setCreateCellContainerCallback(Io(d,"createCellContainerCallback")),f.setIndentLeft(Io(d,"space.indentLeftOdd",0),Io(d,"space.indentLeftEven",0)),f.setIndentTop(Io(d,"space.indentTopOdd",0),Io(d,"space.indentTopEven",0)),f.resetGrid(h,l,u,c,Io(d,"space",void 0)),f}return n(o,[{key:"destroy",value:function(t){this.scene&&!this.ignoreDestroy&&(c(s(o.prototype),"destroy",this).call(this,t),this.columnProportions=void 0,this.rowProportions=void 0,this.columnWidth=void 0,this.rowHeight=void 0,this.createCellContainerCallback=void 0);}},{key:"setColumnProportion",value:function(t,e){return t>=this.columnProportions.length||(this.columnProportions[t]=e),this}},{key:"setRowProportion",value:function(t,e){return t>=this.rowProportions.length||(this.rowProportions[t]=e),this}},{key:"totalColumnProportions",get:function(){return void 0===this._totalColumnProportions&&(this._totalColumnProportions=zo.call(this)),this._totalColumnProportions}},{key:"totalRowProportions",get:function(){return void 0===this._totalRowProportions&&(this._totalRowProportions=Ao.call(this)),this._totalRowProportions}},{key:"getChildAt",value:function(t,e){return this.sizerChildren[e*this.columnCount+t]}},{key:"childToGridIndex",value:function(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)}},{key:"getColumnWidth",value:function(t){var e=this.columnProportions[t];return 0===e?this.columnWidth[t]:e*this.proportionWidthLength}},{key:"getRowHeight",value:function(t){var e=this.rowProportions[t];return 0===e?this.rowHeight[t]:e*this.proportionHeightLength}},{key:"setCreateCellContainerCallback",value:function(t){return this.createCellContainerCallback=t,this}}]),o}(qs);Object.assign(Xo.prototype,Lo);var Wo=Phaser.Utils.Objects.GetValue,Vo=Phaser.Utils.Objects.GetValue,No=function(){function t(i,n,r,s,o){e(this,t),void 0===i&&(i=0),void 0===n&&(n=i),void 0===r&&(r=0),void 0===s&&(s=0),void 0===o&&(o=0),this.cornerRadius={},this._width=0,this._height=0,this.setTo(i,n,r,s,o);}return n(t,[{key:"setTo",value:function(t,e,i,n,r){return this.setPosition(t,e),this.setRadius(r),this.setSize(i,n),this}},{key:"setPosition",value:function(t,e){return this.x=t,this.y=e,this}},{key:"setRadius",value:function(t){return void 0===t&&(t=0),this.radius=t,this}},{key:"setSize",value:function(t,e){return this.width=t,this.height=e,this}},{key:"minWidth",get:function(){var t=this.cornerRadius;return Math.max(t.tl.x+t.tr.x,t.bl.x+t.br.x)}},{key:"minHeight",get:function(){var t=this.cornerRadius;return Math.max(t.tl.y+t.bl.y,t.tr.y+t.br.y)}},{key:"width",get:function(){return this._width},set:function(t){null==t&&(t=0),this._width=Math.max(t,this.minWidth);}},{key:"height",get:function(){return this._height},set:function(t){null==t&&(t=0),this._height=Math.max(t,this.minHeight);}},{key:"radius",get:function(){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:function(t){var e,i;"number"==typeof t?(e=t,i=t):(e=Vo(t,"x",0),i=Vo(t,"y",0));var n=this.cornerRadius;n.tl=Fo(Vo(t,"tl",void 0),e,i),n.tr=Fo(Vo(t,"tr",void 0),e,i),n.bl=Fo(Vo(t,"bl",void 0),e,i),n.br=Fo(Vo(t,"br",void 0),e,i);}},{key:"radiusTL",get:function(){var t=this.cornerRadius.tl;return Math.max(t.x,t.y)},set:function(t){Ho(this.cornerRadius.tl,t);}},{key:"radiusTR",get:function(){var t=this.cornerRadius.tr;return Math.max(t.x,t.y)},set:function(t){Ho(this.cornerRadius.tr,t);}},{key:"radiusBL",get:function(){var t=this.cornerRadius.bl;return Math.max(t.x,t.y)},set:function(t){Ho(this.cornerRadius.bl,t);}},{key:"radiusBR",get:function(){var t=this.cornerRadius.br;return Math.max(t.x,t.y)},set:function(t){Ho(this.cornerRadius.br,t);}}]),t}(),Fo=function(t,e,i){return void 0===t?t={x:e,y:i}:"number"==typeof t&&(t={x:t,y:t}),Bo(t),t},Ho=function(t,e){"number"==typeof e?(t.x=e,t.y=e):(t.x=Vo(e,"x",0),t.y=Vo(e,"y",0)),Bo(t);},Bo=function(t){t.convex=t.x>=0||t.y>=0,t.x=Math.abs(t.x),t.y=Math.abs(t.y);},Go=function(t,e,i){var n=i.length;if(n>=2){var r=i[n-2],s=i[n-1];if(t===r&&e===s)return i}return i.push(t,e),i},Uo=Phaser.Math.DegToRad,Jo=function(t,e,i,n,r,s,o,a,h){o&&s>r?s-=360:!o&&s>>16,a=(65280&r)>>>8,h=255&r;t.fillStyle="rgba("+o+","+a+","+h+","+s+")";}(r,e),r.fill()),e.isStroked&&(!function(t,e,i,n){var r=i||e.strokeColor,s=n||e.strokeAlpha,o=(16711680&r)>>>16,a=(65280&r)>>>8,h=255&r;t.strokeStyle="rgba("+o+","+a+","+h+","+s+")",t.lineWidth=e.lineWidth;}(r,e),r.stroke()),r.restore();}}},ta=Phaser.GameObjects.Shape,ea=Phaser.Utils.Objects.IsPlainObject,ia=Phaser.Utils.Objects.GetValue,na=Phaser.Geom.Polygon.Earcut,ra=function(t){r(s,t);var i=l(s);function s(t,n,r,o,a,h,l,u){var c,d,f,v,p;if(e(this,s),ea(n)){var g=n;n=g.x,r=g.y,o=g.width,a=g.height,h=g.radius,l=g.color,u=g.alpha,d=g.strokeColor,f=g.strokeAlpha,v=g.strokeWidth,p=g.shape;}void 0===n&&(n=0),void 0===r&&(r=0),void 0===o&&(o=1),void 0===a&&(a=o),void 0===h&&(h=0),void 0===p&&(p=0);var y=new No;if((c=i.call(this,t,"rexRoundRectangleShape",y)).setShapeType(p),0===c.shapeType){var m=ia(h,"radius",h);y.setTo(0,0,o,a,m);}else {m={x:o/2,y:a/2};y.setTo(0,0,o,a,m);}var b=ia(h,"iteration",void 0);return c.setIteration(b),c.setPosition(n,r),c.setFillStyle(l,u),void 0!==d&&void 0===v&&(v=2),c.setStrokeStyle(v,d,f),c.updateDisplayOrigin(),c.dirty=!0,c}return n(s,[{key:"fillColor",get:function(){return this._fillColor},set:function(t){this._fillColor=t,this.isFilled=null!=t&&this._fillAlpha>0;}},{key:"fillAlpha",get:function(){return this._fillAlpha},set:function(t){this._fillAlpha=t,this.isFilled=t>0&&null!=this._fillColor;}},{key:"setFillStyle",value:function(t,e){return void 0===e&&(e=1),this.fillColor=t,this.fillAlpha=e,this}},{key:"strokeColor",get:function(){return this._strokeColor},set:function(t){this._strokeColor=t,this.isStroked=null!=t&&this._strokeAlpha>0&&this._lineWidth>0;}},{key:"strokeAlpha",get:function(){return this._strokeAlpha},set:function(t){this._strokeAlpha=t,this.isStroked=t>0&&null!=this._strokeColor&&this._lineWidth>0;}},{key:"lineWidth",get:function(){return this._lineWidth},set:function(t){this._lineWidth=t,this.isStroked=t>0&&null!=this._strokeColor;}},{key:"setStrokeStyle",value:function(t,e,i){return void 0===i&&(i=1),this.lineWidth=t,this.strokeColor=e,this.strokeAlpha=i,this}},{key:"updateData",value:function(){var t=this.geom,e=this.pathData;e.length=0;var i,n=t.width,r=t.height,s=t.cornerRadius,o=this.iteration+1;if(i=s.tl,sa(i))if(i.convex){var a=i.x,h=i.y;Jo(a,h,i.x,i.y,180,270,!1,o,e);}else {Jo(a=0,h=0,i.x,i.y,90,0,!0,o,e);}else Go(0,0,e);if(i=s.tr,sa(i))if(i.convex){a=n-i.x,h=i.y;Jo(a,h,i.x,i.y,270,360,!1,o,e);}else {Jo(a=n,h=0,i.x,i.y,180,90,!0,o,e);}else Go(n,0,e);if(i=s.br,sa(i))if(i.convex){a=n-i.x,h=r-i.y;Jo(a,h,i.x,i.y,0,90,!1,o,e);}else {Jo(a=n,h=r,i.x,i.y,270,180,!0,o,e);}else Go(n,r,e);if(i=s.bl,sa(i))if(i.convex){a=i.x,h=r-i.y;Jo(a,h,i.x,i.y,90,180,!1,o,e);}else {Jo(a=0,h=r,i.x,i.y,360,270,!0,o,e);}else Go(0,r,e);return e.push(e[0],e[1]),this.pathIndexes=na(e),this}},{key:"setShapeType",value:function(t){return "string"==typeof t&&(t=oa[t]),this.shapeType=t,this}},{key:"width",get:function(){return this.geom.width},set:function(t){this.resize(t,this.height);}},{key:"height",get:function(){return this.geom.height},set:function(t){this.resize(this.width,t);}},{key:"setSize",value:function(t,e){if(void 0===e&&(e=t),this.geom.width===t&&this.geom.height===e)return this;this.geom.setSize(t,e),1===this.shapeType&&this.setRadius({x:t/2,y:e/2}),this.updateDisplayOrigin(),this.dirty=!0;var i=this.input;return i&&!i.customHitArea&&(i.hitArea.width=t,i.hitArea.height=e),this}},{key:"resize",value:function(t,e){return this.setSize(t,e),this}},{key:"radius",get:function(){return this.geom.radius},set:function(t){this.geom.setRadius(t),this.updateDisplayOrigin(),this.dirty=!0;}},{key:"radiusTL",get:function(){return this.geom.radiusTL},set:function(t){this.geom.radiusTL=t,this.dirty=!0;}},{key:"radiusTR",get:function(){return this.geom.radiusTR},set:function(t){this.geom.radiusTR=t,this.dirty=!0;}},{key:"radiusBL",get:function(){return this.geom.radiusBL},set:function(t){this.geom.radiusBL=t,this.dirty=!0;}},{key:"radiusBR",get:function(){return this.geom.radiusBR},set:function(t){this.geom.radiusBR=t,this.dirty=!0;}},{key:"setRadius",value:function(t){return void 0===t&&(t=0),this.radius=t,this}},{key:"setRadiusTL",value:function(t){return void 0===t&&(t=0),this.radiusTL=t,this}},{key:"setRadiusTR",value:function(t){return void 0===t&&(t=0),this.radiusTR=t,this}},{key:"setRadiusBL",value:function(t){return void 0===t&&(t=0),this.radiusBL=t,this}},{key:"setRadiusBR",value:function(t){return void 0===t&&(t=0),this.radiusBR=t,this}},{key:"cornerRadius",get:function(){return this.geom.cornerRadius},set:function(t){this.radius=t;}},{key:"setCornerRadius",value:function(t){return this.setRadius(t)}},{key:"iteration",get:function(){return this._iteration},set:function(t){void 0!==this._iteration?this._iteration!==t&&(this._iteration=t,this.dirty=!0):this._iteration=t;}},{key:"setIteration",value:function(t){return void 0===t&&(t=6),this.iteration=t,this}}]),s}(ta),sa=function(t){return t.x>0&&t.y>0},oa={rectangle:0,circle:1};Object.assign(ra.prototype,$o);var aa=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},ha=Phaser.Utils.Objects.GetValue,la=function(t){r(s,t);var i=l(s);function s(t,n){var r;e(this,s),(r=i.call(this,t,n)).style=ha(n,"style",a(r));var o=ha(n,"propertiesMap");return r.activeStyle=ua(n,"active",o),r.hoverStyle=ua(n,"hover",o),r.disableStyle=ua(n,"disable",o),r.onModifyStyle=ha(n,"onModifyStyle"),r}return n(s,[{key:"getStyle",value:function(t){return function(t,e,i){if(void 0===i&&(i={}),Array.isArray(e))for(var n=0,r=e.length;n=6?(n=[arguments[2],void 0,arguments[3]],r=[arguments[4],void 0,arguments[5]]):(n=Ma(n),r=Ma(r)),this.textureKey=e,this.baseFrameName=i,this.columns.data=n,this.columns.count=n?n.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 s=this.scene.sys.textures.get(e);if(!s)return this.clear(),this;if(!n||!r)return this.clear(),this;for(var o=s.get(i),a=o.width,h=0,l=0,u=n.length;l0?0:g,k=0;l=0;for(var w=n.length;l0?0:y),y>=1&&g>=1){var _=t(m=this.getFrameNameCallback(l,x,i));"string"!==_&&"number"!==_||s.add(m,0,k+o.cutX,C+o.cutY,y,g);}k+=y;}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,n,r,s,o,a,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,f=c>=0?this.maxFixedPartScaleY:this.height/l;if(this.preserveRatio){var v=Math.min(d,f);if(d>v){var p=(d-v)*h;u>=0?u+=p:u=p,d=v;}if(f>v){var g=(f-v)*l;c>=0?c+=g:c=g,f=v;}}this.columns.scale=d,this.rows.scale=f,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 y=0,m=0;this._beginDraw();for(var b=0,k=this.rows.count;b0&&a>0&&(0===(0===s.stretch&&0===r.stretch||0===this.getStretchMode(C,b)?0:1)?this._drawImage(this.textureKey,n,y,m,o,a):this._drawTileSprite(this.textureKey,n,y,m,o,a)),y+=o;m+=a;}this._endDraw();},setStretchMode:function(t){return Da(t)?(this.stretchMode.edge=ja(Ra(t,"edge",0)),this.stretchMode.internal=ja(Ra(t,"internal",0))):(t=ja(t),this.stretchMode.edge=t,this.stretchMode.internal=t),this},getStretchMode:function(t,e){return za.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}},Ya=Phaser.Utils.Objects.IsPlainObject,Ia=Phaser.Utils.Objects.GetValue,Xa=Phaser.GameObjects,Wa=void 0,Va=function(t,e){if(Wa||(Wa={},ii(t).events.once("destroy",(function(){for(var t in Wa)Wa[t].destroy();Wa=void 0;}))),!Wa.hasOwnProperty(e)){var i=ii(t).scene.systemScene;(t=new Xa[e](i)).setOrigin(0),Wa[e]=t;}return Wa[e]},Na=function(t){r(s,t);var i=l(s);function s(){return e(this,s),i.apply(this,arguments)}return n(s)}(function(t,i){var o=function(t){r(a,t);var o=l(a);function a(t,n,r,s,h,l,u,c,d,f){var v;if(e(this,a),Ya(n)?(n=Ia(f=n,"x",0),r=Ia(f,"y",0),s=Ia(f,"width",1),h=Ia(f,"height",1),l=Ia(f,"key",void 0),u=Ia(f,"baseFrame",void 0),c=Ia(f,"columns",void 0),d=Ia(f,"rows",void 0)):Ya(s)?(s=Ia(f=s,"width",1),h=Ia(f,"height",1),l=Ia(f,"key",void 0),u=Ia(f,"baseFrame",void 0),c=Ia(f,"columns",void 0),d=Ia(f,"rows",void 0)):Ya(l)?(l=Ia(f=l,"key",void 0),u=Ia(f,"baseFrame",void 0),c=Ia(f,"columns",void 0),d=Ia(f,"rows",void 0)):Ya(u)?(u=Ia(f=u,"baseFrame",void 0),c=Ia(f,"columns",void 0),d=Ia(f,"rows",void 0)):Array.isArray(u)?(f=d,d=c,c=u,u=Ia(f,"baseFrame",void 0)):Ya(c)&&(c=Ia(f=c,"columns",void 0),d=Ia(f,"rows",void 0)),void 0===c){var p=Ia(f,"leftWidth",void 0),g=Ia(f,"rightWidth",void 0);void 0!==p&&void 0!==g&&(c=[p,void 0,g]);}if(void 0===d){var y=Ia(f,"topHeight",void 0),m=Ia(f,"bottomHeight",void 0);void 0!==y&&void 0!==m&&(d=[y,void 0,m]);}(v=o.call(this,t)).type=i,v.setPosition(n,r).setSize(s,h).setOrigin(.5,.5),v.columns={},v.rows={},v.stretchMode={},v._tileSprite=void 0,v._image=void 0,v.setGetFrameNameCallback(Ia(f,"getFrameNameCallback",void 0)),v.setStretchMode(Ia(f,"stretchMode",0)),v.setPreserveRatio(Ia(f,"preserveRatio",!0));var b=Ia(f,"maxFixedPartScale",1),k=Ia(f,"maxFixedPartScaleX",b),C=Ia(f,"maxFixedPartScaleY",void 0);return v.setMaxFixedPartScale(k,C),v.setBaseTexture(l,u,c,d),v}return n(a,[{key:"minWidth",get:function(){return this.columns.minWidth}},{key:"minHeight",get:function(){return this.rows.minHeight}},{key:"fixedPartScaleX",get:function(){return this.columns.scale}},{key:"fixedPartScaleY",get:function(){return this.rows.scale}},{key:"resize",value:function(t,e){return this.width===t&&this.height===e||(c(s(a.prototype),"resize",this)?c(s(a.prototype),"resize",this).call(this,t,e):c(s(a.prototype),"setSize",this).call(this,t,e),this.updateTexture()),this}}]),a}(t);return Object.assign(o.prototype,Aa),o}(Phaser.GameObjects.RenderTexture,"rexNinePatch")),Fa={_drawImage:function(t,e,i,n,r,s){var o=Va(this,"Image").setTexture(t,e).setDisplaySize(r,s);this.draw(o,i,n);},_drawTileSprite:function(t,e,i,n,r,s){var o=Va(this,"TileSprite").setTexture(t,e).setSize(r,s);this.draw(o,i,n);}};Object.assign(Na.prototype,Fa);var Ha=function(t,e){var i,n;switch(e&&(e.hasOwnProperty("type")?i=e.type:e.hasOwnProperty("leftWidth")?i="nineSlice":e.hasOwnProperty("key")&&(i="image")),i){case"image":n=new Ea(t,e);break;case"nineSlice":n=e.hasOwnProperty("stretchMode")?new Na(t,e):new wa(t,e);break;default:n=new fa(t,e);}return t.add.existing(n),n},Ba=Phaser.Math.Linear,Ga=Phaser.Math.Percent,Ua={setValue:function(t,e,i){return null==t||(void 0!==e&&(t=Ga(t,e,i)),this.value=t),this},addValue:function(t,e,i){return void 0!==e&&(t=Ga(t,e,i)),this.value+=t,this},getValue:function(t,e){var i=this.value;return void 0!==t&&(i=Ba(t,e,i)),i}},Ja=Phaser.Math.Percent,Ka={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=Ja(t,e,i)),void 0===this.easeValueTask&&(this.easeValueTask=new vn(this,{eventEmitter:null})),this.easeValueTask.restart({key:this.easeValuePropName,to:t,duration:this.easeValueDuration,ease:this.easeFunction})),this},easeValueRepeat:function(t,e,i,n){return void 0===i&&(i=-1),void 0===n&&(n=0),void 0===this.easeValueTask&&(this.easeValueTask=new vn(this,{eventEmitter:null})),this.easeValueTask.restart({key:this.easeValuePropName,from:t,to:e,duration:this.easeValueDuration,ease:this.easeFunction,repeat:i,repeatDelay:n}),this}},qa=Phaser.Utils.Objects.GetValue,Za=Phaser.Math.Clamp;var Qa=Phaser.Math.Percent,$a=function(t,e,i){var n;return t.y===e.y?n=Qa(i.x,t.x,e.x):t.x===e.x&&(n=Qa(i.y,t.y,e.y)),n},th=function(t,e,i){var n,r;this.enable&&(eh.x=e,eh.y=i,this.reverseAxis?(n=this.getEndPoint(),r=this.getStartPoint()):(n=this.getStartPoint(),r=this.getEndPoint()),this.value=$a(n,r,eh));},eh={},ih=function(t,e,i){if(this.enable&&t.isDown){var n,r;nh.x=t.worldX,nh.y=t.worldY,this.reverseAxis?(n=this.getEndPoint(),r=this.getStartPoint()):(n=this.getStartPoint(),r=this.getEndPoint());var s=$a(n,r,nh);this.stopEaseValue(),0===this.easeValueDuration||Math.abs(this.value-s)<.1?this.value=s:this.easeValueTo(s);}},nh={},rh=function(t,e){void 0===e&&(e=sh);var i=this.childrenMap.thumb,n=i.x,r=i.y;return Se(i,this.innerLeft,this.innerTop,this.innerWidth,this.innerHeight,t),e.x=i.x,e.y=i.y,i.x=n,i.y=r,e},sh={},oh=Phaser.Display.Align.LEFT_CENTER,ah=Phaser.Display.Align.TOP_CENTER,hh={},lh=Phaser.Display.Align.RIGHT_CENTER,uh=Phaser.Display.Align.BOTTOM_CENTER,ch={},dh=Phaser.Math.Linear,fh={},vh=Phaser.Display.Align.LEFT_CENTER,ph=Phaser.Display.Align.TOP_CENTER,gh=Phaser.Display.Align.RIGHT_CENTER,yh=Phaser.Display.Align.BOTTOM_CENTER,mh=Phaser.Utils.Objects.GetValue,bh=Phaser.Utils.Objects.IsPlainObject,kh=Phaser.Math.Clamp,Ch=Phaser.Math.Snap.To,xh=function(t){r(o,t);var i=l(o);function o(t,n){var r;e(this,o),(r=i.call(this,t,n)).type="rexSlider",r.bootProgressBase(n),r.reverseAxis=mh(n,"reverseAxis",!1);var s=mh(n,"background",void 0),h=mh(n,"track",void 0),l=mh(n,"indicator",void 0),u=mh(n,"thumb",void 0);s&&(bh(s)&&(s=Ha(t,s)),r.addBackground(s)),h&&(bh(h)&&(h=Ha(t,h)),r.add(h,{proportion:1,expand:!0,minWidth:0===r.orientation?0:void 0,minHeight:1===r.orientation?0:void 0})),l&&(bh(l)&&(l=Ha(t,l)),r.pin(l)),u&&(bh(u)&&(u=Ha(t,u)),r.pin(u));var c=mh(n,"input",0);switch("string"==typeof c&&(c=Sh[c]),c){case 0:u&&(u.setInteractive(),r.scene.input.setDraggable(u),u.on("drag",th,a(r)).on("dragstart",(function(t){this.eventEmitter.emit("inputstart",t);}),a(r)).on("dragend",(function(t){this.eventEmitter.emit("inputend",t);}),a(r)));break;case 1:r.on("pointerdown",ih,a(r)).on("pointermove",ih,a(r)).on("pointerdown",(function(t){this.eventEmitter.emit("inputstart",t);}),a(r)).on("pointerup",(function(t){this.eventEmitter.emit("inputend",t);}),a(r)).on("pointerover",(function(t){t.isDown&&this.eventEmitter.emit("inputstart",t);}),a(r)).on("pointerout",(function(t){t.isDown&&this.eventEmitter.emit("inputend",t);}),a(r)).setInteractive();}return r.addChildrenMap("background",s),r.addChildrenMap("track",h),r.addChildrenMap("indicator",l),r.addChildrenMap("thumb",u),r.setEnable(mh(n,"enable",void 0)),r.setGap(mh(n,"gap",void 0)),r.setValue(mh(n,"value",0),mh(n,"min",void 0),mh(n,"max",void 0)),r}return n(o,[{key:"setEnable",value:function(t){return void 0===t&&(t=!0),this.enable=t,this}},{key:"setGap",value:function(t,e,i){return t&&void 0!==e&&(t/=i-e),this.gap=t,this}},{key:"value",get:function(){return this._value},set:function(t){void 0!==this.gap&&(t=Ch(t,this.gap));var e=this._value;this._value=kh(t,0,1),e!==this._value&&(this.updateThumb(this._value),this.updateIndicator(this._value),this.eventEmitter.emit("valuechange",this._value,e,this.eventEmitter));}},{key:"runLayout",value:function(t,e,i){return this.ignoreLayout||(c(s(o.prototype),"runLayout",this).call(this,t,e,i),this.updateThumb(),this.updateIndicator()),this}}]),o}(function(t){var i=function(t){r(s,t);var i=l(s);function s(){return e(this,s),i.apply(this,arguments)}return n(s,[{key:"bootProgressBase",value:function(t){this.eventEmitter=qa(t,"eventEmitter",this);var e=qa(t,"valuechangeCallback",null);if(null!==e){var i=qa(t,"valuechangeCallbackScope",void 0);this.eventEmitter.on("valuechange",e,i);}return this.setEaseValuePropName("value").setEaseValueDuration(qa(t,"easeValue.duration",0)).setEaseValueFunction(qa(t,"easeValue.ease","Linear")),this}},{key:"value",get:function(){return this._value},set:function(t){t=Za(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);}}]),s}(t);return Object.assign(i.prototype,Ua,Ka),i}(mo)),Sh={pan:0,drag:0,click:1,none:-1},wh={getStartPoint:function(t){if(void 0===t&&(t=hh),this.childrenMap.thumb){var e=0===this.orientation?oh:ah;rh.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=ch),this.childrenMap.thumb){var e=0===this.orientation?lh:uh;rh.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,n=this.childrenMap.thumb;return void 0===n||(void 0===t&&(t=this.value),this.reverseAxis?(e=this.getEndPoint(),i=this.getStartPoint()):(e=this.getStartPoint(),i=this.getEndPoint()),function(t,e,i,n){void 0===n&&(n=fh),n.x=dh(e.x,i.x,t),n.y=dh(e.y,i.y,t);}(t,e,i,n),this.resetChildPositionState(n)),this},updateIndicator:function(t){var e=this.childrenMap.indicator;if(void 0===e)return this;void 0===t&&(t=this.value);var i,n,r,s=this.reverseAxis,o=this.childrenMap.thumb;if(o)if(0===this.orientation){var a=pt(o);if(s){h=o.x-a*o.originX;i=this.right-h;}else {var h;i=(h=o.x-a*o.originX)+a-this.left;}}else {var l=gt(o);if(s){u=o.y-l*o.originY;n=this.bottom-u;}else {var u;n=(u=o.y-l*o.originY)+l-this.top;}}else 0===this.orientation?i=this.width*t:n=this.height*t;ar(e,i,n),r=s?0===this.orientation?gh:yh:0===this.orientation?vh:ph,xe(e,this,r),this.resetChildPositionState(e);}};Object.assign(xh.prototype,wh);var _h=Phaser.Utils.Objects.GetValue,Oh=function(t){r(s,t);var i=l(s);function s(t,n){var r;e(this,s),(r=i.call(this,t,n)).type="rexScrollBar";var o,h=_h(n,"background",void 0),l=_h(n,"buttons",void 0),u=_h(l,"top",_h(l,"left",void 0)),c=_h(l,"bottom",_h(l,"right",void 0)),d=_h(n,"slider",void 0);(h&&r.addBackground(h),u)&&(r.add(u),new Pr(u).on("intouch",(function(){if(this.enable){var t=o.reverseAxis?this.scrollStep:-this.scrollStep;this.value+=t;}}),a(r)));if(d){var f;if(d.orientation=r.orientation,d.eventEmitter=a(r),d.value=null,0===r.orientation)f=void 0===_h(d,"width",void 0)?1:0;else f=void 0===_h(d,"height",void 0)?1:0;o=new xh(t,d),t.add.existing(o),r.add(o,{proportion:f});}c&&(r.add(c),new Pr(c).on("intouch",(function(){if(this.enable){var t=o.reverseAxis?-this.scrollStep:this.scrollStep;this.value+=t;}}),a(r)));var v=[u,c];r.addChildrenMap("background",h),r.addChildrenMap("slider",o),r.addChildrenMap("buttons",v);var p=_h(n,"valuechangeCallback",null);if(null!==p){var g=_h(n,"valuechangeCallbackScope",void 0);r.on("valuechange",p,g);}return r.setEnable(_h(n,"enable",void 0)),r.setValue(_h(n,"value",0)),r.setScrollStep(_h(l,"step",.01)),r}return n(s,[{key:"setScrollStep",value:function(t){return this.scrollStep=t,this}},{key:"enable",get:function(){return !!this.childrenMap.slider&&this.childrenMap.slider.enable},set:function(t){this.childrenMap.slider&&this.childrenMap.slider.setEnable(t);}},{key:"setEnable",value:function(t){return void 0===t&&(t=!0),this.enable=t,this}},{key:"value",get:function(){return this.childrenMap.slider?this.childrenMap.slider.value:0},set:function(t){this.childrenMap.slider&&(this.childrenMap.slider.value=t);}},{key:"setValue",value:function(t,e,i){return this.childrenMap.slider&&this.childrenMap.slider.setValue(t,e,i),this}},{key:"addValue",value:function(t,e,i){return this.childrenMap.slider&&this.childrenMap.slider.addValue(t,e,i),this}},{key:"getValue",value:function(t,e){return this.childrenMap.slider?this.childrenMap.slider.getValue(t,e):0}},{key:"easeValueTo",value:function(t,e,i){return this.childrenMap.slider&&this.childrenMap.slider.easeValueTo(t,e,i),this}},{key:"stopEaseValue",value:function(){return this.childrenMap.slider&&this.childrenMap.slider.stopEaseValue(),this}},{key:"setEaseValueDuration",value:function(t){return this.childrenMap.slider&&this.childrenMap.slider.setEaseValueDuration(t),this}},{key:"setEaseValueFunction",value:function(t){return this.childrenMap.slider&&this.childrenMap.slider.setEaseValueFunction(t),this}}]),s}(mo),Ph=function(t){r(s,t);var i=l(s);function s(t,n){var r;return e(this,s),(r=i.call(this,n)).parent=t,r.init(),r}return n(s,[{key:"init",value:function(){this.start("IDLE");}},{key:"next_IDLE",value:function(){var t,e=this.parent;return e.dragState.isDown&&(t=0===e.dragThreshold?"DRAG":"DRAGBEGIN"),t}},{key:"update_IDLE",value:function(t,e){this.next();}},{key:"next_DRAGBEGIN",value:function(){var t=this.parent,e=t.dragState;return e.isDown?e.pointer.getDistance()>=t.dragThreshold?"DRAG":"DRAGBEGIN":"IDLE"}},{key:"update_DRAGBEGIN",value:function(t,e){this.next();}},{key:"next_DRAG",value:function(){var t,e=this.parent;return e.dragState.isUp&&(t=e.outOfBounds?"BACK":e.slidingEnable?"SLIDE":"IDLE"),t}},{key:"update_DRAG",value:function(t,e){var i=this.parent;i.dragState.justMoved&&i.dragging(),this.next();}},{key:"enter_DRAG",value:function(){this.parent.onDragStart();}},{key:"exit_DRAG",value:function(){this.parent.onDragEnd();}},{key:"next_SLIDE",value:function(){var t,e=this.parent;return e.dragState.isDown?t="DRAG":e.isSliding||(t="IDLE"),t}},{key:"enter_SLIDE",value:function(){this.parent.onSliding();}},{key:"exit_SLIDE",value:function(){this.parent.stop();}},{key:"update_SLIDE",value:function(t,e){this.parent.sliding(t,e),this.next();}},{key:"next_BACK",value:function(){var t,e=this.parent;return e.dragState.isDown?t="DRAG":e.isPullBack||(t="IDLE"),t}},{key:"enter_BACK",value:function(){this.parent.onPullBack();}},{key:"exit_BACK",value:function(){this.parent.stop();}},{key:"update_BACK",value:function(t,e){this.parent.pullBack(t,e),this.next();}}]),s}(Tn),Eh=Phaser.Utils.Objects.GetValue,Th=Phaser.Math.Distance.Between,Mh=function(t){r(o,t);var i=l(o);function o(t,n){var r;return e(this,o),(r=i.call(this,t,n))._enable=void 0,t.setInteractive(Eh(n,"inputConfig",void 0)),r.resetFromJSON(n),r.boot(),r}return n(o,[{key:"resetFromJSON",value:function(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(Eh(t,"enable",!0)),this.holdThreshold=Eh(t,"holdThreshold",50),this.pointerOutReleaseEnable=Eh(t,"pointerOutRelease",!0),this}},{key:"boot",value:function(){this.parent.on("pointerdown",this.onPointIn,this),this.parent.on("pointerup",this.onPointOut,this),this.pointerOutReleaseEnable&&this.parent.on("pointerout",this.onPointOut,this),this.parent.on("pointermove",this.onPointerMove,this),this.scene.sys.events.on("preupdate",this.preupdate,this);}},{key:"shutdown",value:function(t){this.isShutdown||(this.scene.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,c(s(o.prototype),"shutdown",this).call(this,t));}},{key:"enable",get:function(){return this._enable},set:function(t){this._enable!==t&&(t||(this.isInTouched=!1,this.pointer=void 0),this._enable=t);}},{key:"setEnable",value:function(t){return void 0===t&&(t=!0),this.enable=t,this}},{key:"toggleEnable",value:function(){return this.setEnable(!this.enable),this}},{key:"setPointerOutReleaseEnable",value:function(t){return void 0===t&&(t=!0),this.pointerOutReleaseEnable=t,this}},{key:"isDown",get:function(){return this.pointer&&this.pointer.isDown}},{key:"isUp",get:function(){return !this.isDown}},{key:"dx",get:function(){return this.x-this.preX}},{key:"dy",get:function(){return this.y-this.preY}},{key:"dt",get:function(){return ss(this.scene)}},{key:"speed",get:function(){return this.x===this.preX&&this.y===this.preY?0:Th(this.preX,this.preY,this.x,this.y)/(.001*this.dt)}},{key:"speedX",get:function(){return this.dx/(.001*this.dt)}},{key:"speedY",get:function(){return this.dy/(.001*this.dt)}},{key:"onPointIn",value:function(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.pointer=t,this.localX=e,this.localY=i);}},{key:"onPointOut",value:function(t){this.enable&&this.pointer===t&&(this.pointer=void 0);}},{key:"onPointerMove",value:function(t,e,i){this.enable&&t.isDown&&this.pointer===t&&(this.localX=e,this.localY=i);}},{key:"preupdate",value:function(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));}}}]),o}(ri),Dh=Phaser.Utils.Objects.GetValue,Rh=function(){function t(i){e(this,t),this.resetFromJSON(i);}return n(t,[{key:"resetFromJSON",value:function(t){return this.setValue(Dh(t,"value",0)),this.setSpeed(Dh(t,"speed",0)),this.setAcceleration(Dh(t,"acceleration",0)),this}},{key:"reset",value:function(){this.setValue(0),this.setSpeed(0),this.setAcceleration(0);}},{key:"setValue",value:function(t){return this.value=t,this}},{key:"setSpeed",value:function(t){return this.speed=t,this}},{key:"setAcceleration",value:function(t){return this.acceleration=t,this}},{key:"updateSpeed",value:function(t){return 0!==this.acceleration&&(this.speed+=this.acceleration*t,this.speed<0&&(this.speed=0)),this}},{key:"getDeltaValue",value:function(t){return this.updateSpeed(t),this.speed<=0?0:this.speed*t}},{key:"update",value:function(t){return this.updateSpeed(t),this.speed>0&&(this.value+=this.getDeltaValue(t)),this}},{key:"isMoving",get:function(){return this.speed>0}}]),t}(),jh=function(){function t(){e(this,t),this.value,this.dir,this.movement=new Rh;}return n(t,[{key:"init",value:function(t,e,i,n,r){return this.value=t,this.end=r,this.dir=void 0!==r?tthis.end&&(this.value=this.end):this.valuethis.maxValue}},{key:"overMin",value:function(t){return null!=this.minValue&&t0,Math.abs(e),i);}},{key:"sliding",value:function(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;}},{key:"onPullBack",value:function(){var t=this.value,e=this.outOfMinBound?this.minValue:this.maxValue,i=Math.abs(e-t),n=this.backDeceleration,r=Math.sqrt(2*n*i);this._slowDown.init(t,void 0,r,n,e);}},{key:"pullBack",value:function(t,e){e*=.001,this.value=this._slowDown.update(e).value,this._slowDown.isMoving||this._state.next();}},{key:"stop",value:function(){this._slowDown.stop();}}]),o}(ri),Yh={y:0,v:0,vertical:0,x:1,h:1,horizontal:1},Ih=Phaser.Utils.Objects.GetValue,Xh=function(t){r(s,t);var i=l(s);function s(t,n){var r;(e(this,s),(r=i.call(this,t,n)).parent!==r.scene?r.focusMode=Ih(n,"focus",!1):r.focusMode=!1,r.setSpeed(Ih(n,"speed",.1)),r.setEnable(Ih(n,"enable",!0)),r.focusMode)?(t=r.parent).setInteractive(Ih(n,"inputConfig",void 0)).on("wheel",(function(t,e,i,n,r){this.enable&&this.scroll(i);}),a(r)):r.scene.input.on("wheel",r.onSceneScroll,a(r));return r}return n(s,[{key:"destroy",value:function(){this.focusMode||this.scene.input.off("wheel",this.onSceneScroll,this);}},{key:"onSceneScroll",value:function(t,e,i,n,r,s){this.enable&&this.scroll(n);}},{key:"setEnable",value:function(t){return void 0===t&&(t=!0),this.enable=t,this}},{key:"setSpeed",value:function(t){return this.speed=t,this}},{key:"scroll",value:function(t){t*=this.speed,this.emit("scroll",t,this.parent,this);}}]),s}(ri),Wh=Phaser.Utils.Objects.GetValue,Vh=function(t,e,i,n){var r,s,o,a,h="Y"===(i=i.toUpperCase()),l=2===t.scrollMode,u=t.childrenMap.child,c="slider".concat(i);if(r=l||n.hasOwnProperty(c)?Wh(n,c,void 0):Wh(n,"slider",void 0)){var d,f,v;!0===r&&(r={}),r.orientation=h?1:0,s=function(t,e){void 0===e&&(e={});var i=Dt(e);(e={slider:i}).orientation=i.orientation,delete i.orientation,e.background=i.background,delete i.background,e.buttons=i.buttons,delete i.buttons;var n=new Oh(t,e);t.add.existing(n);var r=n.childrenMap.slider;return n.addChildrenMap("track",r.childrenMap.track),n.addChildrenMap("indicator",r.childrenMap.indicator),n.addChildrenMap("thumb",r.childrenMap.thumb),n}(t.scene,r);var p=Wh(r,"position",0);"string"==typeof p&&(p=Nh[p]);var g=Wh(n,"space.slider".concat(i),void 0);void 0===g&&void 0===(g=Wh(n,"space.slider",void 0))&&(g=l?0:Wh(n,"space.child",0));var y="number"==typeof g;h?0===p?(d=2,f=1,v=y?{left:g}:g):(d=0,f=1,v=y?{right:g}:g):0===p?(d=1,f=2,v=y?{top:g}:g):(d=1,f=0,v=y?{bottom:g}:g),e.add(s,{column:d,row:f,align:"center",padding:v,expand:!0}),t["hideUnscrollableSlider".concat(i)]=Wh(r,"hideUnscrollableSlider",!1),t["adaptThumb".concat(i,"SizeMode")]=Wh(r,"adaptThumbSize",!1),t["minThumb".concat(i,"Size")]=Wh(r,"minThumbSize",void 0);}else t["hideUnscrollableSlider".concat(i)]=!1,t["adaptThumb".concat(i,"SizeMode")]=!1,t["minThumb".concat(i,"Size")]=void 0;var m="scroller".concat(i);(o=l||n.hasOwnProperty(m)?Wh(n,m,!0):Wh(n,"scroller",!0))&&u&&(!0===o&&(o={}),o.orientation=h?0:1,a=new Ah(u,o));var b,k,C,x,S=Wh(n,l?"mouseWheelScroller".concat(i):"mouseWheelScroller",!1);(S&&u&&(b=new Xh(u,S)),t.addChildrenMap("slider".concat(i),s),t.addChildrenMap("scroller".concat(i),a),t.addChildrenMap("mouseWheelScroller".concat(i),b),l&&!h||(t.hideUnscrollableSlider=t["hideUnscrollableSlider".concat(i)],t.adaptThumbSizeMode=t["adaptThumb".concat(i,"SizeMode")],t.minThumbSize=t["minThumb".concat(i,"Size")],t.addChildrenMap("slider",s),t.addChildrenMap("scroller",a),t.addChildrenMap("mouseWheelScroller",b)),s)&&(l?(k=h?"t":"s",x="scroll".concat(i)):(k="t",x="scroll"),s.on("valuechange",(function(e){t[k]=e,t.emit(x,t);})));a&&(l?(C="childO".concat(i),x="scroll".concat(i)):(C="childOY",x="scroll"),a.on("valuechange",(function(e){t[C]=e,t.emit(x,t);})));if(b){var w="addChildO".concat(i);b.on("scroll",(function(e){t[w](-e,!0);}));}},Nh={right:0,left:1,bottom:0,top:1},Fh=Phaser.Utils.Objects.GetValue,Hh=function(t,e){var i=t.scene,n=[0,1,0],r=[0,1,0],s=Fh(e,"width"),o=Fh(e,"height");s||(n[1]=0),o||(r[1]=0);var a=new Xo(i,{column:3,row:3,columnProportions:n,rowProportions:r});switch(function(t,e,i){var n=Wo(i,"child"),r=Wo(n,"gameObject",void 0);if(r){var s=Wo(i,"space.child",0);t.childMargin={};var o=t.childMargin,a={};if("number"==typeof s)switch(t.scrollMode){case 0:case 1:o.top=0,o.bottom=0,o.left=0,o.right=0;break;default:o.top=s,o.bottom=s,o.left=s,o.right=s;}else switch(t.scrollMode){case 0:o.top=Wo(s,"top",0),o.bottom=Wo(s,"bottom",0),a.left=Wo(s,"left",0),a.right=Wo(s,"right",0);break;case 1:o.top=Wo(s,"left",0),o.bottom=Wo(s,"right",0),a.top=Wo(s,"top",0),a.bottom=Wo(s,"bottom",0);break;default:o.top=Wo(s,"top",0),o.bottom=Wo(s,"bottom",0),o.left=Wo(s,"left",0),o.right=Wo(s,"right",0);}e.add(r,{column:1,row:1,align:Wo(n,"align","center"),padding:a,expand:{width:Wo(n,"expandWidth",!0),height:Wo(n,"expandHeight",!0)}});}t.addChildrenMap("child",r);}(t,a,e),t.scrollMode){case 0:Vh(t,a,"y",e);break;case 1:Vh(t,a,"x",e);break;default:Vh(t,a,"y",e),Vh(t,a,"x",e);}return a},Bh=function(t){var e,i,n,r;switch(this.scrollMode){case 0:case 1:e=this.topChildOY,i=this.bottomChildOY,n=this.childrenMap.scroller,r=this.childrenMap.slider;break;default:"Y"===(t=t.toUpperCase())?(e=this.topChildOY,i=this.bottomChildOY):(e=this.leftChildOX,i=this.rightChildOX),n=this.childrenMap["scroller".concat(t)],r=this.childrenMap["slider".concat(t)];}n&&n.setBounds(e,i),r&&r.setEnable(e!==i);},Gh=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".concat(t)],i=this["hideUnscrollableSlider".concat(t)],n=this["isOverflow".concat(t)];e&&i&&this.setChildVisible(e,n);}},Uh=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,n=a.childrenMap.thumb,r=this.minThumbSize;if(0===this.scrollMode){var s=i.displayHeight*e;void 0!==r&&s0?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(ol.call(this,-this.textOY)),0),e=al.call(this,t)+this.textOY,i=hl.call(this,t);return function(t,e){switch(el(t)){case 0:var i=(r=t.style).wordWrapWidth,n=r.wordWrapCallback;r.wordWrapWidth=0,r.wordWrapCallback=void 0,t.setText(e),r.wordWrapWidth=i,r.wordWrapCallback=n;break;case 1:var r,s=(r=t.style).wrapMode;r.wrapMode=0,t.setText(e),r.wrapMode=s;break;case 2:var o=t._maxWidth;t._maxWidth=0,t.setText(e),t._maxWidth=o;}}(this.textObject,i),this.textObject.rexSizer.offsetY=e,ll.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,Ke.call(this),this},layoutChildren:function(){var t,e,i,n,r,s,o,a=this.left,h=this.top;(t=this.textObject).rexSizer.hidden||(n=a+(i=(e=t.rexSizer).padding).left,r=h+i.top,s=this.width-i.left-i.right,o=this.height-i.top-i.bottom,cl.call(this,t,s,o),Se(t,n,r,s,o,e.align),e.preOffsetY=0,ll.call(this),this.textMask&&(this.textMask.setPosition().resize(),this.resetChildPositionState(this.textMask)));}},fl=Phaser.Utils.Objects.IsPlainObject,vl=Phaser.Utils.Objects.GetValue,pl=Phaser.Display.Align.TOP_LEFT,gl=function(t){r(o,t);var i=l(o);function o(t,n,r,s,h,l){var u;e(this,o),fl(n)?(n=vl(l=n,"x",0),r=vl(l,"y",0),s=vl(l,"width",void 0),h=vl(l,"height",void 0)):fl(s)&&(s=vl(l=s,"width",void 0),h=vl(l,"height",void 0)),(u=i.call(this,t,n,r,s,h,l)).type="rexTextBlock",u.textObject=void 0,u.linesCount=0,u.textMask=void 0,u.textObjectType=void 0,u._textLineHeight=void 0,u._textLineSpacing=void 0,u._visibleLinesCount=void 0,u._textHeight=void 0,u._textVisibleHeight=void 0,u._textObjectRealHeight=0,u.lines=void 0,u.text=vl(l,"content",""),u._textOY=0,u.execeedTopState=!1,u.execeedBottomState=!1,u.setClampMode(vl(l,"clamplTextOY",!0)),u.alwaysScrollable=vl(l,"alwaysScrollable",!1);var c=vl(l,"background",void 0),d=vl(l,"text",void 0);void 0===d&&(d=yl(t)),u.textCropEnable=vl(l,"textCrop",!!d.setCrop);var f=vl(l,"textMask",!u.textCropEnable);c&&u.addBackground(c),u.add(d),u.sizerChildren=[d];var v=u.getSizerConfig(d);return v.align=pl,v.padding=Te(0),v.expand=!0,u.textObject=d,u.textObjectType=el(d),v.preOffsetY=0,v.offsetY=0,f&&(u.textMask=sl.call(a(u),u.textObject,a(u))),u.addChildrenMap("background",c),u.addChildrenMap("text",d),u}return n(o,[{key:"destroy",value:function(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;}c(s(o.prototype),"destroy",this).call(this,t);}}},{key:"setClampMode",value:function(t){return void 0===t&&(t=!0),this.clampTextOY=t,this}},{key:"textLineHeight",get:function(){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}},{key:"textLineSpacing",get:function(){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}},{key:"visibleLinesCount",get:function(){return void 0===this._visibleLinesCount&&(this._visibleLinesCount=Math.floor(ol.call(this,this._textObjectRealHeight))),this._visibleLinesCount}},{key:"topTextOY",get:function(){return 0}},{key:"bottomTextOY",get:function(){return -this.textVisibleHeight}},{key:"textHeight",get:function(){return void 0===this._textHeight&&(this._textHeight=al.call(this,this.linesCount)),this._textHeight}},{key:"textObjectHeight",get:function(){return this._textObjectRealHeight-(this.textLineHeight+this.textLineSpacing)}},{key:"textVisibleHeight",get:function(){if(void 0===this._textVisibleHeight){var t=this.textHeight-this.textObjectHeight;!this.alwaysScrollable&&t<0&&(t=0),this._textVisibleHeight=t;}return this._textVisibleHeight}},{key:"textOYExceedTop",value:function(t){return void 0===t&&(t=this.textOY),t>this.topTextOY}},{key:"textOYExeceedBottom",value:function(t){return void 0===t&&(t=this.textOY),tthis.linesCount?t=0:n?t=e:r&&(t=i)),this._textOY!==t&&(this._textOY=t,this.updateTextObject()),n&&(this.execeedTopState||this.emit("execeedtop",this,t,e)),this.execeedTopState=n,r&&(this.execeedBottomState||this.emit("execeedbottom",this,t,i)),this.execeedBottomState=r;}},{key:"setTextOY",value:function(t){return this.textOY=t,this}},{key:"t",get:function(){var t=this.textVisibleHeight;return 0===t?0:this.textOY/-t},set:function(t){this.textOY=-this.textVisibleHeight*t;}},{key:"setTextOYByPercentage",value:function(t){return this.t=t,this}}]),o}(qs),yl=function(t){return t.add.text(0,0,"")};Object.assign(gl.prototype,dl);Phaser.Math.Clamp;var ml={scrollToLine:function(t){return this.setChildOY(-this.lineHeight*t),this},scrollToNextLine:function(t){void 0===t&&(t=1);var e=this.lineIndex+t;return this.scrollToLine(e),this}},bl=Phaser.Utils.Objects.GetValue,kl=function(t){r(s,t);var i=l(s);function s(t,n){var r;e(this,s),void 0===n&&(n={});var o=bl(n,"text",void 0),a=bl(n,"textWidth",void 0),h=bl(n,"textHeight",void 0),l=bl(n,"textCrop",!!o.setCrop),u=bl(n,"textMask",!l),c=bl(n,"content",""),d=new gl(t,{width:a,height:h,text:o,textMask:u,textCrop:l&&!u,content:c,clamplTextOY:bl(n,"clamplChildOY",!1),alwaysScrollable:bl(n,"alwaysScrollable",!1)});t.add.existing(d),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}});}(d),n.scrollMode=0,n.type="rexTextArea",n.child={gameObject:d,expandWidth:void 0===a,expandHeight:void 0===h};var f=bl(n,"space",void 0);return f&&(f.child=bl(f,"text",0)),(r=i.call(this,t,n)).addChildrenMap("text",o),r}return n(s,[{key:"text",get:function(){return this.childrenMap.child.text}},{key:"lineHeight",get:function(){var t=this.childrenMap.child;return t.textLineHeight+t.textLineSpacing}},{key:"lineIndex",get:function(){return Math.floor(-this.childOY/this.lineHeight)}},{key:"linesCount",get:function(){return this.childrenMap.child.linesCount}},{key:"contentHeight",get:function(){return this.childrenMap.child.textHeight}}]),s}(Zh);return Object.assign(kl.prototype,{setText:function(t){return this.childrenMap.child.setText(t),this.resizeController(),this},appendText:function(t){return this.setText(this.text+t),this}},ml),kl})); diff --git a/dist/rextextplayer.js b/dist/rextextplayer.js index c08fbae1f5..245babb026 100644 --- a/dist/rextextplayer.js +++ b/dist/rextextplayer.js @@ -6666,36 +6666,9 @@ return GetBobWorldPosition(this.parent, this, offsetX, offsetY, out); }; - var ScrollTo$1 = function ScrollTo() { - var textObject = this.parent; - var dx, dy; - var childLeftX = this.drawX + this.drawTLX; - var childRightX = childLeftX + this.width; - if (childLeftX < 0) { - dx = 0 - childLeftX; - } else if (childRightX > textObject.width) { - dx = textObject.width - childRightX; - } else { - dx = 0; - } - var childTopY = this.drawY + this.drawTLY; - var childBottomY = childTopY + this.height; - if (childTopY < 0) { - dy = 0 - childTopY; - } else if (childBottomY > textObject.height) { - dy = textObject.height - childBottomY; - } else { - dy = 0; - } - textObject._textOX += dx; - textObject._textOY += dy; - return this; - }; - var Methods$4 = { contains: Contains, - getWorldPosition: GetWorldPosition, - scrollTo: ScrollTo$1 + getWorldPosition: GetWorldPosition }; Object.assign(Methods$4, RenderMethods); @@ -9741,7 +9714,6 @@ return this; } this._textOX = ox; - this.updateTexture(); return this; }, setTextOY: function setTextOY(oy) { @@ -9749,7 +9721,6 @@ return this; } this._textOY = oy; - this.updateTexture(); return this; }, setTextOXY: function setTextOXY(ox, oy) { @@ -9758,7 +9729,6 @@ } this._textOX = ox; this._textOY = oy; - this.updateTexture(); return this; }, addTextOX: function addTextOX(incX) { diff --git a/dist/rextextplayer.min.js b/dist/rextextplayer.min.js index b994642cf0..a1429baf11 100644 --- a/dist/rextextplayer.min.js +++ b/dist/rextextplayer.min.js @@ -1 +1 @@ -!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).rextextplayer=e();}(undefined,(function(){function t(e){return t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},t(e)}function e(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){for(var i=0;it.length)&&(e=t.length);for(var i=0,n=new Array(e);i1?i-1:0),r=1;r0&&void 0!==t.setTint},useAlphaFadeEffect:function(t){return (void 0===this.fadeMode||1===this.fadeMode)&&this.fadeTime>0&&void 0!==t.setAlpha},useRevealEffect:function(t){return this.fadeMode>=2&&this.fadeMode<=5&&this.fadeTime>0&&(t.preFX||t.postFX)},fadeBob:function(t,e,i,n){var r=t.gameObject;if(this.useTintFadeEffect(r))void 0!==e&&t.setProperty("tintGray",255*e),t.easeProperty("tintGray",Math.floor(255*i),this.fadeTime,"Linear",0,!1,n);else if(this.useAlphaFadeEffect(r))void 0!==e&&t.setProperty("alpha",e),t.easeProperty("alpha",i,this.fadeTime,"Linear",0,!1,n);else if(this.useRevealEffect(r)){var s;switch(j(r,"reveal"),this.fadeMode){case 2:s="revealUp";break;case 3:s="revealDown";break;case 4:s="revealLeft";break;case 5:s="revealRight";}void 0===e&&(e=0),r[s]=e,t.easeProperty(s,i,this.fadeTime,"Linear",0,!1,n),t.getTweenTask(s).once("complete",(function(){r[s]=null;}));}else n&&n(r);return this}},G=function(t){return t>>16&255},D=function(t){return t>>8&255},W=function(t){return 255&t},A=Phaser.Events.EventEmitter,L=function(t,e,i,n,r,s){return void 0===s?s={}:!0===s&&(s=F),"number"!=typeof i&&(i=0,n=0),s.x=r.x+r.width*t+i,s.y=r.y+r.height*e+n,s},F={},X=function(t,e,i,n,r,s,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===n&&(n=.5),void 0===r&&(r=0),void 0===s&&(s=0),void 0===a&&(a=L),function(t){if(t.events)return t;var e=new A,i=t.x;Object.defineProperty(t,"x",{get:function(){return i},set:function(n){i!==n&&(i=n,e.emit("update",t));}});var n=t.y;Object.defineProperty(t,"y",{get:function(){return n},set:function(i){n!==i&&(n=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 s=t.height;Object.defineProperty(t,"height",{get:function(){return s},set:function(i){s!==i&&(s=i,e.emit("update",t));}}),t.events=e;}(e);var o=e.events;t.vp=e;var u=function(){a(i,n,r,s,e,t);};o.on("update",u),t.once("destroy",(function(){o.off("update",u),t.vp=void 0;})),Object.defineProperty(t,"vpx",{get:function(){return i},set:function(t){i!==t&&(i=t,u());}}),Object.defineProperty(t,"vpy",{get:function(){return n},set:function(t){n!==t&&(n=t,u());}}),Object.defineProperty(t,"vpxOffset",{get:function(){return r},set:function(t){r!==t&&(r=t,u());}}),Object.defineProperty(t,"vpyOffset",{get:function(){return s},set:function(t){s!==t&&(s=t,u());}}),u();},Y=Phaser.Utils.Array.Remove,I={has:function(t){return this.bobs.hasOwnProperty(t)},exists:function(t){return this.bobs.hasOwnProperty(t)},get:function(t){return this.bobs[t]},getGO:function(t){var e=this.get(t);return e?e.gameObject:null},addGO:function(t,e){this.remove(t,!0),this.useTintFadeEffect(e)&&function(t,e){if(t.hasOwnProperty("tintR"))return t;void 0===e&&(e=16777215);var i=G(e),n=D(e),r=W(e);Object.defineProperty(t,"tint",{get:function(){return e},set:function(s){s=16777215&Math.floor(s),t.setTint&&t.setTint(s),e!==s&&(i=G(e=s),n=D(e),r=W(e));}}),Object.defineProperty(t,"tintR",{get:function(){return i},set:function(n){n=255&Math.floor(n),i!==n&&(i=n,t.tint=(255&n)<<16|65535&e);}}),Object.defineProperty(t,"tintG",{get:function(){return n},set:function(i){i=255&Math.floor(i),n!==i&&(n=i,t.tint=(255&i)<<8|16711935&e);}}),Object.defineProperty(t,"tintB",{get:function(){return r},set:function(i){i=255&Math.floor(i),r!==i&&(r=i,t.tint=255&i|16776960&e);}}),Object.defineProperty(t,"tintGray",{get:function(){return Math.floor((i+n+r)/3)},set:function(e){e=255&Math.floor(e),i===e&&n===e&&r===e||(i=e,n=e,r=e,t.tint=(255&e)<<16|(255&e)<<8|255&e);}}),t.tint=e;}(e),this.viewportCoordinateEnable&&X(e,this.viewport),this.effectPropertiesConfig&&j(e,this.effectPropertiesConfig),e.once("destroy",(function(){Y(this.removedGOs,e),this.isEmpty&&this.emit("empty");}),this);var i=new this.BobClass(this,e,t);return this.bobs[t]=i,this},add:function(t){for(var e=this.createGameObjectCallback,i=this.createGameObjectScope,n=arguments.length,r=new Array(n>1?n-1:0),s=1;s2?n-2:0),s=2;s0?-this.delay:0,this.state=this.nowTime>=0?_t:Ct,this.repeatCounter=0,this}},{key:"stop",value:function(){return this.state=Tt,this}},{key:"update",value:function(t,e){this.state!==Tt&&this.state!==Rt&&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=jt)):(this.nowTime=this.duration,this.state=Rt):this.nowTime>=0&&(this.state=_t));}},{key:"t",get:function(){var t;switch(this.state){case Tt:case Ct:case jt:t=0;break;case _t:t=this.nowTime/this.duration;break;case Rt:t=1;}return Mt(t,0,1)},set:function(t){(t=Mt(t,-1,1))<0?(this.state=Ct,this.nowTime=-this.delay*t):(this.state=_t,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++);}},{key:"setT",value:function(t){return this.t=t,this}},{key:"isIdle",get:function(){return this.state===Tt}},{key:"isDelay",get:function(){return this.state===Ct}},{key:"isCountDown",get:function(){return this.state===_t}},{key:"isRunning",get:function(){return this.state===Ct||this.state===_t}},{key:"isDone",get:function(){return this.state===Rt}},{key:"isOddIteration",get:function(){return 1==(1&this.repeatCounter)}},{key:"isEvenIteration",get:function(){return 0==(1&this.repeatCounter)}}]),t}(),Tt=0,Ct=1,_t=2,jt=3,Rt=-1,Bt=function(t){r(a,t);var i=u(a);function a(t,n){var r;return e(this,a),(r=i.call(this,t,n)).timer=new Pt,r}return n(a,[{key:"shutdown",value:function(t){this.isShutdown||(h(s(a.prototype),"shutdown",this).call(this,t),this.timer.destroy(),this.timer=void 0);}},{key:"start",value:function(){return this.timer.start(),h(s(a.prototype),"start",this).call(this),this}},{key:"stop",value:function(){return this.timer.stop(),h(s(a.prototype),"stop",this).call(this),this}},{key:"complete",value:function(){return this.timer.stop(),h(s(a.prototype),"complete",this).call(this),this}}]),a}(Et),Gt=Phaser.Utils.Objects.GetValue,Dt=Phaser.Utils.Objects.GetAdvancedValue,Wt=Phaser.Tweens.Builders.GetEaseFunction,At=function(t){r(a,t);var i=u(a);function a(){return e(this,a),i.apply(this,arguments)}return n(a,[{key:"resetFromJSON",value:function(t){return this.timer.resetFromJSON(Gt(t,"timer")),this.setEnable(Gt(t,"enable",!0)),this.setTarget(Gt(t,"target",this.parent)),this.setDelay(Dt(t,"delay",0)),this.setDuration(Dt(t,"duration",1e3)),this.setEase(Gt(t,"ease","Linear")),this.setRepeat(Gt(t,"repeat",0)),this}},{key:"setEnable",value:function(t){return null==t&&(t=!0),this.enable=t,this}},{key:"setTarget",value:function(t){return void 0===t&&(t=this.parent),this.target=t,this}},{key:"setDelay",value:function(t){return this.delay=t,this}},{key:"setDuration",value:function(t){return this.duration=t,this}},{key:"setRepeat",value:function(t){return this.repeat=t,this}},{key:"setRepeatDelay",value:function(t){return this.repeatDelay=t,this}},{key:"setEase",value:function(t){return void 0===t&&(t="Linear"),this.ease=t,this.easeFn=Wt(t),this}},{key:"start",value:function(){return this.timer.isRunning||h(s(a.prototype),"start",this).call(this),this}},{key:"restart",value:function(){return this.timer.stop(),this.start.apply(this,arguments),this}},{key:"stop",value:function(t){return void 0===t&&(t=!1),h(s(a.prototype),"stop",this).call(this),t&&(this.timer.setT(1),this.updateGameObject(this.target,this.timer),this.complete()),this}},{key:"update",value:function(t,e){if(!this.isRunning||!this.enable||!this.parent.active)return this;var i=this.target,n=this.timer;return n.update(t,e),n.isDelay||this.updateGameObject(i,n),this.emit("update",i,this),n.isDone&&this.complete(),this}},{key:"updateGameObject",value:function(t,e){}}]),a}(Bt),Lt=Phaser.Sound.BaseSound,Ft=function(t){return t instanceof Lt},Xt=Phaser.Utils.Objects.GetValue,Yt=Phaser.Utils.Objects.GetAdvancedValue,It=Phaser.Math.Linear,Vt=function(t){r(a,t);var i=u(a);function a(t,n,r){var s;return e(this,a),Ft(t)&&(r=n,n=t,t=void 0),n.active=!0,n.scene=t,n.game=n.manager.game,(s=i.call(this,n,r)).volume={},s.resetFromJSON(r),s}return n(a,[{key:"resetFromJSON",value:function(t){return h(s(a.prototype),"resetFromJSON",this).call(this,t),this.setMode(Xt(t,"mode",0)),this.setEnable(Xt(t,"enable",!0)),this.setVolumeRange(Yt(t,"volume.start",this.parent.volume),Yt(t,"volume.end",0)),this}},{key:"setMode",value:function(t){return "string"==typeof t&&(t=zt[t]),this.mode=t,this}},{key:"setVolumeRange",value:function(t,e){return this.volume.start=t,this.volume.end=e,this}},{key:"start",value:function(){return this.timer.isRunning||(this.parent.setVolume(this.volume.start),this.timer.setDelay(this.delay).setDuration(this.duration),h(s(a.prototype),"start",this).call(this)),this}},{key:"updateGameObject",value:function(t,e){t.volume=It(this.volume.start,this.volume.end,e.t);}},{key:"complete",value:function(){switch(h(s(a.prototype),"complete",this).call(this),this.mode){case 1:this.parent.stop();break;case 2:this.parent.destroy();}return this}}]),a}(At),zt={stop:1,destroy:2},Nt=function(t,e,i,n,r){Ft(t)&&(r=n,n=i,i=e,e=t,t=void 0),void 0===n&&(n=1),void 0===r&&(r=0);var s,a={mode:0,volume:{start:r,end:n},duration:i};return "string"==typeof e&&(e=t.sys.sound.add(e)),e.hasOwnProperty("_fade")?(s=e._fade).stop().resetFromJSON(a):(s=new Vt(t,e,a),e._fade=s),s.start(),e.isPlaying||e.setVolume(r).play(),e},Ut=function(t,e,i,n){Ft(t)&&(n=i,i=e,e=t,t=void 0),void 0===n&&(n=!0);var r,s={mode:n?2:1,volume:{start:e.volume,end:0},duration:i};return e.hasOwnProperty("_fade")?(r=e._fade).stop().resetFromJSON(s):(r=new Vt(t,e,s),e._fade=r),r.start(),e.isPlaying||e.play(),e},Ht=Phaser.Utils.Objects.GetValue,Jt={setBackgroundMusicLoop:function(t){return void 0===t&&(t=!0),this.backgroundMusicLoop=t,this},setBackgroundMusicFadeTime:function(t){return this.backgroundMusicFadeTime=t,this},getBackgroundMusic:function(){return this.backgroundMusic},setCurrentBackgroundMusic:function(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:function(t,e){if(this.backgroundMusic&&this.backgroundMusic.key===t)return this;this.stopBackgroundMusic();var i=this.sound.add(t,{loop:Ht(e,"loop",this.backgroundMusicLoop),mute:Ht(e,"mute",this.backgroundMusicMute),volume:Ht(e,"volume",this.backgroundMusicVolume),detune:Ht(e,"detune",0),rate:Ht(e,"rate",1)});return this.setCurrentBackgroundMusic(i),this.backgroundMusicFadeTime>0&&this.fadeInBackgroundMusic(this.backgroundMusicFadeTime),this},pauseBackgroundMusic:function(){return this.backgroundMusic&&this.backgroundMusic.pause(),this},resumeBackgroundMusic:function(){return this.backgroundMusic&&this.backgroundMusic.resume(),this},stopBackgroundMusic:function(){return this.backgroundMusic&&(this.backgroundMusicFadeTime>0?this.fadeOutBackgroundMusic(this.backgroundMusicFadeTime,!0):(this.backgroundMusic.stop(),this.backgroundMusic.destroy(),this.backgroundMusic=void 0)),this},fadeInBackgroundMusic:function(t){return this.backgroundMusic&&Nt(this.backgroundMusic,t,this.backgroundMusicVolume,0),this},fadeOutBackgroundMusic:function(t,e){return this.backgroundMusic&&Ut(this.backgroundMusic,t,e),this},crossFadeBackgroundMusic:function(t,e){var i=this.backgroundMusicFadeTime;return this.backgroundMusicFadeTime=0,this.fadeOutBackgroundMusic(e,!0).playBackgroundMusic(t).fadeInBackgroundMusic(e),this.backgroundMusicFadeTime=i,this},setBackgroundMusicMute:function(t){return void 0===t&&(t=!0),this.backgroundMusicMute=t,this},setBackgroundMusicVolume:function(t){return this.backgroundMusicVolume=t,this},setBackgroundMusicRate:function(t){return this.backgroundMusic&&this.backgroundMusic.setRate(t),this},setBackgroundMusicDetune:function(t){return this.backgroundMusic&&this.backgroundMusic.setDetune(t),this}},Kt=Phaser.Utils.Objects.GetValue,qt={setBackgroundMusic2Loop:function(t){return void 0===t&&(t=!0),this.backgroundMusic2Loop=t,this},setBackgroundMusic2FadeTime:function(t){return this.backgroundMusic2FadeTime=t,this},getBackgroundMusic2:function(){return this.backgroundMusic2},setCurrentBackgroundMusic2:function(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:function(t,e){if(this.backgroundMusic2&&this.backgroundMusic2.key===t)return this;this.stopBackgroundMusic2();var i=this.sound.add(t,{loop:Kt(e,"loop",this.backgroundMusicLoop),mute:Kt(e,"mute",this.backgroundMusic2Mute),volume:Kt(e,"volume",this.backgroundMusic2Volume),detune:Kt(e,"detune",0),rate:Kt(e,"rate",1)});return this.setCurrentBackgroundMusic2(i),this.backgroundMusic2FadeTime>0&&this.fadeInBackgroundMusic2(this.backgroundMusic2FadeTime),this},pauseBackgroundMusic2:function(){return this.backgroundMusic2&&this.backgroundMusic2.pause(),this},resumeBackgroundMusic2:function(){return this.backgroundMusic2&&this.backgroundMusic2.resume(),this},stopBackgroundMusic2:function(){return this.backgroundMusic2&&(this.backgroundMusic2FadeTime>0?this.fadeOutBackgroundMusic2(this.backgroundMusic2FadeTime,!0):(this.backgroundMusic2.stop(),this.backgroundMusic2.destroy(),this.backgroundMusic2=void 0)),this},fadeInBackgroundMusic2:function(t){return this.backgroundMusic2&&Nt(this.backgroundMusic2,t,this.backgroundMusic2Volume,0),this},fadeOutBackgroundMusic2:function(t,e){return this.backgroundMusic2&&Ut(this.backgroundMusic2,t,e),this},crossFadeBackgroundMusic2:function(t,e){var i=this.backgroundMusic2FadeTime;return this.backgroundMusic2FadeTime=0,this.fadeOutBackgroundMusic2(e,!0).playBackgroundMusic2(t).fadeInBackgroundMusic2(e),this.backgroundMusic2FadeTime=i,this},setBackgroundMusic2Mute:function(t){return void 0===t&&(t=!0),this.backgroundMusic2Mute=t,this},setBackgroundMusic2Volume:function(t){return this.backgroundMusic2Volume=t,this},setBackgroundMusic2Rate:function(t){return this.backgroundMusic2&&this.backgroundMusic2.setRate(t),this},setBackgroundMusic2Detune:function(t){return this.backgroundMusic2&&this.backgroundMusic2.setDetune(t),this}},$t=Phaser.Utils.Array.Remove,Qt=Phaser.Utils.Objects.GetValue,Zt={getSoundEffects:function(){return this.soundEffects},getLastSoundEffect:function(){return this.soundEffects[this.soundEffects.length-1]},playSoundEffect:function(t,e){var i=this.sound.add(t,{mute:Qt(e,"mute",this.soundEffectsMute),volume:Qt(e,"volume",this.soundEffectsVolume),detune:Qt(e,"detune",0),rate:Qt(e,"rate",1)});return this.soundEffects.push(i),i.once("complete",(function(){i.destroy(),this.sound&&$t(this.soundEffects,i);}),this).once("destroy",(function(){this.sound&&$t(this.soundEffects,i);}),this).play(),this},stopAllSoundEffects:function(){for(var t=this.soundEffects.length-1;t>=0;t--){var e=this.soundEffects[t];e.stop(),e.destroy();}return this},fadeInSoundEffect:function(t){var e=this.getLastSoundEffect();return e&&Nt(e,t,this.soundEffectsVolume,0),this},fadeOutSoundEffect:function(t,e){var i=this.getLastSoundEffect();return i&&Ut(i,t,e),this},fadeOutAllSoundEffects:function(t,e){for(var i=this.soundEffects.length-1;i>=0;i--)Ut(this.soundEffects[i],t,e);return this},setSoundEffectMute:function(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:function(t,e){if(void 0===e&&(e=!1),e){var i=this.getLastSoundEffect();i&&i.setVolume(t);}else this.soundEffectsVolume=t;return this},setSoundEffectDetune:function(t,e){var i;void 0===e&&(e=!1);for(var n=0,r=(i=e?[this.getLastSoundEffect()]:this.soundEffects).length;n=0;t--){var e=this.soundEffects[t];e.stop(),e.destroy();}return this},fadeInSoundEffect2:function(t){var e=this.getLastSoundEffect2();return e&&Nt(e,t,this.soundEffects2Volume,0),this},fadeOutSoundEffect2:function(t,e){var i=this.getLastSoundEffect2();return i&&Ut(i,t,e),this},fadeOutAllSoundEffects2:function(t,e){for(var i=this.soundEffects2.length-1;i>=0;i--)Ut(this.soundEffects2[i],t,e);return this},setSoundEffect2Mute:function(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:function(t,e){if(void 0===e&&(e=!1),e){var i=this.getLastSoundEffect2();i&&i.setVolume(t);}else this.soundEffects2Volume=t;return this},setSoundEffect2Detune:function(t,e){var i;void 0===e&&(e=!1);for(var n=0,r=(i=e?[this.getLastSoundEffect2()]:this.soundEffects2).length;n=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}},{key:"backgroundMusicMute",get:function(){return this._backgroundMusicMute},set:function(t){this._backgroundMusicMute=t,this.backgroundMusic&&this.backgroundMusic.setMute(mute);}},{key:"backgroundMusicVolume",get:function(){return this._backgroundMusicVolume},set:function(t){this._backgroundMusicVolume=t,this.backgroundMusic&&this.backgroundMusic.setVolume(t);}},{key:"backgroundMusic2Mute",get:function(){return this._backgroundMusic2Mute},set:function(t){this._backgroundMusic2Mute=t,this.backgroundMusic2&&this.backgroundMusic2.setMute(mute);}},{key:"backgroundMusic2Volume",get:function(){return this._backgroundMusic2Volume},set:function(t){this._backgroundMusic2Volume=t,this.backgroundMusic2&&this.backgroundMusic2.setVolume(t);}},{key:"soundEffectsMute",get:function(){return this._soundEffectsMute},set:function(t){this._soundEffectsMute=t;for(var e=this.soundEffects,i=0,n=e.length;i0?this.items.pop():null}},{key:"push",value:function(t){return this.items.push(t),this}},{key:"pushMultiple",value:function(t){return this.items.push.apply(this.items,t),t.length=0,this}},{key:"clear",value:function(){return this.items.length=0,this}}]),t}(),le=function(t){r(s,t);var i=u(s);function s(){return e(this,s),i.apply(this,arguments)}return n(s,[{key:"allocate",value:function(){return this.pop()}},{key:"free",value:function(t){t.onFree(),this.push(t);}},{key:"freeMultiple",value:function(t){for(var e=0,i=t.length;e2?n-2:0),s=2;s3?r-3:0),a=3;ai.width?i.width-r:0;var s=this.drawY+this.drawTLY,a=s+this.height;return e=s<0?0-s:a>i.height?i.height-a:0,i._textOX+=t,i._textOY+=e,this}};Object.assign(ii,Ue);var ni=Phaser.Math.DegToRad,ri=Phaser.Math.RadToDeg,si=Phaser.Utils.Objects.GetValue,ai=function(t){r(s,t);var i=u(s);function s(t,n){var r;return e(this,s),(r=i.call(this,t,n)).renderable=!0,r.scrollFactorX=1,r.scrollFactorY=1,r.toLocalPosition=!0,r.originX=0,r.offsetX=0,r.offsetY=0,r}return n(s,[{key:"visible",get:function(){return this._visible},set:function(t){this.setDirty(this._visible!=t),this._visible=t;}},{key:"setVisible",value:function(t){return void 0===t&&(t=!0),this.visible=t,this}},{key:"alpha",get:function(){return this._alpha},set:function(t){this.setDirty(this._alpha!=t),this._alpha=t;}},{key:"setAlpha",value:function(t){return this.alpha=t,this}},{key:"x",get:function(){return this._x},set:function(t){this.setDirty(this._x!=t),this._x=t;}},{key:"setX",value:function(t){return this.x=t,this}},{key:"y",get:function(){return this._y},set:function(t){this.setDirty(this._y!=t),this._y=t;}},{key:"setY",value:function(t){return this.y=t,this}},{key:"setPosition",value:function(t,e){return this.x=t,this.y=e,this}},{key:"setInitialPosition",value:function(t,e){return this.x0=t,this.y0=e,this}},{key:"setScrollFactorX",value:function(t){return this.scrollFactorX=t,this}},{key:"setScrollFactorY",value:function(t){return this.scrollFactorY=t,this}},{key:"setScrollFactor",value:function(t,e){return void 0===e&&(e=t),this.scrollFactorX=t,this.scrollFactorY=e,this}},{key:"rotation",get:function(){return this._rotation},set:function(t){this.setDirty(this._rotation!=t),this._rotation=t;}},{key:"setRotation",value:function(t){return this.rotation=t,this}},{key:"angle",get:function(){return ri(this._rotation)},set:function(t){this.rotation=ni(t);}},{key:"setAngle",value:function(t){return this.angle=t,this}},{key:"scaleX",get:function(){return this._scaleX},set:function(t){this.setDirty(this._scaleX!==t),this._scaleX=t;}},{key:"setScaleX",value:function(t){return this.scaleX=t,this}},{key:"width",get:function(){return 0},set:function(t){}},{key:"setWidth",value:function(t,e){return void 0===e&&(e=!1),this.width=t,e&&(this.scaleY=this.scaleX),this}},{key:"leftSpace",get:function(){return this._leftSpace},set:function(t){this.setDirty(this._leftSpace!==t),this._leftSpace=t;}},{key:"setLeftSpace",value:function(t){return this.leftSpace=t,this}},{key:"rightSpace",get:function(){return this._rightSpace},set:function(t){this.setDirty(this._rightSpace!==t),this._rightSpace=t;}},{key:"setRightSpace",value:function(t){return this.rightSpace=t,this}},{key:"outerWidth",get:function(){return this.width+this.leftSpace+this.rightSpace}},{key:"scaleY",get:function(){return this._scaleY},set:function(t){this.setDirty(this._scaleY!==t),this._scaleY=t;}},{key:"setScaleY",value:function(t){return this.scaleY=t,this}},{key:"height",get:function(){return 0},set:function(t){}},{key:"setHeight",value:function(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}},{key:"setScale",value:function(t,e){return void 0===e&&(e=t),this.scaleX=t,this.scaleY=e,this}},{key:"setOrigin",value:function(t){return this.originX=t,this}},{key:"setAlign",value:function(t){return this.align=t,this}},{key:"modifyPorperties",value:function(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=si(t,"width",void 0),i=si(t,"height",void 0),n=si(t,"scaleX",void 0),r=si(t,"scaleY",void 0);return void 0!==e?void 0===i&&void 0===r?this.setWidth(e,!0):this.setWidth(e):void 0!==n&&this.setScaleX(n),void 0!==i?void 0===e&&void 0===n?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}},{key:"setDrawBelowCallback",value:function(t){return this.drawBelowCallback=t,this}},{key:"setDrawAboveCallback",value:function(t){return this.drawAboveCallback=t,this}},{key:"reset",value:function(){return this.setVisible().setAlpha(1).setPosition(0,0).setRotation(0).setScale(1,1).setLeftSpace(0).setRightSpace(0).setOrigin(0).setAlign().setDrawBelowCallback().setDrawAboveCallback(),this}},{key:"willRender",get:function(){return this.visible&&this.alpha>0}},{key:"drawX",get:function(){var t=this.x+this.leftSpace+this.offsetX-this.originX*this.width;return this.parent._textOX*this.scrollFactorX+t}},{key:"drawY",get:function(){var t=this.y+this.offsetY;return this.parent._textOY*this.scrollFactorY+t}},{key:"drawTLX",get:function(){return 0}},{key:"drawTLY",get:function(){return 0}},{key:"drawBLX",get:function(){return 0}},{key:"drawBLY",get:function(){return 0}},{key:"drawTRX",get:function(){return 0}},{key:"drawTRY",get:function(){return 0}},{key:"drawBRX",get:function(){return 0}},{key:"drawBRY",get:function(){return 0}},{key:"drawCenterX",get:function(){return (this.drawTRX+this.drawTLX)/2}},{key:"drawCenterY",get:function(){return (this.drawBLY+this.drawTLY)/2}}]),s}(Xe);Object.assign(ai.prototype,ii);var oi=Phaser.Utils.String.Pad,ui=function(e,i,n){if(null==e)return e;switch(t(e)){case"string":default:return e;case"number":return "#".concat(oi(Math.floor(e).toString(16),6,"0",1));case"function":return e(i,n);case"object":return e.hasOwnProperty("r")?e.hasOwnProperty("a")?"rgba(".concat(e.r,",").concat(e.g,",").concat(e.b,",").concat(e.a,")"):"rgb(".concat(e.r,",").concat(e.g,",").concat(e.b,")"):e.hasOwnProperty("h")?e.hasOwnProperty("a")?"hsla(".concat(e.h,",").concat(e.s,",").concat(e.l,",").concat(e.a,")"):"hsl(".concat(e.h,",").concat(e.s,",").concat(e.l,")"):e}},ci=function(t,e,i){return e.hasOwnProperty(t)?e[t]:i[t]},hi=Phaser.Utils.Objects.GetValue,li=function(){function t(i,n,r,s,a){e(this,t),void 0===i&&(i=0),void 0===n&&(n=i),void 0===r&&(r=0),void 0===s&&(s=0),void 0===a&&(a=0),this.cornerRadius={},this._width=0,this._height=0,this.setTo(i,n,r,s,a);}return n(t,[{key:"setTo",value:function(t,e,i,n,r){return this.setPosition(t,e),this.setRadius(r),this.setSize(i,n),this}},{key:"setPosition",value:function(t,e){return this.x=t,this.y=e,this}},{key:"setRadius",value:function(t){return void 0===t&&(t=0),this.radius=t,this}},{key:"setSize",value:function(t,e){return this.width=t,this.height=e,this}},{key:"minWidth",get:function(){var t=this.cornerRadius;return Math.max(t.tl.x+t.tr.x,t.bl.x+t.br.x)}},{key:"minHeight",get:function(){var t=this.cornerRadius;return Math.max(t.tl.y+t.bl.y,t.tr.y+t.br.y)}},{key:"width",get:function(){return this._width},set:function(t){null==t&&(t=0),this._width=Math.max(t,this.minWidth);}},{key:"height",get:function(){return this._height},set:function(t){null==t&&(t=0),this._height=Math.max(t,this.minHeight);}},{key:"radius",get:function(){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:function(t){var e,i;"number"==typeof t?(e=t,i=t):(e=hi(t,"x",0),i=hi(t,"y",0));var n=this.cornerRadius;n.tl=fi(hi(t,"tl",void 0),e,i),n.tr=fi(hi(t,"tr",void 0),e,i),n.bl=fi(hi(t,"bl",void 0),e,i),n.br=fi(hi(t,"br",void 0),e,i);}},{key:"radiusTL",get:function(){var t=this.cornerRadius.tl;return Math.max(t.x,t.y)},set:function(t){di(this.cornerRadius.tl,t);}},{key:"radiusTR",get:function(){var t=this.cornerRadius.tr;return Math.max(t.x,t.y)},set:function(t){di(this.cornerRadius.tr,t);}},{key:"radiusBL",get:function(){var t=this.cornerRadius.bl;return Math.max(t.x,t.y)},set:function(t){di(this.cornerRadius.bl,t);}},{key:"radiusBR",get:function(){var t=this.cornerRadius.br;return Math.max(t.x,t.y)},set:function(t){di(this.cornerRadius.br,t);}}]),t}(),fi=function(t,e,i){return void 0===t?t={x:e,y:i}:"number"==typeof t&&(t={x:t,y:t}),gi(t),t},di=function(t,e){"number"==typeof e?(t.x=e,t.y=e):(t.x=hi(e,"x",0),t.y=hi(e,"y",0)),gi(t);},gi=function(t){t.convex=t.x>=0||t.y>=0,t.x=Math.abs(t.x),t.y=Math.abs(t.y);},pi=Phaser.Math.DegToRad,vi=function(t){return !t.hasOwnProperty("convex")||t.convex},yi=function(t){return t.x>0&&t.y>0},mi=function(t,e,i,n,r,s,a,o,u){if(o&&a>s?a-=360:!o&&a=d?1:n/d,v=r>=g?1:r/g,y=f.cornerRadius;t.save(),t.beginPath(),t.translate(e,i),o=y.tl,yi(o)?(u=o.x*p,c=o.y*v,vi(o)?mi(t,u,c,u,c,180,270,!1,a):mi(t,0,0,u,c,90,0,!0,a),h=0,l=c):(t.lineTo(0,0),h=0,l=0),o=y.tr,yi(o)?(u=o.x*p,c=o.y*v,vi(o)?mi(t,n-u,c,u,c,270,360,!1,a):mi(t,n,0,u,c,180,90,!0,a)):t.lineTo(n,0),o=y.br,yi(o)?(u=o.x*p,c=o.y*v,vi(o)?mi(t,n-u,r-c,u,c,0,90,!1,a):mi(t,n,r,u,c,270,180,!0,a)):t.lineTo(n,r),o=y.bl,yi(o)?(u=o.x*p,c=o.y*v,vi(o)?mi(t,u,r-c,u,c,90,180,!1,a):mi(t,0,r,u,c,360,270,!0,a)):t.lineTo(0,r),t.lineTo(h,l),t.closePath(),t.restore();}(e,i,n,r,s,a,f),null!=o){var d;if(null!=h)(d=l?e.createLinearGradient(0,0,r,0):e.createLinearGradient(0,0,0,s)).addColorStop(0,o),d.addColorStop(1,h),o=d;e.fillStyle=o,e.fill();}null!=u&&c>0&&(e.strokeStyle=u,e.lineWidth=c,e.stroke());},bi=Phaser.Utils.Objects.GetValue,wi=function(t){r(a,t);var i=u(a);function a(t,n){var r;return e(this,a),(r=i.call(this,t,"background")).setScrollFactor(0),r.setColor(bi(n,"color",null),bi(n,"color2",null),bi(n,"horizontalGradient",!0)),r.setStroke(bi(n,"stroke",null),bi(n,"strokeThickness",2)),r.setCornerRadius(bi(n,"cornerRadius",0),bi(n,"cornerIteration",null)),r}return n(a,[{key:"color",get:function(){return this._color},set:function(t){t=ui(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t;}},{key:"color2",get:function(){return this._color2},set:function(t){t=ui(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t;}},{key:"horizontalGradient",get:function(){return this._horizontalGradient},set:function(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t;}},{key:"setColor",value:function(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}},{key:"stroke",get:function(){return this._stroke},set:function(t){t=ui(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t;}},{key:"strokeThickness",get:function(){return this._strokeThickness},set:function(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t;}},{key:"setStroke",value:function(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}},{key:"cornerRadius",get:function(){return this._cornerRadius},set:function(t){this.setDirty(this._cornerRadius!=t),this._cornerRadius=t;}},{key:"cornerIteration",get:function(){return this._cornerIteration},set:function(t){this.setDirty(this._cornerIteration!=t),this._cornerIteration=t;}},{key:"modifyStyle",value:function(t){return t.hasOwnProperty("color")&&this.setColor(t.color,ci("color2",t,this),ci("horizontalGradient",t,this)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,ci("strokeThickness",t,this)),t.hasOwnProperty("cornerRadius")&&this.setCornerRadius(t.cornerRadius,ci("cornerIteration",t,this)),this}},{key:"modifyPorperties",value:function(t){return h(s(a.prototype),"modifyPorperties",this).call(this,t),this.modifyStyle(t),this}},{key:"setCornerRadius",value:function(t,e){return this.cornerRadius=t,this.cornerIteration=e,this}},{key:"renderContent",value:function(){!function(t,e,i,n,r,s,a,o){if(null!=e||null!=i){var u=t.canvas.width,c=t.canvas.height;null==i&&(n=0);var h=n/2;u=Math.max(1,u-n),c=Math.max(1,c-n),ki(t.canvas,t.context,h,h,u,c,r,e,i,n,s,a,o);}}(this.parent,this.color,this.stroke,this.strokeThickness,this.cornerRadius,this.color2,this.horizontalGradient,this.cornerIteration);}}]),a}(ai),Si=Phaser.Utils.Objects.GetValue,Ei=function(t){r(a,t);var i=u(a);function a(t,n){var r;return e(this,a),(r=i.call(this,t,"innerbounds")).setScrollFactor(0),r.setColor(Si(n,"color",null),Si(n,"color2",null),Si(n,"horizontalGradient",!0)),r.setStroke(Si(n,"stroke",null),Si(n,"strokeThickness",2)),r}return n(a,[{key:"color",get:function(){return this._color},set:function(t){t=ui(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t;}},{key:"color2",get:function(){return this._color2},set:function(t){t=ui(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t;}},{key:"horizontalGradient",get:function(){return this._horizontalGradient},set:function(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t;}},{key:"setColor",value:function(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}},{key:"stroke",get:function(){return this._stroke},set:function(t){t=ui(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t;}},{key:"strokeThickness",get:function(){return this._strokeThickness},set:function(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t;}},{key:"setStroke",value:function(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}},{key:"modifyPorperties",value:function(t){h(s(a.prototype),"modifyPorperties",this).call(this,t),t.hasOwnProperty("color")&&this.setColor(t.color,Si(t,"color2",null),Si(t,"horizontalGradient",!0)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,Si(t,"strokeThickness",2));}},{key:"renderContent",value:function(){var t=this.parent.padding,e=t.left,i=t.top,n=this.parent.width-t.left-t.right,r=this.parent.height-t.top-t.bottom,s=this.context;if(null!=this.color){var a,o;if(null!=this.color2)(o=this.horizontalGradient?s.createLinearGradient(0,0,n,0):s.createLinearGradient(0,0,0,r)).addColorStop(0,this.color),o.addColorStop(1,this.color2),a=o;else a=this.color;s.fillStyle=a,s.fillRect(e,i,n,r);}null!=this.stroke&&this.strokeThickness>0&&(s.strokeStyle=this.stroke,s.lineWidth=this.strokeThickness,s.strokeRect(e,i,n,r));}}]),a}(ai),Oi=Phaser.Utils.Objects.GetValue,xi=function(){function t(i,n){e(this,t),this.parent=i,this.set(n);}return n(t,[{key:"toJSON",value:function(){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}}},{key:"set",value:function(t){return this.setBold(Oi(t,"bold",!1)),this.setItalic(Oi(t,"italic",!1)),this.setFontSize(Oi(t,"fontSize","16px")),this.setFontFamily(Oi(t,"fontFamily","Courier")),this.setColor(Oi(t,"color","#fff")),this.setStrokeStyle(Oi(t,"stroke",null),Oi(t,"strokeThickness",0)),this.setShadow(Oi(t,"shadowColor",null),Oi(t,"shadowOffsetX",0),Oi(t,"shadowOffsetY",0),Oi(t,"shadowBlur",0)),this.setOffset(Oi(t,"offsetX",0),Oi(t,"offsetY",0)),this.setSpace(Oi(t,"leftSpace",0),Oi(t,"rightSpace",0)),this.setAlign(Oi(t,"align",void 0)),this.setBackgroundColor(Oi(t,"backgroundColor",null)),this.setBackgroundHeight(Oi(t,"backgroundHeight",void 0)),this.setBackgroundBottomY(Oi(t,"backgroundBottomY",void 0)),this}},{key:"modify",value:function(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(ci("stroke",t,this),ci("strokeThickness",t,this)),t.hasOwnProperty("shadowColor")&&this.setShadowColor(t.shadowColor),(t.hasOwnProperty("shadowOffsetX")||t.hasOwnProperty("shadowOffsetY"))&&this.setShadowOffset(ci("shadowOffsetX",t,this),ci("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}},{key:"setUpdateTextFlag",value:function(){return this.parent&&(this.parent.updateTextFlag=!0),this}},{key:"clone",value:function(){return new t(null,this.toJSON())}},{key:"copyFrom",value:function(t){return this.set(t.toJSON()),this}},{key:"copyTo",value:function(t){return t.set(this.toJSON()),this}},{key:"setBold",value:function(t){return void 0===t&&(t=!0),this.bold=t,this.setUpdateTextFlag(),this}},{key:"setItalic",value:function(t){return void 0===t&&(t=!0),this.italic=t,this.setUpdateTextFlag(),this}},{key:"fontStyle",get:function(){return this.bold&&this.italic?"bold italic":this.bold?"bold":this.italic?"italic":""}},{key:"setFontSize",value:function(t){return "number"==typeof t&&(t="".concat(t,"px")),this.fontSize=t,this.setUpdateTextFlag(),this}},{key:"setFontFamily",value:function(t){return this.fontFamily=t,this.setUpdateTextFlag(),this}},{key:"font",get:function(){return "".concat(this.fontStyle," ").concat(this.fontSize," ").concat(this.fontFamily)}},{key:"setColor",value:function(t){return this.color=ui(t),this}},{key:"hasFill",get:function(){return null!=this.color}},{key:"setStrokeStyle",value:function(t,e){return this.stroke=ui(t),void 0!==e&&(this.strokeThickness=e),this}},{key:"setStrokeThickness",value:function(t){return this.strokeThickness=t,this}},{key:"hasStroke",get:function(){return null!=this.stroke&&this.strokeThickness>0}},{key:"setShadowColor",value:function(t){return this.shadowColor=ui(t),this}},{key:"setShadowOffset",value:function(t,e){return void 0===t&&(t=0),void 0===e&&(e=0),this.shadowOffsetX=t,this.shadowOffsetY=e,this}},{key:"setShadowBlur",value:function(t){return void 0===t&&(t=0),this.shaodwBlur=t,this}},{key:"setShadow",value:function(t,e,i,n){return this.setShadowColor(t).setShadowOffset(e,i).setShadowBlur(n),this}},{key:"setBackgroundColor",value:function(t){return this.backgroundColor=ui(t),this}},{key:"hasBackgroundColor",get:function(){return null!=this.backgroundColor}},{key:"setBackgroundHeight",value:function(t){return this.backgroundHeight=t,this}},{key:"setBackgroundBottomY",value:function(t){return this.backgroundBottomY=t,this}},{key:"setOffsetX",value:function(t){return void 0===t&&(t=0),this.offsetX=t,this}},{key:"setOffsetY",value:function(t){return void 0===t&&(t=0),this.offsetY=t,this}},{key:"setOffset",value:function(t,e){return this.setOffsetX(t).setOffsetY(e),this}},{key:"setLeftSpace",value:function(t){return void 0===t&&(t=0),this.leftSpace=t,this}},{key:"setRightSpace",value:function(t){return void 0===t&&(t=0),this.rightSpace=t,this}},{key:"setSpace",value:function(t,e){return this.setLeftSpace(t).setRightSpace(e),this}},{key:"setAlign",value:function(t){return this.align=t,this}},{key:"syncFont",value:function(t){return t.font=this.font,this}},{key:"syncStyle",value:function(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}},{key:"syncShadow",value:function(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);}},{key:"getTextMetrics",value:function(t,e){return this.syncFont(t).syncStyle(t),t.measureText(e)}}]),t}(),Mi=Phaser.Utils.Array.Remove,Pi=Phaser.Utils.Array.Remove,Ti="text",Ci="image",_i="drawer",ji="space",Ri="command",Bi=function(t){return t.type===Ti&&"\n"===t.text},Gi=function(t){return t.type===Ti&&"\f"===t.text},Di=function(t){return t.type===Ti},Wi=function(t){return t.type===Ri},Ai=function(t){r(a,t);var i=u(a);function a(t,n,r){var s;return e(this,a),(s=i.call(this,t,Ti)).updateTextFlag=!1,s.style=new xi(o(s),r),s.setText(n),s}return n(a,[{key:"autoRound",get:function(){return this.parent.autoRound}},{key:"offsetX",get:function(){return this.style.offsetX},set:function(t){this.style&&(this.style.offsetX=t);}},{key:"offsetY",get:function(){return this.style.offsetY},set:function(t){this.style&&(this.style.offsetY=t);}},{key:"leftSpace",get:function(){return this.style.leftSpace*this.scaleX},set:function(t){this.style&&(this.style.leftSpace=t),f(s(a.prototype),"leftSpace",t,this,!0);}},{key:"rightSpace",get:function(){return this.style.rightSpace*this.scaleX},set:function(t){this.style&&(this.style.rightSpace=t),f(s(a.prototype),"rightSpace",t,this,!0);}},{key:"align",get:function(){return this.style.align},set:function(t){this.style&&(this.style.align=t);}},{key:"modifyStyle",value:function(t){return this.setDirty(!0),this.style.modify(t),this.updateTextFlag&&this.updateTextSize(),this}},{key:"modifyPorperties",value:function(t){return t?(this.modifyStyle(t),h(s(a.prototype),"modifyPorperties",this).call(this,t),this):this}},{key:"setText",value:function(t){return this.setDirty(this.text!=t),this.text=t,this.updateTextSize(),this}},{key:"updateTextSize",value:function(){var t=this.text;if("\n"===t||"\f"===t||""===t)this.clearTextSize();else {var e,i,n=this.style.getTextMetrics(this.context,this.text);this.textWidth=n.width,"actualBoundingBoxAscent"in n?(e=n.actualBoundingBoxAscent,i=n.actualBoundingBoxDescent):(e=0,i=0),this.textHeight=e+i,this.ascent=e,this.descent=i;}return this.updateTextFlag=!1,this}},{key:"clearTextSize",value:function(){return this.textWidth=0,this.textHeight=0,this.ascent=0,this.descent=0,this}},{key:"copyTextSize",value:function(t){return this.textWidth=t.textWidth,this.textHeight=t.textHeight,this.ascent=t.ascent,this.descent=t.descent,this}},{key:"width",get:function(){return this.textWidth*this.scaleX},set:function(t){this.textWidth>0?this.scaleX=t/this.textWidth:this.scaleX=1;}},{key:"height",get:function(){return this.textHeight*this.scaleY},set:function(t){this.textHeight>0?this.scaleY=t/this.textHeight:this.scaleY=1;}},{key:"willRender",get:function(){return 0!==this.textWidth&&h(s(a.prototype),"willRender",this)}},{key:"renderContent",value:function(){var t=this.context,e=this.style;if(e.hasBackgroundColor){t.fillStyle=e.backgroundColor;var i=this.drawTLX,n=this.drawTRX-i,r=e.backgroundBottomY;null==r&&(r=this.drawBLY);var s=e.backgroundHeight;null==s&&(s=r-this.drawTLY);var a=r-s;t.fillRect(i,a,n,s);}var o=e.hasFill,u=e.hasStroke;(o||u)&&(e.syncFont(t).syncStyle(t),u&&(e.syncShadow(t),t.strokeText(this.text,0,0)),o&&(e.syncShadow(t),t.fillText(this.text,0,0)));}},{key:"drawTLX",get:function(){return -this.leftSpace}},{key:"drawTLY",get:function(){return -this.ascent}},{key:"drawBLX",get:function(){return -this.leftSpace}},{key:"drawBLY",get:function(){return this.descent}},{key:"drawTRX",get:function(){return this.textWidth+this.rightSpace}},{key:"drawTRY",get:function(){return -this.ascent}},{key:"drawBRX",get:function(){return this.textWidth+this.rightSpace}},{key:"drawBRY",get:function(){return this.descent}}]),a}(ai),Li=function(t,e){var i=this.createCharChildren(t,e);return this.addChild(i),this},Fi=function(t){r(s,t);var i=u(s);function s(t,n,r){var a;return e(this,s),(a=i.call(this,t,Ci)).setTexture(n,r),a}return n(s,[{key:"frameWidth",get:function(){return this.frameObj?this.frameObj.cutWidth:0}},{key:"frameHeight",get:function(){return this.frameObj?this.frameObj.cutHeight:0}},{key:"offsetY",get:function(){return -this.height},set:function(t){}},{key:"key",get:function(){return this._key},set:function(t){this.setDirty(this._key!=t),this._key=t;}},{key:"frame",get:function(){return this._frame},set:function(t){this.setDirty(this._frame!=t),this._frame=t;}},{key:"setTexture",value:function(t,e){return this.key=t,this.frame=e,this.frameObj=this.scene.sys.textures.getFrame(t,e),this}},{key:"width",get:function(){return this.frameWidth*this.scaleX},set:function(t){this.setDirty(this.width!==t),this.scaleX=t/this.frameWidth;}},{key:"height",get:function(){return this.frameHeight*this.scaleY},set:function(t){this.setDirty(this.height!==t),this.scaleY=t/this.frameHeight;}},{key:"setHeight",value:function(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}},{key:"renderContent",value:function(){var t=this.context,e=this.frameObj,i=this.frameWidth,n=this.frameHeight;t.drawImage(e.source.image,e.cutX,e.cutY,i,n,0,0,i,n);}},{key:"drawTLX",get:function(){return -this.leftSpace}},{key:"drawTLY",get:function(){return 0}},{key:"drawBLX",get:function(){return -this.leftSpace}},{key:"drawBLY",get:function(){return this.frameHeight}},{key:"drawTRX",get:function(){return this.frameWidth+this.rightSpace}},{key:"drawTRY",get:function(){return 0}},{key:"drawBRX",get:function(){return this.frameWidth+this.rightSpace}},{key:"drawBRY",get:function(){return this.frameHeight}}]),s}(ai),Xi=function(t,e,i){var n=this.createImageChild(t,e,i);return this.addChild(n),this},Yi=function(t){r(a,t);var i=u(a);function a(t,n,r,s){var o;return e(this,a),(o=i.call(this,t,_i)).setRenderCallback(n),o.setDrawerSize(r,s),o}return n(a,[{key:"setRenderCallback",value:function(t){return t?this.renderContent=t.bind(this):delete this.renderContent,this}},{key:"setDrawerSize",value:function(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}},{key:"onFree",value:function(){h(s(a.prototype),"onFree",this).call(this),this.setRenderCallback();}},{key:"width",get:function(){return this.drawerWidth*this.scaleX},set:function(t){this.setDirty(this.width!==t),this.scaleX=this.drawerWidth>0?t/this.drawerWidth:1;}},{key:"height",get:function(){return this.drawerHeight*this.scaleY},set:function(t){this.setDirty(this.height!==t),this.scaleY=this.drawerHeight>0?t/this.drawerHeight:1;}},{key:"offsetY",get:function(){return -this.height},set:function(t){}},{key:"drawTLX",get:function(){return -this.leftSpace}},{key:"drawTLY",get:function(){return 0}},{key:"drawBLX",get:function(){return -this.leftSpace}},{key:"drawBLY",get:function(){return this.drawerHeight}},{key:"drawTRX",get:function(){return this.drawerWidth+this.rightSpace}},{key:"drawTRY",get:function(){return 0}},{key:"drawBRX",get:function(){return this.drawerWidth+this.rightSpace}},{key:"drawBRY",get:function(){return this.drawerHeight}}]),a}(ai),Ii=function(t){r(s,t);var i=u(s);function s(t,n){var r;return e(this,s),(r=i.call(this,t,ji)).setSpaceWidth(n),r}return n(s,[{key:"width",get:function(){return this.spaceWidth*this.scaleX},set:function(t){this.spaceWidth>0?this.scaleX=t/this.spaceWidth:this.scaleX=1;}},{key:"setSpaceWidth",value:function(t){return this.spaceWidth=t,this}}]),s}(ai),Vi=function(t){var e=this.createSpaceChild(t);return this.addChild(e),this},zi=function(t){r(a,t);var i=u(a);function a(t,n,r,s,o){var u;return e(this,a),(u=i.call(this,t,Ri)).setName(n).setParameter(s).setCallback(r,o),u}return n(a,[{key:"setName",value:function(t){return this.name=t,this}},{key:"setParameter",value:function(t){return this.param=t,this}},{key:"setCallback",value:function(t,e){return this.callback=t,this.scope=e,this}},{key:"exec",value:function(){return this.scope?this.callback.call(this.scope,this.param,this.name):this.callback(this.param,this.name)}},{key:"onFree",value:function(){h(s(a.prototype),"onFree",this).call(this),this.setName().setCallback().setParameter();}}]),a}(Xe),Ni=function(t,e,i,n){var r=this.createCommandChild(t,e,i,n);return this.addChild(r),this},Ui=function e(i){var n,r,s;if(null==i||"object"!==t(i))return i;if(n=Array.isArray(i)?[]:{},function(e){if("object"!==t(e)||e.nodeType||e===e.window)return !1;try{if(e.constructor&&!{}.hasOwnProperty.call(e.constructor.prototype,"isPrototypeOf"))return !1}catch(t){return !1}return !0}(i))for(s in i)r=i[s],n[s]=e(r);else n=i;return n},Hi=function(t,e,i,n){void 0===n&&(n={word:[],width:0}),n.word.length=0;for(var r=t.length,s=e,a=n.word,o=0;s0&&!o){var u=this.fixedHeight-n;if(i>0)s=u/i;else s=(c=qi.call(this)).height,a=c.ascent,i=Math.floor((u-a)/s);}else {var c;s=(c=qi.call(this)).height,a=c.ascent;}}else if(this.fixedHeight>0){if(void 0===(i=Qi(t,"maxLines"))){u=this.fixedHeight-n;i=Math.floor(u/s);}}else i=Qi(t,"maxLines",0);void 0===a&&(a=s);var h=0===i,l=Qi(t,"wrapWidth",void 0);void 0===l&&(l=this.fixedWidth>0?this.fixedWidth-r:1/0);for(var f=Qi(t,"letterSpacing",0),d=Qi(t,"hAlign",0),g=Qi(t,"vAlign",0),p=Qi(t,"charWrap",!1),v={callback:"runWordWrap",start:e,isLastPage:!1,padding:this.wrapPadding,ascent:a,lineHeight:s,maxLines:i,wrapWidth:l,letterSpacing:f,hAlign:d,vAlign:g,charWrap:p,children:[],lines:[],maxLineWidth:0,linesHeight:0},y=this.children,m=0,k=y.length;m0&&(T.push({children:C,width:_}),j=Math.max(j,_)),v.start+=P.length,v.isLastPage=!R&&v.start===M,v.maxLineWidth=j,v.linesHeight=T.length*s;var F=this.fixedWidth>0?this.fixedWidth:v.maxLineWidth+r,X=this.fixedHeight>0?this.fixedHeight:v.linesHeight+n;!function(t,e,i){var n,r,s=t.hAlign,a=t.vAlign,o=t.linesHeight;switch(a){case 1:case"center":r=(i-o)/2;break;case 2:case"bottom":r=i-o;break;default:r=0;}for(var u=t.lines,c=0,h=u.length;c0?(a=this.fixedWidth-r)/i:0;else if(this.fixedWidth>0){if(void 0===(i=en(t,"maxLines",void 0))){var a=this.fixedWidth-r;i=Math.floor(a/s)+1;}}else i=en(t,"maxLines",0);var o=0===i,u=en(t,"fixedChildHeight",void 0);if(void 0===u){var c=en(t,"charPerLine",void 0);if(void 0!==c){var h=this.fixedHeight-n;u=Math.floor(h/c);}}var l=en(t,"wrapHeight",void 0);void 0===l&&(l=this.fixedHeight>0?this.fixedHeight-n:1/0);for(var f=en(t,"letterSpacing",0),d=en(t,"rtl",!0),g=en(t,"hAlign",d?2:0),p=en(t,"vAlign",0),v={callback:"runVerticalWrap",start:e,isLastPage:!1,padding:this.wrapPadding,lineWidth:s,maxLines:i,fixedChildHeight:u,wrapHeight:l,letterSpacing:f,hAlign:g,vAlign:p,rtl:d,children:[],lines:[],maxLineHeight:0,linesWidth:0},y=this.children,m=0,k=y.length;m0&&(T.push({children:C,height:_}),j=Math.max(j,_)),v.start+=P.length,v.isLastPage=v.start===M,v.maxLineHeight=j,v.linesWidth=T.length*s;var A=this.fixedWidth>0?this.fixedWidth:v.linesWidth+r,L=this.fixedHeight>0?this.fixedHeight:v.maxLineHeight+n;!function(t,e,i){var n,r,s=t.hAlign,a=t.vAlign,o=t.rtl,u=t.lines,c=t.lineWidth,h=t.linesWidth;switch(s){case 1:case"center":n=(e-h)/2;break;case 2:case"right":n=e-h;break;default:n=0;}o&&(n+=c);for(var l=0,f=u.length;l0?t:this.width,e>0?e:this.height),this):this},setPadding:function(t,e){var i=this.padding,n=i.left,r=i.right,s=i.top,a=i.bottom;return Le(i,t,e),this.dirty=this.dirty||n!=i.left||r!=i.right||s!=i.top||a!=i.bottom,this},getPadding:function(t){return function(t,e){return void 0===e?t:t[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),Mi(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 Pi(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,n,r,s=Array.isArray(t);void 0===e||e===this.children.length?s?(i=this.children).push.apply(i,p(t)):this.children.push(t):s?(n=this.children).splice.apply(n,[e,0].concat(p(t))):this.children.splice(e,0,t);(this.lastAppendedChildren.length=0,s)?(r=this.lastAppendedChildren).push.apply(r,p(t)):this.lastAppendedChildren.push(t);return this},createCharChild:function(t,e){e&&this.textStyle.modify(e);var i=this.poolManager.allocate(Ti);return null===i?i=new Ai(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=[],n=0,r=t.length;ne&&(n=e,r=t);})),r},getCharWorldPosition:function(t,e,i,n){return "number"==typeof t&&(t=this.getCharChild(t,!0)),ei(this,t,e,i,n)},setToMinSize:function(){for(var t=this.children,e=0,i=0,n=0,r=t.length;n=i.length&&(t=i.length);for(var n=0,r=0;r");this.setDelimiters(n[0],n[1]),this.setTranslateTagNameCallback(ye(i,"translateTagNameCallback")),this.isRunning=!1,this.isPaused=!1,this.skipEventFlag=!1,this.justCompleted=!1,this.lastTagStart=null,this.lastTagEnd=null,this.lastContent=null;}return n(t,[{key:"shutdown",value:function(){this.destroyEventEmitter();}},{key:"destroy",value:function(){this.shutdown();}},{key:"setMultipleLinesTagEnable",value:function(t){return void 0===t&&(t=!0),this.multipleLinesTagEnable=t,this}},{key:"setDelimiters",value:function(t,e){void 0===e&&(e=t[1],t=t[0]),this.delimiterLeft=t,this.delimiterRight=e,t=jn(this.delimiterLeft),e=jn(this.delimiterRight);var i=this.multipleLinesTagEnable?"gs":"gi";return this.reSplit=RegExp("".concat(t,"(.+?)").concat(e),i),this}},{key:"setTranslateTagNameCallback",value:function(t){return this.translateTagNameCallback=t,this}},{key:"setValueConverter",value:function(t){return !0===t?t=_n:t||(t=Dn),this.valueConverter=t,this}},{key:"setLoopEnable",value:function(t){return void 0===t&&(t=!0),this.loopEnable=t,this}},{key:"setSource",value:function(t){return this.source=t,this}},{key:"resetIndex",value:function(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}},{key:"start",value:function(t){return this.setSource(t).restart(),this}},{key:"restart",value:function(){this.resetIndex().next();}},{key:"next",value:function(){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");return n.setDelimiters(r[0],r[1]),n}return n(a,[{key:"setTagExpression",value:function(t){return t||(t=An),this.tagExpression=t,this}},{key:"setValueExpression",value:function(t){return t||(t=An),this.valueExpression=t,this}},{key:"setDelimiters",value:function(t,e){h(s(a.prototype),"setDelimiters",this).call(this,t,e);var i="(".concat(this.tagExpression,")(=(").concat(this.valueExpression,"))?");if(this.reTag=RegExp(i,"i"),this.tagExpression!==An||this.valueExpression!==An){var n="".concat(this.tagExpression,"(=").concat(this.valueExpression,")?"),r="/".concat(this.tagExpression);t=jn(this.delimiterLeft),e=jn(this.delimiterRight);var o=this.multipleLinesTagEnable?"gs":"gi";this.reSplit=RegExp("".concat(t,"((").concat(n,")|(").concat(r,"))").concat(e),o);}return this}},{key:"onTag",value:function(t){var e=t.match(this.reTag),i=e[1],n="/"===i.charAt(0);if(n&&(i=i.substring(1,i.length)),this.translateTagNameCallback&&(i=this.translateTagNameCallback(i)),this.skipEventFlag=!1,n)this.emit("-".concat(i)),this.skipEventFlag||this.emit("-",i),this.lastTagEnd=i;else {var r=function(t,e){if(null==t)return [];void 0===e&&(e=_n);for(var i=t.split(","),n=0,r=i.length;n1?r-1:0),a=1;a1&&-1!==e.indexOf("|")?e.split("|"):[e]).length;s0){var a=this.timeline.addTimer({name:Yr,target:r,duration:s.duration,yoyo:s.yoyo,onStart:s.onStart,onProgress:s.onProgress,onComplete:s.onComplete});this.skipTypingAnimation&&a.seek(1);}else s.onStart&&s.onStart(r,0);this.minSizeEnable&&this.textPlayer.setToMinSize(),this.textPlayer.emit("typing",r);var o=this.nextChild;if(o)if(this.skipSpaceEnable&&((i=o).type===Ti&&" "===i.text));else if(n+=this.speed+e,e=0,n>0){this.typingTimer=this.timeline.addTimer({name:"delay",target:this,duration:n,onComplete:function(e,i,n){e.typingTimer=void 0,t.call(e,n.remainder);}});break}}else Wi(r)&&r.exec();}this.minSizeEnable&&this.textPlayer.setToMinSize(),this.inTypingProcessLoop=!1;},pause:function(){return this.timeline.pause(),this},resume:function(){return this.timeline.resume(),this},pauseTyping:function(){return this.isTypingPaused||(this.typingTimer?(this.typingTimer.pause(),this.isTypingPaused=!0):this.inTypingProcessLoop&&(this.inTypingProcessLoop=!1,this.isTypingPaused=!0)),this},resumeTyping:function(t){return this.isTypingPaused?(void 0===t&&(t=0),this.typingTimer?(this.isTypingPaused=!1,this.typingTimer.resume(),this.typingTimer.remainder+=t):this.isTypingPaused&&(this.isTypingPaused=!1,this.typing(t)),this):this},wait:function(t){return this.ignoreWait||(this.pauseTyping(),Ur(this.textPlayer,t,this.resumeTyping,this)),this},setIgnoreWait:function(t){return void 0===t&&(t=!0),this.ignoreWait=t,this},setSkipSpaceEnable:function(t){return void 0===t&&(t=!0),this.skipSpaceEnable=t,this},setSkipTypingAnimation:function(t){if(void 0===t&&(t=!0),this.skipTypingAnimation=t,t)for(var e=this.timeline.getTimers(Yr),i=0,n=e.length;i0&&a.chainAnimation(i,n);},hs=function(t){var e,i,n=g(t);e=n[0],i=n.slice(1);var r=this.getGameObjectManager(e);r.stopAnimation.apply(r,p(i));},ls=function(t){var e,i,n=g(t);e=n[0],i=n.slice(1);var r=this.getGameObjectManager(e);r.pauseAnimation.apply(r,p(i));},fs=function(t){var e,i,n=g(t);e=n[0],i=n.slice(1);var r=this.getGameObjectManager(e);r.chainAnimation.apply(r,p(i));},ds=[function(t,e,i){var n=i.name;e.on("+",(function(i){if(!e.skipEventFlag){var r,s=i.split(".");if(us(s,n)){r=s[1];for(var a=arguments.length,o=new Array(a>1?a-1:0),u=1;u0)){var o=this.getGameObjectManager(e);o.hasMethod(i,n)?o.call.apply(o,[i,n].concat(p(r))):o.setProperty(i,n,r[0]);}},bs={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},ws=function(t){var e,i,n,r,s,a,o,u,c=d(t,8);e=c[0],i=c[1],n=c[2],r=c[3],s=c[4],a=c[5],o=c[6],u=c[7];var h=this.getGameObjectManager(e),l=h.getProperty(i,n);if("number"==typeof l){u.endsWith("Left")||u.endsWith("Up")?u.startsWith("to")||u.startsWith("yoyo")?r=l-r:u.startsWith("from")&&(h.setProperty(i,n,l-r),r=l):u.endsWith("Right")||u.endsWith("Down")?u.startsWith("to")||u.startsWith("yoyo")?r=l+r:u.startsWith("from")&&(h.setProperty(i,n,l+r),r=l):"from"===u&&(h.setProperty(i,n,r),r=l);var f=u.startsWith("yoyo");h.easeProperty(i,n,r,s,a,o,f);}},Ss=[function(t,e,i){var n=i.name;e.on("+",(function(i){if(!e.skipEventFlag){var r,s=i.split(".");if(ps(s,n)){r=s[1];for(var a=arguments.length,o=new Array(a>1?a-1:0),u=1;u1?o-1:0),c=1;ct.length)&&(e=t.length);for(var i=0,n=new Array(e);i1?i-1:0),r=1;r0&&void 0!==t.setTint},useAlphaFadeEffect:function(t){return (void 0===this.fadeMode||1===this.fadeMode)&&this.fadeTime>0&&void 0!==t.setAlpha},useRevealEffect:function(t){return this.fadeMode>=2&&this.fadeMode<=5&&this.fadeTime>0&&(t.preFX||t.postFX)},fadeBob:function(t,e,i,n){var r=t.gameObject;if(this.useTintFadeEffect(r))void 0!==e&&t.setProperty("tintGray",255*e),t.easeProperty("tintGray",Math.floor(255*i),this.fadeTime,"Linear",0,!1,n);else if(this.useAlphaFadeEffect(r))void 0!==e&&t.setProperty("alpha",e),t.easeProperty("alpha",i,this.fadeTime,"Linear",0,!1,n);else if(this.useRevealEffect(r)){var s;switch(j(r,"reveal"),this.fadeMode){case 2:s="revealUp";break;case 3:s="revealDown";break;case 4:s="revealLeft";break;case 5:s="revealRight";}void 0===e&&(e=0),r[s]=e,t.easeProperty(s,i,this.fadeTime,"Linear",0,!1,n),t.getTweenTask(s).once("complete",(function(){r[s]=null;}));}else n&&n(r);return this}},G=function(t){return t>>16&255},D=function(t){return t>>8&255},W=function(t){return 255&t},A=Phaser.Events.EventEmitter,L=function(t,e,i,n,r,s){return void 0===s?s={}:!0===s&&(s=F),"number"!=typeof i&&(i=0,n=0),s.x=r.x+r.width*t+i,s.y=r.y+r.height*e+n,s},F={},X=function(t,e,i,n,r,s,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===n&&(n=.5),void 0===r&&(r=0),void 0===s&&(s=0),void 0===a&&(a=L),function(t){if(t.events)return t;var e=new A,i=t.x;Object.defineProperty(t,"x",{get:function(){return i},set:function(n){i!==n&&(i=n,e.emit("update",t));}});var n=t.y;Object.defineProperty(t,"y",{get:function(){return n},set:function(i){n!==i&&(n=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 s=t.height;Object.defineProperty(t,"height",{get:function(){return s},set:function(i){s!==i&&(s=i,e.emit("update",t));}}),t.events=e;}(e);var o=e.events;t.vp=e;var u=function(){a(i,n,r,s,e,t);};o.on("update",u),t.once("destroy",(function(){o.off("update",u),t.vp=void 0;})),Object.defineProperty(t,"vpx",{get:function(){return i},set:function(t){i!==t&&(i=t,u());}}),Object.defineProperty(t,"vpy",{get:function(){return n},set:function(t){n!==t&&(n=t,u());}}),Object.defineProperty(t,"vpxOffset",{get:function(){return r},set:function(t){r!==t&&(r=t,u());}}),Object.defineProperty(t,"vpyOffset",{get:function(){return s},set:function(t){s!==t&&(s=t,u());}}),u();},Y=Phaser.Utils.Array.Remove,I={has:function(t){return this.bobs.hasOwnProperty(t)},exists:function(t){return this.bobs.hasOwnProperty(t)},get:function(t){return this.bobs[t]},getGO:function(t){var e=this.get(t);return e?e.gameObject:null},addGO:function(t,e){this.remove(t,!0),this.useTintFadeEffect(e)&&function(t,e){if(t.hasOwnProperty("tintR"))return t;void 0===e&&(e=16777215);var i=G(e),n=D(e),r=W(e);Object.defineProperty(t,"tint",{get:function(){return e},set:function(s){s=16777215&Math.floor(s),t.setTint&&t.setTint(s),e!==s&&(i=G(e=s),n=D(e),r=W(e));}}),Object.defineProperty(t,"tintR",{get:function(){return i},set:function(n){n=255&Math.floor(n),i!==n&&(i=n,t.tint=(255&n)<<16|65535&e);}}),Object.defineProperty(t,"tintG",{get:function(){return n},set:function(i){i=255&Math.floor(i),n!==i&&(n=i,t.tint=(255&i)<<8|16711935&e);}}),Object.defineProperty(t,"tintB",{get:function(){return r},set:function(i){i=255&Math.floor(i),r!==i&&(r=i,t.tint=255&i|16776960&e);}}),Object.defineProperty(t,"tintGray",{get:function(){return Math.floor((i+n+r)/3)},set:function(e){e=255&Math.floor(e),i===e&&n===e&&r===e||(i=e,n=e,r=e,t.tint=(255&e)<<16|(255&e)<<8|255&e);}}),t.tint=e;}(e),this.viewportCoordinateEnable&&X(e,this.viewport),this.effectPropertiesConfig&&j(e,this.effectPropertiesConfig),e.once("destroy",(function(){Y(this.removedGOs,e),this.isEmpty&&this.emit("empty");}),this);var i=new this.BobClass(this,e,t);return this.bobs[t]=i,this},add:function(t){for(var e=this.createGameObjectCallback,i=this.createGameObjectScope,n=arguments.length,r=new Array(n>1?n-1:0),s=1;s2?n-2:0),s=2;s0?-this.delay:0,this.state=this.nowTime>=0?_t:Ct,this.repeatCounter=0,this}},{key:"stop",value:function(){return this.state=Tt,this}},{key:"update",value:function(t,e){this.state!==Tt&&this.state!==Rt&&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=jt)):(this.nowTime=this.duration,this.state=Rt):this.nowTime>=0&&(this.state=_t));}},{key:"t",get:function(){var t;switch(this.state){case Tt:case Ct:case jt:t=0;break;case _t:t=this.nowTime/this.duration;break;case Rt:t=1;}return Mt(t,0,1)},set:function(t){(t=Mt(t,-1,1))<0?(this.state=Ct,this.nowTime=-this.delay*t):(this.state=_t,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++);}},{key:"setT",value:function(t){return this.t=t,this}},{key:"isIdle",get:function(){return this.state===Tt}},{key:"isDelay",get:function(){return this.state===Ct}},{key:"isCountDown",get:function(){return this.state===_t}},{key:"isRunning",get:function(){return this.state===Ct||this.state===_t}},{key:"isDone",get:function(){return this.state===Rt}},{key:"isOddIteration",get:function(){return 1==(1&this.repeatCounter)}},{key:"isEvenIteration",get:function(){return 0==(1&this.repeatCounter)}}]),t}(),Tt=0,Ct=1,_t=2,jt=3,Rt=-1,Bt=function(t){r(a,t);var i=u(a);function a(t,n){var r;return e(this,a),(r=i.call(this,t,n)).timer=new Pt,r}return n(a,[{key:"shutdown",value:function(t){this.isShutdown||(h(s(a.prototype),"shutdown",this).call(this,t),this.timer.destroy(),this.timer=void 0);}},{key:"start",value:function(){return this.timer.start(),h(s(a.prototype),"start",this).call(this),this}},{key:"stop",value:function(){return this.timer.stop(),h(s(a.prototype),"stop",this).call(this),this}},{key:"complete",value:function(){return this.timer.stop(),h(s(a.prototype),"complete",this).call(this),this}}]),a}(Et),Gt=Phaser.Utils.Objects.GetValue,Dt=Phaser.Utils.Objects.GetAdvancedValue,Wt=Phaser.Tweens.Builders.GetEaseFunction,At=function(t){r(a,t);var i=u(a);function a(){return e(this,a),i.apply(this,arguments)}return n(a,[{key:"resetFromJSON",value:function(t){return this.timer.resetFromJSON(Gt(t,"timer")),this.setEnable(Gt(t,"enable",!0)),this.setTarget(Gt(t,"target",this.parent)),this.setDelay(Dt(t,"delay",0)),this.setDuration(Dt(t,"duration",1e3)),this.setEase(Gt(t,"ease","Linear")),this.setRepeat(Gt(t,"repeat",0)),this}},{key:"setEnable",value:function(t){return null==t&&(t=!0),this.enable=t,this}},{key:"setTarget",value:function(t){return void 0===t&&(t=this.parent),this.target=t,this}},{key:"setDelay",value:function(t){return this.delay=t,this}},{key:"setDuration",value:function(t){return this.duration=t,this}},{key:"setRepeat",value:function(t){return this.repeat=t,this}},{key:"setRepeatDelay",value:function(t){return this.repeatDelay=t,this}},{key:"setEase",value:function(t){return void 0===t&&(t="Linear"),this.ease=t,this.easeFn=Wt(t),this}},{key:"start",value:function(){return this.timer.isRunning||h(s(a.prototype),"start",this).call(this),this}},{key:"restart",value:function(){return this.timer.stop(),this.start.apply(this,arguments),this}},{key:"stop",value:function(t){return void 0===t&&(t=!1),h(s(a.prototype),"stop",this).call(this),t&&(this.timer.setT(1),this.updateGameObject(this.target,this.timer),this.complete()),this}},{key:"update",value:function(t,e){if(!this.isRunning||!this.enable||!this.parent.active)return this;var i=this.target,n=this.timer;return n.update(t,e),n.isDelay||this.updateGameObject(i,n),this.emit("update",i,this),n.isDone&&this.complete(),this}},{key:"updateGameObject",value:function(t,e){}}]),a}(Bt),Lt=Phaser.Sound.BaseSound,Ft=function(t){return t instanceof Lt},Xt=Phaser.Utils.Objects.GetValue,Yt=Phaser.Utils.Objects.GetAdvancedValue,It=Phaser.Math.Linear,Vt=function(t){r(a,t);var i=u(a);function a(t,n,r){var s;return e(this,a),Ft(t)&&(r=n,n=t,t=void 0),n.active=!0,n.scene=t,n.game=n.manager.game,(s=i.call(this,n,r)).volume={},s.resetFromJSON(r),s}return n(a,[{key:"resetFromJSON",value:function(t){return h(s(a.prototype),"resetFromJSON",this).call(this,t),this.setMode(Xt(t,"mode",0)),this.setEnable(Xt(t,"enable",!0)),this.setVolumeRange(Yt(t,"volume.start",this.parent.volume),Yt(t,"volume.end",0)),this}},{key:"setMode",value:function(t){return "string"==typeof t&&(t=zt[t]),this.mode=t,this}},{key:"setVolumeRange",value:function(t,e){return this.volume.start=t,this.volume.end=e,this}},{key:"start",value:function(){return this.timer.isRunning||(this.parent.setVolume(this.volume.start),this.timer.setDelay(this.delay).setDuration(this.duration),h(s(a.prototype),"start",this).call(this)),this}},{key:"updateGameObject",value:function(t,e){t.volume=It(this.volume.start,this.volume.end,e.t);}},{key:"complete",value:function(){switch(h(s(a.prototype),"complete",this).call(this),this.mode){case 1:this.parent.stop();break;case 2:this.parent.destroy();}return this}}]),a}(At),zt={stop:1,destroy:2},Nt=function(t,e,i,n,r){Ft(t)&&(r=n,n=i,i=e,e=t,t=void 0),void 0===n&&(n=1),void 0===r&&(r=0);var s,a={mode:0,volume:{start:r,end:n},duration:i};return "string"==typeof e&&(e=t.sys.sound.add(e)),e.hasOwnProperty("_fade")?(s=e._fade).stop().resetFromJSON(a):(s=new Vt(t,e,a),e._fade=s),s.start(),e.isPlaying||e.setVolume(r).play(),e},Ut=function(t,e,i,n){Ft(t)&&(n=i,i=e,e=t,t=void 0),void 0===n&&(n=!0);var r,s={mode:n?2:1,volume:{start:e.volume,end:0},duration:i};return e.hasOwnProperty("_fade")?(r=e._fade).stop().resetFromJSON(s):(r=new Vt(t,e,s),e._fade=r),r.start(),e.isPlaying||e.play(),e},Ht=Phaser.Utils.Objects.GetValue,Jt={setBackgroundMusicLoop:function(t){return void 0===t&&(t=!0),this.backgroundMusicLoop=t,this},setBackgroundMusicFadeTime:function(t){return this.backgroundMusicFadeTime=t,this},getBackgroundMusic:function(){return this.backgroundMusic},setCurrentBackgroundMusic:function(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:function(t,e){if(this.backgroundMusic&&this.backgroundMusic.key===t)return this;this.stopBackgroundMusic();var i=this.sound.add(t,{loop:Ht(e,"loop",this.backgroundMusicLoop),mute:Ht(e,"mute",this.backgroundMusicMute),volume:Ht(e,"volume",this.backgroundMusicVolume),detune:Ht(e,"detune",0),rate:Ht(e,"rate",1)});return this.setCurrentBackgroundMusic(i),this.backgroundMusicFadeTime>0&&this.fadeInBackgroundMusic(this.backgroundMusicFadeTime),this},pauseBackgroundMusic:function(){return this.backgroundMusic&&this.backgroundMusic.pause(),this},resumeBackgroundMusic:function(){return this.backgroundMusic&&this.backgroundMusic.resume(),this},stopBackgroundMusic:function(){return this.backgroundMusic&&(this.backgroundMusicFadeTime>0?this.fadeOutBackgroundMusic(this.backgroundMusicFadeTime,!0):(this.backgroundMusic.stop(),this.backgroundMusic.destroy(),this.backgroundMusic=void 0)),this},fadeInBackgroundMusic:function(t){return this.backgroundMusic&&Nt(this.backgroundMusic,t,this.backgroundMusicVolume,0),this},fadeOutBackgroundMusic:function(t,e){return this.backgroundMusic&&Ut(this.backgroundMusic,t,e),this},crossFadeBackgroundMusic:function(t,e){var i=this.backgroundMusicFadeTime;return this.backgroundMusicFadeTime=0,this.fadeOutBackgroundMusic(e,!0).playBackgroundMusic(t).fadeInBackgroundMusic(e),this.backgroundMusicFadeTime=i,this},setBackgroundMusicMute:function(t){return void 0===t&&(t=!0),this.backgroundMusicMute=t,this},setBackgroundMusicVolume:function(t){return this.backgroundMusicVolume=t,this},setBackgroundMusicRate:function(t){return this.backgroundMusic&&this.backgroundMusic.setRate(t),this},setBackgroundMusicDetune:function(t){return this.backgroundMusic&&this.backgroundMusic.setDetune(t),this}},Kt=Phaser.Utils.Objects.GetValue,qt={setBackgroundMusic2Loop:function(t){return void 0===t&&(t=!0),this.backgroundMusic2Loop=t,this},setBackgroundMusic2FadeTime:function(t){return this.backgroundMusic2FadeTime=t,this},getBackgroundMusic2:function(){return this.backgroundMusic2},setCurrentBackgroundMusic2:function(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:function(t,e){if(this.backgroundMusic2&&this.backgroundMusic2.key===t)return this;this.stopBackgroundMusic2();var i=this.sound.add(t,{loop:Kt(e,"loop",this.backgroundMusicLoop),mute:Kt(e,"mute",this.backgroundMusic2Mute),volume:Kt(e,"volume",this.backgroundMusic2Volume),detune:Kt(e,"detune",0),rate:Kt(e,"rate",1)});return this.setCurrentBackgroundMusic2(i),this.backgroundMusic2FadeTime>0&&this.fadeInBackgroundMusic2(this.backgroundMusic2FadeTime),this},pauseBackgroundMusic2:function(){return this.backgroundMusic2&&this.backgroundMusic2.pause(),this},resumeBackgroundMusic2:function(){return this.backgroundMusic2&&this.backgroundMusic2.resume(),this},stopBackgroundMusic2:function(){return this.backgroundMusic2&&(this.backgroundMusic2FadeTime>0?this.fadeOutBackgroundMusic2(this.backgroundMusic2FadeTime,!0):(this.backgroundMusic2.stop(),this.backgroundMusic2.destroy(),this.backgroundMusic2=void 0)),this},fadeInBackgroundMusic2:function(t){return this.backgroundMusic2&&Nt(this.backgroundMusic2,t,this.backgroundMusic2Volume,0),this},fadeOutBackgroundMusic2:function(t,e){return this.backgroundMusic2&&Ut(this.backgroundMusic2,t,e),this},crossFadeBackgroundMusic2:function(t,e){var i=this.backgroundMusic2FadeTime;return this.backgroundMusic2FadeTime=0,this.fadeOutBackgroundMusic2(e,!0).playBackgroundMusic2(t).fadeInBackgroundMusic2(e),this.backgroundMusic2FadeTime=i,this},setBackgroundMusic2Mute:function(t){return void 0===t&&(t=!0),this.backgroundMusic2Mute=t,this},setBackgroundMusic2Volume:function(t){return this.backgroundMusic2Volume=t,this},setBackgroundMusic2Rate:function(t){return this.backgroundMusic2&&this.backgroundMusic2.setRate(t),this},setBackgroundMusic2Detune:function(t){return this.backgroundMusic2&&this.backgroundMusic2.setDetune(t),this}},$t=Phaser.Utils.Array.Remove,Qt=Phaser.Utils.Objects.GetValue,Zt={getSoundEffects:function(){return this.soundEffects},getLastSoundEffect:function(){return this.soundEffects[this.soundEffects.length-1]},playSoundEffect:function(t,e){var i=this.sound.add(t,{mute:Qt(e,"mute",this.soundEffectsMute),volume:Qt(e,"volume",this.soundEffectsVolume),detune:Qt(e,"detune",0),rate:Qt(e,"rate",1)});return this.soundEffects.push(i),i.once("complete",(function(){i.destroy(),this.sound&&$t(this.soundEffects,i);}),this).once("destroy",(function(){this.sound&&$t(this.soundEffects,i);}),this).play(),this},stopAllSoundEffects:function(){for(var t=this.soundEffects.length-1;t>=0;t--){var e=this.soundEffects[t];e.stop(),e.destroy();}return this},fadeInSoundEffect:function(t){var e=this.getLastSoundEffect();return e&&Nt(e,t,this.soundEffectsVolume,0),this},fadeOutSoundEffect:function(t,e){var i=this.getLastSoundEffect();return i&&Ut(i,t,e),this},fadeOutAllSoundEffects:function(t,e){for(var i=this.soundEffects.length-1;i>=0;i--)Ut(this.soundEffects[i],t,e);return this},setSoundEffectMute:function(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:function(t,e){if(void 0===e&&(e=!1),e){var i=this.getLastSoundEffect();i&&i.setVolume(t);}else this.soundEffectsVolume=t;return this},setSoundEffectDetune:function(t,e){var i;void 0===e&&(e=!1);for(var n=0,r=(i=e?[this.getLastSoundEffect()]:this.soundEffects).length;n=0;t--){var e=this.soundEffects[t];e.stop(),e.destroy();}return this},fadeInSoundEffect2:function(t){var e=this.getLastSoundEffect2();return e&&Nt(e,t,this.soundEffects2Volume,0),this},fadeOutSoundEffect2:function(t,e){var i=this.getLastSoundEffect2();return i&&Ut(i,t,e),this},fadeOutAllSoundEffects2:function(t,e){for(var i=this.soundEffects2.length-1;i>=0;i--)Ut(this.soundEffects2[i],t,e);return this},setSoundEffect2Mute:function(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:function(t,e){if(void 0===e&&(e=!1),e){var i=this.getLastSoundEffect2();i&&i.setVolume(t);}else this.soundEffects2Volume=t;return this},setSoundEffect2Detune:function(t,e){var i;void 0===e&&(e=!1);for(var n=0,r=(i=e?[this.getLastSoundEffect2()]:this.soundEffects2).length;n=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}},{key:"backgroundMusicMute",get:function(){return this._backgroundMusicMute},set:function(t){this._backgroundMusicMute=t,this.backgroundMusic&&this.backgroundMusic.setMute(mute);}},{key:"backgroundMusicVolume",get:function(){return this._backgroundMusicVolume},set:function(t){this._backgroundMusicVolume=t,this.backgroundMusic&&this.backgroundMusic.setVolume(t);}},{key:"backgroundMusic2Mute",get:function(){return this._backgroundMusic2Mute},set:function(t){this._backgroundMusic2Mute=t,this.backgroundMusic2&&this.backgroundMusic2.setMute(mute);}},{key:"backgroundMusic2Volume",get:function(){return this._backgroundMusic2Volume},set:function(t){this._backgroundMusic2Volume=t,this.backgroundMusic2&&this.backgroundMusic2.setVolume(t);}},{key:"soundEffectsMute",get:function(){return this._soundEffectsMute},set:function(t){this._soundEffectsMute=t;for(var e=this.soundEffects,i=0,n=e.length;i0?this.items.pop():null}},{key:"push",value:function(t){return this.items.push(t),this}},{key:"pushMultiple",value:function(t){return this.items.push.apply(this.items,t),t.length=0,this}},{key:"clear",value:function(){return this.items.length=0,this}}]),t}(),le=function(t){r(s,t);var i=u(s);function s(){return e(this,s),i.apply(this,arguments)}return n(s,[{key:"allocate",value:function(){return this.pop()}},{key:"free",value:function(t){t.onFree(),this.push(t);}},{key:"freeMultiple",value:function(t){for(var e=0,i=t.length;e2?n-2:0),s=2;s3?r-3:0),a=3;a0}},{key:"drawX",get:function(){var t=this.x+this.leftSpace+this.offsetX-this.originX*this.width;return this.parent._textOX*this.scrollFactorX+t}},{key:"drawY",get:function(){var t=this.y+this.offsetY;return this.parent._textOY*this.scrollFactorY+t}},{key:"drawTLX",get:function(){return 0}},{key:"drawTLY",get:function(){return 0}},{key:"drawBLX",get:function(){return 0}},{key:"drawBLY",get:function(){return 0}},{key:"drawTRX",get:function(){return 0}},{key:"drawTRY",get:function(){return 0}},{key:"drawBRX",get:function(){return 0}},{key:"drawBRY",get:function(){return 0}},{key:"drawCenterX",get:function(){return (this.drawTRX+this.drawTLX)/2}},{key:"drawCenterY",get:function(){return (this.drawBLY+this.drawTLY)/2}}]),s}(Xe);Object.assign(ai.prototype,ii);var oi=Phaser.Utils.String.Pad,ui=function(e,i,n){if(null==e)return e;switch(t(e)){case"string":default:return e;case"number":return "#".concat(oi(Math.floor(e).toString(16),6,"0",1));case"function":return e(i,n);case"object":return e.hasOwnProperty("r")?e.hasOwnProperty("a")?"rgba(".concat(e.r,",").concat(e.g,",").concat(e.b,",").concat(e.a,")"):"rgb(".concat(e.r,",").concat(e.g,",").concat(e.b,")"):e.hasOwnProperty("h")?e.hasOwnProperty("a")?"hsla(".concat(e.h,",").concat(e.s,",").concat(e.l,",").concat(e.a,")"):"hsl(".concat(e.h,",").concat(e.s,",").concat(e.l,")"):e}},ci=function(t,e,i){return e.hasOwnProperty(t)?e[t]:i[t]},hi=Phaser.Utils.Objects.GetValue,li=function(){function t(i,n,r,s,a){e(this,t),void 0===i&&(i=0),void 0===n&&(n=i),void 0===r&&(r=0),void 0===s&&(s=0),void 0===a&&(a=0),this.cornerRadius={},this._width=0,this._height=0,this.setTo(i,n,r,s,a);}return n(t,[{key:"setTo",value:function(t,e,i,n,r){return this.setPosition(t,e),this.setRadius(r),this.setSize(i,n),this}},{key:"setPosition",value:function(t,e){return this.x=t,this.y=e,this}},{key:"setRadius",value:function(t){return void 0===t&&(t=0),this.radius=t,this}},{key:"setSize",value:function(t,e){return this.width=t,this.height=e,this}},{key:"minWidth",get:function(){var t=this.cornerRadius;return Math.max(t.tl.x+t.tr.x,t.bl.x+t.br.x)}},{key:"minHeight",get:function(){var t=this.cornerRadius;return Math.max(t.tl.y+t.bl.y,t.tr.y+t.br.y)}},{key:"width",get:function(){return this._width},set:function(t){null==t&&(t=0),this._width=Math.max(t,this.minWidth);}},{key:"height",get:function(){return this._height},set:function(t){null==t&&(t=0),this._height=Math.max(t,this.minHeight);}},{key:"radius",get:function(){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:function(t){var e,i;"number"==typeof t?(e=t,i=t):(e=hi(t,"x",0),i=hi(t,"y",0));var n=this.cornerRadius;n.tl=fi(hi(t,"tl",void 0),e,i),n.tr=fi(hi(t,"tr",void 0),e,i),n.bl=fi(hi(t,"bl",void 0),e,i),n.br=fi(hi(t,"br",void 0),e,i);}},{key:"radiusTL",get:function(){var t=this.cornerRadius.tl;return Math.max(t.x,t.y)},set:function(t){di(this.cornerRadius.tl,t);}},{key:"radiusTR",get:function(){var t=this.cornerRadius.tr;return Math.max(t.x,t.y)},set:function(t){di(this.cornerRadius.tr,t);}},{key:"radiusBL",get:function(){var t=this.cornerRadius.bl;return Math.max(t.x,t.y)},set:function(t){di(this.cornerRadius.bl,t);}},{key:"radiusBR",get:function(){var t=this.cornerRadius.br;return Math.max(t.x,t.y)},set:function(t){di(this.cornerRadius.br,t);}}]),t}(),fi=function(t,e,i){return void 0===t?t={x:e,y:i}:"number"==typeof t&&(t={x:t,y:t}),gi(t),t},di=function(t,e){"number"==typeof e?(t.x=e,t.y=e):(t.x=hi(e,"x",0),t.y=hi(e,"y",0)),gi(t);},gi=function(t){t.convex=t.x>=0||t.y>=0,t.x=Math.abs(t.x),t.y=Math.abs(t.y);},pi=Phaser.Math.DegToRad,vi=function(t){return !t.hasOwnProperty("convex")||t.convex},yi=function(t){return t.x>0&&t.y>0},mi=function(t,e,i,n,r,s,a,o,u){if(o&&a>s?a-=360:!o&&a=d?1:n/d,v=r>=g?1:r/g,y=f.cornerRadius;t.save(),t.beginPath(),t.translate(e,i),o=y.tl,yi(o)?(u=o.x*p,c=o.y*v,vi(o)?mi(t,u,c,u,c,180,270,!1,a):mi(t,0,0,u,c,90,0,!0,a),h=0,l=c):(t.lineTo(0,0),h=0,l=0),o=y.tr,yi(o)?(u=o.x*p,c=o.y*v,vi(o)?mi(t,n-u,c,u,c,270,360,!1,a):mi(t,n,0,u,c,180,90,!0,a)):t.lineTo(n,0),o=y.br,yi(o)?(u=o.x*p,c=o.y*v,vi(o)?mi(t,n-u,r-c,u,c,0,90,!1,a):mi(t,n,r,u,c,270,180,!0,a)):t.lineTo(n,r),o=y.bl,yi(o)?(u=o.x*p,c=o.y*v,vi(o)?mi(t,u,r-c,u,c,90,180,!1,a):mi(t,0,r,u,c,360,270,!0,a)):t.lineTo(0,r),t.lineTo(h,l),t.closePath(),t.restore();}(e,i,n,r,s,a,f),null!=o){var d;if(null!=h)(d=l?e.createLinearGradient(0,0,r,0):e.createLinearGradient(0,0,0,s)).addColorStop(0,o),d.addColorStop(1,h),o=d;e.fillStyle=o,e.fill();}null!=u&&c>0&&(e.strokeStyle=u,e.lineWidth=c,e.stroke());},bi=Phaser.Utils.Objects.GetValue,wi=function(t){r(a,t);var i=u(a);function a(t,n){var r;return e(this,a),(r=i.call(this,t,"background")).setScrollFactor(0),r.setColor(bi(n,"color",null),bi(n,"color2",null),bi(n,"horizontalGradient",!0)),r.setStroke(bi(n,"stroke",null),bi(n,"strokeThickness",2)),r.setCornerRadius(bi(n,"cornerRadius",0),bi(n,"cornerIteration",null)),r}return n(a,[{key:"color",get:function(){return this._color},set:function(t){t=ui(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t;}},{key:"color2",get:function(){return this._color2},set:function(t){t=ui(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t;}},{key:"horizontalGradient",get:function(){return this._horizontalGradient},set:function(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t;}},{key:"setColor",value:function(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}},{key:"stroke",get:function(){return this._stroke},set:function(t){t=ui(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t;}},{key:"strokeThickness",get:function(){return this._strokeThickness},set:function(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t;}},{key:"setStroke",value:function(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}},{key:"cornerRadius",get:function(){return this._cornerRadius},set:function(t){this.setDirty(this._cornerRadius!=t),this._cornerRadius=t;}},{key:"cornerIteration",get:function(){return this._cornerIteration},set:function(t){this.setDirty(this._cornerIteration!=t),this._cornerIteration=t;}},{key:"modifyStyle",value:function(t){return t.hasOwnProperty("color")&&this.setColor(t.color,ci("color2",t,this),ci("horizontalGradient",t,this)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,ci("strokeThickness",t,this)),t.hasOwnProperty("cornerRadius")&&this.setCornerRadius(t.cornerRadius,ci("cornerIteration",t,this)),this}},{key:"modifyPorperties",value:function(t){return h(s(a.prototype),"modifyPorperties",this).call(this,t),this.modifyStyle(t),this}},{key:"setCornerRadius",value:function(t,e){return this.cornerRadius=t,this.cornerIteration=e,this}},{key:"renderContent",value:function(){!function(t,e,i,n,r,s,a,o){if(null!=e||null!=i){var u=t.canvas.width,c=t.canvas.height;null==i&&(n=0);var h=n/2;u=Math.max(1,u-n),c=Math.max(1,c-n),ki(t.canvas,t.context,h,h,u,c,r,e,i,n,s,a,o);}}(this.parent,this.color,this.stroke,this.strokeThickness,this.cornerRadius,this.color2,this.horizontalGradient,this.cornerIteration);}}]),a}(ai),Si=Phaser.Utils.Objects.GetValue,Ei=function(t){r(a,t);var i=u(a);function a(t,n){var r;return e(this,a),(r=i.call(this,t,"innerbounds")).setScrollFactor(0),r.setColor(Si(n,"color",null),Si(n,"color2",null),Si(n,"horizontalGradient",!0)),r.setStroke(Si(n,"stroke",null),Si(n,"strokeThickness",2)),r}return n(a,[{key:"color",get:function(){return this._color},set:function(t){t=ui(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t;}},{key:"color2",get:function(){return this._color2},set:function(t){t=ui(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t;}},{key:"horizontalGradient",get:function(){return this._horizontalGradient},set:function(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t;}},{key:"setColor",value:function(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}},{key:"stroke",get:function(){return this._stroke},set:function(t){t=ui(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t;}},{key:"strokeThickness",get:function(){return this._strokeThickness},set:function(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t;}},{key:"setStroke",value:function(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}},{key:"modifyPorperties",value:function(t){h(s(a.prototype),"modifyPorperties",this).call(this,t),t.hasOwnProperty("color")&&this.setColor(t.color,Si(t,"color2",null),Si(t,"horizontalGradient",!0)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,Si(t,"strokeThickness",2));}},{key:"renderContent",value:function(){var t=this.parent.padding,e=t.left,i=t.top,n=this.parent.width-t.left-t.right,r=this.parent.height-t.top-t.bottom,s=this.context;if(null!=this.color){var a,o;if(null!=this.color2)(o=this.horizontalGradient?s.createLinearGradient(0,0,n,0):s.createLinearGradient(0,0,0,r)).addColorStop(0,this.color),o.addColorStop(1,this.color2),a=o;else a=this.color;s.fillStyle=a,s.fillRect(e,i,n,r);}null!=this.stroke&&this.strokeThickness>0&&(s.strokeStyle=this.stroke,s.lineWidth=this.strokeThickness,s.strokeRect(e,i,n,r));}}]),a}(ai),Oi=Phaser.Utils.Objects.GetValue,xi=function(){function t(i,n){e(this,t),this.parent=i,this.set(n);}return n(t,[{key:"toJSON",value:function(){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}}},{key:"set",value:function(t){return this.setBold(Oi(t,"bold",!1)),this.setItalic(Oi(t,"italic",!1)),this.setFontSize(Oi(t,"fontSize","16px")),this.setFontFamily(Oi(t,"fontFamily","Courier")),this.setColor(Oi(t,"color","#fff")),this.setStrokeStyle(Oi(t,"stroke",null),Oi(t,"strokeThickness",0)),this.setShadow(Oi(t,"shadowColor",null),Oi(t,"shadowOffsetX",0),Oi(t,"shadowOffsetY",0),Oi(t,"shadowBlur",0)),this.setOffset(Oi(t,"offsetX",0),Oi(t,"offsetY",0)),this.setSpace(Oi(t,"leftSpace",0),Oi(t,"rightSpace",0)),this.setAlign(Oi(t,"align",void 0)),this.setBackgroundColor(Oi(t,"backgroundColor",null)),this.setBackgroundHeight(Oi(t,"backgroundHeight",void 0)),this.setBackgroundBottomY(Oi(t,"backgroundBottomY",void 0)),this}},{key:"modify",value:function(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(ci("stroke",t,this),ci("strokeThickness",t,this)),t.hasOwnProperty("shadowColor")&&this.setShadowColor(t.shadowColor),(t.hasOwnProperty("shadowOffsetX")||t.hasOwnProperty("shadowOffsetY"))&&this.setShadowOffset(ci("shadowOffsetX",t,this),ci("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}},{key:"setUpdateTextFlag",value:function(){return this.parent&&(this.parent.updateTextFlag=!0),this}},{key:"clone",value:function(){return new t(null,this.toJSON())}},{key:"copyFrom",value:function(t){return this.set(t.toJSON()),this}},{key:"copyTo",value:function(t){return t.set(this.toJSON()),this}},{key:"setBold",value:function(t){return void 0===t&&(t=!0),this.bold=t,this.setUpdateTextFlag(),this}},{key:"setItalic",value:function(t){return void 0===t&&(t=!0),this.italic=t,this.setUpdateTextFlag(),this}},{key:"fontStyle",get:function(){return this.bold&&this.italic?"bold italic":this.bold?"bold":this.italic?"italic":""}},{key:"setFontSize",value:function(t){return "number"==typeof t&&(t="".concat(t,"px")),this.fontSize=t,this.setUpdateTextFlag(),this}},{key:"setFontFamily",value:function(t){return this.fontFamily=t,this.setUpdateTextFlag(),this}},{key:"font",get:function(){return "".concat(this.fontStyle," ").concat(this.fontSize," ").concat(this.fontFamily)}},{key:"setColor",value:function(t){return this.color=ui(t),this}},{key:"hasFill",get:function(){return null!=this.color}},{key:"setStrokeStyle",value:function(t,e){return this.stroke=ui(t),void 0!==e&&(this.strokeThickness=e),this}},{key:"setStrokeThickness",value:function(t){return this.strokeThickness=t,this}},{key:"hasStroke",get:function(){return null!=this.stroke&&this.strokeThickness>0}},{key:"setShadowColor",value:function(t){return this.shadowColor=ui(t),this}},{key:"setShadowOffset",value:function(t,e){return void 0===t&&(t=0),void 0===e&&(e=0),this.shadowOffsetX=t,this.shadowOffsetY=e,this}},{key:"setShadowBlur",value:function(t){return void 0===t&&(t=0),this.shaodwBlur=t,this}},{key:"setShadow",value:function(t,e,i,n){return this.setShadowColor(t).setShadowOffset(e,i).setShadowBlur(n),this}},{key:"setBackgroundColor",value:function(t){return this.backgroundColor=ui(t),this}},{key:"hasBackgroundColor",get:function(){return null!=this.backgroundColor}},{key:"setBackgroundHeight",value:function(t){return this.backgroundHeight=t,this}},{key:"setBackgroundBottomY",value:function(t){return this.backgroundBottomY=t,this}},{key:"setOffsetX",value:function(t){return void 0===t&&(t=0),this.offsetX=t,this}},{key:"setOffsetY",value:function(t){return void 0===t&&(t=0),this.offsetY=t,this}},{key:"setOffset",value:function(t,e){return this.setOffsetX(t).setOffsetY(e),this}},{key:"setLeftSpace",value:function(t){return void 0===t&&(t=0),this.leftSpace=t,this}},{key:"setRightSpace",value:function(t){return void 0===t&&(t=0),this.rightSpace=t,this}},{key:"setSpace",value:function(t,e){return this.setLeftSpace(t).setRightSpace(e),this}},{key:"setAlign",value:function(t){return this.align=t,this}},{key:"syncFont",value:function(t){return t.font=this.font,this}},{key:"syncStyle",value:function(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}},{key:"syncShadow",value:function(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);}},{key:"getTextMetrics",value:function(t,e){return this.syncFont(t).syncStyle(t),t.measureText(e)}}]),t}(),Mi=Phaser.Utils.Array.Remove,Pi=Phaser.Utils.Array.Remove,Ti="text",Ci="image",_i="drawer",ji="space",Ri="command",Bi=function(t){return t.type===Ti&&"\n"===t.text},Gi=function(t){return t.type===Ti&&"\f"===t.text},Di=function(t){return t.type===Ti},Wi=function(t){return t.type===Ri},Ai=function(t){r(a,t);var i=u(a);function a(t,n,r){var s;return e(this,a),(s=i.call(this,t,Ti)).updateTextFlag=!1,s.style=new xi(o(s),r),s.setText(n),s}return n(a,[{key:"autoRound",get:function(){return this.parent.autoRound}},{key:"offsetX",get:function(){return this.style.offsetX},set:function(t){this.style&&(this.style.offsetX=t);}},{key:"offsetY",get:function(){return this.style.offsetY},set:function(t){this.style&&(this.style.offsetY=t);}},{key:"leftSpace",get:function(){return this.style.leftSpace*this.scaleX},set:function(t){this.style&&(this.style.leftSpace=t),f(s(a.prototype),"leftSpace",t,this,!0);}},{key:"rightSpace",get:function(){return this.style.rightSpace*this.scaleX},set:function(t){this.style&&(this.style.rightSpace=t),f(s(a.prototype),"rightSpace",t,this,!0);}},{key:"align",get:function(){return this.style.align},set:function(t){this.style&&(this.style.align=t);}},{key:"modifyStyle",value:function(t){return this.setDirty(!0),this.style.modify(t),this.updateTextFlag&&this.updateTextSize(),this}},{key:"modifyPorperties",value:function(t){return t?(this.modifyStyle(t),h(s(a.prototype),"modifyPorperties",this).call(this,t),this):this}},{key:"setText",value:function(t){return this.setDirty(this.text!=t),this.text=t,this.updateTextSize(),this}},{key:"updateTextSize",value:function(){var t=this.text;if("\n"===t||"\f"===t||""===t)this.clearTextSize();else {var e,i,n=this.style.getTextMetrics(this.context,this.text);this.textWidth=n.width,"actualBoundingBoxAscent"in n?(e=n.actualBoundingBoxAscent,i=n.actualBoundingBoxDescent):(e=0,i=0),this.textHeight=e+i,this.ascent=e,this.descent=i;}return this.updateTextFlag=!1,this}},{key:"clearTextSize",value:function(){return this.textWidth=0,this.textHeight=0,this.ascent=0,this.descent=0,this}},{key:"copyTextSize",value:function(t){return this.textWidth=t.textWidth,this.textHeight=t.textHeight,this.ascent=t.ascent,this.descent=t.descent,this}},{key:"width",get:function(){return this.textWidth*this.scaleX},set:function(t){this.textWidth>0?this.scaleX=t/this.textWidth:this.scaleX=1;}},{key:"height",get:function(){return this.textHeight*this.scaleY},set:function(t){this.textHeight>0?this.scaleY=t/this.textHeight:this.scaleY=1;}},{key:"willRender",get:function(){return 0!==this.textWidth&&h(s(a.prototype),"willRender",this)}},{key:"renderContent",value:function(){var t=this.context,e=this.style;if(e.hasBackgroundColor){t.fillStyle=e.backgroundColor;var i=this.drawTLX,n=this.drawTRX-i,r=e.backgroundBottomY;null==r&&(r=this.drawBLY);var s=e.backgroundHeight;null==s&&(s=r-this.drawTLY);var a=r-s;t.fillRect(i,a,n,s);}var o=e.hasFill,u=e.hasStroke;(o||u)&&(e.syncFont(t).syncStyle(t),u&&(e.syncShadow(t),t.strokeText(this.text,0,0)),o&&(e.syncShadow(t),t.fillText(this.text,0,0)));}},{key:"drawTLX",get:function(){return -this.leftSpace}},{key:"drawTLY",get:function(){return -this.ascent}},{key:"drawBLX",get:function(){return -this.leftSpace}},{key:"drawBLY",get:function(){return this.descent}},{key:"drawTRX",get:function(){return this.textWidth+this.rightSpace}},{key:"drawTRY",get:function(){return -this.ascent}},{key:"drawBRX",get:function(){return this.textWidth+this.rightSpace}},{key:"drawBRY",get:function(){return this.descent}}]),a}(ai),Li=function(t,e){var i=this.createCharChildren(t,e);return this.addChild(i),this},Fi=function(t){r(s,t);var i=u(s);function s(t,n,r){var a;return e(this,s),(a=i.call(this,t,Ci)).setTexture(n,r),a}return n(s,[{key:"frameWidth",get:function(){return this.frameObj?this.frameObj.cutWidth:0}},{key:"frameHeight",get:function(){return this.frameObj?this.frameObj.cutHeight:0}},{key:"offsetY",get:function(){return -this.height},set:function(t){}},{key:"key",get:function(){return this._key},set:function(t){this.setDirty(this._key!=t),this._key=t;}},{key:"frame",get:function(){return this._frame},set:function(t){this.setDirty(this._frame!=t),this._frame=t;}},{key:"setTexture",value:function(t,e){return this.key=t,this.frame=e,this.frameObj=this.scene.sys.textures.getFrame(t,e),this}},{key:"width",get:function(){return this.frameWidth*this.scaleX},set:function(t){this.setDirty(this.width!==t),this.scaleX=t/this.frameWidth;}},{key:"height",get:function(){return this.frameHeight*this.scaleY},set:function(t){this.setDirty(this.height!==t),this.scaleY=t/this.frameHeight;}},{key:"setHeight",value:function(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}},{key:"renderContent",value:function(){var t=this.context,e=this.frameObj,i=this.frameWidth,n=this.frameHeight;t.drawImage(e.source.image,e.cutX,e.cutY,i,n,0,0,i,n);}},{key:"drawTLX",get:function(){return -this.leftSpace}},{key:"drawTLY",get:function(){return 0}},{key:"drawBLX",get:function(){return -this.leftSpace}},{key:"drawBLY",get:function(){return this.frameHeight}},{key:"drawTRX",get:function(){return this.frameWidth+this.rightSpace}},{key:"drawTRY",get:function(){return 0}},{key:"drawBRX",get:function(){return this.frameWidth+this.rightSpace}},{key:"drawBRY",get:function(){return this.frameHeight}}]),s}(ai),Xi=function(t,e,i){var n=this.createImageChild(t,e,i);return this.addChild(n),this},Yi=function(t){r(a,t);var i=u(a);function a(t,n,r,s){var o;return e(this,a),(o=i.call(this,t,_i)).setRenderCallback(n),o.setDrawerSize(r,s),o}return n(a,[{key:"setRenderCallback",value:function(t){return t?this.renderContent=t.bind(this):delete this.renderContent,this}},{key:"setDrawerSize",value:function(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}},{key:"onFree",value:function(){h(s(a.prototype),"onFree",this).call(this),this.setRenderCallback();}},{key:"width",get:function(){return this.drawerWidth*this.scaleX},set:function(t){this.setDirty(this.width!==t),this.scaleX=this.drawerWidth>0?t/this.drawerWidth:1;}},{key:"height",get:function(){return this.drawerHeight*this.scaleY},set:function(t){this.setDirty(this.height!==t),this.scaleY=this.drawerHeight>0?t/this.drawerHeight:1;}},{key:"offsetY",get:function(){return -this.height},set:function(t){}},{key:"drawTLX",get:function(){return -this.leftSpace}},{key:"drawTLY",get:function(){return 0}},{key:"drawBLX",get:function(){return -this.leftSpace}},{key:"drawBLY",get:function(){return this.drawerHeight}},{key:"drawTRX",get:function(){return this.drawerWidth+this.rightSpace}},{key:"drawTRY",get:function(){return 0}},{key:"drawBRX",get:function(){return this.drawerWidth+this.rightSpace}},{key:"drawBRY",get:function(){return this.drawerHeight}}]),a}(ai),Ii=function(t){r(s,t);var i=u(s);function s(t,n){var r;return e(this,s),(r=i.call(this,t,ji)).setSpaceWidth(n),r}return n(s,[{key:"width",get:function(){return this.spaceWidth*this.scaleX},set:function(t){this.spaceWidth>0?this.scaleX=t/this.spaceWidth:this.scaleX=1;}},{key:"setSpaceWidth",value:function(t){return this.spaceWidth=t,this}}]),s}(ai),Vi=function(t){var e=this.createSpaceChild(t);return this.addChild(e),this},zi=function(t){r(a,t);var i=u(a);function a(t,n,r,s,o){var u;return e(this,a),(u=i.call(this,t,Ri)).setName(n).setParameter(s).setCallback(r,o),u}return n(a,[{key:"setName",value:function(t){return this.name=t,this}},{key:"setParameter",value:function(t){return this.param=t,this}},{key:"setCallback",value:function(t,e){return this.callback=t,this.scope=e,this}},{key:"exec",value:function(){return this.scope?this.callback.call(this.scope,this.param,this.name):this.callback(this.param,this.name)}},{key:"onFree",value:function(){h(s(a.prototype),"onFree",this).call(this),this.setName().setCallback().setParameter();}}]),a}(Xe),Ni=function(t,e,i,n){var r=this.createCommandChild(t,e,i,n);return this.addChild(r),this},Ui=function e(i){var n,r,s;if(null==i||"object"!==t(i))return i;if(n=Array.isArray(i)?[]:{},function(e){if("object"!==t(e)||e.nodeType||e===e.window)return !1;try{if(e.constructor&&!{}.hasOwnProperty.call(e.constructor.prototype,"isPrototypeOf"))return !1}catch(t){return !1}return !0}(i))for(s in i)r=i[s],n[s]=e(r);else n=i;return n},Hi=function(t,e,i,n){void 0===n&&(n={word:[],width:0}),n.word.length=0;for(var r=t.length,s=e,a=n.word,o=0;s0&&!o){var u=this.fixedHeight-n;if(i>0)s=u/i;else s=(c=qi.call(this)).height,a=c.ascent,i=Math.floor((u-a)/s);}else {var c;s=(c=qi.call(this)).height,a=c.ascent;}}else if(this.fixedHeight>0){if(void 0===(i=Qi(t,"maxLines"))){u=this.fixedHeight-n;i=Math.floor(u/s);}}else i=Qi(t,"maxLines",0);void 0===a&&(a=s);var h=0===i,l=Qi(t,"wrapWidth",void 0);void 0===l&&(l=this.fixedWidth>0?this.fixedWidth-r:1/0);for(var f=Qi(t,"letterSpacing",0),d=Qi(t,"hAlign",0),g=Qi(t,"vAlign",0),p=Qi(t,"charWrap",!1),v={callback:"runWordWrap",start:e,isLastPage:!1,padding:this.wrapPadding,ascent:a,lineHeight:s,maxLines:i,wrapWidth:l,letterSpacing:f,hAlign:d,vAlign:g,charWrap:p,children:[],lines:[],maxLineWidth:0,linesHeight:0},y=this.children,m=0,k=y.length;m0&&(T.push({children:C,width:_}),j=Math.max(j,_)),v.start+=P.length,v.isLastPage=!R&&v.start===M,v.maxLineWidth=j,v.linesHeight=T.length*s;var F=this.fixedWidth>0?this.fixedWidth:v.maxLineWidth+r,X=this.fixedHeight>0?this.fixedHeight:v.linesHeight+n;!function(t,e,i){var n,r,s=t.hAlign,a=t.vAlign,o=t.linesHeight;switch(a){case 1:case"center":r=(i-o)/2;break;case 2:case"bottom":r=i-o;break;default:r=0;}for(var u=t.lines,c=0,h=u.length;c0?(a=this.fixedWidth-r)/i:0;else if(this.fixedWidth>0){if(void 0===(i=en(t,"maxLines",void 0))){var a=this.fixedWidth-r;i=Math.floor(a/s)+1;}}else i=en(t,"maxLines",0);var o=0===i,u=en(t,"fixedChildHeight",void 0);if(void 0===u){var c=en(t,"charPerLine",void 0);if(void 0!==c){var h=this.fixedHeight-n;u=Math.floor(h/c);}}var l=en(t,"wrapHeight",void 0);void 0===l&&(l=this.fixedHeight>0?this.fixedHeight-n:1/0);for(var f=en(t,"letterSpacing",0),d=en(t,"rtl",!0),g=en(t,"hAlign",d?2:0),p=en(t,"vAlign",0),v={callback:"runVerticalWrap",start:e,isLastPage:!1,padding:this.wrapPadding,lineWidth:s,maxLines:i,fixedChildHeight:u,wrapHeight:l,letterSpacing:f,hAlign:g,vAlign:p,rtl:d,children:[],lines:[],maxLineHeight:0,linesWidth:0},y=this.children,m=0,k=y.length;m0&&(T.push({children:C,height:_}),j=Math.max(j,_)),v.start+=P.length,v.isLastPage=v.start===M,v.maxLineHeight=j,v.linesWidth=T.length*s;var A=this.fixedWidth>0?this.fixedWidth:v.linesWidth+r,L=this.fixedHeight>0?this.fixedHeight:v.maxLineHeight+n;!function(t,e,i){var n,r,s=t.hAlign,a=t.vAlign,o=t.rtl,u=t.lines,c=t.lineWidth,h=t.linesWidth;switch(s){case 1:case"center":n=(e-h)/2;break;case 2:case"right":n=e-h;break;default:n=0;}o&&(n+=c);for(var l=0,f=u.length;l0?t:this.width,e>0?e:this.height),this):this},setPadding:function(t,e){var i=this.padding,n=i.left,r=i.right,s=i.top,a=i.bottom;return Le(i,t,e),this.dirty=this.dirty||n!=i.left||r!=i.right||s!=i.top||a!=i.bottom,this},getPadding:function(t){return function(t,e){return void 0===e?t:t[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),Mi(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 Pi(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,n,r,s=Array.isArray(t);void 0===e||e===this.children.length?s?(i=this.children).push.apply(i,p(t)):this.children.push(t):s?(n=this.children).splice.apply(n,[e,0].concat(p(t))):this.children.splice(e,0,t);(this.lastAppendedChildren.length=0,s)?(r=this.lastAppendedChildren).push.apply(r,p(t)):this.lastAppendedChildren.push(t);return this},createCharChild:function(t,e){e&&this.textStyle.modify(e);var i=this.poolManager.allocate(Ti);return null===i?i=new Ai(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=[],n=0,r=t.length;ne&&(n=e,r=t);})),r},getCharWorldPosition:function(t,e,i,n){return "number"==typeof t&&(t=this.getCharChild(t,!0)),ei(this,t,e,i,n)},setToMinSize:function(){for(var t=this.children,e=0,i=0,n=0,r=t.length;n=i.length&&(t=i.length);for(var n=0,r=0;r");this.setDelimiters(n[0],n[1]),this.setTranslateTagNameCallback(ye(i,"translateTagNameCallback")),this.isRunning=!1,this.isPaused=!1,this.skipEventFlag=!1,this.justCompleted=!1,this.lastTagStart=null,this.lastTagEnd=null,this.lastContent=null;}return n(t,[{key:"shutdown",value:function(){this.destroyEventEmitter();}},{key:"destroy",value:function(){this.shutdown();}},{key:"setMultipleLinesTagEnable",value:function(t){return void 0===t&&(t=!0),this.multipleLinesTagEnable=t,this}},{key:"setDelimiters",value:function(t,e){void 0===e&&(e=t[1],t=t[0]),this.delimiterLeft=t,this.delimiterRight=e,t=jn(this.delimiterLeft),e=jn(this.delimiterRight);var i=this.multipleLinesTagEnable?"gs":"gi";return this.reSplit=RegExp("".concat(t,"(.+?)").concat(e),i),this}},{key:"setTranslateTagNameCallback",value:function(t){return this.translateTagNameCallback=t,this}},{key:"setValueConverter",value:function(t){return !0===t?t=_n:t||(t=Dn),this.valueConverter=t,this}},{key:"setLoopEnable",value:function(t){return void 0===t&&(t=!0),this.loopEnable=t,this}},{key:"setSource",value:function(t){return this.source=t,this}},{key:"resetIndex",value:function(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}},{key:"start",value:function(t){return this.setSource(t).restart(),this}},{key:"restart",value:function(){this.resetIndex().next();}},{key:"next",value:function(){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");return n.setDelimiters(r[0],r[1]),n}return n(a,[{key:"setTagExpression",value:function(t){return t||(t=An),this.tagExpression=t,this}},{key:"setValueExpression",value:function(t){return t||(t=An),this.valueExpression=t,this}},{key:"setDelimiters",value:function(t,e){h(s(a.prototype),"setDelimiters",this).call(this,t,e);var i="(".concat(this.tagExpression,")(=(").concat(this.valueExpression,"))?");if(this.reTag=RegExp(i,"i"),this.tagExpression!==An||this.valueExpression!==An){var n="".concat(this.tagExpression,"(=").concat(this.valueExpression,")?"),r="/".concat(this.tagExpression);t=jn(this.delimiterLeft),e=jn(this.delimiterRight);var o=this.multipleLinesTagEnable?"gs":"gi";this.reSplit=RegExp("".concat(t,"((").concat(n,")|(").concat(r,"))").concat(e),o);}return this}},{key:"onTag",value:function(t){var e=t.match(this.reTag),i=e[1],n="/"===i.charAt(0);if(n&&(i=i.substring(1,i.length)),this.translateTagNameCallback&&(i=this.translateTagNameCallback(i)),this.skipEventFlag=!1,n)this.emit("-".concat(i)),this.skipEventFlag||this.emit("-",i),this.lastTagEnd=i;else {var r=function(t,e){if(null==t)return [];void 0===e&&(e=_n);for(var i=t.split(","),n=0,r=i.length;n1?r-1:0),a=1;a1&&-1!==e.indexOf("|")?e.split("|"):[e]).length;s0){var a=this.timeline.addTimer({name:Yr,target:r,duration:s.duration,yoyo:s.yoyo,onStart:s.onStart,onProgress:s.onProgress,onComplete:s.onComplete});this.skipTypingAnimation&&a.seek(1);}else s.onStart&&s.onStart(r,0);this.minSizeEnable&&this.textPlayer.setToMinSize(),this.textPlayer.emit("typing",r);var o=this.nextChild;if(o)if(this.skipSpaceEnable&&((i=o).type===Ti&&" "===i.text));else if(n+=this.speed+e,e=0,n>0){this.typingTimer=this.timeline.addTimer({name:"delay",target:this,duration:n,onComplete:function(e,i,n){e.typingTimer=void 0,t.call(e,n.remainder);}});break}}else Wi(r)&&r.exec();}this.minSizeEnable&&this.textPlayer.setToMinSize(),this.inTypingProcessLoop=!1;},pause:function(){return this.timeline.pause(),this},resume:function(){return this.timeline.resume(),this},pauseTyping:function(){return this.isTypingPaused||(this.typingTimer?(this.typingTimer.pause(),this.isTypingPaused=!0):this.inTypingProcessLoop&&(this.inTypingProcessLoop=!1,this.isTypingPaused=!0)),this},resumeTyping:function(t){return this.isTypingPaused?(void 0===t&&(t=0),this.typingTimer?(this.isTypingPaused=!1,this.typingTimer.resume(),this.typingTimer.remainder+=t):this.isTypingPaused&&(this.isTypingPaused=!1,this.typing(t)),this):this},wait:function(t){return this.ignoreWait||(this.pauseTyping(),Ur(this.textPlayer,t,this.resumeTyping,this)),this},setIgnoreWait:function(t){return void 0===t&&(t=!0),this.ignoreWait=t,this},setSkipSpaceEnable:function(t){return void 0===t&&(t=!0),this.skipSpaceEnable=t,this},setSkipTypingAnimation:function(t){if(void 0===t&&(t=!0),this.skipTypingAnimation=t,t)for(var e=this.timeline.getTimers(Yr),i=0,n=e.length;i0&&a.chainAnimation(i,n);},hs=function(t){var e,i,n=g(t);e=n[0],i=n.slice(1);var r=this.getGameObjectManager(e);r.stopAnimation.apply(r,p(i));},ls=function(t){var e,i,n=g(t);e=n[0],i=n.slice(1);var r=this.getGameObjectManager(e);r.pauseAnimation.apply(r,p(i));},fs=function(t){var e,i,n=g(t);e=n[0],i=n.slice(1);var r=this.getGameObjectManager(e);r.chainAnimation.apply(r,p(i));},ds=[function(t,e,i){var n=i.name;e.on("+",(function(i){if(!e.skipEventFlag){var r,s=i.split(".");if(us(s,n)){r=s[1];for(var a=arguments.length,o=new Array(a>1?a-1:0),u=1;u0)){var o=this.getGameObjectManager(e);o.hasMethod(i,n)?o.call.apply(o,[i,n].concat(p(r))):o.setProperty(i,n,r[0]);}},bs={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},ws=function(t){var e,i,n,r,s,a,o,u,c=d(t,8);e=c[0],i=c[1],n=c[2],r=c[3],s=c[4],a=c[5],o=c[6],u=c[7];var h=this.getGameObjectManager(e),l=h.getProperty(i,n);if("number"==typeof l){u.endsWith("Left")||u.endsWith("Up")?u.startsWith("to")||u.startsWith("yoyo")?r=l-r:u.startsWith("from")&&(h.setProperty(i,n,l-r),r=l):u.endsWith("Right")||u.endsWith("Down")?u.startsWith("to")||u.startsWith("yoyo")?r=l+r:u.startsWith("from")&&(h.setProperty(i,n,l+r),r=l):"from"===u&&(h.setProperty(i,n,r),r=l);var f=u.startsWith("yoyo");h.easeProperty(i,n,r,s,a,o,f);}},Ss=[function(t,e,i){var n=i.name;e.on("+",(function(i){if(!e.skipEventFlag){var r,s=i.split(".");if(ps(s,n)){r=s[1];for(var a=arguments.length,o=new Array(a>1?a-1:0),u=1;u1?o-1:0),c=1;c textObject.width) { - dx = textObject.width - childRightX; - } else { - dx = 0; - } - var childTopY = this.drawY + this.drawTLY; - var childBottomY = childTopY + this.height; - if (childTopY < 0) { - dy = 0 - childTopY; - } else if (childBottomY > textObject.height) { - dy = textObject.height - childBottomY; - } else { - dy = 0; - } - textObject._textOX += dx; - textObject._textOY += dy; - return this; - }; - var Methods$4 = { contains: Contains, - getWorldPosition: GetWorldPosition, - scrollTo: ScrollTo$1 + getWorldPosition: GetWorldPosition }; Object.assign(Methods$4, RenderMethods); @@ -9741,7 +9714,6 @@ return this; } this._textOX = ox; - this.updateTexture(); return this; }, setTextOY: function setTextOY(oy) { @@ -9749,7 +9721,6 @@ return this; } this._textOY = oy; - this.updateTexture(); return this; }, setTextOXY: function setTextOXY(ox, oy) { @@ -9758,7 +9729,6 @@ } this._textOX = ox; this._textOY = oy; - this.updateTexture(); return this; }, addTextOX: function addTextOX(incX) { diff --git a/dist/rextextplayerplugin.min.js b/dist/rextextplayerplugin.min.js index 89ea09308e..5f12c8ec6d 100644 --- a/dist/rextextplayerplugin.min.js +++ b/dist/rextextplayerplugin.min.js @@ -1 +1 @@ -!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).rextextplayerplugin=e();}(undefined,(function(){function t(e){return t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},t(e)}function e(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){for(var i=0;it.length)&&(e=t.length);for(var i=0,n=new Array(e);i1?i-1:0),r=1;r0&&void 0!==t.setTint},useAlphaFadeEffect:function(t){return (void 0===this.fadeMode||1===this.fadeMode)&&this.fadeTime>0&&void 0!==t.setAlpha},useRevealEffect:function(t){return this.fadeMode>=2&&this.fadeMode<=5&&this.fadeTime>0&&(t.preFX||t.postFX)},fadeBob:function(t,e,i,n){var r=t.gameObject;if(this.useTintFadeEffect(r))void 0!==e&&t.setProperty("tintGray",255*e),t.easeProperty("tintGray",Math.floor(255*i),this.fadeTime,"Linear",0,!1,n);else if(this.useAlphaFadeEffect(r))void 0!==e&&t.setProperty("alpha",e),t.easeProperty("alpha",i,this.fadeTime,"Linear",0,!1,n);else if(this.useRevealEffect(r)){var s;switch(j(r,"reveal"),this.fadeMode){case 2:s="revealUp";break;case 3:s="revealDown";break;case 4:s="revealLeft";break;case 5:s="revealRight";}void 0===e&&(e=0),r[s]=e,t.easeProperty(s,i,this.fadeTime,"Linear",0,!1,n),t.getTweenTask(s).once("complete",(function(){r[s]=null;}));}else n&&n(r);return this}},G=function(t){return t>>16&255},A=function(t){return t>>8&255},D=function(t){return 255&t},W=Phaser.Events.EventEmitter,L=function(t,e,i,n,r,s){return void 0===s?s={}:!0===s&&(s=F),"number"!=typeof i&&(i=0,n=0),s.x=r.x+r.width*t+i,s.y=r.y+r.height*e+n,s},F={},X=function(t,e,i,n,r,s,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===n&&(n=.5),void 0===r&&(r=0),void 0===s&&(s=0),void 0===a&&(a=L),function(t){if(t.events)return t;var e=new W,i=t.x;Object.defineProperty(t,"x",{get:function(){return i},set:function(n){i!==n&&(i=n,e.emit("update",t));}});var n=t.y;Object.defineProperty(t,"y",{get:function(){return n},set:function(i){n!==i&&(n=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 s=t.height;Object.defineProperty(t,"height",{get:function(){return s},set:function(i){s!==i&&(s=i,e.emit("update",t));}}),t.events=e;}(e);var o=e.events;t.vp=e;var u=function(){a(i,n,r,s,e,t);};o.on("update",u),t.once("destroy",(function(){o.off("update",u),t.vp=void 0;})),Object.defineProperty(t,"vpx",{get:function(){return i},set:function(t){i!==t&&(i=t,u());}}),Object.defineProperty(t,"vpy",{get:function(){return n},set:function(t){n!==t&&(n=t,u());}}),Object.defineProperty(t,"vpxOffset",{get:function(){return r},set:function(t){r!==t&&(r=t,u());}}),Object.defineProperty(t,"vpyOffset",{get:function(){return s},set:function(t){s!==t&&(s=t,u());}}),u();},Y=Phaser.Utils.Array.Remove,I={has:function(t){return this.bobs.hasOwnProperty(t)},exists:function(t){return this.bobs.hasOwnProperty(t)},get:function(t){return this.bobs[t]},getGO:function(t){var e=this.get(t);return e?e.gameObject:null},addGO:function(t,e){this.remove(t,!0),this.useTintFadeEffect(e)&&function(t,e){if(t.hasOwnProperty("tintR"))return t;void 0===e&&(e=16777215);var i=G(e),n=A(e),r=D(e);Object.defineProperty(t,"tint",{get:function(){return e},set:function(s){s=16777215&Math.floor(s),t.setTint&&t.setTint(s),e!==s&&(i=G(e=s),n=A(e),r=D(e));}}),Object.defineProperty(t,"tintR",{get:function(){return i},set:function(n){n=255&Math.floor(n),i!==n&&(i=n,t.tint=(255&n)<<16|65535&e);}}),Object.defineProperty(t,"tintG",{get:function(){return n},set:function(i){i=255&Math.floor(i),n!==i&&(n=i,t.tint=(255&i)<<8|16711935&e);}}),Object.defineProperty(t,"tintB",{get:function(){return r},set:function(i){i=255&Math.floor(i),r!==i&&(r=i,t.tint=255&i|16776960&e);}}),Object.defineProperty(t,"tintGray",{get:function(){return Math.floor((i+n+r)/3)},set:function(e){e=255&Math.floor(e),i===e&&n===e&&r===e||(i=e,n=e,r=e,t.tint=(255&e)<<16|(255&e)<<8|255&e);}}),t.tint=e;}(e),this.viewportCoordinateEnable&&X(e,this.viewport),this.effectPropertiesConfig&&j(e,this.effectPropertiesConfig),e.once("destroy",(function(){Y(this.removedGOs,e),this.isEmpty&&this.emit("empty");}),this);var i=new this.BobClass(this,e,t);return this.bobs[t]=i,this},add:function(t){for(var e=this.createGameObjectCallback,i=this.createGameObjectScope,n=arguments.length,r=new Array(n>1?n-1:0),s=1;s2?n-2:0),s=2;s0?-this.delay:0,this.state=this.nowTime>=0?_t:Ct,this.repeatCounter=0,this}},{key:"stop",value:function(){return this.state=Tt,this}},{key:"update",value:function(t,e){this.state!==Tt&&this.state!==Rt&&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=jt)):(this.nowTime=this.duration,this.state=Rt):this.nowTime>=0&&(this.state=_t));}},{key:"t",get:function(){var t;switch(this.state){case Tt:case Ct:case jt:t=0;break;case _t:t=this.nowTime/this.duration;break;case Rt:t=1;}return Mt(t,0,1)},set:function(t){(t=Mt(t,-1,1))<0?(this.state=Ct,this.nowTime=-this.delay*t):(this.state=_t,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++);}},{key:"setT",value:function(t){return this.t=t,this}},{key:"isIdle",get:function(){return this.state===Tt}},{key:"isDelay",get:function(){return this.state===Ct}},{key:"isCountDown",get:function(){return this.state===_t}},{key:"isRunning",get:function(){return this.state===Ct||this.state===_t}},{key:"isDone",get:function(){return this.state===Rt}},{key:"isOddIteration",get:function(){return 1==(1&this.repeatCounter)}},{key:"isEvenIteration",get:function(){return 0==(1&this.repeatCounter)}}]),t}(),Tt=0,Ct=1,_t=2,jt=3,Rt=-1,Bt=function(t){r(a,t);var i=u(a);function a(t,n){var r;return e(this,a),(r=i.call(this,t,n)).timer=new Pt,r}return n(a,[{key:"shutdown",value:function(t){this.isShutdown||(h(s(a.prototype),"shutdown",this).call(this,t),this.timer.destroy(),this.timer=void 0);}},{key:"start",value:function(){return this.timer.start(),h(s(a.prototype),"start",this).call(this),this}},{key:"stop",value:function(){return this.timer.stop(),h(s(a.prototype),"stop",this).call(this),this}},{key:"complete",value:function(){return this.timer.stop(),h(s(a.prototype),"complete",this).call(this),this}}]),a}(Et),Gt=Phaser.Utils.Objects.GetValue,At=Phaser.Utils.Objects.GetAdvancedValue,Dt=Phaser.Tweens.Builders.GetEaseFunction,Wt=function(t){r(a,t);var i=u(a);function a(){return e(this,a),i.apply(this,arguments)}return n(a,[{key:"resetFromJSON",value:function(t){return this.timer.resetFromJSON(Gt(t,"timer")),this.setEnable(Gt(t,"enable",!0)),this.setTarget(Gt(t,"target",this.parent)),this.setDelay(At(t,"delay",0)),this.setDuration(At(t,"duration",1e3)),this.setEase(Gt(t,"ease","Linear")),this.setRepeat(Gt(t,"repeat",0)),this}},{key:"setEnable",value:function(t){return null==t&&(t=!0),this.enable=t,this}},{key:"setTarget",value:function(t){return void 0===t&&(t=this.parent),this.target=t,this}},{key:"setDelay",value:function(t){return this.delay=t,this}},{key:"setDuration",value:function(t){return this.duration=t,this}},{key:"setRepeat",value:function(t){return this.repeat=t,this}},{key:"setRepeatDelay",value:function(t){return this.repeatDelay=t,this}},{key:"setEase",value:function(t){return void 0===t&&(t="Linear"),this.ease=t,this.easeFn=Dt(t),this}},{key:"start",value:function(){return this.timer.isRunning||h(s(a.prototype),"start",this).call(this),this}},{key:"restart",value:function(){return this.timer.stop(),this.start.apply(this,arguments),this}},{key:"stop",value:function(t){return void 0===t&&(t=!1),h(s(a.prototype),"stop",this).call(this),t&&(this.timer.setT(1),this.updateGameObject(this.target,this.timer),this.complete()),this}},{key:"update",value:function(t,e){if(!this.isRunning||!this.enable||!this.parent.active)return this;var i=this.target,n=this.timer;return n.update(t,e),n.isDelay||this.updateGameObject(i,n),this.emit("update",i,this),n.isDone&&this.complete(),this}},{key:"updateGameObject",value:function(t,e){}}]),a}(Bt),Lt=Phaser.Sound.BaseSound,Ft=function(t){return t instanceof Lt},Xt=Phaser.Utils.Objects.GetValue,Yt=Phaser.Utils.Objects.GetAdvancedValue,It=Phaser.Math.Linear,Vt=function(t){r(a,t);var i=u(a);function a(t,n,r){var s;return e(this,a),Ft(t)&&(r=n,n=t,t=void 0),n.active=!0,n.scene=t,n.game=n.manager.game,(s=i.call(this,n,r)).volume={},s.resetFromJSON(r),s}return n(a,[{key:"resetFromJSON",value:function(t){return h(s(a.prototype),"resetFromJSON",this).call(this,t),this.setMode(Xt(t,"mode",0)),this.setEnable(Xt(t,"enable",!0)),this.setVolumeRange(Yt(t,"volume.start",this.parent.volume),Yt(t,"volume.end",0)),this}},{key:"setMode",value:function(t){return "string"==typeof t&&(t=zt[t]),this.mode=t,this}},{key:"setVolumeRange",value:function(t,e){return this.volume.start=t,this.volume.end=e,this}},{key:"start",value:function(){return this.timer.isRunning||(this.parent.setVolume(this.volume.start),this.timer.setDelay(this.delay).setDuration(this.duration),h(s(a.prototype),"start",this).call(this)),this}},{key:"updateGameObject",value:function(t,e){t.volume=It(this.volume.start,this.volume.end,e.t);}},{key:"complete",value:function(){switch(h(s(a.prototype),"complete",this).call(this),this.mode){case 1:this.parent.stop();break;case 2:this.parent.destroy();}return this}}]),a}(Wt),zt={stop:1,destroy:2},Ut=function(t,e,i,n,r){Ft(t)&&(r=n,n=i,i=e,e=t,t=void 0),void 0===n&&(n=1),void 0===r&&(r=0);var s,a={mode:0,volume:{start:r,end:n},duration:i};return "string"==typeof e&&(e=t.sys.sound.add(e)),e.hasOwnProperty("_fade")?(s=e._fade).stop().resetFromJSON(a):(s=new Vt(t,e,a),e._fade=s),s.start(),e.isPlaying||e.setVolume(r).play(),e},Nt=function(t,e,i,n){Ft(t)&&(n=i,i=e,e=t,t=void 0),void 0===n&&(n=!0);var r,s={mode:n?2:1,volume:{start:e.volume,end:0},duration:i};return e.hasOwnProperty("_fade")?(r=e._fade).stop().resetFromJSON(s):(r=new Vt(t,e,s),e._fade=r),r.start(),e.isPlaying||e.play(),e},Ht=Phaser.Utils.Objects.GetValue,Jt={setBackgroundMusicLoop:function(t){return void 0===t&&(t=!0),this.backgroundMusicLoop=t,this},setBackgroundMusicFadeTime:function(t){return this.backgroundMusicFadeTime=t,this},getBackgroundMusic:function(){return this.backgroundMusic},setCurrentBackgroundMusic:function(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:function(t,e){if(this.backgroundMusic&&this.backgroundMusic.key===t)return this;this.stopBackgroundMusic();var i=this.sound.add(t,{loop:Ht(e,"loop",this.backgroundMusicLoop),mute:Ht(e,"mute",this.backgroundMusicMute),volume:Ht(e,"volume",this.backgroundMusicVolume),detune:Ht(e,"detune",0),rate:Ht(e,"rate",1)});return this.setCurrentBackgroundMusic(i),this.backgroundMusicFadeTime>0&&this.fadeInBackgroundMusic(this.backgroundMusicFadeTime),this},pauseBackgroundMusic:function(){return this.backgroundMusic&&this.backgroundMusic.pause(),this},resumeBackgroundMusic:function(){return this.backgroundMusic&&this.backgroundMusic.resume(),this},stopBackgroundMusic:function(){return this.backgroundMusic&&(this.backgroundMusicFadeTime>0?this.fadeOutBackgroundMusic(this.backgroundMusicFadeTime,!0):(this.backgroundMusic.stop(),this.backgroundMusic.destroy(),this.backgroundMusic=void 0)),this},fadeInBackgroundMusic:function(t){return this.backgroundMusic&&Ut(this.backgroundMusic,t,this.backgroundMusicVolume,0),this},fadeOutBackgroundMusic:function(t,e){return this.backgroundMusic&&Nt(this.backgroundMusic,t,e),this},crossFadeBackgroundMusic:function(t,e){var i=this.backgroundMusicFadeTime;return this.backgroundMusicFadeTime=0,this.fadeOutBackgroundMusic(e,!0).playBackgroundMusic(t).fadeInBackgroundMusic(e),this.backgroundMusicFadeTime=i,this},setBackgroundMusicMute:function(t){return void 0===t&&(t=!0),this.backgroundMusicMute=t,this},setBackgroundMusicVolume:function(t){return this.backgroundMusicVolume=t,this},setBackgroundMusicRate:function(t){return this.backgroundMusic&&this.backgroundMusic.setRate(t),this},setBackgroundMusicDetune:function(t){return this.backgroundMusic&&this.backgroundMusic.setDetune(t),this}},Kt=Phaser.Utils.Objects.GetValue,qt={setBackgroundMusic2Loop:function(t){return void 0===t&&(t=!0),this.backgroundMusic2Loop=t,this},setBackgroundMusic2FadeTime:function(t){return this.backgroundMusic2FadeTime=t,this},getBackgroundMusic2:function(){return this.backgroundMusic2},setCurrentBackgroundMusic2:function(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:function(t,e){if(this.backgroundMusic2&&this.backgroundMusic2.key===t)return this;this.stopBackgroundMusic2();var i=this.sound.add(t,{loop:Kt(e,"loop",this.backgroundMusicLoop),mute:Kt(e,"mute",this.backgroundMusic2Mute),volume:Kt(e,"volume",this.backgroundMusic2Volume),detune:Kt(e,"detune",0),rate:Kt(e,"rate",1)});return this.setCurrentBackgroundMusic2(i),this.backgroundMusic2FadeTime>0&&this.fadeInBackgroundMusic2(this.backgroundMusic2FadeTime),this},pauseBackgroundMusic2:function(){return this.backgroundMusic2&&this.backgroundMusic2.pause(),this},resumeBackgroundMusic2:function(){return this.backgroundMusic2&&this.backgroundMusic2.resume(),this},stopBackgroundMusic2:function(){return this.backgroundMusic2&&(this.backgroundMusic2FadeTime>0?this.fadeOutBackgroundMusic2(this.backgroundMusic2FadeTime,!0):(this.backgroundMusic2.stop(),this.backgroundMusic2.destroy(),this.backgroundMusic2=void 0)),this},fadeInBackgroundMusic2:function(t){return this.backgroundMusic2&&Ut(this.backgroundMusic2,t,this.backgroundMusic2Volume,0),this},fadeOutBackgroundMusic2:function(t,e){return this.backgroundMusic2&&Nt(this.backgroundMusic2,t,e),this},crossFadeBackgroundMusic2:function(t,e){var i=this.backgroundMusic2FadeTime;return this.backgroundMusic2FadeTime=0,this.fadeOutBackgroundMusic2(e,!0).playBackgroundMusic2(t).fadeInBackgroundMusic2(e),this.backgroundMusic2FadeTime=i,this},setBackgroundMusic2Mute:function(t){return void 0===t&&(t=!0),this.backgroundMusic2Mute=t,this},setBackgroundMusic2Volume:function(t){return this.backgroundMusic2Volume=t,this},setBackgroundMusic2Rate:function(t){return this.backgroundMusic2&&this.backgroundMusic2.setRate(t),this},setBackgroundMusic2Detune:function(t){return this.backgroundMusic2&&this.backgroundMusic2.setDetune(t),this}},$t=Phaser.Utils.Array.Remove,Qt=Phaser.Utils.Objects.GetValue,Zt={getSoundEffects:function(){return this.soundEffects},getLastSoundEffect:function(){return this.soundEffects[this.soundEffects.length-1]},playSoundEffect:function(t,e){var i=this.sound.add(t,{mute:Qt(e,"mute",this.soundEffectsMute),volume:Qt(e,"volume",this.soundEffectsVolume),detune:Qt(e,"detune",0),rate:Qt(e,"rate",1)});return this.soundEffects.push(i),i.once("complete",(function(){i.destroy(),this.sound&&$t(this.soundEffects,i);}),this).once("destroy",(function(){this.sound&&$t(this.soundEffects,i);}),this).play(),this},stopAllSoundEffects:function(){for(var t=this.soundEffects.length-1;t>=0;t--){var e=this.soundEffects[t];e.stop(),e.destroy();}return this},fadeInSoundEffect:function(t){var e=this.getLastSoundEffect();return e&&Ut(e,t,this.soundEffectsVolume,0),this},fadeOutSoundEffect:function(t,e){var i=this.getLastSoundEffect();return i&&Nt(i,t,e),this},fadeOutAllSoundEffects:function(t,e){for(var i=this.soundEffects.length-1;i>=0;i--)Nt(this.soundEffects[i],t,e);return this},setSoundEffectMute:function(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:function(t,e){if(void 0===e&&(e=!1),e){var i=this.getLastSoundEffect();i&&i.setVolume(t);}else this.soundEffectsVolume=t;return this},setSoundEffectDetune:function(t,e){var i;void 0===e&&(e=!1);for(var n=0,r=(i=e?[this.getLastSoundEffect()]:this.soundEffects).length;n=0;t--){var e=this.soundEffects[t];e.stop(),e.destroy();}return this},fadeInSoundEffect2:function(t){var e=this.getLastSoundEffect2();return e&&Ut(e,t,this.soundEffects2Volume,0),this},fadeOutSoundEffect2:function(t,e){var i=this.getLastSoundEffect2();return i&&Nt(i,t,e),this},fadeOutAllSoundEffects2:function(t,e){for(var i=this.soundEffects2.length-1;i>=0;i--)Nt(this.soundEffects2[i],t,e);return this},setSoundEffect2Mute:function(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:function(t,e){if(void 0===e&&(e=!1),e){var i=this.getLastSoundEffect2();i&&i.setVolume(t);}else this.soundEffects2Volume=t;return this},setSoundEffect2Detune:function(t,e){var i;void 0===e&&(e=!1);for(var n=0,r=(i=e?[this.getLastSoundEffect2()]:this.soundEffects2).length;n=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}},{key:"backgroundMusicMute",get:function(){return this._backgroundMusicMute},set:function(t){this._backgroundMusicMute=t,this.backgroundMusic&&this.backgroundMusic.setMute(mute);}},{key:"backgroundMusicVolume",get:function(){return this._backgroundMusicVolume},set:function(t){this._backgroundMusicVolume=t,this.backgroundMusic&&this.backgroundMusic.setVolume(t);}},{key:"backgroundMusic2Mute",get:function(){return this._backgroundMusic2Mute},set:function(t){this._backgroundMusic2Mute=t,this.backgroundMusic2&&this.backgroundMusic2.setMute(mute);}},{key:"backgroundMusic2Volume",get:function(){return this._backgroundMusic2Volume},set:function(t){this._backgroundMusic2Volume=t,this.backgroundMusic2&&this.backgroundMusic2.setVolume(t);}},{key:"soundEffectsMute",get:function(){return this._soundEffectsMute},set:function(t){this._soundEffectsMute=t;for(var e=this.soundEffects,i=0,n=e.length;i0?this.items.pop():null}},{key:"push",value:function(t){return this.items.push(t),this}},{key:"pushMultiple",value:function(t){return this.items.push.apply(this.items,t),t.length=0,this}},{key:"clear",value:function(){return this.items.length=0,this}}]),t}(),le=function(t){r(s,t);var i=u(s);function s(){return e(this,s),i.apply(this,arguments)}return n(s,[{key:"allocate",value:function(){return this.pop()}},{key:"free",value:function(t){t.onFree(),this.push(t);}},{key:"freeMultiple",value:function(t){for(var e=0,i=t.length;e2?n-2:0),s=2;s3?r-3:0),a=3;ai.width?i.width-r:0;var s=this.drawY+this.drawTLY,a=s+this.height;return e=s<0?0-s:a>i.height?i.height-a:0,i._textOX+=t,i._textOY+=e,this}};Object.assign(ii,Ne);var ni=Phaser.Math.DegToRad,ri=Phaser.Math.RadToDeg,si=Phaser.Utils.Objects.GetValue,ai=function(t){r(s,t);var i=u(s);function s(t,n){var r;return e(this,s),(r=i.call(this,t,n)).renderable=!0,r.scrollFactorX=1,r.scrollFactorY=1,r.toLocalPosition=!0,r.originX=0,r.offsetX=0,r.offsetY=0,r}return n(s,[{key:"visible",get:function(){return this._visible},set:function(t){this.setDirty(this._visible!=t),this._visible=t;}},{key:"setVisible",value:function(t){return void 0===t&&(t=!0),this.visible=t,this}},{key:"alpha",get:function(){return this._alpha},set:function(t){this.setDirty(this._alpha!=t),this._alpha=t;}},{key:"setAlpha",value:function(t){return this.alpha=t,this}},{key:"x",get:function(){return this._x},set:function(t){this.setDirty(this._x!=t),this._x=t;}},{key:"setX",value:function(t){return this.x=t,this}},{key:"y",get:function(){return this._y},set:function(t){this.setDirty(this._y!=t),this._y=t;}},{key:"setY",value:function(t){return this.y=t,this}},{key:"setPosition",value:function(t,e){return this.x=t,this.y=e,this}},{key:"setInitialPosition",value:function(t,e){return this.x0=t,this.y0=e,this}},{key:"setScrollFactorX",value:function(t){return this.scrollFactorX=t,this}},{key:"setScrollFactorY",value:function(t){return this.scrollFactorY=t,this}},{key:"setScrollFactor",value:function(t,e){return void 0===e&&(e=t),this.scrollFactorX=t,this.scrollFactorY=e,this}},{key:"rotation",get:function(){return this._rotation},set:function(t){this.setDirty(this._rotation!=t),this._rotation=t;}},{key:"setRotation",value:function(t){return this.rotation=t,this}},{key:"angle",get:function(){return ri(this._rotation)},set:function(t){this.rotation=ni(t);}},{key:"setAngle",value:function(t){return this.angle=t,this}},{key:"scaleX",get:function(){return this._scaleX},set:function(t){this.setDirty(this._scaleX!==t),this._scaleX=t;}},{key:"setScaleX",value:function(t){return this.scaleX=t,this}},{key:"width",get:function(){return 0},set:function(t){}},{key:"setWidth",value:function(t,e){return void 0===e&&(e=!1),this.width=t,e&&(this.scaleY=this.scaleX),this}},{key:"leftSpace",get:function(){return this._leftSpace},set:function(t){this.setDirty(this._leftSpace!==t),this._leftSpace=t;}},{key:"setLeftSpace",value:function(t){return this.leftSpace=t,this}},{key:"rightSpace",get:function(){return this._rightSpace},set:function(t){this.setDirty(this._rightSpace!==t),this._rightSpace=t;}},{key:"setRightSpace",value:function(t){return this.rightSpace=t,this}},{key:"outerWidth",get:function(){return this.width+this.leftSpace+this.rightSpace}},{key:"scaleY",get:function(){return this._scaleY},set:function(t){this.setDirty(this._scaleY!==t),this._scaleY=t;}},{key:"setScaleY",value:function(t){return this.scaleY=t,this}},{key:"height",get:function(){return 0},set:function(t){}},{key:"setHeight",value:function(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}},{key:"setScale",value:function(t,e){return void 0===e&&(e=t),this.scaleX=t,this.scaleY=e,this}},{key:"setOrigin",value:function(t){return this.originX=t,this}},{key:"setAlign",value:function(t){return this.align=t,this}},{key:"modifyPorperties",value:function(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=si(t,"width",void 0),i=si(t,"height",void 0),n=si(t,"scaleX",void 0),r=si(t,"scaleY",void 0);return void 0!==e?void 0===i&&void 0===r?this.setWidth(e,!0):this.setWidth(e):void 0!==n&&this.setScaleX(n),void 0!==i?void 0===e&&void 0===n?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}},{key:"setDrawBelowCallback",value:function(t){return this.drawBelowCallback=t,this}},{key:"setDrawAboveCallback",value:function(t){return this.drawAboveCallback=t,this}},{key:"reset",value:function(){return this.setVisible().setAlpha(1).setPosition(0,0).setRotation(0).setScale(1,1).setLeftSpace(0).setRightSpace(0).setOrigin(0).setAlign().setDrawBelowCallback().setDrawAboveCallback(),this}},{key:"willRender",get:function(){return this.visible&&this.alpha>0}},{key:"drawX",get:function(){var t=this.x+this.leftSpace+this.offsetX-this.originX*this.width;return this.parent._textOX*this.scrollFactorX+t}},{key:"drawY",get:function(){var t=this.y+this.offsetY;return this.parent._textOY*this.scrollFactorY+t}},{key:"drawTLX",get:function(){return 0}},{key:"drawTLY",get:function(){return 0}},{key:"drawBLX",get:function(){return 0}},{key:"drawBLY",get:function(){return 0}},{key:"drawTRX",get:function(){return 0}},{key:"drawTRY",get:function(){return 0}},{key:"drawBRX",get:function(){return 0}},{key:"drawBRY",get:function(){return 0}},{key:"drawCenterX",get:function(){return (this.drawTRX+this.drawTLX)/2}},{key:"drawCenterY",get:function(){return (this.drawBLY+this.drawTLY)/2}}]),s}(Xe);Object.assign(ai.prototype,ii);var oi=Phaser.Utils.String.Pad,ui=function(e,i,n){if(null==e)return e;switch(t(e)){case"string":default:return e;case"number":return "#".concat(oi(Math.floor(e).toString(16),6,"0",1));case"function":return e(i,n);case"object":return e.hasOwnProperty("r")?e.hasOwnProperty("a")?"rgba(".concat(e.r,",").concat(e.g,",").concat(e.b,",").concat(e.a,")"):"rgb(".concat(e.r,",").concat(e.g,",").concat(e.b,")"):e.hasOwnProperty("h")?e.hasOwnProperty("a")?"hsla(".concat(e.h,",").concat(e.s,",").concat(e.l,",").concat(e.a,")"):"hsl(".concat(e.h,",").concat(e.s,",").concat(e.l,")"):e}},ci=function(t,e,i){return e.hasOwnProperty(t)?e[t]:i[t]},hi=Phaser.Utils.Objects.GetValue,li=function(){function t(i,n,r,s,a){e(this,t),void 0===i&&(i=0),void 0===n&&(n=i),void 0===r&&(r=0),void 0===s&&(s=0),void 0===a&&(a=0),this.cornerRadius={},this._width=0,this._height=0,this.setTo(i,n,r,s,a);}return n(t,[{key:"setTo",value:function(t,e,i,n,r){return this.setPosition(t,e),this.setRadius(r),this.setSize(i,n),this}},{key:"setPosition",value:function(t,e){return this.x=t,this.y=e,this}},{key:"setRadius",value:function(t){return void 0===t&&(t=0),this.radius=t,this}},{key:"setSize",value:function(t,e){return this.width=t,this.height=e,this}},{key:"minWidth",get:function(){var t=this.cornerRadius;return Math.max(t.tl.x+t.tr.x,t.bl.x+t.br.x)}},{key:"minHeight",get:function(){var t=this.cornerRadius;return Math.max(t.tl.y+t.bl.y,t.tr.y+t.br.y)}},{key:"width",get:function(){return this._width},set:function(t){null==t&&(t=0),this._width=Math.max(t,this.minWidth);}},{key:"height",get:function(){return this._height},set:function(t){null==t&&(t=0),this._height=Math.max(t,this.minHeight);}},{key:"radius",get:function(){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:function(t){var e,i;"number"==typeof t?(e=t,i=t):(e=hi(t,"x",0),i=hi(t,"y",0));var n=this.cornerRadius;n.tl=fi(hi(t,"tl",void 0),e,i),n.tr=fi(hi(t,"tr",void 0),e,i),n.bl=fi(hi(t,"bl",void 0),e,i),n.br=fi(hi(t,"br",void 0),e,i);}},{key:"radiusTL",get:function(){var t=this.cornerRadius.tl;return Math.max(t.x,t.y)},set:function(t){di(this.cornerRadius.tl,t);}},{key:"radiusTR",get:function(){var t=this.cornerRadius.tr;return Math.max(t.x,t.y)},set:function(t){di(this.cornerRadius.tr,t);}},{key:"radiusBL",get:function(){var t=this.cornerRadius.bl;return Math.max(t.x,t.y)},set:function(t){di(this.cornerRadius.bl,t);}},{key:"radiusBR",get:function(){var t=this.cornerRadius.br;return Math.max(t.x,t.y)},set:function(t){di(this.cornerRadius.br,t);}}]),t}(),fi=function(t,e,i){return void 0===t?t={x:e,y:i}:"number"==typeof t&&(t={x:t,y:t}),gi(t),t},di=function(t,e){"number"==typeof e?(t.x=e,t.y=e):(t.x=hi(e,"x",0),t.y=hi(e,"y",0)),gi(t);},gi=function(t){t.convex=t.x>=0||t.y>=0,t.x=Math.abs(t.x),t.y=Math.abs(t.y);},pi=Phaser.Math.DegToRad,vi=function(t){return !t.hasOwnProperty("convex")||t.convex},yi=function(t){return t.x>0&&t.y>0},mi=function(t,e,i,n,r,s,a,o,u){if(o&&a>s?a-=360:!o&&a=d?1:n/d,v=r>=g?1:r/g,y=f.cornerRadius;t.save(),t.beginPath(),t.translate(e,i),o=y.tl,yi(o)?(u=o.x*p,c=o.y*v,vi(o)?mi(t,u,c,u,c,180,270,!1,a):mi(t,0,0,u,c,90,0,!0,a),h=0,l=c):(t.lineTo(0,0),h=0,l=0),o=y.tr,yi(o)?(u=o.x*p,c=o.y*v,vi(o)?mi(t,n-u,c,u,c,270,360,!1,a):mi(t,n,0,u,c,180,90,!0,a)):t.lineTo(n,0),o=y.br,yi(o)?(u=o.x*p,c=o.y*v,vi(o)?mi(t,n-u,r-c,u,c,0,90,!1,a):mi(t,n,r,u,c,270,180,!0,a)):t.lineTo(n,r),o=y.bl,yi(o)?(u=o.x*p,c=o.y*v,vi(o)?mi(t,u,r-c,u,c,90,180,!1,a):mi(t,0,r,u,c,360,270,!0,a)):t.lineTo(0,r),t.lineTo(h,l),t.closePath(),t.restore();}(e,i,n,r,s,a,f),null!=o){var d;if(null!=h)(d=l?e.createLinearGradient(0,0,r,0):e.createLinearGradient(0,0,0,s)).addColorStop(0,o),d.addColorStop(1,h),o=d;e.fillStyle=o,e.fill();}null!=u&&c>0&&(e.strokeStyle=u,e.lineWidth=c,e.stroke());},bi=Phaser.Utils.Objects.GetValue,wi=function(t){r(a,t);var i=u(a);function a(t,n){var r;return e(this,a),(r=i.call(this,t,"background")).setScrollFactor(0),r.setColor(bi(n,"color",null),bi(n,"color2",null),bi(n,"horizontalGradient",!0)),r.setStroke(bi(n,"stroke",null),bi(n,"strokeThickness",2)),r.setCornerRadius(bi(n,"cornerRadius",0),bi(n,"cornerIteration",null)),r}return n(a,[{key:"color",get:function(){return this._color},set:function(t){t=ui(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t;}},{key:"color2",get:function(){return this._color2},set:function(t){t=ui(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t;}},{key:"horizontalGradient",get:function(){return this._horizontalGradient},set:function(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t;}},{key:"setColor",value:function(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}},{key:"stroke",get:function(){return this._stroke},set:function(t){t=ui(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t;}},{key:"strokeThickness",get:function(){return this._strokeThickness},set:function(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t;}},{key:"setStroke",value:function(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}},{key:"cornerRadius",get:function(){return this._cornerRadius},set:function(t){this.setDirty(this._cornerRadius!=t),this._cornerRadius=t;}},{key:"cornerIteration",get:function(){return this._cornerIteration},set:function(t){this.setDirty(this._cornerIteration!=t),this._cornerIteration=t;}},{key:"modifyStyle",value:function(t){return t.hasOwnProperty("color")&&this.setColor(t.color,ci("color2",t,this),ci("horizontalGradient",t,this)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,ci("strokeThickness",t,this)),t.hasOwnProperty("cornerRadius")&&this.setCornerRadius(t.cornerRadius,ci("cornerIteration",t,this)),this}},{key:"modifyPorperties",value:function(t){return h(s(a.prototype),"modifyPorperties",this).call(this,t),this.modifyStyle(t),this}},{key:"setCornerRadius",value:function(t,e){return this.cornerRadius=t,this.cornerIteration=e,this}},{key:"renderContent",value:function(){!function(t,e,i,n,r,s,a,o){if(null!=e||null!=i){var u=t.canvas.width,c=t.canvas.height;null==i&&(n=0);var h=n/2;u=Math.max(1,u-n),c=Math.max(1,c-n),ki(t.canvas,t.context,h,h,u,c,r,e,i,n,s,a,o);}}(this.parent,this.color,this.stroke,this.strokeThickness,this.cornerRadius,this.color2,this.horizontalGradient,this.cornerIteration);}}]),a}(ai),Si=Phaser.Utils.Objects.GetValue,Ei=function(t){r(a,t);var i=u(a);function a(t,n){var r;return e(this,a),(r=i.call(this,t,"innerbounds")).setScrollFactor(0),r.setColor(Si(n,"color",null),Si(n,"color2",null),Si(n,"horizontalGradient",!0)),r.setStroke(Si(n,"stroke",null),Si(n,"strokeThickness",2)),r}return n(a,[{key:"color",get:function(){return this._color},set:function(t){t=ui(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t;}},{key:"color2",get:function(){return this._color2},set:function(t){t=ui(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t;}},{key:"horizontalGradient",get:function(){return this._horizontalGradient},set:function(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t;}},{key:"setColor",value:function(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}},{key:"stroke",get:function(){return this._stroke},set:function(t){t=ui(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t;}},{key:"strokeThickness",get:function(){return this._strokeThickness},set:function(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t;}},{key:"setStroke",value:function(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}},{key:"modifyPorperties",value:function(t){h(s(a.prototype),"modifyPorperties",this).call(this,t),t.hasOwnProperty("color")&&this.setColor(t.color,Si(t,"color2",null),Si(t,"horizontalGradient",!0)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,Si(t,"strokeThickness",2));}},{key:"renderContent",value:function(){var t=this.parent.padding,e=t.left,i=t.top,n=this.parent.width-t.left-t.right,r=this.parent.height-t.top-t.bottom,s=this.context;if(null!=this.color){var a,o;if(null!=this.color2)(o=this.horizontalGradient?s.createLinearGradient(0,0,n,0):s.createLinearGradient(0,0,0,r)).addColorStop(0,this.color),o.addColorStop(1,this.color2),a=o;else a=this.color;s.fillStyle=a,s.fillRect(e,i,n,r);}null!=this.stroke&&this.strokeThickness>0&&(s.strokeStyle=this.stroke,s.lineWidth=this.strokeThickness,s.strokeRect(e,i,n,r));}}]),a}(ai),Oi=Phaser.Utils.Objects.GetValue,xi=function(){function t(i,n){e(this,t),this.parent=i,this.set(n);}return n(t,[{key:"toJSON",value:function(){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}}},{key:"set",value:function(t){return this.setBold(Oi(t,"bold",!1)),this.setItalic(Oi(t,"italic",!1)),this.setFontSize(Oi(t,"fontSize","16px")),this.setFontFamily(Oi(t,"fontFamily","Courier")),this.setColor(Oi(t,"color","#fff")),this.setStrokeStyle(Oi(t,"stroke",null),Oi(t,"strokeThickness",0)),this.setShadow(Oi(t,"shadowColor",null),Oi(t,"shadowOffsetX",0),Oi(t,"shadowOffsetY",0),Oi(t,"shadowBlur",0)),this.setOffset(Oi(t,"offsetX",0),Oi(t,"offsetY",0)),this.setSpace(Oi(t,"leftSpace",0),Oi(t,"rightSpace",0)),this.setAlign(Oi(t,"align",void 0)),this.setBackgroundColor(Oi(t,"backgroundColor",null)),this.setBackgroundHeight(Oi(t,"backgroundHeight",void 0)),this.setBackgroundBottomY(Oi(t,"backgroundBottomY",void 0)),this}},{key:"modify",value:function(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(ci("stroke",t,this),ci("strokeThickness",t,this)),t.hasOwnProperty("shadowColor")&&this.setShadowColor(t.shadowColor),(t.hasOwnProperty("shadowOffsetX")||t.hasOwnProperty("shadowOffsetY"))&&this.setShadowOffset(ci("shadowOffsetX",t,this),ci("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}},{key:"setUpdateTextFlag",value:function(){return this.parent&&(this.parent.updateTextFlag=!0),this}},{key:"clone",value:function(){return new t(null,this.toJSON())}},{key:"copyFrom",value:function(t){return this.set(t.toJSON()),this}},{key:"copyTo",value:function(t){return t.set(this.toJSON()),this}},{key:"setBold",value:function(t){return void 0===t&&(t=!0),this.bold=t,this.setUpdateTextFlag(),this}},{key:"setItalic",value:function(t){return void 0===t&&(t=!0),this.italic=t,this.setUpdateTextFlag(),this}},{key:"fontStyle",get:function(){return this.bold&&this.italic?"bold italic":this.bold?"bold":this.italic?"italic":""}},{key:"setFontSize",value:function(t){return "number"==typeof t&&(t="".concat(t,"px")),this.fontSize=t,this.setUpdateTextFlag(),this}},{key:"setFontFamily",value:function(t){return this.fontFamily=t,this.setUpdateTextFlag(),this}},{key:"font",get:function(){return "".concat(this.fontStyle," ").concat(this.fontSize," ").concat(this.fontFamily)}},{key:"setColor",value:function(t){return this.color=ui(t),this}},{key:"hasFill",get:function(){return null!=this.color}},{key:"setStrokeStyle",value:function(t,e){return this.stroke=ui(t),void 0!==e&&(this.strokeThickness=e),this}},{key:"setStrokeThickness",value:function(t){return this.strokeThickness=t,this}},{key:"hasStroke",get:function(){return null!=this.stroke&&this.strokeThickness>0}},{key:"setShadowColor",value:function(t){return this.shadowColor=ui(t),this}},{key:"setShadowOffset",value:function(t,e){return void 0===t&&(t=0),void 0===e&&(e=0),this.shadowOffsetX=t,this.shadowOffsetY=e,this}},{key:"setShadowBlur",value:function(t){return void 0===t&&(t=0),this.shaodwBlur=t,this}},{key:"setShadow",value:function(t,e,i,n){return this.setShadowColor(t).setShadowOffset(e,i).setShadowBlur(n),this}},{key:"setBackgroundColor",value:function(t){return this.backgroundColor=ui(t),this}},{key:"hasBackgroundColor",get:function(){return null!=this.backgroundColor}},{key:"setBackgroundHeight",value:function(t){return this.backgroundHeight=t,this}},{key:"setBackgroundBottomY",value:function(t){return this.backgroundBottomY=t,this}},{key:"setOffsetX",value:function(t){return void 0===t&&(t=0),this.offsetX=t,this}},{key:"setOffsetY",value:function(t){return void 0===t&&(t=0),this.offsetY=t,this}},{key:"setOffset",value:function(t,e){return this.setOffsetX(t).setOffsetY(e),this}},{key:"setLeftSpace",value:function(t){return void 0===t&&(t=0),this.leftSpace=t,this}},{key:"setRightSpace",value:function(t){return void 0===t&&(t=0),this.rightSpace=t,this}},{key:"setSpace",value:function(t,e){return this.setLeftSpace(t).setRightSpace(e),this}},{key:"setAlign",value:function(t){return this.align=t,this}},{key:"syncFont",value:function(t){return t.font=this.font,this}},{key:"syncStyle",value:function(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}},{key:"syncShadow",value:function(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);}},{key:"getTextMetrics",value:function(t,e){return this.syncFont(t).syncStyle(t),t.measureText(e)}}]),t}(),Mi=Phaser.Utils.Array.Remove,Pi=Phaser.Utils.Array.Remove,Ti="text",Ci="image",_i="drawer",ji="space",Ri="command",Bi=function(t){return t.type===Ti&&"\n"===t.text},Gi=function(t){return t.type===Ti&&"\f"===t.text},Ai=function(t){return t.type===Ti},Di=function(t){return t.type===Ri},Wi=function(t){r(a,t);var i=u(a);function a(t,n,r){var s;return e(this,a),(s=i.call(this,t,Ti)).updateTextFlag=!1,s.style=new xi(o(s),r),s.setText(n),s}return n(a,[{key:"autoRound",get:function(){return this.parent.autoRound}},{key:"offsetX",get:function(){return this.style.offsetX},set:function(t){this.style&&(this.style.offsetX=t);}},{key:"offsetY",get:function(){return this.style.offsetY},set:function(t){this.style&&(this.style.offsetY=t);}},{key:"leftSpace",get:function(){return this.style.leftSpace*this.scaleX},set:function(t){this.style&&(this.style.leftSpace=t),f(s(a.prototype),"leftSpace",t,this,!0);}},{key:"rightSpace",get:function(){return this.style.rightSpace*this.scaleX},set:function(t){this.style&&(this.style.rightSpace=t),f(s(a.prototype),"rightSpace",t,this,!0);}},{key:"align",get:function(){return this.style.align},set:function(t){this.style&&(this.style.align=t);}},{key:"modifyStyle",value:function(t){return this.setDirty(!0),this.style.modify(t),this.updateTextFlag&&this.updateTextSize(),this}},{key:"modifyPorperties",value:function(t){return t?(this.modifyStyle(t),h(s(a.prototype),"modifyPorperties",this).call(this,t),this):this}},{key:"setText",value:function(t){return this.setDirty(this.text!=t),this.text=t,this.updateTextSize(),this}},{key:"updateTextSize",value:function(){var t=this.text;if("\n"===t||"\f"===t||""===t)this.clearTextSize();else {var e,i,n=this.style.getTextMetrics(this.context,this.text);this.textWidth=n.width,"actualBoundingBoxAscent"in n?(e=n.actualBoundingBoxAscent,i=n.actualBoundingBoxDescent):(e=0,i=0),this.textHeight=e+i,this.ascent=e,this.descent=i;}return this.updateTextFlag=!1,this}},{key:"clearTextSize",value:function(){return this.textWidth=0,this.textHeight=0,this.ascent=0,this.descent=0,this}},{key:"copyTextSize",value:function(t){return this.textWidth=t.textWidth,this.textHeight=t.textHeight,this.ascent=t.ascent,this.descent=t.descent,this}},{key:"width",get:function(){return this.textWidth*this.scaleX},set:function(t){this.textWidth>0?this.scaleX=t/this.textWidth:this.scaleX=1;}},{key:"height",get:function(){return this.textHeight*this.scaleY},set:function(t){this.textHeight>0?this.scaleY=t/this.textHeight:this.scaleY=1;}},{key:"willRender",get:function(){return 0!==this.textWidth&&h(s(a.prototype),"willRender",this)}},{key:"renderContent",value:function(){var t=this.context,e=this.style;if(e.hasBackgroundColor){t.fillStyle=e.backgroundColor;var i=this.drawTLX,n=this.drawTRX-i,r=e.backgroundBottomY;null==r&&(r=this.drawBLY);var s=e.backgroundHeight;null==s&&(s=r-this.drawTLY);var a=r-s;t.fillRect(i,a,n,s);}var o=e.hasFill,u=e.hasStroke;(o||u)&&(e.syncFont(t).syncStyle(t),u&&(e.syncShadow(t),t.strokeText(this.text,0,0)),o&&(e.syncShadow(t),t.fillText(this.text,0,0)));}},{key:"drawTLX",get:function(){return -this.leftSpace}},{key:"drawTLY",get:function(){return -this.ascent}},{key:"drawBLX",get:function(){return -this.leftSpace}},{key:"drawBLY",get:function(){return this.descent}},{key:"drawTRX",get:function(){return this.textWidth+this.rightSpace}},{key:"drawTRY",get:function(){return -this.ascent}},{key:"drawBRX",get:function(){return this.textWidth+this.rightSpace}},{key:"drawBRY",get:function(){return this.descent}}]),a}(ai),Li=function(t,e){var i=this.createCharChildren(t,e);return this.addChild(i),this},Fi=function(t){r(s,t);var i=u(s);function s(t,n,r){var a;return e(this,s),(a=i.call(this,t,Ci)).setTexture(n,r),a}return n(s,[{key:"frameWidth",get:function(){return this.frameObj?this.frameObj.cutWidth:0}},{key:"frameHeight",get:function(){return this.frameObj?this.frameObj.cutHeight:0}},{key:"offsetY",get:function(){return -this.height},set:function(t){}},{key:"key",get:function(){return this._key},set:function(t){this.setDirty(this._key!=t),this._key=t;}},{key:"frame",get:function(){return this._frame},set:function(t){this.setDirty(this._frame!=t),this._frame=t;}},{key:"setTexture",value:function(t,e){return this.key=t,this.frame=e,this.frameObj=this.scene.sys.textures.getFrame(t,e),this}},{key:"width",get:function(){return this.frameWidth*this.scaleX},set:function(t){this.setDirty(this.width!==t),this.scaleX=t/this.frameWidth;}},{key:"height",get:function(){return this.frameHeight*this.scaleY},set:function(t){this.setDirty(this.height!==t),this.scaleY=t/this.frameHeight;}},{key:"setHeight",value:function(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}},{key:"renderContent",value:function(){var t=this.context,e=this.frameObj,i=this.frameWidth,n=this.frameHeight;t.drawImage(e.source.image,e.cutX,e.cutY,i,n,0,0,i,n);}},{key:"drawTLX",get:function(){return -this.leftSpace}},{key:"drawTLY",get:function(){return 0}},{key:"drawBLX",get:function(){return -this.leftSpace}},{key:"drawBLY",get:function(){return this.frameHeight}},{key:"drawTRX",get:function(){return this.frameWidth+this.rightSpace}},{key:"drawTRY",get:function(){return 0}},{key:"drawBRX",get:function(){return this.frameWidth+this.rightSpace}},{key:"drawBRY",get:function(){return this.frameHeight}}]),s}(ai),Xi=function(t,e,i){var n=this.createImageChild(t,e,i);return this.addChild(n),this},Yi=function(t){r(a,t);var i=u(a);function a(t,n,r,s){var o;return e(this,a),(o=i.call(this,t,_i)).setRenderCallback(n),o.setDrawerSize(r,s),o}return n(a,[{key:"setRenderCallback",value:function(t){return t?this.renderContent=t.bind(this):delete this.renderContent,this}},{key:"setDrawerSize",value:function(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}},{key:"onFree",value:function(){h(s(a.prototype),"onFree",this).call(this),this.setRenderCallback();}},{key:"width",get:function(){return this.drawerWidth*this.scaleX},set:function(t){this.setDirty(this.width!==t),this.scaleX=this.drawerWidth>0?t/this.drawerWidth:1;}},{key:"height",get:function(){return this.drawerHeight*this.scaleY},set:function(t){this.setDirty(this.height!==t),this.scaleY=this.drawerHeight>0?t/this.drawerHeight:1;}},{key:"offsetY",get:function(){return -this.height},set:function(t){}},{key:"drawTLX",get:function(){return -this.leftSpace}},{key:"drawTLY",get:function(){return 0}},{key:"drawBLX",get:function(){return -this.leftSpace}},{key:"drawBLY",get:function(){return this.drawerHeight}},{key:"drawTRX",get:function(){return this.drawerWidth+this.rightSpace}},{key:"drawTRY",get:function(){return 0}},{key:"drawBRX",get:function(){return this.drawerWidth+this.rightSpace}},{key:"drawBRY",get:function(){return this.drawerHeight}}]),a}(ai),Ii=function(t){r(s,t);var i=u(s);function s(t,n){var r;return e(this,s),(r=i.call(this,t,ji)).setSpaceWidth(n),r}return n(s,[{key:"width",get:function(){return this.spaceWidth*this.scaleX},set:function(t){this.spaceWidth>0?this.scaleX=t/this.spaceWidth:this.scaleX=1;}},{key:"setSpaceWidth",value:function(t){return this.spaceWidth=t,this}}]),s}(ai),Vi=function(t){var e=this.createSpaceChild(t);return this.addChild(e),this},zi=function(t){r(a,t);var i=u(a);function a(t,n,r,s,o){var u;return e(this,a),(u=i.call(this,t,Ri)).setName(n).setParameter(s).setCallback(r,o),u}return n(a,[{key:"setName",value:function(t){return this.name=t,this}},{key:"setParameter",value:function(t){return this.param=t,this}},{key:"setCallback",value:function(t,e){return this.callback=t,this.scope=e,this}},{key:"exec",value:function(){return this.scope?this.callback.call(this.scope,this.param,this.name):this.callback(this.param,this.name)}},{key:"onFree",value:function(){h(s(a.prototype),"onFree",this).call(this),this.setName().setCallback().setParameter();}}]),a}(Xe),Ui=function(t,e,i,n){var r=this.createCommandChild(t,e,i,n);return this.addChild(r),this},Ni=function e(i){var n,r,s;if(null==i||"object"!==t(i))return i;if(n=Array.isArray(i)?[]:{},function(e){if("object"!==t(e)||e.nodeType||e===e.window)return !1;try{if(e.constructor&&!{}.hasOwnProperty.call(e.constructor.prototype,"isPrototypeOf"))return !1}catch(t){return !1}return !0}(i))for(s in i)r=i[s],n[s]=e(r);else n=i;return n},Hi=function(t,e,i,n){void 0===n&&(n={word:[],width:0}),n.word.length=0;for(var r=t.length,s=e,a=n.word,o=0;s0&&!o){var u=this.fixedHeight-n;if(i>0)s=u/i;else s=(c=qi.call(this)).height,a=c.ascent,i=Math.floor((u-a)/s);}else {var c;s=(c=qi.call(this)).height,a=c.ascent;}}else if(this.fixedHeight>0){if(void 0===(i=Qi(t,"maxLines"))){u=this.fixedHeight-n;i=Math.floor(u/s);}}else i=Qi(t,"maxLines",0);void 0===a&&(a=s);var h=0===i,l=Qi(t,"wrapWidth",void 0);void 0===l&&(l=this.fixedWidth>0?this.fixedWidth-r:1/0);for(var f=Qi(t,"letterSpacing",0),d=Qi(t,"hAlign",0),g=Qi(t,"vAlign",0),p=Qi(t,"charWrap",!1),v={callback:"runWordWrap",start:e,isLastPage:!1,padding:this.wrapPadding,ascent:a,lineHeight:s,maxLines:i,wrapWidth:l,letterSpacing:f,hAlign:d,vAlign:g,charWrap:p,children:[],lines:[],maxLineWidth:0,linesHeight:0},y=this.children,m=0,k=y.length;m0&&(T.push({children:C,width:_}),j=Math.max(j,_)),v.start+=P.length,v.isLastPage=!R&&v.start===M,v.maxLineWidth=j,v.linesHeight=T.length*s;var F=this.fixedWidth>0?this.fixedWidth:v.maxLineWidth+r,X=this.fixedHeight>0?this.fixedHeight:v.linesHeight+n;!function(t,e,i){var n,r,s=t.hAlign,a=t.vAlign,o=t.linesHeight;switch(a){case 1:case"center":r=(i-o)/2;break;case 2:case"bottom":r=i-o;break;default:r=0;}for(var u=t.lines,c=0,h=u.length;c0?(a=this.fixedWidth-r)/i:0;else if(this.fixedWidth>0){if(void 0===(i=en(t,"maxLines",void 0))){var a=this.fixedWidth-r;i=Math.floor(a/s)+1;}}else i=en(t,"maxLines",0);var o=0===i,u=en(t,"fixedChildHeight",void 0);if(void 0===u){var c=en(t,"charPerLine",void 0);if(void 0!==c){var h=this.fixedHeight-n;u=Math.floor(h/c);}}var l=en(t,"wrapHeight",void 0);void 0===l&&(l=this.fixedHeight>0?this.fixedHeight-n:1/0);for(var f=en(t,"letterSpacing",0),d=en(t,"rtl",!0),g=en(t,"hAlign",d?2:0),p=en(t,"vAlign",0),v={callback:"runVerticalWrap",start:e,isLastPage:!1,padding:this.wrapPadding,lineWidth:s,maxLines:i,fixedChildHeight:u,wrapHeight:l,letterSpacing:f,hAlign:g,vAlign:p,rtl:d,children:[],lines:[],maxLineHeight:0,linesWidth:0},y=this.children,m=0,k=y.length;m0&&(T.push({children:C,height:_}),j=Math.max(j,_)),v.start+=P.length,v.isLastPage=v.start===M,v.maxLineHeight=j,v.linesWidth=T.length*s;var W=this.fixedWidth>0?this.fixedWidth:v.linesWidth+r,L=this.fixedHeight>0?this.fixedHeight:v.maxLineHeight+n;!function(t,e,i){var n,r,s=t.hAlign,a=t.vAlign,o=t.rtl,u=t.lines,c=t.lineWidth,h=t.linesWidth;switch(s){case 1:case"center":n=(e-h)/2;break;case 2:case"right":n=e-h;break;default:n=0;}o&&(n+=c);for(var l=0,f=u.length;l0?t:this.width,e>0?e:this.height),this):this},setPadding:function(t,e){var i=this.padding,n=i.left,r=i.right,s=i.top,a=i.bottom;return Le(i,t,e),this.dirty=this.dirty||n!=i.left||r!=i.right||s!=i.top||a!=i.bottom,this},getPadding:function(t){return function(t,e){return void 0===e?t:t[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),Mi(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 Pi(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,n,r,s=Array.isArray(t);void 0===e||e===this.children.length?s?(i=this.children).push.apply(i,p(t)):this.children.push(t):s?(n=this.children).splice.apply(n,[e,0].concat(p(t))):this.children.splice(e,0,t);(this.lastAppendedChildren.length=0,s)?(r=this.lastAppendedChildren).push.apply(r,p(t)):this.lastAppendedChildren.push(t);return this},createCharChild:function(t,e){e&&this.textStyle.modify(e);var i=this.poolManager.allocate(Ti);return null===i?i=new Wi(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=[],n=0,r=t.length;ne&&(n=e,r=t);})),r},getCharWorldPosition:function(t,e,i,n){return "number"==typeof t&&(t=this.getCharChild(t,!0)),ei(this,t,e,i,n)},setToMinSize:function(){for(var t=this.children,e=0,i=0,n=0,r=t.length;n=i.length&&(t=i.length);for(var n=0,r=0;r");this.setDelimiters(n[0],n[1]),this.setTranslateTagNameCallback(ye(i,"translateTagNameCallback")),this.isRunning=!1,this.isPaused=!1,this.skipEventFlag=!1,this.justCompleted=!1,this.lastTagStart=null,this.lastTagEnd=null,this.lastContent=null;}return n(t,[{key:"shutdown",value:function(){this.destroyEventEmitter();}},{key:"destroy",value:function(){this.shutdown();}},{key:"setMultipleLinesTagEnable",value:function(t){return void 0===t&&(t=!0),this.multipleLinesTagEnable=t,this}},{key:"setDelimiters",value:function(t,e){void 0===e&&(e=t[1],t=t[0]),this.delimiterLeft=t,this.delimiterRight=e,t=jn(this.delimiterLeft),e=jn(this.delimiterRight);var i=this.multipleLinesTagEnable?"gs":"gi";return this.reSplit=RegExp("".concat(t,"(.+?)").concat(e),i),this}},{key:"setTranslateTagNameCallback",value:function(t){return this.translateTagNameCallback=t,this}},{key:"setValueConverter",value:function(t){return !0===t?t=_n:t||(t=An),this.valueConverter=t,this}},{key:"setLoopEnable",value:function(t){return void 0===t&&(t=!0),this.loopEnable=t,this}},{key:"setSource",value:function(t){return this.source=t,this}},{key:"resetIndex",value:function(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}},{key:"start",value:function(t){return this.setSource(t).restart(),this}},{key:"restart",value:function(){this.resetIndex().next();}},{key:"next",value:function(){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");return n.setDelimiters(r[0],r[1]),n}return n(a,[{key:"setTagExpression",value:function(t){return t||(t=Wn),this.tagExpression=t,this}},{key:"setValueExpression",value:function(t){return t||(t=Wn),this.valueExpression=t,this}},{key:"setDelimiters",value:function(t,e){h(s(a.prototype),"setDelimiters",this).call(this,t,e);var i="(".concat(this.tagExpression,")(=(").concat(this.valueExpression,"))?");if(this.reTag=RegExp(i,"i"),this.tagExpression!==Wn||this.valueExpression!==Wn){var n="".concat(this.tagExpression,"(=").concat(this.valueExpression,")?"),r="/".concat(this.tagExpression);t=jn(this.delimiterLeft),e=jn(this.delimiterRight);var o=this.multipleLinesTagEnable?"gs":"gi";this.reSplit=RegExp("".concat(t,"((").concat(n,")|(").concat(r,"))").concat(e),o);}return this}},{key:"onTag",value:function(t){var e=t.match(this.reTag),i=e[1],n="/"===i.charAt(0);if(n&&(i=i.substring(1,i.length)),this.translateTagNameCallback&&(i=this.translateTagNameCallback(i)),this.skipEventFlag=!1,n)this.emit("-".concat(i)),this.skipEventFlag||this.emit("-",i),this.lastTagEnd=i;else {var r=function(t,e){if(null==t)return [];void 0===e&&(e=_n);for(var i=t.split(","),n=0,r=i.length;n1?r-1:0),a=1;a1&&-1!==e.indexOf("|")?e.split("|"):[e]).length;s0){var a=this.timeline.addTimer({name:Yr,target:r,duration:s.duration,yoyo:s.yoyo,onStart:s.onStart,onProgress:s.onProgress,onComplete:s.onComplete});this.skipTypingAnimation&&a.seek(1);}else s.onStart&&s.onStart(r,0);this.minSizeEnable&&this.textPlayer.setToMinSize(),this.textPlayer.emit("typing",r);var o=this.nextChild;if(o)if(this.skipSpaceEnable&&((i=o).type===Ti&&" "===i.text));else if(n+=this.speed+e,e=0,n>0){this.typingTimer=this.timeline.addTimer({name:"delay",target:this,duration:n,onComplete:function(e,i,n){e.typingTimer=void 0,t.call(e,n.remainder);}});break}}else Di(r)&&r.exec();}this.minSizeEnable&&this.textPlayer.setToMinSize(),this.inTypingProcessLoop=!1;},pause:function(){return this.timeline.pause(),this},resume:function(){return this.timeline.resume(),this},pauseTyping:function(){return this.isTypingPaused||(this.typingTimer?(this.typingTimer.pause(),this.isTypingPaused=!0):this.inTypingProcessLoop&&(this.inTypingProcessLoop=!1,this.isTypingPaused=!0)),this},resumeTyping:function(t){return this.isTypingPaused?(void 0===t&&(t=0),this.typingTimer?(this.isTypingPaused=!1,this.typingTimer.resume(),this.typingTimer.remainder+=t):this.isTypingPaused&&(this.isTypingPaused=!1,this.typing(t)),this):this},wait:function(t){return this.ignoreWait||(this.pauseTyping(),Nr(this.textPlayer,t,this.resumeTyping,this)),this},setIgnoreWait:function(t){return void 0===t&&(t=!0),this.ignoreWait=t,this},setSkipSpaceEnable:function(t){return void 0===t&&(t=!0),this.skipSpaceEnable=t,this},setSkipTypingAnimation:function(t){if(void 0===t&&(t=!0),this.skipTypingAnimation=t,t)for(var e=this.timeline.getTimers(Yr),i=0,n=e.length;i0&&a.chainAnimation(i,n);},hs=function(t){var e,i,n=g(t);e=n[0],i=n.slice(1);var r=this.getGameObjectManager(e);r.stopAnimation.apply(r,p(i));},ls=function(t){var e,i,n=g(t);e=n[0],i=n.slice(1);var r=this.getGameObjectManager(e);r.pauseAnimation.apply(r,p(i));},fs=function(t){var e,i,n=g(t);e=n[0],i=n.slice(1);var r=this.getGameObjectManager(e);r.chainAnimation.apply(r,p(i));},ds=[function(t,e,i){var n=i.name;e.on("+",(function(i){if(!e.skipEventFlag){var r,s=i.split(".");if(us(s,n)){r=s[1];for(var a=arguments.length,o=new Array(a>1?a-1:0),u=1;u0)){var o=this.getGameObjectManager(e);o.hasMethod(i,n)?o.call.apply(o,[i,n].concat(p(r))):o.setProperty(i,n,r[0]);}},bs={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},ws=function(t){var e,i,n,r,s,a,o,u,c=d(t,8);e=c[0],i=c[1],n=c[2],r=c[3],s=c[4],a=c[5],o=c[6],u=c[7];var h=this.getGameObjectManager(e),l=h.getProperty(i,n);if("number"==typeof l){u.endsWith("Left")||u.endsWith("Up")?u.startsWith("to")||u.startsWith("yoyo")?r=l-r:u.startsWith("from")&&(h.setProperty(i,n,l-r),r=l):u.endsWith("Right")||u.endsWith("Down")?u.startsWith("to")||u.startsWith("yoyo")?r=l+r:u.startsWith("from")&&(h.setProperty(i,n,l+r),r=l):"from"===u&&(h.setProperty(i,n,r),r=l);var f=u.startsWith("yoyo");h.easeProperty(i,n,r,s,a,o,f);}},Ss=[function(t,e,i){var n=i.name;e.on("+",(function(i){if(!e.skipEventFlag){var r,s=i.split(".");if(ps(s,n)){r=s[1];for(var a=arguments.length,o=new Array(a>1?a-1:0),u=1;u1?o-1:0),c=1;ct.length)&&(e=t.length);for(var i=0,n=new Array(e);i1?i-1:0),r=1;r0&&void 0!==t.setTint},useAlphaFadeEffect:function(t){return (void 0===this.fadeMode||1===this.fadeMode)&&this.fadeTime>0&&void 0!==t.setAlpha},useRevealEffect:function(t){return this.fadeMode>=2&&this.fadeMode<=5&&this.fadeTime>0&&(t.preFX||t.postFX)},fadeBob:function(t,e,i,n){var r=t.gameObject;if(this.useTintFadeEffect(r))void 0!==e&&t.setProperty("tintGray",255*e),t.easeProperty("tintGray",Math.floor(255*i),this.fadeTime,"Linear",0,!1,n);else if(this.useAlphaFadeEffect(r))void 0!==e&&t.setProperty("alpha",e),t.easeProperty("alpha",i,this.fadeTime,"Linear",0,!1,n);else if(this.useRevealEffect(r)){var s;switch(j(r,"reveal"),this.fadeMode){case 2:s="revealUp";break;case 3:s="revealDown";break;case 4:s="revealLeft";break;case 5:s="revealRight";}void 0===e&&(e=0),r[s]=e,t.easeProperty(s,i,this.fadeTime,"Linear",0,!1,n),t.getTweenTask(s).once("complete",(function(){r[s]=null;}));}else n&&n(r);return this}},G=function(t){return t>>16&255},A=function(t){return t>>8&255},D=function(t){return 255&t},W=Phaser.Events.EventEmitter,L=function(t,e,i,n,r,s){return void 0===s?s={}:!0===s&&(s=F),"number"!=typeof i&&(i=0,n=0),s.x=r.x+r.width*t+i,s.y=r.y+r.height*e+n,s},F={},X=function(t,e,i,n,r,s,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===n&&(n=.5),void 0===r&&(r=0),void 0===s&&(s=0),void 0===a&&(a=L),function(t){if(t.events)return t;var e=new W,i=t.x;Object.defineProperty(t,"x",{get:function(){return i},set:function(n){i!==n&&(i=n,e.emit("update",t));}});var n=t.y;Object.defineProperty(t,"y",{get:function(){return n},set:function(i){n!==i&&(n=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 s=t.height;Object.defineProperty(t,"height",{get:function(){return s},set:function(i){s!==i&&(s=i,e.emit("update",t));}}),t.events=e;}(e);var o=e.events;t.vp=e;var u=function(){a(i,n,r,s,e,t);};o.on("update",u),t.once("destroy",(function(){o.off("update",u),t.vp=void 0;})),Object.defineProperty(t,"vpx",{get:function(){return i},set:function(t){i!==t&&(i=t,u());}}),Object.defineProperty(t,"vpy",{get:function(){return n},set:function(t){n!==t&&(n=t,u());}}),Object.defineProperty(t,"vpxOffset",{get:function(){return r},set:function(t){r!==t&&(r=t,u());}}),Object.defineProperty(t,"vpyOffset",{get:function(){return s},set:function(t){s!==t&&(s=t,u());}}),u();},Y=Phaser.Utils.Array.Remove,I={has:function(t){return this.bobs.hasOwnProperty(t)},exists:function(t){return this.bobs.hasOwnProperty(t)},get:function(t){return this.bobs[t]},getGO:function(t){var e=this.get(t);return e?e.gameObject:null},addGO:function(t,e){this.remove(t,!0),this.useTintFadeEffect(e)&&function(t,e){if(t.hasOwnProperty("tintR"))return t;void 0===e&&(e=16777215);var i=G(e),n=A(e),r=D(e);Object.defineProperty(t,"tint",{get:function(){return e},set:function(s){s=16777215&Math.floor(s),t.setTint&&t.setTint(s),e!==s&&(i=G(e=s),n=A(e),r=D(e));}}),Object.defineProperty(t,"tintR",{get:function(){return i},set:function(n){n=255&Math.floor(n),i!==n&&(i=n,t.tint=(255&n)<<16|65535&e);}}),Object.defineProperty(t,"tintG",{get:function(){return n},set:function(i){i=255&Math.floor(i),n!==i&&(n=i,t.tint=(255&i)<<8|16711935&e);}}),Object.defineProperty(t,"tintB",{get:function(){return r},set:function(i){i=255&Math.floor(i),r!==i&&(r=i,t.tint=255&i|16776960&e);}}),Object.defineProperty(t,"tintGray",{get:function(){return Math.floor((i+n+r)/3)},set:function(e){e=255&Math.floor(e),i===e&&n===e&&r===e||(i=e,n=e,r=e,t.tint=(255&e)<<16|(255&e)<<8|255&e);}}),t.tint=e;}(e),this.viewportCoordinateEnable&&X(e,this.viewport),this.effectPropertiesConfig&&j(e,this.effectPropertiesConfig),e.once("destroy",(function(){Y(this.removedGOs,e),this.isEmpty&&this.emit("empty");}),this);var i=new this.BobClass(this,e,t);return this.bobs[t]=i,this},add:function(t){for(var e=this.createGameObjectCallback,i=this.createGameObjectScope,n=arguments.length,r=new Array(n>1?n-1:0),s=1;s2?n-2:0),s=2;s0?-this.delay:0,this.state=this.nowTime>=0?_t:Ct,this.repeatCounter=0,this}},{key:"stop",value:function(){return this.state=Tt,this}},{key:"update",value:function(t,e){this.state!==Tt&&this.state!==Rt&&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=jt)):(this.nowTime=this.duration,this.state=Rt):this.nowTime>=0&&(this.state=_t));}},{key:"t",get:function(){var t;switch(this.state){case Tt:case Ct:case jt:t=0;break;case _t:t=this.nowTime/this.duration;break;case Rt:t=1;}return Mt(t,0,1)},set:function(t){(t=Mt(t,-1,1))<0?(this.state=Ct,this.nowTime=-this.delay*t):(this.state=_t,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++);}},{key:"setT",value:function(t){return this.t=t,this}},{key:"isIdle",get:function(){return this.state===Tt}},{key:"isDelay",get:function(){return this.state===Ct}},{key:"isCountDown",get:function(){return this.state===_t}},{key:"isRunning",get:function(){return this.state===Ct||this.state===_t}},{key:"isDone",get:function(){return this.state===Rt}},{key:"isOddIteration",get:function(){return 1==(1&this.repeatCounter)}},{key:"isEvenIteration",get:function(){return 0==(1&this.repeatCounter)}}]),t}(),Tt=0,Ct=1,_t=2,jt=3,Rt=-1,Bt=function(t){r(a,t);var i=u(a);function a(t,n){var r;return e(this,a),(r=i.call(this,t,n)).timer=new Pt,r}return n(a,[{key:"shutdown",value:function(t){this.isShutdown||(h(s(a.prototype),"shutdown",this).call(this,t),this.timer.destroy(),this.timer=void 0);}},{key:"start",value:function(){return this.timer.start(),h(s(a.prototype),"start",this).call(this),this}},{key:"stop",value:function(){return this.timer.stop(),h(s(a.prototype),"stop",this).call(this),this}},{key:"complete",value:function(){return this.timer.stop(),h(s(a.prototype),"complete",this).call(this),this}}]),a}(Et),Gt=Phaser.Utils.Objects.GetValue,At=Phaser.Utils.Objects.GetAdvancedValue,Dt=Phaser.Tweens.Builders.GetEaseFunction,Wt=function(t){r(a,t);var i=u(a);function a(){return e(this,a),i.apply(this,arguments)}return n(a,[{key:"resetFromJSON",value:function(t){return this.timer.resetFromJSON(Gt(t,"timer")),this.setEnable(Gt(t,"enable",!0)),this.setTarget(Gt(t,"target",this.parent)),this.setDelay(At(t,"delay",0)),this.setDuration(At(t,"duration",1e3)),this.setEase(Gt(t,"ease","Linear")),this.setRepeat(Gt(t,"repeat",0)),this}},{key:"setEnable",value:function(t){return null==t&&(t=!0),this.enable=t,this}},{key:"setTarget",value:function(t){return void 0===t&&(t=this.parent),this.target=t,this}},{key:"setDelay",value:function(t){return this.delay=t,this}},{key:"setDuration",value:function(t){return this.duration=t,this}},{key:"setRepeat",value:function(t){return this.repeat=t,this}},{key:"setRepeatDelay",value:function(t){return this.repeatDelay=t,this}},{key:"setEase",value:function(t){return void 0===t&&(t="Linear"),this.ease=t,this.easeFn=Dt(t),this}},{key:"start",value:function(){return this.timer.isRunning||h(s(a.prototype),"start",this).call(this),this}},{key:"restart",value:function(){return this.timer.stop(),this.start.apply(this,arguments),this}},{key:"stop",value:function(t){return void 0===t&&(t=!1),h(s(a.prototype),"stop",this).call(this),t&&(this.timer.setT(1),this.updateGameObject(this.target,this.timer),this.complete()),this}},{key:"update",value:function(t,e){if(!this.isRunning||!this.enable||!this.parent.active)return this;var i=this.target,n=this.timer;return n.update(t,e),n.isDelay||this.updateGameObject(i,n),this.emit("update",i,this),n.isDone&&this.complete(),this}},{key:"updateGameObject",value:function(t,e){}}]),a}(Bt),Lt=Phaser.Sound.BaseSound,Ft=function(t){return t instanceof Lt},Xt=Phaser.Utils.Objects.GetValue,Yt=Phaser.Utils.Objects.GetAdvancedValue,It=Phaser.Math.Linear,Vt=function(t){r(a,t);var i=u(a);function a(t,n,r){var s;return e(this,a),Ft(t)&&(r=n,n=t,t=void 0),n.active=!0,n.scene=t,n.game=n.manager.game,(s=i.call(this,n,r)).volume={},s.resetFromJSON(r),s}return n(a,[{key:"resetFromJSON",value:function(t){return h(s(a.prototype),"resetFromJSON",this).call(this,t),this.setMode(Xt(t,"mode",0)),this.setEnable(Xt(t,"enable",!0)),this.setVolumeRange(Yt(t,"volume.start",this.parent.volume),Yt(t,"volume.end",0)),this}},{key:"setMode",value:function(t){return "string"==typeof t&&(t=zt[t]),this.mode=t,this}},{key:"setVolumeRange",value:function(t,e){return this.volume.start=t,this.volume.end=e,this}},{key:"start",value:function(){return this.timer.isRunning||(this.parent.setVolume(this.volume.start),this.timer.setDelay(this.delay).setDuration(this.duration),h(s(a.prototype),"start",this).call(this)),this}},{key:"updateGameObject",value:function(t,e){t.volume=It(this.volume.start,this.volume.end,e.t);}},{key:"complete",value:function(){switch(h(s(a.prototype),"complete",this).call(this),this.mode){case 1:this.parent.stop();break;case 2:this.parent.destroy();}return this}}]),a}(Wt),zt={stop:1,destroy:2},Ut=function(t,e,i,n,r){Ft(t)&&(r=n,n=i,i=e,e=t,t=void 0),void 0===n&&(n=1),void 0===r&&(r=0);var s,a={mode:0,volume:{start:r,end:n},duration:i};return "string"==typeof e&&(e=t.sys.sound.add(e)),e.hasOwnProperty("_fade")?(s=e._fade).stop().resetFromJSON(a):(s=new Vt(t,e,a),e._fade=s),s.start(),e.isPlaying||e.setVolume(r).play(),e},Nt=function(t,e,i,n){Ft(t)&&(n=i,i=e,e=t,t=void 0),void 0===n&&(n=!0);var r,s={mode:n?2:1,volume:{start:e.volume,end:0},duration:i};return e.hasOwnProperty("_fade")?(r=e._fade).stop().resetFromJSON(s):(r=new Vt(t,e,s),e._fade=r),r.start(),e.isPlaying||e.play(),e},Ht=Phaser.Utils.Objects.GetValue,Jt={setBackgroundMusicLoop:function(t){return void 0===t&&(t=!0),this.backgroundMusicLoop=t,this},setBackgroundMusicFadeTime:function(t){return this.backgroundMusicFadeTime=t,this},getBackgroundMusic:function(){return this.backgroundMusic},setCurrentBackgroundMusic:function(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:function(t,e){if(this.backgroundMusic&&this.backgroundMusic.key===t)return this;this.stopBackgroundMusic();var i=this.sound.add(t,{loop:Ht(e,"loop",this.backgroundMusicLoop),mute:Ht(e,"mute",this.backgroundMusicMute),volume:Ht(e,"volume",this.backgroundMusicVolume),detune:Ht(e,"detune",0),rate:Ht(e,"rate",1)});return this.setCurrentBackgroundMusic(i),this.backgroundMusicFadeTime>0&&this.fadeInBackgroundMusic(this.backgroundMusicFadeTime),this},pauseBackgroundMusic:function(){return this.backgroundMusic&&this.backgroundMusic.pause(),this},resumeBackgroundMusic:function(){return this.backgroundMusic&&this.backgroundMusic.resume(),this},stopBackgroundMusic:function(){return this.backgroundMusic&&(this.backgroundMusicFadeTime>0?this.fadeOutBackgroundMusic(this.backgroundMusicFadeTime,!0):(this.backgroundMusic.stop(),this.backgroundMusic.destroy(),this.backgroundMusic=void 0)),this},fadeInBackgroundMusic:function(t){return this.backgroundMusic&&Ut(this.backgroundMusic,t,this.backgroundMusicVolume,0),this},fadeOutBackgroundMusic:function(t,e){return this.backgroundMusic&&Nt(this.backgroundMusic,t,e),this},crossFadeBackgroundMusic:function(t,e){var i=this.backgroundMusicFadeTime;return this.backgroundMusicFadeTime=0,this.fadeOutBackgroundMusic(e,!0).playBackgroundMusic(t).fadeInBackgroundMusic(e),this.backgroundMusicFadeTime=i,this},setBackgroundMusicMute:function(t){return void 0===t&&(t=!0),this.backgroundMusicMute=t,this},setBackgroundMusicVolume:function(t){return this.backgroundMusicVolume=t,this},setBackgroundMusicRate:function(t){return this.backgroundMusic&&this.backgroundMusic.setRate(t),this},setBackgroundMusicDetune:function(t){return this.backgroundMusic&&this.backgroundMusic.setDetune(t),this}},Kt=Phaser.Utils.Objects.GetValue,qt={setBackgroundMusic2Loop:function(t){return void 0===t&&(t=!0),this.backgroundMusic2Loop=t,this},setBackgroundMusic2FadeTime:function(t){return this.backgroundMusic2FadeTime=t,this},getBackgroundMusic2:function(){return this.backgroundMusic2},setCurrentBackgroundMusic2:function(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:function(t,e){if(this.backgroundMusic2&&this.backgroundMusic2.key===t)return this;this.stopBackgroundMusic2();var i=this.sound.add(t,{loop:Kt(e,"loop",this.backgroundMusicLoop),mute:Kt(e,"mute",this.backgroundMusic2Mute),volume:Kt(e,"volume",this.backgroundMusic2Volume),detune:Kt(e,"detune",0),rate:Kt(e,"rate",1)});return this.setCurrentBackgroundMusic2(i),this.backgroundMusic2FadeTime>0&&this.fadeInBackgroundMusic2(this.backgroundMusic2FadeTime),this},pauseBackgroundMusic2:function(){return this.backgroundMusic2&&this.backgroundMusic2.pause(),this},resumeBackgroundMusic2:function(){return this.backgroundMusic2&&this.backgroundMusic2.resume(),this},stopBackgroundMusic2:function(){return this.backgroundMusic2&&(this.backgroundMusic2FadeTime>0?this.fadeOutBackgroundMusic2(this.backgroundMusic2FadeTime,!0):(this.backgroundMusic2.stop(),this.backgroundMusic2.destroy(),this.backgroundMusic2=void 0)),this},fadeInBackgroundMusic2:function(t){return this.backgroundMusic2&&Ut(this.backgroundMusic2,t,this.backgroundMusic2Volume,0),this},fadeOutBackgroundMusic2:function(t,e){return this.backgroundMusic2&&Nt(this.backgroundMusic2,t,e),this},crossFadeBackgroundMusic2:function(t,e){var i=this.backgroundMusic2FadeTime;return this.backgroundMusic2FadeTime=0,this.fadeOutBackgroundMusic2(e,!0).playBackgroundMusic2(t).fadeInBackgroundMusic2(e),this.backgroundMusic2FadeTime=i,this},setBackgroundMusic2Mute:function(t){return void 0===t&&(t=!0),this.backgroundMusic2Mute=t,this},setBackgroundMusic2Volume:function(t){return this.backgroundMusic2Volume=t,this},setBackgroundMusic2Rate:function(t){return this.backgroundMusic2&&this.backgroundMusic2.setRate(t),this},setBackgroundMusic2Detune:function(t){return this.backgroundMusic2&&this.backgroundMusic2.setDetune(t),this}},$t=Phaser.Utils.Array.Remove,Qt=Phaser.Utils.Objects.GetValue,Zt={getSoundEffects:function(){return this.soundEffects},getLastSoundEffect:function(){return this.soundEffects[this.soundEffects.length-1]},playSoundEffect:function(t,e){var i=this.sound.add(t,{mute:Qt(e,"mute",this.soundEffectsMute),volume:Qt(e,"volume",this.soundEffectsVolume),detune:Qt(e,"detune",0),rate:Qt(e,"rate",1)});return this.soundEffects.push(i),i.once("complete",(function(){i.destroy(),this.sound&&$t(this.soundEffects,i);}),this).once("destroy",(function(){this.sound&&$t(this.soundEffects,i);}),this).play(),this},stopAllSoundEffects:function(){for(var t=this.soundEffects.length-1;t>=0;t--){var e=this.soundEffects[t];e.stop(),e.destroy();}return this},fadeInSoundEffect:function(t){var e=this.getLastSoundEffect();return e&&Ut(e,t,this.soundEffectsVolume,0),this},fadeOutSoundEffect:function(t,e){var i=this.getLastSoundEffect();return i&&Nt(i,t,e),this},fadeOutAllSoundEffects:function(t,e){for(var i=this.soundEffects.length-1;i>=0;i--)Nt(this.soundEffects[i],t,e);return this},setSoundEffectMute:function(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:function(t,e){if(void 0===e&&(e=!1),e){var i=this.getLastSoundEffect();i&&i.setVolume(t);}else this.soundEffectsVolume=t;return this},setSoundEffectDetune:function(t,e){var i;void 0===e&&(e=!1);for(var n=0,r=(i=e?[this.getLastSoundEffect()]:this.soundEffects).length;n=0;t--){var e=this.soundEffects[t];e.stop(),e.destroy();}return this},fadeInSoundEffect2:function(t){var e=this.getLastSoundEffect2();return e&&Ut(e,t,this.soundEffects2Volume,0),this},fadeOutSoundEffect2:function(t,e){var i=this.getLastSoundEffect2();return i&&Nt(i,t,e),this},fadeOutAllSoundEffects2:function(t,e){for(var i=this.soundEffects2.length-1;i>=0;i--)Nt(this.soundEffects2[i],t,e);return this},setSoundEffect2Mute:function(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:function(t,e){if(void 0===e&&(e=!1),e){var i=this.getLastSoundEffect2();i&&i.setVolume(t);}else this.soundEffects2Volume=t;return this},setSoundEffect2Detune:function(t,e){var i;void 0===e&&(e=!1);for(var n=0,r=(i=e?[this.getLastSoundEffect2()]:this.soundEffects2).length;n=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}},{key:"backgroundMusicMute",get:function(){return this._backgroundMusicMute},set:function(t){this._backgroundMusicMute=t,this.backgroundMusic&&this.backgroundMusic.setMute(mute);}},{key:"backgroundMusicVolume",get:function(){return this._backgroundMusicVolume},set:function(t){this._backgroundMusicVolume=t,this.backgroundMusic&&this.backgroundMusic.setVolume(t);}},{key:"backgroundMusic2Mute",get:function(){return this._backgroundMusic2Mute},set:function(t){this._backgroundMusic2Mute=t,this.backgroundMusic2&&this.backgroundMusic2.setMute(mute);}},{key:"backgroundMusic2Volume",get:function(){return this._backgroundMusic2Volume},set:function(t){this._backgroundMusic2Volume=t,this.backgroundMusic2&&this.backgroundMusic2.setVolume(t);}},{key:"soundEffectsMute",get:function(){return this._soundEffectsMute},set:function(t){this._soundEffectsMute=t;for(var e=this.soundEffects,i=0,n=e.length;i0?this.items.pop():null}},{key:"push",value:function(t){return this.items.push(t),this}},{key:"pushMultiple",value:function(t){return this.items.push.apply(this.items,t),t.length=0,this}},{key:"clear",value:function(){return this.items.length=0,this}}]),t}(),le=function(t){r(s,t);var i=u(s);function s(){return e(this,s),i.apply(this,arguments)}return n(s,[{key:"allocate",value:function(){return this.pop()}},{key:"free",value:function(t){t.onFree(),this.push(t);}},{key:"freeMultiple",value:function(t){for(var e=0,i=t.length;e2?n-2:0),s=2;s3?r-3:0),a=3;a0}},{key:"drawX",get:function(){var t=this.x+this.leftSpace+this.offsetX-this.originX*this.width;return this.parent._textOX*this.scrollFactorX+t}},{key:"drawY",get:function(){var t=this.y+this.offsetY;return this.parent._textOY*this.scrollFactorY+t}},{key:"drawTLX",get:function(){return 0}},{key:"drawTLY",get:function(){return 0}},{key:"drawBLX",get:function(){return 0}},{key:"drawBLY",get:function(){return 0}},{key:"drawTRX",get:function(){return 0}},{key:"drawTRY",get:function(){return 0}},{key:"drawBRX",get:function(){return 0}},{key:"drawBRY",get:function(){return 0}},{key:"drawCenterX",get:function(){return (this.drawTRX+this.drawTLX)/2}},{key:"drawCenterY",get:function(){return (this.drawBLY+this.drawTLY)/2}}]),s}(Xe);Object.assign(ai.prototype,ii);var oi=Phaser.Utils.String.Pad,ui=function(e,i,n){if(null==e)return e;switch(t(e)){case"string":default:return e;case"number":return "#".concat(oi(Math.floor(e).toString(16),6,"0",1));case"function":return e(i,n);case"object":return e.hasOwnProperty("r")?e.hasOwnProperty("a")?"rgba(".concat(e.r,",").concat(e.g,",").concat(e.b,",").concat(e.a,")"):"rgb(".concat(e.r,",").concat(e.g,",").concat(e.b,")"):e.hasOwnProperty("h")?e.hasOwnProperty("a")?"hsla(".concat(e.h,",").concat(e.s,",").concat(e.l,",").concat(e.a,")"):"hsl(".concat(e.h,",").concat(e.s,",").concat(e.l,")"):e}},ci=function(t,e,i){return e.hasOwnProperty(t)?e[t]:i[t]},hi=Phaser.Utils.Objects.GetValue,li=function(){function t(i,n,r,s,a){e(this,t),void 0===i&&(i=0),void 0===n&&(n=i),void 0===r&&(r=0),void 0===s&&(s=0),void 0===a&&(a=0),this.cornerRadius={},this._width=0,this._height=0,this.setTo(i,n,r,s,a);}return n(t,[{key:"setTo",value:function(t,e,i,n,r){return this.setPosition(t,e),this.setRadius(r),this.setSize(i,n),this}},{key:"setPosition",value:function(t,e){return this.x=t,this.y=e,this}},{key:"setRadius",value:function(t){return void 0===t&&(t=0),this.radius=t,this}},{key:"setSize",value:function(t,e){return this.width=t,this.height=e,this}},{key:"minWidth",get:function(){var t=this.cornerRadius;return Math.max(t.tl.x+t.tr.x,t.bl.x+t.br.x)}},{key:"minHeight",get:function(){var t=this.cornerRadius;return Math.max(t.tl.y+t.bl.y,t.tr.y+t.br.y)}},{key:"width",get:function(){return this._width},set:function(t){null==t&&(t=0),this._width=Math.max(t,this.minWidth);}},{key:"height",get:function(){return this._height},set:function(t){null==t&&(t=0),this._height=Math.max(t,this.minHeight);}},{key:"radius",get:function(){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:function(t){var e,i;"number"==typeof t?(e=t,i=t):(e=hi(t,"x",0),i=hi(t,"y",0));var n=this.cornerRadius;n.tl=fi(hi(t,"tl",void 0),e,i),n.tr=fi(hi(t,"tr",void 0),e,i),n.bl=fi(hi(t,"bl",void 0),e,i),n.br=fi(hi(t,"br",void 0),e,i);}},{key:"radiusTL",get:function(){var t=this.cornerRadius.tl;return Math.max(t.x,t.y)},set:function(t){di(this.cornerRadius.tl,t);}},{key:"radiusTR",get:function(){var t=this.cornerRadius.tr;return Math.max(t.x,t.y)},set:function(t){di(this.cornerRadius.tr,t);}},{key:"radiusBL",get:function(){var t=this.cornerRadius.bl;return Math.max(t.x,t.y)},set:function(t){di(this.cornerRadius.bl,t);}},{key:"radiusBR",get:function(){var t=this.cornerRadius.br;return Math.max(t.x,t.y)},set:function(t){di(this.cornerRadius.br,t);}}]),t}(),fi=function(t,e,i){return void 0===t?t={x:e,y:i}:"number"==typeof t&&(t={x:t,y:t}),gi(t),t},di=function(t,e){"number"==typeof e?(t.x=e,t.y=e):(t.x=hi(e,"x",0),t.y=hi(e,"y",0)),gi(t);},gi=function(t){t.convex=t.x>=0||t.y>=0,t.x=Math.abs(t.x),t.y=Math.abs(t.y);},pi=Phaser.Math.DegToRad,vi=function(t){return !t.hasOwnProperty("convex")||t.convex},yi=function(t){return t.x>0&&t.y>0},mi=function(t,e,i,n,r,s,a,o,u){if(o&&a>s?a-=360:!o&&a=d?1:n/d,v=r>=g?1:r/g,y=f.cornerRadius;t.save(),t.beginPath(),t.translate(e,i),o=y.tl,yi(o)?(u=o.x*p,c=o.y*v,vi(o)?mi(t,u,c,u,c,180,270,!1,a):mi(t,0,0,u,c,90,0,!0,a),h=0,l=c):(t.lineTo(0,0),h=0,l=0),o=y.tr,yi(o)?(u=o.x*p,c=o.y*v,vi(o)?mi(t,n-u,c,u,c,270,360,!1,a):mi(t,n,0,u,c,180,90,!0,a)):t.lineTo(n,0),o=y.br,yi(o)?(u=o.x*p,c=o.y*v,vi(o)?mi(t,n-u,r-c,u,c,0,90,!1,a):mi(t,n,r,u,c,270,180,!0,a)):t.lineTo(n,r),o=y.bl,yi(o)?(u=o.x*p,c=o.y*v,vi(o)?mi(t,u,r-c,u,c,90,180,!1,a):mi(t,0,r,u,c,360,270,!0,a)):t.lineTo(0,r),t.lineTo(h,l),t.closePath(),t.restore();}(e,i,n,r,s,a,f),null!=o){var d;if(null!=h)(d=l?e.createLinearGradient(0,0,r,0):e.createLinearGradient(0,0,0,s)).addColorStop(0,o),d.addColorStop(1,h),o=d;e.fillStyle=o,e.fill();}null!=u&&c>0&&(e.strokeStyle=u,e.lineWidth=c,e.stroke());},bi=Phaser.Utils.Objects.GetValue,wi=function(t){r(a,t);var i=u(a);function a(t,n){var r;return e(this,a),(r=i.call(this,t,"background")).setScrollFactor(0),r.setColor(bi(n,"color",null),bi(n,"color2",null),bi(n,"horizontalGradient",!0)),r.setStroke(bi(n,"stroke",null),bi(n,"strokeThickness",2)),r.setCornerRadius(bi(n,"cornerRadius",0),bi(n,"cornerIteration",null)),r}return n(a,[{key:"color",get:function(){return this._color},set:function(t){t=ui(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t;}},{key:"color2",get:function(){return this._color2},set:function(t){t=ui(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t;}},{key:"horizontalGradient",get:function(){return this._horizontalGradient},set:function(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t;}},{key:"setColor",value:function(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}},{key:"stroke",get:function(){return this._stroke},set:function(t){t=ui(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t;}},{key:"strokeThickness",get:function(){return this._strokeThickness},set:function(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t;}},{key:"setStroke",value:function(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}},{key:"cornerRadius",get:function(){return this._cornerRadius},set:function(t){this.setDirty(this._cornerRadius!=t),this._cornerRadius=t;}},{key:"cornerIteration",get:function(){return this._cornerIteration},set:function(t){this.setDirty(this._cornerIteration!=t),this._cornerIteration=t;}},{key:"modifyStyle",value:function(t){return t.hasOwnProperty("color")&&this.setColor(t.color,ci("color2",t,this),ci("horizontalGradient",t,this)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,ci("strokeThickness",t,this)),t.hasOwnProperty("cornerRadius")&&this.setCornerRadius(t.cornerRadius,ci("cornerIteration",t,this)),this}},{key:"modifyPorperties",value:function(t){return h(s(a.prototype),"modifyPorperties",this).call(this,t),this.modifyStyle(t),this}},{key:"setCornerRadius",value:function(t,e){return this.cornerRadius=t,this.cornerIteration=e,this}},{key:"renderContent",value:function(){!function(t,e,i,n,r,s,a,o){if(null!=e||null!=i){var u=t.canvas.width,c=t.canvas.height;null==i&&(n=0);var h=n/2;u=Math.max(1,u-n),c=Math.max(1,c-n),ki(t.canvas,t.context,h,h,u,c,r,e,i,n,s,a,o);}}(this.parent,this.color,this.stroke,this.strokeThickness,this.cornerRadius,this.color2,this.horizontalGradient,this.cornerIteration);}}]),a}(ai),Si=Phaser.Utils.Objects.GetValue,Ei=function(t){r(a,t);var i=u(a);function a(t,n){var r;return e(this,a),(r=i.call(this,t,"innerbounds")).setScrollFactor(0),r.setColor(Si(n,"color",null),Si(n,"color2",null),Si(n,"horizontalGradient",!0)),r.setStroke(Si(n,"stroke",null),Si(n,"strokeThickness",2)),r}return n(a,[{key:"color",get:function(){return this._color},set:function(t){t=ui(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t;}},{key:"color2",get:function(){return this._color2},set:function(t){t=ui(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t;}},{key:"horizontalGradient",get:function(){return this._horizontalGradient},set:function(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t;}},{key:"setColor",value:function(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}},{key:"stroke",get:function(){return this._stroke},set:function(t){t=ui(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t;}},{key:"strokeThickness",get:function(){return this._strokeThickness},set:function(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t;}},{key:"setStroke",value:function(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}},{key:"modifyPorperties",value:function(t){h(s(a.prototype),"modifyPorperties",this).call(this,t),t.hasOwnProperty("color")&&this.setColor(t.color,Si(t,"color2",null),Si(t,"horizontalGradient",!0)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,Si(t,"strokeThickness",2));}},{key:"renderContent",value:function(){var t=this.parent.padding,e=t.left,i=t.top,n=this.parent.width-t.left-t.right,r=this.parent.height-t.top-t.bottom,s=this.context;if(null!=this.color){var a,o;if(null!=this.color2)(o=this.horizontalGradient?s.createLinearGradient(0,0,n,0):s.createLinearGradient(0,0,0,r)).addColorStop(0,this.color),o.addColorStop(1,this.color2),a=o;else a=this.color;s.fillStyle=a,s.fillRect(e,i,n,r);}null!=this.stroke&&this.strokeThickness>0&&(s.strokeStyle=this.stroke,s.lineWidth=this.strokeThickness,s.strokeRect(e,i,n,r));}}]),a}(ai),Oi=Phaser.Utils.Objects.GetValue,xi=function(){function t(i,n){e(this,t),this.parent=i,this.set(n);}return n(t,[{key:"toJSON",value:function(){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}}},{key:"set",value:function(t){return this.setBold(Oi(t,"bold",!1)),this.setItalic(Oi(t,"italic",!1)),this.setFontSize(Oi(t,"fontSize","16px")),this.setFontFamily(Oi(t,"fontFamily","Courier")),this.setColor(Oi(t,"color","#fff")),this.setStrokeStyle(Oi(t,"stroke",null),Oi(t,"strokeThickness",0)),this.setShadow(Oi(t,"shadowColor",null),Oi(t,"shadowOffsetX",0),Oi(t,"shadowOffsetY",0),Oi(t,"shadowBlur",0)),this.setOffset(Oi(t,"offsetX",0),Oi(t,"offsetY",0)),this.setSpace(Oi(t,"leftSpace",0),Oi(t,"rightSpace",0)),this.setAlign(Oi(t,"align",void 0)),this.setBackgroundColor(Oi(t,"backgroundColor",null)),this.setBackgroundHeight(Oi(t,"backgroundHeight",void 0)),this.setBackgroundBottomY(Oi(t,"backgroundBottomY",void 0)),this}},{key:"modify",value:function(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(ci("stroke",t,this),ci("strokeThickness",t,this)),t.hasOwnProperty("shadowColor")&&this.setShadowColor(t.shadowColor),(t.hasOwnProperty("shadowOffsetX")||t.hasOwnProperty("shadowOffsetY"))&&this.setShadowOffset(ci("shadowOffsetX",t,this),ci("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}},{key:"setUpdateTextFlag",value:function(){return this.parent&&(this.parent.updateTextFlag=!0),this}},{key:"clone",value:function(){return new t(null,this.toJSON())}},{key:"copyFrom",value:function(t){return this.set(t.toJSON()),this}},{key:"copyTo",value:function(t){return t.set(this.toJSON()),this}},{key:"setBold",value:function(t){return void 0===t&&(t=!0),this.bold=t,this.setUpdateTextFlag(),this}},{key:"setItalic",value:function(t){return void 0===t&&(t=!0),this.italic=t,this.setUpdateTextFlag(),this}},{key:"fontStyle",get:function(){return this.bold&&this.italic?"bold italic":this.bold?"bold":this.italic?"italic":""}},{key:"setFontSize",value:function(t){return "number"==typeof t&&(t="".concat(t,"px")),this.fontSize=t,this.setUpdateTextFlag(),this}},{key:"setFontFamily",value:function(t){return this.fontFamily=t,this.setUpdateTextFlag(),this}},{key:"font",get:function(){return "".concat(this.fontStyle," ").concat(this.fontSize," ").concat(this.fontFamily)}},{key:"setColor",value:function(t){return this.color=ui(t),this}},{key:"hasFill",get:function(){return null!=this.color}},{key:"setStrokeStyle",value:function(t,e){return this.stroke=ui(t),void 0!==e&&(this.strokeThickness=e),this}},{key:"setStrokeThickness",value:function(t){return this.strokeThickness=t,this}},{key:"hasStroke",get:function(){return null!=this.stroke&&this.strokeThickness>0}},{key:"setShadowColor",value:function(t){return this.shadowColor=ui(t),this}},{key:"setShadowOffset",value:function(t,e){return void 0===t&&(t=0),void 0===e&&(e=0),this.shadowOffsetX=t,this.shadowOffsetY=e,this}},{key:"setShadowBlur",value:function(t){return void 0===t&&(t=0),this.shaodwBlur=t,this}},{key:"setShadow",value:function(t,e,i,n){return this.setShadowColor(t).setShadowOffset(e,i).setShadowBlur(n),this}},{key:"setBackgroundColor",value:function(t){return this.backgroundColor=ui(t),this}},{key:"hasBackgroundColor",get:function(){return null!=this.backgroundColor}},{key:"setBackgroundHeight",value:function(t){return this.backgroundHeight=t,this}},{key:"setBackgroundBottomY",value:function(t){return this.backgroundBottomY=t,this}},{key:"setOffsetX",value:function(t){return void 0===t&&(t=0),this.offsetX=t,this}},{key:"setOffsetY",value:function(t){return void 0===t&&(t=0),this.offsetY=t,this}},{key:"setOffset",value:function(t,e){return this.setOffsetX(t).setOffsetY(e),this}},{key:"setLeftSpace",value:function(t){return void 0===t&&(t=0),this.leftSpace=t,this}},{key:"setRightSpace",value:function(t){return void 0===t&&(t=0),this.rightSpace=t,this}},{key:"setSpace",value:function(t,e){return this.setLeftSpace(t).setRightSpace(e),this}},{key:"setAlign",value:function(t){return this.align=t,this}},{key:"syncFont",value:function(t){return t.font=this.font,this}},{key:"syncStyle",value:function(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}},{key:"syncShadow",value:function(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);}},{key:"getTextMetrics",value:function(t,e){return this.syncFont(t).syncStyle(t),t.measureText(e)}}]),t}(),Mi=Phaser.Utils.Array.Remove,Pi=Phaser.Utils.Array.Remove,Ti="text",Ci="image",_i="drawer",ji="space",Ri="command",Bi=function(t){return t.type===Ti&&"\n"===t.text},Gi=function(t){return t.type===Ti&&"\f"===t.text},Ai=function(t){return t.type===Ti},Di=function(t){return t.type===Ri},Wi=function(t){r(a,t);var i=u(a);function a(t,n,r){var s;return e(this,a),(s=i.call(this,t,Ti)).updateTextFlag=!1,s.style=new xi(o(s),r),s.setText(n),s}return n(a,[{key:"autoRound",get:function(){return this.parent.autoRound}},{key:"offsetX",get:function(){return this.style.offsetX},set:function(t){this.style&&(this.style.offsetX=t);}},{key:"offsetY",get:function(){return this.style.offsetY},set:function(t){this.style&&(this.style.offsetY=t);}},{key:"leftSpace",get:function(){return this.style.leftSpace*this.scaleX},set:function(t){this.style&&(this.style.leftSpace=t),f(s(a.prototype),"leftSpace",t,this,!0);}},{key:"rightSpace",get:function(){return this.style.rightSpace*this.scaleX},set:function(t){this.style&&(this.style.rightSpace=t),f(s(a.prototype),"rightSpace",t,this,!0);}},{key:"align",get:function(){return this.style.align},set:function(t){this.style&&(this.style.align=t);}},{key:"modifyStyle",value:function(t){return this.setDirty(!0),this.style.modify(t),this.updateTextFlag&&this.updateTextSize(),this}},{key:"modifyPorperties",value:function(t){return t?(this.modifyStyle(t),h(s(a.prototype),"modifyPorperties",this).call(this,t),this):this}},{key:"setText",value:function(t){return this.setDirty(this.text!=t),this.text=t,this.updateTextSize(),this}},{key:"updateTextSize",value:function(){var t=this.text;if("\n"===t||"\f"===t||""===t)this.clearTextSize();else {var e,i,n=this.style.getTextMetrics(this.context,this.text);this.textWidth=n.width,"actualBoundingBoxAscent"in n?(e=n.actualBoundingBoxAscent,i=n.actualBoundingBoxDescent):(e=0,i=0),this.textHeight=e+i,this.ascent=e,this.descent=i;}return this.updateTextFlag=!1,this}},{key:"clearTextSize",value:function(){return this.textWidth=0,this.textHeight=0,this.ascent=0,this.descent=0,this}},{key:"copyTextSize",value:function(t){return this.textWidth=t.textWidth,this.textHeight=t.textHeight,this.ascent=t.ascent,this.descent=t.descent,this}},{key:"width",get:function(){return this.textWidth*this.scaleX},set:function(t){this.textWidth>0?this.scaleX=t/this.textWidth:this.scaleX=1;}},{key:"height",get:function(){return this.textHeight*this.scaleY},set:function(t){this.textHeight>0?this.scaleY=t/this.textHeight:this.scaleY=1;}},{key:"willRender",get:function(){return 0!==this.textWidth&&h(s(a.prototype),"willRender",this)}},{key:"renderContent",value:function(){var t=this.context,e=this.style;if(e.hasBackgroundColor){t.fillStyle=e.backgroundColor;var i=this.drawTLX,n=this.drawTRX-i,r=e.backgroundBottomY;null==r&&(r=this.drawBLY);var s=e.backgroundHeight;null==s&&(s=r-this.drawTLY);var a=r-s;t.fillRect(i,a,n,s);}var o=e.hasFill,u=e.hasStroke;(o||u)&&(e.syncFont(t).syncStyle(t),u&&(e.syncShadow(t),t.strokeText(this.text,0,0)),o&&(e.syncShadow(t),t.fillText(this.text,0,0)));}},{key:"drawTLX",get:function(){return -this.leftSpace}},{key:"drawTLY",get:function(){return -this.ascent}},{key:"drawBLX",get:function(){return -this.leftSpace}},{key:"drawBLY",get:function(){return this.descent}},{key:"drawTRX",get:function(){return this.textWidth+this.rightSpace}},{key:"drawTRY",get:function(){return -this.ascent}},{key:"drawBRX",get:function(){return this.textWidth+this.rightSpace}},{key:"drawBRY",get:function(){return this.descent}}]),a}(ai),Li=function(t,e){var i=this.createCharChildren(t,e);return this.addChild(i),this},Fi=function(t){r(s,t);var i=u(s);function s(t,n,r){var a;return e(this,s),(a=i.call(this,t,Ci)).setTexture(n,r),a}return n(s,[{key:"frameWidth",get:function(){return this.frameObj?this.frameObj.cutWidth:0}},{key:"frameHeight",get:function(){return this.frameObj?this.frameObj.cutHeight:0}},{key:"offsetY",get:function(){return -this.height},set:function(t){}},{key:"key",get:function(){return this._key},set:function(t){this.setDirty(this._key!=t),this._key=t;}},{key:"frame",get:function(){return this._frame},set:function(t){this.setDirty(this._frame!=t),this._frame=t;}},{key:"setTexture",value:function(t,e){return this.key=t,this.frame=e,this.frameObj=this.scene.sys.textures.getFrame(t,e),this}},{key:"width",get:function(){return this.frameWidth*this.scaleX},set:function(t){this.setDirty(this.width!==t),this.scaleX=t/this.frameWidth;}},{key:"height",get:function(){return this.frameHeight*this.scaleY},set:function(t){this.setDirty(this.height!==t),this.scaleY=t/this.frameHeight;}},{key:"setHeight",value:function(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}},{key:"renderContent",value:function(){var t=this.context,e=this.frameObj,i=this.frameWidth,n=this.frameHeight;t.drawImage(e.source.image,e.cutX,e.cutY,i,n,0,0,i,n);}},{key:"drawTLX",get:function(){return -this.leftSpace}},{key:"drawTLY",get:function(){return 0}},{key:"drawBLX",get:function(){return -this.leftSpace}},{key:"drawBLY",get:function(){return this.frameHeight}},{key:"drawTRX",get:function(){return this.frameWidth+this.rightSpace}},{key:"drawTRY",get:function(){return 0}},{key:"drawBRX",get:function(){return this.frameWidth+this.rightSpace}},{key:"drawBRY",get:function(){return this.frameHeight}}]),s}(ai),Xi=function(t,e,i){var n=this.createImageChild(t,e,i);return this.addChild(n),this},Yi=function(t){r(a,t);var i=u(a);function a(t,n,r,s){var o;return e(this,a),(o=i.call(this,t,_i)).setRenderCallback(n),o.setDrawerSize(r,s),o}return n(a,[{key:"setRenderCallback",value:function(t){return t?this.renderContent=t.bind(this):delete this.renderContent,this}},{key:"setDrawerSize",value:function(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}},{key:"onFree",value:function(){h(s(a.prototype),"onFree",this).call(this),this.setRenderCallback();}},{key:"width",get:function(){return this.drawerWidth*this.scaleX},set:function(t){this.setDirty(this.width!==t),this.scaleX=this.drawerWidth>0?t/this.drawerWidth:1;}},{key:"height",get:function(){return this.drawerHeight*this.scaleY},set:function(t){this.setDirty(this.height!==t),this.scaleY=this.drawerHeight>0?t/this.drawerHeight:1;}},{key:"offsetY",get:function(){return -this.height},set:function(t){}},{key:"drawTLX",get:function(){return -this.leftSpace}},{key:"drawTLY",get:function(){return 0}},{key:"drawBLX",get:function(){return -this.leftSpace}},{key:"drawBLY",get:function(){return this.drawerHeight}},{key:"drawTRX",get:function(){return this.drawerWidth+this.rightSpace}},{key:"drawTRY",get:function(){return 0}},{key:"drawBRX",get:function(){return this.drawerWidth+this.rightSpace}},{key:"drawBRY",get:function(){return this.drawerHeight}}]),a}(ai),Ii=function(t){r(s,t);var i=u(s);function s(t,n){var r;return e(this,s),(r=i.call(this,t,ji)).setSpaceWidth(n),r}return n(s,[{key:"width",get:function(){return this.spaceWidth*this.scaleX},set:function(t){this.spaceWidth>0?this.scaleX=t/this.spaceWidth:this.scaleX=1;}},{key:"setSpaceWidth",value:function(t){return this.spaceWidth=t,this}}]),s}(ai),Vi=function(t){var e=this.createSpaceChild(t);return this.addChild(e),this},zi=function(t){r(a,t);var i=u(a);function a(t,n,r,s,o){var u;return e(this,a),(u=i.call(this,t,Ri)).setName(n).setParameter(s).setCallback(r,o),u}return n(a,[{key:"setName",value:function(t){return this.name=t,this}},{key:"setParameter",value:function(t){return this.param=t,this}},{key:"setCallback",value:function(t,e){return this.callback=t,this.scope=e,this}},{key:"exec",value:function(){return this.scope?this.callback.call(this.scope,this.param,this.name):this.callback(this.param,this.name)}},{key:"onFree",value:function(){h(s(a.prototype),"onFree",this).call(this),this.setName().setCallback().setParameter();}}]),a}(Xe),Ui=function(t,e,i,n){var r=this.createCommandChild(t,e,i,n);return this.addChild(r),this},Ni=function e(i){var n,r,s;if(null==i||"object"!==t(i))return i;if(n=Array.isArray(i)?[]:{},function(e){if("object"!==t(e)||e.nodeType||e===e.window)return !1;try{if(e.constructor&&!{}.hasOwnProperty.call(e.constructor.prototype,"isPrototypeOf"))return !1}catch(t){return !1}return !0}(i))for(s in i)r=i[s],n[s]=e(r);else n=i;return n},Hi=function(t,e,i,n){void 0===n&&(n={word:[],width:0}),n.word.length=0;for(var r=t.length,s=e,a=n.word,o=0;s0&&!o){var u=this.fixedHeight-n;if(i>0)s=u/i;else s=(c=qi.call(this)).height,a=c.ascent,i=Math.floor((u-a)/s);}else {var c;s=(c=qi.call(this)).height,a=c.ascent;}}else if(this.fixedHeight>0){if(void 0===(i=Qi(t,"maxLines"))){u=this.fixedHeight-n;i=Math.floor(u/s);}}else i=Qi(t,"maxLines",0);void 0===a&&(a=s);var h=0===i,l=Qi(t,"wrapWidth",void 0);void 0===l&&(l=this.fixedWidth>0?this.fixedWidth-r:1/0);for(var f=Qi(t,"letterSpacing",0),d=Qi(t,"hAlign",0),g=Qi(t,"vAlign",0),p=Qi(t,"charWrap",!1),v={callback:"runWordWrap",start:e,isLastPage:!1,padding:this.wrapPadding,ascent:a,lineHeight:s,maxLines:i,wrapWidth:l,letterSpacing:f,hAlign:d,vAlign:g,charWrap:p,children:[],lines:[],maxLineWidth:0,linesHeight:0},y=this.children,m=0,k=y.length;m0&&(T.push({children:C,width:_}),j=Math.max(j,_)),v.start+=P.length,v.isLastPage=!R&&v.start===M,v.maxLineWidth=j,v.linesHeight=T.length*s;var F=this.fixedWidth>0?this.fixedWidth:v.maxLineWidth+r,X=this.fixedHeight>0?this.fixedHeight:v.linesHeight+n;!function(t,e,i){var n,r,s=t.hAlign,a=t.vAlign,o=t.linesHeight;switch(a){case 1:case"center":r=(i-o)/2;break;case 2:case"bottom":r=i-o;break;default:r=0;}for(var u=t.lines,c=0,h=u.length;c0?(a=this.fixedWidth-r)/i:0;else if(this.fixedWidth>0){if(void 0===(i=en(t,"maxLines",void 0))){var a=this.fixedWidth-r;i=Math.floor(a/s)+1;}}else i=en(t,"maxLines",0);var o=0===i,u=en(t,"fixedChildHeight",void 0);if(void 0===u){var c=en(t,"charPerLine",void 0);if(void 0!==c){var h=this.fixedHeight-n;u=Math.floor(h/c);}}var l=en(t,"wrapHeight",void 0);void 0===l&&(l=this.fixedHeight>0?this.fixedHeight-n:1/0);for(var f=en(t,"letterSpacing",0),d=en(t,"rtl",!0),g=en(t,"hAlign",d?2:0),p=en(t,"vAlign",0),v={callback:"runVerticalWrap",start:e,isLastPage:!1,padding:this.wrapPadding,lineWidth:s,maxLines:i,fixedChildHeight:u,wrapHeight:l,letterSpacing:f,hAlign:g,vAlign:p,rtl:d,children:[],lines:[],maxLineHeight:0,linesWidth:0},y=this.children,m=0,k=y.length;m0&&(T.push({children:C,height:_}),j=Math.max(j,_)),v.start+=P.length,v.isLastPage=v.start===M,v.maxLineHeight=j,v.linesWidth=T.length*s;var W=this.fixedWidth>0?this.fixedWidth:v.linesWidth+r,L=this.fixedHeight>0?this.fixedHeight:v.maxLineHeight+n;!function(t,e,i){var n,r,s=t.hAlign,a=t.vAlign,o=t.rtl,u=t.lines,c=t.lineWidth,h=t.linesWidth;switch(s){case 1:case"center":n=(e-h)/2;break;case 2:case"right":n=e-h;break;default:n=0;}o&&(n+=c);for(var l=0,f=u.length;l0?t:this.width,e>0?e:this.height),this):this},setPadding:function(t,e){var i=this.padding,n=i.left,r=i.right,s=i.top,a=i.bottom;return Le(i,t,e),this.dirty=this.dirty||n!=i.left||r!=i.right||s!=i.top||a!=i.bottom,this},getPadding:function(t){return function(t,e){return void 0===e?t:t[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),Mi(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 Pi(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,n,r,s=Array.isArray(t);void 0===e||e===this.children.length?s?(i=this.children).push.apply(i,p(t)):this.children.push(t):s?(n=this.children).splice.apply(n,[e,0].concat(p(t))):this.children.splice(e,0,t);(this.lastAppendedChildren.length=0,s)?(r=this.lastAppendedChildren).push.apply(r,p(t)):this.lastAppendedChildren.push(t);return this},createCharChild:function(t,e){e&&this.textStyle.modify(e);var i=this.poolManager.allocate(Ti);return null===i?i=new Wi(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=[],n=0,r=t.length;ne&&(n=e,r=t);})),r},getCharWorldPosition:function(t,e,i,n){return "number"==typeof t&&(t=this.getCharChild(t,!0)),ei(this,t,e,i,n)},setToMinSize:function(){for(var t=this.children,e=0,i=0,n=0,r=t.length;n=i.length&&(t=i.length);for(var n=0,r=0;r");this.setDelimiters(n[0],n[1]),this.setTranslateTagNameCallback(ye(i,"translateTagNameCallback")),this.isRunning=!1,this.isPaused=!1,this.skipEventFlag=!1,this.justCompleted=!1,this.lastTagStart=null,this.lastTagEnd=null,this.lastContent=null;}return n(t,[{key:"shutdown",value:function(){this.destroyEventEmitter();}},{key:"destroy",value:function(){this.shutdown();}},{key:"setMultipleLinesTagEnable",value:function(t){return void 0===t&&(t=!0),this.multipleLinesTagEnable=t,this}},{key:"setDelimiters",value:function(t,e){void 0===e&&(e=t[1],t=t[0]),this.delimiterLeft=t,this.delimiterRight=e,t=jn(this.delimiterLeft),e=jn(this.delimiterRight);var i=this.multipleLinesTagEnable?"gs":"gi";return this.reSplit=RegExp("".concat(t,"(.+?)").concat(e),i),this}},{key:"setTranslateTagNameCallback",value:function(t){return this.translateTagNameCallback=t,this}},{key:"setValueConverter",value:function(t){return !0===t?t=_n:t||(t=An),this.valueConverter=t,this}},{key:"setLoopEnable",value:function(t){return void 0===t&&(t=!0),this.loopEnable=t,this}},{key:"setSource",value:function(t){return this.source=t,this}},{key:"resetIndex",value:function(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}},{key:"start",value:function(t){return this.setSource(t).restart(),this}},{key:"restart",value:function(){this.resetIndex().next();}},{key:"next",value:function(){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");return n.setDelimiters(r[0],r[1]),n}return n(a,[{key:"setTagExpression",value:function(t){return t||(t=Wn),this.tagExpression=t,this}},{key:"setValueExpression",value:function(t){return t||(t=Wn),this.valueExpression=t,this}},{key:"setDelimiters",value:function(t,e){h(s(a.prototype),"setDelimiters",this).call(this,t,e);var i="(".concat(this.tagExpression,")(=(").concat(this.valueExpression,"))?");if(this.reTag=RegExp(i,"i"),this.tagExpression!==Wn||this.valueExpression!==Wn){var n="".concat(this.tagExpression,"(=").concat(this.valueExpression,")?"),r="/".concat(this.tagExpression);t=jn(this.delimiterLeft),e=jn(this.delimiterRight);var o=this.multipleLinesTagEnable?"gs":"gi";this.reSplit=RegExp("".concat(t,"((").concat(n,")|(").concat(r,"))").concat(e),o);}return this}},{key:"onTag",value:function(t){var e=t.match(this.reTag),i=e[1],n="/"===i.charAt(0);if(n&&(i=i.substring(1,i.length)),this.translateTagNameCallback&&(i=this.translateTagNameCallback(i)),this.skipEventFlag=!1,n)this.emit("-".concat(i)),this.skipEventFlag||this.emit("-",i),this.lastTagEnd=i;else {var r=function(t,e){if(null==t)return [];void 0===e&&(e=_n);for(var i=t.split(","),n=0,r=i.length;n1?r-1:0),a=1;a1&&-1!==e.indexOf("|")?e.split("|"):[e]).length;s0){var a=this.timeline.addTimer({name:Yr,target:r,duration:s.duration,yoyo:s.yoyo,onStart:s.onStart,onProgress:s.onProgress,onComplete:s.onComplete});this.skipTypingAnimation&&a.seek(1);}else s.onStart&&s.onStart(r,0);this.minSizeEnable&&this.textPlayer.setToMinSize(),this.textPlayer.emit("typing",r);var o=this.nextChild;if(o)if(this.skipSpaceEnable&&((i=o).type===Ti&&" "===i.text));else if(n+=this.speed+e,e=0,n>0){this.typingTimer=this.timeline.addTimer({name:"delay",target:this,duration:n,onComplete:function(e,i,n){e.typingTimer=void 0,t.call(e,n.remainder);}});break}}else Di(r)&&r.exec();}this.minSizeEnable&&this.textPlayer.setToMinSize(),this.inTypingProcessLoop=!1;},pause:function(){return this.timeline.pause(),this},resume:function(){return this.timeline.resume(),this},pauseTyping:function(){return this.isTypingPaused||(this.typingTimer?(this.typingTimer.pause(),this.isTypingPaused=!0):this.inTypingProcessLoop&&(this.inTypingProcessLoop=!1,this.isTypingPaused=!0)),this},resumeTyping:function(t){return this.isTypingPaused?(void 0===t&&(t=0),this.typingTimer?(this.isTypingPaused=!1,this.typingTimer.resume(),this.typingTimer.remainder+=t):this.isTypingPaused&&(this.isTypingPaused=!1,this.typing(t)),this):this},wait:function(t){return this.ignoreWait||(this.pauseTyping(),Nr(this.textPlayer,t,this.resumeTyping,this)),this},setIgnoreWait:function(t){return void 0===t&&(t=!0),this.ignoreWait=t,this},setSkipSpaceEnable:function(t){return void 0===t&&(t=!0),this.skipSpaceEnable=t,this},setSkipTypingAnimation:function(t){if(void 0===t&&(t=!0),this.skipTypingAnimation=t,t)for(var e=this.timeline.getTimers(Yr),i=0,n=e.length;i0&&a.chainAnimation(i,n);},hs=function(t){var e,i,n=g(t);e=n[0],i=n.slice(1);var r=this.getGameObjectManager(e);r.stopAnimation.apply(r,p(i));},ls=function(t){var e,i,n=g(t);e=n[0],i=n.slice(1);var r=this.getGameObjectManager(e);r.pauseAnimation.apply(r,p(i));},fs=function(t){var e,i,n=g(t);e=n[0],i=n.slice(1);var r=this.getGameObjectManager(e);r.chainAnimation.apply(r,p(i));},ds=[function(t,e,i){var n=i.name;e.on("+",(function(i){if(!e.skipEventFlag){var r,s=i.split(".");if(us(s,n)){r=s[1];for(var a=arguments.length,o=new Array(a>1?a-1:0),u=1;u0)){var o=this.getGameObjectManager(e);o.hasMethod(i,n)?o.call.apply(o,[i,n].concat(p(r))):o.setProperty(i,n,r[0]);}},bs={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},ws=function(t){var e,i,n,r,s,a,o,u,c=d(t,8);e=c[0],i=c[1],n=c[2],r=c[3],s=c[4],a=c[5],o=c[6],u=c[7];var h=this.getGameObjectManager(e),l=h.getProperty(i,n);if("number"==typeof l){u.endsWith("Left")||u.endsWith("Up")?u.startsWith("to")||u.startsWith("yoyo")?r=l-r:u.startsWith("from")&&(h.setProperty(i,n,l-r),r=l):u.endsWith("Right")||u.endsWith("Down")?u.startsWith("to")||u.startsWith("yoyo")?r=l+r:u.startsWith("from")&&(h.setProperty(i,n,l+r),r=l):"from"===u&&(h.setProperty(i,n,r),r=l);var f=u.startsWith("yoyo");h.easeProperty(i,n,r,s,a,o,f);}},Ss=[function(t,e,i){var n=i.name;e.on("+",(function(i){if(!e.skipEventFlag){var r,s=i.split(".");if(ps(s,n)){r=s[1];for(var a=arguments.length,o=new Array(a>1?a-1:0),u=1;u1?o-1:0),c=1;c textObject.width) { - dx = textObject.width - childRightX; - } else { - dx = 0; - } - var childTopY = this.drawY + this.drawTLY; - var childBottomY = childTopY + this.height; - if (childTopY < 0) { - dy = 0 - childTopY; - } else if (childBottomY > textObject.height) { - dy = textObject.height - childBottomY; - } else { - dy = 0; - } - textObject._textOX += dx; - textObject._textOY += dy; - return this; - }; - var Methods$3 = { contains: Contains, - getWorldPosition: GetWorldPosition, - scrollTo: ScrollTo + getWorldPosition: GetWorldPosition }; Object.assign(Methods$3, RenderMethods); @@ -22443,13 +22416,12 @@ } }; - var SetTextOXYMethods = { + var SetTextOXYMethods$1 = { setTextOX: function setTextOX(ox) { if (ox === this._textOX) { return this; } this._textOX = ox; - this.updateTexture(); return this; }, setTextOY: function setTextOY(oy) { @@ -22457,7 +22429,6 @@ return this; } this._textOY = oy; - this.updateTexture(); return this; }, setTextOXY: function setTextOXY(ox, oy) { @@ -22466,7 +22437,6 @@ } this._textOX = ox; this._textOY = oy; - this.updateTexture(); return this; }, addTextOX: function addTextOX(incX) { @@ -22927,7 +22897,7 @@ setChildrenInteractiveEnable: SetChildrenInteractiveEnable, setInteractive: SetInteractive }; - Object.assign(Methods$2, MoveChildMethods, BackgroundMethods, InnerBoundsMethods, SetAlignMethods, SetTextOXYMethods); + Object.assign(Methods$2, MoveChildMethods, BackgroundMethods, InnerBoundsMethods, SetAlignMethods, SetTextOXYMethods$1); var GetFastValue = Phaser.Utils.Objects.GetFastValue; var Pools = {}; @@ -28396,6 +28366,38 @@ hiddenTextEdit.prevSelectionEnd = selectionEnd; }; + var ScrollToBob = function ScrollToBob(bob) { + var textObject = bob.parent; + var textObjectLeftX = 0, + textObjectRightX = textObject.width, + textObjectTopY = 0, + textObjectBottomY = textObject.height; + var childX = bob.drawX, + childY = bob.drawY; + var childLeftX = childX + bob.drawTLX, + childRightX = childX + bob.drawTRX, + childTopY = childY + bob.drawTLY, + childBottomY = childY + bob.drawBLY; + var dx; + if (childLeftX < textObjectLeftX) { + dx = textObjectLeftX - childLeftX; + } else if (childRightX > textObjectRightX) { + dx = textObjectRightX - childRightX; + } else { + dx = 0; + } + var dy; + if (childTopY < textObjectTopY) { + dy = textObjectTopY - childTopY; + } else if (childBottomY > textObjectBottomY) { + dy = textObjectBottomY - childBottomY; + } else { + dy = 0; + } + textObject._textOX += dx; + textObject._textOY += dy; + }; + var MoveCursor = function MoveCursor(hiddenTextEdit) { var textObject = hiddenTextEdit.parent; var text = textObject.text; @@ -28425,7 +28427,7 @@ if (child.text === '\n') { child.copyTextSize(textObject.lastInsertCursor); } - child.scrollTo(); + ScrollToBob(child); textObject.emit('cursorin', child, cursorPosition, textObject); } } @@ -29126,7 +29128,35 @@ // Push back lastInsertCursor directly textObject.children.push(textObject.lastInsertCursor); - textObject.runWordWrap(); + var result = textObject.runWordWrap(); + textObject.contentWidth = result.maxLineWidth; + textObject.contentHeight = result.linesHeight; + textObject.linesCount = result.lines.length; + }; + + var SetTextOXYMethods = { + setTextOYByPercentage: function setTextOYByPercentage(percentage) { + this.setTextOY(-this.textVisibleHeight * percentage); + return this; + }, + getTextOYPercentage: function getTextOYPercentage() { + var textVisibleHeight = this.textVisibleHeight; + if (textVisibleHeight === 0) { + return 0; + } + return this._textOY / -textVisibleHeight; + }, + setTextOXByPercentage: function setTextOXByPercentage(percentage) { + this.setTextOX(-this.textVisibleWidth * percentage); + return this; + }, + getTextOXPercentage: function getTextOXPercentage() { + var textVisibleWidth = this.textVisibleWidth; + if (textVisibleWidth === 0) { + return 0; + } + return this._textOX / -textVisibleWidth; + } }; var IsPlainObject$4 = Phaser.Utils.Objects.IsPlainObject; @@ -29155,6 +29185,11 @@ var cursorStyle = ExtractByPrefix(config.style, 'cursor'); _this = _super.call(this, scene, x, y, fixedWidth, fixedHeight, config); _this.type = 'rexCanvasInput'; + + // readonly + _this.contentWidth = undefined; + _this.contentHeight = undefined; + _this.linesCount = undefined; _this._text; _this.textEdit = CreateHiddenTextEdit(_assertThisInitialized(_this), config); if (config.focusStyle) { @@ -29386,12 +29421,67 @@ this.minLength = value; return this; } + }, { + key: "topTextOY", + get: function get() { + return 0; + } + }, { + key: "bottomTextOY", + get: function get() { + return -this.tableVisibleHeight; + } + }, { + key: "leftTextOX", + get: function get() { + return 0; + } + }, { + key: "rightTextOX", + get: function get() { + return -this.textVisibleWidth; + } + }, { + key: "textVisibleHeight", + get: function get() { + var h = this.contentHeight - this.height; + if (h < 0) { + h = 0; + } + return h; + } + }, { + key: "textVisibleWidth", + get: function get() { + var w = this.contentWidth - this.width; + if (w < 0) { + w = 0; + } + return w; + } + }, { + key: "t", + get: function get() { + return this.getTextOYPercentage(); + }, + set: function set(value) { + this.setTextOYByPercentage(value).updateTexture(); + } + }, { + key: "s", + get: function get() { + return this.getTextOXPercentage(); + }, + set: function set(value) { + this.setTextOXByPercentage(value).updateTexture(); + } }]); return CanvasInput; }(DynamicText); var DefaultParseTextCallback = function DefaultParseTextCallback(text) { return text; }; + Object.assign(CanvasInput.prototype, SetTextOXYMethods); var CreateInputText = function CreateInputText(scene, config, deepCloneConfig) { if (deepCloneConfig === undefined) { diff --git a/dist/rextweaker.min.js b/dist/rextweaker.min.js index bf4093d8b3..3f5238b5f7 100644 --- a/dist/rextweaker.min.js +++ b/dist/rextweaker.min.js @@ -4,4 +4,4 @@ * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var $a=Phaser.Renderer.WebGL.Utils,Qa={renderWebGL:function(t,e,i,n){if(0!==e.width&&0!==e.height){i.addToRenderList(e);var r=e.frame,s=r.width,o=r.height,a=$a.getTintAppendFloatAlpha,h=t.pipelines.set(e.pipeline,e),l=h.setTexture2D(r.glTexture,e);t.pipelines.preBatch(e),h.batchTexture(e,r.glTexture,s,o,e.x,e.y,s/e.style.resolution,o/e.style.resolution,e.scaleX,e.scaleY,e.rotation,e.flipX,e.flipY,e.scrollFactorX,e.scrollFactorY,e.displayOriginX,e.displayOriginY,0,0,s,o,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,n,!1,l),t.pipelines.postBatch(e);}},renderCanvas:function(t,e,i,n){0!==e.width&&0!==e.height&&(i.addToRenderList(e),t.batchSprite(e,e.frame,i,n));}},th=Phaser.Display.Canvas.CanvasPool;x();var eh=function(t){a(i,t);var e=d(i);function i(){return n(this,i),e.apply(this,arguments)}return s(i,[{key:"setStyle",value:function(t){return this.style.setStyle(t)}},{key:"setFont",value:function(t){return this.style.setFont(t)}},{key:"setFontFamily",value:function(t){return this.style.setFontFamily(t)}},{key:"setFontSize",value:function(t){return this.style.setFontSize(t)}},{key:"setFontStyle",value:function(t){return this.style.setFontStyle(t)}},{key:"setTestString",value:function(t){return this.style.setTestString(t)}},{key:"setFixedSize",value:function(t,e){return this.style.setFixedSize(t,e)}},{key:"setBackgroundColor",value:function(t,e,i){return this.style.setBackgroundColor(t,e,i)}},{key:"setBackgroundStrokeColor",value:function(t,e){return this.style.setBackgroundStrokeColor(t,e)}},{key:"setBackgroundCornerRadius",value:function(t,e){return this.style.setBackgroundCornerRadius(t,e)}},{key:"setFill",value:function(t){return this.style.setFill(t)}},{key:"setColor",value:function(t){return this.style.setColor(t)}},{key:"setStroke",value:function(t,e){return this.style.setStroke(t,e)}},{key:"setShadow",value:function(t,e,i,n,r,s){return this.style.setShadow(t,e,i,n,r,s)}},{key:"setShadowOffset",value:function(t,e){return this.style.setShadowOffset(t,e)}},{key:"setShadowColor",value:function(t){return this.style.setShadowColor(t)}},{key:"setShadowBlur",value:function(t){return this.style.setShadowBlur(t)}},{key:"setShadowStroke",value:function(t){return this.style.setShadowStroke(t)}},{key:"setShadowFill",value:function(t){return this.style.setShadowFill(t)}},{key:"setWrapMode",value:function(t){return this.style.setWrapMode(t)}},{key:"setWrapWidth",value:function(t){return this.style.setWrapWidth(t)}},{key:"setWordWrapWidth",value:function(t){return this.style.setWrapWidth(t)}},{key:"setAlign",value:function(t){return this.style.setHAlign(t)}},{key:"setHAlign",value:function(t){return this.style.setHAlign(t)}},{key:"setVAlign",value:function(t){return this.style.setVAlign(t)}},{key:"setLineSpacing",value:function(t){return this.style.setLineSpacing(t)}},{key:"lineSpacing",get:function(){return this.style.lineSpacing},set:function(t){this.setLineSpacing(t);}},{key:"setXOffset",value:function(t){return this.style.setXOffset(t)}},{key:"setMaxLines",value:function(t){return this.style.setMaxLines(t)}},{key:"setResolution",value:function(t){return this.style.setResolution(t)}},{key:"getTextMetrics",value:function(){return this.style.getTextMetrics()}},{key:"setTextMetrics",value:function(t,e){return this.style.setTextMetrics(t,e)}},{key:"measureTextMargins",value:function(t,e){return function(t,e,i){void 0===i&&(i={});var n=th.create(this),r=n.getContext("2d",{willReadFrequently:!0});t.syncFont(n,r);var s=r.measureText(e),o=Math.ceil(s.width*t.baselineX),a=o,h=2*a;if(a=a*t.baselineY|0,n.width=o,n.height=h,r.fillStyle="#f00",r.fillRect(0,0,o,h),r.font=t._font,r.textBaseline="alphabetic",r.fillStyle="#000",r.fillText(t.testString,0,a),i.left=0,0===o||0===h||!r.getImageData(0,0,o,h))return th.remove(n),i;for(var l=r.getImageData(0,0,o,h).data,u=!1,c=0;ch;u--){for(c=0;c0&&this.wrapMode!==ch&&0===this.wrapWidth}},{key:"setStyle",value:function(t,e,i){if(void 0===e&&(e=!0),void 0===i&&(i=!1),t&&t.hasOwnProperty("wrap")){var n=t.wrap;if(n.hasOwnProperty("mode")){var r=n.mode;"string"==typeof r&&(n.mode=kh[r]);}else n.hasOwnProperty("width")&&(n.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 s=this.propertyMap;for(var o in s){var a=s[o],h=a[0],l=i?a[1]:this[o],u=a[2];if("wrapCallback"===o||"wrapCallbackScope"===o)this[o]=gh(t,h,l);else {var c=ph(t,h,l);u&&(c=u(c)),this[o]=c;}}var d=gh(t,"font",null);this._font=null===d?this.fontStyle+" "+this.fontSize+" "+this.fontFamily:d;var f=gh(t,"fill",null);null!==f&&(this.color=rh(f));var v=gh(t,"metrics",!1);return v?this.metrics={ascent:gh(v,"ascent",0),descent:gh(v,"descent",0),fontSize:gh(v,"fontSize",0)}:!e&&this.metrics||(this.metrics=ah(this)),e?this.parent.updateText():this.parent}},{key:"syncFont",value:function(t,e){e.font=this._font;}},{key:"syncStyle",value:function(t,e){e.textBaseline="alphabetic",e.fillStyle=this.color,e.strokeStyle=this.stroke,e.lineWidth=this.strokeThickness,e.lineCap="round",e.lineJoin="round";}},{key:"syncShadow",value:function(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);}},{key:"update",value:function(t){return t&&(this._font="".concat(this.fontStyle," ").concat(this.fontSize," ").concat(this.fontFamily).trim(),this.metrics=ah(this)),this.parent.updateText(t)}},{key:"buildFont",value:function(){var t="".concat(this.fontStyle," ").concat(this.fontSize," ").concat(this.fontFamily).trim();return t!==this._font&&(this._font=t),this}},{key:"setFont",value:function(t){return "string"==typeof t?(this.fontFamily=t,this.fontSize="",this.fontStyle=""):(this.fontFamily=gh(t,"fontFamily","Courier"),this.fontSize=gh(t,"fontSize","16px"),this.fontStyle=gh(t,"fontStyle","")),this.update(!0)}},{key:"setFontFamily",value:function(t){return this.fontFamily=t,this.update(!0)}},{key:"setFontStyle",value:function(t){return this.fontStyle=t,this.update(!0)}},{key:"setFontSize",value:function(t){return "number"==typeof t&&(t=t.toString()+"px"),this.fontSize=t,this.update(!0)}},{key:"setTestString",value:function(t){return this.testString=t,this.update(!0)}},{key:"setFixedSize",value:function(t,e){return this.fixedWidth=t,this.fixedHeight=e,t&&(this.parent.width=t),e&&(this.parent.height=e),this.update(this.isWrapFitMode)}},{key:"setResolution",value:function(t){return this.resolution=t,this.update(!1)}},{key:"setLineSpacing",value:function(t){return this.lineSpacing=t,this.update(!1)}},{key:"setXOffset",value:function(t){return this.xOffset=t,this.update(!1)}},{key:"setBackgroundColor",value:function(t,e,i){return void 0===i&&(i=!0),this.backgroundColor=rh(t,this.parent.canvas,this.parent.context),this.backgroundColor2=rh(e,this.parent.canvas,this.parent.context),this.backgroundHorizontalGradient=i,this.update(!1)}},{key:"setBackgroundStrokeColor",value:function(t,e){return this.backgroundStrokeColor=rh(t,this.parent.canvas,this.parent.context),this.backgroundStrokeLineWidth=e,this.update(!1)}},{key:"setBackgroundCornerRadius",value:function(t,e){return this.backgroundCornerRadius=t,this.backgroundCornerIteration=e,this.update(!1)}},{key:"setFill",value:function(t){return this.color=rh(t,this.parent.canvas,this.parent.context),this.update(!1)}},{key:"setColor",value:function(t){return this.color=rh(t,this.parent.canvas,this.parent.context),this.update(!1)}},{key:"setStroke",value:function(t,e){return void 0===t?this.strokeThickness=0:(void 0===e&&(e=this.strokeThickness),this.stroke=rh(t,this.parent.canvas,this.parent.context),this.strokeThickness=e),this.update(!0)}},{key:"setShadow",value:function(t,e,i,n,r,s){return void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i="#000"),void 0===n&&(n=0),void 0===r&&(r=!1),void 0===s&&(s=!0),this.shadowOffsetX=t,this.shadowOffsetY=e,this.shadowColor=rh(i,this.parent.canvas,this.parent.context),this.shadowBlur=n,this.shadowStroke=r,this.shadowFill=s,this.update(!1)}},{key:"setShadowOffset",value:function(t,e){return void 0===t&&(t=0),void 0===e&&(e=t),this.shadowOffsetX=t,this.shadowOffsetY=e,this.update(!1)}},{key:"setShadowColor",value:function(t){return void 0===t&&(t="#000"),this.shadowColor=rh(t,this.parent.canvas,this.parent.context),this.update(!1)}},{key:"setShadowBlur",value:function(t){return void 0===t&&(t=0),this.shadowBlur=t,this.update(!1)}},{key:"setShadowStroke",value:function(t){return this.shadowStroke=t,this.update(!1)}},{key:"setShadowFill",value:function(t){return this.shadowFill=t,this.update(!1)}},{key:"setUnderline",value:function(t,e,i){return void 0===t&&(t="#000"),void 0===e&&(e=0),void 0===i&&(i=0),this.underlineColor=rh(t,this.parent.canvas,this.parent.context),this.underlineThickness=e,this.underlineOffset=i,this.update(!1)}},{key:"setUnderlineColor",value:function(t){return void 0===t&&(t="#000"),this.underlineColor=rh(t,this.parent.canvas,this.parent.context),this.update(!1)}},{key:"setUnderlineThickness",value:function(t){return void 0===t&&(t=0),this.underlineThickness=t,this.update(!1)}},{key:"setUnderlineOffset",value:function(t){return void 0===t&&(t=0),this.underlineOffset=t,this.update(!1)}},{key:"setStrikethrough",value:function(t,e,i){return void 0===t&&(t="#000"),void 0===e&&(e=0),void 0===i&&(i=0),this.strikethroughColor=rh(t,this.parent.canvas,this.parent.context),this.strikethroughThickness=e,this.strikethroughOffset=i,this.update(!1)}},{key:"setStrikethroughColor",value:function(t){return void 0===t&&(t="#000"),this.strikethroughColor=rh(t,this.parent.canvas,this.parent.context),this.update(!1)}},{key:"setStrikethroughThickness",value:function(t){return void 0===t&&(t=0),this.strikethroughThickness=t,this.update(!1)}},{key:"setStrikethroughOffset",value:function(t){return void 0===t&&(t=0),this.strikethroughOffset=t,this.update(!1)}},{key:"setWrapMode",value:function(t){return "string"==typeof t&&(t=kh[t.toLowerCase()]||0),this.wrapMode=t,this.update(!0)}},{key:"setWrapWidth",value:function(t){return this.wrapWidth=t,this.update(!1)}},{key:"setAlign",value:function(t,e){return void 0===t&&(t="left"),void 0===e&&(e="top"),this.halign=t,this.valign=e,this.update(!1)}},{key:"setHAlign",value:function(t){return void 0===t&&(t="left"),this.halign=t,this.update(!1)}},{key:"setVAlign",value:function(t){return void 0===t&&(t="top"),this.valign=t,this.update(!1)}},{key:"setMaxLines",value:function(t){return void 0===t&&(t=0),this.maxLines=t,this.update(!1)}},{key:"getTextMetrics",value:function(){var t=this.metrics;return {ascent:t.ascent,descent:t.descent,fontSize:t.fontSize}}},{key:"setTextMetrics",value:function(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=gh(e,"fontFamily",this.fontFamily),this.fontSize=gh(e,"fontSize",this.fontSize),this.fontStyle=gh(e,"fontStyle",this.fontStyle))),this.parent.updateText(!0)}},{key:"lineHeight",get:function(){return this.metrics.fontSize+this.strokeThickness+this.lineSpacing}},{key:"toJSON",value:function(){var t={},e=this.propertyMap;for(var i in e)t[i]=this[i];return t.metrics=this.getTextMetrics(),t}},{key:"destroy",value:function(){this.parent=void 0;}}]),t}(),kh={none:ch,word:dh,char:fh,character:fh},mh=Phaser.Math.DegToRad,bh=function(t){return !t.hasOwnProperty("convex")||t.convex},xh=function(t){return t.x>0&&t.y>0},Ch=function(t,e,i,n,r,s,o,a,h){if(a&&o>s?o-=360:!a&&o=f?1:n/f,g=r>=v?1:r/v,y=d.cornerRadius;t.save(),t.beginPath(),t.translate(e,i),a=y.tl,xh(a)?(h=a.x*p,l=a.y*g,bh(a)?Ch(t,h,l,h,l,180,270,!1,o):Ch(t,0,0,h,l,90,0,!0,o),u=0,c=l):(t.lineTo(0,0),u=0,c=0),a=y.tr,xh(a)?(h=a.x*p,l=a.y*g,bh(a)?Ch(t,n-h,l,h,l,270,360,!1,o):Ch(t,n,0,h,l,180,90,!0,o)):t.lineTo(n,0),a=y.br,xh(a)?(h=a.x*p,l=a.y*g,bh(a)?Ch(t,n-h,r-l,h,l,0,90,!1,o):Ch(t,n,r,h,l,270,180,!0,o)):t.lineTo(n,r),a=y.bl,xh(a)?(h=a.x*p,l=a.y*g,bh(a)?Ch(t,h,r-l,h,l,90,180,!1,o):Ch(t,0,r,h,l,360,270,!0,o)):t.lineTo(0,r),t.lineTo(u,c),t.closePath(),t.restore();}(e,i,n,r,s,o,d),null!=a){var f;if(null!=u)(f=c?e.createLinearGradient(0,0,r,0):e.createLinearGradient(0,0,0,s)).addColorStop(0,a),f.addColorStop(1,u),a=f;e.fillStyle=a,e.fill();}null!=h&&l>0&&(e.strokeStyle=h,e.lineWidth=l,e.stroke());},Sh=function(t,e,i,n,r,s,o,a){if(null!=e||null!=i){var h=t.canvas.width,l=t.canvas.height;null==i&&(n=0);var u=n/2;h=Math.max(1,h-n),l=Math.max(1,l-n),wh(t.canvas,t.context,u,u,h,l,r,e,i,n,s,o,a);}},Ph={draw:function(t,e,i,n){var r=this.penManager;this.hitAreaManager.clear();var s=this.context;s.save();var o=this.defaultStyle;this.clear(),Sh(this,o.backgroundColor,o.backgroundStrokeColor,o.backgroundStrokeLineWidth,o.backgroundCornerRadius,o.backgroundColor2,o.backgroundHorizontalGradient,o.backgroundCornerIteration),t+=this.startXOffset,e+=this.startYOffset;var a,h,l,u,c,d,f=o.halign,v=o.valign,p=o.lineHeight,g=r.lines,y=g.length,k=o.maxLines;k>0&&y>k?(h=k,l="center"===v?Math.floor((y-h)/2):"bottom"===v?y-h:0):(h=y,l=0),u=l+h;var m=this.rtl,b=m?this.parent.width:void 0;d="center"===v?Math.max((n-h*p)/2,0):"bottom"===v?Math.max(n-h*p-2,0):0,d+=e;for(var x=l;x0&&t.width>0){var a=i+o.underlineOffset-o.underlineThickness/2;this.drawLine(e,a,t.width,o.underlineThickness,o.underlineColor);}if(t.isTextPen&&this.drawText(e,i,t.text,o),t.isImagePen&&this.drawImage(e,i,t.prop.img,o),o.strikethroughThickness>0&&t.width>0){a=i+o.strikethroughOffset-o.strikethroughThickness/2;this.drawLine(e,a,t.width,o.strikethroughThickness,o.strikethroughColor);}if(s.restore(),t.hasAreaMarker&&t.width>0){var h,l=t.prop.area;if(l)h={key:l};else {var u=t.prop.url;h={key:"url:".concat(u),url:u};}this.hitAreaManager.add(e,i-this.startYOffset,t.width,this.defaultStyle.lineHeight,h);}},clear:function(){var t=this.canvas;this.context.clearRect(0,0,t.width,t.height);},drawLine:function(t,e,i,n,r){this.autoRound&&(t=Math.round(t),e=Math.round(e));var s=this.context,o=s.lineCap;s.lineCap="butt",s.strokeStyle=r,s.lineWidth=n,s.beginPath(),s.moveTo(t,e),s.lineTo(t+i,e),s.stroke(),s.lineCap=o;},drawText:function(t,e,i,n){this.autoRound&&(t=Math.round(t),e=Math.round(e));var r=this.context;n.stroke&&"none"!==n.stroke&&n.strokeThickness>0&&(n.syncShadow(r,n.shadowStroke),r.strokeText(i,t,e)),n.color&&"none"!==n.color&&(n.syncShadow(r,n.shadowFill),r.fillText(i,t,e));},drawImage:function(t,e,i,n){e-=this.startYOffset,this.parent.imageManager.draw(i,this.context,t,e,this.autoRound);}},Th=Phaser.Utils.Objects.GetValue,Oh=hh,_h=lh,Eh=function(){function t(e){n(this,t),this.prop={},this.resetFromJSON(e);}return s(t,[{key:"resetFromJSON",value:function(t){this.text=Th(t,"text",""),this.x=Th(t,"x",0),this.y=Th(t,"y",0),this.width=Th(t,"width",0);var e=Th(t,"prop",null);null===e&&(e={}),this.prop=e,this.newLineMode=Th(t,"newLineMode",0),this.startIndex=Th(t,"startIndex",0);}},{key:"plainText",get:function(){var t=this.text;return this.newLineMode===_h&&(t+="\n"),t}},{key:"wrapText",get:function(){var t=this.text;return this.newLineMode!==Oh&&(t+="\n"),t}},{key:"rawTextLength",get:function(){var t=this.text.length;return this.newLineMode===_h&&(t+=1),t}},{key:"endIndex",get:function(){return this.startIndex+this.rawTextLength}},{key:"lastX",get:function(){return this.x+this.width}},{key:"isTextPen",get:function(){return ""!==this.text}},{key:"isImagePen",get:function(){return !!this.prop.img}},{key:"hasAreaMarker",get:function(){return !!this.prop.area||!!this.prop.url}}]),t}(),Rh=Phaser.Utils.Objects.GetFastValue,Mh=hh,Lh=uh,Dh=function(){function t(e){n(this,t),this.pens=[],this.lines=[],this.maxLinesWidth=void 0,this.pensPool=e.pensPool,this.linesPool=e.linesPool,this.tagToText=Rh(e,"tagToText",ie),this.tagToTextScope=Rh(e,"tagToTextScope",void 0);}return s(t,[{key:"destroy",value:function(){this.clear(),this.tagToText=void 0,this.tagToTextScope=void 0;}},{key:"clear",value:function(){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}},{key:"getLineEndIndex",value:function(t){t>=this.lines.length&&(t=this.lines.length-1);var e,i,n=!1;for(e=t;e>=0&&!(n=null!=(i=this.lines[e])&&i.length>0);e--);return n?i[i.length-1].endIndex:0}},{key:"getLineWidth",value:function(t){var e=this.lines[t];if(!e)return 0;var i=e[e.length-1];return null==i?0:i.lastX}},{key:"getMaxLineWidth",value:function(){if(void 0!==this.maxLinesWidth)return this.maxLinesWidth;for(var t,e=0,i=0,n=this.lines.length;ie&&(e=t);return this.maxLinesWidth=e,e}},{key:"getLineWidths",value:function(){for(var t=[],e=0,i=this.lines.length;e=t&&h<=e||(o=o.substring(t-a,e-a)),this.tagToTextScope?c+=this.tagToText.call(this.tagToTextScope,o,l,u):c+=this.tagToText(o,l,u),u=l,!(h>=e)));d++);return c}},{key:"length",get:function(){return this.lines.length},set:function(t){this.clear();}}]),t}(),Ah={},Bh=function(){function t(){n(this,t),this.items=[];}return s(t,[{key:"destroy",value:function(){this.clear(),this.items=void 0;}},{key:"pop",value:function(){return this.items.length>0?this.items.pop():null}},{key:"push",value:function(t){return this.items.push(t),this}},{key:"pushMultiple",value:function(t){return this.items.push.apply(this.items,t),t.length=0,this}},{key:"clear",value:function(){return this.items.length=0,this}}]),t}(),zh=Phaser.Geom.Rectangle,jh=new Bh,Ih=function(){function t(){n(this,t),this.hitAreas=[];}return s(t,[{key:"destroy",value:function(){this.clear();}},{key:"clear",value:function(){for(var t=0,e=this.hitAreas.length;tr){""!==S?a.push(o.getLine(S,P,Hh)):0===O&&s>0&&a.push(o.getLine("",0,Hh)),a.push.apply(a,y(t(b,i,Kh,r,0,o)));var E=a.pop();S=E.text,P=E.width,o.freeLine(E)," "===S&&(S="",P=0);}else (w=P+x)>l?(a.push(o.getLine(S,P,Hh)),S=b,P=x,l=r):(S+=b,P=w),C&&a.push(o.getLine(S,P,u));}return a},Zh=Phaser.Utils.Objects.GetValue,$h=ch,Qh=hh,tl=function(){function t(e){n(this,t),this.parent=e.parent,this.scene=this.parent.scene,this.context=Zh(e,"context",null),this.canvas=this.context.canvas,this.parser=Zh(e,"parser",null),this.defaultStyle=Zh(e,"style",null),this.autoRound=!0,this.pensPool=e.pensPool,this.linesPool=e.linesPool,this.wrapTextLinesPool=e.wrapTextLinesPool,this.penManager=this.newPenManager(),this._tmpPenManager=null,this.hitAreaManager=new Ih,this.lastHitAreaKey=null,this.urlTagCursorStyle=null;var i=this.context;this.getTextWidth=function(t){return i.measureText(t).width};}return s(t,[{key:"destroy",value:function(){this.parent=void 0,this.scene=void 0,this.context=void 0,this.canvas=void 0,this.parser=void 0,this.defaultStyle=void 0,this.penManager&&(this.penManager.destroy(),this.penManager=void 0),this._tmpPenManager&&(this._tmpPenManager.destroy(),this._tmpPenManager=void 0),this.hitAreaManager&&(this.hitAreaManager.destroy(),this.hitAreaManager=void 0),this.pensPool=void 0,this.linesPool=void 0,this.wrapTextLinesPool=void 0;}},{key:"updatePenManager",value:function(t,e,i,n,r){if(void 0===r&&(r=this.penManager),r.clear(),""===t)return r;var s=this.parent.style;if(s.isWrapFitMode){var o=this.parent.padding;i=s.fixedWidth-o.left-o.right;}for(var a,h,l,u,c,d=this.canvas,f=this.context,v=function(t){return f.measureText(t).width},p=0,g=0,y=s.wrapCallback,k=s.wrapCallbackScope,m=!0,b=this.parser.splitText(t),x=this.wrapTextLinesPool,C=0,w=b.length;C0&&e!==$h&&i0&&t>e&&(t=e),t}},{key:"linesWidth",get:function(){return Math.ceil(this.penManager.getMaxLineWidth())}},{key:"linesHeight",get:function(){var t=this.desplayLinesCount,e=this.defaultStyle.lineHeight*t;return t>0&&(e-=this.defaultStyle.lineSpacing),e}},{key:"imageManager",get:function(){return this.parent.imageManager}},{key:"rtl",get:function(){return this.parent.style.rtl}},{key:"newPenManager",value:function(){return new Dh({pensPool:this.pensPool,linesPool:this.linesPool,tagToText:this.parser.propToTagText,tagToTextScope:this.parser})}},{key:"tmpPenManager",get:function(){return null===this._tmpPenManager&&(this._tmpPenManager=this.newPenManager()),this._tmpPenManager}},{key:"getPlainText",value:function(t,e,i){var n;if(null==t)n=this.penManager.plainText;else {var r=this.parser.splitText(t,1);n="";for(var s=0,o=r.length;si.width?i.width-r:0;var s=this.drawY+this.drawTLY,o=s+this.height;return e=s<0?0-s:o>i.height?i.height-o:0,i._textOX+=t,i._textOY+=e,this}};Object.assign(mu,lu);var bu=Phaser.Math.DegToRad,xu=Phaser.Math.RadToDeg,Cu=Phaser.Utils.Objects.GetValue,wu=function(t){a(i,t);var e=d(i);function i(t,r){var s;return n(this,i),(s=e.call(this,t,r)).renderable=!0,s.scrollFactorX=1,s.scrollFactorY=1,s.toLocalPosition=!0,s.originX=0,s.offsetX=0,s.offsetY=0,s}return s(i,[{key:"visible",get:function(){return this._visible},set:function(t){this.setDirty(this._visible!=t),this._visible=t;}},{key:"setVisible",value:function(t){return void 0===t&&(t=!0),this.visible=t,this}},{key:"alpha",get:function(){return this._alpha},set:function(t){this.setDirty(this._alpha!=t),this._alpha=t;}},{key:"setAlpha",value:function(t){return this.alpha=t,this}},{key:"x",get:function(){return this._x},set:function(t){this.setDirty(this._x!=t),this._x=t;}},{key:"setX",value:function(t){return this.x=t,this}},{key:"y",get:function(){return this._y},set:function(t){this.setDirty(this._y!=t),this._y=t;}},{key:"setY",value:function(t){return this.y=t,this}},{key:"setPosition",value:function(t,e){return this.x=t,this.y=e,this}},{key:"setInitialPosition",value:function(t,e){return this.x0=t,this.y0=e,this}},{key:"setScrollFactorX",value:function(t){return this.scrollFactorX=t,this}},{key:"setScrollFactorY",value:function(t){return this.scrollFactorY=t,this}},{key:"setScrollFactor",value:function(t,e){return void 0===e&&(e=t),this.scrollFactorX=t,this.scrollFactorY=e,this}},{key:"rotation",get:function(){return this._rotation},set:function(t){this.setDirty(this._rotation!=t),this._rotation=t;}},{key:"setRotation",value:function(t){return this.rotation=t,this}},{key:"angle",get:function(){return xu(this._rotation)},set:function(t){this.rotation=bu(t);}},{key:"setAngle",value:function(t){return this.angle=t,this}},{key:"scaleX",get:function(){return this._scaleX},set:function(t){this.setDirty(this._scaleX!==t),this._scaleX=t;}},{key:"setScaleX",value:function(t){return this.scaleX=t,this}},{key:"width",get:function(){return 0},set:function(t){}},{key:"setWidth",value:function(t,e){return void 0===e&&(e=!1),this.width=t,e&&(this.scaleY=this.scaleX),this}},{key:"leftSpace",get:function(){return this._leftSpace},set:function(t){this.setDirty(this._leftSpace!==t),this._leftSpace=t;}},{key:"setLeftSpace",value:function(t){return this.leftSpace=t,this}},{key:"rightSpace",get:function(){return this._rightSpace},set:function(t){this.setDirty(this._rightSpace!==t),this._rightSpace=t;}},{key:"setRightSpace",value:function(t){return this.rightSpace=t,this}},{key:"outerWidth",get:function(){return this.width+this.leftSpace+this.rightSpace}},{key:"scaleY",get:function(){return this._scaleY},set:function(t){this.setDirty(this._scaleY!==t),this._scaleY=t;}},{key:"setScaleY",value:function(t){return this.scaleY=t,this}},{key:"height",get:function(){return 0},set:function(t){}},{key:"setHeight",value:function(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}},{key:"setScale",value:function(t,e){return void 0===e&&(e=t),this.scaleX=t,this.scaleY=e,this}},{key:"setOrigin",value:function(t){return this.originX=t,this}},{key:"setAlign",value:function(t){return this.align=t,this}},{key:"modifyPorperties",value:function(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=Cu(t,"width",void 0),i=Cu(t,"height",void 0),n=Cu(t,"scaleX",void 0),r=Cu(t,"scaleY",void 0);return void 0!==e?void 0===i&&void 0===r?this.setWidth(e,!0):this.setWidth(e):void 0!==n&&this.setScaleX(n),void 0!==i?void 0===e&&void 0===n?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}},{key:"setDrawBelowCallback",value:function(t){return this.drawBelowCallback=t,this}},{key:"setDrawAboveCallback",value:function(t){return this.drawAboveCallback=t,this}},{key:"reset",value:function(){return this.setVisible().setAlpha(1).setPosition(0,0).setRotation(0).setScale(1,1).setLeftSpace(0).setRightSpace(0).setOrigin(0).setAlign().setDrawBelowCallback().setDrawAboveCallback(),this}},{key:"willRender",get:function(){return this.visible&&this.alpha>0}},{key:"drawX",get:function(){var t=this.x+this.leftSpace+this.offsetX-this.originX*this.width;return this.parent._textOX*this.scrollFactorX+t}},{key:"drawY",get:function(){var t=this.y+this.offsetY;return this.parent._textOY*this.scrollFactorY+t}},{key:"drawTLX",get:function(){return 0}},{key:"drawTLY",get:function(){return 0}},{key:"drawBLX",get:function(){return 0}},{key:"drawBLY",get:function(){return 0}},{key:"drawTRX",get:function(){return 0}},{key:"drawTRY",get:function(){return 0}},{key:"drawBRX",get:function(){return 0}},{key:"drawBRY",get:function(){return 0}},{key:"drawCenterX",get:function(){return (this.drawTRX+this.drawTLX)/2}},{key:"drawCenterY",get:function(){return (this.drawBLY+this.drawTLY)/2}}]),i}(nu);Object.assign(wu.prototype,mu);var Su=function(t,e,i){return e.hasOwnProperty(t)?e[t]:i[t]},Pu=Phaser.Utils.Objects.GetValue,Tu=function(t){a(i,t);var e=d(i);function i(t,r){var s;return n(this,i),(s=e.call(this,t,"background")).setScrollFactor(0),s.setColor(Pu(r,"color",null),Pu(r,"color2",null),Pu(r,"horizontalGradient",!0)),s.setStroke(Pu(r,"stroke",null),Pu(r,"strokeThickness",2)),s.setCornerRadius(Pu(r,"cornerRadius",0),Pu(r,"cornerIteration",null)),s}return s(i,[{key:"color",get:function(){return this._color},set:function(t){t=rh(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t;}},{key:"color2",get:function(){return this._color2},set:function(t){t=rh(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t;}},{key:"horizontalGradient",get:function(){return this._horizontalGradient},set:function(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t;}},{key:"setColor",value:function(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}},{key:"stroke",get:function(){return this._stroke},set:function(t){t=rh(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t;}},{key:"strokeThickness",get:function(){return this._strokeThickness},set:function(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t;}},{key:"setStroke",value:function(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}},{key:"cornerRadius",get:function(){return this._cornerRadius},set:function(t){this.setDirty(this._cornerRadius!=t),this._cornerRadius=t;}},{key:"cornerIteration",get:function(){return this._cornerIteration},set:function(t){this.setDirty(this._cornerIteration!=t),this._cornerIteration=t;}},{key:"modifyStyle",value:function(t){return t.hasOwnProperty("color")&&this.setColor(t.color,Su("color2",t,this),Su("horizontalGradient",t,this)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,Su("strokeThickness",t,this)),t.hasOwnProperty("cornerRadius")&&this.setCornerRadius(t.cornerRadius,Su("cornerIteration",t,this)),this}},{key:"modifyPorperties",value:function(t){return v(h(i.prototype),"modifyPorperties",this).call(this,t),this.modifyStyle(t),this}},{key:"setCornerRadius",value:function(t,e){return this.cornerRadius=t,this.cornerIteration=e,this}},{key:"renderContent",value:function(){Sh(this.parent,this.color,this.stroke,this.strokeThickness,this.cornerRadius,this.color2,this.horizontalGradient,this.cornerIteration);}}]),i}(wu),Ou=Phaser.Utils.Objects.GetValue,_u=function(t){a(i,t);var e=d(i);function i(t,r){var s;return n(this,i),(s=e.call(this,t,"innerbounds")).setScrollFactor(0),s.setColor(Ou(r,"color",null),Ou(r,"color2",null),Ou(r,"horizontalGradient",!0)),s.setStroke(Ou(r,"stroke",null),Ou(r,"strokeThickness",2)),s}return s(i,[{key:"color",get:function(){return this._color},set:function(t){t=rh(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t;}},{key:"color2",get:function(){return this._color2},set:function(t){t=rh(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t;}},{key:"horizontalGradient",get:function(){return this._horizontalGradient},set:function(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t;}},{key:"setColor",value:function(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}},{key:"stroke",get:function(){return this._stroke},set:function(t){t=rh(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t;}},{key:"strokeThickness",get:function(){return this._strokeThickness},set:function(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t;}},{key:"setStroke",value:function(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}},{key:"modifyPorperties",value:function(t){v(h(i.prototype),"modifyPorperties",this).call(this,t),t.hasOwnProperty("color")&&this.setColor(t.color,Ou(t,"color2",null),Ou(t,"horizontalGradient",!0)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,Ou(t,"strokeThickness",2));}},{key:"renderContent",value:function(){var t=this.parent.padding,e=t.left,i=t.top,n=this.parent.width-t.left-t.right,r=this.parent.height-t.top-t.bottom,s=this.context;if(null!=this.color){var o,a;if(null!=this.color2)(a=this.horizontalGradient?s.createLinearGradient(0,0,n,0):s.createLinearGradient(0,0,0,r)).addColorStop(0,this.color),a.addColorStop(1,this.color2),o=a;else o=this.color;s.fillStyle=o,s.fillRect(e,i,n,r);}null!=this.stroke&&this.strokeThickness>0&&(s.strokeStyle=this.stroke,s.lineWidth=this.strokeThickness,s.strokeRect(e,i,n,r));}}]),i}(wu),Eu=Phaser.Utils.Objects.GetValue,Ru=function(){function t(e,i){n(this,t),this.parent=e,this.set(i);}return s(t,[{key:"toJSON",value:function(){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}}},{key:"set",value:function(t){return this.setBold(Eu(t,"bold",!1)),this.setItalic(Eu(t,"italic",!1)),this.setFontSize(Eu(t,"fontSize","16px")),this.setFontFamily(Eu(t,"fontFamily","Courier")),this.setColor(Eu(t,"color","#fff")),this.setStrokeStyle(Eu(t,"stroke",null),Eu(t,"strokeThickness",0)),this.setShadow(Eu(t,"shadowColor",null),Eu(t,"shadowOffsetX",0),Eu(t,"shadowOffsetY",0),Eu(t,"shadowBlur",0)),this.setOffset(Eu(t,"offsetX",0),Eu(t,"offsetY",0)),this.setSpace(Eu(t,"leftSpace",0),Eu(t,"rightSpace",0)),this.setAlign(Eu(t,"align",void 0)),this.setBackgroundColor(Eu(t,"backgroundColor",null)),this.setBackgroundHeight(Eu(t,"backgroundHeight",void 0)),this.setBackgroundBottomY(Eu(t,"backgroundBottomY",void 0)),this}},{key:"modify",value:function(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(Su("stroke",t,this),Su("strokeThickness",t,this)),t.hasOwnProperty("shadowColor")&&this.setShadowColor(t.shadowColor),(t.hasOwnProperty("shadowOffsetX")||t.hasOwnProperty("shadowOffsetY"))&&this.setShadowOffset(Su("shadowOffsetX",t,this),Su("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}},{key:"setUpdateTextFlag",value:function(){return this.parent&&(this.parent.updateTextFlag=!0),this}},{key:"clone",value:function(){return new t(null,this.toJSON())}},{key:"copyFrom",value:function(t){return this.set(t.toJSON()),this}},{key:"copyTo",value:function(t){return t.set(this.toJSON()),this}},{key:"setBold",value:function(t){return void 0===t&&(t=!0),this.bold=t,this.setUpdateTextFlag(),this}},{key:"setItalic",value:function(t){return void 0===t&&(t=!0),this.italic=t,this.setUpdateTextFlag(),this}},{key:"fontStyle",get:function(){return this.bold&&this.italic?"bold italic":this.bold?"bold":this.italic?"italic":""}},{key:"setFontSize",value:function(t){return "number"==typeof t&&(t="".concat(t,"px")),this.fontSize=t,this.setUpdateTextFlag(),this}},{key:"setFontFamily",value:function(t){return this.fontFamily=t,this.setUpdateTextFlag(),this}},{key:"font",get:function(){return "".concat(this.fontStyle," ").concat(this.fontSize," ").concat(this.fontFamily)}},{key:"setColor",value:function(t){return this.color=rh(t),this}},{key:"hasFill",get:function(){return null!=this.color}},{key:"setStrokeStyle",value:function(t,e){return this.stroke=rh(t),void 0!==e&&(this.strokeThickness=e),this}},{key:"setStrokeThickness",value:function(t){return this.strokeThickness=t,this}},{key:"hasStroke",get:function(){return null!=this.stroke&&this.strokeThickness>0}},{key:"setShadowColor",value:function(t){return this.shadowColor=rh(t),this}},{key:"setShadowOffset",value:function(t,e){return void 0===t&&(t=0),void 0===e&&(e=0),this.shadowOffsetX=t,this.shadowOffsetY=e,this}},{key:"setShadowBlur",value:function(t){return void 0===t&&(t=0),this.shaodwBlur=t,this}},{key:"setShadow",value:function(t,e,i,n){return this.setShadowColor(t).setShadowOffset(e,i).setShadowBlur(n),this}},{key:"setBackgroundColor",value:function(t){return this.backgroundColor=rh(t),this}},{key:"hasBackgroundColor",get:function(){return null!=this.backgroundColor}},{key:"setBackgroundHeight",value:function(t){return this.backgroundHeight=t,this}},{key:"setBackgroundBottomY",value:function(t){return this.backgroundBottomY=t,this}},{key:"setOffsetX",value:function(t){return void 0===t&&(t=0),this.offsetX=t,this}},{key:"setOffsetY",value:function(t){return void 0===t&&(t=0),this.offsetY=t,this}},{key:"setOffset",value:function(t,e){return this.setOffsetX(t).setOffsetY(e),this}},{key:"setLeftSpace",value:function(t){return void 0===t&&(t=0),this.leftSpace=t,this}},{key:"setRightSpace",value:function(t){return void 0===t&&(t=0),this.rightSpace=t,this}},{key:"setSpace",value:function(t,e){return this.setLeftSpace(t).setRightSpace(e),this}},{key:"setAlign",value:function(t){return this.align=t,this}},{key:"syncFont",value:function(t){return t.font=this.font,this}},{key:"syncStyle",value:function(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}},{key:"syncShadow",value:function(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);}},{key:"getTextMetrics",value:function(t,e){return this.syncFont(t).syncStyle(t),t.measureText(e)}}]),t}(),Mu=Phaser.Utils.Array.Remove,Lu=Phaser.Utils.Array.Remove,Du="text",Au="image",Bu="drawer",zu="space",ju="command",Iu=function(t){return t.type===Du&&"\n"===t.text},Fu=function(t){return t.type===Du&&"\f"===t.text},Wu=function(t){return t.type===Du},Xu=function(t){a(i,t);var e=d(i);function i(t,r,s){var o;return n(this,i),(o=e.call(this,t,Du)).updateTextFlag=!1,o.style=new Ru(u(o),s),o.setText(r),o}return s(i,[{key:"autoRound",get:function(){return this.parent.autoRound}},{key:"offsetX",get:function(){return this.style.offsetX},set:function(t){this.style&&(this.style.offsetX=t);}},{key:"offsetY",get:function(){return this.style.offsetY},set:function(t){this.style&&(this.style.offsetY=t);}},{key:"leftSpace",get:function(){return this.style.leftSpace*this.scaleX},set:function(t){this.style&&(this.style.leftSpace=t),g(h(i.prototype),"leftSpace",t,this,!0);}},{key:"rightSpace",get:function(){return this.style.rightSpace*this.scaleX},set:function(t){this.style&&(this.style.rightSpace=t),g(h(i.prototype),"rightSpace",t,this,!0);}},{key:"align",get:function(){return this.style.align},set:function(t){this.style&&(this.style.align=t);}},{key:"modifyStyle",value:function(t){return this.setDirty(!0),this.style.modify(t),this.updateTextFlag&&this.updateTextSize(),this}},{key:"modifyPorperties",value:function(t){return t?(this.modifyStyle(t),v(h(i.prototype),"modifyPorperties",this).call(this,t),this):this}},{key:"setText",value:function(t){return this.setDirty(this.text!=t),this.text=t,this.updateTextSize(),this}},{key:"updateTextSize",value:function(){var t=this.text;if("\n"===t||"\f"===t||""===t)this.clearTextSize();else {var e,i,n=this.style.getTextMetrics(this.context,this.text);this.textWidth=n.width,"actualBoundingBoxAscent"in n?(e=n.actualBoundingBoxAscent,i=n.actualBoundingBoxDescent):(e=0,i=0),this.textHeight=e+i,this.ascent=e,this.descent=i;}return this.updateTextFlag=!1,this}},{key:"clearTextSize",value:function(){return this.textWidth=0,this.textHeight=0,this.ascent=0,this.descent=0,this}},{key:"copyTextSize",value:function(t){return this.textWidth=t.textWidth,this.textHeight=t.textHeight,this.ascent=t.ascent,this.descent=t.descent,this}},{key:"width",get:function(){return this.textWidth*this.scaleX},set:function(t){this.textWidth>0?this.scaleX=t/this.textWidth:this.scaleX=1;}},{key:"height",get:function(){return this.textHeight*this.scaleY},set:function(t){this.textHeight>0?this.scaleY=t/this.textHeight:this.scaleY=1;}},{key:"willRender",get:function(){return 0!==this.textWidth&&v(h(i.prototype),"willRender",this)}},{key:"renderContent",value:function(){var t=this.context,e=this.style;if(e.hasBackgroundColor){t.fillStyle=e.backgroundColor;var i=this.drawTLX,n=this.drawTRX-i,r=e.backgroundBottomY;null==r&&(r=this.drawBLY);var s=e.backgroundHeight;null==s&&(s=r-this.drawTLY);var o=r-s;t.fillRect(i,o,n,s);}var a=e.hasFill,h=e.hasStroke;(a||h)&&(e.syncFont(t).syncStyle(t),h&&(e.syncShadow(t),t.strokeText(this.text,0,0)),a&&(e.syncShadow(t),t.fillText(this.text,0,0)));}},{key:"drawTLX",get:function(){return -this.leftSpace}},{key:"drawTLY",get:function(){return -this.ascent}},{key:"drawBLX",get:function(){return -this.leftSpace}},{key:"drawBLY",get:function(){return this.descent}},{key:"drawTRX",get:function(){return this.textWidth+this.rightSpace}},{key:"drawTRY",get:function(){return -this.ascent}},{key:"drawBRX",get:function(){return this.textWidth+this.rightSpace}},{key:"drawBRY",get:function(){return this.descent}}]),i}(wu),Yu=function(t,e){var i=this.createCharChildren(t,e);return this.addChild(i),this},Gu=function(t){a(i,t);var e=d(i);function i(t,r,s){var o;return n(this,i),(o=e.call(this,t,Au)).setTexture(r,s),o}return s(i,[{key:"frameWidth",get:function(){return this.frameObj?this.frameObj.cutWidth:0}},{key:"frameHeight",get:function(){return this.frameObj?this.frameObj.cutHeight:0}},{key:"offsetY",get:function(){return -this.height},set:function(t){}},{key:"key",get:function(){return this._key},set:function(t){this.setDirty(this._key!=t),this._key=t;}},{key:"frame",get:function(){return this._frame},set:function(t){this.setDirty(this._frame!=t),this._frame=t;}},{key:"setTexture",value:function(t,e){return this.key=t,this.frame=e,this.frameObj=this.scene.sys.textures.getFrame(t,e),this}},{key:"width",get:function(){return this.frameWidth*this.scaleX},set:function(t){this.setDirty(this.width!==t),this.scaleX=t/this.frameWidth;}},{key:"height",get:function(){return this.frameHeight*this.scaleY},set:function(t){this.setDirty(this.height!==t),this.scaleY=t/this.frameHeight;}},{key:"setHeight",value:function(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}},{key:"renderContent",value:function(){var t=this.context,e=this.frameObj,i=this.frameWidth,n=this.frameHeight;t.drawImage(e.source.image,e.cutX,e.cutY,i,n,0,0,i,n);}},{key:"drawTLX",get:function(){return -this.leftSpace}},{key:"drawTLY",get:function(){return 0}},{key:"drawBLX",get:function(){return -this.leftSpace}},{key:"drawBLY",get:function(){return this.frameHeight}},{key:"drawTRX",get:function(){return this.frameWidth+this.rightSpace}},{key:"drawTRY",get:function(){return 0}},{key:"drawBRX",get:function(){return this.frameWidth+this.rightSpace}},{key:"drawBRY",get:function(){return this.frameHeight}}]),i}(wu),Vu=function(t){a(i,t);var e=d(i);function i(t,r,s,o){var a;return n(this,i),(a=e.call(this,t,Bu)).setRenderCallback(r),a.setDrawerSize(s,o),a}return s(i,[{key:"setRenderCallback",value:function(t){return t?this.renderContent=t.bind(this):delete this.renderContent,this}},{key:"setDrawerSize",value:function(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}},{key:"onFree",value:function(){v(h(i.prototype),"onFree",this).call(this),this.setRenderCallback();}},{key:"width",get:function(){return this.drawerWidth*this.scaleX},set:function(t){this.setDirty(this.width!==t),this.scaleX=this.drawerWidth>0?t/this.drawerWidth:1;}},{key:"height",get:function(){return this.drawerHeight*this.scaleY},set:function(t){this.setDirty(this.height!==t),this.scaleY=this.drawerHeight>0?t/this.drawerHeight:1;}},{key:"offsetY",get:function(){return -this.height},set:function(t){}},{key:"drawTLX",get:function(){return -this.leftSpace}},{key:"drawTLY",get:function(){return 0}},{key:"drawBLX",get:function(){return -this.leftSpace}},{key:"drawBLY",get:function(){return this.drawerHeight}},{key:"drawTRX",get:function(){return this.drawerWidth+this.rightSpace}},{key:"drawTRY",get:function(){return 0}},{key:"drawBRX",get:function(){return this.drawerWidth+this.rightSpace}},{key:"drawBRY",get:function(){return this.drawerHeight}}]),i}(wu),Hu=function(t){a(i,t);var e=d(i);function i(t,r){var s;return n(this,i),(s=e.call(this,t,zu)).setSpaceWidth(r),s}return s(i,[{key:"width",get:function(){return this.spaceWidth*this.scaleX},set:function(t){this.spaceWidth>0?this.scaleX=t/this.spaceWidth:this.scaleX=1;}},{key:"setSpaceWidth",value:function(t){return this.spaceWidth=t,this}}]),i}(wu),Nu=function(t){a(i,t);var e=d(i);function i(t,r,s,o,a){var h;return n(this,i),(h=e.call(this,t,ju)).setName(r).setParameter(o).setCallback(s,a),h}return s(i,[{key:"setName",value:function(t){return this.name=t,this}},{key:"setParameter",value:function(t){return this.param=t,this}},{key:"setCallback",value:function(t,e){return this.callback=t,this.scope=e,this}},{key:"exec",value:function(){return this.scope?this.callback.call(this.scope,this.param,this.name):this.callback(this.param,this.name)}},{key:"onFree",value:function(){v(h(i.prototype),"onFree",this).call(this),this.setName().setCallback().setParameter();}}]),i}(nu),Uu=function(t,e,i,n){void 0===n&&(n={word:[],width:0}),n.word.length=0;for(var r=t.length,s=e,o=n.word,a=0;s0&&!a){var h=this.fixedHeight-n;if(i>0)s=h/i;else s=(l=qu.call(this)).height,o=l.ascent,i=Math.floor((h-o)/s);}else {var l;s=(l=qu.call(this)).height,o=l.ascent;}}else if(this.fixedHeight>0){if(void 0===(i=$u(t,"maxLines"))){h=this.fixedHeight-n;i=Math.floor(h/s);}}else i=$u(t,"maxLines",0);void 0===o&&(o=s);var u=0===i,c=$u(t,"wrapWidth",void 0);void 0===c&&(c=this.fixedWidth>0?this.fixedWidth-r:1/0);for(var d=$u(t,"letterSpacing",0),f=$u(t,"hAlign",0),v=$u(t,"vAlign",0),p=$u(t,"charWrap",!1),g={callback:"runWordWrap",start:e,isLastPage:!1,padding:this.wrapPadding,ascent:o,lineHeight:s,maxLines:i,wrapWidth:c,letterSpacing:d,hAlign:f,vAlign:v,charWrap:p,children:[],lines:[],maxLineWidth:0,linesHeight:0},y=this.children,k=0,m=y.length;k0&&(_.push({children:E,width:R}),M=Math.max(M,R)),g.start+=O.length,g.isLastPage=!L&&g.start===T,g.maxLineWidth=M,g.linesHeight=_.length*s;var F=this.fixedWidth>0?this.fixedWidth:g.maxLineWidth+r,W=this.fixedHeight>0?this.fixedHeight:g.linesHeight+n;!function(t,e,i){var n,r,s=t.hAlign,o=t.vAlign,a=t.linesHeight;switch(o){case 1:case"center":r=(i-a)/2;break;case 2:case"bottom":r=i-a;break;default:r=0;}for(var h=t.lines,l=0,u=h.length;l0?(o=this.fixedWidth-r)/i:0;else if(this.fixedWidth>0){if(void 0===(i=ec(t,"maxLines",void 0))){var o=this.fixedWidth-r;i=Math.floor(o/s)+1;}}else i=ec(t,"maxLines",0);var a=0===i,h=ec(t,"fixedChildHeight",void 0);if(void 0===h){var l=ec(t,"charPerLine",void 0);if(void 0!==l){var u=this.fixedHeight-n;h=Math.floor(u/l);}}var c=ec(t,"wrapHeight",void 0);void 0===c&&(c=this.fixedHeight>0?this.fixedHeight-n:1/0);for(var d=ec(t,"letterSpacing",0),f=ec(t,"rtl",!0),v=ec(t,"hAlign",f?2:0),p=ec(t,"vAlign",0),g={callback:"runVerticalWrap",start:e,isLastPage:!1,padding:this.wrapPadding,lineWidth:s,maxLines:i,fixedChildHeight:h,wrapHeight:c,letterSpacing:d,hAlign:v,vAlign:p,rtl:f,children:[],lines:[],maxLineHeight:0,linesWidth:0},y=this.children,k=0,m=y.length;k0&&(_.push({children:E,height:R}),M=Math.max(M,R)),g.start+=O.length,g.isLastPage=g.start===T,g.maxLineHeight=M,g.linesWidth=_.length*s;var j=this.fixedWidth>0?this.fixedWidth:g.linesWidth+r,I=this.fixedHeight>0?this.fixedHeight:g.maxLineHeight+n;!function(t,e,i){var n,r,s=t.hAlign,o=t.vAlign,a=t.rtl,h=t.lines,l=t.lineWidth,u=t.linesWidth;switch(s){case 1:case"center":n=(e-u)/2;break;case 2:case"right":n=e-u;break;default:n=0;}a&&(n+=l);for(var c=0,d=h.length;c0?t:this.width,e>0?e:this.height),this):this},setPadding:function(t,e){var i=this.padding,n=i.left,r=i.right,s=i.top,o=i.bottom;return Ue(i,t,e),this.dirty=this.dirty||n!=i.left||r!=i.right||s!=i.top||o!=i.bottom,this},getPadding:function(t){return Ne(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),Mu(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 Lu(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,n,r,s=Array.isArray(t);void 0===e||e===this.children.length?s?(i=this.children).push.apply(i,y(t)):this.children.push(t):s?(n=this.children).splice.apply(n,[e,0].concat(y(t))):this.children.splice(e,0,t);(this.lastAppendedChildren.length=0,s)?(r=this.lastAppendedChildren).push.apply(r,y(t)):this.lastAppendedChildren.push(t);return this},createCharChild:function(t,e){e&&this.textStyle.modify(e);var i=this.poolManager.allocate(Du);return null===i?i=new Xu(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=[],n=0,r=t.length;ne&&(n=e,r=t);})),r},getCharWorldPosition:function(t,e,i,n){return "number"==typeof t&&(t=this.getCharChild(t,!0)),ku(this,t,e,i,n)},setToMinSize:function(){for(var t=this.children,e=0,i=0,n=0,r=t.length;n=i.length&&(t=i.length);for(var n=0,r=0;r0,o=0,a=e.length;o0;this.dirty=this.dirty||this._radiusTL!==t||this._convexTL!==e,this._convexTL=e,this._radiusTL=Math.abs(t);}},{key:"radiusTR",get:function(){return this._radiusTR},set:function(t){var e=t>0;this.dirty=this.dirty||this._radiusTR!==t||this._convexTR!==e,this._convexTR=e,this._radiusTR=Math.abs(t);}},{key:"radiusBL",get:function(){return this._radiusBL},set:function(t){var e=t>0;this.dirty=this.dirty||this._radiusBL!==t||this._convexBL!==e,this._convexBL=e,this._radiusBL=Math.abs(t);}},{key:"radiusBR",get:function(){return this._radiusBR},set:function(t){var e=t>0;this.dirty=this.dirty||this._radiusBR!==t||this._convexBR!==e,this._convexBR=e,this._radiusBR=Math.abs(t);}},{key:"radius",get:function(){return Math.max(this.radiusTL,this.radiusTR,this.radiusBL,this.radiusBR)},set:function(t){"number"==typeof t?(this.radiusTL=t,this.radiusTR=t,this.radiusBL=t,this.radiusBR=t):(this.radiusTL=dd(t,"tl",0),this.radiusTR=dd(t,"tr",0),this.radiusBL=dd(t,"bl",0),this.radiusBR=dd(t,"br",0));}},{key:"setRadius",value:function(t){return void 0===t&&(t=0),this.radius=t,this}},{key:"iterations",get:function(){return this._iterations},set:function(t){this.dirty=this.dirty||this._iterations!==t,this._iterations=t;}},{key:"setIterations",value:function(t){return this.iterations=t,this}},{key:"updateData",value:function(){var t=this.pathData;t.length=0;var e,n=this.width,r=this.height,s=this.iterations+1;(e=this.radiusTL)>0?this._convexTL?Ko(e,e,e,e,180,270,!1,s,t):Ko(0,0,e,e,90,0,!0,s,t):No(0,0,t);(e=this.radiusTR)>0?this._convexTR?Ko(n-e,e,e,e,270,360,!1,s,t):Ko(n,0,e,e,180,90,!0,s,t):No(n,0,t);(e=this.radiusBR)>0?this._convexBR?Ko(n-e,r-e,e,e,0,90,!1,s,t):Ko(n,r,e,e,270,180,!0,s,t):No(n,r,t);(e=this.radiusBL)>0?this._convexBL?Ko(e,r-e,e,e,90,180,!1,s,t):Ko(0,r,e,e,360,270,!0,s,t):No(0,r,t);return t.push(t[0],t[1]),qc(this.x,this.y,t),v(h(i.prototype),"updateData",this).call(this),this}}]),i}(Vc);Phaser.Renderer.WebGL.Utils.getTintAppendFloatAlpha,Phaser.Math.Wrap;var vd=Phaser.Math.Linear,pd=function(){var t,e,i,n,r,s,o=this.getShape("triangle"),a=this.padding,h=this.width-a.right,l=0+a.left,u=this.height-a.bottom,c=0+a.top,d=(l+h)/2,f=(c+u)/2,v={0:{a:{x:l,y:c},b:{x:h,y:f},c:{x:l,y:u}},1:{a:{x:l,y:c},b:{x:d,y:u},c:{x:h,y:c}},2:{a:{x:h,y:c},b:{x:l,y:f},c:{x:h,y:u}},3:{a:{x:l,y:u},b:{x:d,y:c},c:{x:h,y:u}}};if(void 0===this.previousDirection){var p=v[this.direction],g=p.a,y=p.b,k=p.c;t=g.x,e=g.y,i=y.x,n=y.y,r=k.x,s=k.y;}else {var m=v[this.previousDirection],b=v[this.direction],x=this.easeDirectionProgress;t=vd(m.a.x,b.a.x,x),e=vd(m.a.y,b.a.y,x),i=vd(m.b.x,b.b.x,x),n=vd(m.b.y,b.b.y,x),r=vd(m.c.x,b.c.x,x),s=vd(m.c.y,b.c.y,x);}o.startAt(t,e).lineTo(i,n).lineTo(r,s),this.arrowOnly?o.end():o.close();},gd=(0, Phaser.Math.DegToRad)(120),yd=function(t){t=this.getShape("triangle");var e=this.width/2,i=this.height/2,n=Math.min(e,i)*this.radius,r=this.verticeRotation;t.startAt(e+n*Math.cos(r+gd),i+n*Math.sin(r+gd)).lineTo(e+n*Math.cos(r),i+n*Math.sin(r)).lineTo(e+n*Math.cos(r-gd),i+n*Math.sin(r-gd)),this.arrowOnly?t.end():t.close();},kd={buildShapes:function(){this.addShape((new cd).setName("triangle"));},updateShapes:function(){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?pd.call(this):yd.call(this);}},md={setEaseDuration:function(t){return void 0===t&&(t=0),this.easeDuration=t,this},playEaseDirectionation:function(){return void 0===this.easeDirectionProgressTask&&(this.easeDirectionProgressTask=new kn(this,{eventEmitter:null})),this.easeDirectionProgressTask.restart({key:"easeDirectionProgress",from:0,to:1,duration:this.easeDuration}),this},stopEaseDirection:function(){return void 0===this.easeDirectionProgressTask||this.easeDirectionProgressTask.stop(),this}},bd=Phaser.Utils.Objects.GetValue,xd=Phaser.Utils.Objects.IsPlainObject,Cd=Phaser.Math.DegToRad,wd=Phaser.Math.RadToDeg,Sd=function(t){a(r,t);var e=d(r);function r(t,i,s,o,a,h,l){var u,c,d,f,v,p,g,y,k;if(n(this,r),xd(i)){var m=i;i=m.x,s=m.y,o=m.width,a=m.height,h=m.color,l=m.alpha,c=m.strokeColor,d=m.strokeAlpha,f=m.strokeWidth,v=m.arrowOnly,p=m.direction,g=m.easeDuration,y=m.padding,k=m.radius;}return void 0===i&&(i=0),void 0===s&&(s=0),void 0===o&&(o=1),void 0===a&&(a=o),void 0===v&&(v=!1),void 0===p&&(p=0),void 0===g&&(g=0),void 0===y&&(y=0),void 0===k&&(k=void 0),(u=e.call(this,t,i,s,o,a)).type="rexTriangle",u.setFillStyle(h,l),void 0!==c&&void 0===f&&(f=2),u.setStrokeStyle(f,c,d),u.setArrowOnly(v),u.setDirection(p,g),u.setPadding(y),u.setRadius(k),u.buildShapes(),u}return s(r,[{key:"arrowOnly",get:function(){return this._arrowOnly},set:function(t){this.dirty=this.dirty||this._arrowOnly!=t,this._arrowOnly=t;}},{key:"setArrowOnly",value:function(t){return void 0===t&&(t=!0),this.arrowOnly=t,this}},{key:"direction",get:function(){return this._direction},set:function(t){t=Td(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());}},{key:"setDirection",value:function(t,e){return void 0!==e&&this.setEaseDuration(e),this.direction=t,this}},{key:"toggleDirection",value:function(t){return this.setDirection(this.direction+2,t),this}},{key:"easeDirectionProgress",get:function(){return this._easeDirectionProgress},set:function(t){this._easeDirectionProgress!==t&&(this._easeDirectionProgress=t,this.dirty=!0);}},{key:"setPadding",value:function(t,e,n,r){if("object"===i(t)){var s=t,o=bd(s,"x",null);null!==o?(t=o,n=o):(t=bd(s,"left",0),n=bd(s,"right",t));var a=bd(s,"y",null);null!==a?(e=a,r=a):(e=bd(s,"top",0),r=bd(s,"bottom",e));}else void 0===t&&(t=0),void 0===e&&(e=t),void 0===n&&(n=t),void 0===r&&(r=e);return void 0===this.padding&&(this.padding={}),this.dirty=this.dirty||this.padding.left!=t||this.padding.top!=e||this.padding.right!=n||this.padding.bottom!=r,this.padding.left=t,this.padding.top=e,this.padding.right=n,this.padding.bottom=r,this.setRadius(),this}},{key:"radius",get:function(){return this._radius},set:function(t){this.dirty=this.dirty||this._radius!=t,this._radius=t;}},{key:"setRadius",value:function(t){return this.radius=t,this.shapeMode=null==t?0:1,this}},{key:"verticeRotation",get:function(){return this._verticeRotation},set:function(t){this.dirty=this.dirty||this._verticeRotation!=t,this._verticeRotation=t;}},{key:"setVerticeRotation",value:function(t){return this.verticeRotation=t,this}},{key:"verticeAngle",get:function(){return wd(this.verticeRotation)},set:function(t){this.verticeRotation=Cd(t);}},{key:"setVerticeAngle",value:function(t){return this.verticeAngle=t,this}}]),r}(Wc),Pd={right:0,down:1,left:2,up:3},Td=function(t){return "string"==typeof t&&(t=Pd[t]),t%=4};Object.assign(Sd.prototype,kd,md);var Od=function(t){a(i,t);var e=d(i);function i(t,r){var s;n(this,i),void 0===r&&(r={}),(s=e.call(this,t,r)).type="rexTweaker.FolderTitle";var o=new Sd(t,r.expandedIcon);return t.add.existing(o),s.addSpace().add(o,{proportion:0,expand:!1,padding:1,fitRatio:1}),s.addChildrenMap("expandedIcon",o),s}return s(i,[{key:"setExpandedState",value:function(t){void 0===t&&(t=!0);var e=t?"down":"right";return this.childrenMap.expandedIcon.setDirection(e),this}}]),i}(Ac),_d=function(t,e){var i=new uk(t,e);return t.add.existing(i),i},Ed=function(t,e,i){return Ka(t,i)},Rd=function(t){a(i,t);var e=d(i);function i(t,r){return n(this,i),void 0===r&&(r={}),r.destroy=!1,e.call(this,t,r)}return s(i,[{key:"onOpen",value:function(){this.emit("open",this.parent,this),v(h(i.prototype),"onOpen",this).call(this);}},{key:"onClose",value:function(){this.emit("close",this.parent,this),v(h(i.prototype),"onClose",this).call(this);}}]),i}(Vn),Md={expand:function(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.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:function(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.reLayoutTarget?this.reLayoutTarget:this.getTopmostSizer()).layout(),this.emit("collapse.complete",this);}),this).requestClose(null,t),this},toggle:function(t){return this.expanded?this.collapse(t):this.expand(t),this}},Ld=function(t,e){Wi.popUp.call(t,e,this.expandDirection);},Dd=function(t,e){Wi.scaleDown.call(t,e,this.expandDirection);},Ad={setTransitionDuration:function(t){return this.transitionDuration=t,this.childTransition.setTransitInTime(t).setTransitOutTime(t),this},setExpandCallback:function(t){return void 0===t&&(t=Ld.bind(this)),this.childTransition.setTransitInCallback(t),this},setCollapseCallback:function(t){return void 0===t&&(t=Dd.bind(this)),this.childTransition.setTransitOutCallback(t),this}},Bd=Phaser.Utils.Objects.GetValue,zd=function(t){a(i,t);var e=d(i);function i(t,r){var s;n(this,i),void 0===r&&(r={}),r.hasOwnProperty("orientation")||(r.orientation=1),(s=e.call(this,t,r)).type="rexFolder",s.expanded=void 0,s.expandDirection=1===s.orientation?"y":"x";var o=r.background,a=r.title,h=r.child;o&&s.addBackground(o);var l=1===s.orientation?"left":"top",c=Bd(r,"align.title",l),d=Bd(r,"expand.title",!0);s.add(a,{proportion:0,align:c,expand:d});var f=Bd(r,"toggleByTarget",void 0),v=Bd(r,"toggleClickConfig");if(void 0===f&&(f=a),f&&Pr.onClick.call(f,(function(){this.toggle();}),u(s),v),s.childTransition=new Rd(h),!Bd(r,"customChildOrigin",!1)){var p=s.rtl?1:0;h.setOrigin(p);}c=Bd(r,"align.child","left");var g=(d=Bd(r,"expand.child",!0))?1:0;s.add(h,{proportion:g,align:c,expand:d}),s.addChildrenMap("title",a),s.addChildrenMap("child",h),s.addChildrenMap("background",o);var y=r.transition;s.setTransitionDuration(Bd(y,"duration",200)),s.setExpandCallback(Bd(y,"expandCallback",void 0)),s.setCollapseCallback(Bd(y,"collapseCallback",void 0)),s.reLayoutTarget=Bd(r,"reLayoutTarget",void 0);var k=r.onExpandStart;k&&s.on("expand.start",k);var m=r.onExpandComplete;m&&s.on("expand.complete",m);var b=r.onCollapseStart;b&&s.on("collapse.start",b);var x=r.onCollapseComplete;return x&&s.on("collapse.complete",x),s}return s(i)}(To);Object.assign(zd.prototype,Md,Ad);var jd=function(t){a(i,t);var e=d(i);function i(t,r){var s;return n(this,i),(s=e.call(this,t,r)).type="rexTweaker.Folder",s}return s(i,[{key:"setTitle",value:function(t){return this.childrenMap.title.setTitle(t),this}}]),i}(zd);Object.assign(jd.prototype,{setBindingTarget:function(t){return this.childrenMap.child.setBindingTarget(t),this}},{getMaxInputRowTitleWidth:function(){return this.childrenMap.child.getMaxInputRowTitleWidth()+this.getInnerPadding("left")},setInputRowTitleWidth:function(t){return t-=this.getInnerPadding("left"),this.childrenMap.child.setInputRowTitleWidth(t),this}});var Id=Phaser.Utils.Objects.GetValue,Fd=Phaser.Utils.Objects.GetValue,Wd=To.prototype.add,Xd=To.prototype.addSpace,Yd=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)&&Xd.call(this),Wd.call(this,t,{proportion:i,expand:!0});var n=!this.buttonsExpand&&"center"===this.buttonsAlign;n&&Xd.call(this),this.hasTailSpace=n;}else Wd.call(this,t,{proportion:i,expand:!0}),this.hasTailSpace=!1;else if(this.hasTailSpace){var r=this.sizerChildren.length-1;Wd.call(this,t,{index:r,proportion:i,expand:!0});}else Wd.call(this,t,{proportion:i,expand:!0});return e&&this.buttonGroup.add(t),this},Gd={addButton:function(t){if(ur(t))for(var e=t,i=0,n=e.length;i=0;i--)Nd.call(this,e[i],t);return this}},Kd=function(t,e,i){if(t){var n=this.setValueCallback,r=this.setValueCallbackScope;n&&(r?n.call(r,t,e,i):n(t,e,i)),this.fireEvent("button.statechange",t,e,i);}},Jd=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 n=t._selected;t._selected=i,Kd.call(e,t,i,n);}},enumerable:!0,configurable:!0}),t.selected=!1;},qd={add:function(t){return this.buttons.push(t),t._click||(t._click=new wr(t,this.clickConfig),t._click.on("click",(function(t,e,i,n){this.fireEvent("button.click",e,i,n);}),this).on("enable",(function(t,e){this.fireEvent("button.enable",e);}),this).on("disable",(function(t,e){this.fireEvent("button.disable",e);}),this),t.on("pointerover",(function(e,i,n,r){this.fireEvent("button.over",t,e,r);}),this).on("pointerout",(function(e,i){this.fireEvent("button.out",t,e,i);}),this).on("pointerdown",(function(e,i,n,r){this.fireEvent("button.down",t,e,r);}),this).on("pointerup",(function(e,i){this.fireEvent("button.up",t,e,i);}),this)),this.buttonsType&&(void 0===t.name&&console.error("".concat(this.parent.constructor.name,": Option button miss value")),Jd.call(this,t)),this},addMultiple:function(t){for(var e=0,i=t.length;e2?o-2:0),h=2;ha.height/2)){r>(h=ff(a.left,a.centerY,t,e))&&(r=h,n=s);var h,l=i[s+1];if(!l||l.y!==a.y)r>(h=ff(a.right,a.centerY,t,e))&&(r=h,n=s+1);}}return n},pf=Phaser.Utils.Objects.IsPlainObject,gf=Phaser.Utils.Objects.GetValue,yf=Phaser.Display.Align.CENTER,kf=function(t,e,i,n){if("\n"===t)return this.addNewLine(),this;var r;(Ae.call(this,t),pf(e))&&(e=gf(r=e,"padding",0),i=gf(r,"key",void 0),n=gf(r,"index",void 0));return void 0===e&&(e=0),(r=this.getSizerConfig(t)).align=yf,r.padding=Le(e),void 0===n||n>=this.sizerChildren.length?this.sizerChildren.push(t):this.sizerChildren.splice(n,0,t),void 0!==i&&this.addChildrenMap(i,t),this},mf={add:function(t,e,i){if(ur(t))for(var n=t,r=0,s=n.length;r=0;e--)this.remove(this.sizerChildren[e],t);return this},clear:function(t){return this.sizerChildren.length=0,go.call(this,t),this}},Cf={getChildrenWidth:function(){return this.rexSizer.hidden?0:this.maxChildWidth+this.space.left+this.space.right},getChildrenHeight:function(){return this.rexSizer.hidden?0:this.widthWrapResult.height+this.space.top+this.space.bottom},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,n=0,r=i.length;nr&&Ef.addNewLine(this);}else for(s=0,o=t.length;s=0;i--)Af.call(this,e[i],t);return this}},zf=Phaser.Utils.Objects.GetValue,jf=function(t){a(i,t);var e=d(i);function i(t,r){var s;n(this,i),void 0===r&&(r={});var o=r.space;"number"==typeof o&&(r.space={item:o,line:o}),(s=e.call(this,t,r)).type="rexFixWidthButtons",s.buttonGroup=new rf({parent:u(s),eventEmitter:zf(r,"eventEmitter",u(s)),groupName:zf(r,"groupName",void 0),clickConfig:zf(r,"click",void 0)}).setButtonsType(r);var a=zf(r,"background",void 0),h=zf(r,"buttons",void 0);return s.buttonsAlign=zf(r,"align",void 0),a&&s.addBackground(a),h&&s.addButtons(h),s.addChildrenMap("background",a),s.addChildrenMap("buttons",s.buttonGroup.buttons),s}return s(i,[{key:"destroy",value:function(t){this.scene&&!this.ignoreDestroy&&(v(h(i.prototype),"destroy",this).call(this,t),this.buttonGroup.destroy(),this.buttonGroup=void 0);}},{key:"buttons",get:function(){return this.buttonGroup.buttons}},{key:"groupName",get:function(){return this.buttonGroup.groupName},set:function(t){this.buttonGroup.groupName=t;}},{key:"eventEmitter",get:function(){return this.buttonGroup.eventEmitter}}]),i}(Of);Object.assign(jf.prototype,Mf,Bf,nf,of);var If=Phaser.Utils.Objects.IsPlainObject,Ff=Phaser.Utils.Objects.GetValue,Wf=Phaser.Display.Align.CENTER,Xf=Phaser.Utils.String.UUID,Yf={add:function(t,e,i,n,r,s,o,a,h){(Ae.call(this,t),If(e))&&(e=Ff(l=e,"key",void 0),i=Ff(l,"align",Wf),a=Ff(l,"offsetX",0),h=Ff(l,"offsetY",0),n=Ff(l,"padding",0),r=Ff(l,"expand",!0),t.isRexSizer||(s=Ff(l,"minWidth",t._minWidth),o=Ff(l,"minHeight",t._minHeighted)));var l,u=void 0!==e;return u||(e=Xf()),"string"==typeof i&&(i=ee[i]),void 0===i&&(i=Wf),void 0===a&&(a=0),void 0===h&&(h=0),void 0===n&&(n=0),void 0===r&&(r=!0),t.isRexSizer||(void 0===s&&(s=t._minWidth),void 0===o&&(o=t._minHeight)),(l=this.getSizerConfig(t)).align=i,l.alignOffsetX=a,l.alignOffsetY=h,l.padding=Le(n),If(r)?(l.expandWidth=Ff(r,"width",!1),l.expandHeight=Ff(r,"height",!1)):(l.expandWidth=r,l.expandHeight=r),t.isRexSizer||(l.expandWidth&&(t.minWidth=void 0===s?kt(t):s),l.expandHeight&&(t.minHeight=void 0===o?mt(t):o)),this.sizerChildren.hasOwnProperty(e)&&this.sizerChildren[e].destroy(),this.sizerChildren[e]=t,u&&this.addChildrenMap(e,t),this}},Gf={remove:function(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]),Ie.call(this,t,e),this},removeAll:function(t){for(var e in this.sizerChildren)this.remove(e,t);return this},clear:function(t){for(var e in this.sizerChildren)delete this.sizerChildren[e],this.childrenMap.hasOwnProperty(e)&&delete this.childrenMap[e];return go.call(this,t),this}},Vf={getChildrenWidth:function(){if(this.rexSizer.hidden)return 0;var t,e,i,n=0,r=this.sizerChildren;for(var s in r)e=(t=r[s]).rexSizer.padding,i=this.getChildWidth(t)+e.left+e.right,n=Math.max(i,n);return n+this.space.left+this.space.right},getChildrenHeight:function(){if(this.rexSizer.hidden)return 0;var t,e,i,n=0,r=this.sizerChildren;for(var s in r)i=(t=r[s]).isRexSizer?Math.max(t.minHeight,t.childrenHeight):void 0!==t.minHeight?t.minHeight:mt(t),i+=(e=t.rexSizer.padding).top+e.bottom,n=Math.max(i,n);return n+this.space.top+this.space.bottom},getExpandedChildWidth:function(t,e){var i;void 0===e&&(e=this.width);var n=t.rexSizer;if(n.expandWidth){var r=e-this.space.left-this.space.right,s=n.padding;i=r-s.left-s.right;}return i},getExpandedChildHeight:function(t,e){var i;void 0===e&&(e=this.height);var n=t.rexSizer;if(n.expandHeight){var r=e-this.space.top-this.space.bottom,s=n.padding;i=r-s.top-s.bottom;}return i},getChildrenSizers:function(t){void 0===t&&(t=[]);var e,i=this.sizerChildren;for(var n in i)(e=i[n]).isRexSizer&&t.push(e);return t},layoutChildren:function(){var t,e,i,n,r,s,o,a,h,l=this.innerLeft,u=this.innerTop,c=this.innerWidth,d=this.innerHeight,f=this.sizerChildren;for(var v in f)(t=f[v]).rexSizer.hidden||(i=(e=t.rexSizer).padding,mr.call(this,t),t.isRexSizer?(t.runLayout(this,this.getExpandedChildWidth(t),this.getExpandedChildHeight(t)),ro(t,this)):(a=void 0,h=void 0,e.expandWidth&&(a=c-i.left-i.right),e.expandHeight&&(h=d-i.top-i.bottom),pr(t,a,h)),n=l+i.left,s=c-i.left-i.right,r=u+i.top,o=d-i.top-i.bottom,br.call(this,t,n,r,s,o,e.align,e.alignOffsetX,e.alignOffsetY));}};Object.assign(Vf,Yf,Gf);var Hf=Phaser.Utils.Objects.IsPlainObject,Nf=Phaser.Utils.Objects.GetValue,Uf=function(t){a(i,t);var e=d(i);function i(t,r,s,o,a,h){var l;return n(this,i),Hf(r)?(r=Nf(h=r,"x",0),s=Nf(h,"y",0),o=Nf(h,"width",void 0),a=Nf(h,"height",void 0)):Hf(o)&&(o=Nf(h=o,"width",void 0),a=Nf(h,"height",void 0)),(l=e.call(this,t,r,s,o,a,h)).type="rexOverlapSizer",l.sizerChildren={},l.addChildrenMap("items",l.sizerChildren),l}return s(i,[{key:"childToKey",value:function(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}}]),i}(no);Object.assign(Uf.prototype,Vf);var Kf=Uf.prototype.add,Jf=function(t,e,i,n,r,s,o,a,h){return t.setVisible(!1),Kf.call(this,t,e,i,n,r,s,o,a,h),this},qf={add:Jf,addPage:Jf},Zf=Kt.prototype.setChildVisible,$f={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?(Zf.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 n=this.currentPage;return n&&(Zf.call(this,n,!0),this.emit("pagevisible",n,this._currentKey,this),void 0===e&&(e=this.fadeInDuration),e>0&&n.setAlpha(0).fadeIn(e,1)),this},hasPage:function(t){return this.sizerChildren.hasOwnProperty(t)}};Object.assign($f,qf);var Qf=Phaser.Utils.Objects.GetValue,tv=function(t){a(i,t);var e=d(i);function i(t,r){var s;return n(this,i),(s=e.call(this,t,r)).type="rexPages",s.childrenMap=s.sizerChildren,s._previousKey=void 0,s._currentKey=void 0,s.setSwapMode(Qf(r,"swapMode",0)),s.setFadeInDuration(Qf(r,"fadeIn",0)),s}return s(i,[{key:"setSwapMode",value:function(t){return "string"==typeof t&&(t=ev[t]),this.swapMode=t,this}},{key:"setFadeInDuration",value:function(t){return this.fadeInDuration=t,this}},{key:"previousKey",get:function(){return this._previousKey}},{key:"currentKey",get:function(){return this._currentKey},set:function(t){this.swapPage(t);}},{key:"currentPage",get:function(){return this.getPage(this.currentKey)}},{key:"previousPage",get:function(){return this.getPage(this.previousKey)}},{key:"keys",get:function(){return Object.keys(this.sizerChildren)}}]),i}(Uf);Object.assign(tv.prototype,$f);var ev={invisible:0,destroy:1},iv=Phaser.Utils.Objects.IsPlainObject,nv=Phaser.Utils.Objects.GetValue,rv=Phaser.Utils.String.UUID,sv={swapPage:function(t,e){var i,n;null!=(i="number"==typeof t?t:this.getPageIndex(t))&&(void 0!==e&&(n=this.childrenMap.pages.fadeInDuration,this.childrenMap.pages.fadeInDuration=e),this.childrenMap.tabs.emitButtonClick(i),void 0!==n&&(this.childrenMap.pages.fadeInDuration=n));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}},ov={removePage:function(t,e){"number"==typeof t&&(t=this.getPageKey(t));var i=this.childrenMap.tabs,n=i.getByName(t),r=this.childrenMap.pages,s=r.getElement(t);return n&&s?(r.removeChildrenMap(t),i.removeButton(n,e),r.remove(s,e),this):this}},av={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,n=e.length;i1?e-1:0),n=1;n=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!=n&&(r=e.getCharChild(n))&&("\n"===r.text&&r.copyTextSize(e.lastInsertCursor),r.scrollTo(),e.emit("cursorin",r,n,e)),e.emit("movecursor",n,t.prevCursorPosition,e),t.prevCursorPosition=n;}}(this)):(Yv(this),Gv(this)),this}},{key:"setNumberInput",value:function(){return this.onUpdateCallback=Xv,this}},{key:"setSelectAllWhenFocusEnable",value:function(t){return void 0===t&&(t=!0),this.selectAllWhenFocus=t,this}}]),i}(Wv),Nv=Phaser.Utils.Objects.GetValue,Uv=["inputType","onOpen","onFocus","onClose","onBlur","onUpdate","enterClose","readOnly","maxLength","minLength","selectAll"],Kv=function(t,e){if(t&&"number"!=typeof t){if(t.hasOwnProperty(e))return !0;if(-1!==e.indexOf(".")){for(var i=e.split("."),n=t,r=0;rt.length?i:t})),l.value=t.join(c);}else l.value=t.join(i.slice(a,a+l.count));a+=l.count,l.added||(h+=l.count);}}var d=e[o-1];return o>1&&"string"==typeof d.value&&(d.added||d.removed)&&t.equals("",d.value)&&(e[o-2].value+=d.value,e.pop()),e}$v.prototype={diff:function(t,e){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=i.callback;"function"==typeof i&&(n=i,i={}),this.options=i;var r=this;function s(t){return n?(setTimeout((function(){n(void 0,t);}),0),!0):t}t=this.castInput(t),e=this.castInput(e),t=this.removeEmpty(this.tokenize(t));var o=(e=this.removeEmpty(this.tokenize(e))).length,a=t.length,h=1,l=o+a;i.maxEditLength&&(l=Math.min(l,i.maxEditLength));var u=[{newPos:-1,components:[]}],c=this.extractCommon(u[0],e,t,0);if(u[0].newPos+1>=o&&c+1>=a)return s([{value:this.join(e),count:e.length}]);function d(){for(var i=-1*h;i<=h;i+=2){var n=void 0,l=u[i-1],c=u[i+1],d=(c?c.newPos:0)-i;l&&(u[i-1]=void 0);var f=l&&l.newPos+1=o&&d+1>=a)return s(Qv(r,n.components,e,t,r.useLongestToken));u[i]=n;}else u[i]=void 0;}var p;h++;}if(n)!function t(){setTimeout((function(){if(h>l)return n();d()||t();}),0);}();else for(;h<=l;){var f=d();if(f)return f}},pushComponent:function(t,e,i){var n=t[t.length-1];n&&n.added===e&&n.removed===i?t[t.length-1]={count:n.count+1,added:e,removed:i}:t.push({count:1,added:e,removed:i});},extractCommon:function(t,e,i,n){for(var r=e.length,s=i.length,o=t.newPos,a=o-n,h=0;o+1b.bottom&&(l=c.getTopLeft().y,t.setOrigin(0,1).setPosition(h+d,l+f));},lg={down:0,up:1},ug=Phaser.Utils.Objects.GetValue,cg=function(t){a(i,t);var e=d(i);function i(t,r){var s;n(this,i),void 0===r&&(r={}),null==r.transitIn&&(r.transitIn=function(t,e){Ai(t,e,"y","Cubic");}),null==r.transitOut&&(r.transitOut=function(t,e){!function(t,e,i,n,r){void 0===n&&(n="Linear");var s={mode:0};switch(i){case 0:case"x":s.end={x:0};break;case 1:case"y":s.end={y:0};break;default:s.end=0;}s.duration=e,s.ease=n,void 0===r?r=new Li(t,s):r.resetFromJSON(s),r.restart();}(t,e,"y","Linear");}),r.manualClose=!0,r.clickOutsideClose=!0,r.destroy=!0,s=e.call(this,t,r),hg(t,r),t.isRexSizer&&t.layout();var o=ug(r,"touchOutsideClose",!1),a=ug(r,"anyTouchClose",!1);return a&&(o=!1),a?s.once("open",s.anyTouchClose,u(s)):o&&s.once("open",s.touchOutsideClose,u(s)),s.requestOpen(),s}return s(i,[{key:"shutdown",value:function(t){this.isShutdown||(this.scene.input.off("pointerup",this.touchCloseCallback,this),v(h(i.prototype),"shutdown",this).call(this,t));}},{key:"touchOutsideClose",value:function(){return this.scene.input.on("pointerup",this.touchCloseCallback,this),this.clickOutsideTest=!0,this}},{key:"anyTouchClose",value:function(){return this.scene.input.once("pointerup",this.touchCloseCallback,this),this}},{key:"touchCloseCallback",value:function(t){this.clickOutsideTest&&nr(this.parent,t.worldX,t.worldY)||this.requestClose();}},{key:"onOpen",value:function(){this.emit("open",this.parent,this),v(h(i.prototype),"onOpen",this).call(this);}},{key:"onClose",value:function(){this.emit("close",this.parent,this),v(h(i.prototype),"onClose",this).call(this);}}]),i}(Vn),dg={openListPanel:function(){if(this.listPanel)return this;var t,e=og.call(this);e.on("button.over",(function(t,i,n,r){this.listOnButtonOver&&this.listOnButtonOver.call(this,t,i,n,r),this.emit("button.over",this,e,t,i,n,r);}),this).on("button.out",(function(t,i,n,r){this.listOnButtonOut&&this.listOnButtonOut.call(this,t,i,n,r),this.emit("button.out",this,e,t,i,n,r);}),this),t=this.listAlignMode&&"label"!==this.listAlignMode?this.getElement(this.listAlignMode):this;var i=new cg(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,anyTouchClose:!0}).on("open",(function(){e.on("button.click",(function(t,i,n,r){this.listOnButtonClick&&this.listOnButtonClick.call(this,t,i,n,r),this.emit("button.click",this,e,t,i,n,r);}),this),this.emit("list.open",this,e);}),this).on("close",(function(){this.listPanel=void 0,this.dropDownBehavior=void 0;}),this);return this.listPanel=e,this.dropDownBehavior=i,this.pin(e),this},closeListPanel:function(){return this.dropDownBehavior?(this.dropDownBehavior.requestClose(),this):this},toggleListPanel:function(){return this.listPanel?this.closeListPanel():this.openListPanel(),this}};Object.assign(dg,rg);var fg=Phaser.Utils.Objects.GetValue,vg=function(t){a(i,t);var e=d(i);function i(t,r){var s;n(this,i),(s=e.call(this,t,r)).type="rexDropDownList",s.timer=void 0,s.setOptions(fg(r,"options"));var o=fg(r,"list");return s.setWrapEnable(fg(o,"wrap",!1)),s.setCreateButtonCallback(fg(o,"createButtonCallback")),s.setCreateListBackgroundCallback(fg(o,"createBackgroundCallback")),s.setButtonClickCallback(fg(o,"onButtonClick")),s.setButtonOverCallback(fg(o,"onButtonOver")),s.setButtonOutCallback(fg(o,"onButtonOut")),s.setListExpandDirection(fg(o,"expandDirection")),s.setListEaseInDuration(fg(o,"easeIn",500)),s.setListEaseOutDuration(fg(o,"easeOut",100)),s.setListTransitInCallback(fg(o,"transitIn")),s.settListTransitOutCallback(fg(o,"transitOut")),s.setListSize(fg(o,"width"),fg(o,"height")),s.setListAlignmentMode(fg(o,"alignParent","text")),s.setListAlignmentSide(fg(o,"alignSide","")),s.setListBounds(fg(o,"bounds")),s.setListSpace(fg(o,"space")),s.setListDraggable(fg(o,"draggable",!1)),s.setValueChangeCallback(fg(r,"setValueCallback"),fg(r,"setValueCallbackScope")),s.setValue(fg(r,"value")),s.onClick(s.toggleListPanel,u(s)),s}return s(i,[{key:"destroy",value:function(t){this.scene&&!this.ignoreDestroy&&(this.listPanel&&(this.listPanel.destroy(t),this.listPanel=void 0),v(h(i.prototype),"destroy",this).call(this,t));}},{key:"setOptions",value:function(t){return void 0===t&&(t=[]),this.options=t,this}},{key:"setValueChangeCallback",value:function(t,e){return this.valueChangeCallback=t,this.valueChangeCallbackScope=e,this}},{key:"setValue",value:function(t){return this.value=t,this}},{key:"value",get:function(){return this._value},set:function(t){if(this._value!==t){var e=this._value;this._value=t;var i=this.valueChangeCallback,n=this.valueChangeCallbackScope;i&&(n?i.call(n,this,t,e):i(this,t,e)),this.emit("valuechange",this,t,e);}}},{key:"emitButtonClick",value:function(t){var e=this.options[t];return e?(this.emit("button.click",this,void 0,e,t),this):this}}]),i}(jo);Object.assign(vg.prototype,dg);var pg=function(t,e){e=function(t,e,i){void 0===i&&(i={});var n=(e=e?Io(e):{}).label||e.button,r=e.button||e.label;delete e.label,delete e.button;var s=i.label||i.button||i,o=i.button||i.label||i,a=Dc(t,n,s);return a.list=e.list||{},a.list.createButtonCallback=function(t,e){var i=pv(t,r,o).resetDisplayContent({text:e.text});return e.hasOwnProperty("value")&&(i.value=e.value),i},a.list.onButtonOver=function(t,e,i,n){t.setHoverState&&t.setHoverState(!0);},a.list.onButtonOut=function(t,e,i,n){t.setHoverState&&t.setHoverState(!1);},a}(t,e);var i=new vg(t,e);return t.add.existing(i),i},gg=function(t,e){for(var i=0,n=t.length;i>16&255},Xg=function(t){return t>>8&255},Yg=function(t){return 255&t},Gg=Phaser.Math.Linear,Vg={buildShapes:function(){this.addShape((new fd).setName("track")).addShape((new fd).setName("thumb"));},updateShapes:function(){var t=this.width,e=this.height,i=this.value?this.toggleAnimProgress:1-this.toggleAnimProgress,n=this.getShape("track");if(this.isSizeChanged){var r=t*this.trackWidth,s=e*this.trackHeight,o=(t-r)/2,a=(e-s)/2,h=e*this.trackRadius;n.setTopLeftPosition(o,a).setSize(r,s).setRadius(h);}var l,u,c,d=(l=this.falseValueTrackColor,u=this.trackFillColor,c=i,(255&Fg(Wg(l),Wg(u),c))<<16|(255&Fg(Xg(l),Xg(u),c))<<8|255&Fg(Yg(l),Yg(u),c)),f=Gg(this.falseValueTrackFillAlpha,this.trackFillAlpha,i);n.fillStyle(d,f);var v=this.getShape("thumb");if(this.isSizeChanged){var p=t*this.thumbWidth,g=e*this.thumbHeight,y=e*this.thumbRadius;v.setSize(p,g).setRadius(y);}var k=Gg(this.thumbLeftX,this.thumbRightX,i)*t;this.rtl&&(k=t-k);var m=e/2;v.setCenterPosition(k,m),v.fillStyle(this.thumbColor,this.thumbAlpha);}},Hg={setToggleAnimationDuration:function(t){return void 0===t&&(t=0),this.toggleAnimDuration=t,this},playToggleAnimation:function(){return void 0===this.toggleAnimProgressTask&&(this.toggleAnimProgressTask=new kn(this,{eventEmitter:null})),this.toggleAnimProgressTask.restart({key:"toggleAnimProgress",from:0,to:1,duration:this.toggleAnimDuration}),this},stopToggleAnimation:function(){return void 0===this.toggleAnimProgressTask||this.toggleAnimProgressTask.stop(),this}},Ng={};Object.assign(Ng,zg,jg,Ig,Vg,Hg);var Ug=Phaser.Utils.Objects.GetValue,Kg=Phaser.Utils.Objects.IsPlainObject,Jg=23730,qg=function(t){a(i,t);var e=d(i);function i(t,r,s,o,a,h,l){var u;n(this,i),Kg(r)?(r=Ug(l=r,"x",0),s=Ug(l,"y",0),o=Ug(l,"width",2),a=Ug(l,"height",2),h=Ug(l,"color",Jg)):Kg(h)&&(h=Ug(l=h,"color",Jg)),(u=e.call(this,t,r,s,o,a)).type="rexToggleSwitch",void 0===h&&(h=Jg),u.setTrackFillStyle(h,Ug(l,"trackFillAlpha",1)),u.setFalseValueTrackFillStyle(Ug(l,"falseValueTrackColor",function(t){var e=.3*Wg(t)+.59*Xg(t)+.11*Yg(t);return (255&e)<<16|(255&e)<<8|255&e}(h)),Ug(l,"falseValueTrackFillAlpha",1)),u.setThumbStyle(Ug(l,"thumbColor",16777215),Ug(l,"thumbAlpha",1)),u.setTrackSize(Ug(l,"trackWidth",.9),Ug(l,"trackHeight",.5)),u.setTrackRadius(Ug(l,"trackRadius",.5*u.trackHeight));var c=Ug(l,"thumbHeight",void 0),d=Ug(l,"thumbWidth",c);return void 0===d&&(d=.9*u.trackHeight),u.setThumbSize(d,c),u.setThumbRadius(Ug(l,"thumbRadius",.5*u.thumbHeight)),u.setThumbPosition(Ug(l,"thumbLeft",.3),Ug(l,"thumbRight",void 0)),u.setRTL(Ug(l,"rtl",!1)),u.setToggleAnimationDuration(Ug(l,"animationDuration",150)),u.buildShapes(),u.setValue(Ug(l,"value",!1),0),u}return s(i,[{key:"value",get:function(){return this._value},set:function(t){t=!!t,this._value!==t&&(this.dirty=!0,this._value=t,this.playToggleAnimation(),this.emit("valuechange",t));}},{key:"setValue",value:function(t,e){void 0===e&&(e=this.toggleAnimDuration);var i=this.toggleAnimDuration;return this.toggleAnimDuration=e,this.value=t,this.toggleAnimDuration=i,this}},{key:"toggleValue",value:function(t){return this.setValue(!this.value,t),this}},{key:"toggleAnimProgress",get:function(){return this._toggleAnimProgress},set:function(t){this._toggleAnimProgress!==t&&(this._toggleAnimProgress=t,this.dirty=!0);}}]),i}(Wc);Object.assign(qg.prototype,Ng);for(var Zg,$g=Phaser.Utils.Objects.GetValue,Qg=function(t){a(i,t);var e=d(i);function i(t,r,s,o,a,h,l){var c;return n(this,i),(c=e.call(this,t,r,s,o,a,h,l))._click=new wr(u(c),$g(l,"click")),c._click.on("click",(function(){this.toggleValue();}),u(c)),c.setReadOnly($g(l,"readOnly",!1)),c}return s(i,[{key:"readOnly",get:function(){return !this._click.enable},set:function(t){this._click.enable=!t;}},{key:"setReadOnly",value:function(t){return void 0===t&&(t=!0),this.readOnly=t,this}}]),i}(qg),ty=Phaser.Utils.Objects.GetValue,ey=function(t){a(i,t);var e=d(i);function i(t,r){var s;n(this,i),void 0===r&&(r={}),(s=e.call(this,t)).type="rexTweaker.ToggleSwitchInput";var o=r.toggleSwitch,a=function(t,e){var i=new Qg(t,e);return t.add.existing(i),i}(t,o),h=ty(o,"size");void 0!==h&&a.setSize(h,h);var l=void 0!==h?0:1;return s.addSpace().add(a,{proportion:0,expand:!1,fitRatio:l}),s.addChildrenMap("toggleSwitch",a),a.on("valuechange",(function(t){this.setValue(t);}),u(s)),s}return s(i,[{key:"value",get:function(){return this._value},set:function(t){this._value!==t&&(this.validate(t)||(t=this._value),this.childrenMap.toggleSwitch.setValue(t),g(h(i.prototype),"value",t,this,!0));}}]),i}(_v),iy=function(t,e,i){var n=new ey(t,i);return t.add.existing(n),n},ny=["AliceBlue","AntiqueWhite","Aqua","Aquamarine","Azure","Beige","Bisque","Black","BlanchedAlmond","Blue","BlueViolet","Brown","BurlyWood","CadetBlue","Chartreuse","Chocolate","Coral","CornflowerBlue","Cornsilk","Crimson","Cyan","DarkBlue","DarkCyan","DarkGoldenRod","DarkGray","DarkGrey","DarkGreen","DarkKhaki","DarkMagenta","DarkOliveGreen","DarkOrange","DarkOrchid","DarkRed","DarkSalmon","DarkSeaGreen","DarkSlateBlue","DarkSlateGray","DarkSlateGrey","DarkTurquoise","DarkViolet","DeepPink","DeepSkyBlue","DimGray","DimGrey","DodgerBlue","FireBrick","FloralWhite","ForestGreen","Fuchsia","Gainsboro","GhostWhite","Gold","GoldenRod","Gray","Grey","Green","GreenYellow","HoneyDew","HotPink","IndianRed","Indigo","Ivory","Khaki","Lavender","LavenderBlush","LawnGreen","LemonChiffon","LightBlue","LightCoral","LightCyan","LightGoldenRodYellow","LightGray","LightGrey","LightGreen","LightPink","LightSalmon","LightSeaGreen","LightSkyBlue","LightSlateGray","LightSlateGrey","LightSteelBlue","LightYellow","Lime","LimeGreen","Linen","Magenta","Maroon","MediumAquaMarine","MediumBlue","MediumOrchid","MediumPurple","MediumSeaGreen","MediumSlateBlue","MediumSpringGreen","MediumTurquoise","MediumVioletRed","MidnightBlue","MintCream","MistyRose","Moccasin","NavajoWhite","Navy","OldLace","Olive","OliveDrab","Orange","OrangeRed","Orchid","PaleGoldenRod","PaleGreen","PaleTurquoise","PaleVioletRed","PapayaWhip","PeachPuff","Peru","Pink","Plum","PowderBlue","Purple","RebeccaPurple","Red","RosyBrown","RoyalBlue","SaddleBrown","Salmon","SandyBrown","SeaGreen","SeaShell","Sienna","Silver","SkyBlue","SlateBlue","SlateGray","SlateGrey","Snow","SpringGreen","SteelBlue","Tan","Teal","Thistle","Tomato","Turquoise","Violet","Wheat","White","WhiteSmoke","Yellow","YellowGreen"],ry=[15792383,16444375,65535,8388564,15794175,16119260,16770244,0,16772045,255,9055202,10824234,14596231,6266528,8388352,13789470,16744272,6591981,16775388,14423100,65535,139,35723,12092939,11119017,11119017,25600,12433259,9109643,5597999,16747520,10040012,9109504,15308410,9419919,4734347,3100495,3100495,52945,9699539,16716947,49151,6908265,6908265,2003199,11674146,16775920,2263842,16711935,14474460,16316671,16766720,14329120,8421504,8421504,32768,11403055,15794160,16738740,13458524,4915330,16777200,15787660,15132410,16773365,8190976,16775885,11393254,15761536,14745599,16448210,13882323,13882323,9498256,16758465,16752762,2142890,8900346,7833753,7833753,11584734,16777184,65280,3329330,16445670,16711935,8388608,6737322,205,12211667,9662683,3978097,8087790,64154,4772300,13047173,1644912,16121850,16770273,16770229,16768685,128,16643558,8421376,7048739,16753920,16729344,14315734,15657130,10025880,11529966,14381203,16773077,16767673,13468991,16761035,14524637,11591910,8388736,6697881,16711680,12357519,4286945,9127187,16416882,16032864,3050327,16774638,10506797,12632256,8900331,6970061,7372944,7372944,16775930,65407,4620980,13808780,32896,14204888,16737095,4251856,15631086,16113331,16777215,16119285,16776960,10145074],sy={},oy=0,ay=ny.length;oy0&&{height:this.colorComponentsHeight,formatLabel:this.colorComponentsFormatLabelConfig,inputText:this.colorComponentsInputTextConfig,space:this.colorComponentsSpace};var o=new Ky(t,{width:n,height:s,background:e,space:this.colorPickerSpace,hPalette:{position:this.colorPickerHPalettePosition},colorComponents:r,value:this.value});return t.add.existing(o),o},qy={openColorPicker:function(){if(!this.colorPicker){var t=Jy.call(this).layout(),e=new cg(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(qy,py);var Zy=Phaser.Utils.Objects.GetValue,$y=function(t){a(i,t);var e=d(i);function i(t,r){var s;n(this,i),void 0===r&&(r={}),(s=e.call(this,t,r)).type="rexColorInput",r.hasOwnProperty("colorPicker")||(r.colorPicker={background:{color:0}});var o=r.colorPicker,a=!1!==o&&null!==o;if(a){var h;s.setColorPickerSize(Zy(o,"width",160),Zy(o,"height",170));var l=Zy(o,"background");h=l?function(t){return Ka(t,l)}:Zy(o,"createBackgroundCallback"),s.setCreateColorPickerBackgroundCallback(h),s.setColorPickerHPalettePosition(Zy(o,"hPalettePosition",0)),s.setColorPickerExpandDirection(Zy(o,"expandDirection")),s.setColorPickerEaseInDuration(Zy(o,"easeIn",200)),s.setColorPickerEaseOutDuration(Zy(o,"easeOut",200)),s.setColorPickerTransitInCallback(Zy(o,"transitIn")),s.setColorPickerTransitOutCallback(Zy(o,"transitOut")),s.setColorPickerBounds(Zy(o,"bounds"));var c=Zy(o,"space");void 0===c&&(c={left:10,right:10,top:10,bottom:10,item:8}),s.setColorPickerSpace(c);}var d=r.colorComponents;if(a&&(!1!==d&&null!==d)){s.setColorComponentsHeight(Zy(d,"height",30)),s.setColorComponentsFormatLabelConfig(Zy(d,"formatLabel"));var f=Zy(d,"inputText");f||(f=Zy(r,"inputText")),s.setColorComponentsInputTextConfig(f);var v=Zy(d,"space");void 0===v&&(v={item:8}),s.setColorComponentsSpace(v);}var p=s.childrenMap.swatch;return p&&a&&s.onClick(p,s.openColorPicker,u(s)),s}return s(i)}(vy);Object.assign($y.prototype,qy);var Qy=function(t){a(i,t);var e=d(i);function i(t,r){var s;n(this,i),void 0===r&&(r={}),(s=e.call(this,t)).type="rexTweaker.ColorInput";var o=function(t,e,i){void 0===i&&(i=!0),i?e=e?Io(e):{}:e||(e={});var n=new $y(t,e);return t.add.existing(n),n}(t,r.colorInput);return s.add(o,{proportion:1,expand:!0}),s.addChildrenMap("colorInput",o),o.on("valuechange",(function(t){this.setValue(t);}),u(s)),s}return s(i,[{key:"value",get:function(){return this._value},set:function(t){this._value!==t&&(this.validate(t)||(t=this._value),this.childrenMap.colorInput.setValue(t),g(h(i.prototype),"value",t,this,!0));}}]),i}(_v),tk=function(t,e,i){var n=new Qy(t,i);return t.add.existing(n),n},ek=Phaser.Utils.Objects.GetValue,ik=function(t,i,n){var r=ek(n,"title")||{},s=Ov(t,0,r),o=function(t,e,i){var n,r=e.view;switch(r){case kv:n=gp;break;case mv:n=kp;break;case bv:n=ng;break;case xv:n=kg;break;case"buttons":n=Cg;break;case Cv:n=Bg;break;case"toggleSwitch":n=iy;break;case"color":n=tk;break;default:n=ar(r)?r:gp;}var s=n(t,e,i,s);return s.setTextFormatCallback(e.format),s}(t,i,n),a=ek(n,"background")||{},h=Ka(t,a),l=new Tv(t,e(e(e({},i),n),{},{inputTitle:s,inputField:o,background:h}));return t.add.existing(l),l.setTitle(i),l};Phaser.Utils.Objects.GetValue;var nk=Phaser.Utils.Objects.GetValue,rk=function(t,i,n){for(var r=nk(n,"title")||{},s=Ov(t,0,r),o=i.buttons,a=nk(n,"button")||{},h=[],l=0,u=o.length;l0?0:1,o.setMinWidth(this.itemWidth)),this.add(o,{proportion:s,expand:!0}),n.onValueChange&&a.on("valuechange",n.onValueChange),n.onValidate&&a.setValidateCallback(n.onValidate),o.setAutoUpdateEnable(n.autoUpdate),o.setBindingTarget(t,e),n.monitor&&o.startMonitorTarget(),n.key&&this.root.addChildrenMap(n.key,o),this},addButton:ok,addButtons:ok,addSeparator:function(t){var e=this.scene,i=ak(this.styles,"separator"),n=Ed(e,0,i);return this.add(n,{expand:!0}),this},setBindingTarget:function(t){for(var e=this.sizerChildren,i=0,n=e.length;ih;u--){for(c=0;c0&&this.wrapMode!==ch&&0===this.wrapWidth}},{key:"setStyle",value:function(t,e,i){if(void 0===e&&(e=!0),void 0===i&&(i=!1),t&&t.hasOwnProperty("wrap")){var n=t.wrap;if(n.hasOwnProperty("mode")){var r=n.mode;"string"==typeof r&&(n.mode=kh[r]);}else n.hasOwnProperty("width")&&(n.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 s=this.propertyMap;for(var o in s){var a=s[o],h=a[0],l=i?a[1]:this[o],u=a[2];if("wrapCallback"===o||"wrapCallbackScope"===o)this[o]=gh(t,h,l);else {var c=ph(t,h,l);u&&(c=u(c)),this[o]=c;}}var d=gh(t,"font",null);this._font=null===d?this.fontStyle+" "+this.fontSize+" "+this.fontFamily:d;var f=gh(t,"fill",null);null!==f&&(this.color=rh(f));var v=gh(t,"metrics",!1);return v?this.metrics={ascent:gh(v,"ascent",0),descent:gh(v,"descent",0),fontSize:gh(v,"fontSize",0)}:!e&&this.metrics||(this.metrics=ah(this)),e?this.parent.updateText():this.parent}},{key:"syncFont",value:function(t,e){e.font=this._font;}},{key:"syncStyle",value:function(t,e){e.textBaseline="alphabetic",e.fillStyle=this.color,e.strokeStyle=this.stroke,e.lineWidth=this.strokeThickness,e.lineCap="round",e.lineJoin="round";}},{key:"syncShadow",value:function(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);}},{key:"update",value:function(t){return t&&(this._font="".concat(this.fontStyle," ").concat(this.fontSize," ").concat(this.fontFamily).trim(),this.metrics=ah(this)),this.parent.updateText(t)}},{key:"buildFont",value:function(){var t="".concat(this.fontStyle," ").concat(this.fontSize," ").concat(this.fontFamily).trim();return t!==this._font&&(this._font=t),this}},{key:"setFont",value:function(t){return "string"==typeof t?(this.fontFamily=t,this.fontSize="",this.fontStyle=""):(this.fontFamily=gh(t,"fontFamily","Courier"),this.fontSize=gh(t,"fontSize","16px"),this.fontStyle=gh(t,"fontStyle","")),this.update(!0)}},{key:"setFontFamily",value:function(t){return this.fontFamily=t,this.update(!0)}},{key:"setFontStyle",value:function(t){return this.fontStyle=t,this.update(!0)}},{key:"setFontSize",value:function(t){return "number"==typeof t&&(t=t.toString()+"px"),this.fontSize=t,this.update(!0)}},{key:"setTestString",value:function(t){return this.testString=t,this.update(!0)}},{key:"setFixedSize",value:function(t,e){return this.fixedWidth=t,this.fixedHeight=e,t&&(this.parent.width=t),e&&(this.parent.height=e),this.update(this.isWrapFitMode)}},{key:"setResolution",value:function(t){return this.resolution=t,this.update(!1)}},{key:"setLineSpacing",value:function(t){return this.lineSpacing=t,this.update(!1)}},{key:"setXOffset",value:function(t){return this.xOffset=t,this.update(!1)}},{key:"setBackgroundColor",value:function(t,e,i){return void 0===i&&(i=!0),this.backgroundColor=rh(t,this.parent.canvas,this.parent.context),this.backgroundColor2=rh(e,this.parent.canvas,this.parent.context),this.backgroundHorizontalGradient=i,this.update(!1)}},{key:"setBackgroundStrokeColor",value:function(t,e){return this.backgroundStrokeColor=rh(t,this.parent.canvas,this.parent.context),this.backgroundStrokeLineWidth=e,this.update(!1)}},{key:"setBackgroundCornerRadius",value:function(t,e){return this.backgroundCornerRadius=t,this.backgroundCornerIteration=e,this.update(!1)}},{key:"setFill",value:function(t){return this.color=rh(t,this.parent.canvas,this.parent.context),this.update(!1)}},{key:"setColor",value:function(t){return this.color=rh(t,this.parent.canvas,this.parent.context),this.update(!1)}},{key:"setStroke",value:function(t,e){return void 0===t?this.strokeThickness=0:(void 0===e&&(e=this.strokeThickness),this.stroke=rh(t,this.parent.canvas,this.parent.context),this.strokeThickness=e),this.update(!0)}},{key:"setShadow",value:function(t,e,i,n,r,s){return void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i="#000"),void 0===n&&(n=0),void 0===r&&(r=!1),void 0===s&&(s=!0),this.shadowOffsetX=t,this.shadowOffsetY=e,this.shadowColor=rh(i,this.parent.canvas,this.parent.context),this.shadowBlur=n,this.shadowStroke=r,this.shadowFill=s,this.update(!1)}},{key:"setShadowOffset",value:function(t,e){return void 0===t&&(t=0),void 0===e&&(e=t),this.shadowOffsetX=t,this.shadowOffsetY=e,this.update(!1)}},{key:"setShadowColor",value:function(t){return void 0===t&&(t="#000"),this.shadowColor=rh(t,this.parent.canvas,this.parent.context),this.update(!1)}},{key:"setShadowBlur",value:function(t){return void 0===t&&(t=0),this.shadowBlur=t,this.update(!1)}},{key:"setShadowStroke",value:function(t){return this.shadowStroke=t,this.update(!1)}},{key:"setShadowFill",value:function(t){return this.shadowFill=t,this.update(!1)}},{key:"setUnderline",value:function(t,e,i){return void 0===t&&(t="#000"),void 0===e&&(e=0),void 0===i&&(i=0),this.underlineColor=rh(t,this.parent.canvas,this.parent.context),this.underlineThickness=e,this.underlineOffset=i,this.update(!1)}},{key:"setUnderlineColor",value:function(t){return void 0===t&&(t="#000"),this.underlineColor=rh(t,this.parent.canvas,this.parent.context),this.update(!1)}},{key:"setUnderlineThickness",value:function(t){return void 0===t&&(t=0),this.underlineThickness=t,this.update(!1)}},{key:"setUnderlineOffset",value:function(t){return void 0===t&&(t=0),this.underlineOffset=t,this.update(!1)}},{key:"setStrikethrough",value:function(t,e,i){return void 0===t&&(t="#000"),void 0===e&&(e=0),void 0===i&&(i=0),this.strikethroughColor=rh(t,this.parent.canvas,this.parent.context),this.strikethroughThickness=e,this.strikethroughOffset=i,this.update(!1)}},{key:"setStrikethroughColor",value:function(t){return void 0===t&&(t="#000"),this.strikethroughColor=rh(t,this.parent.canvas,this.parent.context),this.update(!1)}},{key:"setStrikethroughThickness",value:function(t){return void 0===t&&(t=0),this.strikethroughThickness=t,this.update(!1)}},{key:"setStrikethroughOffset",value:function(t){return void 0===t&&(t=0),this.strikethroughOffset=t,this.update(!1)}},{key:"setWrapMode",value:function(t){return "string"==typeof t&&(t=kh[t.toLowerCase()]||0),this.wrapMode=t,this.update(!0)}},{key:"setWrapWidth",value:function(t){return this.wrapWidth=t,this.update(!1)}},{key:"setAlign",value:function(t,e){return void 0===t&&(t="left"),void 0===e&&(e="top"),this.halign=t,this.valign=e,this.update(!1)}},{key:"setHAlign",value:function(t){return void 0===t&&(t="left"),this.halign=t,this.update(!1)}},{key:"setVAlign",value:function(t){return void 0===t&&(t="top"),this.valign=t,this.update(!1)}},{key:"setMaxLines",value:function(t){return void 0===t&&(t=0),this.maxLines=t,this.update(!1)}},{key:"getTextMetrics",value:function(){var t=this.metrics;return {ascent:t.ascent,descent:t.descent,fontSize:t.fontSize}}},{key:"setTextMetrics",value:function(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=gh(e,"fontFamily",this.fontFamily),this.fontSize=gh(e,"fontSize",this.fontSize),this.fontStyle=gh(e,"fontStyle",this.fontStyle))),this.parent.updateText(!0)}},{key:"lineHeight",get:function(){return this.metrics.fontSize+this.strokeThickness+this.lineSpacing}},{key:"toJSON",value:function(){var t={},e=this.propertyMap;for(var i in e)t[i]=this[i];return t.metrics=this.getTextMetrics(),t}},{key:"destroy",value:function(){this.parent=void 0;}}]),t}(),kh={none:ch,word:dh,char:fh,character:fh},mh=Phaser.Math.DegToRad,bh=function(t){return !t.hasOwnProperty("convex")||t.convex},xh=function(t){return t.x>0&&t.y>0},Ch=function(t,e,i,n,r,s,o,a,h){if(a&&o>s?o-=360:!a&&o=f?1:n/f,g=r>=v?1:r/v,y=d.cornerRadius;t.save(),t.beginPath(),t.translate(e,i),a=y.tl,xh(a)?(h=a.x*p,l=a.y*g,bh(a)?Ch(t,h,l,h,l,180,270,!1,o):Ch(t,0,0,h,l,90,0,!0,o),u=0,c=l):(t.lineTo(0,0),u=0,c=0),a=y.tr,xh(a)?(h=a.x*p,l=a.y*g,bh(a)?Ch(t,n-h,l,h,l,270,360,!1,o):Ch(t,n,0,h,l,180,90,!0,o)):t.lineTo(n,0),a=y.br,xh(a)?(h=a.x*p,l=a.y*g,bh(a)?Ch(t,n-h,r-l,h,l,0,90,!1,o):Ch(t,n,r,h,l,270,180,!0,o)):t.lineTo(n,r),a=y.bl,xh(a)?(h=a.x*p,l=a.y*g,bh(a)?Ch(t,h,r-l,h,l,90,180,!1,o):Ch(t,0,r,h,l,360,270,!0,o)):t.lineTo(0,r),t.lineTo(u,c),t.closePath(),t.restore();}(e,i,n,r,s,o,d),null!=a){var f;if(null!=u)(f=c?e.createLinearGradient(0,0,r,0):e.createLinearGradient(0,0,0,s)).addColorStop(0,a),f.addColorStop(1,u),a=f;e.fillStyle=a,e.fill();}null!=h&&l>0&&(e.strokeStyle=h,e.lineWidth=l,e.stroke());},Sh=function(t,e,i,n,r,s,o,a){if(null!=e||null!=i){var h=t.canvas.width,l=t.canvas.height;null==i&&(n=0);var u=n/2;h=Math.max(1,h-n),l=Math.max(1,l-n),wh(t.canvas,t.context,u,u,h,l,r,e,i,n,s,o,a);}},Ph={draw:function(t,e,i,n){var r=this.penManager;this.hitAreaManager.clear();var s=this.context;s.save();var o=this.defaultStyle;this.clear(),Sh(this,o.backgroundColor,o.backgroundStrokeColor,o.backgroundStrokeLineWidth,o.backgroundCornerRadius,o.backgroundColor2,o.backgroundHorizontalGradient,o.backgroundCornerIteration),t+=this.startXOffset,e+=this.startYOffset;var a,h,l,u,c,d,f=o.halign,v=o.valign,p=o.lineHeight,g=r.lines,y=g.length,k=o.maxLines;k>0&&y>k?(h=k,l="center"===v?Math.floor((y-h)/2):"bottom"===v?y-h:0):(h=y,l=0),u=l+h;var m=this.rtl,b=m?this.parent.width:void 0;d="center"===v?Math.max((n-h*p)/2,0):"bottom"===v?Math.max(n-h*p-2,0):0,d+=e;for(var x=l;x0&&t.width>0){var a=i+o.underlineOffset-o.underlineThickness/2;this.drawLine(e,a,t.width,o.underlineThickness,o.underlineColor);}if(t.isTextPen&&this.drawText(e,i,t.text,o),t.isImagePen&&this.drawImage(e,i,t.prop.img,o),o.strikethroughThickness>0&&t.width>0){a=i+o.strikethroughOffset-o.strikethroughThickness/2;this.drawLine(e,a,t.width,o.strikethroughThickness,o.strikethroughColor);}if(s.restore(),t.hasAreaMarker&&t.width>0){var h,l=t.prop.area;if(l)h={key:l};else {var u=t.prop.url;h={key:"url:".concat(u),url:u};}this.hitAreaManager.add(e,i-this.startYOffset,t.width,this.defaultStyle.lineHeight,h);}},clear:function(){var t=this.canvas;this.context.clearRect(0,0,t.width,t.height);},drawLine:function(t,e,i,n,r){this.autoRound&&(t=Math.round(t),e=Math.round(e));var s=this.context,o=s.lineCap;s.lineCap="butt",s.strokeStyle=r,s.lineWidth=n,s.beginPath(),s.moveTo(t,e),s.lineTo(t+i,e),s.stroke(),s.lineCap=o;},drawText:function(t,e,i,n){this.autoRound&&(t=Math.round(t),e=Math.round(e));var r=this.context;n.stroke&&"none"!==n.stroke&&n.strokeThickness>0&&(n.syncShadow(r,n.shadowStroke),r.strokeText(i,t,e)),n.color&&"none"!==n.color&&(n.syncShadow(r,n.shadowFill),r.fillText(i,t,e));},drawImage:function(t,e,i,n){e-=this.startYOffset,this.parent.imageManager.draw(i,this.context,t,e,this.autoRound);}},Th=Phaser.Utils.Objects.GetValue,Oh=hh,_h=lh,Eh=function(){function t(e){n(this,t),this.prop={},this.resetFromJSON(e);}return s(t,[{key:"resetFromJSON",value:function(t){this.text=Th(t,"text",""),this.x=Th(t,"x",0),this.y=Th(t,"y",0),this.width=Th(t,"width",0);var e=Th(t,"prop",null);null===e&&(e={}),this.prop=e,this.newLineMode=Th(t,"newLineMode",0),this.startIndex=Th(t,"startIndex",0);}},{key:"plainText",get:function(){var t=this.text;return this.newLineMode===_h&&(t+="\n"),t}},{key:"wrapText",get:function(){var t=this.text;return this.newLineMode!==Oh&&(t+="\n"),t}},{key:"rawTextLength",get:function(){var t=this.text.length;return this.newLineMode===_h&&(t+=1),t}},{key:"endIndex",get:function(){return this.startIndex+this.rawTextLength}},{key:"lastX",get:function(){return this.x+this.width}},{key:"isTextPen",get:function(){return ""!==this.text}},{key:"isImagePen",get:function(){return !!this.prop.img}},{key:"hasAreaMarker",get:function(){return !!this.prop.area||!!this.prop.url}}]),t}(),Rh=Phaser.Utils.Objects.GetFastValue,Mh=hh,Lh=uh,Dh=function(){function t(e){n(this,t),this.pens=[],this.lines=[],this.maxLinesWidth=void 0,this.pensPool=e.pensPool,this.linesPool=e.linesPool,this.tagToText=Rh(e,"tagToText",ie),this.tagToTextScope=Rh(e,"tagToTextScope",void 0);}return s(t,[{key:"destroy",value:function(){this.clear(),this.tagToText=void 0,this.tagToTextScope=void 0;}},{key:"clear",value:function(){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}},{key:"getLineEndIndex",value:function(t){t>=this.lines.length&&(t=this.lines.length-1);var e,i,n=!1;for(e=t;e>=0&&!(n=null!=(i=this.lines[e])&&i.length>0);e--);return n?i[i.length-1].endIndex:0}},{key:"getLineWidth",value:function(t){var e=this.lines[t];if(!e)return 0;var i=e[e.length-1];return null==i?0:i.lastX}},{key:"getMaxLineWidth",value:function(){if(void 0!==this.maxLinesWidth)return this.maxLinesWidth;for(var t,e=0,i=0,n=this.lines.length;ie&&(e=t);return this.maxLinesWidth=e,e}},{key:"getLineWidths",value:function(){for(var t=[],e=0,i=this.lines.length;e=t&&h<=e||(o=o.substring(t-a,e-a)),this.tagToTextScope?c+=this.tagToText.call(this.tagToTextScope,o,l,u):c+=this.tagToText(o,l,u),u=l,!(h>=e)));d++);return c}},{key:"length",get:function(){return this.lines.length},set:function(t){this.clear();}}]),t}(),Ah={},Bh=function(){function t(){n(this,t),this.items=[];}return s(t,[{key:"destroy",value:function(){this.clear(),this.items=void 0;}},{key:"pop",value:function(){return this.items.length>0?this.items.pop():null}},{key:"push",value:function(t){return this.items.push(t),this}},{key:"pushMultiple",value:function(t){return this.items.push.apply(this.items,t),t.length=0,this}},{key:"clear",value:function(){return this.items.length=0,this}}]),t}(),zh=Phaser.Geom.Rectangle,jh=new Bh,Ih=function(){function t(){n(this,t),this.hitAreas=[];}return s(t,[{key:"destroy",value:function(){this.clear();}},{key:"clear",value:function(){for(var t=0,e=this.hitAreas.length;tr){""!==S?a.push(o.getLine(S,P,Hh)):0===O&&s>0&&a.push(o.getLine("",0,Hh)),a.push.apply(a,y(t(b,i,Kh,r,0,o)));var E=a.pop();S=E.text,P=E.width,o.freeLine(E)," "===S&&(S="",P=0);}else (w=P+x)>l?(a.push(o.getLine(S,P,Hh)),S=b,P=x,l=r):(S+=b,P=w),C&&a.push(o.getLine(S,P,u));}return a},Zh=Phaser.Utils.Objects.GetValue,$h=ch,Qh=hh,tl=function(){function t(e){n(this,t),this.parent=e.parent,this.scene=this.parent.scene,this.context=Zh(e,"context",null),this.canvas=this.context.canvas,this.parser=Zh(e,"parser",null),this.defaultStyle=Zh(e,"style",null),this.autoRound=!0,this.pensPool=e.pensPool,this.linesPool=e.linesPool,this.wrapTextLinesPool=e.wrapTextLinesPool,this.penManager=this.newPenManager(),this._tmpPenManager=null,this.hitAreaManager=new Ih,this.lastHitAreaKey=null,this.urlTagCursorStyle=null;var i=this.context;this.getTextWidth=function(t){return i.measureText(t).width};}return s(t,[{key:"destroy",value:function(){this.parent=void 0,this.scene=void 0,this.context=void 0,this.canvas=void 0,this.parser=void 0,this.defaultStyle=void 0,this.penManager&&(this.penManager.destroy(),this.penManager=void 0),this._tmpPenManager&&(this._tmpPenManager.destroy(),this._tmpPenManager=void 0),this.hitAreaManager&&(this.hitAreaManager.destroy(),this.hitAreaManager=void 0),this.pensPool=void 0,this.linesPool=void 0,this.wrapTextLinesPool=void 0;}},{key:"updatePenManager",value:function(t,e,i,n,r){if(void 0===r&&(r=this.penManager),r.clear(),""===t)return r;var s=this.parent.style;if(s.isWrapFitMode){var o=this.parent.padding;i=s.fixedWidth-o.left-o.right;}for(var a,h,l,u,c,d=this.canvas,f=this.context,v=function(t){return f.measureText(t).width},p=0,g=0,y=s.wrapCallback,k=s.wrapCallbackScope,m=!0,b=this.parser.splitText(t),x=this.wrapTextLinesPool,C=0,w=b.length;C0&&e!==$h&&i0&&t>e&&(t=e),t}},{key:"linesWidth",get:function(){return Math.ceil(this.penManager.getMaxLineWidth())}},{key:"linesHeight",get:function(){var t=this.desplayLinesCount,e=this.defaultStyle.lineHeight*t;return t>0&&(e-=this.defaultStyle.lineSpacing),e}},{key:"imageManager",get:function(){return this.parent.imageManager}},{key:"rtl",get:function(){return this.parent.style.rtl}},{key:"newPenManager",value:function(){return new Dh({pensPool:this.pensPool,linesPool:this.linesPool,tagToText:this.parser.propToTagText,tagToTextScope:this.parser})}},{key:"tmpPenManager",get:function(){return null===this._tmpPenManager&&(this._tmpPenManager=this.newPenManager()),this._tmpPenManager}},{key:"getPlainText",value:function(t,e,i){var n;if(null==t)n=this.penManager.plainText;else {var r=this.parser.splitText(t,1);n="";for(var s=0,o=r.length;s0}},{key:"drawX",get:function(){var t=this.x+this.leftSpace+this.offsetX-this.originX*this.width;return this.parent._textOX*this.scrollFactorX+t}},{key:"drawY",get:function(){var t=this.y+this.offsetY;return this.parent._textOY*this.scrollFactorY+t}},{key:"drawTLX",get:function(){return 0}},{key:"drawTLY",get:function(){return 0}},{key:"drawBLX",get:function(){return 0}},{key:"drawBLY",get:function(){return 0}},{key:"drawTRX",get:function(){return 0}},{key:"drawTRY",get:function(){return 0}},{key:"drawBRX",get:function(){return 0}},{key:"drawBRY",get:function(){return 0}},{key:"drawCenterX",get:function(){return (this.drawTRX+this.drawTLX)/2}},{key:"drawCenterY",get:function(){return (this.drawBLY+this.drawTLY)/2}}]),i}(nu);Object.assign(wu.prototype,mu);var Su=function(t,e,i){return e.hasOwnProperty(t)?e[t]:i[t]},Pu=Phaser.Utils.Objects.GetValue,Tu=function(t){a(i,t);var e=d(i);function i(t,r){var s;return n(this,i),(s=e.call(this,t,"background")).setScrollFactor(0),s.setColor(Pu(r,"color",null),Pu(r,"color2",null),Pu(r,"horizontalGradient",!0)),s.setStroke(Pu(r,"stroke",null),Pu(r,"strokeThickness",2)),s.setCornerRadius(Pu(r,"cornerRadius",0),Pu(r,"cornerIteration",null)),s}return s(i,[{key:"color",get:function(){return this._color},set:function(t){t=rh(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t;}},{key:"color2",get:function(){return this._color2},set:function(t){t=rh(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t;}},{key:"horizontalGradient",get:function(){return this._horizontalGradient},set:function(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t;}},{key:"setColor",value:function(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}},{key:"stroke",get:function(){return this._stroke},set:function(t){t=rh(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t;}},{key:"strokeThickness",get:function(){return this._strokeThickness},set:function(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t;}},{key:"setStroke",value:function(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}},{key:"cornerRadius",get:function(){return this._cornerRadius},set:function(t){this.setDirty(this._cornerRadius!=t),this._cornerRadius=t;}},{key:"cornerIteration",get:function(){return this._cornerIteration},set:function(t){this.setDirty(this._cornerIteration!=t),this._cornerIteration=t;}},{key:"modifyStyle",value:function(t){return t.hasOwnProperty("color")&&this.setColor(t.color,Su("color2",t,this),Su("horizontalGradient",t,this)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,Su("strokeThickness",t,this)),t.hasOwnProperty("cornerRadius")&&this.setCornerRadius(t.cornerRadius,Su("cornerIteration",t,this)),this}},{key:"modifyPorperties",value:function(t){return v(h(i.prototype),"modifyPorperties",this).call(this,t),this.modifyStyle(t),this}},{key:"setCornerRadius",value:function(t,e){return this.cornerRadius=t,this.cornerIteration=e,this}},{key:"renderContent",value:function(){Sh(this.parent,this.color,this.stroke,this.strokeThickness,this.cornerRadius,this.color2,this.horizontalGradient,this.cornerIteration);}}]),i}(wu),Ou=Phaser.Utils.Objects.GetValue,_u=function(t){a(i,t);var e=d(i);function i(t,r){var s;return n(this,i),(s=e.call(this,t,"innerbounds")).setScrollFactor(0),s.setColor(Ou(r,"color",null),Ou(r,"color2",null),Ou(r,"horizontalGradient",!0)),s.setStroke(Ou(r,"stroke",null),Ou(r,"strokeThickness",2)),s}return s(i,[{key:"color",get:function(){return this._color},set:function(t){t=rh(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t;}},{key:"color2",get:function(){return this._color2},set:function(t){t=rh(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t;}},{key:"horizontalGradient",get:function(){return this._horizontalGradient},set:function(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t;}},{key:"setColor",value:function(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}},{key:"stroke",get:function(){return this._stroke},set:function(t){t=rh(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t;}},{key:"strokeThickness",get:function(){return this._strokeThickness},set:function(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t;}},{key:"setStroke",value:function(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}},{key:"modifyPorperties",value:function(t){v(h(i.prototype),"modifyPorperties",this).call(this,t),t.hasOwnProperty("color")&&this.setColor(t.color,Ou(t,"color2",null),Ou(t,"horizontalGradient",!0)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,Ou(t,"strokeThickness",2));}},{key:"renderContent",value:function(){var t=this.parent.padding,e=t.left,i=t.top,n=this.parent.width-t.left-t.right,r=this.parent.height-t.top-t.bottom,s=this.context;if(null!=this.color){var o,a;if(null!=this.color2)(a=this.horizontalGradient?s.createLinearGradient(0,0,n,0):s.createLinearGradient(0,0,0,r)).addColorStop(0,this.color),a.addColorStop(1,this.color2),o=a;else o=this.color;s.fillStyle=o,s.fillRect(e,i,n,r);}null!=this.stroke&&this.strokeThickness>0&&(s.strokeStyle=this.stroke,s.lineWidth=this.strokeThickness,s.strokeRect(e,i,n,r));}}]),i}(wu),Eu=Phaser.Utils.Objects.GetValue,Ru=function(){function t(e,i){n(this,t),this.parent=e,this.set(i);}return s(t,[{key:"toJSON",value:function(){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}}},{key:"set",value:function(t){return this.setBold(Eu(t,"bold",!1)),this.setItalic(Eu(t,"italic",!1)),this.setFontSize(Eu(t,"fontSize","16px")),this.setFontFamily(Eu(t,"fontFamily","Courier")),this.setColor(Eu(t,"color","#fff")),this.setStrokeStyle(Eu(t,"stroke",null),Eu(t,"strokeThickness",0)),this.setShadow(Eu(t,"shadowColor",null),Eu(t,"shadowOffsetX",0),Eu(t,"shadowOffsetY",0),Eu(t,"shadowBlur",0)),this.setOffset(Eu(t,"offsetX",0),Eu(t,"offsetY",0)),this.setSpace(Eu(t,"leftSpace",0),Eu(t,"rightSpace",0)),this.setAlign(Eu(t,"align",void 0)),this.setBackgroundColor(Eu(t,"backgroundColor",null)),this.setBackgroundHeight(Eu(t,"backgroundHeight",void 0)),this.setBackgroundBottomY(Eu(t,"backgroundBottomY",void 0)),this}},{key:"modify",value:function(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(Su("stroke",t,this),Su("strokeThickness",t,this)),t.hasOwnProperty("shadowColor")&&this.setShadowColor(t.shadowColor),(t.hasOwnProperty("shadowOffsetX")||t.hasOwnProperty("shadowOffsetY"))&&this.setShadowOffset(Su("shadowOffsetX",t,this),Su("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}},{key:"setUpdateTextFlag",value:function(){return this.parent&&(this.parent.updateTextFlag=!0),this}},{key:"clone",value:function(){return new t(null,this.toJSON())}},{key:"copyFrom",value:function(t){return this.set(t.toJSON()),this}},{key:"copyTo",value:function(t){return t.set(this.toJSON()),this}},{key:"setBold",value:function(t){return void 0===t&&(t=!0),this.bold=t,this.setUpdateTextFlag(),this}},{key:"setItalic",value:function(t){return void 0===t&&(t=!0),this.italic=t,this.setUpdateTextFlag(),this}},{key:"fontStyle",get:function(){return this.bold&&this.italic?"bold italic":this.bold?"bold":this.italic?"italic":""}},{key:"setFontSize",value:function(t){return "number"==typeof t&&(t="".concat(t,"px")),this.fontSize=t,this.setUpdateTextFlag(),this}},{key:"setFontFamily",value:function(t){return this.fontFamily=t,this.setUpdateTextFlag(),this}},{key:"font",get:function(){return "".concat(this.fontStyle," ").concat(this.fontSize," ").concat(this.fontFamily)}},{key:"setColor",value:function(t){return this.color=rh(t),this}},{key:"hasFill",get:function(){return null!=this.color}},{key:"setStrokeStyle",value:function(t,e){return this.stroke=rh(t),void 0!==e&&(this.strokeThickness=e),this}},{key:"setStrokeThickness",value:function(t){return this.strokeThickness=t,this}},{key:"hasStroke",get:function(){return null!=this.stroke&&this.strokeThickness>0}},{key:"setShadowColor",value:function(t){return this.shadowColor=rh(t),this}},{key:"setShadowOffset",value:function(t,e){return void 0===t&&(t=0),void 0===e&&(e=0),this.shadowOffsetX=t,this.shadowOffsetY=e,this}},{key:"setShadowBlur",value:function(t){return void 0===t&&(t=0),this.shaodwBlur=t,this}},{key:"setShadow",value:function(t,e,i,n){return this.setShadowColor(t).setShadowOffset(e,i).setShadowBlur(n),this}},{key:"setBackgroundColor",value:function(t){return this.backgroundColor=rh(t),this}},{key:"hasBackgroundColor",get:function(){return null!=this.backgroundColor}},{key:"setBackgroundHeight",value:function(t){return this.backgroundHeight=t,this}},{key:"setBackgroundBottomY",value:function(t){return this.backgroundBottomY=t,this}},{key:"setOffsetX",value:function(t){return void 0===t&&(t=0),this.offsetX=t,this}},{key:"setOffsetY",value:function(t){return void 0===t&&(t=0),this.offsetY=t,this}},{key:"setOffset",value:function(t,e){return this.setOffsetX(t).setOffsetY(e),this}},{key:"setLeftSpace",value:function(t){return void 0===t&&(t=0),this.leftSpace=t,this}},{key:"setRightSpace",value:function(t){return void 0===t&&(t=0),this.rightSpace=t,this}},{key:"setSpace",value:function(t,e){return this.setLeftSpace(t).setRightSpace(e),this}},{key:"setAlign",value:function(t){return this.align=t,this}},{key:"syncFont",value:function(t){return t.font=this.font,this}},{key:"syncStyle",value:function(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}},{key:"syncShadow",value:function(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);}},{key:"getTextMetrics",value:function(t,e){return this.syncFont(t).syncStyle(t),t.measureText(e)}}]),t}(),Mu=Phaser.Utils.Array.Remove,Lu=Phaser.Utils.Array.Remove,Du="text",Au="image",Bu="drawer",zu="space",ju="command",Iu=function(t){return t.type===Du&&"\n"===t.text},Fu=function(t){return t.type===Du&&"\f"===t.text},Wu=function(t){return t.type===Du},Xu=function(t){a(i,t);var e=d(i);function i(t,r,s){var o;return n(this,i),(o=e.call(this,t,Du)).updateTextFlag=!1,o.style=new Ru(u(o),s),o.setText(r),o}return s(i,[{key:"autoRound",get:function(){return this.parent.autoRound}},{key:"offsetX",get:function(){return this.style.offsetX},set:function(t){this.style&&(this.style.offsetX=t);}},{key:"offsetY",get:function(){return this.style.offsetY},set:function(t){this.style&&(this.style.offsetY=t);}},{key:"leftSpace",get:function(){return this.style.leftSpace*this.scaleX},set:function(t){this.style&&(this.style.leftSpace=t),g(h(i.prototype),"leftSpace",t,this,!0);}},{key:"rightSpace",get:function(){return this.style.rightSpace*this.scaleX},set:function(t){this.style&&(this.style.rightSpace=t),g(h(i.prototype),"rightSpace",t,this,!0);}},{key:"align",get:function(){return this.style.align},set:function(t){this.style&&(this.style.align=t);}},{key:"modifyStyle",value:function(t){return this.setDirty(!0),this.style.modify(t),this.updateTextFlag&&this.updateTextSize(),this}},{key:"modifyPorperties",value:function(t){return t?(this.modifyStyle(t),v(h(i.prototype),"modifyPorperties",this).call(this,t),this):this}},{key:"setText",value:function(t){return this.setDirty(this.text!=t),this.text=t,this.updateTextSize(),this}},{key:"updateTextSize",value:function(){var t=this.text;if("\n"===t||"\f"===t||""===t)this.clearTextSize();else {var e,i,n=this.style.getTextMetrics(this.context,this.text);this.textWidth=n.width,"actualBoundingBoxAscent"in n?(e=n.actualBoundingBoxAscent,i=n.actualBoundingBoxDescent):(e=0,i=0),this.textHeight=e+i,this.ascent=e,this.descent=i;}return this.updateTextFlag=!1,this}},{key:"clearTextSize",value:function(){return this.textWidth=0,this.textHeight=0,this.ascent=0,this.descent=0,this}},{key:"copyTextSize",value:function(t){return this.textWidth=t.textWidth,this.textHeight=t.textHeight,this.ascent=t.ascent,this.descent=t.descent,this}},{key:"width",get:function(){return this.textWidth*this.scaleX},set:function(t){this.textWidth>0?this.scaleX=t/this.textWidth:this.scaleX=1;}},{key:"height",get:function(){return this.textHeight*this.scaleY},set:function(t){this.textHeight>0?this.scaleY=t/this.textHeight:this.scaleY=1;}},{key:"willRender",get:function(){return 0!==this.textWidth&&v(h(i.prototype),"willRender",this)}},{key:"renderContent",value:function(){var t=this.context,e=this.style;if(e.hasBackgroundColor){t.fillStyle=e.backgroundColor;var i=this.drawTLX,n=this.drawTRX-i,r=e.backgroundBottomY;null==r&&(r=this.drawBLY);var s=e.backgroundHeight;null==s&&(s=r-this.drawTLY);var o=r-s;t.fillRect(i,o,n,s);}var a=e.hasFill,h=e.hasStroke;(a||h)&&(e.syncFont(t).syncStyle(t),h&&(e.syncShadow(t),t.strokeText(this.text,0,0)),a&&(e.syncShadow(t),t.fillText(this.text,0,0)));}},{key:"drawTLX",get:function(){return -this.leftSpace}},{key:"drawTLY",get:function(){return -this.ascent}},{key:"drawBLX",get:function(){return -this.leftSpace}},{key:"drawBLY",get:function(){return this.descent}},{key:"drawTRX",get:function(){return this.textWidth+this.rightSpace}},{key:"drawTRY",get:function(){return -this.ascent}},{key:"drawBRX",get:function(){return this.textWidth+this.rightSpace}},{key:"drawBRY",get:function(){return this.descent}}]),i}(wu),Yu=function(t,e){var i=this.createCharChildren(t,e);return this.addChild(i),this},Gu=function(t){a(i,t);var e=d(i);function i(t,r,s){var o;return n(this,i),(o=e.call(this,t,Au)).setTexture(r,s),o}return s(i,[{key:"frameWidth",get:function(){return this.frameObj?this.frameObj.cutWidth:0}},{key:"frameHeight",get:function(){return this.frameObj?this.frameObj.cutHeight:0}},{key:"offsetY",get:function(){return -this.height},set:function(t){}},{key:"key",get:function(){return this._key},set:function(t){this.setDirty(this._key!=t),this._key=t;}},{key:"frame",get:function(){return this._frame},set:function(t){this.setDirty(this._frame!=t),this._frame=t;}},{key:"setTexture",value:function(t,e){return this.key=t,this.frame=e,this.frameObj=this.scene.sys.textures.getFrame(t,e),this}},{key:"width",get:function(){return this.frameWidth*this.scaleX},set:function(t){this.setDirty(this.width!==t),this.scaleX=t/this.frameWidth;}},{key:"height",get:function(){return this.frameHeight*this.scaleY},set:function(t){this.setDirty(this.height!==t),this.scaleY=t/this.frameHeight;}},{key:"setHeight",value:function(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}},{key:"renderContent",value:function(){var t=this.context,e=this.frameObj,i=this.frameWidth,n=this.frameHeight;t.drawImage(e.source.image,e.cutX,e.cutY,i,n,0,0,i,n);}},{key:"drawTLX",get:function(){return -this.leftSpace}},{key:"drawTLY",get:function(){return 0}},{key:"drawBLX",get:function(){return -this.leftSpace}},{key:"drawBLY",get:function(){return this.frameHeight}},{key:"drawTRX",get:function(){return this.frameWidth+this.rightSpace}},{key:"drawTRY",get:function(){return 0}},{key:"drawBRX",get:function(){return this.frameWidth+this.rightSpace}},{key:"drawBRY",get:function(){return this.frameHeight}}]),i}(wu),Vu=function(t){a(i,t);var e=d(i);function i(t,r,s,o){var a;return n(this,i),(a=e.call(this,t,Bu)).setRenderCallback(r),a.setDrawerSize(s,o),a}return s(i,[{key:"setRenderCallback",value:function(t){return t?this.renderContent=t.bind(this):delete this.renderContent,this}},{key:"setDrawerSize",value:function(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}},{key:"onFree",value:function(){v(h(i.prototype),"onFree",this).call(this),this.setRenderCallback();}},{key:"width",get:function(){return this.drawerWidth*this.scaleX},set:function(t){this.setDirty(this.width!==t),this.scaleX=this.drawerWidth>0?t/this.drawerWidth:1;}},{key:"height",get:function(){return this.drawerHeight*this.scaleY},set:function(t){this.setDirty(this.height!==t),this.scaleY=this.drawerHeight>0?t/this.drawerHeight:1;}},{key:"offsetY",get:function(){return -this.height},set:function(t){}},{key:"drawTLX",get:function(){return -this.leftSpace}},{key:"drawTLY",get:function(){return 0}},{key:"drawBLX",get:function(){return -this.leftSpace}},{key:"drawBLY",get:function(){return this.drawerHeight}},{key:"drawTRX",get:function(){return this.drawerWidth+this.rightSpace}},{key:"drawTRY",get:function(){return 0}},{key:"drawBRX",get:function(){return this.drawerWidth+this.rightSpace}},{key:"drawBRY",get:function(){return this.drawerHeight}}]),i}(wu),Hu=function(t){a(i,t);var e=d(i);function i(t,r){var s;return n(this,i),(s=e.call(this,t,zu)).setSpaceWidth(r),s}return s(i,[{key:"width",get:function(){return this.spaceWidth*this.scaleX},set:function(t){this.spaceWidth>0?this.scaleX=t/this.spaceWidth:this.scaleX=1;}},{key:"setSpaceWidth",value:function(t){return this.spaceWidth=t,this}}]),i}(wu),Nu=function(t){a(i,t);var e=d(i);function i(t,r,s,o,a){var h;return n(this,i),(h=e.call(this,t,ju)).setName(r).setParameter(o).setCallback(s,a),h}return s(i,[{key:"setName",value:function(t){return this.name=t,this}},{key:"setParameter",value:function(t){return this.param=t,this}},{key:"setCallback",value:function(t,e){return this.callback=t,this.scope=e,this}},{key:"exec",value:function(){return this.scope?this.callback.call(this.scope,this.param,this.name):this.callback(this.param,this.name)}},{key:"onFree",value:function(){v(h(i.prototype),"onFree",this).call(this),this.setName().setCallback().setParameter();}}]),i}(nu),Uu=function(t,e,i,n){void 0===n&&(n={word:[],width:0}),n.word.length=0;for(var r=t.length,s=e,o=n.word,a=0;s0&&!a){var h=this.fixedHeight-n;if(i>0)s=h/i;else s=(l=qu.call(this)).height,o=l.ascent,i=Math.floor((h-o)/s);}else {var l;s=(l=qu.call(this)).height,o=l.ascent;}}else if(this.fixedHeight>0){if(void 0===(i=$u(t,"maxLines"))){h=this.fixedHeight-n;i=Math.floor(h/s);}}else i=$u(t,"maxLines",0);void 0===o&&(o=s);var u=0===i,c=$u(t,"wrapWidth",void 0);void 0===c&&(c=this.fixedWidth>0?this.fixedWidth-r:1/0);for(var d=$u(t,"letterSpacing",0),f=$u(t,"hAlign",0),v=$u(t,"vAlign",0),p=$u(t,"charWrap",!1),g={callback:"runWordWrap",start:e,isLastPage:!1,padding:this.wrapPadding,ascent:o,lineHeight:s,maxLines:i,wrapWidth:c,letterSpacing:d,hAlign:f,vAlign:v,charWrap:p,children:[],lines:[],maxLineWidth:0,linesHeight:0},y=this.children,k=0,m=y.length;k0&&(_.push({children:E,width:R}),M=Math.max(M,R)),g.start+=O.length,g.isLastPage=!L&&g.start===T,g.maxLineWidth=M,g.linesHeight=_.length*s;var F=this.fixedWidth>0?this.fixedWidth:g.maxLineWidth+r,W=this.fixedHeight>0?this.fixedHeight:g.linesHeight+n;!function(t,e,i){var n,r,s=t.hAlign,o=t.vAlign,a=t.linesHeight;switch(o){case 1:case"center":r=(i-a)/2;break;case 2:case"bottom":r=i-a;break;default:r=0;}for(var h=t.lines,l=0,u=h.length;l0?(o=this.fixedWidth-r)/i:0;else if(this.fixedWidth>0){if(void 0===(i=ec(t,"maxLines",void 0))){var o=this.fixedWidth-r;i=Math.floor(o/s)+1;}}else i=ec(t,"maxLines",0);var a=0===i,h=ec(t,"fixedChildHeight",void 0);if(void 0===h){var l=ec(t,"charPerLine",void 0);if(void 0!==l){var u=this.fixedHeight-n;h=Math.floor(u/l);}}var c=ec(t,"wrapHeight",void 0);void 0===c&&(c=this.fixedHeight>0?this.fixedHeight-n:1/0);for(var d=ec(t,"letterSpacing",0),f=ec(t,"rtl",!0),v=ec(t,"hAlign",f?2:0),p=ec(t,"vAlign",0),g={callback:"runVerticalWrap",start:e,isLastPage:!1,padding:this.wrapPadding,lineWidth:s,maxLines:i,fixedChildHeight:h,wrapHeight:c,letterSpacing:d,hAlign:v,vAlign:p,rtl:f,children:[],lines:[],maxLineHeight:0,linesWidth:0},y=this.children,k=0,m=y.length;k0&&(_.push({children:E,height:R}),M=Math.max(M,R)),g.start+=O.length,g.isLastPage=g.start===T,g.maxLineHeight=M,g.linesWidth=_.length*s;var j=this.fixedWidth>0?this.fixedWidth:g.linesWidth+r,I=this.fixedHeight>0?this.fixedHeight:g.maxLineHeight+n;!function(t,e,i){var n,r,s=t.hAlign,o=t.vAlign,a=t.rtl,h=t.lines,l=t.lineWidth,u=t.linesWidth;switch(s){case 1:case"center":n=(e-u)/2;break;case 2:case"right":n=e-u;break;default:n=0;}a&&(n+=l);for(var c=0,d=h.length;c0?t:this.width,e>0?e:this.height),this):this},setPadding:function(t,e){var i=this.padding,n=i.left,r=i.right,s=i.top,o=i.bottom;return Ue(i,t,e),this.dirty=this.dirty||n!=i.left||r!=i.right||s!=i.top||o!=i.bottom,this},getPadding:function(t){return Ne(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),Mu(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 Lu(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,n,r,s=Array.isArray(t);void 0===e||e===this.children.length?s?(i=this.children).push.apply(i,y(t)):this.children.push(t):s?(n=this.children).splice.apply(n,[e,0].concat(y(t))):this.children.splice(e,0,t);(this.lastAppendedChildren.length=0,s)?(r=this.lastAppendedChildren).push.apply(r,y(t)):this.lastAppendedChildren.push(t);return this},createCharChild:function(t,e){e&&this.textStyle.modify(e);var i=this.poolManager.allocate(Du);return null===i?i=new Xu(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=[],n=0,r=t.length;ne&&(n=e,r=t);})),r},getCharWorldPosition:function(t,e,i,n){return "number"==typeof t&&(t=this.getCharChild(t,!0)),ku(this,t,e,i,n)},setToMinSize:function(){for(var t=this.children,e=0,i=0,n=0,r=t.length;n=i.length&&(t=i.length);for(var n=0,r=0;r0,o=0,a=e.length;o0;this.dirty=this.dirty||this._radiusTL!==t||this._convexTL!==e,this._convexTL=e,this._radiusTL=Math.abs(t);}},{key:"radiusTR",get:function(){return this._radiusTR},set:function(t){var e=t>0;this.dirty=this.dirty||this._radiusTR!==t||this._convexTR!==e,this._convexTR=e,this._radiusTR=Math.abs(t);}},{key:"radiusBL",get:function(){return this._radiusBL},set:function(t){var e=t>0;this.dirty=this.dirty||this._radiusBL!==t||this._convexBL!==e,this._convexBL=e,this._radiusBL=Math.abs(t);}},{key:"radiusBR",get:function(){return this._radiusBR},set:function(t){var e=t>0;this.dirty=this.dirty||this._radiusBR!==t||this._convexBR!==e,this._convexBR=e,this._radiusBR=Math.abs(t);}},{key:"radius",get:function(){return Math.max(this.radiusTL,this.radiusTR,this.radiusBL,this.radiusBR)},set:function(t){"number"==typeof t?(this.radiusTL=t,this.radiusTR=t,this.radiusBL=t,this.radiusBR=t):(this.radiusTL=dd(t,"tl",0),this.radiusTR=dd(t,"tr",0),this.radiusBL=dd(t,"bl",0),this.radiusBR=dd(t,"br",0));}},{key:"setRadius",value:function(t){return void 0===t&&(t=0),this.radius=t,this}},{key:"iterations",get:function(){return this._iterations},set:function(t){this.dirty=this.dirty||this._iterations!==t,this._iterations=t;}},{key:"setIterations",value:function(t){return this.iterations=t,this}},{key:"updateData",value:function(){var t=this.pathData;t.length=0;var e,n=this.width,r=this.height,s=this.iterations+1;(e=this.radiusTL)>0?this._convexTL?Ko(e,e,e,e,180,270,!1,s,t):Ko(0,0,e,e,90,0,!0,s,t):No(0,0,t);(e=this.radiusTR)>0?this._convexTR?Ko(n-e,e,e,e,270,360,!1,s,t):Ko(n,0,e,e,180,90,!0,s,t):No(n,0,t);(e=this.radiusBR)>0?this._convexBR?Ko(n-e,r-e,e,e,0,90,!1,s,t):Ko(n,r,e,e,270,180,!0,s,t):No(n,r,t);(e=this.radiusBL)>0?this._convexBL?Ko(e,r-e,e,e,90,180,!1,s,t):Ko(0,r,e,e,360,270,!0,s,t):No(0,r,t);return t.push(t[0],t[1]),qc(this.x,this.y,t),v(h(i.prototype),"updateData",this).call(this),this}}]),i}(Vc);Phaser.Renderer.WebGL.Utils.getTintAppendFloatAlpha,Phaser.Math.Wrap;var vd=Phaser.Math.Linear,pd=function(){var t,e,i,n,r,s,o=this.getShape("triangle"),a=this.padding,h=this.width-a.right,l=0+a.left,u=this.height-a.bottom,c=0+a.top,d=(l+h)/2,f=(c+u)/2,v={0:{a:{x:l,y:c},b:{x:h,y:f},c:{x:l,y:u}},1:{a:{x:l,y:c},b:{x:d,y:u},c:{x:h,y:c}},2:{a:{x:h,y:c},b:{x:l,y:f},c:{x:h,y:u}},3:{a:{x:l,y:u},b:{x:d,y:c},c:{x:h,y:u}}};if(void 0===this.previousDirection){var p=v[this.direction],g=p.a,y=p.b,k=p.c;t=g.x,e=g.y,i=y.x,n=y.y,r=k.x,s=k.y;}else {var m=v[this.previousDirection],b=v[this.direction],x=this.easeDirectionProgress;t=vd(m.a.x,b.a.x,x),e=vd(m.a.y,b.a.y,x),i=vd(m.b.x,b.b.x,x),n=vd(m.b.y,b.b.y,x),r=vd(m.c.x,b.c.x,x),s=vd(m.c.y,b.c.y,x);}o.startAt(t,e).lineTo(i,n).lineTo(r,s),this.arrowOnly?o.end():o.close();},gd=(0, Phaser.Math.DegToRad)(120),yd=function(t){t=this.getShape("triangle");var e=this.width/2,i=this.height/2,n=Math.min(e,i)*this.radius,r=this.verticeRotation;t.startAt(e+n*Math.cos(r+gd),i+n*Math.sin(r+gd)).lineTo(e+n*Math.cos(r),i+n*Math.sin(r)).lineTo(e+n*Math.cos(r-gd),i+n*Math.sin(r-gd)),this.arrowOnly?t.end():t.close();},kd={buildShapes:function(){this.addShape((new cd).setName("triangle"));},updateShapes:function(){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?pd.call(this):yd.call(this);}},md={setEaseDuration:function(t){return void 0===t&&(t=0),this.easeDuration=t,this},playEaseDirectionation:function(){return void 0===this.easeDirectionProgressTask&&(this.easeDirectionProgressTask=new kn(this,{eventEmitter:null})),this.easeDirectionProgressTask.restart({key:"easeDirectionProgress",from:0,to:1,duration:this.easeDuration}),this},stopEaseDirection:function(){return void 0===this.easeDirectionProgressTask||this.easeDirectionProgressTask.stop(),this}},bd=Phaser.Utils.Objects.GetValue,xd=Phaser.Utils.Objects.IsPlainObject,Cd=Phaser.Math.DegToRad,wd=Phaser.Math.RadToDeg,Sd=function(t){a(r,t);var e=d(r);function r(t,i,s,o,a,h,l){var u,c,d,f,v,p,g,y,k;if(n(this,r),xd(i)){var m=i;i=m.x,s=m.y,o=m.width,a=m.height,h=m.color,l=m.alpha,c=m.strokeColor,d=m.strokeAlpha,f=m.strokeWidth,v=m.arrowOnly,p=m.direction,g=m.easeDuration,y=m.padding,k=m.radius;}return void 0===i&&(i=0),void 0===s&&(s=0),void 0===o&&(o=1),void 0===a&&(a=o),void 0===v&&(v=!1),void 0===p&&(p=0),void 0===g&&(g=0),void 0===y&&(y=0),void 0===k&&(k=void 0),(u=e.call(this,t,i,s,o,a)).type="rexTriangle",u.setFillStyle(h,l),void 0!==c&&void 0===f&&(f=2),u.setStrokeStyle(f,c,d),u.setArrowOnly(v),u.setDirection(p,g),u.setPadding(y),u.setRadius(k),u.buildShapes(),u}return s(r,[{key:"arrowOnly",get:function(){return this._arrowOnly},set:function(t){this.dirty=this.dirty||this._arrowOnly!=t,this._arrowOnly=t;}},{key:"setArrowOnly",value:function(t){return void 0===t&&(t=!0),this.arrowOnly=t,this}},{key:"direction",get:function(){return this._direction},set:function(t){t=Td(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());}},{key:"setDirection",value:function(t,e){return void 0!==e&&this.setEaseDuration(e),this.direction=t,this}},{key:"toggleDirection",value:function(t){return this.setDirection(this.direction+2,t),this}},{key:"easeDirectionProgress",get:function(){return this._easeDirectionProgress},set:function(t){this._easeDirectionProgress!==t&&(this._easeDirectionProgress=t,this.dirty=!0);}},{key:"setPadding",value:function(t,e,n,r){if("object"===i(t)){var s=t,o=bd(s,"x",null);null!==o?(t=o,n=o):(t=bd(s,"left",0),n=bd(s,"right",t));var a=bd(s,"y",null);null!==a?(e=a,r=a):(e=bd(s,"top",0),r=bd(s,"bottom",e));}else void 0===t&&(t=0),void 0===e&&(e=t),void 0===n&&(n=t),void 0===r&&(r=e);return void 0===this.padding&&(this.padding={}),this.dirty=this.dirty||this.padding.left!=t||this.padding.top!=e||this.padding.right!=n||this.padding.bottom!=r,this.padding.left=t,this.padding.top=e,this.padding.right=n,this.padding.bottom=r,this.setRadius(),this}},{key:"radius",get:function(){return this._radius},set:function(t){this.dirty=this.dirty||this._radius!=t,this._radius=t;}},{key:"setRadius",value:function(t){return this.radius=t,this.shapeMode=null==t?0:1,this}},{key:"verticeRotation",get:function(){return this._verticeRotation},set:function(t){this.dirty=this.dirty||this._verticeRotation!=t,this._verticeRotation=t;}},{key:"setVerticeRotation",value:function(t){return this.verticeRotation=t,this}},{key:"verticeAngle",get:function(){return wd(this.verticeRotation)},set:function(t){this.verticeRotation=Cd(t);}},{key:"setVerticeAngle",value:function(t){return this.verticeAngle=t,this}}]),r}(Wc),Pd={right:0,down:1,left:2,up:3},Td=function(t){return "string"==typeof t&&(t=Pd[t]),t%=4};Object.assign(Sd.prototype,kd,md);var Od=function(t){a(i,t);var e=d(i);function i(t,r){var s;n(this,i),void 0===r&&(r={}),(s=e.call(this,t,r)).type="rexTweaker.FolderTitle";var o=new Sd(t,r.expandedIcon);return t.add.existing(o),s.addSpace().add(o,{proportion:0,expand:!1,padding:1,fitRatio:1}),s.addChildrenMap("expandedIcon",o),s}return s(i,[{key:"setExpandedState",value:function(t){void 0===t&&(t=!0);var e=t?"down":"right";return this.childrenMap.expandedIcon.setDirection(e),this}}]),i}(Ac),_d=function(t,e){var i=new uk(t,e);return t.add.existing(i),i},Ed=function(t,e,i){return Ka(t,i)},Rd=function(t){a(i,t);var e=d(i);function i(t,r){return n(this,i),void 0===r&&(r={}),r.destroy=!1,e.call(this,t,r)}return s(i,[{key:"onOpen",value:function(){this.emit("open",this.parent,this),v(h(i.prototype),"onOpen",this).call(this);}},{key:"onClose",value:function(){this.emit("close",this.parent,this),v(h(i.prototype),"onClose",this).call(this);}}]),i}(Vn),Md={expand:function(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.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:function(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.reLayoutTarget?this.reLayoutTarget:this.getTopmostSizer()).layout(),this.emit("collapse.complete",this);}),this).requestClose(null,t),this},toggle:function(t){return this.expanded?this.collapse(t):this.expand(t),this}},Ld=function(t,e){Wi.popUp.call(t,e,this.expandDirection);},Dd=function(t,e){Wi.scaleDown.call(t,e,this.expandDirection);},Ad={setTransitionDuration:function(t){return this.transitionDuration=t,this.childTransition.setTransitInTime(t).setTransitOutTime(t),this},setExpandCallback:function(t){return void 0===t&&(t=Ld.bind(this)),this.childTransition.setTransitInCallback(t),this},setCollapseCallback:function(t){return void 0===t&&(t=Dd.bind(this)),this.childTransition.setTransitOutCallback(t),this}},Bd=Phaser.Utils.Objects.GetValue,zd=function(t){a(i,t);var e=d(i);function i(t,r){var s;n(this,i),void 0===r&&(r={}),r.hasOwnProperty("orientation")||(r.orientation=1),(s=e.call(this,t,r)).type="rexFolder",s.expanded=void 0,s.expandDirection=1===s.orientation?"y":"x";var o=r.background,a=r.title,h=r.child;o&&s.addBackground(o);var l=1===s.orientation?"left":"top",c=Bd(r,"align.title",l),d=Bd(r,"expand.title",!0);s.add(a,{proportion:0,align:c,expand:d});var f=Bd(r,"toggleByTarget",void 0),v=Bd(r,"toggleClickConfig");if(void 0===f&&(f=a),f&&Pr.onClick.call(f,(function(){this.toggle();}),u(s),v),s.childTransition=new Rd(h),!Bd(r,"customChildOrigin",!1)){var p=s.rtl?1:0;h.setOrigin(p);}c=Bd(r,"align.child","left");var g=(d=Bd(r,"expand.child",!0))?1:0;s.add(h,{proportion:g,align:c,expand:d}),s.addChildrenMap("title",a),s.addChildrenMap("child",h),s.addChildrenMap("background",o);var y=r.transition;s.setTransitionDuration(Bd(y,"duration",200)),s.setExpandCallback(Bd(y,"expandCallback",void 0)),s.setCollapseCallback(Bd(y,"collapseCallback",void 0)),s.reLayoutTarget=Bd(r,"reLayoutTarget",void 0);var k=r.onExpandStart;k&&s.on("expand.start",k);var m=r.onExpandComplete;m&&s.on("expand.complete",m);var b=r.onCollapseStart;b&&s.on("collapse.start",b);var x=r.onCollapseComplete;return x&&s.on("collapse.complete",x),s}return s(i)}(To);Object.assign(zd.prototype,Md,Ad);var jd=function(t){a(i,t);var e=d(i);function i(t,r){var s;return n(this,i),(s=e.call(this,t,r)).type="rexTweaker.Folder",s}return s(i,[{key:"setTitle",value:function(t){return this.childrenMap.title.setTitle(t),this}}]),i}(zd);Object.assign(jd.prototype,{setBindingTarget:function(t){return this.childrenMap.child.setBindingTarget(t),this}},{getMaxInputRowTitleWidth:function(){return this.childrenMap.child.getMaxInputRowTitleWidth()+this.getInnerPadding("left")},setInputRowTitleWidth:function(t){return t-=this.getInnerPadding("left"),this.childrenMap.child.setInputRowTitleWidth(t),this}});var Id=Phaser.Utils.Objects.GetValue,Fd=Phaser.Utils.Objects.GetValue,Wd=To.prototype.add,Xd=To.prototype.addSpace,Yd=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)&&Xd.call(this),Wd.call(this,t,{proportion:i,expand:!0});var n=!this.buttonsExpand&&"center"===this.buttonsAlign;n&&Xd.call(this),this.hasTailSpace=n;}else Wd.call(this,t,{proportion:i,expand:!0}),this.hasTailSpace=!1;else if(this.hasTailSpace){var r=this.sizerChildren.length-1;Wd.call(this,t,{index:r,proportion:i,expand:!0});}else Wd.call(this,t,{proportion:i,expand:!0});return e&&this.buttonGroup.add(t),this},Gd={addButton:function(t){if(ur(t))for(var e=t,i=0,n=e.length;i=0;i--)Nd.call(this,e[i],t);return this}},Kd=function(t,e,i){if(t){var n=this.setValueCallback,r=this.setValueCallbackScope;n&&(r?n.call(r,t,e,i):n(t,e,i)),this.fireEvent("button.statechange",t,e,i);}},Jd=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 n=t._selected;t._selected=i,Kd.call(e,t,i,n);}},enumerable:!0,configurable:!0}),t.selected=!1;},qd={add:function(t){return this.buttons.push(t),t._click||(t._click=new wr(t,this.clickConfig),t._click.on("click",(function(t,e,i,n){this.fireEvent("button.click",e,i,n);}),this).on("enable",(function(t,e){this.fireEvent("button.enable",e);}),this).on("disable",(function(t,e){this.fireEvent("button.disable",e);}),this),t.on("pointerover",(function(e,i,n,r){this.fireEvent("button.over",t,e,r);}),this).on("pointerout",(function(e,i){this.fireEvent("button.out",t,e,i);}),this).on("pointerdown",(function(e,i,n,r){this.fireEvent("button.down",t,e,r);}),this).on("pointerup",(function(e,i){this.fireEvent("button.up",t,e,i);}),this)),this.buttonsType&&(void 0===t.name&&console.error("".concat(this.parent.constructor.name,": Option button miss value")),Jd.call(this,t)),this},addMultiple:function(t){for(var e=0,i=t.length;e2?o-2:0),h=2;ha.height/2)){r>(h=ff(a.left,a.centerY,t,e))&&(r=h,n=s);var h,l=i[s+1];if(!l||l.y!==a.y)r>(h=ff(a.right,a.centerY,t,e))&&(r=h,n=s+1);}}return n},pf=Phaser.Utils.Objects.IsPlainObject,gf=Phaser.Utils.Objects.GetValue,yf=Phaser.Display.Align.CENTER,kf=function(t,e,i,n){if("\n"===t)return this.addNewLine(),this;var r;(Ae.call(this,t),pf(e))&&(e=gf(r=e,"padding",0),i=gf(r,"key",void 0),n=gf(r,"index",void 0));return void 0===e&&(e=0),(r=this.getSizerConfig(t)).align=yf,r.padding=Le(e),void 0===n||n>=this.sizerChildren.length?this.sizerChildren.push(t):this.sizerChildren.splice(n,0,t),void 0!==i&&this.addChildrenMap(i,t),this},mf={add:function(t,e,i){if(ur(t))for(var n=t,r=0,s=n.length;r=0;e--)this.remove(this.sizerChildren[e],t);return this},clear:function(t){return this.sizerChildren.length=0,go.call(this,t),this}},Cf={getChildrenWidth:function(){return this.rexSizer.hidden?0:this.maxChildWidth+this.space.left+this.space.right},getChildrenHeight:function(){return this.rexSizer.hidden?0:this.widthWrapResult.height+this.space.top+this.space.bottom},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,n=0,r=i.length;nr&&Ef.addNewLine(this);}else for(s=0,o=t.length;s=0;i--)Af.call(this,e[i],t);return this}},zf=Phaser.Utils.Objects.GetValue,jf=function(t){a(i,t);var e=d(i);function i(t,r){var s;n(this,i),void 0===r&&(r={});var o=r.space;"number"==typeof o&&(r.space={item:o,line:o}),(s=e.call(this,t,r)).type="rexFixWidthButtons",s.buttonGroup=new rf({parent:u(s),eventEmitter:zf(r,"eventEmitter",u(s)),groupName:zf(r,"groupName",void 0),clickConfig:zf(r,"click",void 0)}).setButtonsType(r);var a=zf(r,"background",void 0),h=zf(r,"buttons",void 0);return s.buttonsAlign=zf(r,"align",void 0),a&&s.addBackground(a),h&&s.addButtons(h),s.addChildrenMap("background",a),s.addChildrenMap("buttons",s.buttonGroup.buttons),s}return s(i,[{key:"destroy",value:function(t){this.scene&&!this.ignoreDestroy&&(v(h(i.prototype),"destroy",this).call(this,t),this.buttonGroup.destroy(),this.buttonGroup=void 0);}},{key:"buttons",get:function(){return this.buttonGroup.buttons}},{key:"groupName",get:function(){return this.buttonGroup.groupName},set:function(t){this.buttonGroup.groupName=t;}},{key:"eventEmitter",get:function(){return this.buttonGroup.eventEmitter}}]),i}(Of);Object.assign(jf.prototype,Mf,Bf,nf,of);var If=Phaser.Utils.Objects.IsPlainObject,Ff=Phaser.Utils.Objects.GetValue,Wf=Phaser.Display.Align.CENTER,Xf=Phaser.Utils.String.UUID,Yf={add:function(t,e,i,n,r,s,o,a,h){(Ae.call(this,t),If(e))&&(e=Ff(l=e,"key",void 0),i=Ff(l,"align",Wf),a=Ff(l,"offsetX",0),h=Ff(l,"offsetY",0),n=Ff(l,"padding",0),r=Ff(l,"expand",!0),t.isRexSizer||(s=Ff(l,"minWidth",t._minWidth),o=Ff(l,"minHeight",t._minHeighted)));var l,u=void 0!==e;return u||(e=Xf()),"string"==typeof i&&(i=ee[i]),void 0===i&&(i=Wf),void 0===a&&(a=0),void 0===h&&(h=0),void 0===n&&(n=0),void 0===r&&(r=!0),t.isRexSizer||(void 0===s&&(s=t._minWidth),void 0===o&&(o=t._minHeight)),(l=this.getSizerConfig(t)).align=i,l.alignOffsetX=a,l.alignOffsetY=h,l.padding=Le(n),If(r)?(l.expandWidth=Ff(r,"width",!1),l.expandHeight=Ff(r,"height",!1)):(l.expandWidth=r,l.expandHeight=r),t.isRexSizer||(l.expandWidth&&(t.minWidth=void 0===s?kt(t):s),l.expandHeight&&(t.minHeight=void 0===o?mt(t):o)),this.sizerChildren.hasOwnProperty(e)&&this.sizerChildren[e].destroy(),this.sizerChildren[e]=t,u&&this.addChildrenMap(e,t),this}},Gf={remove:function(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]),Ie.call(this,t,e),this},removeAll:function(t){for(var e in this.sizerChildren)this.remove(e,t);return this},clear:function(t){for(var e in this.sizerChildren)delete this.sizerChildren[e],this.childrenMap.hasOwnProperty(e)&&delete this.childrenMap[e];return go.call(this,t),this}},Vf={getChildrenWidth:function(){if(this.rexSizer.hidden)return 0;var t,e,i,n=0,r=this.sizerChildren;for(var s in r)e=(t=r[s]).rexSizer.padding,i=this.getChildWidth(t)+e.left+e.right,n=Math.max(i,n);return n+this.space.left+this.space.right},getChildrenHeight:function(){if(this.rexSizer.hidden)return 0;var t,e,i,n=0,r=this.sizerChildren;for(var s in r)i=(t=r[s]).isRexSizer?Math.max(t.minHeight,t.childrenHeight):void 0!==t.minHeight?t.minHeight:mt(t),i+=(e=t.rexSizer.padding).top+e.bottom,n=Math.max(i,n);return n+this.space.top+this.space.bottom},getExpandedChildWidth:function(t,e){var i;void 0===e&&(e=this.width);var n=t.rexSizer;if(n.expandWidth){var r=e-this.space.left-this.space.right,s=n.padding;i=r-s.left-s.right;}return i},getExpandedChildHeight:function(t,e){var i;void 0===e&&(e=this.height);var n=t.rexSizer;if(n.expandHeight){var r=e-this.space.top-this.space.bottom,s=n.padding;i=r-s.top-s.bottom;}return i},getChildrenSizers:function(t){void 0===t&&(t=[]);var e,i=this.sizerChildren;for(var n in i)(e=i[n]).isRexSizer&&t.push(e);return t},layoutChildren:function(){var t,e,i,n,r,s,o,a,h,l=this.innerLeft,u=this.innerTop,c=this.innerWidth,d=this.innerHeight,f=this.sizerChildren;for(var v in f)(t=f[v]).rexSizer.hidden||(i=(e=t.rexSizer).padding,mr.call(this,t),t.isRexSizer?(t.runLayout(this,this.getExpandedChildWidth(t),this.getExpandedChildHeight(t)),ro(t,this)):(a=void 0,h=void 0,e.expandWidth&&(a=c-i.left-i.right),e.expandHeight&&(h=d-i.top-i.bottom),pr(t,a,h)),n=l+i.left,s=c-i.left-i.right,r=u+i.top,o=d-i.top-i.bottom,br.call(this,t,n,r,s,o,e.align,e.alignOffsetX,e.alignOffsetY));}};Object.assign(Vf,Yf,Gf);var Hf=Phaser.Utils.Objects.IsPlainObject,Nf=Phaser.Utils.Objects.GetValue,Uf=function(t){a(i,t);var e=d(i);function i(t,r,s,o,a,h){var l;return n(this,i),Hf(r)?(r=Nf(h=r,"x",0),s=Nf(h,"y",0),o=Nf(h,"width",void 0),a=Nf(h,"height",void 0)):Hf(o)&&(o=Nf(h=o,"width",void 0),a=Nf(h,"height",void 0)),(l=e.call(this,t,r,s,o,a,h)).type="rexOverlapSizer",l.sizerChildren={},l.addChildrenMap("items",l.sizerChildren),l}return s(i,[{key:"childToKey",value:function(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}}]),i}(no);Object.assign(Uf.prototype,Vf);var Kf=Uf.prototype.add,Jf=function(t,e,i,n,r,s,o,a,h){return t.setVisible(!1),Kf.call(this,t,e,i,n,r,s,o,a,h),this},qf={add:Jf,addPage:Jf},Zf=Kt.prototype.setChildVisible,$f={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?(Zf.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 n=this.currentPage;return n&&(Zf.call(this,n,!0),this.emit("pagevisible",n,this._currentKey,this),void 0===e&&(e=this.fadeInDuration),e>0&&n.setAlpha(0).fadeIn(e,1)),this},hasPage:function(t){return this.sizerChildren.hasOwnProperty(t)}};Object.assign($f,qf);var Qf=Phaser.Utils.Objects.GetValue,tv=function(t){a(i,t);var e=d(i);function i(t,r){var s;return n(this,i),(s=e.call(this,t,r)).type="rexPages",s.childrenMap=s.sizerChildren,s._previousKey=void 0,s._currentKey=void 0,s.setSwapMode(Qf(r,"swapMode",0)),s.setFadeInDuration(Qf(r,"fadeIn",0)),s}return s(i,[{key:"setSwapMode",value:function(t){return "string"==typeof t&&(t=ev[t]),this.swapMode=t,this}},{key:"setFadeInDuration",value:function(t){return this.fadeInDuration=t,this}},{key:"previousKey",get:function(){return this._previousKey}},{key:"currentKey",get:function(){return this._currentKey},set:function(t){this.swapPage(t);}},{key:"currentPage",get:function(){return this.getPage(this.currentKey)}},{key:"previousPage",get:function(){return this.getPage(this.previousKey)}},{key:"keys",get:function(){return Object.keys(this.sizerChildren)}}]),i}(Uf);Object.assign(tv.prototype,$f);var ev={invisible:0,destroy:1},iv=Phaser.Utils.Objects.IsPlainObject,nv=Phaser.Utils.Objects.GetValue,rv=Phaser.Utils.String.UUID,sv={swapPage:function(t,e){var i,n;null!=(i="number"==typeof t?t:this.getPageIndex(t))&&(void 0!==e&&(n=this.childrenMap.pages.fadeInDuration,this.childrenMap.pages.fadeInDuration=e),this.childrenMap.tabs.emitButtonClick(i),void 0!==n&&(this.childrenMap.pages.fadeInDuration=n));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}},ov={removePage:function(t,e){"number"==typeof t&&(t=this.getPageKey(t));var i=this.childrenMap.tabs,n=i.getByName(t),r=this.childrenMap.pages,s=r.getElement(t);return n&&s?(r.removeChildrenMap(t),i.removeButton(n,e),r.remove(s,e),this):this}},av={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,n=e.length;i1?e-1:0),n=1;n=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!=n&&(r=e.getCharChild(n))&&("\n"===r.text&&r.copyTextSize(e.lastInsertCursor),function(t){var e,i,n=t.parent,r=n.width,s=n.height,o=t.drawX,a=t.drawY,h=o+t.drawTLX,l=o+t.drawTRX,u=a+t.drawTLY,c=a+t.drawBLY;e=h<0?0-h:l>r?r-l:0,i=u<0?0-u:c>s?s-c:0,n._textOX+=e,n._textOY+=i;}(r),e.emit("cursorin",r,n,e)),e.emit("movecursor",n,t.prevCursorPosition,e),t.prevCursorPosition=n;}}(this)):(Yv(this),Gv(this)),this}},{key:"setNumberInput",value:function(){return this.onUpdateCallback=Xv,this}},{key:"setSelectAllWhenFocusEnable",value:function(t){return void 0===t&&(t=!0),this.selectAllWhenFocus=t,this}}]),i}(Wv),Nv=Phaser.Utils.Objects.GetValue,Uv=["inputType","onOpen","onFocus","onClose","onBlur","onUpdate","enterClose","readOnly","maxLength","minLength","selectAll"],Kv=function(t,e){if(t&&"number"!=typeof t){if(t.hasOwnProperty(e))return !0;if(-1!==e.indexOf(".")){for(var i=e.split("."),n=t,r=0;rt.length?i:t})),l.value=t.join(c);}else l.value=t.join(i.slice(a,a+l.count));a+=l.count,l.added||(h+=l.count);}}var d=e[o-1];return o>1&&"string"==typeof d.value&&(d.added||d.removed)&&t.equals("",d.value)&&(e[o-2].value+=d.value,e.pop()),e}$v.prototype={diff:function(t,e){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=i.callback;"function"==typeof i&&(n=i,i={}),this.options=i;var r=this;function s(t){return n?(setTimeout((function(){n(void 0,t);}),0),!0):t}t=this.castInput(t),e=this.castInput(e),t=this.removeEmpty(this.tokenize(t));var o=(e=this.removeEmpty(this.tokenize(e))).length,a=t.length,h=1,l=o+a;i.maxEditLength&&(l=Math.min(l,i.maxEditLength));var u=[{newPos:-1,components:[]}],c=this.extractCommon(u[0],e,t,0);if(u[0].newPos+1>=o&&c+1>=a)return s([{value:this.join(e),count:e.length}]);function d(){for(var i=-1*h;i<=h;i+=2){var n=void 0,l=u[i-1],c=u[i+1],d=(c?c.newPos:0)-i;l&&(u[i-1]=void 0);var f=l&&l.newPos+1=o&&d+1>=a)return s(Qv(r,n.components,e,t,r.useLongestToken));u[i]=n;}else u[i]=void 0;}var p;h++;}if(n)!function t(){setTimeout((function(){if(h>l)return n();d()||t();}),0);}();else for(;h<=l;){var f=d();if(f)return f}},pushComponent:function(t,e,i){var n=t[t.length-1];n&&n.added===e&&n.removed===i?t[t.length-1]={count:n.count+1,added:e,removed:i}:t.push({count:1,added:e,removed:i});},extractCommon:function(t,e,i,n){for(var r=e.length,s=i.length,o=t.newPos,a=o-n,h=0;o+1b.bottom&&(l=c.getTopLeft().y,t.setOrigin(0,1).setPosition(h+d,l+f));},lg={down:0,up:1},ug=Phaser.Utils.Objects.GetValue,cg=function(t){a(i,t);var e=d(i);function i(t,r){var s;n(this,i),void 0===r&&(r={}),null==r.transitIn&&(r.transitIn=function(t,e){Ai(t,e,"y","Cubic");}),null==r.transitOut&&(r.transitOut=function(t,e){!function(t,e,i,n,r){void 0===n&&(n="Linear");var s={mode:0};switch(i){case 0:case"x":s.end={x:0};break;case 1:case"y":s.end={y:0};break;default:s.end=0;}s.duration=e,s.ease=n,void 0===r?r=new Li(t,s):r.resetFromJSON(s),r.restart();}(t,e,"y","Linear");}),r.manualClose=!0,r.clickOutsideClose=!0,r.destroy=!0,s=e.call(this,t,r),hg(t,r),t.isRexSizer&&t.layout();var o=ug(r,"touchOutsideClose",!1),a=ug(r,"anyTouchClose",!1);return a&&(o=!1),a?s.once("open",s.anyTouchClose,u(s)):o&&s.once("open",s.touchOutsideClose,u(s)),s.requestOpen(),s}return s(i,[{key:"shutdown",value:function(t){this.isShutdown||(this.scene.input.off("pointerup",this.touchCloseCallback,this),v(h(i.prototype),"shutdown",this).call(this,t));}},{key:"touchOutsideClose",value:function(){return this.scene.input.on("pointerup",this.touchCloseCallback,this),this.clickOutsideTest=!0,this}},{key:"anyTouchClose",value:function(){return this.scene.input.once("pointerup",this.touchCloseCallback,this),this}},{key:"touchCloseCallback",value:function(t){this.clickOutsideTest&&nr(this.parent,t.worldX,t.worldY)||this.requestClose();}},{key:"onOpen",value:function(){this.emit("open",this.parent,this),v(h(i.prototype),"onOpen",this).call(this);}},{key:"onClose",value:function(){this.emit("close",this.parent,this),v(h(i.prototype),"onClose",this).call(this);}}]),i}(Vn),dg={openListPanel:function(){if(this.listPanel)return this;var t,e=og.call(this);e.on("button.over",(function(t,i,n,r){this.listOnButtonOver&&this.listOnButtonOver.call(this,t,i,n,r),this.emit("button.over",this,e,t,i,n,r);}),this).on("button.out",(function(t,i,n,r){this.listOnButtonOut&&this.listOnButtonOut.call(this,t,i,n,r),this.emit("button.out",this,e,t,i,n,r);}),this),t=this.listAlignMode&&"label"!==this.listAlignMode?this.getElement(this.listAlignMode):this;var i=new cg(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,anyTouchClose:!0}).on("open",(function(){e.on("button.click",(function(t,i,n,r){this.listOnButtonClick&&this.listOnButtonClick.call(this,t,i,n,r),this.emit("button.click",this,e,t,i,n,r);}),this),this.emit("list.open",this,e);}),this).on("close",(function(){this.listPanel=void 0,this.dropDownBehavior=void 0;}),this);return this.listPanel=e,this.dropDownBehavior=i,this.pin(e),this},closeListPanel:function(){return this.dropDownBehavior?(this.dropDownBehavior.requestClose(),this):this},toggleListPanel:function(){return this.listPanel?this.closeListPanel():this.openListPanel(),this}};Object.assign(dg,rg);var fg=Phaser.Utils.Objects.GetValue,vg=function(t){a(i,t);var e=d(i);function i(t,r){var s;n(this,i),(s=e.call(this,t,r)).type="rexDropDownList",s.timer=void 0,s.setOptions(fg(r,"options"));var o=fg(r,"list");return s.setWrapEnable(fg(o,"wrap",!1)),s.setCreateButtonCallback(fg(o,"createButtonCallback")),s.setCreateListBackgroundCallback(fg(o,"createBackgroundCallback")),s.setButtonClickCallback(fg(o,"onButtonClick")),s.setButtonOverCallback(fg(o,"onButtonOver")),s.setButtonOutCallback(fg(o,"onButtonOut")),s.setListExpandDirection(fg(o,"expandDirection")),s.setListEaseInDuration(fg(o,"easeIn",500)),s.setListEaseOutDuration(fg(o,"easeOut",100)),s.setListTransitInCallback(fg(o,"transitIn")),s.settListTransitOutCallback(fg(o,"transitOut")),s.setListSize(fg(o,"width"),fg(o,"height")),s.setListAlignmentMode(fg(o,"alignParent","text")),s.setListAlignmentSide(fg(o,"alignSide","")),s.setListBounds(fg(o,"bounds")),s.setListSpace(fg(o,"space")),s.setListDraggable(fg(o,"draggable",!1)),s.setValueChangeCallback(fg(r,"setValueCallback"),fg(r,"setValueCallbackScope")),s.setValue(fg(r,"value")),s.onClick(s.toggleListPanel,u(s)),s}return s(i,[{key:"destroy",value:function(t){this.scene&&!this.ignoreDestroy&&(this.listPanel&&(this.listPanel.destroy(t),this.listPanel=void 0),v(h(i.prototype),"destroy",this).call(this,t));}},{key:"setOptions",value:function(t){return void 0===t&&(t=[]),this.options=t,this}},{key:"setValueChangeCallback",value:function(t,e){return this.valueChangeCallback=t,this.valueChangeCallbackScope=e,this}},{key:"setValue",value:function(t){return this.value=t,this}},{key:"value",get:function(){return this._value},set:function(t){if(this._value!==t){var e=this._value;this._value=t;var i=this.valueChangeCallback,n=this.valueChangeCallbackScope;i&&(n?i.call(n,this,t,e):i(this,t,e)),this.emit("valuechange",this,t,e);}}},{key:"emitButtonClick",value:function(t){var e=this.options[t];return e?(this.emit("button.click",this,void 0,e,t),this):this}}]),i}(jo);Object.assign(vg.prototype,dg);var pg=function(t,e){e=function(t,e,i){void 0===i&&(i={});var n=(e=e?Io(e):{}).label||e.button,r=e.button||e.label;delete e.label,delete e.button;var s=i.label||i.button||i,o=i.button||i.label||i,a=Dc(t,n,s);return a.list=e.list||{},a.list.createButtonCallback=function(t,e){var i=pv(t,r,o).resetDisplayContent({text:e.text});return e.hasOwnProperty("value")&&(i.value=e.value),i},a.list.onButtonOver=function(t,e,i,n){t.setHoverState&&t.setHoverState(!0);},a.list.onButtonOut=function(t,e,i,n){t.setHoverState&&t.setHoverState(!1);},a}(t,e);var i=new vg(t,e);return t.add.existing(i),i},gg=function(t,e){for(var i=0,n=t.length;i>16&255},Xg=function(t){return t>>8&255},Yg=function(t){return 255&t},Gg=Phaser.Math.Linear,Vg={buildShapes:function(){this.addShape((new fd).setName("track")).addShape((new fd).setName("thumb"));},updateShapes:function(){var t=this.width,e=this.height,i=this.value?this.toggleAnimProgress:1-this.toggleAnimProgress,n=this.getShape("track");if(this.isSizeChanged){var r=t*this.trackWidth,s=e*this.trackHeight,o=(t-r)/2,a=(e-s)/2,h=e*this.trackRadius;n.setTopLeftPosition(o,a).setSize(r,s).setRadius(h);}var l,u,c,d=(l=this.falseValueTrackColor,u=this.trackFillColor,c=i,(255&Fg(Wg(l),Wg(u),c))<<16|(255&Fg(Xg(l),Xg(u),c))<<8|255&Fg(Yg(l),Yg(u),c)),f=Gg(this.falseValueTrackFillAlpha,this.trackFillAlpha,i);n.fillStyle(d,f);var v=this.getShape("thumb");if(this.isSizeChanged){var p=t*this.thumbWidth,g=e*this.thumbHeight,y=e*this.thumbRadius;v.setSize(p,g).setRadius(y);}var k=Gg(this.thumbLeftX,this.thumbRightX,i)*t;this.rtl&&(k=t-k);var m=e/2;v.setCenterPosition(k,m),v.fillStyle(this.thumbColor,this.thumbAlpha);}},Hg={setToggleAnimationDuration:function(t){return void 0===t&&(t=0),this.toggleAnimDuration=t,this},playToggleAnimation:function(){return void 0===this.toggleAnimProgressTask&&(this.toggleAnimProgressTask=new kn(this,{eventEmitter:null})),this.toggleAnimProgressTask.restart({key:"toggleAnimProgress",from:0,to:1,duration:this.toggleAnimDuration}),this},stopToggleAnimation:function(){return void 0===this.toggleAnimProgressTask||this.toggleAnimProgressTask.stop(),this}},Ng={};Object.assign(Ng,zg,jg,Ig,Vg,Hg);var Ug=Phaser.Utils.Objects.GetValue,Kg=Phaser.Utils.Objects.IsPlainObject,Jg=23730,qg=function(t){a(i,t);var e=d(i);function i(t,r,s,o,a,h,l){var u;n(this,i),Kg(r)?(r=Ug(l=r,"x",0),s=Ug(l,"y",0),o=Ug(l,"width",2),a=Ug(l,"height",2),h=Ug(l,"color",Jg)):Kg(h)&&(h=Ug(l=h,"color",Jg)),(u=e.call(this,t,r,s,o,a)).type="rexToggleSwitch",void 0===h&&(h=Jg),u.setTrackFillStyle(h,Ug(l,"trackFillAlpha",1)),u.setFalseValueTrackFillStyle(Ug(l,"falseValueTrackColor",function(t){var e=.3*Wg(t)+.59*Xg(t)+.11*Yg(t);return (255&e)<<16|(255&e)<<8|255&e}(h)),Ug(l,"falseValueTrackFillAlpha",1)),u.setThumbStyle(Ug(l,"thumbColor",16777215),Ug(l,"thumbAlpha",1)),u.setTrackSize(Ug(l,"trackWidth",.9),Ug(l,"trackHeight",.5)),u.setTrackRadius(Ug(l,"trackRadius",.5*u.trackHeight));var c=Ug(l,"thumbHeight",void 0),d=Ug(l,"thumbWidth",c);return void 0===d&&(d=.9*u.trackHeight),u.setThumbSize(d,c),u.setThumbRadius(Ug(l,"thumbRadius",.5*u.thumbHeight)),u.setThumbPosition(Ug(l,"thumbLeft",.3),Ug(l,"thumbRight",void 0)),u.setRTL(Ug(l,"rtl",!1)),u.setToggleAnimationDuration(Ug(l,"animationDuration",150)),u.buildShapes(),u.setValue(Ug(l,"value",!1),0),u}return s(i,[{key:"value",get:function(){return this._value},set:function(t){t=!!t,this._value!==t&&(this.dirty=!0,this._value=t,this.playToggleAnimation(),this.emit("valuechange",t));}},{key:"setValue",value:function(t,e){void 0===e&&(e=this.toggleAnimDuration);var i=this.toggleAnimDuration;return this.toggleAnimDuration=e,this.value=t,this.toggleAnimDuration=i,this}},{key:"toggleValue",value:function(t){return this.setValue(!this.value,t),this}},{key:"toggleAnimProgress",get:function(){return this._toggleAnimProgress},set:function(t){this._toggleAnimProgress!==t&&(this._toggleAnimProgress=t,this.dirty=!0);}}]),i}(Wc);Object.assign(qg.prototype,Ng);for(var Zg,$g=Phaser.Utils.Objects.GetValue,Qg=function(t){a(i,t);var e=d(i);function i(t,r,s,o,a,h,l){var c;return n(this,i),(c=e.call(this,t,r,s,o,a,h,l))._click=new wr(u(c),$g(l,"click")),c._click.on("click",(function(){this.toggleValue();}),u(c)),c.setReadOnly($g(l,"readOnly",!1)),c}return s(i,[{key:"readOnly",get:function(){return !this._click.enable},set:function(t){this._click.enable=!t;}},{key:"setReadOnly",value:function(t){return void 0===t&&(t=!0),this.readOnly=t,this}}]),i}(qg),ty=Phaser.Utils.Objects.GetValue,ey=function(t){a(i,t);var e=d(i);function i(t,r){var s;n(this,i),void 0===r&&(r={}),(s=e.call(this,t)).type="rexTweaker.ToggleSwitchInput";var o=r.toggleSwitch,a=function(t,e){var i=new Qg(t,e);return t.add.existing(i),i}(t,o),h=ty(o,"size");void 0!==h&&a.setSize(h,h);var l=void 0!==h?0:1;return s.addSpace().add(a,{proportion:0,expand:!1,fitRatio:l}),s.addChildrenMap("toggleSwitch",a),a.on("valuechange",(function(t){this.setValue(t);}),u(s)),s}return s(i,[{key:"value",get:function(){return this._value},set:function(t){this._value!==t&&(this.validate(t)||(t=this._value),this.childrenMap.toggleSwitch.setValue(t),g(h(i.prototype),"value",t,this,!0));}}]),i}(_v),iy=function(t,e,i){var n=new ey(t,i);return t.add.existing(n),n},ny=["AliceBlue","AntiqueWhite","Aqua","Aquamarine","Azure","Beige","Bisque","Black","BlanchedAlmond","Blue","BlueViolet","Brown","BurlyWood","CadetBlue","Chartreuse","Chocolate","Coral","CornflowerBlue","Cornsilk","Crimson","Cyan","DarkBlue","DarkCyan","DarkGoldenRod","DarkGray","DarkGrey","DarkGreen","DarkKhaki","DarkMagenta","DarkOliveGreen","DarkOrange","DarkOrchid","DarkRed","DarkSalmon","DarkSeaGreen","DarkSlateBlue","DarkSlateGray","DarkSlateGrey","DarkTurquoise","DarkViolet","DeepPink","DeepSkyBlue","DimGray","DimGrey","DodgerBlue","FireBrick","FloralWhite","ForestGreen","Fuchsia","Gainsboro","GhostWhite","Gold","GoldenRod","Gray","Grey","Green","GreenYellow","HoneyDew","HotPink","IndianRed","Indigo","Ivory","Khaki","Lavender","LavenderBlush","LawnGreen","LemonChiffon","LightBlue","LightCoral","LightCyan","LightGoldenRodYellow","LightGray","LightGrey","LightGreen","LightPink","LightSalmon","LightSeaGreen","LightSkyBlue","LightSlateGray","LightSlateGrey","LightSteelBlue","LightYellow","Lime","LimeGreen","Linen","Magenta","Maroon","MediumAquaMarine","MediumBlue","MediumOrchid","MediumPurple","MediumSeaGreen","MediumSlateBlue","MediumSpringGreen","MediumTurquoise","MediumVioletRed","MidnightBlue","MintCream","MistyRose","Moccasin","NavajoWhite","Navy","OldLace","Olive","OliveDrab","Orange","OrangeRed","Orchid","PaleGoldenRod","PaleGreen","PaleTurquoise","PaleVioletRed","PapayaWhip","PeachPuff","Peru","Pink","Plum","PowderBlue","Purple","RebeccaPurple","Red","RosyBrown","RoyalBlue","SaddleBrown","Salmon","SandyBrown","SeaGreen","SeaShell","Sienna","Silver","SkyBlue","SlateBlue","SlateGray","SlateGrey","Snow","SpringGreen","SteelBlue","Tan","Teal","Thistle","Tomato","Turquoise","Violet","Wheat","White","WhiteSmoke","Yellow","YellowGreen"],ry=[15792383,16444375,65535,8388564,15794175,16119260,16770244,0,16772045,255,9055202,10824234,14596231,6266528,8388352,13789470,16744272,6591981,16775388,14423100,65535,139,35723,12092939,11119017,11119017,25600,12433259,9109643,5597999,16747520,10040012,9109504,15308410,9419919,4734347,3100495,3100495,52945,9699539,16716947,49151,6908265,6908265,2003199,11674146,16775920,2263842,16711935,14474460,16316671,16766720,14329120,8421504,8421504,32768,11403055,15794160,16738740,13458524,4915330,16777200,15787660,15132410,16773365,8190976,16775885,11393254,15761536,14745599,16448210,13882323,13882323,9498256,16758465,16752762,2142890,8900346,7833753,7833753,11584734,16777184,65280,3329330,16445670,16711935,8388608,6737322,205,12211667,9662683,3978097,8087790,64154,4772300,13047173,1644912,16121850,16770273,16770229,16768685,128,16643558,8421376,7048739,16753920,16729344,14315734,15657130,10025880,11529966,14381203,16773077,16767673,13468991,16761035,14524637,11591910,8388736,6697881,16711680,12357519,4286945,9127187,16416882,16032864,3050327,16774638,10506797,12632256,8900331,6970061,7372944,7372944,16775930,65407,4620980,13808780,32896,14204888,16737095,4251856,15631086,16113331,16777215,16119285,16776960,10145074],sy={},oy=0,ay=ny.length;oy0&&{height:this.colorComponentsHeight,formatLabel:this.colorComponentsFormatLabelConfig,inputText:this.colorComponentsInputTextConfig,space:this.colorComponentsSpace};var o=new Ky(t,{width:n,height:s,background:e,space:this.colorPickerSpace,hPalette:{position:this.colorPickerHPalettePosition},colorComponents:r,value:this.value});return t.add.existing(o),o},qy={openColorPicker:function(){if(!this.colorPicker){var t=Jy.call(this).layout(),e=new cg(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(qy,py);var Zy=Phaser.Utils.Objects.GetValue,$y=function(t){a(i,t);var e=d(i);function i(t,r){var s;n(this,i),void 0===r&&(r={}),(s=e.call(this,t,r)).type="rexColorInput",r.hasOwnProperty("colorPicker")||(r.colorPicker={background:{color:0}});var o=r.colorPicker,a=!1!==o&&null!==o;if(a){var h;s.setColorPickerSize(Zy(o,"width",160),Zy(o,"height",170));var l=Zy(o,"background");h=l?function(t){return Ka(t,l)}:Zy(o,"createBackgroundCallback"),s.setCreateColorPickerBackgroundCallback(h),s.setColorPickerHPalettePosition(Zy(o,"hPalettePosition",0)),s.setColorPickerExpandDirection(Zy(o,"expandDirection")),s.setColorPickerEaseInDuration(Zy(o,"easeIn",200)),s.setColorPickerEaseOutDuration(Zy(o,"easeOut",200)),s.setColorPickerTransitInCallback(Zy(o,"transitIn")),s.setColorPickerTransitOutCallback(Zy(o,"transitOut")),s.setColorPickerBounds(Zy(o,"bounds"));var c=Zy(o,"space");void 0===c&&(c={left:10,right:10,top:10,bottom:10,item:8}),s.setColorPickerSpace(c);}var d=r.colorComponents;if(a&&(!1!==d&&null!==d)){s.setColorComponentsHeight(Zy(d,"height",30)),s.setColorComponentsFormatLabelConfig(Zy(d,"formatLabel"));var f=Zy(d,"inputText");f||(f=Zy(r,"inputText")),s.setColorComponentsInputTextConfig(f);var v=Zy(d,"space");void 0===v&&(v={item:8}),s.setColorComponentsSpace(v);}var p=s.childrenMap.swatch;return p&&a&&s.onClick(p,s.openColorPicker,u(s)),s}return s(i)}(vy);Object.assign($y.prototype,qy);var Qy=function(t){a(i,t);var e=d(i);function i(t,r){var s;n(this,i),void 0===r&&(r={}),(s=e.call(this,t)).type="rexTweaker.ColorInput";var o=function(t,e,i){void 0===i&&(i=!0),i?e=e?Io(e):{}:e||(e={});var n=new $y(t,e);return t.add.existing(n),n}(t,r.colorInput);return s.add(o,{proportion:1,expand:!0}),s.addChildrenMap("colorInput",o),o.on("valuechange",(function(t){this.setValue(t);}),u(s)),s}return s(i,[{key:"value",get:function(){return this._value},set:function(t){this._value!==t&&(this.validate(t)||(t=this._value),this.childrenMap.colorInput.setValue(t),g(h(i.prototype),"value",t,this,!0));}}]),i}(_v),tk=function(t,e,i){var n=new Qy(t,i);return t.add.existing(n),n},ek=Phaser.Utils.Objects.GetValue,ik=function(t,i,n){var r=ek(n,"title")||{},s=Ov(t,0,r),o=function(t,e,i){var n,r=e.view;switch(r){case kv:n=gp;break;case mv:n=kp;break;case bv:n=ng;break;case xv:n=kg;break;case"buttons":n=Cg;break;case Cv:n=Bg;break;case"toggleSwitch":n=iy;break;case"color":n=tk;break;default:n=ar(r)?r:gp;}var s=n(t,e,i,s);return s.setTextFormatCallback(e.format),s}(t,i,n),a=ek(n,"background")||{},h=Ka(t,a),l=new Tv(t,e(e(e({},i),n),{},{inputTitle:s,inputField:o,background:h}));return t.add.existing(l),l.setTitle(i),l};Phaser.Utils.Objects.GetValue;var nk=Phaser.Utils.Objects.GetValue,rk=function(t,i,n){for(var r=nk(n,"title")||{},s=Ov(t,0,r),o=i.buttons,a=nk(n,"button")||{},h=[],l=0,u=o.length;l0?0:1,o.setMinWidth(this.itemWidth)),this.add(o,{proportion:s,expand:!0}),n.onValueChange&&a.on("valuechange",n.onValueChange),n.onValidate&&a.setValidateCallback(n.onValidate),o.setAutoUpdateEnable(n.autoUpdate),o.setBindingTarget(t,e),n.monitor&&o.startMonitorTarget(),n.key&&this.root.addChildrenMap(n.key,o),this},addButton:ok,addButtons:ok,addSeparator:function(t){var e=this.scene,i=ak(this.styles,"separator"),n=Ed(e,0,i);return this.add(n,{expand:!0}),this},setBindingTarget:function(t){for(var e=this.sizerChildren,i=0,n=e.length;i * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */Object.assign(Cs.prototype,xs);var Ss=Phaser.Math.DegToRad,ws=Phaser.Math.RadToDeg,Os=Phaser.Utils.Objects.GetValue,Ts=function(t){r(o,t);var i=l(o);function o(){return e(this,o),i.apply(this,arguments)}return n(o,[{key:"visible",get:function(){return this._visible},set:function(t){this.setDisplayListDirty(this._visible!=t),this._visible=t;}},{key:"setVisible",value:function(t){return void 0===t&&(t=!0),this.visible=t,this}},{key:"alpha",get:function(){return this._alpha},set:function(t){this.setDisplayListDirty(!!this._alpha!=!!t),this._alpha=t;}},{key:"setAlpha",value:function(t){return this.alpha=t,this}},{key:"setX",value:function(t){return this.x=t,this}},{key:"setY",value:function(t){return this.y=t,this}},{key:"setPosition",value:function(t,e){return this.x=t,this.y=e,this}},{key:"setRotation",value:function(t){return this.rotation=t,this}},{key:"angle",get:function(){return ws(this.rotation)},set:function(t){this.rotation=Ss(t);}},{key:"setAngle",value:function(t){return this.angle=t,this}},{key:"setScaleX",value:function(t){return this.scaleX=t,this}},{key:"width",get:function(){return this._width},set:function(t){this._width=t;}},{key:"setWidth",value:function(t,e){return void 0===e&&(e=!1),this.width=t,e&&(this.scaleY=this.scaleX),this}},{key:"setScaleY",value:function(t){return this.scaleY=t,this}},{key:"setScale",value:function(t,e){return void 0===e&&(e=t),this.scaleX=t,this.scaleY=e,this}},{key:"height",get:function(){return this._height},set:function(t){this._height=t;}},{key:"setHeight",value:function(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}},{key:"displayWidth",get:function(){return this._width*this.scaleX},set:function(t){this.scaleX=t/this._width;}},{key:"setDisplayWidth",value:function(t,e){return void 0===e&&(e=!1),this.displayWidth=t,e&&(this.scaleY=this.scaleX),this}},{key:"displayHeight",get:function(){return this._height*this.scaleY},set:function(t){this.scaleY=t/this._height;}},{key:"setDisplayHeight",value:function(t,e){return void 0===e&&(e=!1),this.displayHeight=t,e&&(this.scaleX=this.scaleY),this}},{key:"setOriginX",value:function(t){return this.originX=t,this._displayOriginX=this.width*t,this}},{key:"setOriginY",value:function(t){return this.originY=t,this._displayOriginY=this.height*t,this}},{key:"setOrigin",value:function(t,e){return void 0===e&&(e=t),this.setOriginX(t).setOriginY(e),this}},{key:"depth",get:function(){return this._depth},set:function(t){this.setDisplayListDirty(this._depth!=t),this._depth=t;}},{key:"setDepth",value:function(t){return void 0===t&&(t=0),this.depth=t,this}},{key:"modifyPorperties",value:function(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=Os(t,"width",void 0),i=Os(t,"height",void 0),n=Os(t,"scale",void 0),r=Os(t,"scaleX",n),s=Os(t,"scaleY",n);void 0!==e?void 0===i&&void 0===s?this.setWidth(e,!0):this.setWidth(e):void 0!==r?this.setScaleX(r):t.hasOwnProperty("displayWidth")&&this.setDisplayWidth(t.displayWidth),void 0!==i?void 0===e&&void 0===r?this.setHeight(i,!0):this.setHeight(i):void 0!==s?this.setScaleY(s):t.hasOwnProperty("displayHeight")&&this.setDisplayHeight(t.displayHeight);var o=Os(t,"origin",void 0);return void 0!==o?this.setOrigin(o):(t.hasOwnProperty("originX")&&this.setOriginX(t.originX),t.hasOwnProperty("originY")&&this.setOriginY(t.originY)),t.hasOwnProperty("depth")&&this.setDepth(t.depth),this}},{key:"reset",value:function(){return c(s(o.prototype),"reset",this).call(this),this.setVisible().setAlpha(1).setPosition(0,0).setRotation(0).setScale(1,1).setOrigin(0).setDepth(0),this}},{key:"webglRender",value:function(t,e,i,n,r,s,o,a){}},{key:"canvasRender",value:function(t,e,i,n){}}]),o}(Cs),Ps=Phaser.GameObjects.Components.TransformMatrix,_s=Phaser.Renderer.WebGL.Utils.getTintAppendFloatAlpha,Es=new Ps,Ms=Phaser.Utils.Objects.IsPlainObject,Rs=function(t){r(o,t);var i=l(o);function o(t,n){var r;return e(this,o),(r=i.call(this,t,ks)).setFrame(n),r}return n(o,[{key:"width",get:function(){return this._width},set:function(t){}},{key:"height",get:function(){return this._height},set:function(t){}},{key:"setFrame",value:function(t){return arguments.length>0&&!Ms(t)&&(t=this.parent.texture.get(t)),this.frame=t,this._width=t?t.width:0,this._height=t?t.height:0,this}},{key:"setFlipX",value:function(t){return void 0===t&&(t=!0),this.flipX=t,this}},{key:"setFlipY",value:function(t){return void 0===t&&(t=!0),this.flipY=t,this}},{key:"resetFlip",value:function(){return this.flipX=!1,this.flipY=!1,this}},{key:"tint",get:function(){return void 0===this._tint?this.parent.tint:this._tint},set:function(t){this._tint=t;}},{key:"setTint",value:function(t){return this.tint=t,this.tintFill=!1,this}},{key:"setTintFill",value:function(t){return this.tint=t,this.tintFill=!0,this}},{key:"clearTint",value:function(){return this.setTint(16777215),this}},{key:"resetTint",value:function(){return this.tint=void 0,this.tintFill=void 0,this}},{key:"tintFill",get:function(){return void 0===this._tintFill?this.parent.tintFill:this._tintFill},set:function(t){this._tintFill=t;}},{key:"reset",value:function(){return c(s(o.prototype),"reset",this).call(this),this.resetFlip().resetTint().setFrame(),this}},{key:"modifyPorperties",value:function(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),c(s(o.prototype),"modifyPorperties",this).call(this,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}}]),o}(Ts),Ls={webglRender:function(t,e,i,n,r,s,o,a){var h=this._width,l=this._height,u=h*this.originX,c=l*this.originY,d=this.x-n,p=this.y-r,f=1,v=1;this.flipX&&(d+=h-2*u,f=-1),this.flipY&&(p+=l-2*c,v=-1),Es.applyITRS(d,p,this.rotation,this.scaleX*f,this.scaleY*v),e.multiply(Es,Es);var g=-u,y=-c,m=g+h,k=y+l,b=Es.setQuad(g,y,m,k,a),x=this.frame.u0,C=this.frame.v0,S=this.frame.u1,w=this.frame.v1,O=_s(this.tint,this.alpha*i);t.batchQuad(this.parent,b[0],b[1],b[2],b[3],b[4],b[5],b[6],b[7],x,C,S,w,O,O,O,O,this.tintFill,s,o);},canvasRender:function(t,e,i,n){t.save();var r=this._width,s=this._height,o=r*this.originX,a=s*this.originY,h=this.x-o,l=this.y-a,u=1,c=1;this.flipX&&(h+=r,u=-1),this.flipY&&(l+=s,c=-1),n&&(h=Math.round(h),l=Math.round(l)),t.translate(h,l),t.rotate(this.rotation),t.scale(this.scaleX*u,this.scaleY*c);var d=this.frame;t.drawImage(d.source.image,d.cutX,d.cutY,r,s,0,0,r,s),t.restore();}};Object.assign(Rs.prototype,Ls);var As=function(t,e){"string"==typeof e&&(e={frame:e});var i=t.poolManager?t.poolManager.allocate(ks):null;return null===i?i=new Rs(t):i.setParent(t).setActive(),i.modifyPorperties(e),t.addChild(i),i},Ds={_drawImage:function(t,e,i,n,r,s){As(this,{frame:e,x:i,y:n,width:r,height:s});},_drawTileSprite:function(t,e,i,n,r,s){var o=this.texture.get(e),a=o.width,h=o.height,l=Math.floor(r/a),u=Math.floor(s/h);i+=(r-l*a)/2,n+=(s-u*h)/2;for(var c=0;c=0;i--)(e=this.children[i]).parentContainer||e.displayList||e.destroy(t);this.clear(!t),c(s(o.prototype),"destroy",this).call(this,t);}}},{key:"contains",value:function(t){return -1!==this.children.indexOf(t)}},{key:"add",value:function(t){var e=this;return to(this.children,t,0,(function(t){t.once("destroy",e.onChildDestroy,e);}),this),this}},{key:"remove",value:function(t,e){var i=this;return eo(this.children,t,(function(t){t.off("destroy",i.onChildDestroy,i),e&&t.destroy();})),this}},{key:"onChildDestroy",value:function(t,e){this.remove(t,!1);}},{key:"clear",value:function(t){for(var e,i=0,n=this.children.length;i0;){var n=i.shift();!e(n)&&n.isRexContainerLite&&i.push.apply(i,f(n.children));}},jo=Phaser.Utils.Array,Bo={getChildren:function(t){if(t)for(var e=0,i=this.children.length;e=0;e--)this.remove(this.backgroundChildren[e],t);return this}},mh=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},kh=/(\S+)\[(\d+)\]/i,bh=Phaser.Utils.Objects.GetValue,xh=function(t,e){return void 0===e?t:t[e]},Ch=function(e,i,n){void 0===e&&(e={}),void 0===i&&(i=0);var r=t(i);return "string"===r?e[i]=n:"number"===r?(e.left=i,e.right=i,e.top=i,e.bottom=i):(e.left=bh(i,"left",0),e.right=bh(i,"right",0),e.top=bh(i,"top",0),e.bottom=bh(i,"bottom",0)),e},Sh={getInnerPadding:function(t){return xh(this.space,t)},setInnerPadding:function(t,e){return Ch(this.space,t,e),this},getOuterPadding:function(t){return xh(this.getSizerConfig(this).padding,t)},setOuterPadding:function(t,e){return Ch(this.getSizerConfig(this).padding,t,e),this},getChildOuterPadding:function(t,e){return "string"==typeof t&&(t=this.getElement(t)),xh(this.getSizerConfig(t).padding,e)},setChildOuterPadding:function(t,e,i){return "string"==typeof t&&(t=this.getElement(t)),Ch(this.getSizerConfig(t).padding,e,i),this}},wh=function(t){var e=this.childrenWidth,i=void 0!==this.minWidth?this.minWidth:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn("Layout width warn: ".concat(this.constructor.name,"'s minWidth (").concat(i,") < childrenWidth (").concat(e,")"))):this.layoutWarnEnable&&(i>t||e>t)&&console.warn("Layout width warn: ".concat(this.constructor.name,"'s minWidth (").concat(i,") or childrenWidth (").concat(e," > targetWidth ").concat(t,")")),t},Oh=function(t){var e=this.childrenHeight,i=void 0!==this.minHeight?this.minHeight:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn("Layout height warn: ".concat(this.constructor.name,"'s minHeight (").concat(i,") < childrenHeight (").concat(e,")"))):this.layoutWarnEnable&&(i>t||e>t)&&console.warn("Layout height warn: ".concat(this.constructor.name,"'s minHeight (").concat(i,") or childrenHeight (").concat(e,") > targetHeight (").concat(t,")")),t},Th={getShownChildren:function(t){void 0===t&&(t=[]);for(var e,i=this.children,n=0,r=i.length;n0;){var i=e.shift();i.rexSizer&&i.rexSizer.hidden||(i!==this&&t.push(i),i.isRexContainerLite&&e.push.apply(e,f(i.children)));}return t}},Ph=function(){this._childrenWidth=void 0,this._childrenHeight=void 0;for(var t,e=this.getChildrenSizers(),i=0,n=e.length;i0?-this.delay:0,this.state=this.nowTime>=0?Hh:Gh,this.repeatCounter=0,this}},{key:"stop",value:function(){return this.state=Xh,this}},{key:"update",value:function(t,e){this.state!==Xh&&this.state!==Uh&&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=Vh)):(this.nowTime=this.duration,this.state=Uh):this.nowTime>=0&&(this.state=Hh));}},{key:"t",get:function(){var t;switch(this.state){case Xh:case Gh:case Vh:t=0;break;case Hh:t=this.nowTime/this.duration;break;case Uh:t=1;}return Yh(t,0,1)},set:function(t){(t=Yh(t,-1,1))<0?(this.state=Gh,this.nowTime=-this.delay*t):(this.state=Hh,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++);}},{key:"setT",value:function(t){return this.t=t,this}},{key:"isIdle",get:function(){return this.state===Xh}},{key:"isDelay",get:function(){return this.state===Gh}},{key:"isCountDown",get:function(){return this.state===Hh}},{key:"isRunning",get:function(){return this.state===Gh||this.state===Hh}},{key:"isDone",get:function(){return this.state===Uh}},{key:"isOddIteration",get:function(){return 1==(1&this.repeatCounter)}},{key:"isEvenIteration",get:function(){return 0==(1&this.repeatCounter)}}]),t}(),Xh=0,Gh=1,Hh=2,Vh=3,Uh=-1,Jh=function(t){r(o,t);var i=l(o);function o(t,n){var r;return e(this,o),(r=i.call(this,t,n)).timer=new Nh,r}return n(o,[{key:"shutdown",value:function(t){this.isShutdown||(c(s(o.prototype),"shutdown",this).call(this,t),this.timer.destroy(),this.timer=void 0);}},{key:"start",value:function(){return this.timer.start(),c(s(o.prototype),"start",this).call(this),this}},{key:"stop",value:function(){return this.timer.stop(),c(s(o.prototype),"stop",this).call(this),this}},{key:"complete",value:function(){return this.timer.stop(),c(s(o.prototype),"complete",this).call(this),this}}]),o}(Bh),Kh=Phaser.Utils.Objects.GetValue,qh=Phaser.Utils.Objects.GetAdvancedValue,$h=Phaser.Tweens.Builders.GetEaseFunction,Zh=function(t){r(o,t);var i=l(o);function o(){return e(this,o),i.apply(this,arguments)}return n(o,[{key:"resetFromJSON",value:function(t){return this.timer.resetFromJSON(Kh(t,"timer")),this.setEnable(Kh(t,"enable",!0)),this.setTarget(Kh(t,"target",this.parent)),this.setDelay(qh(t,"delay",0)),this.setDuration(qh(t,"duration",1e3)),this.setEase(Kh(t,"ease","Linear")),this.setRepeat(Kh(t,"repeat",0)),this}},{key:"setEnable",value:function(t){return null==t&&(t=!0),this.enable=t,this}},{key:"setTarget",value:function(t){return void 0===t&&(t=this.parent),this.target=t,this}},{key:"setDelay",value:function(t){return this.delay=t,this}},{key:"setDuration",value:function(t){return this.duration=t,this}},{key:"setRepeat",value:function(t){return this.repeat=t,this}},{key:"setRepeatDelay",value:function(t){return this.repeatDelay=t,this}},{key:"setEase",value:function(t){return void 0===t&&(t="Linear"),this.ease=t,this.easeFn=$h(t),this}},{key:"start",value:function(){return this.timer.isRunning||c(s(o.prototype),"start",this).call(this),this}},{key:"restart",value:function(){return this.timer.stop(),this.start.apply(this,arguments),this}},{key:"stop",value:function(t){return void 0===t&&(t=!1),c(s(o.prototype),"stop",this).call(this),t&&(this.timer.setT(1),this.updateGameObject(this.target,this.timer),this.complete()),this}},{key:"update",value:function(t,e){if(!this.isRunning||!this.enable||!this.parent.active)return this;var i=this.target,n=this.timer;return n.update(t,e),n.isDelay||this.updateGameObject(i,n),this.emit("update",i,this),n.isDone&&this.complete(),this}},{key:"updateGameObject",value:function(t,e){}}]),o}(Jh),Qh=Phaser.Utils.Objects.GetValue,tl=Phaser.Utils.Objects.GetAdvancedValue,el=Phaser.Math.Linear,il=function(t){r(o,t);var i=l(o);function o(t,n){var r;return e(this,o),(r=i.call(this,t,n)).scaleStart={},r.scaleEnd={},r.resetFromJSON(n),r.boot(),r}return n(o,[{key:"resetFromJSON",value:function(t){return c(s(o.prototype),"resetFromJSON",this).call(this,t),this.setMode(Qh(t,"mode",0)),this.setScaleRange(tl(t,"start",void 0),tl(t,"end",0)),this}},{key:"setMode",value:function(t){return "string"==typeof t&&(t=nl[t]),this.mode=t,this}},{key:"setScaleRange",value:function(t,e){return "number"==typeof t?(this.startX=t,this.startY=t):(this.startX=tl(t,"x",this.parent.scaleX),this.startY=tl(t,"y",this.parent.scaleY)),"number"==typeof e?(this.endX=e,this.endY=e):(this.endX=tl(e,"x",void 0),this.endY=tl(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}},{key:"start",value:function(){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),c(s(o.prototype),"start",this).call(this),this}},{key:"updateGameObject",value:function(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasScaleX&&(t.scaleX=el(this.startX,this.endX,i)),this.hasScaleY&&(t.scaleY=el(this.startY,this.endY,i));}},{key:"complete",value:function(){return c(s(o.prototype),"complete",this).call(this),1===this.mode&&this.parent.destroy(),this}}]),o}(Zh),nl={stop:0,destroy:1,yoyo:2},rl=function(t,e,i,n,r){var s,o;switch(void 0===n&&(n="Cubic"),i){case 0:case"x":s={x:0},o={x:t.scaleX};break;case 1:case"y":s={y:0},o={y:t.scaleY};break;default:s=0,o=t.scale;}var a={mode:0,start:s,end:o,duration:e,ease:n};return void 0===r?r=new il(t,a):r.resetFromJSON(a),r.restart(),r},sl=function(t,e,i,n,r,s){void 0===n&&(n="Linear"),r instanceof il&&(s=r,r=void 0),void 0===r&&(r=!0);var o={};switch(o.mode=r?1:0,i){case 0:case"x":o.end={x:0};break;case 1:case"y":o.end={y:0};break;default:o.end=0;}return o.duration=e,o.ease=n,void 0===s?s=new il(t,o):s.resetFromJSON(o),s.restart(),s},ol=function(t,e){return new Promise((function(i,n){t.once(e,(function(){i();}));}))},al=function(t){return ol(t,"complete")},hl=Phaser.Utils.Objects.IsPlainObject,ll=function(t,e){e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0);})),e.on("update",(function(){var e=vh.getParentSizer(t);e&&e.resetChildPositionState(t);}));},ul={popUp:function(t,e,i){if(hl(t)){var n=t;t=n.duration,e=n.orientation,i=n.ease;}var r=void 0===this._scaleBehavior;return this._scaleBehavior=rl(this,t,e,i,this._scaleBehavior),r&&ll(this,this._scaleBehavior),this._scaleBehavior.completeEventName="popup.complete",this},popUpPromise:function(t,e,i){return this.popUp(t,e,i),al(this._scaleBehavior)},scaleDownDestroy:function(t,e,i,n){if(hl(t)){var r=t;t=r.duration,e=r.orientation,i=r.ease,n=r.destroy;}var s=void 0===this._scaleBehavior;return this._scaleBehavior=sl(this,t,e,i,n,this._scaleBehavior),s&&ll(this,this._scaleBehavior),this._scaleBehavior.completeEventName="scaledown.complete",this},scaleDownDestroyPromise:function(t,e,i,n){return this.scaleDownDestroy(t,e,i,n),al(this._scaleBehavior)},scaleDown:function(t,e,i){return this.scaleDownDestroy(t,e,i,!1),this},scaleDownPromise:function(t,e,i){return this.scaleDown(t,e,i),al(this._scaleBehavior)},scaleYoyo:function(t,e,i,n,r){if(hl(t)){var s=t;t=s.duration,e=s.peakValue,i=s.repeat,n=s.orientation,r=s.ease;}var o=void 0===this._scaleBehavior;return this._scaleBehavior=function(t,e,i,n,r,s,o){var a,h;switch(void 0===i&&(i=1.2),void 0===n&&(n=0),void 0===s&&(s="Cubic"),r){case 0:case"x":a={x:t.scaleX},h={x:i};break;case 1:case"y":a={y:t.scaleX},h={y:i};break;default:a=t.scaleX,h=i;}var l={mode:2,start:a,end:h,duration:e/2,ease:s,repeat:n};return void 0===o?o=new il(t,l):o.resetFromJSON(l),o.restart(),o}(this,t,e,i,n,r,this._scaleBehavior),o&&ll(this,this._scaleBehavior),this._scaleBehavior.completeEventName="scaleyoyo.complete",this},scaleYoyoPromise:function(t,e,i,n,r){return this.scaleYoyo(t,e,i,n,r),al(this._scaleBehavior)}},cl=Phaser.Utils.Objects.GetValue,dl=Phaser.Utils.Objects.GetAdvancedValue,pl=Phaser.Math.Linear,fl=function(t){r(o,t);var i=l(o);function o(t,n){var r;return e(this,o),(r=i.call(this,t,n)).resetFromJSON(n),r.boot(),r}return n(o,[{key:"resetFromJSON",value:function(t){return c(s(o.prototype),"resetFromJSON",this).call(this,t),this.setMode(cl(t,"mode",0)),this.setAlphaRange(dl(t,"start",this.parent.alpha),dl(t,"end",0)),this}},{key:"setMode",value:function(t){return "string"==typeof t&&(t=vl[t]),this.mode=t,this}},{key:"setAlphaRange",value:function(t,e){return this.alphaStart=t,this.alphaEnd=e,this}},{key:"start",value:function(){return this.timer.isRunning||(this.parent.setAlpha(this.alphaStart),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),c(s(o.prototype),"start",this).call(this)),this}},{key:"updateGameObject",value:function(t,e){var i=e.t;e.isOddIteration&&(i=1-i),t.alpha=pl(this.alphaStart,this.alphaEnd,i);}},{key:"complete",value:function(){return c(s(o.prototype),"complete",this).call(this),1===this.mode&&this.parent.destroy(),this}}]),o}(Zh),vl={stop:0,destroy:1,yoyo:2},gl=Phaser.Utils.Objects.IsPlainObject,yl=function(t,e,i,n){var r,s;gl(i)?(r=i.start,s=i.end):s=i,void 0===r&&(r=0),void 0===s&&(s=1);var o={mode:0,start:r,end:s,duration:e};return void 0===n?n=new fl(t,o):n.resetFromJSON(o),n.restart(),n},ml=function(t,e,i,n){i instanceof fl&&(n=i,i=void 0),void 0===i&&(i=!0);var r={mode:i?1:0,end:0,duration:e};return void 0===n?n=new fl(t,r):n.resetFromJSON(r),n.restart(),n},kl=Phaser.Utils.Objects.IsPlainObject,bl=function(t,e){e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0);})),e.on("update",(function(){var e=vh.getParentSizer(t);e&&e.resetChildAlphaState(t);}));},xl={fadeIn:function(t,e){if(kl(t)){var i=t;t=i.duration,e=i.alpha;}var n=void 0===this._fade;return this._fade=yl(this,t,e,this._fade),n&&bl(this,this._fade),this._fade.completeEventName="fadein.complete",this},fadeInPromise:function(t,e){return this.fadeIn(t,e),al(this._fade)},fadeOutDestroy:function(t,e){if(kl(t)){var i=t;t=i.duration,e=i.destroy;}var n=void 0===this._fade;return this._fade=ml(this,t,e,this._fade),n&&bl(this,this._fade),this._fade.completeEventName="fadeout.complete",this},fadeOutDestroyPromise:function(t,e){return this.fadeOutDestroy(t,e),al(this._fade)},fadeOut:function(t){return this.fadeOutDestroy(t,!1),this},fadeOutPromise:function(t){return this.fadeOut(t),al(this._fade)}},Cl=Phaser.Utils.Objects.GetValue,Sl=Phaser.Utils.Objects.GetAdvancedValue,wl=Phaser.Math.Linear,Ol=function(t){r(o,t);var i=l(o);function o(t,n){var r;return e(this,o),(r=i.call(this,t,n)).resetFromJSON(n),r.boot(),r}return n(o,[{key:"resetFromJSON",value:function(t){if(c(s(o.prototype),"resetFromJSON",this).call(this,t),this.setMode(Cl(t,"mode",0)),t&&(t.hasOwnProperty("x")||t.hasOwnProperty("y"))){var e=Sl(t,"x",void 0),i=Sl(t,"y",void 0);this.setTargetPosition(e,i);}else this.setTargetPosition(t);return this}},{key:"setMode",value:function(t){return "string"==typeof t&&(t=Tl[t]),this.mode=t,this}},{key:"setTargetPosition",value:function(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=Sl(i,"startX",void 0),this.startY=Sl(i,"startY",void 0),this.endX=Sl(i,"endX",void 0),this.endY=Sl(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}},{key:"start",value:function(){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),c(s(o.prototype),"start",this).call(this),this}},{key:"updateGameObject",value:function(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasMoveX&&(t.x=wl(this.startX,this.endX,i)),this.hasMoveY&&(t.y=wl(this.startY,this.endY,i));}},{key:"complete",value:function(){return c(s(o.prototype),"complete",this).call(this),1===this.mode&&this.parent.destroy(),this}}]),o}(Zh),Tl={stop:0,destroy:1,yoyo:2},Pl=function(t,e){if("number"==typeof t)return t;var i=t[0],n=parseFloat(t.substr(2));switch(i){case"+":return e+n;case"-":return e-n;case"*":return e*n;case"/":return e/n}},_l=Phaser.Utils.Objects.IsPlainObject,El=Phaser.Math.Distance.Between,Ml=function(t,e){e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0);})),e.on("update",(function(){var e=vh.getParentSizer(t);e&&e.resetChildPositionState(t);}));},Rl={moveFrom:function(t,e,i,n,r){if(_l(t)){var s=t;e=s.x,i=s.y,t=s.hasOwnProperty("speed")?1e3*El(e,i,this.x,this.y)/s.speed:s.duration,n=s.ease;}var o=void 0===this._easeMove;return this._easeMove=function(t,e,i,n,r,s,o){s instanceof Ol&&(o=s,s=void 0),void 0===s&&(s=!1);var a={};return a.mode=s?1:0,void 0!==i&&(a.startX=Pl(i,t.x),a.endX=t.x),void 0!==n&&(a.startY=Pl(n,t.y),a.endY=t.y),a.duration=e,a.ease=void 0===r?"Linear":r,void 0===o?o=new Ol(t,a):o.resetFromJSON(a),o.restart(),o}(this,t,e,i,n,r,this._easeMove),o&&Ml(this,this._easeMove),this._easeMove.completeEventName="movefrom.complete",this},moveFromPromise:function(t,e,i,n,r){return this.moveFrom(t,e,i,n,r),al(this._easeMove)},moveFromDestroy:function(t,e,i,n){return this.moveFrom(t,e,i,n,!0),this},moveFromDestroyPromise:function(t,e,i,n){return this.moveFromDestroy(t,e,i,n),al(this._easeMove)},moveTo:function(t,e,i,n,r){if(_l(t)){var s=t;e=s.x,i=s.y,t=s.hasOwnProperty("speed")?1e3*El(e,i,this.x,this.y)/s.speed:s.duration,n=s.ease;}var o=void 0===this._easeMove;return this._easeMove=function(t,e,i,n,r,s,o){s instanceof Ol&&(o=s,s=void 0),void 0===s&&(s=!1);var a={};return a.mode=s?1:0,void 0!==i&&(a.startX=t.x,a.endX=Pl(i,t.x)),void 0!==n&&(a.startY=t.y,a.endY=Pl(n,t.y)),a.duration=e,a.ease=void 0===r?"Linear":r,void 0===o?o=new Ol(t,a):o.resetFromJSON(a),o.restart(),o}(this,t,e,i,n,r,this._easeMove),o&&Ml(this,this._easeMove),this._easeMove.completeEventName="moveto.complete",this},moveToPromise:function(t,e,i,n,r){return this.moveTo(t,e,i,n,r),al(this._easeMove)},moveToDestroy:function(t,e,i,n){return this.moveTo(t,e,i,n,!0),this},moveToDestroyPromise:function(t,e,i,n){return this.moveToDestroy(t,e,i,n,!0),al(this._easeMove)},moveStop:function(t){return this._easeMove?(this._easeMove.stop(t),this):this}},Ll=Phaser.Utils.Objects.GetValue,Al=function(t){r(o,t);var i=l(o);function o(t,n){var r;return e(this,o),(r=i.call(this,t,n)).timer=new Nh,r.resetFromJSON(n),r.boot(),r}return n(o,[{key:"resetFromJSON",value:function(t){return this.timer.resetFromJSON(Ll(t,"timer")),this.setEnable(Ll(t,"enable",!0)),this.setMode(Ll(t,"mode",1)),this.isRunning=Ll(t,"isRunning",!1),this.setMagnitudeMode(Ll(t,"magnitudeMode",1)),this.setAxisMode(Ll(t,"axis",0)),this.setDuration(Ll(t,"duration",500)),this.setMagnitude(Ll(t,"magnitude",10)),this.ox=Ll(t,"ox",void 0),this.oy=Ll(t,"oy",void 0),this}},{key:"toJSON",value:function(){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}}},{key:"shutdown",value:function(t){this.isShutdown||(c(s(o.prototype),"shutdown",this).call(this,t),this.timer.destroy(),this.timer=void 0);}},{key:"startTicking",value:function(){c(s(o.prototype),"startTicking",this).call(this),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);}},{key:"stopTicking",value:function(){c(s(o.prototype),"stopTicking",this).call(this),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));}},{key:"setEnable",value:function(t){return null==t&&(t=!0),this.enable=t,this}},{key:"setMode",value:function(t){return "string"==typeof t&&(t=Dl[t]),this.mode=t,this}},{key:"setMagnitudeMode",value:function(t){return "string"==typeof t&&(t=Il[t]),this.magnitudeMode=t,this}},{key:"setAxisMode",value:function(t){return "string"==typeof t&&(t=zl[t]),this.axisMode=t,this}},{key:"setDuration",value:function(t){return this.duration=t,this}},{key:"setMagnitude",value:function(t){return this.magnitude=t,this}},{key:"start",value:function(t,e){if("number"!=typeof t){var i=t;e=Ll(i,"magnitude",void 0),t=Ll(i,"duration",void 0);}return void 0!==e&&this.setMagnitude(e),void 0!==t&&this.setDuration(t),this.timer.setDuration(this.duration).start(),c(s(o.prototype),"start",this).call(this),this}},{key:"shake",value:function(t,e){return this.start(t,e),this}},{key:"update",value:function(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 n=this.magnitude;1===this.magnitudeMode&&(n*=1-this.timer.t);var r=Math.random()*Math.PI*2,s=this.ox+Math.cos(r)*n,o=this.oy+Math.sin(r)*n;switch(this.axisMode){case 1:i.x=s;break;case 2:i.y=o;break;default:i.x=s,i.y=o;}}return this}},{key:"backToOrigin",value:function(){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}}]),o}(zh),Dl={effect:0,behavior:1},zl={both:0,"h&v":0,"x&y":0,horizontal:1,h:1,x:1,vertical:2,v:2,y:2},Il={constant:0,decay:1},jl=Phaser.Utils.Objects.IsPlainObject,Bl={shake:function(t,e,i){if(jl(t)){var n=t;t=n.duration,e=n.magnitude,i=n.magnitudeMode;}return void 0===this._shake&&(this._shake=new Al(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:function(t,e){return this.shake(t,e),al(this._shake)}},Fl=Phaser.Utils.Objects.GetValue,Wl=Phaser.Math.Linear,Yl=function(t){r(o,t);var i=l(o);function o(t,n){var r;return e(this,o),(r=i.call(this,t,n)).resetFromJSON(),r.boot(),r}return n(o,[{key:"start",value:function(t){if(this.timer.isRunning)return this;var e=this.target;this.propertyKey=Fl(t,"key","value");var i=e[this.propertyKey];return this.fromValue=Fl(t,"from",i),this.toValue=Fl(t,"to",i),this.setEase(Fl(t,"ease",this.ease)),this.setDuration(Fl(t,"duration",this.duration)),this.setRepeat(Fl(t,"repeat",0)),this.setDelay(Fl(t,"delay",0)),this.setRepeatDelay(Fl(t,"repeatDelay",0)),this.timer.setDuration(this.duration).setRepeat(this.repeat).setDelay(this.delay).setRepeatDelay(this.repeatDelay),e[this.propertyKey]=this.fromValue,c(s(o.prototype),"start",this).call(this),this}},{key:"updateGameObject",value:function(t,e){var i=e.t;i=this.easeFn(i),t[this.propertyKey]=Wl(this.fromValue,this.toValue,i);}}]),o}(Zh),Nl=Phaser.Utils.Objects.IsPlainObject,Xl=function(t){r(s,t);var i=l(s);function s(t,n){var r;return e(this,s),(r=i.call(this,t,n)).parent.setDataEnabled(),r.easeTasks={},r}return n(s,[{key:"complete",value:function(t){this.emit("complete-".concat(t),this.parent,this),this.emit("complete",t,this.parent,this);}},{key:"getEaseTask",value:function(t){var e=this.easeTasks[t];return void 0===e&&(e=new Yl(this.parent),this.easeTasks[t]=e,e.setTarget(this.parent.data.values).on("complete",(function(){this.complete(t);}),this)),e}},{key:"easeTo",value:function(t,e,i,n){if(Nl(t)){var r=t;t=r.key,e=r.value,i=r.duration,n=r.ease;var s=r.speed;void 0===i&&void 0!==s&&(i=Math.abs(e-this.parent.data.values[t])/s*1e3);}return void 0===i&&(i=1e3),void 0===n&&(n="Linear"),this.getEaseTask(t).restart({key:t,to:e,duration:i,ease:n}),this}},{key:"easeFrom",value:function(t,e,i,n){if(Nl(t)){var r=t;t=r.key,e=r.value,i=r.duration,n=r.ease;var s=r.speed;void 0===i&&void 0!==s&&(i=Math.abs(e-this.parent.data.values[t])/s*1e3);}return void 0===i&&(i=1e3),void 0===n&&(n="Linear"),this.getEaseTask(t).restart({key:t,from:e,duration:i,ease:n}),this}},{key:"stopEase",value:function(t,e){void 0===e&&(e=!0);var i=this.easeTasks[t];return i&&i.stop(e),this}},{key:"stopAll",value:function(t){for(var e in void 0===t&&(t=!0),this.easeTasks)this.stopEase(e,t);return this}}]),s}(Lh),Gl={easeDataTo:function(t,e,i,n){return this._easeData||(this._easeData=new Xl(this),function(t,e){e.on("complete",(function(e){t.emit("easedata.".concat(e,".complete"),t),t.emit("easedata.complete",e,t);}));}(this,this._easeData)),this._easeData.easeTo(t,e,i,n),this},easeDataToPromise:function(t,e,i,n){return this.easeDataTo(t,e,i,n),ol(this._easeData,"complete-".concat(t))},stopEaseData:function(t,e){return this._easeData?(this._easeData.stopEase(t,e),this):this},stopAllEaseData:function(t){return this._easeData?(this._easeData.stopAll(t),this):this}},Hl=function(t){Jl(t,!1);},Vl=function(t){Jl(t,!0);},Ul=function(t){return !!t&&!Oa(t).hidden},Jl=function(t,e){if(t){Oa(t).hidden=e;var i=so(t);i?i.setChildVisible(t,!e):t.setVisible(!e);}},Kl={show:function(t){return void 0===t&&(t=this),Hl(t),this},hide:function(t){return void 0===t&&(t=this),Vl(t),this},isShow:function(t){return void 0===t&&(t=this),Ul(t)}};function ql(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var $l={exports:{}};!function(t){var e=Object.prototype.hasOwnProperty,i="~";function n(){}function r(t,e,i){this.fn=t,this.context=e,this.once=i||!1;}function s(t,e,n,s,o){if("function"!=typeof n)throw new TypeError("The listener must be a function");var a=new r(n,s||t,o),h=i?i+e:e;return t._events[h]?t._events[h].fn?t._events[h]=[t._events[h],a]:t._events[h].push(a):(t._events[h]=a,t._eventsCount++),t}function o(t,e){0==--t._eventsCount?t._events=new n:delete t._events[e];}function a(){this._events=new n,this._eventsCount=0;}Object.create&&(n.prototype=Object.create(null),(new n).__proto__||(i=!1)),a.prototype.eventNames=function(){var t,n,r=[];if(0===this._eventsCount)return r;for(n in t=this._events)e.call(t,n)&&r.push(i?n.slice(1):n);return Object.getOwnPropertySymbols?r.concat(Object.getOwnPropertySymbols(t)):r},a.prototype.listeners=function(t){var e=i?i+t:t,n=this._events[e];if(!n)return [];if(n.fn)return [n.fn];for(var r=0,s=n.length,o=new Array(s);r0){var e=t.runTransitionInCallback();t.delayCall(e,this.next,this);}else this.next();}},{key:"exit_TRANS_OPNE",value:function(){this.parent.removeDelayCall();}},{key:"next_OPEN",value:function(){return "TRANS_CLOSE"}},{key:"enter_OPEN",value:function(){this.parent.onOpen();}},{key:"exit_OPEN",value:function(){this.parent.removeDelayCall();}},{key:"next_TRANS_CLOSE",value:function(){return "CLOSE"}},{key:"enter_TRANS_CLOSE",value:function(){var t=this.parent;if(t.transitOutTime>0){var e=t.runTransitionOutCallback();t.delayCall(e,this.next,this);}else this.next();}},{key:"exit_TRANS_CLOSE",value:function(){this.parent.removeDelayCall();}},{key:"next_CLOSE",value:function(){return "TRANS_OPNE"}},{key:"enter_CLOSE",value:function(){this.parent.onClose();}},{key:"exit_CLOSE",value:function(){}},{key:"canOpen",value:function(){return "IDLE"===this.state||"CLOSE"===this.state}},{key:"canClose",value:function(){return "IDLE"===this.state||"OPEN"===this.state}}]),s}(ru),ou={delayCall:function(t,e,i){return this.delayCallTimer=function(t,e,i,n,r){var s=Mh(t);return s.time.delayedCall(e,(function(){s.game.events.once("poststep",(function(){i.call(n,r);}));}))}(this,t,e,i),this},removeDelayCall:function(){return this.delayCallTimer&&(this.delayCallTimer.remove(!1),this.delayCallTimer=void 0),this}},au={setTransitInTime:function(t){return this.transitInTime=t,this},setTransitOutTime:function(t){return this.transitOutTime=t,this},setTransitInCallback:function(t){return t||(t=$i),this.transitInCallback=t,this},setTransitOutCallback:function(t){return t||(t=$i),this.transitOutCallback=t,this}},hu={runTransitionInCallback:function(){return this.transitInCallback(this.parent,this.transitInTime),this.transitInTime},onOpen:function(){},requestOpen:function(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}},lu={runTransitionOutCallback:function(){return this.transitOutCallback(this.parent,this.transitOutTime),this.transitOutTime},onClose:function(){this.oneShotMode&&this.parent.destroy();},requestClose:function(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}},uu={};Object.assign(uu,ou,au,hu,lu);var cu=Phaser.Utils.Objects.GetValue,du=function(t){r(o,t);var i=l(o);function o(t,n){var r;return e(this,o),(r=i.call(this,t,n)).setTransitInTime(cu(n,"duration.in",200)),r.setTransitOutTime(cu(n,"duration.out",200)),r.setTransitInCallback(cu(n,"transitIn")),r.setTransitOutCallback(cu(n,"transitOut")),r.oneShotMode=cu(n,"destroy",!1),r.delayCallTimer=void 0,r._state=new su(a(r),{eventEmitter:!1,initState:cu(n,"initState","IDLE")}),r.openEventData=void 0,r.closeEventData=void 0,r}return n(o,[{key:"state",get:function(){return this._state.state}},{key:"shutdown",value:function(t){this.isShutdown||(this.transitInCallback=void 0,this.transitOutCallback=void 0,this.openEventData=void 0,this.closeEventData=void 0,this.removeDelayCall(),c(s(o.prototype),"shutdown",this).call(this,t));}}]),o}(Lh);Object.assign(du.prototype,uu);var pu=function(t){r(o,t);var i=l(o);function o(t,n,r){var s;return e(this,o),(s=i.call(this,t,0,0,2,2,n,1)).setAlpha(r),s.setScrollFactor(0),s.boot(),s}return n(o,[{key:"boot",value:function(){this.scene.sys.events.on("prerender",this.resize,this);}},{key:"destroy",value:function(t){this.scene&&!this.ignoreDestroy&&(this.scene.sys.events.off("prerender",this.resize,this),c(s(o.prototype),"destroy",this).call(this,t));}},{key:"tint",get:function(){return this.fillColor},set:function(t){this.setFillStyle(t,this.fillAlpha);}},{key:"resize",value:function(){var t=this.scene,e=t.sys.scale.gameSize,i=t.sys.cameras.main,n=e.width,r=e.height,s=1/i.zoom,o=n/2,a=r/2,h=n*s,l=r*s;this.x===o&&this.y===a||this.setPosition(o,a),this.width===h&&this.height===l||this.setSize(h,l).setOrigin(.5);}}]),o}(Phaser.GameObjects.Rectangle),fu=Phaser.Utils.Objects.GetValue,vu=function(t){r(s,t);var i=l(s);function s(t,n){var r;return e(this,s),(r=i.call(this,t,{eventEmitter:!1})).resetFromJSON(n),r.boot(),r}return n(s,[{key:"resetFromJSON",value:function(t){return this.setHitAreaMode(fu(t,"hitAreaMode",0)),this.setEnable(fu(t,"enable",!0)),this.setStopMode(fu(t,"stopAllLevels",!0)),this}},{key:"boot",value:function(){this.parent.on("pointerdown",(function(t,e,i,n){this.stopAllLevels&&n.stopPropagation();}),this).on("pointerup",(function(t,e,i,n){this.stopAllLevels&&n.stopPropagation();}),this).on("pointermove",(function(t,e,i,n){this.stopAllLevels&&n.stopPropagation();}),this).on("pointerover",(function(t,e,i,n){this.stopAllLevels&&n.stopPropagation();}),this).on("pointerout",(function(t,e){this.stopAllLevels&&e.stopPropagation();}),this);}},{key:"setHitAreaMode",value:function(t){"string"==typeof t&&(t=gu[t]);var e=this.parent;return e.input&&e.removeInteractive(),0===t?e.setInteractive():e.setInteractive({hitArea:{},hitAreaCallback:function(){return !0}}),this}},{key:"setEnable",value:function(t){return void 0===t&&(t=!0),t?this.parent.setInteractive():this.parent.disableInteractive(),this.enable=t,this}},{key:"setStopMode",value:function(t){return void 0===t&&(t=!0),this.stopAllLevels=t,this}},{key:"toggleEnable",value:function(){return this.setEnable(!this.enable),this}}]),s}(Lh),gu={default:0,fullWindow:1},yu=Phaser.Utils.Objects.GetValue,mu=function(t){r(s,t);var i=l(s);function s(t,n){var r;e(this,s);var o=yu(n,"color",0),h=yu(n,"alpha",.8);return (r=i.call(this,t,o,h)).touchEventStop=new vu(a(r),{hitAreaMode:1}),r}return n(s)}(pu),ku=function(t,e){void 0!==t._modalScaleSave?(t.scaleX=t._modalScaleSave,t.scaleY=t._modalScaleSave):t._modalScaleSave=t.scaleX,rl(t,e);},bu=function(t,e){sl(t,e,void 0,void 0,!1);},xu=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,yl(t,e);},Cu=function(t,e){ml(t,e,!1);},Su=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,yl(t,e,t.alpha);},wu=function(t,e){ml(t,e,!1);},Ou=function(t,e,i,n,r){return !!t&&(!(n&&!n(t,e,i))&&(!!ea(t,!0).contains(e,i)&&!(r&&!r(t,e,i))))},Tu=Phaser.Utils.Objects.GetValue,Pu=function(t){r(o,t);var i=l(o);function o(t,n){var r;e(this,o),void 0===n&&(n={}),null==n.transitIn&&(n.transitIn=_u.popUp),null==n.transitOut&&(n.transitOut=_u.scaleDown),n.destroy=Tu(n,"destroy",!0),r=i.call(this,t,n);var s=Tu(n,"cover");r.cover=!1!==s?function(t,e){var i=t.scene,n=new mu(i,e);return i.add.existing(n),t.isRexContainerLite?(t.pin(n,{syncPosition:!1,syncRotation:!1,syncScale:!1,syncAlpha:!1,syncScrollFactor:!1}),t.moveDepthBelow(n)):i.children.moveBelow(n,t),n}(t,s):void 0,r.cover&&(r.setCoverTransitInCallback(Tu(s,"transitIn",Su)),r.setCoverTransitOutCallback(Tu(s,"transitOut",wu)));var h=Tu(n,"touchOutsideClose",!1),l=Tu(n,"duration.hold",-1),u=Tu(n,"timeOutClose",l>=0),c=Tu(n,"anyTouchClose",!1);return Tu(n,"manualClose",!1)&&(h=!1,c=!1,u=!1),c&&(h=!1),u?r.setDisplayTime(l):r.setDisplayTime(-1),c?r.once("open",r.anyTouchClose,a(r)):h&&r.once("open",r.touchOutsideClose,a(r)),Tu(n,"openOnStart",!0)&&r.delayCall(0,r.requestOpen,a(r)),r}return n(o,[{key:"shutdown",value:function(t){this.isShutdown||(this.cover||this.scene.input.off("pointerup",this.touchCloseCallback,this),this.cover&&!t&&(this.cover.destroy(),this.cover=void 0),c(s(o.prototype),"shutdown",this).call(this,t));}},{key:"touchOutsideClose",value:function(){return this.cover?this.cover.on("pointerup",this.touchCloseCallback,this):this.scene.input.on("pointerup",this.touchCloseCallback,this),this.clickOutsideTest=!0,this}},{key:"anyTouchClose",value:function(){return this.cover?this.cover.once("pointerup",this.touchCloseCallback,this):this.scene.input.once("pointerup",this.touchCloseCallback,this),this}},{key:"touchCloseCallback",value:function(t){this.clickOutsideTest&&Ou(this.parent,t.worldX,t.worldY)||this.requestClose();}},{key:"runTransitionInCallback",value:function(){var t=c(s(o.prototype),"runTransitionInCallback",this).call(this),e=this.cover;return e&&this.coverTransitInCallback&&this.coverTransitInCallback(e,t),t}},{key:"runTransitionOutCallback",value:function(){var t=c(s(o.prototype),"runTransitionOutCallback",this).call(this),e=this.cover;return e&&this.coverTransitOutCallback&&this.coverTransitOutCallback(e,t),t}},{key:"onOpen",value:function(){var t=this.displayTime;t>=0&&this.delayCall(t,this.requestClose,this),this.emit("open",this.parent,this),c(s(o.prototype),"onOpen",this).call(this);}},{key:"onClose",value:function(){this.emit("close",this.closeEventData),c(s(o.prototype),"onClose",this).call(this);}},{key:"setDisplayTime",value:function(t){return this.displayTime=t,this}},{key:"setTransitInCallback",value:function(t){switch("string"==typeof t&&(t=_u[t]),t){case _u.popUp:t=ku;break;case _u.fadeIn:t=xu;}return c(s(o.prototype),"setTransitInCallback",this).call(this,t),this}},{key:"setTransitOutCallback",value:function(t){switch("string"==typeof t&&(t=_u[t]),t){case _u.scaleDown:t=bu;break;case _u.fadeOut:t=Cu;}return c(s(o.prototype),"setTransitOutCallback",this).call(this,t),this}},{key:"setCoverTransitInCallback",value:function(t){return this.coverTransitInCallback=t,this}},{key:"setCoverTransitOutCallback",value:function(t){return this.coverTransitOutCallback=t,this}}]),o}(du),_u={popUp:0,fadeIn:1,scaleDown:0,fadeOut:1},Eu=function(t){return t&&"function"==typeof t},Mu={modal:function(t,e){return Eu(t)&&(e=t,t=void 0),void 0===this._modalBehavior&&(this.onCreateModalBehavior&&this.onCreateModalBehavior(this,t),this._modalBehavior=function(t,e){var i=new Pu(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:function(t){var e=this;return new Promise((function(i,n){e.modal(t,i);}))},modalClose:function(t){return function(t,e){t.emit("modal.requestClose",e);}(this,t),this}},Ru=function(t,e,i,n){if(e)return Ou(t,e.worldX,e.worldY,i,n);for(var r=t.scene.input.manager,s=r.pointersTotal,o=r.pointers,a=0;a=this.dragThreshold&&this.cancel();}},{key:"click",value:function(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 n=this.lastClickTime;return void 0!==n&&t-n<=this.clickInterval||(this.lastClickTime=t,this.emit("click",this,this.parent,e,i)),this}},{key:"cancel",value:function(){return this.pointer=void 0,this}},{key:"onOver",value:function(t,e,i,n){return this.enable?(this.emit("over",this,this.parent,t,n),this):this}},{key:"onOut",value:function(t,e){return this.enable?(this.emit("out",this,this.parent,t,e),this):this}}]),o}(Lh),Vu={press:0,pointerdown:0,release:1,pointerup:1},Uu={onClick:function(t,e,i,n){return t?("function"==typeof t&&(n=i,i=e,e=t,t=this),void 0===t._click&&(t._click=new Hu(t,n)),t._click.on("click",e,i),this):this},offClick:function(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:function(e,i){return e&&"object"!==t(e)&&(i=e,e=this),void 0===e._click||e._click.setEnable(i),this},disableClick:function(e){return e&&"object"!==t(e)&&(e=this),void 0===e._click||e._click.setEnable(!1),this}},Ju=function(t,e,i,n){if(e)return !(i&&!i(t,e))&&(!!Ku(t,e)&&!(n&&!n(t,e)));for(var r=t.scene.input.manager,s=r.pointersTotal,o=r.pointers,a=0;a0)return qu.length=0,!0;return qu.length=0,!1},qu=[],$u=Phaser.Utils.Objects.GetValue,Zu=function(t){r(o,t);var i=l(o);function o(t,n){var r;e(this,o),(r=i.call(this,t,n))._enable=void 0;var s=$u(n,"inputConfig",void 0);return s&&t.setInteractive(s),r.resetFromJSON(n),r.boot(),r}return n(o,[{key:"resetFromJSON",value:function(t){return this.pointer=void 0,this.lastClickTime=void 0,this.setEnable($u(t,"enable",!0)),this.setMode($u(t,"mode",1)),this.setClickInterval($u(t,"clickInterval",100)),this.setDragThreshold($u(t,"threshold",void 0)),this}},{key:"boot",value:function(){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);}},{key:"shutdown",value:function(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,c(s(o.prototype),"shutdown",this).call(this,t);}}},{key:"enable",get:function(){return this._enable},set:function(t){if(this._enable!==t){t||this.cancel(),this._enable=t;var e=t?"enable":"disable";this.emit(e,this,this.parent);}}},{key:"setEnable",value:function(t){return void 0===t&&(t=!0),this.enable=t,this}},{key:"toggleEnable",value:function(){return this.setEnable(!this.enable),this}},{key:"setMode",value:function(t){return "string"==typeof t&&(t=Qu[t]),this.mode=t,this}},{key:"setClickInterval",value:function(t){return this.clickInterval=t,this}},{key:"setDragThreshold",value:function(t){return this.dragThreshold=t,this}},{key:"isPointerInside",value:function(t){var e=this.parent;return (e.input?Ju:Ru)(e,t)}},{key:"onPress",value:function(t){this.parent.willRender(t.camera)&&void 0===this.pointer&&(this.pointer=t,0===this.mode&&(this.isPointerInside(t)||this.click(t.downTime,t)));}},{key:"onRelease",value:function(t){this.parent.willRender(t.camera)&&this.pointer===t&&(1===this.mode&&(this.isPointerInside(t)||this.click(t.upTime,t)),this.pointer=void 0);}},{key:"onMove",value:function(t,e,i,n){this.pointer===t&&void 0!==this.dragThreshold&&1===this.mode&&(t.getDistance()>=this.dragThreshold||this.isPointerInside(t))&&this.cancel();}},{key:"click",value:function(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}},{key:"cancel",value:function(){return this.pointer=void 0,this}}]),o}(Lh),Qu={press:0,pointerdown:0,release:1,pointerup:1},tc={onClickOutside:function(t,e,i,n){return t?("function"==typeof t&&(n=i,i=e,e=t,t=this),void 0===t._clickOutside&&(t._clickOutside=new Zu(t,n)),t._clickOutside.on("clickoutside",e,i),this):this},offClickOutside:function(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:function(e,i){return e&&"object"!==t(e)&&(i=e,e=this),void 0===e._clickOutside||e._clickOutside.setEnable(i),this},disableClickOutside:function(e){return e&&"object"!==t(e)&&(e=this),void 0===e._clickOutside||e._clickOutside.setEnable(!1),this}},ec=function(t){r(s,t);var i=l(s);function s(){var t;return e(this,s),(t=i.call(this,{eventEmitter:!1})).goto("IDLE"),t}return n(s,[{key:"setCooldownTime",value:function(t){return this.cooldownTime=t,this.cooldownMode=void 0!==t,this}},{key:"request",value:function(){return this.runMethod("request")}},{key:"update_IDLE",value:function(){this.compensationTime=0;}},{key:"request_IDLE",value:function(){return this.next(),!0}},{key:"next_IDLE",value:function(){if(this.cooldownMode)return "COOLDOWN"}},{key:"enter_COOLDOWN",value:function(){this.remainderTime=this.cooldownTime+this.compensationTime;}},{key:"update_COOLDOWN",value:function(t,e){this.remainderTime-=e,this.remainderTime<0&&(this.compensationTime=this.cooldownTime>e?-this.remainderTime:0,this.goto("IDLE"));}},{key:"request_COOLDOWN",value:function(){return !1}}]),s}(ru),ic=Phaser.Utils.Objects.GetValue,nc=function(t){r(o,t);var i=l(o);function o(t,n){var r;return e(this,o),(r=i.call(this,t,n))._enable=void 0,r.cooldown=new ec,r.parent.setInteractive(ic(n,"inputConfig",void 0)),r.resetFromJSON(n),r.boot(),r}return n(o,[{key:"resetFromJSON",value:function(t){return this.pointer=void 0,this.prevIsInTouch=!1,this.isInTouching=!1,this.setEnable(ic(t,"enable",!0)),this.setCooldown(ic(t,"cooldown",void 0)),this}},{key:"boot",value:function(){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);}},{key:"shutdown",value:function(t){this.isShutdown||(this.scene.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,c(s(o.prototype),"shutdown",this).call(this,t));}},{key:"enable",get:function(){return this._enable},set:function(t){if(this._enable!==t)return t||(this.prevIsInTouch=!1,this.isInTouching=!1,this.pointer=void 0),this._enable=t,this}},{key:"setEnable",value:function(t){return void 0===t&&(t=!0),this.enable=t,this}},{key:"cooldownTime",get:function(){return this.cooldown.cooldownTime},set:function(t){this.cooldown.setCooldownTime(t);}},{key:"setCooldown",value:function(t){return this.cooldownTime=t,this}},{key:"toggleEnable",value:function(){return this.setEnable(!this.enable),this}},{key:"onPointIn",value:function(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.pointer=t,this.isInTouching=!0);}},{key:"onPointOut",value:function(t){this.enable&&this.pointer===t&&(this.pointer=void 0,this.isInTouching=!1);}},{key:"preupdate",value:function(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;}}]),o}(Lh),rc={isPointerInBounds:function(t){return void 0===t?t=this:"string"==typeof t&&(t=this.getElement(t)),!!t&&Ru(t)},onTouching:function(t,e,i,n){return t?("function"==typeof t&&(n=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new nc(t,n)),t._inTouching.on("intouch",e,i),this):this},offTouching:function(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:function(t,e,i,n){return t?("function"==typeof t&&(n=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new nc(t,n)),t._inTouching.on("touchend",e,i),this):this},offTouchingEnd:function(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:function(e,i){return e&&"object"!==t(e)&&(i=e,e=this),void 0===e._inTouching||e._inTouching.setEnable(i),this},disableTouching:function(e){return e&&"object"!==t(e)&&(e=this),void 0===e._inTouching||e._inTouching.setEnable(!1),this}},sc=function(t,e,i){for(var n,r=0,s=t.length;r0),this.onDragStart()));}},{key:"onPointerUp",value:function(t){this.enable&&((!this.bounds||this.bounds.contains(t.x,t.y))&&this.pointer===t&&(this.pointer=void 0,this.movedState=!1,this.tracerState=xc,this.onDragEnd()));}},{key:"onPointerMove",value:function(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()));}}},{key:"dragCancel",value:function(){return this.tracerState===Cc&&this.onDragEnd(),this.pointer=void 0,this.tracerState=xc,this}},{key:"onDragStart",value:function(){this.emit("dragstart",this);}},{key:"onDragEnd",value:function(){this.emit("dragend",this);}},{key:"onDrag",value:function(){this.emit("drag",this);}},{key:"preUpdate",value:function(t,e){}},{key:"postUpdate",value:function(t,e){}},{key:"startTicking",value:function(){c(s(o.prototype),"startTicking",this).call(this),this.scene.sys.events.on("preupdate",this.preUpdate,this),this.scene.sys.events.on("postupdate",this.postUpdate,this);}},{key:"stopTicking",value:function(){c(s(o.prototype),"stopTicking",this).call(this),this.scene&&(this.scene.sys.events.off("preupdate",this.preUpdate,this),this.scene.sys.events.off("postupdate",this.postUpdate,this));}},{key:"setRecongizedStateObject",value:function(t){return this.recongizedState=t,this}},{key:"state",get:function(){return this.recongizedState.state},set:function(t){this.recongizedState.state=t;}},{key:"cancel",value:function(){return this.state=Sc,this}}]),o}(zh),xc=0,Cc=1,Sc="IDLE",wc=Phaser.Utils.Objects.GetValue,Oc=Phaser.Math.Distance.Between,Tc=function(t){r(o,t);var i=l(o);function o(t,n){var r;e(this,o);var s=a(r=i.call(this,t,n)),h={states:{IDLE:{enter:function(){s.stop(),s.tapsCount=0,s.x=0,s.y=0,s.worldX=0,s.worldY=0;},exit:function(){var t=s.lastPointer;s.x=t.x,s.y=t.y,s.worldX=t.worldX,s.worldY=t.worldY;}},BEGIN:{enter:function(){s.start(),s.tapsCount=0,s.emit("tappingstart",s,s.gameObject,s.lastPointer);}},RECOGNIZED:{enter:function(){s.start(),s.emit("tap",s,s.gameObject,s.lastPointer),s.emit("".concat(s.tapsCount,"tap"),s,s.gameObject,s.lastPointer);}}},init:function(){this.state=Pc;},eventEmitter:!1};return r.setRecongizedStateObject(new ru(h)),r}return n(o,[{key:"resetFromJSON",value:function(t){c(s(o.prototype),"resetFromJSON",this).call(this,t),this.setHoldTime(wc(t,"time",250)),this.setTapInterval(wc(t,"tapInterval",200)),this.setDragThreshold(wc(t,"threshold",9)),this.setTapOffset(wc(t,"tapOffset",10));var e=wc(t,"taps",void 0);return void 0!==e?this.setTaps(e):(this.setMaxTaps(wc(t,"maxTaps",void 0)),this.setMinTaps(wc(t,"minTaps",void 0))),this}},{key:"onDragStart",value:function(){switch(this.state){case Pc:this.state=_c;break;case _c:var t=this.lastPointer;Oc(t.upX,t.upY,t.x,t.y)>this.tapOffset&&(this.state=Ec,this.state=_c);break;case Ec:this.state=_c;}}},{key:"onDragEnd",value:function(){this.state===_c&&(this.tapsCount++,this.emit("tapping",this,this.gameObject,this.lastPointer),void 0!==this.maxTaps&&this.tapsCount===this.maxTaps&&(this.state=Ec));}},{key:"onDrag",value:function(){this.state!==Pc&&this.pointer.getDistance()>this.dragThreshold&&(this.state=Pc);}},{key:"preUpdate",value:function(t,e){if(this.isRunning&&this.enable&&this.state===_c){var i=this.lastPointer;if(i.isDown)t-i.downTime>this.holdTime&&(this.state=Pc);else t-i.upTime>this.tapInterval&&(void 0===this.minTaps||this.tapsCount>=this.minTaps?this.state=Ec:this.state=Pc);}}},{key:"postUpdate",value:function(t,e){this.isRunning&&this.enable&&this.state===Ec&&(this.state=Pc);}},{key:"isTapped",get:function(){return this.state===Ec}},{key:"setHoldTime",value:function(t){return this.holdTime=t,this}},{key:"setTapInterval",value:function(t){return this.tapInterval=t,this}},{key:"setDragThreshold",value:function(t){return this.dragThreshold=t,this}},{key:"setTapOffset",value:function(t){return this.tapOffset=t,this}},{key:"setMaxTaps",value:function(t){return this.maxTaps=t,this}},{key:"setMinTaps",value:function(t){return this.minTaps=t,this}},{key:"setTaps",value:function(t,e){return void 0===e&&(e=t),this.setMinTaps(t).setMaxTaps(e),this}}]),o}(bc),Pc="IDLE",_c="BEGIN",Ec="RECOGNIZED",Mc=Phaser.Utils.Objects.GetValue,Rc=function(t){r(o,t);var i=l(o);function o(t,n){var r;e(this,o);var s=a(r=i.call(this,t,n)),h={states:{IDLE:{enter:function(){s.x=0,s.y=0,s.worldX=0,s.worldY=0;},exit:function(){var t=s.lastPointer;s.x=t.x,s.y=t.y,s.worldX=t.worldX,s.worldY=t.worldY;}},BEGIN:{enter:function(){s.start();},exit:function(){s.stop();}},RECOGNIZED:{enter:function(){s.emit("pressstart",s,s.gameObject,s.lastPointer);},exit:function(){s.emit("pressend",s,s.gameObject,s.lastPointer);}}},init:function(){this.state=Lc;},eventEmitter:!1};return r.setRecongizedStateObject(new ru(h)),r}return n(o,[{key:"resetFromJSON",value:function(t){return c(s(o.prototype),"resetFromJSON",this).call(this,t),this.setDragThreshold(Mc(t,"threshold",9)),this.setHoldTime(Mc(t,"time",251)),this}},{key:"onDragStart",value:function(){this.state=Ac,0===this.holdTime&&(this.state=Dc);}},{key:"onDragEnd",value:function(){this.state=Lc;}},{key:"onDrag",value:function(){this.state!==Lc&&this.pointer.getDistance()>this.dragThreshold&&(this.state=Lc);}},{key:"preUpdate",value:function(t,e){this.isRunning&&this.enable&&(this.state===Ac&&t-this.pointer.downTime>=this.holdTime&&(this.state=Dc));}},{key:"isPressed",get:function(){return this.state===Dc}},{key:"setHoldTime",value:function(t){return this.holdTime=t,this}},{key:"setDragThreshold",value:function(t){return this.dragThreshold=t,this}}]),o}(bc),Lc="IDLE",Ac="BEGIN",Dc="RECOGNIZED";Phaser.Utils.Objects.GetValue;var zc=function(t){return Jr(t).loop.delta},Ic=Phaser.Math.Distance.Between,jc=Phaser.Math.Angle.Between,Bc={getDt:function(){return zc(this.scene)},getVelocity:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Ic(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 jc(e.x,e.y,t.x,t.y)}},Fc={"up&down":0,"left&right":1,"4dir":2,"8dir":3},Wc={},Yc=Phaser.Utils.Objects.GetValue,Nc=Phaser.Math.RadToDeg,Xc=function(t){r(o,t);var i=l(o);function o(t,n){var r;e(this,o);var s=a(r=i.call(this,t,n)),h={states:{IDLE:{enter:function(){s.x=0,s.y=0,s.worldX=0,s.worldY=0;},exit:function(){var t=s.lastPointer;s.x=t.x,s.y=t.y,s.worldX=t.worldX,s.worldY=t.worldY;}},BEGIN:{enter:function(){s.validDrag=!1;}},RECOGNIZED:{enter:function(){s.start(),s.updateDirectionStates(),s.emit("swipe",s,s.gameObject,s.lastPointer);},exit:function(){s.stop(),s.clearDirectionStates();}}},init:function(){this.state=Gc;},eventEmitter:!1};return r.setRecongizedStateObject(new ru(h)),r.clearDirectionStates(),r}return n(o,[{key:"resetFromJSON",value:function(t){return c(s(o.prototype),"resetFromJSON",this).call(this,t),this.setDragThreshold(Yc(t,"threshold",10)),this.setVelocityThreshold(Yc(t,"velocityThreshold",1e3)),this.setDirectionMode(Yc(t,"dir","8dir")),this}},{key:"onDragStart",value:function(){this.state=Hc;}},{key:"onDragEnd",value:function(){this.state=Gc;}},{key:"onDrag",value:function(){this.state===Hc&&(this.validDrag||(this.validDrag=0===this.dragThreshold||this.pointer.getDistance()>=this.dragThreshold),this.validDrag&&this.dragVelocity>this.velocityThreshold&&(this.state=Vc));}},{key:"postUpdate",value:function(t,e){this.isRunning&&this.enable&&this.state===Vc&&(this.state=Gc);}},{key:"isSwiped",get:function(){return this.state===Vc}},{key:"dragVelocity",get:function(){var t;switch(this.dirMode){case 0:t=this.getVelocityY();break;case 1:t=this.getVelocityX();break;default:t=this.getVelocity();}return t}},{key:"setDragThreshold",value:function(t){return this.dragThreshold=t,this}},{key:"setVelocityThreshold",value:function(t){return this.velocityThreshold=t,this}},{key:"setDirectionMode",value:function(t){return "string"==typeof t&&(t=Fc[t]),this.dirMode=t,this}},{key:"updateDirectionStates",value:function(){return function(t,e,i){switch(void 0===i?i={}:!0===i&&(i=Wc),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;}}(Nc(this.getVelocityAngle()),this.dirMode,this),this}},{key:"clearDirectionStates",value:function(){return this.left=!1,this.right=!1,this.up=!1,this.down=!1,this}}]),o}(bc);Object.assign(Xc.prototype,Bc);var Gc="IDLE",Hc="BEGIN",Vc="RECOGNIZED",Uc=Phaser.Utils.Objects.GetValue,Jc=Phaser.Utils.Array.SpliceOne,Kc=Phaser.Math.Distance.Between,qc=Phaser.Math.Angle.Between,$c=function(){function t(i,n){e(this,t);var r=i.input.manager.pointersTotal-1;r<2&&i.input.addPointer(2-r),this.scene=i,this.setEventEmitter(Uc(n,"eventEmitter",void 0)),this._enable=void 0,this.pointers=[],this.movedState={},this.resetFromJSON(n),this.boot();}return n(t,[{key:"resetFromJSON",value:function(t){return this.setEnable(Uc(t,"enable",!0)),this.bounds=Uc(t,"bounds",void 0),this.tracerState=Qc,this.pointers.length=0,Ki(this.movedState),this}},{key:"boot",value:function(){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);}},{key:"shutdown",value:function(){this.scene&&(this.destroyEventEmitter(),this.pointers.length=0,Ki(this.movedState),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);}},{key:"destroy",value:function(){this.shutdown();}},{key:"enable",get:function(){return this._enable},set:function(t){if(this._enable!==t)return t||this.dragCancel(),this._enable=t,this}},{key:"setEnable",value:function(t){return void 0===t&&(t=!0),this.enable=t,this}},{key:"toggleEnable",value:function(){return this.setEnable(!this.enable),this}},{key:"onPointerDown",value:function(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.tracerState){case Qc:this.tracerState=td,this.onDrag1Start();break;case td:this.tracerState=ed,this.onDrag2Start();}}},{key:"onPointerUp",value:function(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],Jc(this.pointers,e),this.tracerState){case td:this.tracerState=Qc,this.onDrag1End();break;case ed:this.tracerState=td,this.onDrag2End(),this.onDrag1Start();}}}},{key:"onPointerMove",value:function(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 td:this.onDrag1();break;case ed:this.onDrag2();}}}},{key:"dragCancel",value:function(){return this.tracerState===ed&&this.onDrag2End(),this.pointers.length=0,Ki(this.movedState),this.tracerState=Qc,this}},{key:"onDrag1Start",value:function(){this.emit("drag1start",this);}},{key:"onDrag1End",value:function(){this.emit("drag1end",this);}},{key:"onDrag1",value:function(){this.emit("drag1",this);}},{key:"onDrag2Start",value:function(){this.emit("drag2start",this);}},{key:"onDrag2End",value:function(){this.emit("drag2end",this);}},{key:"onDrag2",value:function(){this.emit("drag2",this);}},{key:"distanceBetween",get:function(){if(this.tracerState!==ed)return 0;var t=this.pointers[0],e=this.pointers[1];return Kc(t.x,t.y,e.x,e.y)}},{key:"angleBetween",get:function(){if(this.tracerState!==ed)return 0;var t=this.pointers[0],e=this.pointers[1];return qc(t.x,t.y,e.x,e.y)}},{key:"drag1Vector",get:function(){var t=this.pointers[0];if(t&&this.movedState[t.id]){var e=t.position,i=t.prevPosition;Zc.x=e.x-i.x,Zc.y=e.y-i.y;}else Zc.x=0,Zc.y=0;return Zc}},{key:"centerX",get:function(){if(this.tracerState!==ed)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return (t.x+e.x)/2}},{key:"centerY",get:function(){if(this.tracerState!==ed)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return (t.y+e.y)/2}},{key:"prevCenterX",get:function(){if(this.tracerState!==ed)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}},{key:"prevCenterY",get:function(){if(this.tracerState!==ed)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}},{key:"movementCenterX",get:function(){return this.centerX-this.prevCenterX}},{key:"movementCenterY",get:function(){return this.centerY-this.prevCenterY}},{key:"setRecongizedStateObject",value:function(t){return this.recongizedState=t,this}},{key:"state",get:function(){return this.recongizedState.state},set:function(t){this.recongizedState.state=t;}},{key:"cancel",value:function(){return this.state=id,this}}]),t}();Object.assign($c.prototype,Eh);var Zc={},Qc=0,td=1,ed=2,id="IDLE";Phaser.Utils.Objects.GetValue;var nd=Phaser.Math.RotateAround,rd=function(t,e,i,n){return nd(t,e,i,n),t.rotation+=n,t},sd={},od=Phaser.Utils.Objects.GetValue,ad=Phaser.Math.Angle.WrapDegrees,hd=Phaser.Math.Angle.ShortestBetween,ld=Phaser.Math.RadToDeg,ud=Phaser.Math.DegToRad,cd=function(t){r(o,t);var i=l(o);function o(t,n){var r;e(this,o);var s=a(r=i.call(this,t,n)),h={states:{IDLE:{enter:function(){s.prevAngle=void 0,s.angle=0;}},BEGIN:{},RECOGNIZED:{enter:function(){s.emit("rotatestart",s);},exit:function(){s.emit("rotateend",s);}}},init:function(){this.state=pd;},eventEmitter:!1};return r.setRecongizedStateObject(new ru(h)),r}return n(o,[{key:"resetFromJSON",value:function(t){return c(s(o.prototype),"resetFromJSON",this).call(this,t),this.setDragThreshold(od(t,"threshold",0)),this}},{key:"onDrag2Start",value:function(){this.prevAngle=ad(ld(this.angleBetween)),this.state=fd,0===this.dragThreshold&&(this.state=vd);}},{key:"onDrag2End",value:function(){this.state=pd;}},{key:"onDrag2",value:function(){switch(this.state){case fd:if(this.pointers[0].getDistance()>=this.dragThreshold&&this.pointers[1].getDistance()>=this.dragThreshold){var t=ad(ld(this.angleBetween));this.angle=hd(this.prevAngle,t),this.prevAngle=t,this.state=vd;}break;case vd:t=ad(ld(this.angleBetween));this.angle=hd(this.prevAngle,t),this.prevAngle=t,this.emit("rotate",this);}}},{key:"isRotated",get:function(){return this.state===vd}},{key:"rotation",get:function(){return ud(this.angle)}},{key:"setDragThreshold",value:function(t){return this.dragThreshold=t,this}}]),o}($c),dd={spinObject:function(t,e){if(!this.isRotation)return this;void 0===e&&(e=this.pointers[0].camera);var i=this.movementCenterX,n=this.movementCenterY,r=function(t,e,i,n){return void 0===n?n={}:!0===n&&(n=sd),i.getWorldPoint(t,e,n),n}(this.centerX,this.centerY,e,!0),s=r.x,o=r.y,a=this.rotation;if(Array.isArray(t))for(var h=t,l=0,u=h.length;l=this.sizerChildren.length?this.sizerChildren.push(e):this.sizerChildren.splice(a,0,e),e.isRexSizer||(i>0&&(0===this.orientation?e.minWidth=void 0===h?qo(e):h:e.minHeight=void 0===l?$o(e):l),s&&(0===this.orientation?e.minHeight=l:e.minWidth=h)),void 0!==o&&this.addChildrenMap(o,e),this},zd={add:Dd,addSpace:function(t){return this.insertSpace(void 0,t),this},insertSpace:function(t,e){return void 0===e&&(e=1),Dd.call(this,new Ks(this.scene),{proportion:e,minWidth:0,minHeight:0,index:t}),this},insert:function(t,e,i,n,r,s,o,a){return Md(i)&&(i.index=t),Dd.call(this,e,i,n,r,s,o,t,a),this},insertAtPosition:function(t,e,i,n,r,s,o,a,h){var l=Ed.call(this,t,e);return -1===l&&(l=void 0),this.insert(l,i,n,r,s,o,a,h),this}},Id=wa.prototype.clear,jd=function(t){this.backgroundChildren&&(this.backgroundChildren.length=0);var e,i=!t&&this.sizerEventsEnable;if(i&&(e=this.getChildren([])),Id.call(this,t),i)for(var n,r=0,s=e.length;r=0;e--)this.remove(this.sizerChildren[e],t);return this},clear:function(t){return this.sizerChildren.length=0,jd.call(this,t),this}},Wd={getChildAlign:function(t){return this.getSizerConfig(t).align},setChildAlign:function(t,e){return "string"==typeof e&&(e=Ra[e]),this.getSizerConfig(t).align=e,this}},Yd={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,n,r=0,s=this.sizerChildren;if(0===this.orientation)for(var o=this.space.item,a=!0,h=0,l=s.length;h0&&this.proportionLength>0&&(i=n.proportion*this.proportionLength):n.expand&&(i=e-this.space.left-this.space.right-r.left-r.right);return i},getExpandedChildHeight:function(t,e){var i;void 0===e&&(e=this.height);var n=t.rexSizer,r=n.padding;0===this.orientation?n.expand&&(i=e-this.space.top-this.space.bottom-r.top-r.bottom):n.proportion>0&&this.proportionLength>0&&(i=n.proportion*this.proportionLength);return i},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,n=0,r=i.length;n0?(e=t-this.getChildrenWidth(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0;}return t},resolveHeight:function(t){t=Oh.call(this,t);if(void 0===this.proportionLength&&1===this.orientation){var e=t-this.childrenHeight;e>0?(e=t-this.getChildrenHeight(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0;}return t}};Object.assign(Yd,zd,Fd,Wd,{getChildProportion:function(t){return this.getSizerConfig(t).proportion},setChildProportion:function(t,e){return this.getSizerConfig(t).proportion=e,this}},{getChildExpand:function(t){return this.getSizerConfig(t).expand},setChildExpand:function(t,e){return this.getSizerConfig(t).expand=e,this}});var Nd=function(){for(var t,e,i=0,n=this.sizerChildren,r=0,s=n.length;r0&&(i+=e);return i},Xd={x:0,h:0,horizontal:0,"left-to-right":0,y:1,v:1,vertical:1,"top-to-bottom":1},Gd=function(t){return "string"==typeof t&&(t=Xd[t]),t},Hd=Phaser.Utils.Objects.IsPlainObject,Vd=Phaser.Utils.Objects.GetValue,Ud=function(t){r(s,t);var i=l(s);function s(t,n,r,o,a,h,l){var u;return e(this,s),Hd(n)?(n=Vd(l=n,"x",0),r=Vd(l,"y",0),o=Vd(l,"width",void 0),a=Vd(l,"height",void 0),h=Vd(l,"orientation",0)):Hd(o)?(o=Vd(l=o,"width",void 0),a=Vd(l,"height",void 0),h=Vd(l,"orientation",0)):Hd(h)&&(h=Vd(l=h,"orientation",0)),void 0===h&&(h=0),(u=i.call(this,t,n,r,o,a,l)).type="rexSizer",u.sizerChildren=[],u.setOrientation(h),u.setItemSpacing(Vd(l,"space.item",0)),u.setStartChildIndex(Vd(l,"startChildIndex",0)),u.setRTL(Vd(l,"rtl",!1)),u.addChildrenMap("items",u.sizerChildren),u}return n(s,[{key:"setOrientation",value:function(t){return this.orientation=Gd(t),this}},{key:"setItemSpacing",value:function(t){return this.space.item=t,this}},{key:"setStartChildIndex",value:function(t){return this.startChildIndex=t,this}},{key:"setRTL",value:function(t){return void 0===t&&(t=!0),this.rtl=t,this}},{key:"childrenProportion",get:function(){return void 0===this._childrenProportion&&(this._childrenProportion=Nd.call(this)),this._childrenProportion}}]),s}(Td);Object.assign(Ud.prototype,Yd);var Jd=function(t,e,i,n){return e/t<=i?e/(n-1):0},Kd=function(t,e){void 0===e?e={lines:[],width:0,height:0}:(e.lines.length=0,e.width=0,e.height=0);for(var i,n,r,s,o=this.sizerChildren,a=this.space.item,h=this.space.line,l=this.space.indentLeftOdd,u=this.space.indentLeftEven,c=this.space.indentTopOdd,d=this.space.indentTopEven,p=0,f=e.lines,v=void 0,g=0,y=o.length;ga.height/2)){r>(h=Zd(a.left,a.centerY,t,e))&&(r=h,n=s);var h,l=i[s+1];if(!l||l.y!==a.y)r>(h=Zd(a.right,a.centerY,t,e))&&(r=h,n=s+1);}}return n},tp=Phaser.Utils.Objects.IsPlainObject,ep=Phaser.Utils.Objects.GetValue,ip=Phaser.Display.Align.CENTER,np=function(t,e,i,n){if("\n"===t)return this.addNewLine(),this;var r;(lh.call(this,t),tp(e))&&(e=ep(r=e,"padding",0),i=ep(r,"key",void 0),n=ep(r,"index",void 0));return void 0===e&&(e=0),(r=this.getSizerConfig(t)).align=ip,r.padding=ah(e),void 0===n||n>=this.sizerChildren.length?this.sizerChildren.push(t):this.sizerChildren.splice(n,0,t),void 0!==i&&this.addChildrenMap(i,t),this},rp={add:function(t,e,i){if(Lu(t))for(var n=t,r=0,s=n.length;r=0;e--)this.remove(this.sizerChildren[e],t);return this},clear:function(t){return this.sizerChildren.length=0,jd.call(this,t),this}},ap={getChildrenWidth:function(){return this.rexSizer.hidden?0:this.maxChildWidth+this.space.left+this.space.right},getChildrenHeight:function(){return this.rexSizer.hidden?0:this.widthWrapResult.height+this.space.top+this.space.bottom},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,n=0,r=i.length;n=0;e--){var i=this.sizerChildren[e];i&&this.remove(i,t);}return this},clear:function(t){return xp(this.sizerChildren,null),jd.call(this,t),this}},Sp={setColumnSpace:function(t){if(this.space.column||(this.space.column=[]),this.space.column.length=this.columnCount-1,"number"==typeof t)xp(this.space.column,t);else for(var e=0,i=this.columnCount-1;e=0;n--){var r=n*this.columnCount+t;this.sizerChildren.splice(r,0,null);}return this.columnProportions.push(e),this.columnWidth.length+=1,this.space.column.splice(t,0,i),this},Pp={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);for(var e,i,n,r,s=0,o=this.sizerChildren,a=0;a0){var i=t-this.getChildrenWidth(!1);i>=0&&(this.proportionWidthLength=i/e);}else this.proportionWidthLength=0;}return t},resolveHeight:function(t){t=Oh.call(this,t);if(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,n;for(var r in this.sizerChildren)(e=this.sizerChildren[r])&&e.isRexSizer&&!e.ignoreLayout&&(n=this.getColumnWidth(parseInt(r)%this.columnCount),i=this.getExpandedChildWidth(e,n),i=e.resolveWidth(i),e.resolveChildrenWidth(i));},runWidthWrap:function(t){var e,i,n;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(n=this.getColumnWidth(parseInt(r)%this.columnCount),i=this.getExpandedChildWidth(e,n),e.isRexSizer&&(i=e.resolveWidth(i)),e.runWidthWrap(i));return this},resetGrid:function(t,e,i,n,r){if(void 0===i&&(i=0),void 0===n&&(n=0),this.columnCount=t,this.rowCount=e,this.gridCount=t*e,this.removeAll(),this.sizerChildren.length=t*e,xp(this.sizerChildren,null),this.columnProportions=[],this.columnProportions.length=t,"number"==typeof i)xp(this.columnProportions,i);else for(var s=0;s0&&(e+=t);return e},Ep=function(){for(var t,e=0,i=0;i0&&(e+=t);return e},Mp=Phaser.Utils.Objects.IsPlainObject,Rp=Phaser.Utils.Objects.GetValue,Lp=function(t){r(o,t);var i=l(o);function o(t,n,r,s,a,h,l,u,c,d){var p;return e(this,o),Mp(n)?(n=Rp(d=n,"x",0),r=Rp(d,"y",0),s=Rp(d,"width",void 0),a=Rp(d,"height",void 0),h=Rp(d,"column",d.col||0),l=Rp(d,"row",0),u=Rp(d,"columnProportions",0),c=Rp(d,"rowProportions",0)):Mp(s)?(s=Rp(d=s,"width",void 0),a=Rp(d,"height",void 0),h=Rp(d,"column",d.col||0),l=Rp(d,"row",0),u=Rp(d,"columnProportions",0),c=Rp(d,"rowProportions",0)):Mp(h)?(h=Rp(d=h,"column",d.col||0),l=Rp(d,"row",0),u=Rp(d,"columnProportions",0),c=Rp(d,"rowProportions",0)):Mp(u)&&(u=Rp(d=u,"columnProportions",0),c=Rp(d,"rowProportions",0)),(p=i.call(this,t,n,r,s,a,d)).type="rexGridSizer",p.sizerChildren=[],p.addChildrenMap("items",p.sizerChildren),p.setCreateCellContainerCallback(Rp(d,"createCellContainerCallback")),p.setIndentLeft(Rp(d,"space.indentLeftOdd",0),Rp(d,"space.indentLeftEven",0)),p.setIndentTop(Rp(d,"space.indentTopOdd",0),Rp(d,"space.indentTopEven",0)),p.resetGrid(h,l,u,c,Rp(d,"space",void 0)),p}return n(o,[{key:"destroy",value:function(t){this.scene&&!this.ignoreDestroy&&(c(s(o.prototype),"destroy",this).call(this,t),this.columnProportions=void 0,this.rowProportions=void 0,this.columnWidth=void 0,this.rowHeight=void 0,this.createCellContainerCallback=void 0);}},{key:"setColumnProportion",value:function(t,e){return t>=this.columnProportions.length||(this.columnProportions[t]=e),this}},{key:"setRowProportion",value:function(t,e){return t>=this.rowProportions.length||(this.rowProportions[t]=e),this}},{key:"totalColumnProportions",get:function(){return void 0===this._totalColumnProportions&&(this._totalColumnProportions=_p.call(this)),this._totalColumnProportions}},{key:"totalRowProportions",get:function(){return void 0===this._totalRowProportions&&(this._totalRowProportions=Ep.call(this)),this._totalRowProportions}},{key:"getChildAt",value:function(t,e){return this.sizerChildren[e*this.columnCount+t]}},{key:"childToGridIndex",value:function(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)}},{key:"getColumnWidth",value:function(t){var e=this.columnProportions[t];return 0===e?this.columnWidth[t]:e*this.proportionWidthLength}},{key:"getRowHeight",value:function(t){var e=this.rowProportions[t];return 0===e?this.rowHeight[t]:e*this.proportionHeightLength}},{key:"setCreateCellContainerCallback",value:function(t){return this.createCellContainerCallback=t,this}}]),o}(Td);Object.assign(Lp.prototype,Pp);var Ap=Phaser.Utils.Objects.IsPlainObject,Dp=Phaser.Utils.Objects.GetValue,zp=Phaser.Display.Align.CENTER,Ip=Phaser.Utils.String.UUID,jp={add:function(t,e,i,n,r,s,o,a,h){(lh.call(this,t),Ap(e))&&(e=Dp(l=e,"key",void 0),i=Dp(l,"align",zp),a=Dp(l,"offsetX",0),h=Dp(l,"offsetY",0),n=Dp(l,"padding",0),r=Dp(l,"expand",!0),t.isRexSizer||(s=Dp(l,"minWidth",t._minWidth),o=Dp(l,"minHeight",t._minHeighted)));var l,u=void 0!==e;return u||(e=Ip()),"string"==typeof i&&(i=Ra[i]),void 0===i&&(i=zp),void 0===a&&(a=0),void 0===h&&(h=0),void 0===n&&(n=0),void 0===r&&(r=!0),t.isRexSizer||(void 0===s&&(s=t._minWidth),void 0===o&&(o=t._minHeight)),(l=this.getSizerConfig(t)).align=i,l.alignOffsetX=a,l.alignOffsetY=h,l.padding=ah(n),Ap(r)?(l.expandWidth=Dp(r,"width",!1),l.expandHeight=Dp(r,"height",!1)):(l.expandWidth=r,l.expandHeight=r),t.isRexSizer||(l.expandWidth&&(t.minWidth=void 0===s?qo(t):s),l.expandHeight&&(t.minHeight=void 0===o?$o(t):o)),this.sizerChildren.hasOwnProperty(e)&&this.sizerChildren[e].destroy(),this.sizerChildren[e]=t,u&&this.addChildrenMap(e,t),this}},Bp={remove:function(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]),ph.call(this,t,e),this},removeAll:function(t){for(var e in this.sizerChildren)this.remove(e,t);return this},clear:function(t){for(var e in this.sizerChildren)delete this.sizerChildren[e],this.childrenMap.hasOwnProperty(e)&&delete this.childrenMap[e];return jd.call(this,t),this}},Fp={getChildrenWidth:function(){if(this.rexSizer.hidden)return 0;var t,e,i,n=0,r=this.sizerChildren;for(var s in r)e=(t=r[s]).rexSizer.padding,i=this.getChildWidth(t)+e.left+e.right,n=Math.max(i,n);return n+this.space.left+this.space.right},getChildrenHeight:function(){if(this.rexSizer.hidden)return 0;var t,e,i,n=0,r=this.sizerChildren;for(var s in r)i=(t=r[s]).isRexSizer?Math.max(t.minHeight,t.childrenHeight):void 0!==t.minHeight?t.minHeight:$o(t),i+=(e=t.rexSizer.padding).top+e.bottom,n=Math.max(i,n);return n+this.space.top+this.space.bottom},getExpandedChildWidth:function(t,e){var i;void 0===e&&(e=this.width);var n=t.rexSizer;if(n.expandWidth){var r=e-this.space.left-this.space.right,s=n.padding;i=r-s.left-s.right;}return i},getExpandedChildHeight:function(t,e){var i;void 0===e&&(e=this.height);var n=t.rexSizer;if(n.expandHeight){var r=e-this.space.top-this.space.bottom,s=n.padding;i=r-s.top-s.bottom;}return i},getChildrenSizers:function(t){void 0===t&&(t=[]);var e,i=this.sizerChildren;for(var n in i)(e=i[n]).isRexSizer&&t.push(e);return t},layoutChildren:function(){var t,e,i,n,r,s,o,a,h,l=this.innerLeft,u=this.innerTop,c=this.innerWidth,d=this.innerHeight,p=this.sizerChildren;for(var f in p)(t=p[f]).rexSizer.hidden||(i=(e=t.rexSizer).padding,Yu.call(this,t),t.isRexSizer?(t.runLayout(this,this.getExpandedChildWidth(t),this.getExpandedChildHeight(t)),Pd(t,this)):(a=void 0,h=void 0,e.expandWidth&&(a=c-i.left-i.right),e.expandHeight&&(h=d-i.top-i.bottom),ju(t,a,h)),n=l+i.left,s=c-i.left-i.right,r=u+i.top,o=d-i.top-i.bottom,Nu.call(this,t,n,r,s,o,e.align,e.alignOffsetX,e.alignOffsetY));}};Object.assign(Fp,jp,Bp);var Wp=Phaser.Utils.Objects.IsPlainObject,Yp=Phaser.Utils.Objects.GetValue,Np=function(t){r(s,t);var i=l(s);function s(t,n,r,o,a,h){var l;return e(this,s),Wp(n)?(n=Yp(h=n,"x",0),r=Yp(h,"y",0),o=Yp(h,"width",void 0),a=Yp(h,"height",void 0)):Wp(o)&&(o=Yp(h=o,"width",void 0),a=Yp(h,"height",void 0)),(l=i.call(this,t,n,r,o,a,h)).type="rexOverlapSizer",l.sizerChildren={},l.addChildrenMap("items",l.sizerChildren),l}return n(s,[{key:"childToKey",value:function(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}}]),s}(Td);Object.assign(Np.prototype,Fp);var Xp=Ud.prototype.add,Gp=Ud.prototype.addSpace,Hp=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)&&Gp.call(this),Xp.call(this,t,{proportion:i,expand:!0});var n=!this.buttonsExpand&&"center"===this.buttonsAlign;n&&Gp.call(this),this.hasTailSpace=n;}else Xp.call(this,t,{proportion:i,expand:!0}),this.hasTailSpace=!1;else if(this.hasTailSpace){var r=this.sizerChildren.length-1;Xp.call(this,t,{index:r,proportion:i,expand:!0});}else Xp.call(this,t,{proportion:i,expand:!0});return e&&this.buttonGroup.add(t),this},Vp={addButton:function(t){if(Lu(t))for(var e=t,i=0,n=e.length;i=0;i--)Kp.call(this,e[i],t);return this}},$p=function(t,e,i){if(t){var n=this.setValueCallback,r=this.setValueCallbackScope;n&&(r?n.call(r,t,e,i):n(t,e,i)),this.fireEvent("button.statechange",t,e,i);}},Zp=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 n=t._selected;t._selected=i,$p.call(e,t,i,n);}},enumerable:!0,configurable:!0}),t.selected=!1;},Qp={add:function(t){return this.buttons.push(t),t._click||(t._click=new Hu(t,this.clickConfig),t._click.on("click",(function(t,e,i,n){this.fireEvent("button.click",e,i,n);}),this).on("enable",(function(t,e){this.fireEvent("button.enable",e);}),this).on("disable",(function(t,e){this.fireEvent("button.disable",e);}),this),t.on("pointerover",(function(e,i,n,r){this.fireEvent("button.over",t,e,r);}),this).on("pointerout",(function(e,i){this.fireEvent("button.out",t,e,i);}),this).on("pointerdown",(function(e,i,n,r){this.fireEvent("button.down",t,e,r);}),this).on("pointerup",(function(e,i){this.fireEvent("button.up",t,e,i);}),this)),this.buttonsType&&(void 0===t.name&&console.error("".concat(this.parent.constructor.name,": Option button miss value")),Zp.call(this,t)),this},addMultiple:function(t){for(var e=0,i=t.length;e2?o-2:0),h=2;hr&&pf.addNewLine(this);}else for(s=0,o=t.length;s=0;i--)mf.call(this,e[i],t);return this}},bf=Phaser.Utils.Objects.GetValue,xf=function(t){r(o,t);var i=l(o);function o(t,n){var r;e(this,o),void 0===n&&(n={});var s=n.space;"number"==typeof s&&(n.space={item:s,line:s}),(r=i.call(this,t,n)).type="rexFixWidthButtons",r.buttonGroup=new af({parent:a(r),eventEmitter:bf(n,"eventEmitter",a(r)),groupName:bf(n,"groupName",void 0),clickConfig:bf(n,"click",void 0)}).setButtonsType(n);var h=bf(n,"background",void 0),l=bf(n,"buttons",void 0);return r.buttonsAlign=bf(n,"align",void 0),h&&r.addBackground(h),l&&r.addButtons(l),r.addChildrenMap("background",h),r.addChildrenMap("buttons",r.buttonGroup.buttons),r}return n(o,[{key:"destroy",value:function(t){this.scene&&!this.ignoreDestroy&&(c(s(o.prototype),"destroy",this).call(this,t),this.buttonGroup.destroy(),this.buttonGroup=void 0);}},{key:"buttons",get:function(){return this.buttonGroup.buttons}},{key:"groupName",get:function(){return this.buttonGroup.groupName},set:function(t){this.buttonGroup.groupName=t;}},{key:"eventEmitter",get:function(){return this.buttonGroup.eventEmitter}}]),o}(dp);Object.assign(xf.prototype,vf,kf,of,lf);var Cf=Lp.prototype.add,Sf={addButton:function(t,e,i){return Cf.call(this,t,e,i,void 0,0,this.buttonsExpand),this.buttonGroup.add(t),this},addButtons:function(t,e){for(var i=0,n=t;i=0;i--)Tf.call(this,e[i],t);return this}},_f=Phaser.Utils.Objects.GetValue,Ef=function(t){r(o,t);var i=l(o);function o(t,n){var r;e(this,o),void 0===n&&(n={});var s=_f(n,"row",0),h=_f(n,"column",n.col||0),l=_f(n,"createCellContainerCallback"),u=_f(n,"buttons",void 0),c=_f(n,"expand",!0),d=c?1:0;if(l&&(n.createCellContainerCallback=void 0),void 0!==u){s=Math.max(s,u.length);for(var p=0,f=u.length;p0?t.setText(e).getTextBounds().wrappedText.split("\n"):e.split("\n");}return i},iv=function(t){return Array.isArray(t)?t=t.join("\n"):"number"==typeof t&&(t=t.toString()),t},nv={clearText:function(){return this.sections.length=0,this.pageStartIndexes.length=0,this.lines.length=0,this},appendPage:function(t){var e=this.totalLinesCount;this.sections.push(iv(t));t=this.sections.join("\n");this.lines=ev(this.parent,t,this.lines);for(var i=this.totalLinesCount-e,n=Math.ceil(i/this.pageLinesCount),r=0;r=this.pageCount-1}},{key:"totalLinesCount",get:function(){return this.lines?this.lines.length:0}},{key:"startLineIndex",get:function(){return this._startLineIndex},set:function(t){t=uv(t,0,this.totalLinesCount-1),this._startLineIndex=t;}},{key:"setStartLineIndex",value:function(t){return this.startLineIndex=t,this}},{key:"pageLinesCount",get:function(){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,n;switch(tv(t)){case 0:case 1:e=t.height-t.padding.top-t.padding.bottom,i=t.lineSpacing,n=t.style.metrics.fontSize+t.style.strokeThickness;break;case 2:e=t.height,i=0;var r=t.fontSize/t.fontData.size;n=t.fontData.lineHeight*r;}return (e-i)/(n+i)}(this.parent));break;case 2:t=this.totalLinesCount;}return t}},{key:"content",get:function(){return this.sections.join(this.pageBreak)}}]),o}(Lh);Object.assign(cv.prototype,hv);var dv=Phaser.Utils.Objects.GetFastValue,pv=Phaser.Utils.Objects.GetValue,fv=function(t){r(o,t);var i=l(o);function o(t,n){var r;return e(this,o),(r=i.call(this,t,n)).timer=null,r.resetFromJSON(n),r}return n(o,[{key:"resetFromJSON",value:function(t){this.setTextWrapEnable(pv(t,"wrap",!1)),this.setTypeMode(pv(t,"typeMode",0)),this.setTypingSpeed(pv(t,"speed",333)),this.setTextCallback=dv(t,"setTextCallback",null),this.setTextCallbackScope=dv(t,"setTextCallbackScope",null),this.setTypingContent(dv(t,"text","")),this.typingIdx=dv(t,"typingIdx",0),this.insertIdx=null,this.insertChar=null;var e=dv(t,"elapsed",null);return null!==e&&this.start(void 0,void 0,this.typingIdx,e),this}},{key:"shutdown",value:function(t){this.isShutdown||(this.freeTimer(),c(s(o.prototype),"shutdown",this).call(this,t));}},{key:"setTypeMode",value:function(t){return "string"==typeof t&&(t=gv[t]),this.typeMode=t,this}},{key:"setTypeSpeed",value:function(t){return this.speed=t,this}},{key:"setTypingSpeed",value:function(t){return this.speed=t,this}},{key:"setTextWrapEnable",value:function(t){return void 0===t&&(t=!0),this.textWrapEnable=t,this}},{key:"text",get:function(){return this._text},set:function(t){var e=vv(t);this.textWrapEnable&&(e=function(t,e){switch(tv(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;}},{key:"isTyping",get:function(){return null!==this.getTimer()}},{key:"isLastChar",get:function(){return this.typingIdx===this.textLen}},{key:"start",value:function(t,e,i,n){return void 0!==t&&this.setTypingContent(t),void 0!==e&&(this.speed=e),void 0===i&&(i=0),this.typingIdx=i+1,0===this.speed?this.stop(!0):(this.setText(""),this.startTimer(n)),this}},{key:"appendText",value:function(t){var e=this.text.concat(vv(t));return this.isTyping?this.setTypingContent(e):this.start(e,void 0,this.textLen),this}},{key:"stop",value:function(t){if(this.getTimer()&&this.freeTimer(),t){for(;!this.isLastChar;)this.getTypingString(this.text,this.typingIdx,this.textLen,this.typeMode),this.emit("typechar",this.insertChar),this.typingIdx++;this.setText(this.text),this.emit("type"),this.emit("complete",this,this.parent);}return this}},{key:"pause",value:function(){var t=this.getTimer();return t&&(t.paused=!0),this}},{key:"resume",value:function(){var t=this.getTimer();return t&&(t.paused=!1),this}},{key:"setTypingContent",value:function(t){return this.text=t,this.textLen=this.getTextLength(this.text),this}},{key:"onTyping",value:function(){var t=this.getTypingString(this.text,this.typingIdx,this.textLen,this.typeMode);this.setText(t),this.emit("typechar",this.insertChar),this.emit("type"),this.isLastChar?(this.freeTimer(),this.emit("complete",this,this.parent)):(this.timer.delay=this.speed,this.typingIdx++);}},{key:"getTypingString",value:function(t,e,i,n){var r;if(0===n){var s=0,o=e;this.insertIdx=o,r=this.getSubString(t,s,o);}else if(1===n){s=(o=i)-e;this.insertIdx=0,r=this.getSubString(t,s,o);}else if(2===n){var a=i/2;o=(s=Math.floor(a-e/2))+e;this.insertIdx=e%2?e:0,r=this.getSubString(t,s,o);}else if(3===n){var h,l=Math.floor(e/2);if(l>0){s=(o=i)-l;h=this.getSubString(t,s,o);}else h="";var u,c=e-l;if(c>0){o=(s=0)+c;this.insertIdx=o,u=this.getSubString(t,s,o);}else u="",this.insertIdx=0;r=u+h;}return this.insertChar=r.charAt(this.insertIdx-1),r}},{key:"startTimer",value:function(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}},{key:"getTimer",value:function(){return this.timer}},{key:"freeTimer",value:function(){return this.timer&&(this.timer.remove(),this.timer=null),this}},{key:"setText",value:function(t){this.setTextCallback&&(t=this.setTextCallbackScope?this.setTextCallback.call(this.setTextCallbackScope,t,this.isLastChar,this.insertIdx):this.setTextCallback(t,this.isLastChar,this.insertIdx)),this.textWrapEnable?ov(this.parent,t):this.parent.setText(t);}},{key:"getTextLength",value:function(t){var e=this.parent;return e.getPlainText?e.getPlainText(t).length:t.length}},{key:"getSubString",value:function(t,e,i){var n=this.parent;return n.getSubString?n.getSubString(t,e,i):t.slice(e,i)}}]),o}(Lh),vv=function(t){return Array.isArray(t)?t=t.join("\n"):"number"==typeof t&&(t=t.toString()),t},gv={"left-to-right":0,"right-to-left":1,"middle-to-sides":2,"sides-to-middle":3},yv=Phaser.Utils.Objects.GetValue,mv=Phaser.Utils.Objects.GetValue,kv=Phaser.Utils.Objects.GetValue,bv=Phaser.Utils.Objects.GetValue,xv=[function(t){var e=this.scene,i=mv(t,"orientation",0);this.setOrientation(i);var n=mv(t,"icon",void 0),r=mv(t,"iconMask",void 0),s=mv(t,"innerBackground",void 0),o=mv(t,"title",void 0),a=mv(t,"separator",void 0),h=mv(t,"text",void 0),l=mv(t,"action",void 0),u=mv(t,"actionMask",void 0);if(n){g=0===this.orientation?{right:mv(t,"space.icon",0),top:mv(t,"space.iconTop",0),bottom:mv(t,"space.iconBottom",0),left:mv(t,"space.iconLeft",0)}:{bottom:mv(t,"space.icon",0),left:mv(t,"space.iconLeft",0),right:mv(t,"space.iconRight",0),top:mv(t,"space.iconTop",0)};var c=mv(t,"squareFitIcon",!1)?1:0;if(this.add(n,{proportion:0,padding:g,fitRatio:c}),r&&(r=Bf.call(this,n,n,1)),!c){var d=mv(t,"iconSize",void 0);this.setIconSize(mv(t,"iconWidth",d),mv(t,"iconHeight",d));}}var p=new Ud(e,{orientation:1});s&&p.addBackground(s);var f=mv(t,"space.separator",0);if(o){var v=mv(t,"align.title","left"),g={bottom:!a&&h?f:0,left:mv(t,"space.titleLeft",0),right:mv(t,"space.titleRight",0)};p.add(o,{proportion:0,align:v,padding:g});}if(a){g={top:o?f:0,bottom:h?f:0,left:mv(t,"space.separatorLeft",0),right:mv(t,"space.separatorRight",0)};p.add(a,{expand:!0,padding:g});}if(h){v=mv(t,"align.text","left"),g={left:mv(t,"space.textLeft",0),right:mv(t,"space.textRight",0)};p.add(h,{proportion:0,align:v,padding:g});}g=void 0;if(l&&(g={right:mv(t,"space.text",0)}),this.add(p,{proportion:1,padding:g}),l){g=0===this.orientation?{top:mv(t,"space.actionTop",0),bottom:mv(t,"space.actionBottom",0),right:mv(t,"space.actionRight",0)}:{left:mv(t,"space.actionLeft",0),right:mv(t,"space.actionRight",0),bottom:mv(t,"space.actionBottom",0)};c=mv(t,"squareFitAction",!1)?1:0;if(this.add(l,{proportion:0,padding:g,fitRatio:c}),u&&(u=Bf.call(this,l,l,1)),!c){var y=mv(t,"actionSize");this.setActionSize(mv(t,"actionWidth",y),mv(t,"actionHeight",y));}}this.addChildrenMap("icon",n),this.addChildrenMap("iconMask",r),this.addChildrenMap("innerSizer",p),this.addChildrenMap("innerBackground",s),this.addChildrenMap("title",o),this.addChildrenMap("separator",a),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=kv(t,"title",void 0),n=kv(t,"separator",void 0),r=kv(t,"innerBackground",void 0),s=kv(t,"icon",void 0),o=kv(t,"iconMask",void 0),a=kv(t,"text",void 0),h=kv(t,"action",void 0),l=kv(t,"actionMask",void 0);if(i){var u=kv(t,"align.title","left"),c={bottom:kv(t,"space.title",0),left:kv(t,"space.titleLeft",0),right:kv(t,"space.titleRight",0)};this.add(i,{proportion:0,align:u,padding:c});}if(n){var d=kv(t,"space.separator",0);c={top:i?d:0,bottom:a?d:0,left:kv(t,"space.separatorLeft",0),right:kv(t,"space.separatorRight",0)};this.add(n,{proportion:0,expand:!0,padding:c});}var p=kv(t,"orientation",0),f=new Ud(e,{orientation:p,rtl:kv(t,"rtl",!1),space:{left:kv(t,"space.innerLeft",0),right:kv(t,"space.innerRight",0),top:kv(t,"space.innerTop",0),bottom:kv(t,"space.innerBottom",0)}});if(r&&f.addBackground(r),this.add(f,{proportion:1,expand:!0}),s){c=void 0;c=0===f.orientation?{right:kv(t,"space.icon",0),top:kv(t,"space.iconTop",0),bottom:kv(t,"space.iconBottom",0),left:kv(t,"space.iconLeft",0)}:{bottom:kv(t,"space.icon",0),left:kv(t,"space.iconLeft",0),right:kv(t,"space.iconRight",0),top:kv(t,"space.iconTop",0)};var v=kv(t,"squareFitIcon",!1)?1:0;if(f.add(s,{proportion:0,padding:c,fitRatio:v}),o&&(o=Bf.call(this,s,s,1)),!v){var g=kv(t,"iconSize",void 0);this.setIconSize(kv(t,"iconWidth",g),kv(t,"iconHeight",g));}}if(a){u=kv(t,"align.text","left");var y,m,k=kv(t,"space.text",0),b=kv(t,"expandTextWidth",!1),x=kv(t,"expandTextHeight",!1);0===f.orientation?(y=b?1:0,h&&(c={right:k}),m=x):(y=x?1:0,h&&(c={bottom:k}),m=b),f.add(a,{proportion:y,expand:m,align:u,padding:c});}if(h){c=0===f.orientation?{top:kv(t,"space.actionTop",0),bottom:kv(t,"space.actionBottom",0),right:kv(t,"space.actionRight",0)}:{left:kv(t,"space.actionLeft",0),right:kv(t,"space.actionRight",0),bottom:kv(t,"space.actionBottom",0)};v=kv(t,"squareFitAction",!1)?1:0;if(f.add(h,{proportion:0,padding:c,fitRatio:v}),l&&(l=Bf.call(this,h,h,1)),!v){var C=kv(t,"actionSize");this.setActionSize(kv(t,"actionWidth",C),kv(t,"actionHeight",C));}}this.addChildrenMap("title",i),this.addChildrenMap("separator",n),this.addChildrenMap("innerSizer",f),this.addChildrenMap("innerBackground",r),this.addChildrenMap("icon",s),this.addChildrenMap("iconMask",o),this.addChildrenMap("text",a),this.addChildrenMap("action",h),this.addChildrenMap("actionMask",l);}],Cv=function(t){r(s,t);var i=l(s);function s(t,n){return e(this,s),void 0===n&&(n={}),n.hasOwnProperty("layoutMode")||(n.layoutMode=1),i.call(this,t,n)}return n(s)}(function(t,i){return void 0===i&&(i="rexTextBox"),function(t){r(o,t);var s=l(o);function o(t,n){var r;e(this,o),(r=s.call(this,t,n)).type=i;var h=r.childrenMap.text;return r.page=new cv(h,yv(n,"page",void 0)),r.typing=new fv(h,yv(n,"typing",n.type)),r.typing.on("complete",r.onPageEnd,a(r)).on("type",r.onType,a(r)).on("typechar",r.onTypeChar,a(r)),r.textWidth=h.width,r.textHeight=h.height,r}return n(o,[{key:"start",value:function(t,e){return this.page.setText(t),void 0!==e&&this.setTypingSpeed(e),this.emit("start"),this.typeNextPage(),this}},{key:"typeNextPage",value:function(){if(this.isLastPage)this.emit("complete");else {var t=this.page.getNextPage();this.typing.start(t);}return this}},{key:"pause",value:function(){return this.isTyping&&(this.typing.pause(),this.emit("pause")),this}},{key:"resume",value:function(){return this.isTyping||(this.emit("resume"),this.typing.resume()),this}},{key:"stop",value:function(t){return this.typing.stop(t),this}},{key:"showLastPage",value:function(){return this.typing.stop(),this.page.showLastPage(),this.emit("type"),this.onPageEnd(),this}},{key:"setTypeSpeed",value:function(t){return this.typing.setTypingSpeed(t),this}},{key:"setTypingSpeed",value:function(t){return this.typing.setTypingSpeed(t),this}},{key:"isTyping",get:function(){return this.typing.isTyping}},{key:"isLastPage",get:function(){return this.page.isLastPage}},{key:"isFirstPage",get:function(){return this.page.isFirstPage}},{key:"pageCount",get:function(){return this.page.pageCount}},{key:"pageIndex",get:function(){return this.page.pageIndex}},{key:"typingSpeed",get:function(){return this.typing.speed}},{key:"onType",value:function(){var t=this.childrenMap.text;this.textWidth===t.width&&this.textHeight===t.height||(this.textWidth=t.width,this.textHeight=t.height,this.getTopmostSizer().layout()),this.emit("type");}},{key:"onTypeChar",value:function(t){this.emit("typechar",t);}},{key:"onPageEnd",value:function(){var t=this.isLastPage;this.emit("pageend"),t&&this.emit("complete");}}]),o}(t)}(function(t){r(o,t);var i=l(o);function o(t,n){var r;e(this,o),(r=i.call(this,t,n)).type="rexTitleLabel";var s=bv(n,"background",void 0);s&&r.addBackground(s);var h=bv(n,"layoutMode",0);return (xv[h]||xv[0]).call(a(r),n),r.addChildrenMap("background",n.background),r}return n(o,[{key:"title",get:function(){var t=this.childrenMap.title;return t?t.title:""},set:function(t){var e=this.childrenMap.title;e&&e.setText(t);}},{key:"setTitle",value:function(t){return this.title=t,this}},{key:"resetDisplayContent",value:function(t){void 0===t?t={}:"string"==typeof t&&(t={text:t}),c(s(o.prototype),"resetDisplayContent",this).call(this,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}}]),o}(Af))),Sv=Phaser.Utils.Objects.GetValue,wv=function(t){r(s,t);var i=l(s);function s(t,n){var r;e(this,s),(r=i.call(this,t,n)).style=Sv(n,"style",a(r));var o=Sv(n,"propertiesMap");return r.activeStyle=Ov(n,"active",o),r.hoverStyle=Ov(n,"hover",o),r.disableStyle=Ov(n,"disable",o),r.onModifyStyle=Sv(n,"onModifyStyle"),r}return n(s,[{key:"getStyle",value:function(t){return function(t,e,i){if(void 0===i&&(i={}),Array.isArray(e))for(var n=0,r=e.length;n=t.dragThreshold?"DRAG":"DRAGBEGIN":"IDLE"}},{key:"update_DRAGBEGIN",value:function(t,e){this.next();}},{key:"next_DRAG",value:function(){var t,e=this.parent;return e.dragState.isUp&&(t=e.outOfBounds?"BACK":e.slidingEnable?"SLIDE":"IDLE"),t}},{key:"update_DRAG",value:function(t,e){var i=this.parent;i.dragState.justMoved&&i.dragging(),this.next();}},{key:"enter_DRAG",value:function(){this.parent.onDragStart();}},{key:"exit_DRAG",value:function(){this.parent.onDragEnd();}},{key:"next_SLIDE",value:function(){var t,e=this.parent;return e.dragState.isDown?t="DRAG":e.isSliding||(t="IDLE"),t}},{key:"enter_SLIDE",value:function(){this.parent.onSliding();}},{key:"exit_SLIDE",value:function(){this.parent.stop();}},{key:"update_SLIDE",value:function(t,e){this.parent.sliding(t,e),this.next();}},{key:"next_BACK",value:function(){var t,e=this.parent;return e.dragState.isDown?t="DRAG":e.isPullBack||(t="IDLE"),t}},{key:"enter_BACK",value:function(){this.parent.onPullBack();}},{key:"exit_BACK",value:function(){this.parent.stop();}},{key:"update_BACK",value:function(t,e){this.parent.pullBack(t,e),this.next();}}]),s}(ru),zg=Phaser.Utils.Objects.GetValue,Ig=Phaser.Math.Distance.Between,jg=function(t){r(o,t);var i=l(o);function o(t,n){var r;return e(this,o),(r=i.call(this,t,n))._enable=void 0,t.setInteractive(zg(n,"inputConfig",void 0)),r.resetFromJSON(n),r.boot(),r}return n(o,[{key:"resetFromJSON",value:function(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(zg(t,"enable",!0)),this.holdThreshold=zg(t,"holdThreshold",50),this.pointerOutReleaseEnable=zg(t,"pointerOutRelease",!0),this}},{key:"boot",value:function(){this.parent.on("pointerdown",this.onPointIn,this),this.parent.on("pointerup",this.onPointOut,this),this.pointerOutReleaseEnable&&this.parent.on("pointerout",this.onPointOut,this),this.parent.on("pointermove",this.onPointerMove,this),this.scene.sys.events.on("preupdate",this.preupdate,this);}},{key:"shutdown",value:function(t){this.isShutdown||(this.scene.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,c(s(o.prototype),"shutdown",this).call(this,t));}},{key:"enable",get:function(){return this._enable},set:function(t){this._enable!==t&&(t||(this.isInTouched=!1,this.pointer=void 0),this._enable=t);}},{key:"setEnable",value:function(t){return void 0===t&&(t=!0),this.enable=t,this}},{key:"toggleEnable",value:function(){return this.setEnable(!this.enable),this}},{key:"setPointerOutReleaseEnable",value:function(t){return void 0===t&&(t=!0),this.pointerOutReleaseEnable=t,this}},{key:"isDown",get:function(){return this.pointer&&this.pointer.isDown}},{key:"isUp",get:function(){return !this.isDown}},{key:"dx",get:function(){return this.x-this.preX}},{key:"dy",get:function(){return this.y-this.preY}},{key:"dt",get:function(){return zc(this.scene)}},{key:"speed",get:function(){return this.x===this.preX&&this.y===this.preY?0:Ig(this.preX,this.preY,this.x,this.y)/(.001*this.dt)}},{key:"speedX",get:function(){return this.dx/(.001*this.dt)}},{key:"speedY",get:function(){return this.dy/(.001*this.dt)}},{key:"onPointIn",value:function(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.pointer=t,this.localX=e,this.localY=i);}},{key:"onPointOut",value:function(t){this.enable&&this.pointer===t&&(this.pointer=void 0);}},{key:"onPointerMove",value:function(t,e,i){this.enable&&t.isDown&&this.pointer===t&&(this.localX=e,this.localY=i);}},{key:"preupdate",value:function(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));}}}]),o}(Lh),Bg=Phaser.Utils.Objects.GetValue,Fg=function(){function t(i){e(this,t),this.resetFromJSON(i);}return n(t,[{key:"resetFromJSON",value:function(t){return this.setValue(Bg(t,"value",0)),this.setSpeed(Bg(t,"speed",0)),this.setAcceleration(Bg(t,"acceleration",0)),this}},{key:"reset",value:function(){this.setValue(0),this.setSpeed(0),this.setAcceleration(0);}},{key:"setValue",value:function(t){return this.value=t,this}},{key:"setSpeed",value:function(t){return this.speed=t,this}},{key:"setAcceleration",value:function(t){return this.acceleration=t,this}},{key:"updateSpeed",value:function(t){return 0!==this.acceleration&&(this.speed+=this.acceleration*t,this.speed<0&&(this.speed=0)),this}},{key:"getDeltaValue",value:function(t){return this.updateSpeed(t),this.speed<=0?0:this.speed*t}},{key:"update",value:function(t){return this.updateSpeed(t),this.speed>0&&(this.value+=this.getDeltaValue(t)),this}},{key:"isMoving",get:function(){return this.speed>0}}]),t}(),Wg=function(){function t(){e(this,t),this.value,this.dir,this.movement=new Fg;}return n(t,[{key:"init",value:function(t,e,i,n,r){return this.value=t,this.end=r,this.dir=void 0!==r?tthis.end&&(this.value=this.end):this.valuethis.maxValue}},{key:"overMin",value:function(t){return null!=this.minValue&&t0,Math.abs(e),i);}},{key:"sliding",value:function(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;}},{key:"onPullBack",value:function(){var t=this.value,e=this.outOfMinBound?this.minValue:this.maxValue,i=Math.abs(e-t),n=this.backDeceleration,r=Math.sqrt(2*n*i);this._slowDown.init(t,void 0,r,n,e);}},{key:"pullBack",value:function(t,e){e*=.001,this.value=this._slowDown.update(e).value,this._slowDown.isMoving||this._state.next();}},{key:"stop",value:function(){this._slowDown.stop();}}]),o}(Lh),Gg={y:0,v:0,vertical:0,x:1,h:1,horizontal:1},Hg=Phaser.Utils.Objects.GetValue,Vg=function(t){r(s,t);var i=l(s);function s(t,n){var r;(e(this,s),(r=i.call(this,t,n)).parent!==r.scene?r.focusMode=Hg(n,"focus",!1):r.focusMode=!1,r.setSpeed(Hg(n,"speed",.1)),r.setEnable(Hg(n,"enable",!0)),r.focusMode)?(t=r.parent).setInteractive(Hg(n,"inputConfig",void 0)).on("wheel",(function(t,e,i,n,r){this.enable&&this.scroll(i);}),a(r)):r.scene.input.on("wheel",r.onSceneScroll,a(r));return r}return n(s,[{key:"destroy",value:function(){this.focusMode||this.scene.input.off("wheel",this.onSceneScroll,this);}},{key:"onSceneScroll",value:function(t,e,i,n,r,s){this.enable&&this.scroll(n);}},{key:"setEnable",value:function(t){return void 0===t&&(t=!0),this.enable=t,this}},{key:"setSpeed",value:function(t){return this.speed=t,this}},{key:"scroll",value:function(t){t*=this.speed,this.emit("scroll",t,this.parent,this);}}]),s}(Lh),Ug=Phaser.Utils.Objects.GetValue,Jg=function(t,e,i,n){var r,s,o,a,h="Y"===(i=i.toUpperCase()),l=2===t.scrollMode,u=t.childrenMap.child,c="slider".concat(i);if(r=l||n.hasOwnProperty(c)?Ug(n,c,void 0):Ug(n,"slider",void 0)){var d,p,f;!0===r&&(r={}),r.orientation=h?1:0,s=function(t,e){void 0===e&&(e={});var i=qi(e);(e={slider:i}).orientation=i.orientation,delete i.orientation,e.background=i.background,delete i.background,e.buttons=i.buttons,delete i.buttons;var n=new Mg(t,e);t.add.existing(n);var r=n.childrenMap.slider;return n.addChildrenMap("track",r.childrenMap.track),n.addChildrenMap("indicator",r.childrenMap.indicator),n.addChildrenMap("thumb",r.childrenMap.thumb),n}(t.scene,r);var v=Ug(r,"position",0);"string"==typeof v&&(v=Kg[v]);var g=Ug(n,"space.slider".concat(i),void 0);void 0===g&&void 0===(g=Ug(n,"space.slider",void 0))&&(g=l?0:Ug(n,"space.child",0));var y="number"==typeof g;h?0===v?(d=2,p=1,f=y?{left:g}:g):(d=0,p=1,f=y?{right:g}:g):0===v?(d=1,p=2,f=y?{top:g}:g):(d=1,p=0,f=y?{bottom:g}:g),e.add(s,{column:d,row:p,align:"center",padding:f,expand:!0}),t["hideUnscrollableSlider".concat(i)]=Ug(r,"hideUnscrollableSlider",!1),t["adaptThumb".concat(i,"SizeMode")]=Ug(r,"adaptThumbSize",!1),t["minThumb".concat(i,"Size")]=Ug(r,"minThumbSize",void 0);}else t["hideUnscrollableSlider".concat(i)]=!1,t["adaptThumb".concat(i,"SizeMode")]=!1,t["minThumb".concat(i,"Size")]=void 0;var m="scroller".concat(i);(o=l||n.hasOwnProperty(m)?Ug(n,m,!0):Ug(n,"scroller",!0))&&u&&(!0===o&&(o={}),o.orientation=h?0:1,a=new Xg(u,o));var k,b,x,C,S=Ug(n,l?"mouseWheelScroller".concat(i):"mouseWheelScroller",!1);(S&&u&&(k=new Vg(u,S)),t.addChildrenMap("slider".concat(i),s),t.addChildrenMap("scroller".concat(i),a),t.addChildrenMap("mouseWheelScroller".concat(i),k),l&&!h||(t.hideUnscrollableSlider=t["hideUnscrollableSlider".concat(i)],t.adaptThumbSizeMode=t["adaptThumb".concat(i,"SizeMode")],t.minThumbSize=t["minThumb".concat(i,"Size")],t.addChildrenMap("slider",s),t.addChildrenMap("scroller",a),t.addChildrenMap("mouseWheelScroller",k)),s)&&(l?(b=h?"t":"s",C="scroll".concat(i)):(b="t",C="scroll"),s.on("valuechange",(function(e){t[b]=e,t.emit(C,t);})));a&&(l?(x="childO".concat(i),C="scroll".concat(i)):(x="childOY",C="scroll"),a.on("valuechange",(function(e){t[x]=e,t.emit(C,t);})));if(k){var w="addChildO".concat(i);k.on("scroll",(function(e){t[w](-e,!0);}));}},Kg={right:0,left:1,bottom:0,top:1},qg=Phaser.Utils.Objects.GetValue,$g=function(t,e){var i=t.scene,n=[0,1,0],r=[0,1,0],s=qg(e,"width"),o=qg(e,"height");s||(n[1]=0),o||(r[1]=0);var a=new Lp(i,{column:3,row:3,columnProportions:n,rowProportions:r});switch(function(t,e,i){var n=Ag(i,"child"),r=Ag(n,"gameObject",void 0);if(r){var s=Ag(i,"space.child",0);t.childMargin={};var o=t.childMargin,a={};if("number"==typeof s)switch(t.scrollMode){case 0:case 1:o.top=0,o.bottom=0,o.left=0,o.right=0;break;default:o.top=s,o.bottom=s,o.left=s,o.right=s;}else switch(t.scrollMode){case 0:o.top=Ag(s,"top",0),o.bottom=Ag(s,"bottom",0),a.left=Ag(s,"left",0),a.right=Ag(s,"right",0);break;case 1:o.top=Ag(s,"left",0),o.bottom=Ag(s,"right",0),a.top=Ag(s,"top",0),a.bottom=Ag(s,"bottom",0);break;default:o.top=Ag(s,"top",0),o.bottom=Ag(s,"bottom",0),o.left=Ag(s,"left",0),o.right=Ag(s,"right",0);}e.add(r,{column:1,row:1,align:Ag(n,"align","center"),padding:a,expand:{width:Ag(n,"expandWidth",!0),height:Ag(n,"expandHeight",!0)}});}t.addChildrenMap("child",r);}(t,a,e),t.scrollMode){case 0:Jg(t,a,"y",e);break;case 1:Jg(t,a,"x",e);break;default:Jg(t,a,"y",e),Jg(t,a,"x",e);}return a},Zg=function(t){var e,i,n,r;switch(this.scrollMode){case 0:case 1:e=this.topChildOY,i=this.bottomChildOY,n=this.childrenMap.scroller,r=this.childrenMap.slider;break;default:"Y"===(t=t.toUpperCase())?(e=this.topChildOY,i=this.bottomChildOY):(e=this.leftChildOX,i=this.rightChildOX),n=this.childrenMap["scroller".concat(t)],r=this.childrenMap["slider".concat(t)];}n&&n.setBounds(e,i),r&&r.setEnable(e!==i);},Qg=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".concat(t)],i=this["hideUnscrollableSlider".concat(t)],n=this["isOverflow".concat(t)];e&&i&&this.setChildVisible(e,n);}},ty=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,n=a.childrenMap.thumb,r=this.minThumbSize;if(0===this.scrollMode){var s=i.displayHeight*e;void 0!==r&&sthis.topTextOY}},{key:"textOYExeceedBottom",value:function(t){return void 0===t&&(t=this.textOY),tthis.linesCount?t=0:n?t=e:r&&(t=i)),this._textOY!==t&&(this._textOY=t,this.updateTextObject()),n&&(this.execeedTopState||this.emit("execeedtop",this,t,e)),this.execeedTopState=n,r&&(this.execeedBottomState||this.emit("execeedbottom",this,t,i)),this.execeedBottomState=r;}},{key:"setTextOY",value:function(t){return this.textOY=t,this}},{key:"t",get:function(){var t=this.textVisibleHeight;return 0===t?0:this.textOY/-t},set:function(t){this.textOY=-this.textVisibleHeight*t;}},{key:"setTextOYByPercentage",value:function(t){return this.t=t,this}}]),o}(Td),yy=function(t){return t.add.text(0,0,"")};Object.assign(gy.prototype,dy);Phaser.Math.Clamp;var my={scrollToLine:function(t){return this.setChildOY(-this.lineHeight*t),this},scrollToNextLine:function(t){void 0===t&&(t=1);var e=this.lineIndex+t;return this.scrollToLine(e),this}},ky=Phaser.Utils.Objects.GetValue,by=function(t){r(s,t);var i=l(s);function s(t,n){var r;e(this,s),void 0===n&&(n={}),n.scrollMode=0;var o=ky(n,"text",void 0),a=ky(n,"textWidth",void 0),h=ky(n,"textHeight",void 0),l=ky(n,"textCrop",!!o.setCrop),u=ky(n,"textMask",!l),c=ky(n,"content",""),d=new gy(t,{width:a,height:h,text:o,textMask:u,textCrop:l&&!u,content:c,clamplTextOY:ky(n,"clamplChildOY",!1),alwaysScrollable:ky(n,"alwaysScrollable",!1)});t.add.existing(d),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}});}(d),n.scrollMode=0,n.type="rexTextArea",n.child={gameObject:d,expandWidth:void 0===a,expandHeight:void 0===h};var p=ky(n,"space",void 0);return p&&(p.child=ky(p,"text",0)),(r=i.call(this,t,n)).addChildrenMap("text",o),r}return n(s,[{key:"text",get:function(){return this.childrenMap.child.text}},{key:"lineHeight",get:function(){var t=this.childrenMap.child;return t.textLineHeight+t.textLineSpacing}},{key:"lineIndex",get:function(){return Math.floor(-this.childOY/this.lineHeight)}},{key:"linesCount",get:function(){return this.childrenMap.child.linesCount}},{key:"contentHeight",get:function(){return this.childrenMap.child.textHeight}}]),s}(ry);Object.assign(by.prototype,{setText:function(t){return this.childrenMap.child.setText(t),this.resizeController(),this},appendText:function(t){return this.setText(this.text+t),this}},my);var xy=Np.prototype.add,Cy=function(t,e,i,n,r,s,o,a,h){return t.setVisible(!1),xy.call(this,t,e,i,n,r,s,o,a,h),this},Sy={add:Cy,addPage:Cy},wy=wa.prototype.setChildVisible,Oy={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?(wy.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 n=this.currentPage;return n&&(wy.call(this,n,!0),this.emit("pagevisible",n,this._currentKey,this),void 0===e&&(e=this.fadeInDuration),e>0&&n.setAlpha(0).fadeIn(e,1)),this},hasPage:function(t){return this.sizerChildren.hasOwnProperty(t)}};Object.assign(Oy,Sy);var Ty=Phaser.Utils.Objects.GetValue,Py=function(t){r(s,t);var i=l(s);function s(t,n){var r;return e(this,s),(r=i.call(this,t,n)).type="rexPages",r.childrenMap=r.sizerChildren,r._previousKey=void 0,r._currentKey=void 0,r.setSwapMode(Ty(n,"swapMode",0)),r.setFadeInDuration(Ty(n,"fadeIn",0)),r}return n(s,[{key:"setSwapMode",value:function(t){return "string"==typeof t&&(t=_y[t]),this.swapMode=t,this}},{key:"setFadeInDuration",value:function(t){return this.fadeInDuration=t,this}},{key:"previousKey",get:function(){return this._previousKey}},{key:"currentKey",get:function(){return this._currentKey},set:function(t){this.swapPage(t);}},{key:"currentPage",get:function(){return this.getPage(this.currentKey)}},{key:"previousPage",get:function(){return this.getPage(this.previousKey)}},{key:"keys",get:function(){return Object.keys(this.sizerChildren)}}]),s}(Np);Object.assign(Py.prototype,Oy);var _y={invisible:0,destroy:1},Ey=function(t,e){t.popUp(e);},My=function(t,e){t.scaleDown(e);},Ry=function(t,e){t.fadeIn(e);},Ly=function(t,e){t.fadeOut(e);},Ay=Phaser.Utils.Objects.GetValue,Dy=function(t){r(o,t);var i=l(o);function o(){return e(this,o),i.apply(this,arguments)}return n(o,[{key:"startTicking",value:function(){c(s(o.prototype),"startTicking",this).call(this),this.scene.sys.events.on("update",this.update,this);}},{key:"stopTicking",value:function(){c(s(o.prototype),"stopTicking",this).call(this),this.scene&&this.scene.sys.events.off("update",this.update,this);}},{key:"update",value:function(t,e){return this.isRunning&&0!==this.timeScale?(this.tick(e),this):this}}]),o}(function(t){r(o,t);var i=l(o);function o(t,n){var r;return e(this,o),(r=i.call(this,t,n)).resetFromJSON(n),r.boot(),r}return n(o,[{key:"resetFromJSON",value:function(t){return this.isRunning=Ay(t,"isRunning",!1),this.timeScale=Ay(t,"timeScale",1),this.now=Ay(t,"now",0),this}},{key:"toJSON",value:function(){return {isRunning:this.isRunning,timeScale:this.timeScale,now:this.now,tickingMode:this.tickingMode}}},{key:"start",value:function(t){return void 0===t&&(t=0),this.delta=0,this.now=t,c(s(o.prototype),"start",this).call(this),this}},{key:"seek",value:function(t){return this.now=t,this}},{key:"setTimeScale",value:function(t){return this.timeScale=t,this}},{key:"tick",value:function(t){return t*=this.timeScale,this.now+=t,this.delta=t,this.emit("update",this.now,this.delta),this}}]),o}(zh)),zy=function(t,e,i,n){void 0===i&&(i=0),void 0===n&&(n=e.length),t.length=n-i;for(var r=0,s=t.length;r=0;o--)r=t(e[o],i,n);else for(var o=0,a=e.length;on?1:it)return this;for(var e=this.commands.length-1;;){var i=this.commands[this.index],n=i[1];if(Lu(n)||(n=zy(Gy,i,1)),Fy(n,this.scope),this.emit("runcommand",n,this.scope),this.index===e)return this.complete(),this;if(this.index++,this.nextTime=this.getNextDt(this.nextTime),this.nextTime>t)return this}}},{key:"complete",value:function(){this.clock.stop(),this.state=2,this.emit("complete",this.parent,this);}},{key:"getNextDt",value:function(t){var e=this.commands[this.index][0];return 1===this.timeUnit&&(e*=1e3),1===this.dtMode&&(e+=t),e}},{key:"setDtMode",value:function(t){return "string"==typeof t&&(t=Vy[t]),this.dtMode=t,this}},{key:"setTimeUnit",value:function(t){return "string"==typeof t&&(t=Hy[t]),this.timeUnit=t,this}}]),o}(Lh),Gy=[],Hy={ms:0,s:1,sec:1},Vy={abs:0,absolute:0,inc:1,increment:1},Uy=Phaser.Utils.Objects.GetValue,Jy=function(t){r(o,t);var i=l(o);function o(t,n){var r;return e(this,o),void 0===n&&(n={text:createDefaultTextObject(t)}),(r=i.call(this,t,n)).type="rexToast",r.setTransitInTime(Uy(n,"duration.in",200)),r.setDisplayTime(Uy(n,"duration.hold",1200)),r.setTransitOutTime(Uy(n,"duration.out",200)),r.setTransitInCallback(Uy(n,"transitIn",Ky.popUp)),r.setTransitOutCallback(Uy(n,"transitOut",Ky.scaleDown)),r.player=new Xy(a(r),{dtMode:1}),r.messages=[],r.scaleX0=void 0,r.scaleY0=void 0,r.setVisible(!1),r}return n(o,[{key:"destroy",value:function(t){this.scene&&!this.ignoreDestroy&&(this.player.destroy(),this.player=void 0,this.messages=void 0,c(s(o.prototype),"destroy",this).call(this,t));}},{key:"setDisplayTime",value:function(t){return this.displayTime=t,this}},{key:"setTransitOutTime",value:function(t){return this.transitOutTime=t,this}},{key:"setTransitInTime",value:function(t){return this.transitInTime=t,this}},{key:"setTransitInCallback",value:function(t){switch("string"==typeof t&&(t=Ky[t]),t){case Ky.popUp:t=Ey;break;case Ky.fadeIn:t=Ry;}return t||(t=$i),this.transitInCallback=t,this}},{key:"setTransitOutCallback",value:function(t){switch("string"==typeof t&&(t=Ky[t]),t){case Ky.scaleDown:t=My;break;case Ky.fadeOut:t=Ly;}return t||(t=$i),this.transitOutCallback=t,this}},{key:"setScale",value:function(t,e){return void 0===e&&(e=t),this.scaleX0=t,this.scaleY0=e,c(s(o.prototype),"setScale",this).call(this,t,e),this}},{key:"showMessage",value:function(t){if(void 0===this.scaleX0&&(this.scaleX0=this.scaleX),void 0===this.scaleY0&&(this.scaleY0=this.scaleY),void 0===t){if(0===this.messages.length)return this;t=this.messages.shift();}if(this.player.isPlaying)return this.messages.push(t),this;this.setScale(this.scaleX0,this.scaleY0).setVisible(!0),"string"==typeof t?this.setText(t):t(this),this.layout();var e=[[0,[this.transitInCallback,this,this.transitInTime]],[this.transitInTime,[$i]],[this.displayTime,[this.transitOutCallback,this,this.transitOutTime]],[this.transitOutTime,[this.setVisible,!1]],[30,[$i]]];return this.player.load(e,this).once("complete",(function(){this.showMessage();}),this).start(),this}}]),o}(Wf),Ky={popUp:0,fadeIn:1,scaleDown:0,fadeOut:1},qy=Phaser.GameObjects.GetCalcMatrix,$y=Phaser.Renderer.Canvas.SetTransform,Zy={renderWebGL:function(t,e,i,n){e.updateData(),i.addToRenderList(e);var r=t.pipelines.set(e.pipeline),s=qy(e,i,n),o=r.calcMatrix.copyFrom(s.calc),a=e._displayOriginX,h=e._displayOriginY,l=i.alpha*e.alpha;t.pipelines.preBatch(e);for(var u=e.geom,c=0,d=u.length;c0,o=0,a=e.length;o0&&t.arc(e,i,r,o,s,!a)),t.close(),t},Rm={buildShapes:function(){this.addShape((new Pm).setName("track")).addShape((new Pm).setName("bar")).addShape((new am).setName("center"));},updateShapes:function(){var t=this.radius,e=this.thickness*this.radius,i=this.radius,n=i-e,r=this.getShape("track");null!=this.trackColor&&this.thickness>0?(r.fillStyle(this.trackColor),Mm(r,t,t,i,n,0,360,!1)):r.reset();var s=this.getShape("bar");if(null!=this.barColor&&this.thickness>0){var o,a,h;if(1===this.value)o=!1,a=0,h=360;else o=this.anticlockwise,a=_m(this.startAngle),h=360*(o?1-this.value:this.value)+a;s.fillStyle(this.barColor),Mm(s,t,t,i,n,a,h,!1);}else s.reset();var l=this.getShape("center");this.centerColor&&n>0?l.setCenterPosition(t,t).setRadius(n).fillStyle(this.centerColor):l.reset();}},Lm=Phaser.Utils.Objects.GetValue,Am=Phaser.Utils.Objects.IsPlainObject,Dm=Phaser.Math.Clamp,zm=Phaser.Math.DegToRad(270),Im=function(t){r(o,t);var i=l(o);function o(t,n,r,s,a,h,l){var u;e(this,o),Am(n)&&(n=Lm(l=n,"x",0),r=Lm(l,"y",0),s=Lm(l,"radius",1),a=Lm(l,"barColor",void 0),h=Lm(l,"value",0)),void 0===s&&(s=1);var c=2*s;return (u=i.call(this,t,n,r,c,c)).type="rexCircularProgress",u.bootProgressBase(l),u.setRadius(s),u.setTrackColor(Lm(l,"trackColor",void 0)),u.setBarColor(a),u.setCenterColor(Lm(l,"centerColor",void 0)),u.setThickness(Lm(l,"thickness",.2)),u.setStartAngle(Lm(l,"startAngle",zm)),u.setAnticlockwise(Lm(l,"anticlockwise",!1)),u.buildShapes(),u.setValue(h),u}return n(o,[{key:"resize",value:function(t,e){return (t=Math.floor(Math.min(t,e)))===this.width||(c(s(o.prototype),"resize",this).call(this,t,t),this.setRadius(t/2)),this}},{key:"radius",get:function(){return this._radius},set:function(t){this.dirty=this.dirty||this._radius!=t,this._radius=t;var e=2*t;this.resize(e,e);}},{key:"setRadius",value:function(t){return this.radius=t,this}},{key:"trackColor",get:function(){return this._trackColor},set:function(t){this.dirty=this.dirty||this._trackColor!=t,this._trackColor=t;}},{key:"setTrackColor",value:function(t){return this.trackColor=t,this}},{key:"barColor",get:function(){return this._barColor},set:function(t){this.dirty=this.dirty||this._barColor!=t,this._barColor=t;}},{key:"setBarColor",value:function(t){return this.barColor=t,this}},{key:"startAngle",get:function(){return this._startAngle},set:function(t){this.dirty=this.dirty||this._startAngle!=t,this._startAngle=t;}},{key:"setStartAngle",value:function(t){return this.startAngle=t,this}},{key:"anticlockwise",get:function(){return this._anticlockwise},set:function(t){this.dirty=this.dirty||this._anticlockwise!=t,this._anticlockwise=t;}},{key:"setAnticlockwise",value:function(t){return void 0===t&&(t=!0),this.anticlockwise=t,this}},{key:"thickness",get:function(){return this._thickness},set:function(t){t=Dm(t,0,1),this.dirty=this.dirty||this._thickness!=t,this._thickness=t;}},{key:"setThickness",value:function(t){return this.thickness=t,this}},{key:"centerColor",get:function(){return this._centerColor},set:function(t){this.dirty=this.dirty||this._centerColor!=t,this._centerColor=t;}},{key:"setCenterColor",value:function(t){return this.centerColor=t,this}}]),o}(Zv(em));Object.assign(Im.prototype,Rm);var jm=Phaser.Math.Distance.Between,Bm=function(t,e,i){var n=t.width/2;return jm(n,n,e,i)<=n},Fm=Phaser.Math.Angle.Between,Wm=Phaser.Math.Angle.Normalize,Ym=function(t,e,i){if(this.enable&&t.isDown){var n=this.sizerChildren.knob;if(Bm(n,e,i)){var r=n.width/2,s=n.startAngle,o=Fm(r,r,e,i),a=n.anticlockwise?s-o:o-s,h=Wm(a)/(2*Math.PI);this.stopEaseValue(),0===this.easeValueDuration||Math.abs(this.value-h)<.1?this.value=h:this.easeValueTo(h);}}},Nm=function(){this.sizerChildren.knob.on("pointerdown",Ym,this).on("pointermove",Ym,this).setInteractive();},Xm=Phaser.Math.Angle.Between,Gm=Phaser.Math.Angle.Wrap,Hm=function(t,e,i){if(this.enable&&!this.panPointer){var n=this.sizerChildren.knob;Bm(n,e,i)&&Jm.call(this,t);}},Vm=function(t,e,i){if(this.enable&&t.isDown){var n=this.sizerChildren.knob;switch(this.panState){case $m:Bm(n,e,i)&&Jm.call(this,t);break;case Zm:Bm(n,e,i)?qm.call(this):Km.call(this);}}},Um=function(t,e,i){this.enable&&this.panPointer===t&&Km.call(this);},Jm=function(t){this.panPointer=t,this.panState=Zm;},Km=function(){this.panPointer=void 0,this.panState=$m;},qm=function(){var t=this.panPointer.prevPosition,e=this.panPointer.position,i=this.sizerChildren.knob,n=Xm(i.x,i.y,t.x,t.y),r=Xm(i.x,i.y,e.x,e.y),s=i.anticlockwise?n-r:r-n,o=Gm(s)/(2*Math.PI);this.stopEaseValue(),this.value+=o;},$m=0,Zm=1,Qm=function(){this.sizerChildren.knob.on("pointerdown",Hm,this).on("pointermove",Vm,this).on("pointerup",Um,this).setInteractive(),this.panPointer=void 0,this.panState=$m;},tk=function(t){return void 0===t&&(t=this.value),this.textFormatCallbackScope?this.textFormatCallback(t):this.textFormatCallback.call(this.textFormatCallbackScope,t)},ek={setTextFormatCallback:function(t,e){return this.textFormatCallback=t,this.textFormatCallbackScope=e,this},getFormatText:tk,updateText:function(t){var e=this.sizerChildren.text;return e&&this.textFormatCallback&&(e.setText(tk.call(this,t)),e.layout&&e.layout()),this}},ik=Phaser.Utils.Objects.GetValue,nk=Phaser.Math.Snap.To,rk=function(t){r(s,t);var i=l(s);function s(t,n){var r;e(this,s),void 0===n&&(n={}),(r=i.call(this,t,n)).type="rexKnob",r.bootProgressBase(n);var o=ik(n,"background",void 0),h=ik(n,"text",void 0);o&&r.addBackground(o),h&&(n.textColor=void 0,n.textStrokeColor=void 0,r.setTextFormatCallback(ik(n,"textFormatCallback",void 0),ik(n,"textFormatCallbackScope",void 0)));var l=new Im(t,n);l.setDepth(ik(n,"knobDepth",0)),l._value=-1,t.add.existing(l),r.add(l,"knob"),h&&(r.add(h,"text","center",0,!1),t.children.moveBelow(l,h)),r.addChildrenMap("background",o),r.addChildrenMap("knob",l),r.addChildrenMap("text",h),r.setEnable(ik(n,"enable",void 0)),r.setGap(ik(n,"gap",void 0)),r.setValue(ik(n,"value",0),ik(n,"min",void 0),ik(n,"max",void 0));var u=ik(n,"input",0);switch("string"==typeof u&&(u=sk[u]),u){case 0:Qm.call(a(r));break;case 1:Nm.call(a(r));}return r}return n(s,[{key:"setEnable",value:function(t){return void 0===t&&(t=!0),this.enable=t,this}},{key:"setGap",value:function(t){return this.gap=t,this}},{key:"value",get:function(){return this.sizerChildren.knob.value},set:function(t){void 0!==this.gap&&(t=nk(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));}}]),s}(Zv(Np)),sk={pan:0,drag:0,click:1,none:-1};Object.assign(rk.prototype,ek);var ok=Phaser.Utils.Objects.GetValue,ak=function(t,e,i){var n=ok(t,"proportion.".concat(e),i.proportion),r=ok(t,"align.".concat(e),"center"),s=ok(t,"space.".concat(e),void 0);if("number"==typeof s&&i.paddingKey){var o=s;(s={})[i.paddingKey]=o;}return {proportion:n,align:r,padding:s,expand:ok(t,"expand.".concat(e),!0)}},hk=function(t){return ak(t,"header",{proportion:0,paddingKey:"bottom"})},lk=function(t){return ak(t,"leftSide",{proportion:0,paddingKey:"right"})},uk=function(t){return ak(t,"content",{proportion:1})},ck=function(t){return ak(t,"rightSide",{proportion:0,paddingKey:"left"})},dk=function(t){return ak(t,"footer",{proportion:0,paddingKey:"top"})},pk=function(t,e){var i=new Ud(t,{orientation:e});return t.add.existing(i),i},fk=Phaser.Utils.Objects.GetValue,vk=[function(t){var e=this.scene,i=t.header;i&&this.add(i,hk(t));var n=pk(e,0);this.add(n,{proportion:1,align:"center",padding:0,expand:!0});var r=t.leftSide;r&&n.add(r,lk(t));var s=t.content;s&&n.add(s,uk(t));var o=t.rightSide;o&&n.add(o,ck(t));var a=t.footer;a&&this.add(a,dk(t));},function(t){var e=this.scene,i=t.header;i&&this.add(i,hk(t));var n=pk(e,0);this.add(n,{proportion:1,align:"center",padding:0,expand:!0});var r=t.leftSide;r&&n.add(r,lk(t));var s=pk(e,1);n.add(s,{proportion:1,align:"center",padding:0,expand:!0});var o=pk(e,0);s.add(o,{proportion:1,align:"center",padding:0,expand:!0});var a=t.content;a&&o.add(a,uk(t));var h=t.rightSide;h&&o.add(h,ck(t));var l=t.footer;l&&s.add(l,dk(t));},function(t){var e=this.scene,i=t.header;i&&this.add(i,hk(t));var n=pk(e,0);this.add(n,{proportion:1,align:"center",padding:0,expand:!0});var r=pk(e,1);n.add(r,{proportion:1,align:"center",padding:0,expand:!0});var s=pk(e,0);r.add(s,{proportion:1,align:"center",padding:0,expand:!0});var o=t.leftSide;o&&s.add(o,lk(t));var a=t.content;a&&s.add(a,uk(t));var h=t.footer;h&&r.add(h,dk(t));var l=t.rightSide;l&&n.add(l,ck(t));},function(t){var e=this.scene,i=t.header;i&&this.add(i,hk(t));var n=pk(e,0);this.add(n,{proportion:1,align:"center",padding:0,expand:!0});var r=t.leftSide;r&&n.add(r,lk(t));var s=pk(e,1);n.add(s,{proportion:1,align:"center",padding:0,expand:!0});var o=t.content;o&&s.add(o,uk(t));var a=t.footer;a&&s.add(a,dk(t));var h=t.rightSide;h&&n.add(h,ck(t));}],gk={FFF:0,LFF:1,FFR:2,LFR:3},yk=function(t){r(s,t);var i=l(s);function s(t,n){var r;return e(this,s),void 0===n&&(n={}),n.orientation=1,(r=i.call(this,t,n)).type="rexHolyGrail",r.build(n),r}return n(s)}(Ud),mk={build:function(t){this.clear(!0);var e=fk(t,"background",void 0);e&&this.addBackground(e);var i=fk(t,"layoutMode",0);"string"==typeof i&&(i=gk[i.toUpperCase()]),(vk[i]||vk[0]).call(this,t),this.addChildrenMap("background",t.background),this.addChildrenMap("header",t.header),this.addChildrenMap("leftSide",t.leftSide),this.addChildrenMap("content",t.content),this.addChildrenMap("rightSide",t.rightSide),this.addChildrenMap("footer",t.footer);}};Object.assign(yk.prototype,mk);var kk=function(t,e){return t.sameOrientation?t.orientation=e.orientation:t.orientation=0===e.orientation?1:0,t},bk=function(t,e){t.popUp(kk(t.root.easeIn,t));},xk=function(t,e){t.scaleDown(kk(t.root.easeOut,t));},Ck={setTransitInCallback:function(t){return void 0===t&&(t=bk),this.transitInCallback=t,this},setTransitOutCallback:function(t){return void 0===t&&(t=xk),this.transitOutCallback=t,this}},Sk={delayCall:function(t,e,i){return this.timer=function(t,e,i,n,r){var s=Mh(t);return s.time.delayedCall(e,(function(){s.sys.events.once("postupdate",(function(){i.call(n,r);}));}))}(this,t,e,i),this},removeDelayCall:function(){return this.timer&&(this.timer.remove(!1),this.timer=void 0),this}},wk={expandSubMenu:function(t,e){var i;if((n=this.childrenMap.subMenu)&&n.parentButton===t)return this;this.collapseSubMenu(),i=this.root.toggleOrientation?0===this.orientation?1:0:this.orientation;var n=new this.constructor(this.scene,{items:e,orientation:i,space:this.space,createBackgroundCallback:this.root.createBackgroundCallback,createBackgroundCallbackScope:this.root.createBackgroundCallbackScope,createButtonCallback:this.root.createButtonCallback,createButtonCallbackScope:this.root.createButtonCallbackScope,easeIn:this.root.easeIn,easeOut:this.root.easeOut,_rootMenu:this.root,_parentMenu:this,_parentButton:t});return this.pin(n),this.childrenMap.subMenu=n,this.root.emit("expand",n,t,this),this},collapse:function(){var t=this.root;t.emit("collapse",this,this.parentButton,t);var e=t.easeOut.duration;return t.transitOutCallback(this,e),this.collapseSubMenu(),this.delayCall(e,this.destroy,this),this},collapseSubMenu:function(){var t=this.childrenMap.subMenu;return void 0===t||(this.childrenMap.subMenu=void 0,this.remove(t),t.collapse()),this}};Object.assign(wk,Ck,Sk);var Ok=function(t,e){return "number"==typeof e&&(e={duration:e}),e.hasOwnProperty("orientation")&&void 0!==e.orientation?e.sameOrientation=Gd(e.orientation)===t.orientation:e.sameOrientation=!0,e.destroy=!1,e},Tk=function(){var t=this.root,e=t.easeIn.duration;t.transitInCallback(this,e),this!==this.root&&this.delayCall(e,(function(){this.root.emit("popup.complete",this);}),this);},Pk=Phaser.Utils.Objects.GetValue,_k=function(t){r(o,t);var i=l(o);function o(t,n){var r;e(this,o),void 0===n&&(n={}),n.hasOwnProperty("orientation")||(n.orientation=1);var s=n._rootMenu,h=n._parentMenu,l=n._parentButton,u=Pk(n,"popup",!0),c=Pk(n,"items",void 0),d=Pk(n,"createBackgroundCallback",void 0),p=Pk(n,"createBackgroundCallbackScope",void 0);n.background=function(t,e,i,n){var r;return i&&(e.scene=t,r=n?i.call(n,e):i(e),e.scene=void 0),r}(t,c,d,p);var f=Pk(n,"createButtonCallback",void 0),v=Pk(n,"createButtonCallbackScope",void 0);if(n.buttons=function(t,e,i,n){var r,s,o=[];if(e&&i)for(var a=0,h=e.length;a0&&!Ms(t)&&(t=this.parent.texture.get(t)),this.frame=t,this._width=t?t.width:0,this._height=t?t.height:0,this}},{key:"setFlipX",value:function(t){return void 0===t&&(t=!0),this.flipX=t,this}},{key:"setFlipY",value:function(t){return void 0===t&&(t=!0),this.flipY=t,this}},{key:"resetFlip",value:function(){return this.flipX=!1,this.flipY=!1,this}},{key:"tint",get:function(){return void 0===this._tint?this.parent.tint:this._tint},set:function(t){this._tint=t;}},{key:"setTint",value:function(t){return this.tint=t,this.tintFill=!1,this}},{key:"setTintFill",value:function(t){return this.tint=t,this.tintFill=!0,this}},{key:"clearTint",value:function(){return this.setTint(16777215),this}},{key:"resetTint",value:function(){return this.tint=void 0,this.tintFill=void 0,this}},{key:"tintFill",get:function(){return void 0===this._tintFill?this.parent.tintFill:this._tintFill},set:function(t){this._tintFill=t;}},{key:"reset",value:function(){return c(s(o.prototype),"reset",this).call(this),this.resetFlip().resetTint().setFrame(),this}},{key:"modifyPorperties",value:function(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),c(s(o.prototype),"modifyPorperties",this).call(this,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}}]),o}(Ts),Ls={webglRender:function(t,e,i,n,r,s,o,a){var h=this._width,l=this._height,u=h*this.originX,c=l*this.originY,d=this.x-n,p=this.y-r,f=1,v=1;this.flipX&&(d+=h-2*u,f=-1),this.flipY&&(p+=l-2*c,v=-1),Es.applyITRS(d,p,this.rotation,this.scaleX*f,this.scaleY*v),e.multiply(Es,Es);var g=-u,y=-c,m=g+h,k=y+l,b=Es.setQuad(g,y,m,k,a),x=this.frame.u0,C=this.frame.v0,S=this.frame.u1,w=this.frame.v1,O=_s(this.tint,this.alpha*i);t.batchQuad(this.parent,b[0],b[1],b[2],b[3],b[4],b[5],b[6],b[7],x,C,S,w,O,O,O,O,this.tintFill,s,o);},canvasRender:function(t,e,i,n){t.save();var r=this._width,s=this._height,o=r*this.originX,a=s*this.originY,h=this.x-o,l=this.y-a,u=1,c=1;this.flipX&&(h+=r,u=-1),this.flipY&&(l+=s,c=-1),n&&(h=Math.round(h),l=Math.round(l)),t.translate(h,l),t.rotate(this.rotation),t.scale(this.scaleX*u,this.scaleY*c);var d=this.frame;t.drawImage(d.source.image,d.cutX,d.cutY,r,s,0,0,r,s),t.restore();}};Object.assign(Rs.prototype,Ls);var As=function(t,e){"string"==typeof e&&(e={frame:e});var i=t.poolManager?t.poolManager.allocate(ks):null;return null===i?i=new Rs(t):i.setParent(t).setActive(),i.modifyPorperties(e),t.addChild(i),i},Ds={_drawImage:function(t,e,i,n,r,s){As(this,{frame:e,x:i,y:n,width:r,height:s});},_drawTileSprite:function(t,e,i,n,r,s){var o=this.texture.get(e),a=o.width,h=o.height,l=Math.floor(r/a),u=Math.floor(s/h);i+=(r-l*a)/2,n+=(s-u*h)/2;for(var c=0;c=0;i--)(e=this.children[i]).parentContainer||e.displayList||e.destroy(t);this.clear(!t),c(s(o.prototype),"destroy",this).call(this,t);}}},{key:"contains",value:function(t){return -1!==this.children.indexOf(t)}},{key:"add",value:function(t){var e=this;return to(this.children,t,0,(function(t){t.once("destroy",e.onChildDestroy,e);}),this),this}},{key:"remove",value:function(t,e){var i=this;return eo(this.children,t,(function(t){t.off("destroy",i.onChildDestroy,i),e&&t.destroy();})),this}},{key:"onChildDestroy",value:function(t,e){this.remove(t,!1);}},{key:"clear",value:function(t){for(var e,i=0,n=this.children.length;i0;){var n=i.shift();!e(n)&&n.isRexContainerLite&&i.push.apply(i,f(n.children));}},jo=Phaser.Utils.Array,Bo={getChildren:function(t){if(t)for(var e=0,i=this.children.length;e=0;e--)this.remove(this.backgroundChildren[e],t);return this}},mh=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},kh=/(\S+)\[(\d+)\]/i,bh=Phaser.Utils.Objects.GetValue,xh=function(t,e){return void 0===e?t:t[e]},Ch=function(e,i,n){void 0===e&&(e={}),void 0===i&&(i=0);var r=t(i);return "string"===r?e[i]=n:"number"===r?(e.left=i,e.right=i,e.top=i,e.bottom=i):(e.left=bh(i,"left",0),e.right=bh(i,"right",0),e.top=bh(i,"top",0),e.bottom=bh(i,"bottom",0)),e},Sh={getInnerPadding:function(t){return xh(this.space,t)},setInnerPadding:function(t,e){return Ch(this.space,t,e),this},getOuterPadding:function(t){return xh(this.getSizerConfig(this).padding,t)},setOuterPadding:function(t,e){return Ch(this.getSizerConfig(this).padding,t,e),this},getChildOuterPadding:function(t,e){return "string"==typeof t&&(t=this.getElement(t)),xh(this.getSizerConfig(t).padding,e)},setChildOuterPadding:function(t,e,i){return "string"==typeof t&&(t=this.getElement(t)),Ch(this.getSizerConfig(t).padding,e,i),this}},wh=function(t){var e=this.childrenWidth,i=void 0!==this.minWidth?this.minWidth:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn("Layout width warn: ".concat(this.constructor.name,"'s minWidth (").concat(i,") < childrenWidth (").concat(e,")"))):this.layoutWarnEnable&&(i>t||e>t)&&console.warn("Layout width warn: ".concat(this.constructor.name,"'s minWidth (").concat(i,") or childrenWidth (").concat(e," > targetWidth ").concat(t,")")),t},Oh=function(t){var e=this.childrenHeight,i=void 0!==this.minHeight?this.minHeight:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn("Layout height warn: ".concat(this.constructor.name,"'s minHeight (").concat(i,") < childrenHeight (").concat(e,")"))):this.layoutWarnEnable&&(i>t||e>t)&&console.warn("Layout height warn: ".concat(this.constructor.name,"'s minHeight (").concat(i,") or childrenHeight (").concat(e,") > targetHeight (").concat(t,")")),t},Th={getShownChildren:function(t){void 0===t&&(t=[]);for(var e,i=this.children,n=0,r=i.length;n0;){var i=e.shift();i.rexSizer&&i.rexSizer.hidden||(i!==this&&t.push(i),i.isRexContainerLite&&e.push.apply(e,f(i.children)));}return t}},Ph=function(){this._childrenWidth=void 0,this._childrenHeight=void 0;for(var t,e=this.getChildrenSizers(),i=0,n=e.length;i0?-this.delay:0,this.state=this.nowTime>=0?Hh:Gh,this.repeatCounter=0,this}},{key:"stop",value:function(){return this.state=Xh,this}},{key:"update",value:function(t,e){this.state!==Xh&&this.state!==Uh&&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=Vh)):(this.nowTime=this.duration,this.state=Uh):this.nowTime>=0&&(this.state=Hh));}},{key:"t",get:function(){var t;switch(this.state){case Xh:case Gh:case Vh:t=0;break;case Hh:t=this.nowTime/this.duration;break;case Uh:t=1;}return Yh(t,0,1)},set:function(t){(t=Yh(t,-1,1))<0?(this.state=Gh,this.nowTime=-this.delay*t):(this.state=Hh,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++);}},{key:"setT",value:function(t){return this.t=t,this}},{key:"isIdle",get:function(){return this.state===Xh}},{key:"isDelay",get:function(){return this.state===Gh}},{key:"isCountDown",get:function(){return this.state===Hh}},{key:"isRunning",get:function(){return this.state===Gh||this.state===Hh}},{key:"isDone",get:function(){return this.state===Uh}},{key:"isOddIteration",get:function(){return 1==(1&this.repeatCounter)}},{key:"isEvenIteration",get:function(){return 0==(1&this.repeatCounter)}}]),t}(),Xh=0,Gh=1,Hh=2,Vh=3,Uh=-1,Jh=function(t){r(o,t);var i=l(o);function o(t,n){var r;return e(this,o),(r=i.call(this,t,n)).timer=new Nh,r}return n(o,[{key:"shutdown",value:function(t){this.isShutdown||(c(s(o.prototype),"shutdown",this).call(this,t),this.timer.destroy(),this.timer=void 0);}},{key:"start",value:function(){return this.timer.start(),c(s(o.prototype),"start",this).call(this),this}},{key:"stop",value:function(){return this.timer.stop(),c(s(o.prototype),"stop",this).call(this),this}},{key:"complete",value:function(){return this.timer.stop(),c(s(o.prototype),"complete",this).call(this),this}}]),o}(Bh),Kh=Phaser.Utils.Objects.GetValue,qh=Phaser.Utils.Objects.GetAdvancedValue,$h=Phaser.Tweens.Builders.GetEaseFunction,Zh=function(t){r(o,t);var i=l(o);function o(){return e(this,o),i.apply(this,arguments)}return n(o,[{key:"resetFromJSON",value:function(t){return this.timer.resetFromJSON(Kh(t,"timer")),this.setEnable(Kh(t,"enable",!0)),this.setTarget(Kh(t,"target",this.parent)),this.setDelay(qh(t,"delay",0)),this.setDuration(qh(t,"duration",1e3)),this.setEase(Kh(t,"ease","Linear")),this.setRepeat(Kh(t,"repeat",0)),this}},{key:"setEnable",value:function(t){return null==t&&(t=!0),this.enable=t,this}},{key:"setTarget",value:function(t){return void 0===t&&(t=this.parent),this.target=t,this}},{key:"setDelay",value:function(t){return this.delay=t,this}},{key:"setDuration",value:function(t){return this.duration=t,this}},{key:"setRepeat",value:function(t){return this.repeat=t,this}},{key:"setRepeatDelay",value:function(t){return this.repeatDelay=t,this}},{key:"setEase",value:function(t){return void 0===t&&(t="Linear"),this.ease=t,this.easeFn=$h(t),this}},{key:"start",value:function(){return this.timer.isRunning||c(s(o.prototype),"start",this).call(this),this}},{key:"restart",value:function(){return this.timer.stop(),this.start.apply(this,arguments),this}},{key:"stop",value:function(t){return void 0===t&&(t=!1),c(s(o.prototype),"stop",this).call(this),t&&(this.timer.setT(1),this.updateGameObject(this.target,this.timer),this.complete()),this}},{key:"update",value:function(t,e){if(!this.isRunning||!this.enable||!this.parent.active)return this;var i=this.target,n=this.timer;return n.update(t,e),n.isDelay||this.updateGameObject(i,n),this.emit("update",i,this),n.isDone&&this.complete(),this}},{key:"updateGameObject",value:function(t,e){}}]),o}(Jh),Qh=Phaser.Utils.Objects.GetValue,tl=Phaser.Utils.Objects.GetAdvancedValue,el=Phaser.Math.Linear,il=function(t){r(o,t);var i=l(o);function o(t,n){var r;return e(this,o),(r=i.call(this,t,n)).scaleStart={},r.scaleEnd={},r.resetFromJSON(n),r.boot(),r}return n(o,[{key:"resetFromJSON",value:function(t){return c(s(o.prototype),"resetFromJSON",this).call(this,t),this.setMode(Qh(t,"mode",0)),this.setScaleRange(tl(t,"start",void 0),tl(t,"end",0)),this}},{key:"setMode",value:function(t){return "string"==typeof t&&(t=nl[t]),this.mode=t,this}},{key:"setScaleRange",value:function(t,e){return "number"==typeof t?(this.startX=t,this.startY=t):(this.startX=tl(t,"x",this.parent.scaleX),this.startY=tl(t,"y",this.parent.scaleY)),"number"==typeof e?(this.endX=e,this.endY=e):(this.endX=tl(e,"x",void 0),this.endY=tl(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}},{key:"start",value:function(){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),c(s(o.prototype),"start",this).call(this),this}},{key:"updateGameObject",value:function(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasScaleX&&(t.scaleX=el(this.startX,this.endX,i)),this.hasScaleY&&(t.scaleY=el(this.startY,this.endY,i));}},{key:"complete",value:function(){return c(s(o.prototype),"complete",this).call(this),1===this.mode&&this.parent.destroy(),this}}]),o}(Zh),nl={stop:0,destroy:1,yoyo:2},rl=function(t,e,i,n,r){var s,o;switch(void 0===n&&(n="Cubic"),i){case 0:case"x":s={x:0},o={x:t.scaleX};break;case 1:case"y":s={y:0},o={y:t.scaleY};break;default:s=0,o=t.scale;}var a={mode:0,start:s,end:o,duration:e,ease:n};return void 0===r?r=new il(t,a):r.resetFromJSON(a),r.restart(),r},sl=function(t,e,i,n,r,s){void 0===n&&(n="Linear"),r instanceof il&&(s=r,r=void 0),void 0===r&&(r=!0);var o={};switch(o.mode=r?1:0,i){case 0:case"x":o.end={x:0};break;case 1:case"y":o.end={y:0};break;default:o.end=0;}return o.duration=e,o.ease=n,void 0===s?s=new il(t,o):s.resetFromJSON(o),s.restart(),s},ol=function(t,e){return new Promise((function(i,n){t.once(e,(function(){i();}));}))},al=function(t){return ol(t,"complete")},hl=Phaser.Utils.Objects.IsPlainObject,ll=function(t,e){e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0);})),e.on("update",(function(){var e=vh.getParentSizer(t);e&&e.resetChildPositionState(t);}));},ul={popUp:function(t,e,i){if(hl(t)){var n=t;t=n.duration,e=n.orientation,i=n.ease;}var r=void 0===this._scaleBehavior;return this._scaleBehavior=rl(this,t,e,i,this._scaleBehavior),r&&ll(this,this._scaleBehavior),this._scaleBehavior.completeEventName="popup.complete",this},popUpPromise:function(t,e,i){return this.popUp(t,e,i),al(this._scaleBehavior)},scaleDownDestroy:function(t,e,i,n){if(hl(t)){var r=t;t=r.duration,e=r.orientation,i=r.ease,n=r.destroy;}var s=void 0===this._scaleBehavior;return this._scaleBehavior=sl(this,t,e,i,n,this._scaleBehavior),s&&ll(this,this._scaleBehavior),this._scaleBehavior.completeEventName="scaledown.complete",this},scaleDownDestroyPromise:function(t,e,i,n){return this.scaleDownDestroy(t,e,i,n),al(this._scaleBehavior)},scaleDown:function(t,e,i){return this.scaleDownDestroy(t,e,i,!1),this},scaleDownPromise:function(t,e,i){return this.scaleDown(t,e,i),al(this._scaleBehavior)},scaleYoyo:function(t,e,i,n,r){if(hl(t)){var s=t;t=s.duration,e=s.peakValue,i=s.repeat,n=s.orientation,r=s.ease;}var o=void 0===this._scaleBehavior;return this._scaleBehavior=function(t,e,i,n,r,s,o){var a,h;switch(void 0===i&&(i=1.2),void 0===n&&(n=0),void 0===s&&(s="Cubic"),r){case 0:case"x":a={x:t.scaleX},h={x:i};break;case 1:case"y":a={y:t.scaleX},h={y:i};break;default:a=t.scaleX,h=i;}var l={mode:2,start:a,end:h,duration:e/2,ease:s,repeat:n};return void 0===o?o=new il(t,l):o.resetFromJSON(l),o.restart(),o}(this,t,e,i,n,r,this._scaleBehavior),o&&ll(this,this._scaleBehavior),this._scaleBehavior.completeEventName="scaleyoyo.complete",this},scaleYoyoPromise:function(t,e,i,n,r){return this.scaleYoyo(t,e,i,n,r),al(this._scaleBehavior)}},cl=Phaser.Utils.Objects.GetValue,dl=Phaser.Utils.Objects.GetAdvancedValue,pl=Phaser.Math.Linear,fl=function(t){r(o,t);var i=l(o);function o(t,n){var r;return e(this,o),(r=i.call(this,t,n)).resetFromJSON(n),r.boot(),r}return n(o,[{key:"resetFromJSON",value:function(t){return c(s(o.prototype),"resetFromJSON",this).call(this,t),this.setMode(cl(t,"mode",0)),this.setAlphaRange(dl(t,"start",this.parent.alpha),dl(t,"end",0)),this}},{key:"setMode",value:function(t){return "string"==typeof t&&(t=vl[t]),this.mode=t,this}},{key:"setAlphaRange",value:function(t,e){return this.alphaStart=t,this.alphaEnd=e,this}},{key:"start",value:function(){return this.timer.isRunning||(this.parent.setAlpha(this.alphaStart),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),c(s(o.prototype),"start",this).call(this)),this}},{key:"updateGameObject",value:function(t,e){var i=e.t;e.isOddIteration&&(i=1-i),t.alpha=pl(this.alphaStart,this.alphaEnd,i);}},{key:"complete",value:function(){return c(s(o.prototype),"complete",this).call(this),1===this.mode&&this.parent.destroy(),this}}]),o}(Zh),vl={stop:0,destroy:1,yoyo:2},gl=Phaser.Utils.Objects.IsPlainObject,yl=function(t,e,i,n){var r,s;gl(i)?(r=i.start,s=i.end):s=i,void 0===r&&(r=0),void 0===s&&(s=1);var o={mode:0,start:r,end:s,duration:e};return void 0===n?n=new fl(t,o):n.resetFromJSON(o),n.restart(),n},ml=function(t,e,i,n){i instanceof fl&&(n=i,i=void 0),void 0===i&&(i=!0);var r={mode:i?1:0,end:0,duration:e};return void 0===n?n=new fl(t,r):n.resetFromJSON(r),n.restart(),n},kl=Phaser.Utils.Objects.IsPlainObject,bl=function(t,e){e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0);})),e.on("update",(function(){var e=vh.getParentSizer(t);e&&e.resetChildAlphaState(t);}));},xl={fadeIn:function(t,e){if(kl(t)){var i=t;t=i.duration,e=i.alpha;}var n=void 0===this._fade;return this._fade=yl(this,t,e,this._fade),n&&bl(this,this._fade),this._fade.completeEventName="fadein.complete",this},fadeInPromise:function(t,e){return this.fadeIn(t,e),al(this._fade)},fadeOutDestroy:function(t,e){if(kl(t)){var i=t;t=i.duration,e=i.destroy;}var n=void 0===this._fade;return this._fade=ml(this,t,e,this._fade),n&&bl(this,this._fade),this._fade.completeEventName="fadeout.complete",this},fadeOutDestroyPromise:function(t,e){return this.fadeOutDestroy(t,e),al(this._fade)},fadeOut:function(t){return this.fadeOutDestroy(t,!1),this},fadeOutPromise:function(t){return this.fadeOut(t),al(this._fade)}},Cl=Phaser.Utils.Objects.GetValue,Sl=Phaser.Utils.Objects.GetAdvancedValue,wl=Phaser.Math.Linear,Ol=function(t){r(o,t);var i=l(o);function o(t,n){var r;return e(this,o),(r=i.call(this,t,n)).resetFromJSON(n),r.boot(),r}return n(o,[{key:"resetFromJSON",value:function(t){if(c(s(o.prototype),"resetFromJSON",this).call(this,t),this.setMode(Cl(t,"mode",0)),t&&(t.hasOwnProperty("x")||t.hasOwnProperty("y"))){var e=Sl(t,"x",void 0),i=Sl(t,"y",void 0);this.setTargetPosition(e,i);}else this.setTargetPosition(t);return this}},{key:"setMode",value:function(t){return "string"==typeof t&&(t=Tl[t]),this.mode=t,this}},{key:"setTargetPosition",value:function(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=Sl(i,"startX",void 0),this.startY=Sl(i,"startY",void 0),this.endX=Sl(i,"endX",void 0),this.endY=Sl(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}},{key:"start",value:function(){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),c(s(o.prototype),"start",this).call(this),this}},{key:"updateGameObject",value:function(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasMoveX&&(t.x=wl(this.startX,this.endX,i)),this.hasMoveY&&(t.y=wl(this.startY,this.endY,i));}},{key:"complete",value:function(){return c(s(o.prototype),"complete",this).call(this),1===this.mode&&this.parent.destroy(),this}}]),o}(Zh),Tl={stop:0,destroy:1,yoyo:2},Pl=function(t,e){if("number"==typeof t)return t;var i=t[0],n=parseFloat(t.substr(2));switch(i){case"+":return e+n;case"-":return e-n;case"*":return e*n;case"/":return e/n}},_l=Phaser.Utils.Objects.IsPlainObject,El=Phaser.Math.Distance.Between,Ml=function(t,e){e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0);})),e.on("update",(function(){var e=vh.getParentSizer(t);e&&e.resetChildPositionState(t);}));},Rl={moveFrom:function(t,e,i,n,r){if(_l(t)){var s=t;e=s.x,i=s.y,t=s.hasOwnProperty("speed")?1e3*El(e,i,this.x,this.y)/s.speed:s.duration,n=s.ease;}var o=void 0===this._easeMove;return this._easeMove=function(t,e,i,n,r,s,o){s instanceof Ol&&(o=s,s=void 0),void 0===s&&(s=!1);var a={};return a.mode=s?1:0,void 0!==i&&(a.startX=Pl(i,t.x),a.endX=t.x),void 0!==n&&(a.startY=Pl(n,t.y),a.endY=t.y),a.duration=e,a.ease=void 0===r?"Linear":r,void 0===o?o=new Ol(t,a):o.resetFromJSON(a),o.restart(),o}(this,t,e,i,n,r,this._easeMove),o&&Ml(this,this._easeMove),this._easeMove.completeEventName="movefrom.complete",this},moveFromPromise:function(t,e,i,n,r){return this.moveFrom(t,e,i,n,r),al(this._easeMove)},moveFromDestroy:function(t,e,i,n){return this.moveFrom(t,e,i,n,!0),this},moveFromDestroyPromise:function(t,e,i,n){return this.moveFromDestroy(t,e,i,n),al(this._easeMove)},moveTo:function(t,e,i,n,r){if(_l(t)){var s=t;e=s.x,i=s.y,t=s.hasOwnProperty("speed")?1e3*El(e,i,this.x,this.y)/s.speed:s.duration,n=s.ease;}var o=void 0===this._easeMove;return this._easeMove=function(t,e,i,n,r,s,o){s instanceof Ol&&(o=s,s=void 0),void 0===s&&(s=!1);var a={};return a.mode=s?1:0,void 0!==i&&(a.startX=t.x,a.endX=Pl(i,t.x)),void 0!==n&&(a.startY=t.y,a.endY=Pl(n,t.y)),a.duration=e,a.ease=void 0===r?"Linear":r,void 0===o?o=new Ol(t,a):o.resetFromJSON(a),o.restart(),o}(this,t,e,i,n,r,this._easeMove),o&&Ml(this,this._easeMove),this._easeMove.completeEventName="moveto.complete",this},moveToPromise:function(t,e,i,n,r){return this.moveTo(t,e,i,n,r),al(this._easeMove)},moveToDestroy:function(t,e,i,n){return this.moveTo(t,e,i,n,!0),this},moveToDestroyPromise:function(t,e,i,n){return this.moveToDestroy(t,e,i,n,!0),al(this._easeMove)},moveStop:function(t){return this._easeMove?(this._easeMove.stop(t),this):this}},Ll=Phaser.Utils.Objects.GetValue,Al=function(t){r(o,t);var i=l(o);function o(t,n){var r;return e(this,o),(r=i.call(this,t,n)).timer=new Nh,r.resetFromJSON(n),r.boot(),r}return n(o,[{key:"resetFromJSON",value:function(t){return this.timer.resetFromJSON(Ll(t,"timer")),this.setEnable(Ll(t,"enable",!0)),this.setMode(Ll(t,"mode",1)),this.isRunning=Ll(t,"isRunning",!1),this.setMagnitudeMode(Ll(t,"magnitudeMode",1)),this.setAxisMode(Ll(t,"axis",0)),this.setDuration(Ll(t,"duration",500)),this.setMagnitude(Ll(t,"magnitude",10)),this.ox=Ll(t,"ox",void 0),this.oy=Ll(t,"oy",void 0),this}},{key:"toJSON",value:function(){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}}},{key:"shutdown",value:function(t){this.isShutdown||(c(s(o.prototype),"shutdown",this).call(this,t),this.timer.destroy(),this.timer=void 0);}},{key:"startTicking",value:function(){c(s(o.prototype),"startTicking",this).call(this),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);}},{key:"stopTicking",value:function(){c(s(o.prototype),"stopTicking",this).call(this),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));}},{key:"setEnable",value:function(t){return null==t&&(t=!0),this.enable=t,this}},{key:"setMode",value:function(t){return "string"==typeof t&&(t=Dl[t]),this.mode=t,this}},{key:"setMagnitudeMode",value:function(t){return "string"==typeof t&&(t=Il[t]),this.magnitudeMode=t,this}},{key:"setAxisMode",value:function(t){return "string"==typeof t&&(t=zl[t]),this.axisMode=t,this}},{key:"setDuration",value:function(t){return this.duration=t,this}},{key:"setMagnitude",value:function(t){return this.magnitude=t,this}},{key:"start",value:function(t,e){if("number"!=typeof t){var i=t;e=Ll(i,"magnitude",void 0),t=Ll(i,"duration",void 0);}return void 0!==e&&this.setMagnitude(e),void 0!==t&&this.setDuration(t),this.timer.setDuration(this.duration).start(),c(s(o.prototype),"start",this).call(this),this}},{key:"shake",value:function(t,e){return this.start(t,e),this}},{key:"update",value:function(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 n=this.magnitude;1===this.magnitudeMode&&(n*=1-this.timer.t);var r=Math.random()*Math.PI*2,s=this.ox+Math.cos(r)*n,o=this.oy+Math.sin(r)*n;switch(this.axisMode){case 1:i.x=s;break;case 2:i.y=o;break;default:i.x=s,i.y=o;}}return this}},{key:"backToOrigin",value:function(){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}}]),o}(zh),Dl={effect:0,behavior:1},zl={both:0,"h&v":0,"x&y":0,horizontal:1,h:1,x:1,vertical:2,v:2,y:2},Il={constant:0,decay:1},jl=Phaser.Utils.Objects.IsPlainObject,Bl={shake:function(t,e,i){if(jl(t)){var n=t;t=n.duration,e=n.magnitude,i=n.magnitudeMode;}return void 0===this._shake&&(this._shake=new Al(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:function(t,e){return this.shake(t,e),al(this._shake)}},Fl=Phaser.Utils.Objects.GetValue,Wl=Phaser.Math.Linear,Yl=function(t){r(o,t);var i=l(o);function o(t,n){var r;return e(this,o),(r=i.call(this,t,n)).resetFromJSON(),r.boot(),r}return n(o,[{key:"start",value:function(t){if(this.timer.isRunning)return this;var e=this.target;this.propertyKey=Fl(t,"key","value");var i=e[this.propertyKey];return this.fromValue=Fl(t,"from",i),this.toValue=Fl(t,"to",i),this.setEase(Fl(t,"ease",this.ease)),this.setDuration(Fl(t,"duration",this.duration)),this.setRepeat(Fl(t,"repeat",0)),this.setDelay(Fl(t,"delay",0)),this.setRepeatDelay(Fl(t,"repeatDelay",0)),this.timer.setDuration(this.duration).setRepeat(this.repeat).setDelay(this.delay).setRepeatDelay(this.repeatDelay),e[this.propertyKey]=this.fromValue,c(s(o.prototype),"start",this).call(this),this}},{key:"updateGameObject",value:function(t,e){var i=e.t;i=this.easeFn(i),t[this.propertyKey]=Wl(this.fromValue,this.toValue,i);}}]),o}(Zh),Nl=Phaser.Utils.Objects.IsPlainObject,Xl=function(t){r(s,t);var i=l(s);function s(t,n){var r;return e(this,s),(r=i.call(this,t,n)).parent.setDataEnabled(),r.easeTasks={},r}return n(s,[{key:"complete",value:function(t){this.emit("complete-".concat(t),this.parent,this),this.emit("complete",t,this.parent,this);}},{key:"getEaseTask",value:function(t){var e=this.easeTasks[t];return void 0===e&&(e=new Yl(this.parent),this.easeTasks[t]=e,e.setTarget(this.parent.data.values).on("complete",(function(){this.complete(t);}),this)),e}},{key:"easeTo",value:function(t,e,i,n){if(Nl(t)){var r=t;t=r.key,e=r.value,i=r.duration,n=r.ease;var s=r.speed;void 0===i&&void 0!==s&&(i=Math.abs(e-this.parent.data.values[t])/s*1e3);}return void 0===i&&(i=1e3),void 0===n&&(n="Linear"),this.getEaseTask(t).restart({key:t,to:e,duration:i,ease:n}),this}},{key:"easeFrom",value:function(t,e,i,n){if(Nl(t)){var r=t;t=r.key,e=r.value,i=r.duration,n=r.ease;var s=r.speed;void 0===i&&void 0!==s&&(i=Math.abs(e-this.parent.data.values[t])/s*1e3);}return void 0===i&&(i=1e3),void 0===n&&(n="Linear"),this.getEaseTask(t).restart({key:t,from:e,duration:i,ease:n}),this}},{key:"stopEase",value:function(t,e){void 0===e&&(e=!0);var i=this.easeTasks[t];return i&&i.stop(e),this}},{key:"stopAll",value:function(t){for(var e in void 0===t&&(t=!0),this.easeTasks)this.stopEase(e,t);return this}}]),s}(Lh),Gl={easeDataTo:function(t,e,i,n){return this._easeData||(this._easeData=new Xl(this),function(t,e){e.on("complete",(function(e){t.emit("easedata.".concat(e,".complete"),t),t.emit("easedata.complete",e,t);}));}(this,this._easeData)),this._easeData.easeTo(t,e,i,n),this},easeDataToPromise:function(t,e,i,n){return this.easeDataTo(t,e,i,n),ol(this._easeData,"complete-".concat(t))},stopEaseData:function(t,e){return this._easeData?(this._easeData.stopEase(t,e),this):this},stopAllEaseData:function(t){return this._easeData?(this._easeData.stopAll(t),this):this}},Hl=function(t){Jl(t,!1);},Vl=function(t){Jl(t,!0);},Ul=function(t){return !!t&&!Oa(t).hidden},Jl=function(t,e){if(t){Oa(t).hidden=e;var i=so(t);i?i.setChildVisible(t,!e):t.setVisible(!e);}},Kl={show:function(t){return void 0===t&&(t=this),Hl(t),this},hide:function(t){return void 0===t&&(t=this),Vl(t),this},isShow:function(t){return void 0===t&&(t=this),Ul(t)}};function ql(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var $l={exports:{}};!function(t){var e=Object.prototype.hasOwnProperty,i="~";function n(){}function r(t,e,i){this.fn=t,this.context=e,this.once=i||!1;}function s(t,e,n,s,o){if("function"!=typeof n)throw new TypeError("The listener must be a function");var a=new r(n,s||t,o),h=i?i+e:e;return t._events[h]?t._events[h].fn?t._events[h]=[t._events[h],a]:t._events[h].push(a):(t._events[h]=a,t._eventsCount++),t}function o(t,e){0==--t._eventsCount?t._events=new n:delete t._events[e];}function a(){this._events=new n,this._eventsCount=0;}Object.create&&(n.prototype=Object.create(null),(new n).__proto__||(i=!1)),a.prototype.eventNames=function(){var t,n,r=[];if(0===this._eventsCount)return r;for(n in t=this._events)e.call(t,n)&&r.push(i?n.slice(1):n);return Object.getOwnPropertySymbols?r.concat(Object.getOwnPropertySymbols(t)):r},a.prototype.listeners=function(t){var e=i?i+t:t,n=this._events[e];if(!n)return [];if(n.fn)return [n.fn];for(var r=0,s=n.length,o=new Array(s);r0){var e=t.runTransitionInCallback();t.delayCall(e,this.next,this);}else this.next();}},{key:"exit_TRANS_OPNE",value:function(){this.parent.removeDelayCall();}},{key:"next_OPEN",value:function(){return "TRANS_CLOSE"}},{key:"enter_OPEN",value:function(){this.parent.onOpen();}},{key:"exit_OPEN",value:function(){this.parent.removeDelayCall();}},{key:"next_TRANS_CLOSE",value:function(){return "CLOSE"}},{key:"enter_TRANS_CLOSE",value:function(){var t=this.parent;if(t.transitOutTime>0){var e=t.runTransitionOutCallback();t.delayCall(e,this.next,this);}else this.next();}},{key:"exit_TRANS_CLOSE",value:function(){this.parent.removeDelayCall();}},{key:"next_CLOSE",value:function(){return "TRANS_OPNE"}},{key:"enter_CLOSE",value:function(){this.parent.onClose();}},{key:"exit_CLOSE",value:function(){}},{key:"canOpen",value:function(){return "IDLE"===this.state||"CLOSE"===this.state}},{key:"canClose",value:function(){return "IDLE"===this.state||"OPEN"===this.state}}]),s}(ru),ou={delayCall:function(t,e,i){return this.delayCallTimer=function(t,e,i,n,r){var s=Mh(t);return s.time.delayedCall(e,(function(){s.game.events.once("poststep",(function(){i.call(n,r);}));}))}(this,t,e,i),this},removeDelayCall:function(){return this.delayCallTimer&&(this.delayCallTimer.remove(!1),this.delayCallTimer=void 0),this}},au={setTransitInTime:function(t){return this.transitInTime=t,this},setTransitOutTime:function(t){return this.transitOutTime=t,this},setTransitInCallback:function(t){return t||(t=$i),this.transitInCallback=t,this},setTransitOutCallback:function(t){return t||(t=$i),this.transitOutCallback=t,this}},hu={runTransitionInCallback:function(){return this.transitInCallback(this.parent,this.transitInTime),this.transitInTime},onOpen:function(){},requestOpen:function(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}},lu={runTransitionOutCallback:function(){return this.transitOutCallback(this.parent,this.transitOutTime),this.transitOutTime},onClose:function(){this.oneShotMode&&this.parent.destroy();},requestClose:function(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}},uu={};Object.assign(uu,ou,au,hu,lu);var cu=Phaser.Utils.Objects.GetValue,du=function(t){r(o,t);var i=l(o);function o(t,n){var r;return e(this,o),(r=i.call(this,t,n)).setTransitInTime(cu(n,"duration.in",200)),r.setTransitOutTime(cu(n,"duration.out",200)),r.setTransitInCallback(cu(n,"transitIn")),r.setTransitOutCallback(cu(n,"transitOut")),r.oneShotMode=cu(n,"destroy",!1),r.delayCallTimer=void 0,r._state=new su(a(r),{eventEmitter:!1,initState:cu(n,"initState","IDLE")}),r.openEventData=void 0,r.closeEventData=void 0,r}return n(o,[{key:"state",get:function(){return this._state.state}},{key:"shutdown",value:function(t){this.isShutdown||(this.transitInCallback=void 0,this.transitOutCallback=void 0,this.openEventData=void 0,this.closeEventData=void 0,this.removeDelayCall(),c(s(o.prototype),"shutdown",this).call(this,t));}}]),o}(Lh);Object.assign(du.prototype,uu);var pu=function(t){r(o,t);var i=l(o);function o(t,n,r){var s;return e(this,o),(s=i.call(this,t,0,0,2,2,n,1)).setAlpha(r),s.setScrollFactor(0),s.boot(),s}return n(o,[{key:"boot",value:function(){this.scene.sys.events.on("prerender",this.resize,this);}},{key:"destroy",value:function(t){this.scene&&!this.ignoreDestroy&&(this.scene.sys.events.off("prerender",this.resize,this),c(s(o.prototype),"destroy",this).call(this,t));}},{key:"tint",get:function(){return this.fillColor},set:function(t){this.setFillStyle(t,this.fillAlpha);}},{key:"resize",value:function(){var t=this.scene,e=t.sys.scale.gameSize,i=t.sys.cameras.main,n=e.width,r=e.height,s=1/i.zoom,o=n/2,a=r/2,h=n*s,l=r*s;this.x===o&&this.y===a||this.setPosition(o,a),this.width===h&&this.height===l||this.setSize(h,l).setOrigin(.5);}}]),o}(Phaser.GameObjects.Rectangle),fu=Phaser.Utils.Objects.GetValue,vu=function(t){r(s,t);var i=l(s);function s(t,n){var r;return e(this,s),(r=i.call(this,t,{eventEmitter:!1})).resetFromJSON(n),r.boot(),r}return n(s,[{key:"resetFromJSON",value:function(t){return this.setHitAreaMode(fu(t,"hitAreaMode",0)),this.setEnable(fu(t,"enable",!0)),this.setStopMode(fu(t,"stopAllLevels",!0)),this}},{key:"boot",value:function(){this.parent.on("pointerdown",(function(t,e,i,n){this.stopAllLevels&&n.stopPropagation();}),this).on("pointerup",(function(t,e,i,n){this.stopAllLevels&&n.stopPropagation();}),this).on("pointermove",(function(t,e,i,n){this.stopAllLevels&&n.stopPropagation();}),this).on("pointerover",(function(t,e,i,n){this.stopAllLevels&&n.stopPropagation();}),this).on("pointerout",(function(t,e){this.stopAllLevels&&e.stopPropagation();}),this);}},{key:"setHitAreaMode",value:function(t){"string"==typeof t&&(t=gu[t]);var e=this.parent;return e.input&&e.removeInteractive(),0===t?e.setInteractive():e.setInteractive({hitArea:{},hitAreaCallback:function(){return !0}}),this}},{key:"setEnable",value:function(t){return void 0===t&&(t=!0),t?this.parent.setInteractive():this.parent.disableInteractive(),this.enable=t,this}},{key:"setStopMode",value:function(t){return void 0===t&&(t=!0),this.stopAllLevels=t,this}},{key:"toggleEnable",value:function(){return this.setEnable(!this.enable),this}}]),s}(Lh),gu={default:0,fullWindow:1},yu=Phaser.Utils.Objects.GetValue,mu=function(t){r(s,t);var i=l(s);function s(t,n){var r;e(this,s);var o=yu(n,"color",0),h=yu(n,"alpha",.8);return (r=i.call(this,t,o,h)).touchEventStop=new vu(a(r),{hitAreaMode:1}),r}return n(s)}(pu),ku=function(t,e){void 0!==t._modalScaleSave?(t.scaleX=t._modalScaleSave,t.scaleY=t._modalScaleSave):t._modalScaleSave=t.scaleX,rl(t,e);},bu=function(t,e){sl(t,e,void 0,void 0,!1);},xu=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,yl(t,e);},Cu=function(t,e){ml(t,e,!1);},Su=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,yl(t,e,t.alpha);},wu=function(t,e){ml(t,e,!1);},Ou=function(t,e,i,n,r){return !!t&&(!(n&&!n(t,e,i))&&(!!ea(t,!0).contains(e,i)&&!(r&&!r(t,e,i))))},Tu=Phaser.Utils.Objects.GetValue,Pu=function(t){r(o,t);var i=l(o);function o(t,n){var r;e(this,o),void 0===n&&(n={}),null==n.transitIn&&(n.transitIn=_u.popUp),null==n.transitOut&&(n.transitOut=_u.scaleDown),n.destroy=Tu(n,"destroy",!0),r=i.call(this,t,n);var s=Tu(n,"cover");r.cover=!1!==s?function(t,e){var i=t.scene,n=new mu(i,e);return i.add.existing(n),t.isRexContainerLite?(t.pin(n,{syncPosition:!1,syncRotation:!1,syncScale:!1,syncAlpha:!1,syncScrollFactor:!1}),t.moveDepthBelow(n)):i.children.moveBelow(n,t),n}(t,s):void 0,r.cover&&(r.setCoverTransitInCallback(Tu(s,"transitIn",Su)),r.setCoverTransitOutCallback(Tu(s,"transitOut",wu)));var h=Tu(n,"touchOutsideClose",!1),l=Tu(n,"duration.hold",-1),u=Tu(n,"timeOutClose",l>=0),c=Tu(n,"anyTouchClose",!1);return Tu(n,"manualClose",!1)&&(h=!1,c=!1,u=!1),c&&(h=!1),u?r.setDisplayTime(l):r.setDisplayTime(-1),c?r.once("open",r.anyTouchClose,a(r)):h&&r.once("open",r.touchOutsideClose,a(r)),Tu(n,"openOnStart",!0)&&r.delayCall(0,r.requestOpen,a(r)),r}return n(o,[{key:"shutdown",value:function(t){this.isShutdown||(this.cover||this.scene.input.off("pointerup",this.touchCloseCallback,this),this.cover&&!t&&(this.cover.destroy(),this.cover=void 0),c(s(o.prototype),"shutdown",this).call(this,t));}},{key:"touchOutsideClose",value:function(){return this.cover?this.cover.on("pointerup",this.touchCloseCallback,this):this.scene.input.on("pointerup",this.touchCloseCallback,this),this.clickOutsideTest=!0,this}},{key:"anyTouchClose",value:function(){return this.cover?this.cover.once("pointerup",this.touchCloseCallback,this):this.scene.input.once("pointerup",this.touchCloseCallback,this),this}},{key:"touchCloseCallback",value:function(t){this.clickOutsideTest&&Ou(this.parent,t.worldX,t.worldY)||this.requestClose();}},{key:"runTransitionInCallback",value:function(){var t=c(s(o.prototype),"runTransitionInCallback",this).call(this),e=this.cover;return e&&this.coverTransitInCallback&&this.coverTransitInCallback(e,t),t}},{key:"runTransitionOutCallback",value:function(){var t=c(s(o.prototype),"runTransitionOutCallback",this).call(this),e=this.cover;return e&&this.coverTransitOutCallback&&this.coverTransitOutCallback(e,t),t}},{key:"onOpen",value:function(){var t=this.displayTime;t>=0&&this.delayCall(t,this.requestClose,this),this.emit("open",this.parent,this),c(s(o.prototype),"onOpen",this).call(this);}},{key:"onClose",value:function(){this.emit("close",this.closeEventData),c(s(o.prototype),"onClose",this).call(this);}},{key:"setDisplayTime",value:function(t){return this.displayTime=t,this}},{key:"setTransitInCallback",value:function(t){switch("string"==typeof t&&(t=_u[t]),t){case _u.popUp:t=ku;break;case _u.fadeIn:t=xu;}return c(s(o.prototype),"setTransitInCallback",this).call(this,t),this}},{key:"setTransitOutCallback",value:function(t){switch("string"==typeof t&&(t=_u[t]),t){case _u.scaleDown:t=bu;break;case _u.fadeOut:t=Cu;}return c(s(o.prototype),"setTransitOutCallback",this).call(this,t),this}},{key:"setCoverTransitInCallback",value:function(t){return this.coverTransitInCallback=t,this}},{key:"setCoverTransitOutCallback",value:function(t){return this.coverTransitOutCallback=t,this}}]),o}(du),_u={popUp:0,fadeIn:1,scaleDown:0,fadeOut:1},Eu=function(t){return t&&"function"==typeof t},Mu={modal:function(t,e){return Eu(t)&&(e=t,t=void 0),void 0===this._modalBehavior&&(this.onCreateModalBehavior&&this.onCreateModalBehavior(this,t),this._modalBehavior=function(t,e){var i=new Pu(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:function(t){var e=this;return new Promise((function(i,n){e.modal(t,i);}))},modalClose:function(t){return function(t,e){t.emit("modal.requestClose",e);}(this,t),this}},Ru=function(t,e,i,n){if(e)return Ou(t,e.worldX,e.worldY,i,n);for(var r=t.scene.input.manager,s=r.pointersTotal,o=r.pointers,a=0;a=this.dragThreshold&&this.cancel();}},{key:"click",value:function(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 n=this.lastClickTime;return void 0!==n&&t-n<=this.clickInterval||(this.lastClickTime=t,this.emit("click",this,this.parent,e,i)),this}},{key:"cancel",value:function(){return this.pointer=void 0,this}},{key:"onOver",value:function(t,e,i,n){return this.enable?(this.emit("over",this,this.parent,t,n),this):this}},{key:"onOut",value:function(t,e){return this.enable?(this.emit("out",this,this.parent,t,e),this):this}}]),o}(Lh),Vu={press:0,pointerdown:0,release:1,pointerup:1},Uu={onClick:function(t,e,i,n){return t?("function"==typeof t&&(n=i,i=e,e=t,t=this),void 0===t._click&&(t._click=new Hu(t,n)),t._click.on("click",e,i),this):this},offClick:function(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:function(e,i){return e&&"object"!==t(e)&&(i=e,e=this),void 0===e._click||e._click.setEnable(i),this},disableClick:function(e){return e&&"object"!==t(e)&&(e=this),void 0===e._click||e._click.setEnable(!1),this}},Ju=function(t,e,i,n){if(e)return !(i&&!i(t,e))&&(!!Ku(t,e)&&!(n&&!n(t,e)));for(var r=t.scene.input.manager,s=r.pointersTotal,o=r.pointers,a=0;a0)return qu.length=0,!0;return qu.length=0,!1},qu=[],$u=Phaser.Utils.Objects.GetValue,Zu=function(t){r(o,t);var i=l(o);function o(t,n){var r;e(this,o),(r=i.call(this,t,n))._enable=void 0;var s=$u(n,"inputConfig",void 0);return s&&t.setInteractive(s),r.resetFromJSON(n),r.boot(),r}return n(o,[{key:"resetFromJSON",value:function(t){return this.pointer=void 0,this.lastClickTime=void 0,this.setEnable($u(t,"enable",!0)),this.setMode($u(t,"mode",1)),this.setClickInterval($u(t,"clickInterval",100)),this.setDragThreshold($u(t,"threshold",void 0)),this}},{key:"boot",value:function(){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);}},{key:"shutdown",value:function(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,c(s(o.prototype),"shutdown",this).call(this,t);}}},{key:"enable",get:function(){return this._enable},set:function(t){if(this._enable!==t){t||this.cancel(),this._enable=t;var e=t?"enable":"disable";this.emit(e,this,this.parent);}}},{key:"setEnable",value:function(t){return void 0===t&&(t=!0),this.enable=t,this}},{key:"toggleEnable",value:function(){return this.setEnable(!this.enable),this}},{key:"setMode",value:function(t){return "string"==typeof t&&(t=Qu[t]),this.mode=t,this}},{key:"setClickInterval",value:function(t){return this.clickInterval=t,this}},{key:"setDragThreshold",value:function(t){return this.dragThreshold=t,this}},{key:"isPointerInside",value:function(t){var e=this.parent;return (e.input?Ju:Ru)(e,t)}},{key:"onPress",value:function(t){this.parent.willRender(t.camera)&&void 0===this.pointer&&(this.pointer=t,0===this.mode&&(this.isPointerInside(t)||this.click(t.downTime,t)));}},{key:"onRelease",value:function(t){this.parent.willRender(t.camera)&&this.pointer===t&&(1===this.mode&&(this.isPointerInside(t)||this.click(t.upTime,t)),this.pointer=void 0);}},{key:"onMove",value:function(t,e,i,n){this.pointer===t&&void 0!==this.dragThreshold&&1===this.mode&&(t.getDistance()>=this.dragThreshold||this.isPointerInside(t))&&this.cancel();}},{key:"click",value:function(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}},{key:"cancel",value:function(){return this.pointer=void 0,this}}]),o}(Lh),Qu={press:0,pointerdown:0,release:1,pointerup:1},tc={onClickOutside:function(t,e,i,n){return t?("function"==typeof t&&(n=i,i=e,e=t,t=this),void 0===t._clickOutside&&(t._clickOutside=new Zu(t,n)),t._clickOutside.on("clickoutside",e,i),this):this},offClickOutside:function(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:function(e,i){return e&&"object"!==t(e)&&(i=e,e=this),void 0===e._clickOutside||e._clickOutside.setEnable(i),this},disableClickOutside:function(e){return e&&"object"!==t(e)&&(e=this),void 0===e._clickOutside||e._clickOutside.setEnable(!1),this}},ec=function(t){r(s,t);var i=l(s);function s(){var t;return e(this,s),(t=i.call(this,{eventEmitter:!1})).goto("IDLE"),t}return n(s,[{key:"setCooldownTime",value:function(t){return this.cooldownTime=t,this.cooldownMode=void 0!==t,this}},{key:"request",value:function(){return this.runMethod("request")}},{key:"update_IDLE",value:function(){this.compensationTime=0;}},{key:"request_IDLE",value:function(){return this.next(),!0}},{key:"next_IDLE",value:function(){if(this.cooldownMode)return "COOLDOWN"}},{key:"enter_COOLDOWN",value:function(){this.remainderTime=this.cooldownTime+this.compensationTime;}},{key:"update_COOLDOWN",value:function(t,e){this.remainderTime-=e,this.remainderTime<0&&(this.compensationTime=this.cooldownTime>e?-this.remainderTime:0,this.goto("IDLE"));}},{key:"request_COOLDOWN",value:function(){return !1}}]),s}(ru),ic=Phaser.Utils.Objects.GetValue,nc=function(t){r(o,t);var i=l(o);function o(t,n){var r;return e(this,o),(r=i.call(this,t,n))._enable=void 0,r.cooldown=new ec,r.parent.setInteractive(ic(n,"inputConfig",void 0)),r.resetFromJSON(n),r.boot(),r}return n(o,[{key:"resetFromJSON",value:function(t){return this.pointer=void 0,this.prevIsInTouch=!1,this.isInTouching=!1,this.setEnable(ic(t,"enable",!0)),this.setCooldown(ic(t,"cooldown",void 0)),this}},{key:"boot",value:function(){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);}},{key:"shutdown",value:function(t){this.isShutdown||(this.scene.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,c(s(o.prototype),"shutdown",this).call(this,t));}},{key:"enable",get:function(){return this._enable},set:function(t){if(this._enable!==t)return t||(this.prevIsInTouch=!1,this.isInTouching=!1,this.pointer=void 0),this._enable=t,this}},{key:"setEnable",value:function(t){return void 0===t&&(t=!0),this.enable=t,this}},{key:"cooldownTime",get:function(){return this.cooldown.cooldownTime},set:function(t){this.cooldown.setCooldownTime(t);}},{key:"setCooldown",value:function(t){return this.cooldownTime=t,this}},{key:"toggleEnable",value:function(){return this.setEnable(!this.enable),this}},{key:"onPointIn",value:function(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.pointer=t,this.isInTouching=!0);}},{key:"onPointOut",value:function(t){this.enable&&this.pointer===t&&(this.pointer=void 0,this.isInTouching=!1);}},{key:"preupdate",value:function(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;}}]),o}(Lh),rc={isPointerInBounds:function(t){return void 0===t?t=this:"string"==typeof t&&(t=this.getElement(t)),!!t&&Ru(t)},onTouching:function(t,e,i,n){return t?("function"==typeof t&&(n=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new nc(t,n)),t._inTouching.on("intouch",e,i),this):this},offTouching:function(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:function(t,e,i,n){return t?("function"==typeof t&&(n=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new nc(t,n)),t._inTouching.on("touchend",e,i),this):this},offTouchingEnd:function(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:function(e,i){return e&&"object"!==t(e)&&(i=e,e=this),void 0===e._inTouching||e._inTouching.setEnable(i),this},disableTouching:function(e){return e&&"object"!==t(e)&&(e=this),void 0===e._inTouching||e._inTouching.setEnable(!1),this}},sc=function(t,e,i){for(var n,r=0,s=t.length;r0),this.onDragStart()));}},{key:"onPointerUp",value:function(t){this.enable&&((!this.bounds||this.bounds.contains(t.x,t.y))&&this.pointer===t&&(this.pointer=void 0,this.movedState=!1,this.tracerState=xc,this.onDragEnd()));}},{key:"onPointerMove",value:function(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()));}}},{key:"dragCancel",value:function(){return this.tracerState===Cc&&this.onDragEnd(),this.pointer=void 0,this.tracerState=xc,this}},{key:"onDragStart",value:function(){this.emit("dragstart",this);}},{key:"onDragEnd",value:function(){this.emit("dragend",this);}},{key:"onDrag",value:function(){this.emit("drag",this);}},{key:"preUpdate",value:function(t,e){}},{key:"postUpdate",value:function(t,e){}},{key:"startTicking",value:function(){c(s(o.prototype),"startTicking",this).call(this),this.scene.sys.events.on("preupdate",this.preUpdate,this),this.scene.sys.events.on("postupdate",this.postUpdate,this);}},{key:"stopTicking",value:function(){c(s(o.prototype),"stopTicking",this).call(this),this.scene&&(this.scene.sys.events.off("preupdate",this.preUpdate,this),this.scene.sys.events.off("postupdate",this.postUpdate,this));}},{key:"setRecongizedStateObject",value:function(t){return this.recongizedState=t,this}},{key:"state",get:function(){return this.recongizedState.state},set:function(t){this.recongizedState.state=t;}},{key:"cancel",value:function(){return this.state=Sc,this}}]),o}(zh),xc=0,Cc=1,Sc="IDLE",wc=Phaser.Utils.Objects.GetValue,Oc=Phaser.Math.Distance.Between,Tc=function(t){r(o,t);var i=l(o);function o(t,n){var r;e(this,o);var s=a(r=i.call(this,t,n)),h={states:{IDLE:{enter:function(){s.stop(),s.tapsCount=0,s.x=0,s.y=0,s.worldX=0,s.worldY=0;},exit:function(){var t=s.lastPointer;s.x=t.x,s.y=t.y,s.worldX=t.worldX,s.worldY=t.worldY;}},BEGIN:{enter:function(){s.start(),s.tapsCount=0,s.emit("tappingstart",s,s.gameObject,s.lastPointer);}},RECOGNIZED:{enter:function(){s.start(),s.emit("tap",s,s.gameObject,s.lastPointer),s.emit("".concat(s.tapsCount,"tap"),s,s.gameObject,s.lastPointer);}}},init:function(){this.state=Pc;},eventEmitter:!1};return r.setRecongizedStateObject(new ru(h)),r}return n(o,[{key:"resetFromJSON",value:function(t){c(s(o.prototype),"resetFromJSON",this).call(this,t),this.setHoldTime(wc(t,"time",250)),this.setTapInterval(wc(t,"tapInterval",200)),this.setDragThreshold(wc(t,"threshold",9)),this.setTapOffset(wc(t,"tapOffset",10));var e=wc(t,"taps",void 0);return void 0!==e?this.setTaps(e):(this.setMaxTaps(wc(t,"maxTaps",void 0)),this.setMinTaps(wc(t,"minTaps",void 0))),this}},{key:"onDragStart",value:function(){switch(this.state){case Pc:this.state=_c;break;case _c:var t=this.lastPointer;Oc(t.upX,t.upY,t.x,t.y)>this.tapOffset&&(this.state=Ec,this.state=_c);break;case Ec:this.state=_c;}}},{key:"onDragEnd",value:function(){this.state===_c&&(this.tapsCount++,this.emit("tapping",this,this.gameObject,this.lastPointer),void 0!==this.maxTaps&&this.tapsCount===this.maxTaps&&(this.state=Ec));}},{key:"onDrag",value:function(){this.state!==Pc&&this.pointer.getDistance()>this.dragThreshold&&(this.state=Pc);}},{key:"preUpdate",value:function(t,e){if(this.isRunning&&this.enable&&this.state===_c){var i=this.lastPointer;if(i.isDown)t-i.downTime>this.holdTime&&(this.state=Pc);else t-i.upTime>this.tapInterval&&(void 0===this.minTaps||this.tapsCount>=this.minTaps?this.state=Ec:this.state=Pc);}}},{key:"postUpdate",value:function(t,e){this.isRunning&&this.enable&&this.state===Ec&&(this.state=Pc);}},{key:"isTapped",get:function(){return this.state===Ec}},{key:"setHoldTime",value:function(t){return this.holdTime=t,this}},{key:"setTapInterval",value:function(t){return this.tapInterval=t,this}},{key:"setDragThreshold",value:function(t){return this.dragThreshold=t,this}},{key:"setTapOffset",value:function(t){return this.tapOffset=t,this}},{key:"setMaxTaps",value:function(t){return this.maxTaps=t,this}},{key:"setMinTaps",value:function(t){return this.minTaps=t,this}},{key:"setTaps",value:function(t,e){return void 0===e&&(e=t),this.setMinTaps(t).setMaxTaps(e),this}}]),o}(bc),Pc="IDLE",_c="BEGIN",Ec="RECOGNIZED",Mc=Phaser.Utils.Objects.GetValue,Rc=function(t){r(o,t);var i=l(o);function o(t,n){var r;e(this,o);var s=a(r=i.call(this,t,n)),h={states:{IDLE:{enter:function(){s.x=0,s.y=0,s.worldX=0,s.worldY=0;},exit:function(){var t=s.lastPointer;s.x=t.x,s.y=t.y,s.worldX=t.worldX,s.worldY=t.worldY;}},BEGIN:{enter:function(){s.start();},exit:function(){s.stop();}},RECOGNIZED:{enter:function(){s.emit("pressstart",s,s.gameObject,s.lastPointer);},exit:function(){s.emit("pressend",s,s.gameObject,s.lastPointer);}}},init:function(){this.state=Lc;},eventEmitter:!1};return r.setRecongizedStateObject(new ru(h)),r}return n(o,[{key:"resetFromJSON",value:function(t){return c(s(o.prototype),"resetFromJSON",this).call(this,t),this.setDragThreshold(Mc(t,"threshold",9)),this.setHoldTime(Mc(t,"time",251)),this}},{key:"onDragStart",value:function(){this.state=Ac,0===this.holdTime&&(this.state=Dc);}},{key:"onDragEnd",value:function(){this.state=Lc;}},{key:"onDrag",value:function(){this.state!==Lc&&this.pointer.getDistance()>this.dragThreshold&&(this.state=Lc);}},{key:"preUpdate",value:function(t,e){this.isRunning&&this.enable&&(this.state===Ac&&t-this.pointer.downTime>=this.holdTime&&(this.state=Dc));}},{key:"isPressed",get:function(){return this.state===Dc}},{key:"setHoldTime",value:function(t){return this.holdTime=t,this}},{key:"setDragThreshold",value:function(t){return this.dragThreshold=t,this}}]),o}(bc),Lc="IDLE",Ac="BEGIN",Dc="RECOGNIZED";Phaser.Utils.Objects.GetValue;var zc=function(t){return Jr(t).loop.delta},Ic=Phaser.Math.Distance.Between,jc=Phaser.Math.Angle.Between,Bc={getDt:function(){return zc(this.scene)},getVelocity:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Ic(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 jc(e.x,e.y,t.x,t.y)}},Fc={"up&down":0,"left&right":1,"4dir":2,"8dir":3},Wc={},Yc=Phaser.Utils.Objects.GetValue,Nc=Phaser.Math.RadToDeg,Xc=function(t){r(o,t);var i=l(o);function o(t,n){var r;e(this,o);var s=a(r=i.call(this,t,n)),h={states:{IDLE:{enter:function(){s.x=0,s.y=0,s.worldX=0,s.worldY=0;},exit:function(){var t=s.lastPointer;s.x=t.x,s.y=t.y,s.worldX=t.worldX,s.worldY=t.worldY;}},BEGIN:{enter:function(){s.validDrag=!1;}},RECOGNIZED:{enter:function(){s.start(),s.updateDirectionStates(),s.emit("swipe",s,s.gameObject,s.lastPointer);},exit:function(){s.stop(),s.clearDirectionStates();}}},init:function(){this.state=Gc;},eventEmitter:!1};return r.setRecongizedStateObject(new ru(h)),r.clearDirectionStates(),r}return n(o,[{key:"resetFromJSON",value:function(t){return c(s(o.prototype),"resetFromJSON",this).call(this,t),this.setDragThreshold(Yc(t,"threshold",10)),this.setVelocityThreshold(Yc(t,"velocityThreshold",1e3)),this.setDirectionMode(Yc(t,"dir","8dir")),this}},{key:"onDragStart",value:function(){this.state=Hc;}},{key:"onDragEnd",value:function(){this.state=Gc;}},{key:"onDrag",value:function(){this.state===Hc&&(this.validDrag||(this.validDrag=0===this.dragThreshold||this.pointer.getDistance()>=this.dragThreshold),this.validDrag&&this.dragVelocity>this.velocityThreshold&&(this.state=Vc));}},{key:"postUpdate",value:function(t,e){this.isRunning&&this.enable&&this.state===Vc&&(this.state=Gc);}},{key:"isSwiped",get:function(){return this.state===Vc}},{key:"dragVelocity",get:function(){var t;switch(this.dirMode){case 0:t=this.getVelocityY();break;case 1:t=this.getVelocityX();break;default:t=this.getVelocity();}return t}},{key:"setDragThreshold",value:function(t){return this.dragThreshold=t,this}},{key:"setVelocityThreshold",value:function(t){return this.velocityThreshold=t,this}},{key:"setDirectionMode",value:function(t){return "string"==typeof t&&(t=Fc[t]),this.dirMode=t,this}},{key:"updateDirectionStates",value:function(){return function(t,e,i){switch(void 0===i?i={}:!0===i&&(i=Wc),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;}}(Nc(this.getVelocityAngle()),this.dirMode,this),this}},{key:"clearDirectionStates",value:function(){return this.left=!1,this.right=!1,this.up=!1,this.down=!1,this}}]),o}(bc);Object.assign(Xc.prototype,Bc);var Gc="IDLE",Hc="BEGIN",Vc="RECOGNIZED",Uc=Phaser.Utils.Objects.GetValue,Jc=Phaser.Utils.Array.SpliceOne,Kc=Phaser.Math.Distance.Between,qc=Phaser.Math.Angle.Between,$c=function(){function t(i,n){e(this,t);var r=i.input.manager.pointersTotal-1;r<2&&i.input.addPointer(2-r),this.scene=i,this.setEventEmitter(Uc(n,"eventEmitter",void 0)),this._enable=void 0,this.pointers=[],this.movedState={},this.resetFromJSON(n),this.boot();}return n(t,[{key:"resetFromJSON",value:function(t){return this.setEnable(Uc(t,"enable",!0)),this.bounds=Uc(t,"bounds",void 0),this.tracerState=Qc,this.pointers.length=0,Ki(this.movedState),this}},{key:"boot",value:function(){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);}},{key:"shutdown",value:function(){this.scene&&(this.destroyEventEmitter(),this.pointers.length=0,Ki(this.movedState),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);}},{key:"destroy",value:function(){this.shutdown();}},{key:"enable",get:function(){return this._enable},set:function(t){if(this._enable!==t)return t||this.dragCancel(),this._enable=t,this}},{key:"setEnable",value:function(t){return void 0===t&&(t=!0),this.enable=t,this}},{key:"toggleEnable",value:function(){return this.setEnable(!this.enable),this}},{key:"onPointerDown",value:function(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.tracerState){case Qc:this.tracerState=td,this.onDrag1Start();break;case td:this.tracerState=ed,this.onDrag2Start();}}},{key:"onPointerUp",value:function(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],Jc(this.pointers,e),this.tracerState){case td:this.tracerState=Qc,this.onDrag1End();break;case ed:this.tracerState=td,this.onDrag2End(),this.onDrag1Start();}}}},{key:"onPointerMove",value:function(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 td:this.onDrag1();break;case ed:this.onDrag2();}}}},{key:"dragCancel",value:function(){return this.tracerState===ed&&this.onDrag2End(),this.pointers.length=0,Ki(this.movedState),this.tracerState=Qc,this}},{key:"onDrag1Start",value:function(){this.emit("drag1start",this);}},{key:"onDrag1End",value:function(){this.emit("drag1end",this);}},{key:"onDrag1",value:function(){this.emit("drag1",this);}},{key:"onDrag2Start",value:function(){this.emit("drag2start",this);}},{key:"onDrag2End",value:function(){this.emit("drag2end",this);}},{key:"onDrag2",value:function(){this.emit("drag2",this);}},{key:"distanceBetween",get:function(){if(this.tracerState!==ed)return 0;var t=this.pointers[0],e=this.pointers[1];return Kc(t.x,t.y,e.x,e.y)}},{key:"angleBetween",get:function(){if(this.tracerState!==ed)return 0;var t=this.pointers[0],e=this.pointers[1];return qc(t.x,t.y,e.x,e.y)}},{key:"drag1Vector",get:function(){var t=this.pointers[0];if(t&&this.movedState[t.id]){var e=t.position,i=t.prevPosition;Zc.x=e.x-i.x,Zc.y=e.y-i.y;}else Zc.x=0,Zc.y=0;return Zc}},{key:"centerX",get:function(){if(this.tracerState!==ed)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return (t.x+e.x)/2}},{key:"centerY",get:function(){if(this.tracerState!==ed)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return (t.y+e.y)/2}},{key:"prevCenterX",get:function(){if(this.tracerState!==ed)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}},{key:"prevCenterY",get:function(){if(this.tracerState!==ed)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}},{key:"movementCenterX",get:function(){return this.centerX-this.prevCenterX}},{key:"movementCenterY",get:function(){return this.centerY-this.prevCenterY}},{key:"setRecongizedStateObject",value:function(t){return this.recongizedState=t,this}},{key:"state",get:function(){return this.recongizedState.state},set:function(t){this.recongizedState.state=t;}},{key:"cancel",value:function(){return this.state=id,this}}]),t}();Object.assign($c.prototype,Eh);var Zc={},Qc=0,td=1,ed=2,id="IDLE";Phaser.Utils.Objects.GetValue;var nd=Phaser.Math.RotateAround,rd=function(t,e,i,n){return nd(t,e,i,n),t.rotation+=n,t},sd={},od=Phaser.Utils.Objects.GetValue,ad=Phaser.Math.Angle.WrapDegrees,hd=Phaser.Math.Angle.ShortestBetween,ld=Phaser.Math.RadToDeg,ud=Phaser.Math.DegToRad,cd=function(t){r(o,t);var i=l(o);function o(t,n){var r;e(this,o);var s=a(r=i.call(this,t,n)),h={states:{IDLE:{enter:function(){s.prevAngle=void 0,s.angle=0;}},BEGIN:{},RECOGNIZED:{enter:function(){s.emit("rotatestart",s);},exit:function(){s.emit("rotateend",s);}}},init:function(){this.state=pd;},eventEmitter:!1};return r.setRecongizedStateObject(new ru(h)),r}return n(o,[{key:"resetFromJSON",value:function(t){return c(s(o.prototype),"resetFromJSON",this).call(this,t),this.setDragThreshold(od(t,"threshold",0)),this}},{key:"onDrag2Start",value:function(){this.prevAngle=ad(ld(this.angleBetween)),this.state=fd,0===this.dragThreshold&&(this.state=vd);}},{key:"onDrag2End",value:function(){this.state=pd;}},{key:"onDrag2",value:function(){switch(this.state){case fd:if(this.pointers[0].getDistance()>=this.dragThreshold&&this.pointers[1].getDistance()>=this.dragThreshold){var t=ad(ld(this.angleBetween));this.angle=hd(this.prevAngle,t),this.prevAngle=t,this.state=vd;}break;case vd:t=ad(ld(this.angleBetween));this.angle=hd(this.prevAngle,t),this.prevAngle=t,this.emit("rotate",this);}}},{key:"isRotated",get:function(){return this.state===vd}},{key:"rotation",get:function(){return ud(this.angle)}},{key:"setDragThreshold",value:function(t){return this.dragThreshold=t,this}}]),o}($c),dd={spinObject:function(t,e){if(!this.isRotation)return this;void 0===e&&(e=this.pointers[0].camera);var i=this.movementCenterX,n=this.movementCenterY,r=function(t,e,i,n){return void 0===n?n={}:!0===n&&(n=sd),i.getWorldPoint(t,e,n),n}(this.centerX,this.centerY,e,!0),s=r.x,o=r.y,a=this.rotation;if(Array.isArray(t))for(var h=t,l=0,u=h.length;l=this.sizerChildren.length?this.sizerChildren.push(e):this.sizerChildren.splice(a,0,e),e.isRexSizer||(i>0&&(0===this.orientation?e.minWidth=void 0===h?qo(e):h:e.minHeight=void 0===l?$o(e):l),s&&(0===this.orientation?e.minHeight=l:e.minWidth=h)),void 0!==o&&this.addChildrenMap(o,e),this},zd={add:Dd,addSpace:function(t){return this.insertSpace(void 0,t),this},insertSpace:function(t,e){return void 0===e&&(e=1),Dd.call(this,new Ks(this.scene),{proportion:e,minWidth:0,minHeight:0,index:t}),this},insert:function(t,e,i,n,r,s,o,a){return Md(i)&&(i.index=t),Dd.call(this,e,i,n,r,s,o,t,a),this},insertAtPosition:function(t,e,i,n,r,s,o,a,h){var l=Ed.call(this,t,e);return -1===l&&(l=void 0),this.insert(l,i,n,r,s,o,a,h),this}},Id=wa.prototype.clear,jd=function(t){this.backgroundChildren&&(this.backgroundChildren.length=0);var e,i=!t&&this.sizerEventsEnable;if(i&&(e=this.getChildren([])),Id.call(this,t),i)for(var n,r=0,s=e.length;r=0;e--)this.remove(this.sizerChildren[e],t);return this},clear:function(t){return this.sizerChildren.length=0,jd.call(this,t),this}},Wd={getChildAlign:function(t){return this.getSizerConfig(t).align},setChildAlign:function(t,e){return "string"==typeof e&&(e=Ra[e]),this.getSizerConfig(t).align=e,this}},Yd={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,n,r=0,s=this.sizerChildren;if(0===this.orientation)for(var o=this.space.item,a=!0,h=0,l=s.length;h0&&this.proportionLength>0&&(i=n.proportion*this.proportionLength):n.expand&&(i=e-this.space.left-this.space.right-r.left-r.right);return i},getExpandedChildHeight:function(t,e){var i;void 0===e&&(e=this.height);var n=t.rexSizer,r=n.padding;0===this.orientation?n.expand&&(i=e-this.space.top-this.space.bottom-r.top-r.bottom):n.proportion>0&&this.proportionLength>0&&(i=n.proportion*this.proportionLength);return i},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,n=0,r=i.length;n0?(e=t-this.getChildrenWidth(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0;}return t},resolveHeight:function(t){t=Oh.call(this,t);if(void 0===this.proportionLength&&1===this.orientation){var e=t-this.childrenHeight;e>0?(e=t-this.getChildrenHeight(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0;}return t}};Object.assign(Yd,zd,Fd,Wd,{getChildProportion:function(t){return this.getSizerConfig(t).proportion},setChildProportion:function(t,e){return this.getSizerConfig(t).proportion=e,this}},{getChildExpand:function(t){return this.getSizerConfig(t).expand},setChildExpand:function(t,e){return this.getSizerConfig(t).expand=e,this}});var Nd=function(){for(var t,e,i=0,n=this.sizerChildren,r=0,s=n.length;r0&&(i+=e);return i},Xd={x:0,h:0,horizontal:0,"left-to-right":0,y:1,v:1,vertical:1,"top-to-bottom":1},Gd=function(t){return "string"==typeof t&&(t=Xd[t]),t},Hd=Phaser.Utils.Objects.IsPlainObject,Vd=Phaser.Utils.Objects.GetValue,Ud=function(t){r(s,t);var i=l(s);function s(t,n,r,o,a,h,l){var u;return e(this,s),Hd(n)?(n=Vd(l=n,"x",0),r=Vd(l,"y",0),o=Vd(l,"width",void 0),a=Vd(l,"height",void 0),h=Vd(l,"orientation",0)):Hd(o)?(o=Vd(l=o,"width",void 0),a=Vd(l,"height",void 0),h=Vd(l,"orientation",0)):Hd(h)&&(h=Vd(l=h,"orientation",0)),void 0===h&&(h=0),(u=i.call(this,t,n,r,o,a,l)).type="rexSizer",u.sizerChildren=[],u.setOrientation(h),u.setItemSpacing(Vd(l,"space.item",0)),u.setStartChildIndex(Vd(l,"startChildIndex",0)),u.setRTL(Vd(l,"rtl",!1)),u.addChildrenMap("items",u.sizerChildren),u}return n(s,[{key:"setOrientation",value:function(t){return this.orientation=Gd(t),this}},{key:"setItemSpacing",value:function(t){return this.space.item=t,this}},{key:"setStartChildIndex",value:function(t){return this.startChildIndex=t,this}},{key:"setRTL",value:function(t){return void 0===t&&(t=!0),this.rtl=t,this}},{key:"childrenProportion",get:function(){return void 0===this._childrenProportion&&(this._childrenProportion=Nd.call(this)),this._childrenProportion}}]),s}(Td);Object.assign(Ud.prototype,Yd);var Jd=function(t,e,i,n){return e/t<=i?e/(n-1):0},Kd=function(t,e){void 0===e?e={lines:[],width:0,height:0}:(e.lines.length=0,e.width=0,e.height=0);for(var i,n,r,s,o=this.sizerChildren,a=this.space.item,h=this.space.line,l=this.space.indentLeftOdd,u=this.space.indentLeftEven,c=this.space.indentTopOdd,d=this.space.indentTopEven,p=0,f=e.lines,v=void 0,g=0,y=o.length;ga.height/2)){r>(h=Zd(a.left,a.centerY,t,e))&&(r=h,n=s);var h,l=i[s+1];if(!l||l.y!==a.y)r>(h=Zd(a.right,a.centerY,t,e))&&(r=h,n=s+1);}}return n},tp=Phaser.Utils.Objects.IsPlainObject,ep=Phaser.Utils.Objects.GetValue,ip=Phaser.Display.Align.CENTER,np=function(t,e,i,n){if("\n"===t)return this.addNewLine(),this;var r;(lh.call(this,t),tp(e))&&(e=ep(r=e,"padding",0),i=ep(r,"key",void 0),n=ep(r,"index",void 0));return void 0===e&&(e=0),(r=this.getSizerConfig(t)).align=ip,r.padding=ah(e),void 0===n||n>=this.sizerChildren.length?this.sizerChildren.push(t):this.sizerChildren.splice(n,0,t),void 0!==i&&this.addChildrenMap(i,t),this},rp={add:function(t,e,i){if(Lu(t))for(var n=t,r=0,s=n.length;r=0;e--)this.remove(this.sizerChildren[e],t);return this},clear:function(t){return this.sizerChildren.length=0,jd.call(this,t),this}},ap={getChildrenWidth:function(){return this.rexSizer.hidden?0:this.maxChildWidth+this.space.left+this.space.right},getChildrenHeight:function(){return this.rexSizer.hidden?0:this.widthWrapResult.height+this.space.top+this.space.bottom},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,n=0,r=i.length;n=0;e--){var i=this.sizerChildren[e];i&&this.remove(i,t);}return this},clear:function(t){return xp(this.sizerChildren,null),jd.call(this,t),this}},Sp={setColumnSpace:function(t){if(this.space.column||(this.space.column=[]),this.space.column.length=this.columnCount-1,"number"==typeof t)xp(this.space.column,t);else for(var e=0,i=this.columnCount-1;e=0;n--){var r=n*this.columnCount+t;this.sizerChildren.splice(r,0,null);}return this.columnProportions.push(e),this.columnWidth.length+=1,this.space.column.splice(t,0,i),this},Pp={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);for(var e,i,n,r,s=0,o=this.sizerChildren,a=0;a0){var i=t-this.getChildrenWidth(!1);i>=0&&(this.proportionWidthLength=i/e);}else this.proportionWidthLength=0;}return t},resolveHeight:function(t){t=Oh.call(this,t);if(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,n;for(var r in this.sizerChildren)(e=this.sizerChildren[r])&&e.isRexSizer&&!e.ignoreLayout&&(n=this.getColumnWidth(parseInt(r)%this.columnCount),i=this.getExpandedChildWidth(e,n),i=e.resolveWidth(i),e.resolveChildrenWidth(i));},runWidthWrap:function(t){var e,i,n;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(n=this.getColumnWidth(parseInt(r)%this.columnCount),i=this.getExpandedChildWidth(e,n),e.isRexSizer&&(i=e.resolveWidth(i)),e.runWidthWrap(i));return this},resetGrid:function(t,e,i,n,r){if(void 0===i&&(i=0),void 0===n&&(n=0),this.columnCount=t,this.rowCount=e,this.gridCount=t*e,this.removeAll(),this.sizerChildren.length=t*e,xp(this.sizerChildren,null),this.columnProportions=[],this.columnProportions.length=t,"number"==typeof i)xp(this.columnProportions,i);else for(var s=0;s0&&(e+=t);return e},Ep=function(){for(var t,e=0,i=0;i0&&(e+=t);return e},Mp=Phaser.Utils.Objects.IsPlainObject,Rp=Phaser.Utils.Objects.GetValue,Lp=function(t){r(o,t);var i=l(o);function o(t,n,r,s,a,h,l,u,c,d){var p;return e(this,o),Mp(n)?(n=Rp(d=n,"x",0),r=Rp(d,"y",0),s=Rp(d,"width",void 0),a=Rp(d,"height",void 0),h=Rp(d,"column",d.col||0),l=Rp(d,"row",0),u=Rp(d,"columnProportions",0),c=Rp(d,"rowProportions",0)):Mp(s)?(s=Rp(d=s,"width",void 0),a=Rp(d,"height",void 0),h=Rp(d,"column",d.col||0),l=Rp(d,"row",0),u=Rp(d,"columnProportions",0),c=Rp(d,"rowProportions",0)):Mp(h)?(h=Rp(d=h,"column",d.col||0),l=Rp(d,"row",0),u=Rp(d,"columnProportions",0),c=Rp(d,"rowProportions",0)):Mp(u)&&(u=Rp(d=u,"columnProportions",0),c=Rp(d,"rowProportions",0)),(p=i.call(this,t,n,r,s,a,d)).type="rexGridSizer",p.sizerChildren=[],p.addChildrenMap("items",p.sizerChildren),p.setCreateCellContainerCallback(Rp(d,"createCellContainerCallback")),p.setIndentLeft(Rp(d,"space.indentLeftOdd",0),Rp(d,"space.indentLeftEven",0)),p.setIndentTop(Rp(d,"space.indentTopOdd",0),Rp(d,"space.indentTopEven",0)),p.resetGrid(h,l,u,c,Rp(d,"space",void 0)),p}return n(o,[{key:"destroy",value:function(t){this.scene&&!this.ignoreDestroy&&(c(s(o.prototype),"destroy",this).call(this,t),this.columnProportions=void 0,this.rowProportions=void 0,this.columnWidth=void 0,this.rowHeight=void 0,this.createCellContainerCallback=void 0);}},{key:"setColumnProportion",value:function(t,e){return t>=this.columnProportions.length||(this.columnProportions[t]=e),this}},{key:"setRowProportion",value:function(t,e){return t>=this.rowProportions.length||(this.rowProportions[t]=e),this}},{key:"totalColumnProportions",get:function(){return void 0===this._totalColumnProportions&&(this._totalColumnProportions=_p.call(this)),this._totalColumnProportions}},{key:"totalRowProportions",get:function(){return void 0===this._totalRowProportions&&(this._totalRowProportions=Ep.call(this)),this._totalRowProportions}},{key:"getChildAt",value:function(t,e){return this.sizerChildren[e*this.columnCount+t]}},{key:"childToGridIndex",value:function(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)}},{key:"getColumnWidth",value:function(t){var e=this.columnProportions[t];return 0===e?this.columnWidth[t]:e*this.proportionWidthLength}},{key:"getRowHeight",value:function(t){var e=this.rowProportions[t];return 0===e?this.rowHeight[t]:e*this.proportionHeightLength}},{key:"setCreateCellContainerCallback",value:function(t){return this.createCellContainerCallback=t,this}}]),o}(Td);Object.assign(Lp.prototype,Pp);var Ap=Phaser.Utils.Objects.IsPlainObject,Dp=Phaser.Utils.Objects.GetValue,zp=Phaser.Display.Align.CENTER,Ip=Phaser.Utils.String.UUID,jp={add:function(t,e,i,n,r,s,o,a,h){(lh.call(this,t),Ap(e))&&(e=Dp(l=e,"key",void 0),i=Dp(l,"align",zp),a=Dp(l,"offsetX",0),h=Dp(l,"offsetY",0),n=Dp(l,"padding",0),r=Dp(l,"expand",!0),t.isRexSizer||(s=Dp(l,"minWidth",t._minWidth),o=Dp(l,"minHeight",t._minHeighted)));var l,u=void 0!==e;return u||(e=Ip()),"string"==typeof i&&(i=Ra[i]),void 0===i&&(i=zp),void 0===a&&(a=0),void 0===h&&(h=0),void 0===n&&(n=0),void 0===r&&(r=!0),t.isRexSizer||(void 0===s&&(s=t._minWidth),void 0===o&&(o=t._minHeight)),(l=this.getSizerConfig(t)).align=i,l.alignOffsetX=a,l.alignOffsetY=h,l.padding=ah(n),Ap(r)?(l.expandWidth=Dp(r,"width",!1),l.expandHeight=Dp(r,"height",!1)):(l.expandWidth=r,l.expandHeight=r),t.isRexSizer||(l.expandWidth&&(t.minWidth=void 0===s?qo(t):s),l.expandHeight&&(t.minHeight=void 0===o?$o(t):o)),this.sizerChildren.hasOwnProperty(e)&&this.sizerChildren[e].destroy(),this.sizerChildren[e]=t,u&&this.addChildrenMap(e,t),this}},Bp={remove:function(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]),ph.call(this,t,e),this},removeAll:function(t){for(var e in this.sizerChildren)this.remove(e,t);return this},clear:function(t){for(var e in this.sizerChildren)delete this.sizerChildren[e],this.childrenMap.hasOwnProperty(e)&&delete this.childrenMap[e];return jd.call(this,t),this}},Fp={getChildrenWidth:function(){if(this.rexSizer.hidden)return 0;var t,e,i,n=0,r=this.sizerChildren;for(var s in r)e=(t=r[s]).rexSizer.padding,i=this.getChildWidth(t)+e.left+e.right,n=Math.max(i,n);return n+this.space.left+this.space.right},getChildrenHeight:function(){if(this.rexSizer.hidden)return 0;var t,e,i,n=0,r=this.sizerChildren;for(var s in r)i=(t=r[s]).isRexSizer?Math.max(t.minHeight,t.childrenHeight):void 0!==t.minHeight?t.minHeight:$o(t),i+=(e=t.rexSizer.padding).top+e.bottom,n=Math.max(i,n);return n+this.space.top+this.space.bottom},getExpandedChildWidth:function(t,e){var i;void 0===e&&(e=this.width);var n=t.rexSizer;if(n.expandWidth){var r=e-this.space.left-this.space.right,s=n.padding;i=r-s.left-s.right;}return i},getExpandedChildHeight:function(t,e){var i;void 0===e&&(e=this.height);var n=t.rexSizer;if(n.expandHeight){var r=e-this.space.top-this.space.bottom,s=n.padding;i=r-s.top-s.bottom;}return i},getChildrenSizers:function(t){void 0===t&&(t=[]);var e,i=this.sizerChildren;for(var n in i)(e=i[n]).isRexSizer&&t.push(e);return t},layoutChildren:function(){var t,e,i,n,r,s,o,a,h,l=this.innerLeft,u=this.innerTop,c=this.innerWidth,d=this.innerHeight,p=this.sizerChildren;for(var f in p)(t=p[f]).rexSizer.hidden||(i=(e=t.rexSizer).padding,Yu.call(this,t),t.isRexSizer?(t.runLayout(this,this.getExpandedChildWidth(t),this.getExpandedChildHeight(t)),Pd(t,this)):(a=void 0,h=void 0,e.expandWidth&&(a=c-i.left-i.right),e.expandHeight&&(h=d-i.top-i.bottom),ju(t,a,h)),n=l+i.left,s=c-i.left-i.right,r=u+i.top,o=d-i.top-i.bottom,Nu.call(this,t,n,r,s,o,e.align,e.alignOffsetX,e.alignOffsetY));}};Object.assign(Fp,jp,Bp);var Wp=Phaser.Utils.Objects.IsPlainObject,Yp=Phaser.Utils.Objects.GetValue,Np=function(t){r(s,t);var i=l(s);function s(t,n,r,o,a,h){var l;return e(this,s),Wp(n)?(n=Yp(h=n,"x",0),r=Yp(h,"y",0),o=Yp(h,"width",void 0),a=Yp(h,"height",void 0)):Wp(o)&&(o=Yp(h=o,"width",void 0),a=Yp(h,"height",void 0)),(l=i.call(this,t,n,r,o,a,h)).type="rexOverlapSizer",l.sizerChildren={},l.addChildrenMap("items",l.sizerChildren),l}return n(s,[{key:"childToKey",value:function(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}}]),s}(Td);Object.assign(Np.prototype,Fp);var Xp=Ud.prototype.add,Gp=Ud.prototype.addSpace,Hp=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)&&Gp.call(this),Xp.call(this,t,{proportion:i,expand:!0});var n=!this.buttonsExpand&&"center"===this.buttonsAlign;n&&Gp.call(this),this.hasTailSpace=n;}else Xp.call(this,t,{proportion:i,expand:!0}),this.hasTailSpace=!1;else if(this.hasTailSpace){var r=this.sizerChildren.length-1;Xp.call(this,t,{index:r,proportion:i,expand:!0});}else Xp.call(this,t,{proportion:i,expand:!0});return e&&this.buttonGroup.add(t),this},Vp={addButton:function(t){if(Lu(t))for(var e=t,i=0,n=e.length;i=0;i--)Kp.call(this,e[i],t);return this}},$p=function(t,e,i){if(t){var n=this.setValueCallback,r=this.setValueCallbackScope;n&&(r?n.call(r,t,e,i):n(t,e,i)),this.fireEvent("button.statechange",t,e,i);}},Zp=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 n=t._selected;t._selected=i,$p.call(e,t,i,n);}},enumerable:!0,configurable:!0}),t.selected=!1;},Qp={add:function(t){return this.buttons.push(t),t._click||(t._click=new Hu(t,this.clickConfig),t._click.on("click",(function(t,e,i,n){this.fireEvent("button.click",e,i,n);}),this).on("enable",(function(t,e){this.fireEvent("button.enable",e);}),this).on("disable",(function(t,e){this.fireEvent("button.disable",e);}),this),t.on("pointerover",(function(e,i,n,r){this.fireEvent("button.over",t,e,r);}),this).on("pointerout",(function(e,i){this.fireEvent("button.out",t,e,i);}),this).on("pointerdown",(function(e,i,n,r){this.fireEvent("button.down",t,e,r);}),this).on("pointerup",(function(e,i){this.fireEvent("button.up",t,e,i);}),this)),this.buttonsType&&(void 0===t.name&&console.error("".concat(this.parent.constructor.name,": Option button miss value")),Zp.call(this,t)),this},addMultiple:function(t){for(var e=0,i=t.length;e2?o-2:0),h=2;hr&&pf.addNewLine(this);}else for(s=0,o=t.length;s=0;i--)mf.call(this,e[i],t);return this}},bf=Phaser.Utils.Objects.GetValue,xf=function(t){r(o,t);var i=l(o);function o(t,n){var r;e(this,o),void 0===n&&(n={});var s=n.space;"number"==typeof s&&(n.space={item:s,line:s}),(r=i.call(this,t,n)).type="rexFixWidthButtons",r.buttonGroup=new af({parent:a(r),eventEmitter:bf(n,"eventEmitter",a(r)),groupName:bf(n,"groupName",void 0),clickConfig:bf(n,"click",void 0)}).setButtonsType(n);var h=bf(n,"background",void 0),l=bf(n,"buttons",void 0);return r.buttonsAlign=bf(n,"align",void 0),h&&r.addBackground(h),l&&r.addButtons(l),r.addChildrenMap("background",h),r.addChildrenMap("buttons",r.buttonGroup.buttons),r}return n(o,[{key:"destroy",value:function(t){this.scene&&!this.ignoreDestroy&&(c(s(o.prototype),"destroy",this).call(this,t),this.buttonGroup.destroy(),this.buttonGroup=void 0);}},{key:"buttons",get:function(){return this.buttonGroup.buttons}},{key:"groupName",get:function(){return this.buttonGroup.groupName},set:function(t){this.buttonGroup.groupName=t;}},{key:"eventEmitter",get:function(){return this.buttonGroup.eventEmitter}}]),o}(dp);Object.assign(xf.prototype,vf,kf,of,lf);var Cf=Lp.prototype.add,Sf={addButton:function(t,e,i){return Cf.call(this,t,e,i,void 0,0,this.buttonsExpand),this.buttonGroup.add(t),this},addButtons:function(t,e){for(var i=0,n=t;i=0;i--)Tf.call(this,e[i],t);return this}},_f=Phaser.Utils.Objects.GetValue,Ef=function(t){r(o,t);var i=l(o);function o(t,n){var r;e(this,o),void 0===n&&(n={});var s=_f(n,"row",0),h=_f(n,"column",n.col||0),l=_f(n,"createCellContainerCallback"),u=_f(n,"buttons",void 0),c=_f(n,"expand",!0),d=c?1:0;if(l&&(n.createCellContainerCallback=void 0),void 0!==u){s=Math.max(s,u.length);for(var p=0,f=u.length;p0?t.setText(e).getTextBounds().wrappedText.split("\n"):e.split("\n");}return i},iv=function(t){return Array.isArray(t)?t=t.join("\n"):"number"==typeof t&&(t=t.toString()),t},nv={clearText:function(){return this.sections.length=0,this.pageStartIndexes.length=0,this.lines.length=0,this},appendPage:function(t){var e=this.totalLinesCount;this.sections.push(iv(t));t=this.sections.join("\n");this.lines=ev(this.parent,t,this.lines);for(var i=this.totalLinesCount-e,n=Math.ceil(i/this.pageLinesCount),r=0;r=this.pageCount-1}},{key:"totalLinesCount",get:function(){return this.lines?this.lines.length:0}},{key:"startLineIndex",get:function(){return this._startLineIndex},set:function(t){t=uv(t,0,this.totalLinesCount-1),this._startLineIndex=t;}},{key:"setStartLineIndex",value:function(t){return this.startLineIndex=t,this}},{key:"pageLinesCount",get:function(){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,n;switch(tv(t)){case 0:case 1:e=t.height-t.padding.top-t.padding.bottom,i=t.lineSpacing,n=t.style.metrics.fontSize+t.style.strokeThickness;break;case 2:e=t.height,i=0;var r=t.fontSize/t.fontData.size;n=t.fontData.lineHeight*r;}return (e-i)/(n+i)}(this.parent));break;case 2:t=this.totalLinesCount;}return t}},{key:"content",get:function(){return this.sections.join(this.pageBreak)}}]),o}(Lh);Object.assign(cv.prototype,hv);var dv=Phaser.Utils.Objects.GetFastValue,pv=Phaser.Utils.Objects.GetValue,fv=function(t){r(o,t);var i=l(o);function o(t,n){var r;return e(this,o),(r=i.call(this,t,n)).timer=null,r.resetFromJSON(n),r}return n(o,[{key:"resetFromJSON",value:function(t){this.setTextWrapEnable(pv(t,"wrap",!1)),this.setTypeMode(pv(t,"typeMode",0)),this.setTypingSpeed(pv(t,"speed",333)),this.setTextCallback=dv(t,"setTextCallback",null),this.setTextCallbackScope=dv(t,"setTextCallbackScope",null),this.setTypingContent(dv(t,"text","")),this.typingIdx=dv(t,"typingIdx",0),this.insertIdx=null,this.insertChar=null;var e=dv(t,"elapsed",null);return null!==e&&this.start(void 0,void 0,this.typingIdx,e),this}},{key:"shutdown",value:function(t){this.isShutdown||(this.freeTimer(),c(s(o.prototype),"shutdown",this).call(this,t));}},{key:"setTypeMode",value:function(t){return "string"==typeof t&&(t=gv[t]),this.typeMode=t,this}},{key:"setTypeSpeed",value:function(t){return this.speed=t,this}},{key:"setTypingSpeed",value:function(t){return this.speed=t,this}},{key:"setTextWrapEnable",value:function(t){return void 0===t&&(t=!0),this.textWrapEnable=t,this}},{key:"text",get:function(){return this._text},set:function(t){var e=vv(t);this.textWrapEnable&&(e=function(t,e){switch(tv(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;}},{key:"isTyping",get:function(){return null!==this.getTimer()}},{key:"isLastChar",get:function(){return this.typingIdx===this.textLen}},{key:"start",value:function(t,e,i,n){return void 0!==t&&this.setTypingContent(t),void 0!==e&&(this.speed=e),void 0===i&&(i=0),this.typingIdx=i+1,0===this.speed?this.stop(!0):(this.setText(""),this.startTimer(n)),this}},{key:"appendText",value:function(t){var e=this.text.concat(vv(t));return this.isTyping?this.setTypingContent(e):this.start(e,void 0,this.textLen),this}},{key:"stop",value:function(t){if(this.getTimer()&&this.freeTimer(),t){for(;!this.isLastChar;)this.getTypingString(this.text,this.typingIdx,this.textLen,this.typeMode),this.emit("typechar",this.insertChar),this.typingIdx++;this.setText(this.text),this.emit("type"),this.emit("complete",this,this.parent);}return this}},{key:"pause",value:function(){var t=this.getTimer();return t&&(t.paused=!0),this}},{key:"resume",value:function(){var t=this.getTimer();return t&&(t.paused=!1),this}},{key:"setTypingContent",value:function(t){return this.text=t,this.textLen=this.getTextLength(this.text),this}},{key:"onTyping",value:function(){var t=this.getTypingString(this.text,this.typingIdx,this.textLen,this.typeMode);this.setText(t),this.emit("typechar",this.insertChar),this.emit("type"),this.isLastChar?(this.freeTimer(),this.emit("complete",this,this.parent)):(this.timer.delay=this.speed,this.typingIdx++);}},{key:"getTypingString",value:function(t,e,i,n){var r;if(0===n){var s=0,o=e;this.insertIdx=o,r=this.getSubString(t,s,o);}else if(1===n){s=(o=i)-e;this.insertIdx=0,r=this.getSubString(t,s,o);}else if(2===n){var a=i/2;o=(s=Math.floor(a-e/2))+e;this.insertIdx=e%2?e:0,r=this.getSubString(t,s,o);}else if(3===n){var h,l=Math.floor(e/2);if(l>0){s=(o=i)-l;h=this.getSubString(t,s,o);}else h="";var u,c=e-l;if(c>0){o=(s=0)+c;this.insertIdx=o,u=this.getSubString(t,s,o);}else u="",this.insertIdx=0;r=u+h;}return this.insertChar=r.charAt(this.insertIdx-1),r}},{key:"startTimer",value:function(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}},{key:"getTimer",value:function(){return this.timer}},{key:"freeTimer",value:function(){return this.timer&&(this.timer.remove(),this.timer=null),this}},{key:"setText",value:function(t){this.setTextCallback&&(t=this.setTextCallbackScope?this.setTextCallback.call(this.setTextCallbackScope,t,this.isLastChar,this.insertIdx):this.setTextCallback(t,this.isLastChar,this.insertIdx)),this.textWrapEnable?ov(this.parent,t):this.parent.setText(t);}},{key:"getTextLength",value:function(t){var e=this.parent;return e.getPlainText?e.getPlainText(t).length:t.length}},{key:"getSubString",value:function(t,e,i){var n=this.parent;return n.getSubString?n.getSubString(t,e,i):t.slice(e,i)}}]),o}(Lh),vv=function(t){return Array.isArray(t)?t=t.join("\n"):"number"==typeof t&&(t=t.toString()),t},gv={"left-to-right":0,"right-to-left":1,"middle-to-sides":2,"sides-to-middle":3},yv=Phaser.Utils.Objects.GetValue,mv=Phaser.Utils.Objects.GetValue,kv=Phaser.Utils.Objects.GetValue,bv=Phaser.Utils.Objects.GetValue,xv=[function(t){var e=this.scene,i=mv(t,"orientation",0);this.setOrientation(i);var n=mv(t,"icon",void 0),r=mv(t,"iconMask",void 0),s=mv(t,"innerBackground",void 0),o=mv(t,"title",void 0),a=mv(t,"separator",void 0),h=mv(t,"text",void 0),l=mv(t,"action",void 0),u=mv(t,"actionMask",void 0);if(n){g=0===this.orientation?{right:mv(t,"space.icon",0),top:mv(t,"space.iconTop",0),bottom:mv(t,"space.iconBottom",0),left:mv(t,"space.iconLeft",0)}:{bottom:mv(t,"space.icon",0),left:mv(t,"space.iconLeft",0),right:mv(t,"space.iconRight",0),top:mv(t,"space.iconTop",0)};var c=mv(t,"squareFitIcon",!1)?1:0;if(this.add(n,{proportion:0,padding:g,fitRatio:c}),r&&(r=Bf.call(this,n,n,1)),!c){var d=mv(t,"iconSize",void 0);this.setIconSize(mv(t,"iconWidth",d),mv(t,"iconHeight",d));}}var p=new Ud(e,{orientation:1});s&&p.addBackground(s);var f=mv(t,"space.separator",0);if(o){var v=mv(t,"align.title","left"),g={bottom:!a&&h?f:0,left:mv(t,"space.titleLeft",0),right:mv(t,"space.titleRight",0)};p.add(o,{proportion:0,align:v,padding:g});}if(a){g={top:o?f:0,bottom:h?f:0,left:mv(t,"space.separatorLeft",0),right:mv(t,"space.separatorRight",0)};p.add(a,{expand:!0,padding:g});}if(h){v=mv(t,"align.text","left"),g={left:mv(t,"space.textLeft",0),right:mv(t,"space.textRight",0)};p.add(h,{proportion:0,align:v,padding:g});}g=void 0;if(l&&(g={right:mv(t,"space.text",0)}),this.add(p,{proportion:1,padding:g}),l){g=0===this.orientation?{top:mv(t,"space.actionTop",0),bottom:mv(t,"space.actionBottom",0),right:mv(t,"space.actionRight",0)}:{left:mv(t,"space.actionLeft",0),right:mv(t,"space.actionRight",0),bottom:mv(t,"space.actionBottom",0)};c=mv(t,"squareFitAction",!1)?1:0;if(this.add(l,{proportion:0,padding:g,fitRatio:c}),u&&(u=Bf.call(this,l,l,1)),!c){var y=mv(t,"actionSize");this.setActionSize(mv(t,"actionWidth",y),mv(t,"actionHeight",y));}}this.addChildrenMap("icon",n),this.addChildrenMap("iconMask",r),this.addChildrenMap("innerSizer",p),this.addChildrenMap("innerBackground",s),this.addChildrenMap("title",o),this.addChildrenMap("separator",a),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=kv(t,"title",void 0),n=kv(t,"separator",void 0),r=kv(t,"innerBackground",void 0),s=kv(t,"icon",void 0),o=kv(t,"iconMask",void 0),a=kv(t,"text",void 0),h=kv(t,"action",void 0),l=kv(t,"actionMask",void 0);if(i){var u=kv(t,"align.title","left"),c={bottom:kv(t,"space.title",0),left:kv(t,"space.titleLeft",0),right:kv(t,"space.titleRight",0)};this.add(i,{proportion:0,align:u,padding:c});}if(n){var d=kv(t,"space.separator",0);c={top:i?d:0,bottom:a?d:0,left:kv(t,"space.separatorLeft",0),right:kv(t,"space.separatorRight",0)};this.add(n,{proportion:0,expand:!0,padding:c});}var p=kv(t,"orientation",0),f=new Ud(e,{orientation:p,rtl:kv(t,"rtl",!1),space:{left:kv(t,"space.innerLeft",0),right:kv(t,"space.innerRight",0),top:kv(t,"space.innerTop",0),bottom:kv(t,"space.innerBottom",0)}});if(r&&f.addBackground(r),this.add(f,{proportion:1,expand:!0}),s){c=void 0;c=0===f.orientation?{right:kv(t,"space.icon",0),top:kv(t,"space.iconTop",0),bottom:kv(t,"space.iconBottom",0),left:kv(t,"space.iconLeft",0)}:{bottom:kv(t,"space.icon",0),left:kv(t,"space.iconLeft",0),right:kv(t,"space.iconRight",0),top:kv(t,"space.iconTop",0)};var v=kv(t,"squareFitIcon",!1)?1:0;if(f.add(s,{proportion:0,padding:c,fitRatio:v}),o&&(o=Bf.call(this,s,s,1)),!v){var g=kv(t,"iconSize",void 0);this.setIconSize(kv(t,"iconWidth",g),kv(t,"iconHeight",g));}}if(a){u=kv(t,"align.text","left");var y,m,k=kv(t,"space.text",0),b=kv(t,"expandTextWidth",!1),x=kv(t,"expandTextHeight",!1);0===f.orientation?(y=b?1:0,h&&(c={right:k}),m=x):(y=x?1:0,h&&(c={bottom:k}),m=b),f.add(a,{proportion:y,expand:m,align:u,padding:c});}if(h){c=0===f.orientation?{top:kv(t,"space.actionTop",0),bottom:kv(t,"space.actionBottom",0),right:kv(t,"space.actionRight",0)}:{left:kv(t,"space.actionLeft",0),right:kv(t,"space.actionRight",0),bottom:kv(t,"space.actionBottom",0)};v=kv(t,"squareFitAction",!1)?1:0;if(f.add(h,{proportion:0,padding:c,fitRatio:v}),l&&(l=Bf.call(this,h,h,1)),!v){var C=kv(t,"actionSize");this.setActionSize(kv(t,"actionWidth",C),kv(t,"actionHeight",C));}}this.addChildrenMap("title",i),this.addChildrenMap("separator",n),this.addChildrenMap("innerSizer",f),this.addChildrenMap("innerBackground",r),this.addChildrenMap("icon",s),this.addChildrenMap("iconMask",o),this.addChildrenMap("text",a),this.addChildrenMap("action",h),this.addChildrenMap("actionMask",l);}],Cv=function(t){r(s,t);var i=l(s);function s(t,n){return e(this,s),void 0===n&&(n={}),n.hasOwnProperty("layoutMode")||(n.layoutMode=1),i.call(this,t,n)}return n(s)}(function(t,i){return void 0===i&&(i="rexTextBox"),function(t){r(o,t);var s=l(o);function o(t,n){var r;e(this,o),(r=s.call(this,t,n)).type=i;var h=r.childrenMap.text;return r.page=new cv(h,yv(n,"page",void 0)),r.typing=new fv(h,yv(n,"typing",n.type)),r.typing.on("complete",r.onPageEnd,a(r)).on("type",r.onType,a(r)).on("typechar",r.onTypeChar,a(r)),r.textWidth=h.width,r.textHeight=h.height,r}return n(o,[{key:"start",value:function(t,e){return this.page.setText(t),void 0!==e&&this.setTypingSpeed(e),this.emit("start"),this.typeNextPage(),this}},{key:"typeNextPage",value:function(){if(this.isLastPage)this.emit("complete");else {var t=this.page.getNextPage();this.typing.start(t);}return this}},{key:"pause",value:function(){return this.isTyping&&(this.typing.pause(),this.emit("pause")),this}},{key:"resume",value:function(){return this.isTyping||(this.emit("resume"),this.typing.resume()),this}},{key:"stop",value:function(t){return this.typing.stop(t),this}},{key:"showLastPage",value:function(){return this.typing.stop(),this.page.showLastPage(),this.emit("type"),this.onPageEnd(),this}},{key:"setTypeSpeed",value:function(t){return this.typing.setTypingSpeed(t),this}},{key:"setTypingSpeed",value:function(t){return this.typing.setTypingSpeed(t),this}},{key:"isTyping",get:function(){return this.typing.isTyping}},{key:"isLastPage",get:function(){return this.page.isLastPage}},{key:"isFirstPage",get:function(){return this.page.isFirstPage}},{key:"pageCount",get:function(){return this.page.pageCount}},{key:"pageIndex",get:function(){return this.page.pageIndex}},{key:"typingSpeed",get:function(){return this.typing.speed}},{key:"onType",value:function(){var t=this.childrenMap.text;this.textWidth===t.width&&this.textHeight===t.height||(this.textWidth=t.width,this.textHeight=t.height,this.getTopmostSizer().layout()),this.emit("type");}},{key:"onTypeChar",value:function(t){this.emit("typechar",t);}},{key:"onPageEnd",value:function(){var t=this.isLastPage;this.emit("pageend"),t&&this.emit("complete");}}]),o}(t)}(function(t){r(o,t);var i=l(o);function o(t,n){var r;e(this,o),(r=i.call(this,t,n)).type="rexTitleLabel";var s=bv(n,"background",void 0);s&&r.addBackground(s);var h=bv(n,"layoutMode",0);return (xv[h]||xv[0]).call(a(r),n),r.addChildrenMap("background",n.background),r}return n(o,[{key:"title",get:function(){var t=this.childrenMap.title;return t?t.title:""},set:function(t){var e=this.childrenMap.title;e&&e.setText(t);}},{key:"setTitle",value:function(t){return this.title=t,this}},{key:"resetDisplayContent",value:function(t){void 0===t?t={}:"string"==typeof t&&(t={text:t}),c(s(o.prototype),"resetDisplayContent",this).call(this,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}}]),o}(Af))),Sv=Phaser.Utils.Objects.GetValue,wv=function(t){r(s,t);var i=l(s);function s(t,n){var r;e(this,s),(r=i.call(this,t,n)).style=Sv(n,"style",a(r));var o=Sv(n,"propertiesMap");return r.activeStyle=Ov(n,"active",o),r.hoverStyle=Ov(n,"hover",o),r.disableStyle=Ov(n,"disable",o),r.onModifyStyle=Sv(n,"onModifyStyle"),r}return n(s,[{key:"getStyle",value:function(t){return function(t,e,i){if(void 0===i&&(i={}),Array.isArray(e))for(var n=0,r=e.length;n=t.dragThreshold?"DRAG":"DRAGBEGIN":"IDLE"}},{key:"update_DRAGBEGIN",value:function(t,e){this.next();}},{key:"next_DRAG",value:function(){var t,e=this.parent;return e.dragState.isUp&&(t=e.outOfBounds?"BACK":e.slidingEnable?"SLIDE":"IDLE"),t}},{key:"update_DRAG",value:function(t,e){var i=this.parent;i.dragState.justMoved&&i.dragging(),this.next();}},{key:"enter_DRAG",value:function(){this.parent.onDragStart();}},{key:"exit_DRAG",value:function(){this.parent.onDragEnd();}},{key:"next_SLIDE",value:function(){var t,e=this.parent;return e.dragState.isDown?t="DRAG":e.isSliding||(t="IDLE"),t}},{key:"enter_SLIDE",value:function(){this.parent.onSliding();}},{key:"exit_SLIDE",value:function(){this.parent.stop();}},{key:"update_SLIDE",value:function(t,e){this.parent.sliding(t,e),this.next();}},{key:"next_BACK",value:function(){var t,e=this.parent;return e.dragState.isDown?t="DRAG":e.isPullBack||(t="IDLE"),t}},{key:"enter_BACK",value:function(){this.parent.onPullBack();}},{key:"exit_BACK",value:function(){this.parent.stop();}},{key:"update_BACK",value:function(t,e){this.parent.pullBack(t,e),this.next();}}]),s}(ru),zg=Phaser.Utils.Objects.GetValue,Ig=Phaser.Math.Distance.Between,jg=function(t){r(o,t);var i=l(o);function o(t,n){var r;return e(this,o),(r=i.call(this,t,n))._enable=void 0,t.setInteractive(zg(n,"inputConfig",void 0)),r.resetFromJSON(n),r.boot(),r}return n(o,[{key:"resetFromJSON",value:function(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(zg(t,"enable",!0)),this.holdThreshold=zg(t,"holdThreshold",50),this.pointerOutReleaseEnable=zg(t,"pointerOutRelease",!0),this}},{key:"boot",value:function(){this.parent.on("pointerdown",this.onPointIn,this),this.parent.on("pointerup",this.onPointOut,this),this.pointerOutReleaseEnable&&this.parent.on("pointerout",this.onPointOut,this),this.parent.on("pointermove",this.onPointerMove,this),this.scene.sys.events.on("preupdate",this.preupdate,this);}},{key:"shutdown",value:function(t){this.isShutdown||(this.scene.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,c(s(o.prototype),"shutdown",this).call(this,t));}},{key:"enable",get:function(){return this._enable},set:function(t){this._enable!==t&&(t||(this.isInTouched=!1,this.pointer=void 0),this._enable=t);}},{key:"setEnable",value:function(t){return void 0===t&&(t=!0),this.enable=t,this}},{key:"toggleEnable",value:function(){return this.setEnable(!this.enable),this}},{key:"setPointerOutReleaseEnable",value:function(t){return void 0===t&&(t=!0),this.pointerOutReleaseEnable=t,this}},{key:"isDown",get:function(){return this.pointer&&this.pointer.isDown}},{key:"isUp",get:function(){return !this.isDown}},{key:"dx",get:function(){return this.x-this.preX}},{key:"dy",get:function(){return this.y-this.preY}},{key:"dt",get:function(){return zc(this.scene)}},{key:"speed",get:function(){return this.x===this.preX&&this.y===this.preY?0:Ig(this.preX,this.preY,this.x,this.y)/(.001*this.dt)}},{key:"speedX",get:function(){return this.dx/(.001*this.dt)}},{key:"speedY",get:function(){return this.dy/(.001*this.dt)}},{key:"onPointIn",value:function(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.pointer=t,this.localX=e,this.localY=i);}},{key:"onPointOut",value:function(t){this.enable&&this.pointer===t&&(this.pointer=void 0);}},{key:"onPointerMove",value:function(t,e,i){this.enable&&t.isDown&&this.pointer===t&&(this.localX=e,this.localY=i);}},{key:"preupdate",value:function(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));}}}]),o}(Lh),Bg=Phaser.Utils.Objects.GetValue,Fg=function(){function t(i){e(this,t),this.resetFromJSON(i);}return n(t,[{key:"resetFromJSON",value:function(t){return this.setValue(Bg(t,"value",0)),this.setSpeed(Bg(t,"speed",0)),this.setAcceleration(Bg(t,"acceleration",0)),this}},{key:"reset",value:function(){this.setValue(0),this.setSpeed(0),this.setAcceleration(0);}},{key:"setValue",value:function(t){return this.value=t,this}},{key:"setSpeed",value:function(t){return this.speed=t,this}},{key:"setAcceleration",value:function(t){return this.acceleration=t,this}},{key:"updateSpeed",value:function(t){return 0!==this.acceleration&&(this.speed+=this.acceleration*t,this.speed<0&&(this.speed=0)),this}},{key:"getDeltaValue",value:function(t){return this.updateSpeed(t),this.speed<=0?0:this.speed*t}},{key:"update",value:function(t){return this.updateSpeed(t),this.speed>0&&(this.value+=this.getDeltaValue(t)),this}},{key:"isMoving",get:function(){return this.speed>0}}]),t}(),Wg=function(){function t(){e(this,t),this.value,this.dir,this.movement=new Fg;}return n(t,[{key:"init",value:function(t,e,i,n,r){return this.value=t,this.end=r,this.dir=void 0!==r?tthis.end&&(this.value=this.end):this.valuethis.maxValue}},{key:"overMin",value:function(t){return null!=this.minValue&&t0,Math.abs(e),i);}},{key:"sliding",value:function(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;}},{key:"onPullBack",value:function(){var t=this.value,e=this.outOfMinBound?this.minValue:this.maxValue,i=Math.abs(e-t),n=this.backDeceleration,r=Math.sqrt(2*n*i);this._slowDown.init(t,void 0,r,n,e);}},{key:"pullBack",value:function(t,e){e*=.001,this.value=this._slowDown.update(e).value,this._slowDown.isMoving||this._state.next();}},{key:"stop",value:function(){this._slowDown.stop();}}]),o}(Lh),Gg={y:0,v:0,vertical:0,x:1,h:1,horizontal:1},Hg=Phaser.Utils.Objects.GetValue,Vg=function(t){r(s,t);var i=l(s);function s(t,n){var r;(e(this,s),(r=i.call(this,t,n)).parent!==r.scene?r.focusMode=Hg(n,"focus",!1):r.focusMode=!1,r.setSpeed(Hg(n,"speed",.1)),r.setEnable(Hg(n,"enable",!0)),r.focusMode)?(t=r.parent).setInteractive(Hg(n,"inputConfig",void 0)).on("wheel",(function(t,e,i,n,r){this.enable&&this.scroll(i);}),a(r)):r.scene.input.on("wheel",r.onSceneScroll,a(r));return r}return n(s,[{key:"destroy",value:function(){this.focusMode||this.scene.input.off("wheel",this.onSceneScroll,this);}},{key:"onSceneScroll",value:function(t,e,i,n,r,s){this.enable&&this.scroll(n);}},{key:"setEnable",value:function(t){return void 0===t&&(t=!0),this.enable=t,this}},{key:"setSpeed",value:function(t){return this.speed=t,this}},{key:"scroll",value:function(t){t*=this.speed,this.emit("scroll",t,this.parent,this);}}]),s}(Lh),Ug=Phaser.Utils.Objects.GetValue,Jg=function(t,e,i,n){var r,s,o,a,h="Y"===(i=i.toUpperCase()),l=2===t.scrollMode,u=t.childrenMap.child,c="slider".concat(i);if(r=l||n.hasOwnProperty(c)?Ug(n,c,void 0):Ug(n,"slider",void 0)){var d,p,f;!0===r&&(r={}),r.orientation=h?1:0,s=function(t,e){void 0===e&&(e={});var i=qi(e);(e={slider:i}).orientation=i.orientation,delete i.orientation,e.background=i.background,delete i.background,e.buttons=i.buttons,delete i.buttons;var n=new Mg(t,e);t.add.existing(n);var r=n.childrenMap.slider;return n.addChildrenMap("track",r.childrenMap.track),n.addChildrenMap("indicator",r.childrenMap.indicator),n.addChildrenMap("thumb",r.childrenMap.thumb),n}(t.scene,r);var v=Ug(r,"position",0);"string"==typeof v&&(v=Kg[v]);var g=Ug(n,"space.slider".concat(i),void 0);void 0===g&&void 0===(g=Ug(n,"space.slider",void 0))&&(g=l?0:Ug(n,"space.child",0));var y="number"==typeof g;h?0===v?(d=2,p=1,f=y?{left:g}:g):(d=0,p=1,f=y?{right:g}:g):0===v?(d=1,p=2,f=y?{top:g}:g):(d=1,p=0,f=y?{bottom:g}:g),e.add(s,{column:d,row:p,align:"center",padding:f,expand:!0}),t["hideUnscrollableSlider".concat(i)]=Ug(r,"hideUnscrollableSlider",!1),t["adaptThumb".concat(i,"SizeMode")]=Ug(r,"adaptThumbSize",!1),t["minThumb".concat(i,"Size")]=Ug(r,"minThumbSize",void 0);}else t["hideUnscrollableSlider".concat(i)]=!1,t["adaptThumb".concat(i,"SizeMode")]=!1,t["minThumb".concat(i,"Size")]=void 0;var m="scroller".concat(i);(o=l||n.hasOwnProperty(m)?Ug(n,m,!0):Ug(n,"scroller",!0))&&u&&(!0===o&&(o={}),o.orientation=h?0:1,a=new Xg(u,o));var k,b,x,C,S=Ug(n,l?"mouseWheelScroller".concat(i):"mouseWheelScroller",!1);(S&&u&&(k=new Vg(u,S)),t.addChildrenMap("slider".concat(i),s),t.addChildrenMap("scroller".concat(i),a),t.addChildrenMap("mouseWheelScroller".concat(i),k),l&&!h||(t.hideUnscrollableSlider=t["hideUnscrollableSlider".concat(i)],t.adaptThumbSizeMode=t["adaptThumb".concat(i,"SizeMode")],t.minThumbSize=t["minThumb".concat(i,"Size")],t.addChildrenMap("slider",s),t.addChildrenMap("scroller",a),t.addChildrenMap("mouseWheelScroller",k)),s)&&(l?(b=h?"t":"s",C="scroll".concat(i)):(b="t",C="scroll"),s.on("valuechange",(function(e){t[b]=e,t.emit(C,t);})));a&&(l?(x="childO".concat(i),C="scroll".concat(i)):(x="childOY",C="scroll"),a.on("valuechange",(function(e){t[x]=e,t.emit(C,t);})));if(k){var w="addChildO".concat(i);k.on("scroll",(function(e){t[w](-e,!0);}));}},Kg={right:0,left:1,bottom:0,top:1},qg=Phaser.Utils.Objects.GetValue,$g=function(t,e){var i=t.scene,n=[0,1,0],r=[0,1,0],s=qg(e,"width"),o=qg(e,"height");s||(n[1]=0),o||(r[1]=0);var a=new Lp(i,{column:3,row:3,columnProportions:n,rowProportions:r});switch(function(t,e,i){var n=Ag(i,"child"),r=Ag(n,"gameObject",void 0);if(r){var s=Ag(i,"space.child",0);t.childMargin={};var o=t.childMargin,a={};if("number"==typeof s)switch(t.scrollMode){case 0:case 1:o.top=0,o.bottom=0,o.left=0,o.right=0;break;default:o.top=s,o.bottom=s,o.left=s,o.right=s;}else switch(t.scrollMode){case 0:o.top=Ag(s,"top",0),o.bottom=Ag(s,"bottom",0),a.left=Ag(s,"left",0),a.right=Ag(s,"right",0);break;case 1:o.top=Ag(s,"left",0),o.bottom=Ag(s,"right",0),a.top=Ag(s,"top",0),a.bottom=Ag(s,"bottom",0);break;default:o.top=Ag(s,"top",0),o.bottom=Ag(s,"bottom",0),o.left=Ag(s,"left",0),o.right=Ag(s,"right",0);}e.add(r,{column:1,row:1,align:Ag(n,"align","center"),padding:a,expand:{width:Ag(n,"expandWidth",!0),height:Ag(n,"expandHeight",!0)}});}t.addChildrenMap("child",r);}(t,a,e),t.scrollMode){case 0:Jg(t,a,"y",e);break;case 1:Jg(t,a,"x",e);break;default:Jg(t,a,"y",e),Jg(t,a,"x",e);}return a},Zg=function(t){var e,i,n,r;switch(this.scrollMode){case 0:case 1:e=this.topChildOY,i=this.bottomChildOY,n=this.childrenMap.scroller,r=this.childrenMap.slider;break;default:"Y"===(t=t.toUpperCase())?(e=this.topChildOY,i=this.bottomChildOY):(e=this.leftChildOX,i=this.rightChildOX),n=this.childrenMap["scroller".concat(t)],r=this.childrenMap["slider".concat(t)];}n&&n.setBounds(e,i),r&&r.setEnable(e!==i);},Qg=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".concat(t)],i=this["hideUnscrollableSlider".concat(t)],n=this["isOverflow".concat(t)];e&&i&&this.setChildVisible(e,n);}},ty=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,n=a.childrenMap.thumb,r=this.minThumbSize;if(0===this.scrollMode){var s=i.displayHeight*e;void 0!==r&&sthis.topTextOY}},{key:"textOYExeceedBottom",value:function(t){return void 0===t&&(t=this.textOY),tthis.linesCount?t=0:n?t=e:r&&(t=i)),this._textOY!==t&&(this._textOY=t,this.updateTextObject()),n&&(this.execeedTopState||this.emit("execeedtop",this,t,e)),this.execeedTopState=n,r&&(this.execeedBottomState||this.emit("execeedbottom",this,t,i)),this.execeedBottomState=r;}},{key:"setTextOY",value:function(t){return this.textOY=t,this}},{key:"t",get:function(){var t=this.textVisibleHeight;return 0===t?0:this.textOY/-t},set:function(t){this.textOY=-this.textVisibleHeight*t;}},{key:"setTextOYByPercentage",value:function(t){return this.t=t,this}}]),o}(Td),yy=function(t){return t.add.text(0,0,"")};Object.assign(gy.prototype,dy);Phaser.Math.Clamp;var my={scrollToLine:function(t){return this.setChildOY(-this.lineHeight*t),this},scrollToNextLine:function(t){void 0===t&&(t=1);var e=this.lineIndex+t;return this.scrollToLine(e),this}},ky=Phaser.Utils.Objects.GetValue,by=function(t){r(s,t);var i=l(s);function s(t,n){var r;e(this,s),void 0===n&&(n={});var o=ky(n,"text",void 0),a=ky(n,"textWidth",void 0),h=ky(n,"textHeight",void 0),l=ky(n,"textCrop",!!o.setCrop),u=ky(n,"textMask",!l),c=ky(n,"content",""),d=new gy(t,{width:a,height:h,text:o,textMask:u,textCrop:l&&!u,content:c,clamplTextOY:ky(n,"clamplChildOY",!1),alwaysScrollable:ky(n,"alwaysScrollable",!1)});t.add.existing(d),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}});}(d),n.scrollMode=0,n.type="rexTextArea",n.child={gameObject:d,expandWidth:void 0===a,expandHeight:void 0===h};var p=ky(n,"space",void 0);return p&&(p.child=ky(p,"text",0)),(r=i.call(this,t,n)).addChildrenMap("text",o),r}return n(s,[{key:"text",get:function(){return this.childrenMap.child.text}},{key:"lineHeight",get:function(){var t=this.childrenMap.child;return t.textLineHeight+t.textLineSpacing}},{key:"lineIndex",get:function(){return Math.floor(-this.childOY/this.lineHeight)}},{key:"linesCount",get:function(){return this.childrenMap.child.linesCount}},{key:"contentHeight",get:function(){return this.childrenMap.child.textHeight}}]),s}(ry);Object.assign(by.prototype,{setText:function(t){return this.childrenMap.child.setText(t),this.resizeController(),this},appendText:function(t){return this.setText(this.text+t),this}},my);var xy=Np.prototype.add,Cy=function(t,e,i,n,r,s,o,a,h){return t.setVisible(!1),xy.call(this,t,e,i,n,r,s,o,a,h),this},Sy={add:Cy,addPage:Cy},wy=wa.prototype.setChildVisible,Oy={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?(wy.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 n=this.currentPage;return n&&(wy.call(this,n,!0),this.emit("pagevisible",n,this._currentKey,this),void 0===e&&(e=this.fadeInDuration),e>0&&n.setAlpha(0).fadeIn(e,1)),this},hasPage:function(t){return this.sizerChildren.hasOwnProperty(t)}};Object.assign(Oy,Sy);var Ty=Phaser.Utils.Objects.GetValue,Py=function(t){r(s,t);var i=l(s);function s(t,n){var r;return e(this,s),(r=i.call(this,t,n)).type="rexPages",r.childrenMap=r.sizerChildren,r._previousKey=void 0,r._currentKey=void 0,r.setSwapMode(Ty(n,"swapMode",0)),r.setFadeInDuration(Ty(n,"fadeIn",0)),r}return n(s,[{key:"setSwapMode",value:function(t){return "string"==typeof t&&(t=_y[t]),this.swapMode=t,this}},{key:"setFadeInDuration",value:function(t){return this.fadeInDuration=t,this}},{key:"previousKey",get:function(){return this._previousKey}},{key:"currentKey",get:function(){return this._currentKey},set:function(t){this.swapPage(t);}},{key:"currentPage",get:function(){return this.getPage(this.currentKey)}},{key:"previousPage",get:function(){return this.getPage(this.previousKey)}},{key:"keys",get:function(){return Object.keys(this.sizerChildren)}}]),s}(Np);Object.assign(Py.prototype,Oy);var _y={invisible:0,destroy:1},Ey=function(t,e){t.popUp(e);},My=function(t,e){t.scaleDown(e);},Ry=function(t,e){t.fadeIn(e);},Ly=function(t,e){t.fadeOut(e);},Ay=Phaser.Utils.Objects.GetValue,Dy=function(t){r(o,t);var i=l(o);function o(){return e(this,o),i.apply(this,arguments)}return n(o,[{key:"startTicking",value:function(){c(s(o.prototype),"startTicking",this).call(this),this.scene.sys.events.on("update",this.update,this);}},{key:"stopTicking",value:function(){c(s(o.prototype),"stopTicking",this).call(this),this.scene&&this.scene.sys.events.off("update",this.update,this);}},{key:"update",value:function(t,e){return this.isRunning&&0!==this.timeScale?(this.tick(e),this):this}}]),o}(function(t){r(o,t);var i=l(o);function o(t,n){var r;return e(this,o),(r=i.call(this,t,n)).resetFromJSON(n),r.boot(),r}return n(o,[{key:"resetFromJSON",value:function(t){return this.isRunning=Ay(t,"isRunning",!1),this.timeScale=Ay(t,"timeScale",1),this.now=Ay(t,"now",0),this}},{key:"toJSON",value:function(){return {isRunning:this.isRunning,timeScale:this.timeScale,now:this.now,tickingMode:this.tickingMode}}},{key:"start",value:function(t){return void 0===t&&(t=0),this.delta=0,this.now=t,c(s(o.prototype),"start",this).call(this),this}},{key:"seek",value:function(t){return this.now=t,this}},{key:"setTimeScale",value:function(t){return this.timeScale=t,this}},{key:"tick",value:function(t){return t*=this.timeScale,this.now+=t,this.delta=t,this.emit("update",this.now,this.delta),this}}]),o}(zh)),zy=function(t,e,i,n){void 0===i&&(i=0),void 0===n&&(n=e.length),t.length=n-i;for(var r=0,s=t.length;r=0;o--)r=t(e[o],i,n);else for(var o=0,a=e.length;on?1:it)return this;for(var e=this.commands.length-1;;){var i=this.commands[this.index],n=i[1];if(Lu(n)||(n=zy(Gy,i,1)),Fy(n,this.scope),this.emit("runcommand",n,this.scope),this.index===e)return this.complete(),this;if(this.index++,this.nextTime=this.getNextDt(this.nextTime),this.nextTime>t)return this}}},{key:"complete",value:function(){this.clock.stop(),this.state=2,this.emit("complete",this.parent,this);}},{key:"getNextDt",value:function(t){var e=this.commands[this.index][0];return 1===this.timeUnit&&(e*=1e3),1===this.dtMode&&(e+=t),e}},{key:"setDtMode",value:function(t){return "string"==typeof t&&(t=Vy[t]),this.dtMode=t,this}},{key:"setTimeUnit",value:function(t){return "string"==typeof t&&(t=Hy[t]),this.timeUnit=t,this}}]),o}(Lh),Gy=[],Hy={ms:0,s:1,sec:1},Vy={abs:0,absolute:0,inc:1,increment:1},Uy=Phaser.Utils.Objects.GetValue,Jy=function(t){r(o,t);var i=l(o);function o(t,n){var r;return e(this,o),void 0===n&&(n={text:createDefaultTextObject(t)}),(r=i.call(this,t,n)).type="rexToast",r.setTransitInTime(Uy(n,"duration.in",200)),r.setDisplayTime(Uy(n,"duration.hold",1200)),r.setTransitOutTime(Uy(n,"duration.out",200)),r.setTransitInCallback(Uy(n,"transitIn",Ky.popUp)),r.setTransitOutCallback(Uy(n,"transitOut",Ky.scaleDown)),r.player=new Xy(a(r),{dtMode:1}),r.messages=[],r.scaleX0=void 0,r.scaleY0=void 0,r.setVisible(!1),r}return n(o,[{key:"destroy",value:function(t){this.scene&&!this.ignoreDestroy&&(this.player.destroy(),this.player=void 0,this.messages=void 0,c(s(o.prototype),"destroy",this).call(this,t));}},{key:"setDisplayTime",value:function(t){return this.displayTime=t,this}},{key:"setTransitOutTime",value:function(t){return this.transitOutTime=t,this}},{key:"setTransitInTime",value:function(t){return this.transitInTime=t,this}},{key:"setTransitInCallback",value:function(t){switch("string"==typeof t&&(t=Ky[t]),t){case Ky.popUp:t=Ey;break;case Ky.fadeIn:t=Ry;}return t||(t=$i),this.transitInCallback=t,this}},{key:"setTransitOutCallback",value:function(t){switch("string"==typeof t&&(t=Ky[t]),t){case Ky.scaleDown:t=My;break;case Ky.fadeOut:t=Ly;}return t||(t=$i),this.transitOutCallback=t,this}},{key:"setScale",value:function(t,e){return void 0===e&&(e=t),this.scaleX0=t,this.scaleY0=e,c(s(o.prototype),"setScale",this).call(this,t,e),this}},{key:"showMessage",value:function(t){if(void 0===this.scaleX0&&(this.scaleX0=this.scaleX),void 0===this.scaleY0&&(this.scaleY0=this.scaleY),void 0===t){if(0===this.messages.length)return this;t=this.messages.shift();}if(this.player.isPlaying)return this.messages.push(t),this;this.setScale(this.scaleX0,this.scaleY0).setVisible(!0),"string"==typeof t?this.setText(t):t(this),this.layout();var e=[[0,[this.transitInCallback,this,this.transitInTime]],[this.transitInTime,[$i]],[this.displayTime,[this.transitOutCallback,this,this.transitOutTime]],[this.transitOutTime,[this.setVisible,!1]],[30,[$i]]];return this.player.load(e,this).once("complete",(function(){this.showMessage();}),this).start(),this}}]),o}(Wf),Ky={popUp:0,fadeIn:1,scaleDown:0,fadeOut:1},qy=Phaser.GameObjects.GetCalcMatrix,$y=Phaser.Renderer.Canvas.SetTransform,Zy={renderWebGL:function(t,e,i,n){e.updateData(),i.addToRenderList(e);var r=t.pipelines.set(e.pipeline),s=qy(e,i,n),o=r.calcMatrix.copyFrom(s.calc),a=e._displayOriginX,h=e._displayOriginY,l=i.alpha*e.alpha;t.pipelines.preBatch(e);for(var u=e.geom,c=0,d=u.length;c0,o=0,a=e.length;o0&&t.arc(e,i,r,o,s,!a)),t.close(),t},Rm={buildShapes:function(){this.addShape((new Pm).setName("track")).addShape((new Pm).setName("bar")).addShape((new am).setName("center"));},updateShapes:function(){var t=this.radius,e=this.thickness*this.radius,i=this.radius,n=i-e,r=this.getShape("track");null!=this.trackColor&&this.thickness>0?(r.fillStyle(this.trackColor),Mm(r,t,t,i,n,0,360,!1)):r.reset();var s=this.getShape("bar");if(null!=this.barColor&&this.thickness>0){var o,a,h;if(1===this.value)o=!1,a=0,h=360;else o=this.anticlockwise,a=_m(this.startAngle),h=360*(o?1-this.value:this.value)+a;s.fillStyle(this.barColor),Mm(s,t,t,i,n,a,h,!1);}else s.reset();var l=this.getShape("center");this.centerColor&&n>0?l.setCenterPosition(t,t).setRadius(n).fillStyle(this.centerColor):l.reset();}},Lm=Phaser.Utils.Objects.GetValue,Am=Phaser.Utils.Objects.IsPlainObject,Dm=Phaser.Math.Clamp,zm=Phaser.Math.DegToRad(270),Im=function(t){r(o,t);var i=l(o);function o(t,n,r,s,a,h,l){var u;e(this,o),Am(n)&&(n=Lm(l=n,"x",0),r=Lm(l,"y",0),s=Lm(l,"radius",1),a=Lm(l,"barColor",void 0),h=Lm(l,"value",0)),void 0===s&&(s=1);var c=2*s;return (u=i.call(this,t,n,r,c,c)).type="rexCircularProgress",u.bootProgressBase(l),u.setRadius(s),u.setTrackColor(Lm(l,"trackColor",void 0)),u.setBarColor(a),u.setCenterColor(Lm(l,"centerColor",void 0)),u.setThickness(Lm(l,"thickness",.2)),u.setStartAngle(Lm(l,"startAngle",zm)),u.setAnticlockwise(Lm(l,"anticlockwise",!1)),u.buildShapes(),u.setValue(h),u}return n(o,[{key:"resize",value:function(t,e){return (t=Math.floor(Math.min(t,e)))===this.width||(c(s(o.prototype),"resize",this).call(this,t,t),this.setRadius(t/2)),this}},{key:"radius",get:function(){return this._radius},set:function(t){this.dirty=this.dirty||this._radius!=t,this._radius=t;var e=2*t;this.resize(e,e);}},{key:"setRadius",value:function(t){return this.radius=t,this}},{key:"trackColor",get:function(){return this._trackColor},set:function(t){this.dirty=this.dirty||this._trackColor!=t,this._trackColor=t;}},{key:"setTrackColor",value:function(t){return this.trackColor=t,this}},{key:"barColor",get:function(){return this._barColor},set:function(t){this.dirty=this.dirty||this._barColor!=t,this._barColor=t;}},{key:"setBarColor",value:function(t){return this.barColor=t,this}},{key:"startAngle",get:function(){return this._startAngle},set:function(t){this.dirty=this.dirty||this._startAngle!=t,this._startAngle=t;}},{key:"setStartAngle",value:function(t){return this.startAngle=t,this}},{key:"anticlockwise",get:function(){return this._anticlockwise},set:function(t){this.dirty=this.dirty||this._anticlockwise!=t,this._anticlockwise=t;}},{key:"setAnticlockwise",value:function(t){return void 0===t&&(t=!0),this.anticlockwise=t,this}},{key:"thickness",get:function(){return this._thickness},set:function(t){t=Dm(t,0,1),this.dirty=this.dirty||this._thickness!=t,this._thickness=t;}},{key:"setThickness",value:function(t){return this.thickness=t,this}},{key:"centerColor",get:function(){return this._centerColor},set:function(t){this.dirty=this.dirty||this._centerColor!=t,this._centerColor=t;}},{key:"setCenterColor",value:function(t){return this.centerColor=t,this}}]),o}(Zv(em));Object.assign(Im.prototype,Rm);var jm=Phaser.Math.Distance.Between,Bm=function(t,e,i){var n=t.width/2;return jm(n,n,e,i)<=n},Fm=Phaser.Math.Angle.Between,Wm=Phaser.Math.Angle.Normalize,Ym=function(t,e,i){if(this.enable&&t.isDown){var n=this.sizerChildren.knob;if(Bm(n,e,i)){var r=n.width/2,s=n.startAngle,o=Fm(r,r,e,i),a=n.anticlockwise?s-o:o-s,h=Wm(a)/(2*Math.PI);this.stopEaseValue(),0===this.easeValueDuration||Math.abs(this.value-h)<.1?this.value=h:this.easeValueTo(h);}}},Nm=function(){this.sizerChildren.knob.on("pointerdown",Ym,this).on("pointermove",Ym,this).setInteractive();},Xm=Phaser.Math.Angle.Between,Gm=Phaser.Math.Angle.Wrap,Hm=function(t,e,i){if(this.enable&&!this.panPointer){var n=this.sizerChildren.knob;Bm(n,e,i)&&Jm.call(this,t);}},Vm=function(t,e,i){if(this.enable&&t.isDown){var n=this.sizerChildren.knob;switch(this.panState){case $m:Bm(n,e,i)&&Jm.call(this,t);break;case Zm:Bm(n,e,i)?qm.call(this):Km.call(this);}}},Um=function(t,e,i){this.enable&&this.panPointer===t&&Km.call(this);},Jm=function(t){this.panPointer=t,this.panState=Zm;},Km=function(){this.panPointer=void 0,this.panState=$m;},qm=function(){var t=this.panPointer.prevPosition,e=this.panPointer.position,i=this.sizerChildren.knob,n=Xm(i.x,i.y,t.x,t.y),r=Xm(i.x,i.y,e.x,e.y),s=i.anticlockwise?n-r:r-n,o=Gm(s)/(2*Math.PI);this.stopEaseValue(),this.value+=o;},$m=0,Zm=1,Qm=function(){this.sizerChildren.knob.on("pointerdown",Hm,this).on("pointermove",Vm,this).on("pointerup",Um,this).setInteractive(),this.panPointer=void 0,this.panState=$m;},tk=function(t){return void 0===t&&(t=this.value),this.textFormatCallbackScope?this.textFormatCallback(t):this.textFormatCallback.call(this.textFormatCallbackScope,t)},ek={setTextFormatCallback:function(t,e){return this.textFormatCallback=t,this.textFormatCallbackScope=e,this},getFormatText:tk,updateText:function(t){var e=this.sizerChildren.text;return e&&this.textFormatCallback&&(e.setText(tk.call(this,t)),e.layout&&e.layout()),this}},ik=Phaser.Utils.Objects.GetValue,nk=Phaser.Math.Snap.To,rk=function(t){r(s,t);var i=l(s);function s(t,n){var r;e(this,s),void 0===n&&(n={}),(r=i.call(this,t,n)).type="rexKnob",r.bootProgressBase(n);var o=ik(n,"background",void 0),h=ik(n,"text",void 0);o&&r.addBackground(o),h&&(n.textColor=void 0,n.textStrokeColor=void 0,r.setTextFormatCallback(ik(n,"textFormatCallback",void 0),ik(n,"textFormatCallbackScope",void 0)));var l=new Im(t,n);l.setDepth(ik(n,"knobDepth",0)),l._value=-1,t.add.existing(l),r.add(l,"knob"),h&&(r.add(h,"text","center",0,!1),t.children.moveBelow(l,h)),r.addChildrenMap("background",o),r.addChildrenMap("knob",l),r.addChildrenMap("text",h),r.setEnable(ik(n,"enable",void 0)),r.setGap(ik(n,"gap",void 0)),r.setValue(ik(n,"value",0),ik(n,"min",void 0),ik(n,"max",void 0));var u=ik(n,"input",0);switch("string"==typeof u&&(u=sk[u]),u){case 0:Qm.call(a(r));break;case 1:Nm.call(a(r));}return r}return n(s,[{key:"setEnable",value:function(t){return void 0===t&&(t=!0),this.enable=t,this}},{key:"setGap",value:function(t){return this.gap=t,this}},{key:"value",get:function(){return this.sizerChildren.knob.value},set:function(t){void 0!==this.gap&&(t=nk(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));}}]),s}(Zv(Np)),sk={pan:0,drag:0,click:1,none:-1};Object.assign(rk.prototype,ek);var ok=Phaser.Utils.Objects.GetValue,ak=function(t,e,i){var n=ok(t,"proportion.".concat(e),i.proportion),r=ok(t,"align.".concat(e),"center"),s=ok(t,"space.".concat(e),void 0);if("number"==typeof s&&i.paddingKey){var o=s;(s={})[i.paddingKey]=o;}return {proportion:n,align:r,padding:s,expand:ok(t,"expand.".concat(e),!0)}},hk=function(t){return ak(t,"header",{proportion:0,paddingKey:"bottom"})},lk=function(t){return ak(t,"leftSide",{proportion:0,paddingKey:"right"})},uk=function(t){return ak(t,"content",{proportion:1})},ck=function(t){return ak(t,"rightSide",{proportion:0,paddingKey:"left"})},dk=function(t){return ak(t,"footer",{proportion:0,paddingKey:"top"})},pk=function(t,e){var i=new Ud(t,{orientation:e});return t.add.existing(i),i},fk=Phaser.Utils.Objects.GetValue,vk=[function(t){var e=this.scene,i=t.header;i&&this.add(i,hk(t));var n=pk(e,0);this.add(n,{proportion:1,align:"center",padding:0,expand:!0});var r=t.leftSide;r&&n.add(r,lk(t));var s=t.content;s&&n.add(s,uk(t));var o=t.rightSide;o&&n.add(o,ck(t));var a=t.footer;a&&this.add(a,dk(t));},function(t){var e=this.scene,i=t.header;i&&this.add(i,hk(t));var n=pk(e,0);this.add(n,{proportion:1,align:"center",padding:0,expand:!0});var r=t.leftSide;r&&n.add(r,lk(t));var s=pk(e,1);n.add(s,{proportion:1,align:"center",padding:0,expand:!0});var o=pk(e,0);s.add(o,{proportion:1,align:"center",padding:0,expand:!0});var a=t.content;a&&o.add(a,uk(t));var h=t.rightSide;h&&o.add(h,ck(t));var l=t.footer;l&&s.add(l,dk(t));},function(t){var e=this.scene,i=t.header;i&&this.add(i,hk(t));var n=pk(e,0);this.add(n,{proportion:1,align:"center",padding:0,expand:!0});var r=pk(e,1);n.add(r,{proportion:1,align:"center",padding:0,expand:!0});var s=pk(e,0);r.add(s,{proportion:1,align:"center",padding:0,expand:!0});var o=t.leftSide;o&&s.add(o,lk(t));var a=t.content;a&&s.add(a,uk(t));var h=t.footer;h&&r.add(h,dk(t));var l=t.rightSide;l&&n.add(l,ck(t));},function(t){var e=this.scene,i=t.header;i&&this.add(i,hk(t));var n=pk(e,0);this.add(n,{proportion:1,align:"center",padding:0,expand:!0});var r=t.leftSide;r&&n.add(r,lk(t));var s=pk(e,1);n.add(s,{proportion:1,align:"center",padding:0,expand:!0});var o=t.content;o&&s.add(o,uk(t));var a=t.footer;a&&s.add(a,dk(t));var h=t.rightSide;h&&n.add(h,ck(t));}],gk={FFF:0,LFF:1,FFR:2,LFR:3},yk=function(t){r(s,t);var i=l(s);function s(t,n){var r;return e(this,s),void 0===n&&(n={}),n.orientation=1,(r=i.call(this,t,n)).type="rexHolyGrail",r.build(n),r}return n(s)}(Ud),mk={build:function(t){this.clear(!0);var e=fk(t,"background",void 0);e&&this.addBackground(e);var i=fk(t,"layoutMode",0);"string"==typeof i&&(i=gk[i.toUpperCase()]),(vk[i]||vk[0]).call(this,t),this.addChildrenMap("background",t.background),this.addChildrenMap("header",t.header),this.addChildrenMap("leftSide",t.leftSide),this.addChildrenMap("content",t.content),this.addChildrenMap("rightSide",t.rightSide),this.addChildrenMap("footer",t.footer);}};Object.assign(yk.prototype,mk);var kk=function(t,e){return t.sameOrientation?t.orientation=e.orientation:t.orientation=0===e.orientation?1:0,t},bk=function(t,e){t.popUp(kk(t.root.easeIn,t));},xk=function(t,e){t.scaleDown(kk(t.root.easeOut,t));},Ck={setTransitInCallback:function(t){return void 0===t&&(t=bk),this.transitInCallback=t,this},setTransitOutCallback:function(t){return void 0===t&&(t=xk),this.transitOutCallback=t,this}},Sk={delayCall:function(t,e,i){return this.timer=function(t,e,i,n,r){var s=Mh(t);return s.time.delayedCall(e,(function(){s.sys.events.once("postupdate",(function(){i.call(n,r);}));}))}(this,t,e,i),this},removeDelayCall:function(){return this.timer&&(this.timer.remove(!1),this.timer=void 0),this}},wk={expandSubMenu:function(t,e){var i;if((n=this.childrenMap.subMenu)&&n.parentButton===t)return this;this.collapseSubMenu(),i=this.root.toggleOrientation?0===this.orientation?1:0:this.orientation;var n=new this.constructor(this.scene,{items:e,orientation:i,space:this.space,createBackgroundCallback:this.root.createBackgroundCallback,createBackgroundCallbackScope:this.root.createBackgroundCallbackScope,createButtonCallback:this.root.createButtonCallback,createButtonCallbackScope:this.root.createButtonCallbackScope,easeIn:this.root.easeIn,easeOut:this.root.easeOut,_rootMenu:this.root,_parentMenu:this,_parentButton:t});return this.pin(n),this.childrenMap.subMenu=n,this.root.emit("expand",n,t,this),this},collapse:function(){var t=this.root;t.emit("collapse",this,this.parentButton,t);var e=t.easeOut.duration;return t.transitOutCallback(this,e),this.collapseSubMenu(),this.delayCall(e,this.destroy,this),this},collapseSubMenu:function(){var t=this.childrenMap.subMenu;return void 0===t||(this.childrenMap.subMenu=void 0,this.remove(t),t.collapse()),this}};Object.assign(wk,Ck,Sk);var Ok=function(t,e){return "number"==typeof e&&(e={duration:e}),e.hasOwnProperty("orientation")&&void 0!==e.orientation?e.sameOrientation=Gd(e.orientation)===t.orientation:e.sameOrientation=!0,e.destroy=!1,e},Tk=function(){var t=this.root,e=t.easeIn.duration;t.transitInCallback(this,e),this!==this.root&&this.delayCall(e,(function(){this.root.emit("popup.complete",this);}),this);},Pk=Phaser.Utils.Objects.GetValue,_k=function(t){r(o,t);var i=l(o);function o(t,n){var r;e(this,o),void 0===n&&(n={}),n.hasOwnProperty("orientation")||(n.orientation=1);var s=n._rootMenu,h=n._parentMenu,l=n._parentButton,u=Pk(n,"popup",!0),c=Pk(n,"items",void 0),d=Pk(n,"createBackgroundCallback",void 0),p=Pk(n,"createBackgroundCallbackScope",void 0);n.background=function(t,e,i,n){var r;return i&&(e.scene=t,r=n?i.call(n,e):i(e),e.scene=void 0),r}(t,c,d,p);var f=Pk(n,"createButtonCallback",void 0),v=Pk(n,"createButtonCallbackScope",void 0);if(n.buttons=function(t,e,i,n){var r,s,o=[];if(e&&i)for(var a=0,h=e.length;a textObject.width) { - dx = textObject.width - childRightX; - } else { - dx = 0; - } - var childTopY = this.drawY + this.drawTLY; - var childBottomY = childTopY + this.height; - if (childTopY < 0) { - dy = 0 - childTopY; - } else if (childBottomY > textObject.height) { - dy = textObject.height - childBottomY; - } else { - dy = 0; - } - textObject._textOX += dx; - textObject._textOY += dy; - return this; - }; - var Methods$i = { contains: Contains$1, - getWorldPosition: GetWorldPosition, - scrollTo: ScrollTo$1 + getWorldPosition: GetWorldPosition }; Object.assign(Methods$i, RenderMethods); @@ -10305,13 +10278,12 @@ } }; - var SetTextOXYMethods = { + var SetTextOXYMethods$1 = { setTextOX: function setTextOX(ox) { if (ox === this._textOX) { return this; } this._textOX = ox; - this.updateTexture(); return this; }, setTextOY: function setTextOY(oy) { @@ -10319,7 +10291,6 @@ return this; } this._textOY = oy; - this.updateTexture(); return this; }, setTextOXY: function setTextOXY(ox, oy) { @@ -10328,7 +10299,6 @@ } this._textOX = ox; this._textOY = oy; - this.updateTexture(); return this; }, addTextOX: function addTextOX(incX) { @@ -10789,7 +10759,7 @@ setChildrenInteractiveEnable: SetChildrenInteractiveEnable, setInteractive: SetInteractive }; - Object.assign(Methods$h, MoveChildMethods, BackgroundMethods, InnerBoundsMethods, SetAlignMethods, SetTextOXYMethods); + Object.assign(Methods$h, MoveChildMethods, BackgroundMethods, InnerBoundsMethods, SetAlignMethods, SetTextOXYMethods$1); var GetFastValue$1 = Phaser.Utils.Objects.GetFastValue; var Pools = {}; @@ -20374,6 +20344,38 @@ hiddenTextEdit.prevSelectionEnd = selectionEnd; }; + var ScrollToBob = function ScrollToBob(bob) { + var textObject = bob.parent; + var textObjectLeftX = 0, + textObjectRightX = textObject.width, + textObjectTopY = 0, + textObjectBottomY = textObject.height; + var childX = bob.drawX, + childY = bob.drawY; + var childLeftX = childX + bob.drawTLX, + childRightX = childX + bob.drawTRX, + childTopY = childY + bob.drawTLY, + childBottomY = childY + bob.drawBLY; + var dx; + if (childLeftX < textObjectLeftX) { + dx = textObjectLeftX - childLeftX; + } else if (childRightX > textObjectRightX) { + dx = textObjectRightX - childRightX; + } else { + dx = 0; + } + var dy; + if (childTopY < textObjectTopY) { + dy = textObjectTopY - childTopY; + } else if (childBottomY > textObjectBottomY) { + dy = textObjectBottomY - childBottomY; + } else { + dy = 0; + } + textObject._textOX += dx; + textObject._textOY += dy; + }; + var MoveCursor = function MoveCursor(hiddenTextEdit) { var textObject = hiddenTextEdit.parent; var text = textObject.text; @@ -20403,7 +20405,7 @@ if (child.text === '\n') { child.copyTextSize(textObject.lastInsertCursor); } - child.scrollTo(); + ScrollToBob(child); textObject.emit('cursorin', child, cursorPosition, textObject); } } @@ -21155,7 +21157,35 @@ // Push back lastInsertCursor directly textObject.children.push(textObject.lastInsertCursor); - textObject.runWordWrap(); + var result = textObject.runWordWrap(); + textObject.contentWidth = result.maxLineWidth; + textObject.contentHeight = result.linesHeight; + textObject.linesCount = result.lines.length; + }; + + var SetTextOXYMethods = { + setTextOYByPercentage: function setTextOYByPercentage(percentage) { + this.setTextOY(-this.textVisibleHeight * percentage); + return this; + }, + getTextOYPercentage: function getTextOYPercentage() { + var textVisibleHeight = this.textVisibleHeight; + if (textVisibleHeight === 0) { + return 0; + } + return this._textOY / -textVisibleHeight; + }, + setTextOXByPercentage: function setTextOXByPercentage(percentage) { + this.setTextOX(-this.textVisibleWidth * percentage); + return this; + }, + getTextOXPercentage: function getTextOXPercentage() { + var textVisibleWidth = this.textVisibleWidth; + if (textVisibleWidth === 0) { + return 0; + } + return this._textOX / -textVisibleWidth; + } }; var IsPlainObject$J = Phaser.Utils.Objects.IsPlainObject; @@ -21184,6 +21214,11 @@ var cursorStyle = ExtractByPrefix(config.style, 'cursor'); _this = _super.call(this, scene, x, y, fixedWidth, fixedHeight, config); _this.type = 'rexCanvasInput'; + + // readonly + _this.contentWidth = undefined; + _this.contentHeight = undefined; + _this.linesCount = undefined; _this._text; _this.textEdit = CreateHiddenTextEdit(_assertThisInitialized(_this), config); if (config.focusStyle) { @@ -21415,12 +21450,67 @@ this.minLength = value; return this; } + }, { + key: "topTextOY", + get: function get() { + return 0; + } + }, { + key: "bottomTextOY", + get: function get() { + return -this.tableVisibleHeight; + } + }, { + key: "leftTextOX", + get: function get() { + return 0; + } + }, { + key: "rightTextOX", + get: function get() { + return -this.textVisibleWidth; + } + }, { + key: "textVisibleHeight", + get: function get() { + var h = this.contentHeight - this.height; + if (h < 0) { + h = 0; + } + return h; + } + }, { + key: "textVisibleWidth", + get: function get() { + var w = this.contentWidth - this.width; + if (w < 0) { + w = 0; + } + return w; + } + }, { + key: "t", + get: function get() { + return this.getTextOYPercentage(); + }, + set: function set(value) { + this.setTextOYByPercentage(value).updateTexture(); + } + }, { + key: "s", + get: function get() { + return this.getTextOXPercentage(); + }, + set: function set(value) { + this.setTextOXByPercentage(value).updateTexture(); + } }]); return CanvasInput; }(DynamicText); var DefaultParseTextCallback = function DefaultParseTextCallback(text) { return text; }; + Object.assign(CanvasInput.prototype, SetTextOXYMethods); ObjectFactory.register('canvasInput', function (x, y, fixedWidth, fixedHeight, config) { var gameObject = new CanvasInput(this.scene, x, y, fixedWidth, fixedHeight, config); @@ -48371,7 +48461,6 @@ if (config === undefined) { config = {}; } - config.scrollMode = 0; // Create text-block var textObject = GetValue$14(config, 'text', undefined); diff --git a/dist/rexuiplugin.min.js b/dist/rexuiplugin.min.js index 3c82d69eef..54652d568f 100644 --- a/dist/rexuiplugin.min.js +++ b/dist/rexuiplugin.min.js @@ -1,17 +1,17 @@ -!function(t,e){"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();}(undefined,(function(){function t(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),i.push.apply(i,n);}return i}function e(e){for(var i=1;it.length)&&(e=t.length);for(var i=0,n=new Array(e);i=6?(n=[arguments[2],void 0,arguments[3]],s=[arguments[4],void 0,arguments[5]]):(n=M(n),s=M(s)),this.textureKey=t,this.baseFrameName=e,this.columns.data=n,this.columns.count=n?n.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(!n||!s)return this.clear(),this;for(var o=r.get(e),a=o.width,h=0,l=0,u=n.length;l0?0:g,b=0;l=0;for(var S=n.length;l0?0:y),y>=1&&g>=1){var P=i(k=this.getFrameNameCallback(l,C,e));"string"!==P&&"number"!==P||r.add(k,0,b+o.cutX,x+o.cutY,y,g);}b+=y;}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,n,s,r,o,a,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,f=c>=0?this.maxFixedPartScaleY:this.height/l;if(this.preserveRatio){var p=Math.min(d,f);if(d>p){var v=(d-p)*h;u>=0?u+=v:u=v,d=p;}if(f>p){var g=(f-p)*l;c>=0?c+=g:c=g,f=p;}}this.columns.scale=d,this.rows.scale=f,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 y=0,k=0;this._beginDraw();for(var m=0,b=this.rows.count;m0&&a>0&&(0===(0===r.stretch&&0===s.stretch||0===this.getStretchMode(x,m)?0:1)?this._drawImage(this.textureKey,n,y,k,o,a):this._drawTileSprite(this.textureKey,n,y,k,o,a)),y+=o;k+=a;}this._endDraw();},setStretchMode:function(t){return E(t)?(this.stretchMode.edge=R(_(t,"edge",0)),this.stretchMode.internal=R(_(t,"internal",0))):(t=R(t),this.stretchMode.edge=t,this.stretchMode.internal=t),this},getStretchMode:function(t,e){return B.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}},j=Phaser.Utils.Objects.IsPlainObject,z=Phaser.Utils.Objects.GetValue,A=function(t,e){var i=function(t){a(s,t);var i=d(s);function s(t,r,o,a,h,l,u,c,d,f){var p;if(n(this,s),j(r)?(r=z(f=r,"x",0),o=z(f,"y",0),a=z(f,"width",1),h=z(f,"height",1),l=z(f,"key",void 0),u=z(f,"baseFrame",void 0),c=z(f,"columns",void 0),d=z(f,"rows",void 0)):j(a)?(a=z(f=a,"width",1),h=z(f,"height",1),l=z(f,"key",void 0),u=z(f,"baseFrame",void 0),c=z(f,"columns",void 0),d=z(f,"rows",void 0)):j(l)?(l=z(f=l,"key",void 0),u=z(f,"baseFrame",void 0),c=z(f,"columns",void 0),d=z(f,"rows",void 0)):j(u)?(u=z(f=u,"baseFrame",void 0),c=z(f,"columns",void 0),d=z(f,"rows",void 0)):Array.isArray(u)?(f=d,d=c,c=u,u=z(f,"baseFrame",void 0)):j(c)&&(c=z(f=c,"columns",void 0),d=z(f,"rows",void 0)),void 0===c){var v=z(f,"leftWidth",void 0),g=z(f,"rightWidth",void 0);void 0!==v&&void 0!==g&&(c=[v,void 0,g]);}if(void 0===d){var y=z(f,"topHeight",void 0),k=z(f,"bottomHeight",void 0);void 0!==y&&void 0!==k&&(d=[y,void 0,k]);}(p=i.call(this,t)).type=e,p.setPosition(r,o).setSize(a,h).setOrigin(.5,.5),p.columns={},p.rows={},p.stretchMode={},p._tileSprite=void 0,p._image=void 0,p.setGetFrameNameCallback(z(f,"getFrameNameCallback",void 0)),p.setStretchMode(z(f,"stretchMode",0)),p.setPreserveRatio(z(f,"preserveRatio",!0));var m=z(f,"maxFixedPartScale",1),b=z(f,"maxFixedPartScaleX",m),x=z(f,"maxFixedPartScaleY",void 0);return p.setMaxFixedPartScale(b,x),p.setBaseTexture(l,u,c,d),p}return r(s,[{key:"minWidth",get:function(){return this.columns.minWidth}},{key:"minHeight",get:function(){return this.rows.minHeight}},{key:"fixedPartScaleX",get:function(){return this.columns.scale}},{key:"fixedPartScaleY",get:function(){return this.rows.scale}},{key:"resize",value:function(t,e){return this.width===t&&this.height===e||(p(h(s.prototype),"resize",this)?p(h(s.prototype),"resize",this).call(this,t,e):p(h(s.prototype),"setSize",this).call(this,t,e),this.updateTexture()),this}}]),s}(t);return Object.assign(i.prototype,I),i},F=Phaser.Game,W=function(t){return t instanceof F},Y=Phaser.Scene,V=function(t){return t instanceof Y},X=function(t){return null==t||"object"!==i(t)?null:W(t)?t:W(t.game)?t.game:V(t)?t.sys.game:V(t.scene)?t.scene.sys.game:void 0},G=Phaser.GameObjects,U=void 0,H=function(t,e){if(U||(U={},X(t).events.once("destroy",(function(){for(var t in U)U[t].destroy();U=void 0;}))),!U.hasOwnProperty(e)){var i=X(t).scene.systemScene;(t=new G[e](i)).setOrigin(0),U[e]=t;}return U[e]},N=function(t){a(i,t);var e=d(i);function i(){return n(this,i),e.apply(this,arguments)}return r(i)}(A(Phaser.GameObjects.RenderTexture,"rexNinePatch")),K={_drawImage:function(t,e,i,n,s,r){var o=H(this,"Image").setTexture(t,e).setDisplaySize(s,r);this.draw(o,i,n);},_drawTileSprite:function(t,e,i,n,s,r){var o=H(this,"TileSprite").setTexture(t,e).setSize(s,r);this.draw(o,i,n);}};Object.assign(N.prototype,K);var J=function(t){return null==t||""===t||0===t.length},Z=function(t,e,n,s){if(void 0===s&&(s="."),"object"===i(t)){if(J(e)){if(null==n)return;"object"===i(n)&&(t=n);}else {"string"==typeof e&&(e=e.split(s));var r=e.pop(),o=function(t,e,n){var s=t;if(J(e));else {var r;"string"==typeof e&&(e=e.split("."));for(var o=0,a=e.length;o0?this.items.pop():null}},{key:"push",value:function(t){return this.items.push(t),this}},{key:"pushMultiple",value:function(t){return this.items.push.apply(this.items,t),t.length=0,this}},{key:"clear",value:function(){return this.items.length=0,this}}]),t}(),rt=Phaser.Utils.Objects.GetValue,ot={},at=function(){function t(e){n(this,t),this.pools=rt(e,"pools",ot);}return r(t,[{key:"destroy",value:function(){this.pools=void 0;}},{key:"free",value:function(t){if(!this.pools)return this;var e=t.type;return this.pools.hasOwnProperty(e)||(this.pools[e]=new st),this.pools[e].push(t),t.onFree(),this}},{key:"freeMultiple",value:function(t){if(!this.pools)return this;for(var e=0,i=t.length;e0},yt=function(t,e){return t._depth-e._depth},kt=Phaser.GameObjects.Components;Phaser.Class.mixin(vt,[kt.Alpha,kt.BlendMode,kt.ComputedSize,kt.Depth,kt.GetBounds,kt.Mask,kt.Origin,kt.Pipeline,kt.PostPipeline,kt.ScrollFactor,kt.Transform,kt.Visible,Q,nt]);var mt="image",bt=function(t,e,i){if(t&&"number"!=typeof t){if(t.hasOwnProperty(e))return t[e];if(-1!==e.indexOf(".")){for(var n=e.split("."),s=t,r=i,o=0;ot.length)&&(e=t.length);for(var i=0,n=new Array(e);i=6?(n=[arguments[2],void 0,arguments[3]],s=[arguments[4],void 0,arguments[5]]):(n=M(n),s=M(s)),this.textureKey=t,this.baseFrameName=e,this.columns.data=n,this.columns.count=n?n.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(!n||!s)return this.clear(),this;for(var o=r.get(e),a=o.width,h=0,l=0,u=n.length;l0?0:g,b=0;l=0;for(var S=n.length;l0?0:y),y>=1&&g>=1){var P=i(k=this.getFrameNameCallback(l,C,e));"string"!==P&&"number"!==P||r.add(k,0,b+o.cutX,x+o.cutY,y,g);}b+=y;}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,n,s,r,o,a,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,f=c>=0?this.maxFixedPartScaleY:this.height/l;if(this.preserveRatio){var p=Math.min(d,f);if(d>p){var v=(d-p)*h;u>=0?u+=v:u=v,d=p;}if(f>p){var g=(f-p)*l;c>=0?c+=g:c=g,f=p;}}this.columns.scale=d,this.rows.scale=f,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 y=0,k=0;this._beginDraw();for(var m=0,b=this.rows.count;m0&&a>0&&(0===(0===r.stretch&&0===s.stretch||0===this.getStretchMode(x,m)?0:1)?this._drawImage(this.textureKey,n,y,k,o,a):this._drawTileSprite(this.textureKey,n,y,k,o,a)),y+=o;k+=a;}this._endDraw();},setStretchMode:function(t){return E(t)?(this.stretchMode.edge=R(_(t,"edge",0)),this.stretchMode.internal=R(_(t,"internal",0))):(t=R(t),this.stretchMode.edge=t,this.stretchMode.internal=t),this},getStretchMode:function(t,e){return B.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}},j=Phaser.Utils.Objects.IsPlainObject,z=Phaser.Utils.Objects.GetValue,A=function(t,e){var i=function(t){a(s,t);var i=d(s);function s(t,r,o,a,h,l,u,c,d,f){var p;if(n(this,s),j(r)?(r=z(f=r,"x",0),o=z(f,"y",0),a=z(f,"width",1),h=z(f,"height",1),l=z(f,"key",void 0),u=z(f,"baseFrame",void 0),c=z(f,"columns",void 0),d=z(f,"rows",void 0)):j(a)?(a=z(f=a,"width",1),h=z(f,"height",1),l=z(f,"key",void 0),u=z(f,"baseFrame",void 0),c=z(f,"columns",void 0),d=z(f,"rows",void 0)):j(l)?(l=z(f=l,"key",void 0),u=z(f,"baseFrame",void 0),c=z(f,"columns",void 0),d=z(f,"rows",void 0)):j(u)?(u=z(f=u,"baseFrame",void 0),c=z(f,"columns",void 0),d=z(f,"rows",void 0)):Array.isArray(u)?(f=d,d=c,c=u,u=z(f,"baseFrame",void 0)):j(c)&&(c=z(f=c,"columns",void 0),d=z(f,"rows",void 0)),void 0===c){var v=z(f,"leftWidth",void 0),g=z(f,"rightWidth",void 0);void 0!==v&&void 0!==g&&(c=[v,void 0,g]);}if(void 0===d){var y=z(f,"topHeight",void 0),k=z(f,"bottomHeight",void 0);void 0!==y&&void 0!==k&&(d=[y,void 0,k]);}(p=i.call(this,t)).type=e,p.setPosition(r,o).setSize(a,h).setOrigin(.5,.5),p.columns={},p.rows={},p.stretchMode={},p._tileSprite=void 0,p._image=void 0,p.setGetFrameNameCallback(z(f,"getFrameNameCallback",void 0)),p.setStretchMode(z(f,"stretchMode",0)),p.setPreserveRatio(z(f,"preserveRatio",!0));var m=z(f,"maxFixedPartScale",1),b=z(f,"maxFixedPartScaleX",m),x=z(f,"maxFixedPartScaleY",void 0);return p.setMaxFixedPartScale(b,x),p.setBaseTexture(l,u,c,d),p}return r(s,[{key:"minWidth",get:function(){return this.columns.minWidth}},{key:"minHeight",get:function(){return this.rows.minHeight}},{key:"fixedPartScaleX",get:function(){return this.columns.scale}},{key:"fixedPartScaleY",get:function(){return this.rows.scale}},{key:"resize",value:function(t,e){return this.width===t&&this.height===e||(p(h(s.prototype),"resize",this)?p(h(s.prototype),"resize",this).call(this,t,e):p(h(s.prototype),"setSize",this).call(this,t,e),this.updateTexture()),this}}]),s}(t);return Object.assign(i.prototype,I),i},F=Phaser.Game,W=function(t){return t instanceof F},Y=Phaser.Scene,X=function(t){return t instanceof Y},V=function(t){return null==t||"object"!==i(t)?null:W(t)?t:W(t.game)?t.game:X(t)?t.sys.game:X(t.scene)?t.scene.sys.game:void 0},G=Phaser.GameObjects,U=void 0,H=function(t,e){if(U||(U={},V(t).events.once("destroy",(function(){for(var t in U)U[t].destroy();U=void 0;}))),!U.hasOwnProperty(e)){var i=V(t).scene.systemScene;(t=new G[e](i)).setOrigin(0),U[e]=t;}return U[e]},N=function(t){a(i,t);var e=d(i);function i(){return n(this,i),e.apply(this,arguments)}return r(i)}(A(Phaser.GameObjects.RenderTexture,"rexNinePatch")),K={_drawImage:function(t,e,i,n,s,r){var o=H(this,"Image").setTexture(t,e).setDisplaySize(s,r);this.draw(o,i,n);},_drawTileSprite:function(t,e,i,n,s,r){var o=H(this,"TileSprite").setTexture(t,e).setSize(s,r);this.draw(o,i,n);}};Object.assign(N.prototype,K);var J=function(t){return null==t||""===t||0===t.length},Z=function(t,e,n,s){if(void 0===s&&(s="."),"object"===i(t)){if(J(e)){if(null==n)return;"object"===i(n)&&(t=n);}else {"string"==typeof e&&(e=e.split(s));var r=e.pop(),o=function(t,e,n){var s=t;if(J(e));else {var r;"string"==typeof e&&(e=e.split("."));for(var o=0,a=e.length;o0?this.items.pop():null}},{key:"push",value:function(t){return this.items.push(t),this}},{key:"pushMultiple",value:function(t){return this.items.push.apply(this.items,t),t.length=0,this}},{key:"clear",value:function(){return this.items.length=0,this}}]),t}(),rt=Phaser.Utils.Objects.GetValue,ot={},at=function(){function t(e){n(this,t),this.pools=rt(e,"pools",ot);}return r(t,[{key:"destroy",value:function(){this.pools=void 0;}},{key:"free",value:function(t){if(!this.pools)return this;var e=t.type;return this.pools.hasOwnProperty(e)||(this.pools[e]=new st),this.pools[e].push(t),t.onFree(),this}},{key:"freeMultiple",value:function(t){if(!this.pools)return this;for(var e=0,i=t.length;e0},yt=function(t,e){return t._depth-e._depth},kt=Phaser.GameObjects.Components;Phaser.Class.mixin(vt,[kt.Alpha,kt.BlendMode,kt.ComputedSize,kt.Depth,kt.GetBounds,kt.Mask,kt.Origin,kt.Pipeline,kt.PostPipeline,kt.ScrollFactor,kt.Transform,kt.Visible,Q,nt]);var mt="image",bt=function(t,e,i){if(t&&"number"!=typeof t){if(t.hasOwnProperty(e))return t[e];if(-1!==e.indexOf(".")){for(var n=e.split("."),s=t,r=i,o=0;o * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */Object.assign(wt.prototype,Ct);var St=Phaser.Math.DegToRad,Pt=Phaser.Math.RadToDeg,Tt=Phaser.Utils.Objects.GetValue,Ot=function(t){a(i,t);var e=d(i);function i(){return n(this,i),e.apply(this,arguments)}return r(i,[{key:"visible",get:function(){return this._visible},set:function(t){this.setDisplayListDirty(this._visible!=t),this._visible=t;}},{key:"setVisible",value:function(t){return void 0===t&&(t=!0),this.visible=t,this}},{key:"alpha",get:function(){return this._alpha},set:function(t){this.setDisplayListDirty(!!this._alpha!=!!t),this._alpha=t;}},{key:"setAlpha",value:function(t){return this.alpha=t,this}},{key:"setX",value:function(t){return this.x=t,this}},{key:"setY",value:function(t){return this.y=t,this}},{key:"setPosition",value:function(t,e){return this.x=t,this.y=e,this}},{key:"setRotation",value:function(t){return this.rotation=t,this}},{key:"angle",get:function(){return Pt(this.rotation)},set:function(t){this.rotation=St(t);}},{key:"setAngle",value:function(t){return this.angle=t,this}},{key:"setScaleX",value:function(t){return this.scaleX=t,this}},{key:"width",get:function(){return this._width},set:function(t){this._width=t;}},{key:"setWidth",value:function(t,e){return void 0===e&&(e=!1),this.width=t,e&&(this.scaleY=this.scaleX),this}},{key:"setScaleY",value:function(t){return this.scaleY=t,this}},{key:"setScale",value:function(t,e){return void 0===e&&(e=t),this.scaleX=t,this.scaleY=e,this}},{key:"height",get:function(){return this._height},set:function(t){this._height=t;}},{key:"setHeight",value:function(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}},{key:"displayWidth",get:function(){return this._width*this.scaleX},set:function(t){this.scaleX=t/this._width;}},{key:"setDisplayWidth",value:function(t,e){return void 0===e&&(e=!1),this.displayWidth=t,e&&(this.scaleY=this.scaleX),this}},{key:"displayHeight",get:function(){return this._height*this.scaleY},set:function(t){this.scaleY=t/this._height;}},{key:"setDisplayHeight",value:function(t,e){return void 0===e&&(e=!1),this.displayHeight=t,e&&(this.scaleX=this.scaleY),this}},{key:"setOriginX",value:function(t){return this.originX=t,this._displayOriginX=this.width*t,this}},{key:"setOriginY",value:function(t){return this.originY=t,this._displayOriginY=this.height*t,this}},{key:"setOrigin",value:function(t,e){return void 0===e&&(e=t),this.setOriginX(t).setOriginY(e),this}},{key:"depth",get:function(){return this._depth},set:function(t){this.setDisplayListDirty(this._depth!=t),this._depth=t;}},{key:"setDepth",value:function(t){return void 0===t&&(t=0),this.depth=t,this}},{key:"modifyPorperties",value:function(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=Tt(t,"width",void 0),i=Tt(t,"height",void 0),n=Tt(t,"scale",void 0),s=Tt(t,"scaleX",n),r=Tt(t,"scaleY",n);void 0!==e?void 0===i&&void 0===r?this.setWidth(e,!0):this.setWidth(e):void 0!==s?this.setScaleX(s):t.hasOwnProperty("displayWidth")&&this.setDisplayWidth(t.displayWidth),void 0!==i?void 0===e&&void 0===s?this.setHeight(i,!0):this.setHeight(i):void 0!==r?this.setScaleY(r):t.hasOwnProperty("displayHeight")&&this.setDisplayHeight(t.displayHeight);var o=Tt(t,"origin",void 0);return void 0!==o?this.setOrigin(o):(t.hasOwnProperty("originX")&&this.setOriginX(t.originX),t.hasOwnProperty("originY")&&this.setOriginY(t.originY)),t.hasOwnProperty("depth")&&this.setDepth(t.depth),this}},{key:"reset",value:function(){return p(h(i.prototype),"reset",this).call(this),this.setVisible().setAlpha(1).setPosition(0,0).setRotation(0).setScale(1,1).setOrigin(0).setDepth(0),this}},{key:"webglRender",value:function(t,e,i,n,s,r,o,a){}},{key:"canvasRender",value:function(t,e,i,n){}}]),i}(wt),Mt=Phaser.GameObjects.Components.TransformMatrix,Et=Phaser.Renderer.WebGL.Utils.getTintAppendFloatAlpha,_t=new Mt,Rt=Phaser.Utils.Objects.IsPlainObject,Lt=function(t){a(i,t);var e=d(i);function i(t,s){var r;return n(this,i),(r=e.call(this,t,mt)).setFrame(s),r}return r(i,[{key:"width",get:function(){return this._width},set:function(t){}},{key:"height",get:function(){return this._height},set:function(t){}},{key:"setFrame",value:function(t){return arguments.length>0&&!Rt(t)&&(t=this.parent.texture.get(t)),this.frame=t,this._width=t?t.width:0,this._height=t?t.height:0,this}},{key:"setFlipX",value:function(t){return void 0===t&&(t=!0),this.flipX=t,this}},{key:"setFlipY",value:function(t){return void 0===t&&(t=!0),this.flipY=t,this}},{key:"resetFlip",value:function(){return this.flipX=!1,this.flipY=!1,this}},{key:"tint",get:function(){return void 0===this._tint?this.parent.tint:this._tint},set:function(t){this._tint=t;}},{key:"setTint",value:function(t){return this.tint=t,this.tintFill=!1,this}},{key:"setTintFill",value:function(t){return this.tint=t,this.tintFill=!0,this}},{key:"clearTint",value:function(){return this.setTint(16777215),this}},{key:"resetTint",value:function(){return this.tint=void 0,this.tintFill=void 0,this}},{key:"tintFill",get:function(){return void 0===this._tintFill?this.parent.tintFill:this._tintFill},set:function(t){this._tintFill=t;}},{key:"reset",value:function(){return p(h(i.prototype),"reset",this).call(this),this.resetFlip().resetTint().setFrame(),this}},{key:"modifyPorperties",value:function(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),p(h(i.prototype),"modifyPorperties",this).call(this,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}}]),i}(Ot),Bt={webglRender:function(t,e,i,n,s,r,o,a){var h=this._width,l=this._height,u=h*this.originX,c=l*this.originY,d=this.x-n,f=this.y-s,p=1,v=1;this.flipX&&(d+=h-2*u,p=-1),this.flipY&&(f+=l-2*c,v=-1),_t.applyITRS(d,f,this.rotation,this.scaleX*p,this.scaleY*v),e.multiply(_t,_t);var g=-u,y=-c,k=g+h,m=y+l,b=_t.setQuad(g,y,k,m,a),x=this.frame.u0,C=this.frame.v0,w=this.frame.u1,S=this.frame.v1,P=Et(this.tint,this.alpha*i);t.batchQuad(this.parent,b[0],b[1],b[2],b[3],b[4],b[5],b[6],b[7],x,C,w,S,P,P,P,P,this.tintFill,r,o);},canvasRender:function(t,e,i,n){t.save();var s=this._width,r=this._height,o=s*this.originX,a=r*this.originY,h=this.x-o,l=this.y-a,u=1,c=1;this.flipX&&(h+=s,u=-1),this.flipY&&(l+=r,c=-1),n&&(h=Math.round(h),l=Math.round(l)),t.translate(h,l),t.rotate(this.rotation),t.scale(this.scaleX*u,this.scaleY*c);var d=this.frame;t.drawImage(d.source.image,d.cutX,d.cutY,s,r,0,0,s,r),t.restore();}};Object.assign(Lt.prototype,Bt);var Dt=function(t,e){"string"==typeof e&&(e={frame:e});var i=t.poolManager?t.poolManager.allocate(mt):null;return null===i?i=new Lt(t):i.setParent(t).setActive(),i.modifyPorperties(e),t.addChild(i),i},It={_drawImage:function(t,e,i,n,s,r){Dt(this,{frame:e,x:i,y:n,width:s,height:r});},_drawTileSprite:function(t,e,i,n,s,r){var o=this.texture.get(e),a=o.width,h=o.height,l=Math.floor(s/a),u=Math.floor(r/h);i+=(s-l*a)/2,n+=(r-u*h)/2;for(var c=0;c=0||t.y>=0,t.x=Math.abs(t.x),t.y=Math.abs(t.y);},Vt=function(t,e,i){var n=i.length;if(n>=2){var s=i[n-2],r=i[n-1];if(t===s&&e===r)return i}return i.push(t,e),i},Xt=Phaser.Math.DegToRad,Gt=function(t,e,i,n,s,r,o,a,h){o&&r>s?r-=360:!o&&r>>16,a=(65280&s)>>>8,h=255&s;t.fillStyle="rgba("+o+","+a+","+h+","+r+")";},qt=function(t,e,i,n){var s=i||e.strokeColor,r=n||e.strokeAlpha,o=(16711680&s)>>>16,a=(65280&s)>>>8,h=255&s;t.strokeStyle="rgba("+o+","+a+","+h+","+r+")",t.lineWidth=e.lineWidth;},$t=Phaser.Renderer.Canvas.SetTransform,Qt={renderWebGL:function(t,e,i,n){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var s=t.pipelines.set(e.pipeline),r=Jt(e,i,n),o=s.calcMatrix.copyFrom(r.calc),a=e._displayOriginX,h=e._displayOriginY,l=i.alpha*e.alpha;t.pipelines.preBatch(e),e.isFilled&&Ht(s,o,e,l,a,h),e.isStroked&&Kt(s,e,l,a,h),t.pipelines.postBatch(e);},renderCanvas:function(t,e,i,n){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var s=t.currentContext;if($t(t,s,e,i,n)){var r=e._displayOriginX,o=e._displayOriginY,a=e.pathData,h=a.length-1,l=a[0]-r,u=a[1]-o;s.beginPath(),s.moveTo(l,u),e.closePath||(h-=2);for(var c=2;c0;}},{key:"fillAlpha",get:function(){return this._fillAlpha},set:function(t){this._fillAlpha=t,this.isFilled=t>0&&null!=this._fillColor;}},{key:"setFillStyle",value:function(t,e){return void 0===e&&(e=1),this.fillColor=t,this.fillAlpha=e,this}},{key:"strokeColor",get:function(){return this._strokeColor},set:function(t){this._strokeColor=t,this.isStroked=null!=t&&this._strokeAlpha>0&&this._lineWidth>0;}},{key:"strokeAlpha",get:function(){return this._strokeAlpha},set:function(t){this._strokeAlpha=t,this.isStroked=t>0&&null!=this._strokeColor&&this._lineWidth>0;}},{key:"lineWidth",get:function(){return this._lineWidth},set:function(t){this._lineWidth=t,this.isStroked=t>0&&null!=this._strokeColor;}},{key:"setStrokeStyle",value:function(t,e,i){return void 0===i&&(i=1),this.lineWidth=t,this.strokeColor=e,this.strokeAlpha=i,this}},{key:"updateData",value:function(){var t=this.geom,e=this.pathData;e.length=0;var i,n=t.width,s=t.height,r=t.cornerRadius,o=this.iteration+1;if(i=r.tl,re(i))if(i.convex){var a=i.x,h=i.y;Gt(a,h,i.x,i.y,180,270,!1,o,e);}else {Gt(a=0,h=0,i.x,i.y,90,0,!0,o,e);}else Vt(0,0,e);if(i=r.tr,re(i))if(i.convex){a=n-i.x,h=i.y;Gt(a,h,i.x,i.y,270,360,!1,o,e);}else {Gt(a=n,h=0,i.x,i.y,180,90,!0,o,e);}else Vt(n,0,e);if(i=r.br,re(i))if(i.convex){a=n-i.x,h=s-i.y;Gt(a,h,i.x,i.y,0,90,!1,o,e);}else {Gt(a=n,h=s,i.x,i.y,270,180,!0,o,e);}else Vt(n,s,e);if(i=r.bl,re(i))if(i.convex){a=i.x,h=s-i.y;Gt(a,h,i.x,i.y,90,180,!1,o,e);}else {Gt(a=0,h=s,i.x,i.y,360,270,!0,o,e);}else Vt(0,s,e);return e.push(e[0],e[1]),this.pathIndexes=ne(e),this}},{key:"setShapeType",value:function(t){return "string"==typeof t&&(t=oe[t]),this.shapeType=t,this}},{key:"width",get:function(){return this.geom.width},set:function(t){this.resize(t,this.height);}},{key:"height",get:function(){return this.geom.height},set:function(t){this.resize(this.width,t);}},{key:"setSize",value:function(t,e){if(void 0===e&&(e=t),this.geom.width===t&&this.geom.height===e)return this;this.geom.setSize(t,e),1===this.shapeType&&this.setRadius({x:t/2,y:e/2}),this.updateDisplayOrigin(),this.dirty=!0;var i=this.input;return i&&!i.customHitArea&&(i.hitArea.width=t,i.hitArea.height=e),this}},{key:"resize",value:function(t,e){return this.setSize(t,e),this}},{key:"radius",get:function(){return this.geom.radius},set:function(t){this.geom.setRadius(t),this.updateDisplayOrigin(),this.dirty=!0;}},{key:"radiusTL",get:function(){return this.geom.radiusTL},set:function(t){this.geom.radiusTL=t,this.dirty=!0;}},{key:"radiusTR",get:function(){return this.geom.radiusTR},set:function(t){this.geom.radiusTR=t,this.dirty=!0;}},{key:"radiusBL",get:function(){return this.geom.radiusBL},set:function(t){this.geom.radiusBL=t,this.dirty=!0;}},{key:"radiusBR",get:function(){return this.geom.radiusBR},set:function(t){this.geom.radiusBR=t,this.dirty=!0;}},{key:"setRadius",value:function(t){return void 0===t&&(t=0),this.radius=t,this}},{key:"setRadiusTL",value:function(t){return void 0===t&&(t=0),this.radiusTL=t,this}},{key:"setRadiusTR",value:function(t){return void 0===t&&(t=0),this.radiusTR=t,this}},{key:"setRadiusBL",value:function(t){return void 0===t&&(t=0),this.radiusBL=t,this}},{key:"setRadiusBR",value:function(t){return void 0===t&&(t=0),this.radiusBR=t,this}},{key:"cornerRadius",get:function(){return this.geom.cornerRadius},set:function(t){this.radius=t;}},{key:"setCornerRadius",value:function(t){return this.setRadius(t)}},{key:"iteration",get:function(){return this._iteration},set:function(t){void 0!==this._iteration?this._iteration!==t&&(this._iteration=t,this.dirty=!0):this._iteration=t;}},{key:"setIteration",value:function(t){return void 0===t&&(t=6),this.iteration=t,this}}]),i}(te),re=function(t){return t.x>0&&t.y>0},oe={rectangle:0,circle:1};Object.assign(se.prototype,Qt),T.register("roundRectangle",(function(t,e,i,n,s,r,o){var a=new se(this.scene,t,e,i,n,s,r,o);return this.scene.add.existing(a),a})),Z(window,"RexPlugins.UI.RoundRectangle",se);var ae=Phaser.Renderer.WebGL.Utils,he={renderWebGL:function(t,e,i,n){if(e.dirty&&(e.updateTexture(),e.dirty=!1),0!==e.width&&0!==e.height){i.addToRenderList(e);var s=e.frame,r=s.width,o=s.height,a=ae.getTintAppendFloatAlpha,h=t.pipelines.set(e.pipeline,e),l=h.setTexture2D(s.glTexture,e);t.pipelines.preBatch(e),h.batchTexture(e,s.glTexture,r,o,e.x,e.y,r/e.resolution,o/e.resolution,e.scaleX,e.scaleY,e.rotation,e.flipX,e.flipY,e.scrollFactorX,e.scrollFactorY,e.displayOriginX,e.displayOriginY,0,0,r,o,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,n,!1,l),t.pipelines.postBatch(e);}},renderCanvas:function(t,e,i,n){e.dirty&&(e.updateTexture(),e.dirty=!1),0!==e.width&&0!==e.height&&(i.addToRenderList(e),t.batchSprite(e,e.frame,i,n));}},le=Phaser.Display.Color,ue={clear:function(){return this.context.clearRect(0,0,this.canvas.width,this.canvas.height),this.dirty=!0,this},fill:function(t){return this.context.fillStyle=t,this.context.fillRect(0,0,this.canvas.width,this.canvas.height),this.dirty=!0,this},drawFrame:function(t,e,i,n,s,r,o,a,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===n&&(n=0),void 0===s&&(s=c),void 0===r&&(r=d),void 0===o&&(o=0),void 0===a&&(a=0),void 0===h&&(h=c),void 0===l&&(l=d);var f=u.cutX+o,p=u.cutY+a;return this.context.drawImage(u.source.image,f,p,h,l,i,n,s,r),this.dirty=!0,this},getDataURL:function(t,e){return this.canvas.toDataURL(t,e)},getPixel:function(t,e,i){void 0===i&&(i=new le);var n=this.context.getImageData(t,e,1,1);return i.setTo(n.data[0],n.data[1],n.data[2],n.data[3]),i},setPixel:function(t,e,i,n,s,r){if("number"!=typeof i){var o=i;i=o.red,n=o.green,s=o.blue,r=o.alpha;}void 0===r&&(r=0!==i||0!==n||0!==s?255:0);var a=this.context.createImageData(1,1);return a.data[0]=i,a.data[1]=n,a.data[2]=s,a.data[3]=r,this.context.putImageData(a,t,e),this.dirty=!0,this}},ce=function(t,e,i,n,s,r,o){var a,h=t.sys.textures,l=t.renderer;void 0===n&&(n=0),void 0===s&&(s=0),void 0===r&&(r=e.width),void 0===o&&(o=e.height);var u=(a=h.exists(i)?h.get(i):h.createCanvas(i,r,o)).getSourceImage();u.width!==r&&(u.width=r),u.height!==o&&(u.height=o);var c=u.getContext("2d",{willReadFrequently:!0});c.clearRect(0,0,r,o),c.drawImage(e,n,s,r,o),l.gl&&a&&l.canvasToTexture(u,a.source[0].glTexture,!0,0);},de={updateTexture:function(t,e){t&&(e?t.call(e,this.canvas,this.context):t(this.canvas,this.context)),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=this.frame.source.glTexture),this.dirty=!1;var i=this.input;return i&&!i.customHitArea&&(i.hitArea.width=this.width,i.hitArea.height=this.height),this},generateTexture:function(t,e,i,n,s){var r=this.canvas;return void 0===n?n=r.width:n*=this.resolution,void 0===s?s=r.height:s*=this.resolution,ce(this.scene,r,t,e,i,n,s),this},loadTexture:function(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}};lt();var fe=Phaser.Display.Canvas.CanvasPool,pe=function(t){a(i,t);var e=d(i);function i(t,s,r,o,a){var h;return n(this,i),void 0===s&&(s=0),void 0===r&&(r=0),void 0===o&&(o=1),void 0===a&&(a=1),(h=e.call(this,t,"rexCanvas")).renderer=t.sys.game.renderer,h.resolution=1,h._width=o,h._height=a,o=Math.max(Math.ceil(o*h.resolution),1),a=Math.max(Math.ceil(a*h.resolution),1),h.canvas=fe.create(u(h),o,a),h.context=h.canvas.getContext("2d",{willReadFrequently:!0}),h.dirty=!1,h.setPosition(s,r),h.setOrigin(.5,.5),h.initPipeline(),h.initPostPipeline(!0),h._crop=h.resetCropObject(),h.texture=t.sys.textures.addCanvas(null,h.canvas,!0),h.frame=h.texture.get(),h.frame.source.resolution=h.resolution,h.renderer&&h.renderer.gl&&(h.renderer.deleteTexture(h.frame.source.glTexture),h.frame.source.glTexture=null),h.dirty=!0,h}return r(i,[{key:"preDestroy",value:function(){fe.remove(this.canvas),this.texture.destroy(),this.canvas=null,this.context=null;}},{key:"width",get:function(){return this._width},set:function(t){this.setSize(t,this._height);}},{key:"height",get:function(){return this._height},set:function(t){this.setSize(this._width,t);}},{key:"setCanvasSize",value:function(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}},{key:"setSize",value:function(t,e){return this.setCanvasSize(t,e),this}},{key:"displayWidth",get:function(){return this.scaleX*this._width},set:function(t){this.scaleX=t/this._width;}},{key:"displayHeight",get:function(){return this.scaleY*this._height},set:function(t){this.scaleY=t/this._height;}},{key:"setDisplaySize",value:function(t,e){return this.displayWidth=t,this.displayHeight=e,this}},{key:"getCanvas",value:function(t){return t||(this.dirty=!0),this.canvas}},{key:"getContext",value:function(t){return t||(this.dirty=!0),this.context}},{key:"needRedraw",value:function(){return this.dirty=!0,this}},{key:"resize",value:function(t,e){return this.setSize(t,e),this}}]),i}(Phaser.GameObjects.GameObject),ve=Phaser.GameObjects.Components;Phaser.Class.mixin(pe,[ve.Alpha,ve.BlendMode,ve.Crop,ve.Depth,ve.Flip,ve.GetBounds,ve.Mask,ve.Origin,ve.Pipeline,ve.PostPipeline,ve.ScrollFactor,ve.Tint,ve.Transform,ve.Visible,he,ue,de]);var ge=Phaser.Utils.String.Pad,ye=function(t,e,n){if(null==t)return t;switch(i(t)){case"string":default:return t;case"number":return "#".concat(ge(Math.floor(t).toString(16),6,"0",1));case"function":return t(e,n);case"object":return t.hasOwnProperty("r")?t.hasOwnProperty("a")?"rgba(".concat(t.r,",").concat(t.g,",").concat(t.b,",").concat(t.a,")"):"rgb(".concat(t.r,",").concat(t.g,",").concat(t.b,")"):t.hasOwnProperty("h")?t.hasOwnProperty("a")?"hsla(".concat(t.h,",").concat(t.s,",").concat(t.l,",").concat(t.a,")"):"hsl(".concat(t.h,",").concat(t.s,",").concat(t.l,")"):t}},ke=Phaser.Math.DegToRad,me=function(t,e,i,n,s,r,o){var a,h,l,u,c,d=new At(e,i,n,s,r),f=d.minWidth,p=d.minHeight,v=n>=f?1:n/f,g=s>=p?1:s/p,y=d.cornerRadius;t.save(),t.beginPath(),t.translate(e,i),a=y.tl,xe(a)?(h=a.x*v,l=a.y*g,be(a)?Ce(t,h,l,h,l,180,270,!1,o):Ce(t,0,0,h,l,90,0,!0,o),u=0,c=l):(t.lineTo(0,0),u=0,c=0),a=y.tr,xe(a)?(h=a.x*v,l=a.y*g,be(a)?Ce(t,n-h,l,h,l,270,360,!1,o):Ce(t,n,0,h,l,180,90,!0,o)):t.lineTo(n,0),a=y.br,xe(a)?(h=a.x*v,l=a.y*g,be(a)?Ce(t,n-h,s-l,h,l,0,90,!1,o):Ce(t,n,s,h,l,270,180,!0,o)):t.lineTo(n,s),a=y.bl,xe(a)?(h=a.x*v,l=a.y*g,be(a)?Ce(t,h,s-l,h,l,90,180,!1,o):Ce(t,0,s,h,l,360,270,!0,o)):t.lineTo(0,s),t.lineTo(u,c),t.closePath(),t.restore();},be=function(t){return !t.hasOwnProperty("convex")||t.convex},xe=function(t){return t.x>0&&t.y>0},Ce=function(t,e,i,n,s,r,o,a,h){if(a&&o>r?o-=360:!a&&o0&&(e.strokeStyle=h,e.lineWidth=l,e.stroke());}(t.canvas,t.context,u,u,h,l,s,e,i,n,r,o,a);}},Se=function(){we(this,this.fillStyle,this.strokeStyle,this.lineWidth,this.radius,this.fillColor2,this.isHorizontalGradient,this.iteration);},Pe=Phaser.Utils.Objects.GetValue,Te=function(t){a(i,t);var e=d(i);function i(t,s,r,o,a,h,l,u,c,d,f){var p;n(this,i),void 0===s&&(s=0),void 0===r&&(r=0),void 0===o&&(o=1),void 0===a&&(a=o),void 0===h&&(h=0),(p=e.call(this,t,s,r,o,a)).type="rexRoundRectangleCanvas";var v=Pe(h,"radius",h),g=Pe(h,"iteration",void 0);return p.setRadius(v),p.setIteration(g),p.setFillStyle(l,d,f),p.setStrokeStyle(u,c),p}return r(i,[{key:"radius",get:function(){return this._radius},set:function(t){this.dirty|=this._radius!=t,this._radius=t;}},{key:"setRadius",value:function(t){return this.radius=t,this}},{key:"iteration",get:function(){return this._iteration},set:function(t){this.dirty|=this._iteration!=t,this._iteration=t;}},{key:"setIteration",value:function(t){return this.iteration=t,this}},{key:"fillStyle",get:function(){return this._fillStyle},set:function(t){t=ye(t,this.canvas,this.context),this.dirty|=this._fillStyle!=t,this._fillStyle=t;}},{key:"fillColor2",get:function(){return this._fillColor2},set:function(t){t=ye(t,this.canvas,this.context),this.dirty|=this._fillColor2!=t,this._fillColor2=t;}},{key:"isHorizontalGradient",get:function(){return this._isHorizontalGradient},set:function(t){this.dirty|=this._isHorizontalGradient!=t,this._isHorizontalGradient=t;}},{key:"setFillStyle",value:function(t,e,i){return void 0===i&&(i=!0),this.fillStyle=t,this.fillColor2=e,this.isHorizontalGradient=i,this}},{key:"strokeStyle",get:function(){return this._strokeStyle},set:function(t){t=ye(t,this.canvas,this.context),this.dirty|=this._strokeStyle!=t,this._strokeStyle=t;}},{key:"lineWidth",get:function(){return this._lineWidth},set:function(t){this.dirty|=this._lineWidth!=t,this._lineWidth=t;}},{key:"setStrokeStyle",value:function(t,e){return this.strokeStyle=t,this.lineWidth=e,this}},{key:"updateTexture",value:function(){return this.clear(),Se.call(this),p(h(i.prototype),"updateTexture",this).call(this),this}}]),i}(pe);T.register("roundRectangleCanvas",(function(t,e,i,n,s,r,o,a,h,l){var u=new Te(this.scene,t,e,i,n,s,r,o,a,h,l);return this.scene.add.existing(u),u})),Z(window,"RexPlugins.UI.RoundRectangleCanvas",Te); + */Object.assign(wt.prototype,Ct);var St=Phaser.Math.DegToRad,Pt=Phaser.Math.RadToDeg,Tt=Phaser.Utils.Objects.GetValue,Ot=function(t){a(i,t);var e=d(i);function i(){return n(this,i),e.apply(this,arguments)}return r(i,[{key:"visible",get:function(){return this._visible},set:function(t){this.setDisplayListDirty(this._visible!=t),this._visible=t;}},{key:"setVisible",value:function(t){return void 0===t&&(t=!0),this.visible=t,this}},{key:"alpha",get:function(){return this._alpha},set:function(t){this.setDisplayListDirty(!!this._alpha!=!!t),this._alpha=t;}},{key:"setAlpha",value:function(t){return this.alpha=t,this}},{key:"setX",value:function(t){return this.x=t,this}},{key:"setY",value:function(t){return this.y=t,this}},{key:"setPosition",value:function(t,e){return this.x=t,this.y=e,this}},{key:"setRotation",value:function(t){return this.rotation=t,this}},{key:"angle",get:function(){return Pt(this.rotation)},set:function(t){this.rotation=St(t);}},{key:"setAngle",value:function(t){return this.angle=t,this}},{key:"setScaleX",value:function(t){return this.scaleX=t,this}},{key:"width",get:function(){return this._width},set:function(t){this._width=t;}},{key:"setWidth",value:function(t,e){return void 0===e&&(e=!1),this.width=t,e&&(this.scaleY=this.scaleX),this}},{key:"setScaleY",value:function(t){return this.scaleY=t,this}},{key:"setScale",value:function(t,e){return void 0===e&&(e=t),this.scaleX=t,this.scaleY=e,this}},{key:"height",get:function(){return this._height},set:function(t){this._height=t;}},{key:"setHeight",value:function(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}},{key:"displayWidth",get:function(){return this._width*this.scaleX},set:function(t){this.scaleX=t/this._width;}},{key:"setDisplayWidth",value:function(t,e){return void 0===e&&(e=!1),this.displayWidth=t,e&&(this.scaleY=this.scaleX),this}},{key:"displayHeight",get:function(){return this._height*this.scaleY},set:function(t){this.scaleY=t/this._height;}},{key:"setDisplayHeight",value:function(t,e){return void 0===e&&(e=!1),this.displayHeight=t,e&&(this.scaleX=this.scaleY),this}},{key:"setOriginX",value:function(t){return this.originX=t,this._displayOriginX=this.width*t,this}},{key:"setOriginY",value:function(t){return this.originY=t,this._displayOriginY=this.height*t,this}},{key:"setOrigin",value:function(t,e){return void 0===e&&(e=t),this.setOriginX(t).setOriginY(e),this}},{key:"depth",get:function(){return this._depth},set:function(t){this.setDisplayListDirty(this._depth!=t),this._depth=t;}},{key:"setDepth",value:function(t){return void 0===t&&(t=0),this.depth=t,this}},{key:"modifyPorperties",value:function(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=Tt(t,"width",void 0),i=Tt(t,"height",void 0),n=Tt(t,"scale",void 0),s=Tt(t,"scaleX",n),r=Tt(t,"scaleY",n);void 0!==e?void 0===i&&void 0===r?this.setWidth(e,!0):this.setWidth(e):void 0!==s?this.setScaleX(s):t.hasOwnProperty("displayWidth")&&this.setDisplayWidth(t.displayWidth),void 0!==i?void 0===e&&void 0===s?this.setHeight(i,!0):this.setHeight(i):void 0!==r?this.setScaleY(r):t.hasOwnProperty("displayHeight")&&this.setDisplayHeight(t.displayHeight);var o=Tt(t,"origin",void 0);return void 0!==o?this.setOrigin(o):(t.hasOwnProperty("originX")&&this.setOriginX(t.originX),t.hasOwnProperty("originY")&&this.setOriginY(t.originY)),t.hasOwnProperty("depth")&&this.setDepth(t.depth),this}},{key:"reset",value:function(){return p(h(i.prototype),"reset",this).call(this),this.setVisible().setAlpha(1).setPosition(0,0).setRotation(0).setScale(1,1).setOrigin(0).setDepth(0),this}},{key:"webglRender",value:function(t,e,i,n,s,r,o,a){}},{key:"canvasRender",value:function(t,e,i,n){}}]),i}(wt),Mt=Phaser.GameObjects.Components.TransformMatrix,Et=Phaser.Renderer.WebGL.Utils.getTintAppendFloatAlpha,_t=new Mt,Rt=Phaser.Utils.Objects.IsPlainObject,Lt=function(t){a(i,t);var e=d(i);function i(t,s){var r;return n(this,i),(r=e.call(this,t,mt)).setFrame(s),r}return r(i,[{key:"width",get:function(){return this._width},set:function(t){}},{key:"height",get:function(){return this._height},set:function(t){}},{key:"setFrame",value:function(t){return arguments.length>0&&!Rt(t)&&(t=this.parent.texture.get(t)),this.frame=t,this._width=t?t.width:0,this._height=t?t.height:0,this}},{key:"setFlipX",value:function(t){return void 0===t&&(t=!0),this.flipX=t,this}},{key:"setFlipY",value:function(t){return void 0===t&&(t=!0),this.flipY=t,this}},{key:"resetFlip",value:function(){return this.flipX=!1,this.flipY=!1,this}},{key:"tint",get:function(){return void 0===this._tint?this.parent.tint:this._tint},set:function(t){this._tint=t;}},{key:"setTint",value:function(t){return this.tint=t,this.tintFill=!1,this}},{key:"setTintFill",value:function(t){return this.tint=t,this.tintFill=!0,this}},{key:"clearTint",value:function(){return this.setTint(16777215),this}},{key:"resetTint",value:function(){return this.tint=void 0,this.tintFill=void 0,this}},{key:"tintFill",get:function(){return void 0===this._tintFill?this.parent.tintFill:this._tintFill},set:function(t){this._tintFill=t;}},{key:"reset",value:function(){return p(h(i.prototype),"reset",this).call(this),this.resetFlip().resetTint().setFrame(),this}},{key:"modifyPorperties",value:function(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),p(h(i.prototype),"modifyPorperties",this).call(this,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}}]),i}(Ot),Bt={webglRender:function(t,e,i,n,s,r,o,a){var h=this._width,l=this._height,u=h*this.originX,c=l*this.originY,d=this.x-n,f=this.y-s,p=1,v=1;this.flipX&&(d+=h-2*u,p=-1),this.flipY&&(f+=l-2*c,v=-1),_t.applyITRS(d,f,this.rotation,this.scaleX*p,this.scaleY*v),e.multiply(_t,_t);var g=-u,y=-c,k=g+h,m=y+l,b=_t.setQuad(g,y,k,m,a),x=this.frame.u0,C=this.frame.v0,w=this.frame.u1,S=this.frame.v1,P=Et(this.tint,this.alpha*i);t.batchQuad(this.parent,b[0],b[1],b[2],b[3],b[4],b[5],b[6],b[7],x,C,w,S,P,P,P,P,this.tintFill,r,o);},canvasRender:function(t,e,i,n){t.save();var s=this._width,r=this._height,o=s*this.originX,a=r*this.originY,h=this.x-o,l=this.y-a,u=1,c=1;this.flipX&&(h+=s,u=-1),this.flipY&&(l+=r,c=-1),n&&(h=Math.round(h),l=Math.round(l)),t.translate(h,l),t.rotate(this.rotation),t.scale(this.scaleX*u,this.scaleY*c);var d=this.frame;t.drawImage(d.source.image,d.cutX,d.cutY,s,r,0,0,s,r),t.restore();}};Object.assign(Lt.prototype,Bt);var Dt=function(t,e){"string"==typeof e&&(e={frame:e});var i=t.poolManager?t.poolManager.allocate(mt):null;return null===i?i=new Lt(t):i.setParent(t).setActive(),i.modifyPorperties(e),t.addChild(i),i},It={_drawImage:function(t,e,i,n,s,r){Dt(this,{frame:e,x:i,y:n,width:s,height:r});},_drawTileSprite:function(t,e,i,n,s,r){var o=this.texture.get(e),a=o.width,h=o.height,l=Math.floor(s/a),u=Math.floor(r/h);i+=(s-l*a)/2,n+=(r-u*h)/2;for(var c=0;c=0||t.y>=0,t.x=Math.abs(t.x),t.y=Math.abs(t.y);},Xt=function(t,e,i){var n=i.length;if(n>=2){var s=i[n-2],r=i[n-1];if(t===s&&e===r)return i}return i.push(t,e),i},Vt=Phaser.Math.DegToRad,Gt=function(t,e,i,n,s,r,o,a,h){o&&r>s?r-=360:!o&&r>>16,a=(65280&s)>>>8,h=255&s;t.fillStyle="rgba("+o+","+a+","+h+","+r+")";},qt=function(t,e,i,n){var s=i||e.strokeColor,r=n||e.strokeAlpha,o=(16711680&s)>>>16,a=(65280&s)>>>8,h=255&s;t.strokeStyle="rgba("+o+","+a+","+h+","+r+")",t.lineWidth=e.lineWidth;},$t=Phaser.Renderer.Canvas.SetTransform,Qt={renderWebGL:function(t,e,i,n){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var s=t.pipelines.set(e.pipeline),r=Jt(e,i,n),o=s.calcMatrix.copyFrom(r.calc),a=e._displayOriginX,h=e._displayOriginY,l=i.alpha*e.alpha;t.pipelines.preBatch(e),e.isFilled&&Ht(s,o,e,l,a,h),e.isStroked&&Kt(s,e,l,a,h),t.pipelines.postBatch(e);},renderCanvas:function(t,e,i,n){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var s=t.currentContext;if($t(t,s,e,i,n)){var r=e._displayOriginX,o=e._displayOriginY,a=e.pathData,h=a.length-1,l=a[0]-r,u=a[1]-o;s.beginPath(),s.moveTo(l,u),e.closePath||(h-=2);for(var c=2;c0;}},{key:"fillAlpha",get:function(){return this._fillAlpha},set:function(t){this._fillAlpha=t,this.isFilled=t>0&&null!=this._fillColor;}},{key:"setFillStyle",value:function(t,e){return void 0===e&&(e=1),this.fillColor=t,this.fillAlpha=e,this}},{key:"strokeColor",get:function(){return this._strokeColor},set:function(t){this._strokeColor=t,this.isStroked=null!=t&&this._strokeAlpha>0&&this._lineWidth>0;}},{key:"strokeAlpha",get:function(){return this._strokeAlpha},set:function(t){this._strokeAlpha=t,this.isStroked=t>0&&null!=this._strokeColor&&this._lineWidth>0;}},{key:"lineWidth",get:function(){return this._lineWidth},set:function(t){this._lineWidth=t,this.isStroked=t>0&&null!=this._strokeColor;}},{key:"setStrokeStyle",value:function(t,e,i){return void 0===i&&(i=1),this.lineWidth=t,this.strokeColor=e,this.strokeAlpha=i,this}},{key:"updateData",value:function(){var t=this.geom,e=this.pathData;e.length=0;var i,n=t.width,s=t.height,r=t.cornerRadius,o=this.iteration+1;if(i=r.tl,re(i))if(i.convex){var a=i.x,h=i.y;Gt(a,h,i.x,i.y,180,270,!1,o,e);}else {Gt(a=0,h=0,i.x,i.y,90,0,!0,o,e);}else Xt(0,0,e);if(i=r.tr,re(i))if(i.convex){a=n-i.x,h=i.y;Gt(a,h,i.x,i.y,270,360,!1,o,e);}else {Gt(a=n,h=0,i.x,i.y,180,90,!0,o,e);}else Xt(n,0,e);if(i=r.br,re(i))if(i.convex){a=n-i.x,h=s-i.y;Gt(a,h,i.x,i.y,0,90,!1,o,e);}else {Gt(a=n,h=s,i.x,i.y,270,180,!0,o,e);}else Xt(n,s,e);if(i=r.bl,re(i))if(i.convex){a=i.x,h=s-i.y;Gt(a,h,i.x,i.y,90,180,!1,o,e);}else {Gt(a=0,h=s,i.x,i.y,360,270,!0,o,e);}else Xt(0,s,e);return e.push(e[0],e[1]),this.pathIndexes=ne(e),this}},{key:"setShapeType",value:function(t){return "string"==typeof t&&(t=oe[t]),this.shapeType=t,this}},{key:"width",get:function(){return this.geom.width},set:function(t){this.resize(t,this.height);}},{key:"height",get:function(){return this.geom.height},set:function(t){this.resize(this.width,t);}},{key:"setSize",value:function(t,e){if(void 0===e&&(e=t),this.geom.width===t&&this.geom.height===e)return this;this.geom.setSize(t,e),1===this.shapeType&&this.setRadius({x:t/2,y:e/2}),this.updateDisplayOrigin(),this.dirty=!0;var i=this.input;return i&&!i.customHitArea&&(i.hitArea.width=t,i.hitArea.height=e),this}},{key:"resize",value:function(t,e){return this.setSize(t,e),this}},{key:"radius",get:function(){return this.geom.radius},set:function(t){this.geom.setRadius(t),this.updateDisplayOrigin(),this.dirty=!0;}},{key:"radiusTL",get:function(){return this.geom.radiusTL},set:function(t){this.geom.radiusTL=t,this.dirty=!0;}},{key:"radiusTR",get:function(){return this.geom.radiusTR},set:function(t){this.geom.radiusTR=t,this.dirty=!0;}},{key:"radiusBL",get:function(){return this.geom.radiusBL},set:function(t){this.geom.radiusBL=t,this.dirty=!0;}},{key:"radiusBR",get:function(){return this.geom.radiusBR},set:function(t){this.geom.radiusBR=t,this.dirty=!0;}},{key:"setRadius",value:function(t){return void 0===t&&(t=0),this.radius=t,this}},{key:"setRadiusTL",value:function(t){return void 0===t&&(t=0),this.radiusTL=t,this}},{key:"setRadiusTR",value:function(t){return void 0===t&&(t=0),this.radiusTR=t,this}},{key:"setRadiusBL",value:function(t){return void 0===t&&(t=0),this.radiusBL=t,this}},{key:"setRadiusBR",value:function(t){return void 0===t&&(t=0),this.radiusBR=t,this}},{key:"cornerRadius",get:function(){return this.geom.cornerRadius},set:function(t){this.radius=t;}},{key:"setCornerRadius",value:function(t){return this.setRadius(t)}},{key:"iteration",get:function(){return this._iteration},set:function(t){void 0!==this._iteration?this._iteration!==t&&(this._iteration=t,this.dirty=!0):this._iteration=t;}},{key:"setIteration",value:function(t){return void 0===t&&(t=6),this.iteration=t,this}}]),i}(te),re=function(t){return t.x>0&&t.y>0},oe={rectangle:0,circle:1};Object.assign(se.prototype,Qt),T.register("roundRectangle",(function(t,e,i,n,s,r,o){var a=new se(this.scene,t,e,i,n,s,r,o);return this.scene.add.existing(a),a})),Z(window,"RexPlugins.UI.RoundRectangle",se);var ae=Phaser.Renderer.WebGL.Utils,he={renderWebGL:function(t,e,i,n){if(e.dirty&&(e.updateTexture(),e.dirty=!1),0!==e.width&&0!==e.height){i.addToRenderList(e);var s=e.frame,r=s.width,o=s.height,a=ae.getTintAppendFloatAlpha,h=t.pipelines.set(e.pipeline,e),l=h.setTexture2D(s.glTexture,e);t.pipelines.preBatch(e),h.batchTexture(e,s.glTexture,r,o,e.x,e.y,r/e.resolution,o/e.resolution,e.scaleX,e.scaleY,e.rotation,e.flipX,e.flipY,e.scrollFactorX,e.scrollFactorY,e.displayOriginX,e.displayOriginY,0,0,r,o,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,n,!1,l),t.pipelines.postBatch(e);}},renderCanvas:function(t,e,i,n){e.dirty&&(e.updateTexture(),e.dirty=!1),0!==e.width&&0!==e.height&&(i.addToRenderList(e),t.batchSprite(e,e.frame,i,n));}},le=Phaser.Display.Color,ue={clear:function(){return this.context.clearRect(0,0,this.canvas.width,this.canvas.height),this.dirty=!0,this},fill:function(t){return this.context.fillStyle=t,this.context.fillRect(0,0,this.canvas.width,this.canvas.height),this.dirty=!0,this},drawFrame:function(t,e,i,n,s,r,o,a,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===n&&(n=0),void 0===s&&(s=c),void 0===r&&(r=d),void 0===o&&(o=0),void 0===a&&(a=0),void 0===h&&(h=c),void 0===l&&(l=d);var f=u.cutX+o,p=u.cutY+a;return this.context.drawImage(u.source.image,f,p,h,l,i,n,s,r),this.dirty=!0,this},getDataURL:function(t,e){return this.canvas.toDataURL(t,e)},getPixel:function(t,e,i){void 0===i&&(i=new le);var n=this.context.getImageData(t,e,1,1);return i.setTo(n.data[0],n.data[1],n.data[2],n.data[3]),i},setPixel:function(t,e,i,n,s,r){if("number"!=typeof i){var o=i;i=o.red,n=o.green,s=o.blue,r=o.alpha;}void 0===r&&(r=0!==i||0!==n||0!==s?255:0);var a=this.context.createImageData(1,1);return a.data[0]=i,a.data[1]=n,a.data[2]=s,a.data[3]=r,this.context.putImageData(a,t,e),this.dirty=!0,this}},ce=function(t,e,i,n,s,r,o){var a,h=t.sys.textures,l=t.renderer;void 0===n&&(n=0),void 0===s&&(s=0),void 0===r&&(r=e.width),void 0===o&&(o=e.height);var u=(a=h.exists(i)?h.get(i):h.createCanvas(i,r,o)).getSourceImage();u.width!==r&&(u.width=r),u.height!==o&&(u.height=o);var c=u.getContext("2d",{willReadFrequently:!0});c.clearRect(0,0,r,o),c.drawImage(e,n,s,r,o),l.gl&&a&&l.canvasToTexture(u,a.source[0].glTexture,!0,0);},de={updateTexture:function(t,e){t&&(e?t.call(e,this.canvas,this.context):t(this.canvas,this.context)),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=this.frame.source.glTexture),this.dirty=!1;var i=this.input;return i&&!i.customHitArea&&(i.hitArea.width=this.width,i.hitArea.height=this.height),this},generateTexture:function(t,e,i,n,s){var r=this.canvas;return void 0===n?n=r.width:n*=this.resolution,void 0===s?s=r.height:s*=this.resolution,ce(this.scene,r,t,e,i,n,s),this},loadTexture:function(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}};lt();var fe=Phaser.Display.Canvas.CanvasPool,pe=function(t){a(i,t);var e=d(i);function i(t,s,r,o,a){var h;return n(this,i),void 0===s&&(s=0),void 0===r&&(r=0),void 0===o&&(o=1),void 0===a&&(a=1),(h=e.call(this,t,"rexCanvas")).renderer=t.sys.game.renderer,h.resolution=1,h._width=o,h._height=a,o=Math.max(Math.ceil(o*h.resolution),1),a=Math.max(Math.ceil(a*h.resolution),1),h.canvas=fe.create(u(h),o,a),h.context=h.canvas.getContext("2d",{willReadFrequently:!0}),h.dirty=!1,h.setPosition(s,r),h.setOrigin(.5,.5),h.initPipeline(),h.initPostPipeline(!0),h._crop=h.resetCropObject(),h.texture=t.sys.textures.addCanvas(null,h.canvas,!0),h.frame=h.texture.get(),h.frame.source.resolution=h.resolution,h.renderer&&h.renderer.gl&&(h.renderer.deleteTexture(h.frame.source.glTexture),h.frame.source.glTexture=null),h.dirty=!0,h}return r(i,[{key:"preDestroy",value:function(){fe.remove(this.canvas),this.texture.destroy(),this.canvas=null,this.context=null;}},{key:"width",get:function(){return this._width},set:function(t){this.setSize(t,this._height);}},{key:"height",get:function(){return this._height},set:function(t){this.setSize(this._width,t);}},{key:"setCanvasSize",value:function(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}},{key:"setSize",value:function(t,e){return this.setCanvasSize(t,e),this}},{key:"displayWidth",get:function(){return this.scaleX*this._width},set:function(t){this.scaleX=t/this._width;}},{key:"displayHeight",get:function(){return this.scaleY*this._height},set:function(t){this.scaleY=t/this._height;}},{key:"setDisplaySize",value:function(t,e){return this.displayWidth=t,this.displayHeight=e,this}},{key:"getCanvas",value:function(t){return t||(this.dirty=!0),this.canvas}},{key:"getContext",value:function(t){return t||(this.dirty=!0),this.context}},{key:"needRedraw",value:function(){return this.dirty=!0,this}},{key:"resize",value:function(t,e){return this.setSize(t,e),this}}]),i}(Phaser.GameObjects.GameObject),ve=Phaser.GameObjects.Components;Phaser.Class.mixin(pe,[ve.Alpha,ve.BlendMode,ve.Crop,ve.Depth,ve.Flip,ve.GetBounds,ve.Mask,ve.Origin,ve.Pipeline,ve.PostPipeline,ve.ScrollFactor,ve.Tint,ve.Transform,ve.Visible,he,ue,de]);var ge=Phaser.Utils.String.Pad,ye=function(t,e,n){if(null==t)return t;switch(i(t)){case"string":default:return t;case"number":return "#".concat(ge(Math.floor(t).toString(16),6,"0",1));case"function":return t(e,n);case"object":return t.hasOwnProperty("r")?t.hasOwnProperty("a")?"rgba(".concat(t.r,",").concat(t.g,",").concat(t.b,",").concat(t.a,")"):"rgb(".concat(t.r,",").concat(t.g,",").concat(t.b,")"):t.hasOwnProperty("h")?t.hasOwnProperty("a")?"hsla(".concat(t.h,",").concat(t.s,",").concat(t.l,",").concat(t.a,")"):"hsl(".concat(t.h,",").concat(t.s,",").concat(t.l,")"):t}},ke=Phaser.Math.DegToRad,me=function(t,e,i,n,s,r,o){var a,h,l,u,c,d=new At(e,i,n,s,r),f=d.minWidth,p=d.minHeight,v=n>=f?1:n/f,g=s>=p?1:s/p,y=d.cornerRadius;t.save(),t.beginPath(),t.translate(e,i),a=y.tl,xe(a)?(h=a.x*v,l=a.y*g,be(a)?Ce(t,h,l,h,l,180,270,!1,o):Ce(t,0,0,h,l,90,0,!0,o),u=0,c=l):(t.lineTo(0,0),u=0,c=0),a=y.tr,xe(a)?(h=a.x*v,l=a.y*g,be(a)?Ce(t,n-h,l,h,l,270,360,!1,o):Ce(t,n,0,h,l,180,90,!0,o)):t.lineTo(n,0),a=y.br,xe(a)?(h=a.x*v,l=a.y*g,be(a)?Ce(t,n-h,s-l,h,l,0,90,!1,o):Ce(t,n,s,h,l,270,180,!0,o)):t.lineTo(n,s),a=y.bl,xe(a)?(h=a.x*v,l=a.y*g,be(a)?Ce(t,h,s-l,h,l,90,180,!1,o):Ce(t,0,s,h,l,360,270,!0,o)):t.lineTo(0,s),t.lineTo(u,c),t.closePath(),t.restore();},be=function(t){return !t.hasOwnProperty("convex")||t.convex},xe=function(t){return t.x>0&&t.y>0},Ce=function(t,e,i,n,s,r,o,a,h){if(a&&o>r?o-=360:!a&&o0&&(e.strokeStyle=h,e.lineWidth=l,e.stroke());}(t.canvas,t.context,u,u,h,l,s,e,i,n,r,o,a);}},Se=function(){we(this,this.fillStyle,this.strokeStyle,this.lineWidth,this.radius,this.fillColor2,this.isHorizontalGradient,this.iteration);},Pe=Phaser.Utils.Objects.GetValue,Te=function(t){a(i,t);var e=d(i);function i(t,s,r,o,a,h,l,u,c,d,f){var p;n(this,i),void 0===s&&(s=0),void 0===r&&(r=0),void 0===o&&(o=1),void 0===a&&(a=o),void 0===h&&(h=0),(p=e.call(this,t,s,r,o,a)).type="rexRoundRectangleCanvas";var v=Pe(h,"radius",h),g=Pe(h,"iteration",void 0);return p.setRadius(v),p.setIteration(g),p.setFillStyle(l,d,f),p.setStrokeStyle(u,c),p}return r(i,[{key:"radius",get:function(){return this._radius},set:function(t){this.dirty|=this._radius!=t,this._radius=t;}},{key:"setRadius",value:function(t){return this.radius=t,this}},{key:"iteration",get:function(){return this._iteration},set:function(t){this.dirty|=this._iteration!=t,this._iteration=t;}},{key:"setIteration",value:function(t){return this.iteration=t,this}},{key:"fillStyle",get:function(){return this._fillStyle},set:function(t){t=ye(t,this.canvas,this.context),this.dirty|=this._fillStyle!=t,this._fillStyle=t;}},{key:"fillColor2",get:function(){return this._fillColor2},set:function(t){t=ye(t,this.canvas,this.context),this.dirty|=this._fillColor2!=t,this._fillColor2=t;}},{key:"isHorizontalGradient",get:function(){return this._isHorizontalGradient},set:function(t){this.dirty|=this._isHorizontalGradient!=t,this._isHorizontalGradient=t;}},{key:"setFillStyle",value:function(t,e,i){return void 0===i&&(i=!0),this.fillStyle=t,this.fillColor2=e,this.isHorizontalGradient=i,this}},{key:"strokeStyle",get:function(){return this._strokeStyle},set:function(t){t=ye(t,this.canvas,this.context),this.dirty|=this._strokeStyle!=t,this._strokeStyle=t;}},{key:"lineWidth",get:function(){return this._lineWidth},set:function(t){this.dirty|=this._lineWidth!=t,this._lineWidth=t;}},{key:"setStrokeStyle",value:function(t,e){return this.strokeStyle=t,this.lineWidth=e,this}},{key:"updateTexture",value:function(){return this.clear(),Se.call(this),p(h(i.prototype),"updateTexture",this).call(this),this}}]),i}(pe);T.register("roundRectangleCanvas",(function(t,e,i,n,s,r,o,a,h,l){var u=new Te(this.scene,t,e,i,n,s,r,o,a,h,l);return this.scene.add.existing(u),u})),Z(window,"RexPlugins.UI.RoundRectangleCanvas",Te); /** * @author Richard Davey * @copyright 2019 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var Oe=Phaser.Renderer.WebGL.Utils,Me={renderWebGL:function(t,e,i,n){if(0!==e.width&&0!==e.height){i.addToRenderList(e);var s=e.frame,r=s.width,o=s.height,a=Oe.getTintAppendFloatAlpha,h=t.pipelines.set(e.pipeline,e),l=h.setTexture2D(s.glTexture,e);t.pipelines.preBatch(e),h.batchTexture(e,s.glTexture,r,o,e.x,e.y,r/e.style.resolution,o/e.style.resolution,e.scaleX,e.scaleY,e.rotation,e.flipX,e.flipY,e.scrollFactorX,e.scrollFactorY,e.displayOriginX,e.displayOriginY,0,0,r,o,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,n,!1,l),t.pipelines.postBatch(e);}},renderCanvas:function(t,e,i,n){0!==e.width&&0!==e.height&&(i.addToRenderList(e),t.batchSprite(e,e.frame,i,n));}},Ee=Phaser.Display.Canvas.CanvasPool;lt();var _e=function(t){a(i,t);var e=d(i);function i(){return n(this,i),e.apply(this,arguments)}return r(i,[{key:"setStyle",value:function(t){return this.style.setStyle(t)}},{key:"setFont",value:function(t){return this.style.setFont(t)}},{key:"setFontFamily",value:function(t){return this.style.setFontFamily(t)}},{key:"setFontSize",value:function(t){return this.style.setFontSize(t)}},{key:"setFontStyle",value:function(t){return this.style.setFontStyle(t)}},{key:"setTestString",value:function(t){return this.style.setTestString(t)}},{key:"setFixedSize",value:function(t,e){return this.style.setFixedSize(t,e)}},{key:"setBackgroundColor",value:function(t,e,i){return this.style.setBackgroundColor(t,e,i)}},{key:"setBackgroundStrokeColor",value:function(t,e){return this.style.setBackgroundStrokeColor(t,e)}},{key:"setBackgroundCornerRadius",value:function(t,e){return this.style.setBackgroundCornerRadius(t,e)}},{key:"setFill",value:function(t){return this.style.setFill(t)}},{key:"setColor",value:function(t){return this.style.setColor(t)}},{key:"setStroke",value:function(t,e){return this.style.setStroke(t,e)}},{key:"setShadow",value:function(t,e,i,n,s,r){return this.style.setShadow(t,e,i,n,s,r)}},{key:"setShadowOffset",value:function(t,e){return this.style.setShadowOffset(t,e)}},{key:"setShadowColor",value:function(t){return this.style.setShadowColor(t)}},{key:"setShadowBlur",value:function(t){return this.style.setShadowBlur(t)}},{key:"setShadowStroke",value:function(t){return this.style.setShadowStroke(t)}},{key:"setShadowFill",value:function(t){return this.style.setShadowFill(t)}},{key:"setWrapMode",value:function(t){return this.style.setWrapMode(t)}},{key:"setWrapWidth",value:function(t){return this.style.setWrapWidth(t)}},{key:"setWordWrapWidth",value:function(t){return this.style.setWrapWidth(t)}},{key:"setAlign",value:function(t){return this.style.setHAlign(t)}},{key:"setHAlign",value:function(t){return this.style.setHAlign(t)}},{key:"setVAlign",value:function(t){return this.style.setVAlign(t)}},{key:"setLineSpacing",value:function(t){return this.style.setLineSpacing(t)}},{key:"lineSpacing",get:function(){return this.style.lineSpacing},set:function(t){this.setLineSpacing(t);}},{key:"setXOffset",value:function(t){return this.style.setXOffset(t)}},{key:"setMaxLines",value:function(t){return this.style.setMaxLines(t)}},{key:"setResolution",value:function(t){return this.style.setResolution(t)}},{key:"getTextMetrics",value:function(){return this.style.getTextMetrics()}},{key:"setTextMetrics",value:function(t,e){return this.style.setTextMetrics(t,e)}},{key:"measureTextMargins",value:function(t,e){return function(t,e,i){void 0===i&&(i={});var n=Ee.create(this),s=n.getContext("2d",{willReadFrequently:!0});t.syncFont(n,s);var r=s.measureText(e),o=Math.ceil(r.width*t.baselineX),a=o,h=2*a;if(a=a*t.baselineY|0,n.width=o,n.height=h,s.fillStyle="#f00",s.fillRect(0,0,o,h),s.font=t._font,s.textBaseline="alphabetic",s.fillStyle="#000",s.fillText(t.testString,0,a),i.left=0,0===o||0===h||!s.getImageData(0,0,o,h))return Ee.remove(n),i;for(var l=s.getImageData(0,0,o,h).data,u=!1,c=0;ch;u--){for(c=0;c0&&this.wrapMode!==Ae&&0===this.wrapWidth}},{key:"setStyle",value:function(t,e,i){if(void 0===e&&(e=!0),void 0===i&&(i=!1),t&&t.hasOwnProperty("wrap")){var n=t.wrap;if(n.hasOwnProperty("mode")){var s=n.mode;"string"==typeof s&&(n.mode=Ue[s]);}else n.hasOwnProperty("width")&&(n.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 r=this.propertyMap;for(var o in r){var a=r[o],h=a[0],l=i?a[1]:this[o],u=a[2];if("wrapCallback"===o||"wrapCallbackScope"===o)this[o]=Xe(t,h,l);else {var c=Ve(t,h,l);u&&(c=u(c)),this[o]=c;}}var d=Xe(t,"font",null);this._font=null===d?this.fontStyle+" "+this.fontSize+" "+this.fontFamily:d;var f=Xe(t,"fill",null);null!==f&&(this.color=ye(f));var p=Xe(t,"metrics",!1);return p?this.metrics={ascent:Xe(p,"ascent",0),descent:Xe(p,"descent",0),fontSize:Xe(p,"fontSize",0)}:!e&&this.metrics||(this.metrics=De(this)),e?this.parent.updateText():this.parent}},{key:"syncFont",value:function(t,e){e.font=this._font;}},{key:"syncStyle",value:function(t,e){e.textBaseline="alphabetic",e.fillStyle=this.color,e.strokeStyle=this.stroke,e.lineWidth=this.strokeThickness,e.lineCap="round",e.lineJoin="round";}},{key:"syncShadow",value:function(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);}},{key:"update",value:function(t){return t&&(this._font="".concat(this.fontStyle," ").concat(this.fontSize," ").concat(this.fontFamily).trim(),this.metrics=De(this)),this.parent.updateText(t)}},{key:"buildFont",value:function(){var t="".concat(this.fontStyle," ").concat(this.fontSize," ").concat(this.fontFamily).trim();return t!==this._font&&(this._font=t),this}},{key:"setFont",value:function(t){return "string"==typeof t?(this.fontFamily=t,this.fontSize="",this.fontStyle=""):(this.fontFamily=Xe(t,"fontFamily","Courier"),this.fontSize=Xe(t,"fontSize","16px"),this.fontStyle=Xe(t,"fontStyle","")),this.update(!0)}},{key:"setFontFamily",value:function(t){return this.fontFamily=t,this.update(!0)}},{key:"setFontStyle",value:function(t){return this.fontStyle=t,this.update(!0)}},{key:"setFontSize",value:function(t){return "number"==typeof t&&(t=t.toString()+"px"),this.fontSize=t,this.update(!0)}},{key:"setTestString",value:function(t){return this.testString=t,this.update(!0)}},{key:"setFixedSize",value:function(t,e){return this.fixedWidth=t,this.fixedHeight=e,t&&(this.parent.width=t),e&&(this.parent.height=e),this.update(this.isWrapFitMode)}},{key:"setResolution",value:function(t){return this.resolution=t,this.update(!1)}},{key:"setLineSpacing",value:function(t){return this.lineSpacing=t,this.update(!1)}},{key:"setXOffset",value:function(t){return this.xOffset=t,this.update(!1)}},{key:"setBackgroundColor",value:function(t,e,i){return void 0===i&&(i=!0),this.backgroundColor=ye(t,this.parent.canvas,this.parent.context),this.backgroundColor2=ye(e,this.parent.canvas,this.parent.context),this.backgroundHorizontalGradient=i,this.update(!1)}},{key:"setBackgroundStrokeColor",value:function(t,e){return this.backgroundStrokeColor=ye(t,this.parent.canvas,this.parent.context),this.backgroundStrokeLineWidth=e,this.update(!1)}},{key:"setBackgroundCornerRadius",value:function(t,e){return this.backgroundCornerRadius=t,this.backgroundCornerIteration=e,this.update(!1)}},{key:"setFill",value:function(t){return this.color=ye(t,this.parent.canvas,this.parent.context),this.update(!1)}},{key:"setColor",value:function(t){return this.color=ye(t,this.parent.canvas,this.parent.context),this.update(!1)}},{key:"setStroke",value:function(t,e){return void 0===t?this.strokeThickness=0:(void 0===e&&(e=this.strokeThickness),this.stroke=ye(t,this.parent.canvas,this.parent.context),this.strokeThickness=e),this.update(!0)}},{key:"setShadow",value:function(t,e,i,n,s,r){return void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i="#000"),void 0===n&&(n=0),void 0===s&&(s=!1),void 0===r&&(r=!0),this.shadowOffsetX=t,this.shadowOffsetY=e,this.shadowColor=ye(i,this.parent.canvas,this.parent.context),this.shadowBlur=n,this.shadowStroke=s,this.shadowFill=r,this.update(!1)}},{key:"setShadowOffset",value:function(t,e){return void 0===t&&(t=0),void 0===e&&(e=t),this.shadowOffsetX=t,this.shadowOffsetY=e,this.update(!1)}},{key:"setShadowColor",value:function(t){return void 0===t&&(t="#000"),this.shadowColor=ye(t,this.parent.canvas,this.parent.context),this.update(!1)}},{key:"setShadowBlur",value:function(t){return void 0===t&&(t=0),this.shadowBlur=t,this.update(!1)}},{key:"setShadowStroke",value:function(t){return this.shadowStroke=t,this.update(!1)}},{key:"setShadowFill",value:function(t){return this.shadowFill=t,this.update(!1)}},{key:"setUnderline",value:function(t,e,i){return void 0===t&&(t="#000"),void 0===e&&(e=0),void 0===i&&(i=0),this.underlineColor=ye(t,this.parent.canvas,this.parent.context),this.underlineThickness=e,this.underlineOffset=i,this.update(!1)}},{key:"setUnderlineColor",value:function(t){return void 0===t&&(t="#000"),this.underlineColor=ye(t,this.parent.canvas,this.parent.context),this.update(!1)}},{key:"setUnderlineThickness",value:function(t){return void 0===t&&(t=0),this.underlineThickness=t,this.update(!1)}},{key:"setUnderlineOffset",value:function(t){return void 0===t&&(t=0),this.underlineOffset=t,this.update(!1)}},{key:"setStrikethrough",value:function(t,e,i){return void 0===t&&(t="#000"),void 0===e&&(e=0),void 0===i&&(i=0),this.strikethroughColor=ye(t,this.parent.canvas,this.parent.context),this.strikethroughThickness=e,this.strikethroughOffset=i,this.update(!1)}},{key:"setStrikethroughColor",value:function(t){return void 0===t&&(t="#000"),this.strikethroughColor=ye(t,this.parent.canvas,this.parent.context),this.update(!1)}},{key:"setStrikethroughThickness",value:function(t){return void 0===t&&(t=0),this.strikethroughThickness=t,this.update(!1)}},{key:"setStrikethroughOffset",value:function(t){return void 0===t&&(t=0),this.strikethroughOffset=t,this.update(!1)}},{key:"setWrapMode",value:function(t){return "string"==typeof t&&(t=Ue[t.toLowerCase()]||0),this.wrapMode=t,this.update(!0)}},{key:"setWrapWidth",value:function(t){return this.wrapWidth=t,this.update(!1)}},{key:"setAlign",value:function(t,e){return void 0===t&&(t="left"),void 0===e&&(e="top"),this.halign=t,this.valign=e,this.update(!1)}},{key:"setHAlign",value:function(t){return void 0===t&&(t="left"),this.halign=t,this.update(!1)}},{key:"setVAlign",value:function(t){return void 0===t&&(t="top"),this.valign=t,this.update(!1)}},{key:"setMaxLines",value:function(t){return void 0===t&&(t=0),this.maxLines=t,this.update(!1)}},{key:"getTextMetrics",value:function(){var t=this.metrics;return {ascent:t.ascent,descent:t.descent,fontSize:t.fontSize}}},{key:"setTextMetrics",value:function(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=Xe(e,"fontFamily",this.fontFamily),this.fontSize=Xe(e,"fontSize",this.fontSize),this.fontStyle=Xe(e,"fontStyle",this.fontStyle))),this.parent.updateText(!0)}},{key:"lineHeight",get:function(){return this.metrics.fontSize+this.strokeThickness+this.lineSpacing}},{key:"toJSON",value:function(){var t={},e=this.propertyMap;for(var i in e)t[i]=this[i];return t.metrics=this.getTextMetrics(),t}},{key:"destroy",value:function(){this.parent=void 0;}}]),t}(),Ue={none:Ae,word:Fe,char:We,character:We},He={draw:function(t,e,i,n){var s=this.penManager;this.hitAreaManager.clear();var r=this.context;r.save();var o=this.defaultStyle;this.clear(),we(this,o.backgroundColor,o.backgroundStrokeColor,o.backgroundStrokeLineWidth,o.backgroundCornerRadius,o.backgroundColor2,o.backgroundHorizontalGradient,o.backgroundCornerIteration),t+=this.startXOffset,e+=this.startYOffset;var a,h,l,u,c,d,f=o.halign,p=o.valign,v=o.lineHeight,g=s.lines,y=g.length,k=o.maxLines;k>0&&y>k?(h=k,l="center"===p?Math.floor((y-h)/2):"bottom"===p?y-h:0):(h=y,l=0),u=l+h;var m=this.rtl,b=m?this.parent.width:void 0;d="center"===p?Math.max((n-h*v)/2,0):"bottom"===p?Math.max(n-h*v-2,0):0,d+=e;for(var x=l;x0&&t.width>0){var a=i+o.underlineOffset-o.underlineThickness/2;this.drawLine(e,a,t.width,o.underlineThickness,o.underlineColor);}if(t.isTextPen&&this.drawText(e,i,t.text,o),t.isImagePen&&this.drawImage(e,i,t.prop.img,o),o.strikethroughThickness>0&&t.width>0){a=i+o.strikethroughOffset-o.strikethroughThickness/2;this.drawLine(e,a,t.width,o.strikethroughThickness,o.strikethroughColor);}if(r.restore(),t.hasAreaMarker&&t.width>0){var h,l=t.prop.area;if(l)h={key:l};else {var u=t.prop.url;h={key:"url:".concat(u),url:u};}this.hitAreaManager.add(e,i-this.startYOffset,t.width,this.defaultStyle.lineHeight,h);}},clear:function(){var t=this.canvas;this.context.clearRect(0,0,t.width,t.height);},drawLine:function(t,e,i,n,s){this.autoRound&&(t=Math.round(t),e=Math.round(e));var r=this.context,o=r.lineCap;r.lineCap="butt",r.strokeStyle=s,r.lineWidth=n,r.beginPath(),r.moveTo(t,e),r.lineTo(t+i,e),r.stroke(),r.lineCap=o;},drawText:function(t,e,i,n){this.autoRound&&(t=Math.round(t),e=Math.round(e));var s=this.context;n.stroke&&"none"!==n.stroke&&n.strokeThickness>0&&(n.syncShadow(s,n.shadowStroke),s.strokeText(i,t,e)),n.color&&"none"!==n.color&&(n.syncShadow(s,n.shadowFill),s.fillText(i,t,e));},drawImage:function(t,e,i,n){e-=this.startYOffset,this.parent.imageManager.draw(i,this.context,t,e,this.autoRound);}},Ne=Phaser.Utils.Objects.GetValue,Ke=Ie,Je=je,Ze=function(){function t(e){n(this,t),this.prop={},this.resetFromJSON(e);}return r(t,[{key:"resetFromJSON",value:function(t){this.text=Ne(t,"text",""),this.x=Ne(t,"x",0),this.y=Ne(t,"y",0),this.width=Ne(t,"width",0);var e=Ne(t,"prop",null);null===e&&(e={}),this.prop=e,this.newLineMode=Ne(t,"newLineMode",0),this.startIndex=Ne(t,"startIndex",0);}},{key:"plainText",get:function(){var t=this.text;return this.newLineMode===Je&&(t+="\n"),t}},{key:"wrapText",get:function(){var t=this.text;return this.newLineMode!==Ke&&(t+="\n"),t}},{key:"rawTextLength",get:function(){var t=this.text.length;return this.newLineMode===Je&&(t+=1),t}},{key:"endIndex",get:function(){return this.startIndex+this.rawTextLength}},{key:"lastX",get:function(){return this.x+this.width}},{key:"isTextPen",get:function(){return ""!==this.text}},{key:"isImagePen",get:function(){return !!this.prop.img}},{key:"hasAreaMarker",get:function(){return !!this.prop.area||!!this.prop.url}}]),t}(),qe=function(t,e){var i=Array.isArray(t);if(void 0===e?e=i?[]:{}:xt(e),i){e.length=t.length;for(var n=0,s=t.length;n=this.lines.length)return this.getLineEndIndex(t);var e=this.lines[t];return e&&e[0]?e[0].startIndex:0}},{key:"getLineEndIndex",value:function(t){t>=this.lines.length&&(t=this.lines.length-1);var e,i,n=!1;for(e=t;e>=0&&!(n=null!=(i=this.lines[e])&&i.length>0);e--);return n?i[i.length-1].endIndex:0}},{key:"getLineWidth",value:function(t){var e=this.lines[t];if(!e)return 0;var i=e[e.length-1];return null==i?0:i.lastX}},{key:"getMaxLineWidth",value:function(){if(void 0!==this.maxLinesWidth)return this.maxLinesWidth;for(var t,e=0,i=0,n=this.lines.length;ie&&(e=t);return this.maxLinesWidth=e,e}},{key:"getLineWidths",value:function(){for(var t=[],e=0,i=this.lines.length;e=t&&h<=e||(o=o.substring(t-a,e-a)),this.tagToTextScope?c+=this.tagToText.call(this.tagToTextScope,o,l,u):c+=this.tagToText(o,l,u),u=l,!(h>=e)));d++);return c}},{key:"length",get:function(){return this.lines.length},set:function(t){this.clear();}}]),t}(),ii={},ni=Phaser.Geom.Rectangle,si=new st,ri=function(){function t(){n(this,t),this.hitAreas=[];}return r(t,[{key:"destroy",value:function(){this.clear();}},{key:"clear",value:function(){for(var t=0,e=this.hitAreas.length;ts){""!==S?a.push(o.getLine(S,P,di)):0===O&&r>0&&a.push(o.getLine("",0,di)),a.push.apply(a,m(t(b,i,vi,s,0,o)));var E=a.pop();S=E.text,P=E.width,o.freeLine(E)," "===S&&(S="",P=0);}else (w=P+x)>l?(a.push(o.getLine(S,P,di)),S=b,P=x,l=s):(S+=b,P=w),C&&a.push(o.getLine(S,P,u));}return a},ki=Phaser.Utils.Objects.GetValue,mi=Ae,bi=Ie,xi=function(){function t(e){n(this,t),this.parent=e.parent,this.scene=this.parent.scene,this.context=ki(e,"context",null),this.canvas=this.context.canvas,this.parser=ki(e,"parser",null),this.defaultStyle=ki(e,"style",null),this.autoRound=!0,this.pensPool=e.pensPool,this.linesPool=e.linesPool,this.wrapTextLinesPool=e.wrapTextLinesPool,this.penManager=this.newPenManager(),this._tmpPenManager=null,this.hitAreaManager=new ri,this.lastHitAreaKey=null,this.urlTagCursorStyle=null;var i=this.context;this.getTextWidth=function(t){return i.measureText(t).width};}return r(t,[{key:"destroy",value:function(){this.parent=void 0,this.scene=void 0,this.context=void 0,this.canvas=void 0,this.parser=void 0,this.defaultStyle=void 0,this.penManager&&(this.penManager.destroy(),this.penManager=void 0),this._tmpPenManager&&(this._tmpPenManager.destroy(),this._tmpPenManager=void 0),this.hitAreaManager&&(this.hitAreaManager.destroy(),this.hitAreaManager=void 0),this.pensPool=void 0,this.linesPool=void 0,this.wrapTextLinesPool=void 0;}},{key:"updatePenManager",value:function(t,e,i,n,s){if(void 0===s&&(s=this.penManager),s.clear(),""===t)return s;var r=this.parent.style;if(r.isWrapFitMode){var o=this.parent.padding;i=r.fixedWidth-o.left-o.right;}for(var a,h,l,u,c,d=this.canvas,f=this.context,p=function(t){return f.measureText(t).width},v=0,g=0,y=r.wrapCallback,k=r.wrapCallbackScope,m=!0,b=this.parser.splitText(t),x=this.wrapTextLinesPool,C=0,w=b.length;C0&&e!==mi&&i0&&t>e&&(t=e),t}},{key:"linesWidth",get:function(){return Math.ceil(this.penManager.getMaxLineWidth())}},{key:"linesHeight",get:function(){var t=this.desplayLinesCount,e=this.defaultStyle.lineHeight*t;return t>0&&(e-=this.defaultStyle.lineSpacing),e}},{key:"imageManager",get:function(){return this.parent.imageManager}},{key:"rtl",get:function(){return this.parent.style.rtl}},{key:"newPenManager",value:function(){return new ei({pensPool:this.pensPool,linesPool:this.linesPool,tagToText:this.parser.propToTagText,tagToTextScope:this.parser})}},{key:"tmpPenManager",get:function(){return null===this._tmpPenManager&&(this._tmpPenManager=this.newPenManager()),this._tmpPenManager}},{key:"getPlainText",value:function(t,e,i){var n;if(null==t)n=this.penManager.plainText;else {var s=this.parser.splitText(t,1);n="";for(var r=0,o=s.length;rh;u--){for(c=0;c0&&this.wrapMode!==Ae&&0===this.wrapWidth}},{key:"setStyle",value:function(t,e,i){if(void 0===e&&(e=!0),void 0===i&&(i=!1),t&&t.hasOwnProperty("wrap")){var n=t.wrap;if(n.hasOwnProperty("mode")){var s=n.mode;"string"==typeof s&&(n.mode=Ue[s]);}else n.hasOwnProperty("width")&&(n.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 r=this.propertyMap;for(var o in r){var a=r[o],h=a[0],l=i?a[1]:this[o],u=a[2];if("wrapCallback"===o||"wrapCallbackScope"===o)this[o]=Ve(t,h,l);else {var c=Xe(t,h,l);u&&(c=u(c)),this[o]=c;}}var d=Ve(t,"font",null);this._font=null===d?this.fontStyle+" "+this.fontSize+" "+this.fontFamily:d;var f=Ve(t,"fill",null);null!==f&&(this.color=ye(f));var p=Ve(t,"metrics",!1);return p?this.metrics={ascent:Ve(p,"ascent",0),descent:Ve(p,"descent",0),fontSize:Ve(p,"fontSize",0)}:!e&&this.metrics||(this.metrics=De(this)),e?this.parent.updateText():this.parent}},{key:"syncFont",value:function(t,e){e.font=this._font;}},{key:"syncStyle",value:function(t,e){e.textBaseline="alphabetic",e.fillStyle=this.color,e.strokeStyle=this.stroke,e.lineWidth=this.strokeThickness,e.lineCap="round",e.lineJoin="round";}},{key:"syncShadow",value:function(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);}},{key:"update",value:function(t){return t&&(this._font="".concat(this.fontStyle," ").concat(this.fontSize," ").concat(this.fontFamily).trim(),this.metrics=De(this)),this.parent.updateText(t)}},{key:"buildFont",value:function(){var t="".concat(this.fontStyle," ").concat(this.fontSize," ").concat(this.fontFamily).trim();return t!==this._font&&(this._font=t),this}},{key:"setFont",value:function(t){return "string"==typeof t?(this.fontFamily=t,this.fontSize="",this.fontStyle=""):(this.fontFamily=Ve(t,"fontFamily","Courier"),this.fontSize=Ve(t,"fontSize","16px"),this.fontStyle=Ve(t,"fontStyle","")),this.update(!0)}},{key:"setFontFamily",value:function(t){return this.fontFamily=t,this.update(!0)}},{key:"setFontStyle",value:function(t){return this.fontStyle=t,this.update(!0)}},{key:"setFontSize",value:function(t){return "number"==typeof t&&(t=t.toString()+"px"),this.fontSize=t,this.update(!0)}},{key:"setTestString",value:function(t){return this.testString=t,this.update(!0)}},{key:"setFixedSize",value:function(t,e){return this.fixedWidth=t,this.fixedHeight=e,t&&(this.parent.width=t),e&&(this.parent.height=e),this.update(this.isWrapFitMode)}},{key:"setResolution",value:function(t){return this.resolution=t,this.update(!1)}},{key:"setLineSpacing",value:function(t){return this.lineSpacing=t,this.update(!1)}},{key:"setXOffset",value:function(t){return this.xOffset=t,this.update(!1)}},{key:"setBackgroundColor",value:function(t,e,i){return void 0===i&&(i=!0),this.backgroundColor=ye(t,this.parent.canvas,this.parent.context),this.backgroundColor2=ye(e,this.parent.canvas,this.parent.context),this.backgroundHorizontalGradient=i,this.update(!1)}},{key:"setBackgroundStrokeColor",value:function(t,e){return this.backgroundStrokeColor=ye(t,this.parent.canvas,this.parent.context),this.backgroundStrokeLineWidth=e,this.update(!1)}},{key:"setBackgroundCornerRadius",value:function(t,e){return this.backgroundCornerRadius=t,this.backgroundCornerIteration=e,this.update(!1)}},{key:"setFill",value:function(t){return this.color=ye(t,this.parent.canvas,this.parent.context),this.update(!1)}},{key:"setColor",value:function(t){return this.color=ye(t,this.parent.canvas,this.parent.context),this.update(!1)}},{key:"setStroke",value:function(t,e){return void 0===t?this.strokeThickness=0:(void 0===e&&(e=this.strokeThickness),this.stroke=ye(t,this.parent.canvas,this.parent.context),this.strokeThickness=e),this.update(!0)}},{key:"setShadow",value:function(t,e,i,n,s,r){return void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i="#000"),void 0===n&&(n=0),void 0===s&&(s=!1),void 0===r&&(r=!0),this.shadowOffsetX=t,this.shadowOffsetY=e,this.shadowColor=ye(i,this.parent.canvas,this.parent.context),this.shadowBlur=n,this.shadowStroke=s,this.shadowFill=r,this.update(!1)}},{key:"setShadowOffset",value:function(t,e){return void 0===t&&(t=0),void 0===e&&(e=t),this.shadowOffsetX=t,this.shadowOffsetY=e,this.update(!1)}},{key:"setShadowColor",value:function(t){return void 0===t&&(t="#000"),this.shadowColor=ye(t,this.parent.canvas,this.parent.context),this.update(!1)}},{key:"setShadowBlur",value:function(t){return void 0===t&&(t=0),this.shadowBlur=t,this.update(!1)}},{key:"setShadowStroke",value:function(t){return this.shadowStroke=t,this.update(!1)}},{key:"setShadowFill",value:function(t){return this.shadowFill=t,this.update(!1)}},{key:"setUnderline",value:function(t,e,i){return void 0===t&&(t="#000"),void 0===e&&(e=0),void 0===i&&(i=0),this.underlineColor=ye(t,this.parent.canvas,this.parent.context),this.underlineThickness=e,this.underlineOffset=i,this.update(!1)}},{key:"setUnderlineColor",value:function(t){return void 0===t&&(t="#000"),this.underlineColor=ye(t,this.parent.canvas,this.parent.context),this.update(!1)}},{key:"setUnderlineThickness",value:function(t){return void 0===t&&(t=0),this.underlineThickness=t,this.update(!1)}},{key:"setUnderlineOffset",value:function(t){return void 0===t&&(t=0),this.underlineOffset=t,this.update(!1)}},{key:"setStrikethrough",value:function(t,e,i){return void 0===t&&(t="#000"),void 0===e&&(e=0),void 0===i&&(i=0),this.strikethroughColor=ye(t,this.parent.canvas,this.parent.context),this.strikethroughThickness=e,this.strikethroughOffset=i,this.update(!1)}},{key:"setStrikethroughColor",value:function(t){return void 0===t&&(t="#000"),this.strikethroughColor=ye(t,this.parent.canvas,this.parent.context),this.update(!1)}},{key:"setStrikethroughThickness",value:function(t){return void 0===t&&(t=0),this.strikethroughThickness=t,this.update(!1)}},{key:"setStrikethroughOffset",value:function(t){return void 0===t&&(t=0),this.strikethroughOffset=t,this.update(!1)}},{key:"setWrapMode",value:function(t){return "string"==typeof t&&(t=Ue[t.toLowerCase()]||0),this.wrapMode=t,this.update(!0)}},{key:"setWrapWidth",value:function(t){return this.wrapWidth=t,this.update(!1)}},{key:"setAlign",value:function(t,e){return void 0===t&&(t="left"),void 0===e&&(e="top"),this.halign=t,this.valign=e,this.update(!1)}},{key:"setHAlign",value:function(t){return void 0===t&&(t="left"),this.halign=t,this.update(!1)}},{key:"setVAlign",value:function(t){return void 0===t&&(t="top"),this.valign=t,this.update(!1)}},{key:"setMaxLines",value:function(t){return void 0===t&&(t=0),this.maxLines=t,this.update(!1)}},{key:"getTextMetrics",value:function(){var t=this.metrics;return {ascent:t.ascent,descent:t.descent,fontSize:t.fontSize}}},{key:"setTextMetrics",value:function(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=Ve(e,"fontFamily",this.fontFamily),this.fontSize=Ve(e,"fontSize",this.fontSize),this.fontStyle=Ve(e,"fontStyle",this.fontStyle))),this.parent.updateText(!0)}},{key:"lineHeight",get:function(){return this.metrics.fontSize+this.strokeThickness+this.lineSpacing}},{key:"toJSON",value:function(){var t={},e=this.propertyMap;for(var i in e)t[i]=this[i];return t.metrics=this.getTextMetrics(),t}},{key:"destroy",value:function(){this.parent=void 0;}}]),t}(),Ue={none:Ae,word:Fe,char:We,character:We},He={draw:function(t,e,i,n){var s=this.penManager;this.hitAreaManager.clear();var r=this.context;r.save();var o=this.defaultStyle;this.clear(),we(this,o.backgroundColor,o.backgroundStrokeColor,o.backgroundStrokeLineWidth,o.backgroundCornerRadius,o.backgroundColor2,o.backgroundHorizontalGradient,o.backgroundCornerIteration),t+=this.startXOffset,e+=this.startYOffset;var a,h,l,u,c,d,f=o.halign,p=o.valign,v=o.lineHeight,g=s.lines,y=g.length,k=o.maxLines;k>0&&y>k?(h=k,l="center"===p?Math.floor((y-h)/2):"bottom"===p?y-h:0):(h=y,l=0),u=l+h;var m=this.rtl,b=m?this.parent.width:void 0;d="center"===p?Math.max((n-h*v)/2,0):"bottom"===p?Math.max(n-h*v-2,0):0,d+=e;for(var x=l;x0&&t.width>0){var a=i+o.underlineOffset-o.underlineThickness/2;this.drawLine(e,a,t.width,o.underlineThickness,o.underlineColor);}if(t.isTextPen&&this.drawText(e,i,t.text,o),t.isImagePen&&this.drawImage(e,i,t.prop.img,o),o.strikethroughThickness>0&&t.width>0){a=i+o.strikethroughOffset-o.strikethroughThickness/2;this.drawLine(e,a,t.width,o.strikethroughThickness,o.strikethroughColor);}if(r.restore(),t.hasAreaMarker&&t.width>0){var h,l=t.prop.area;if(l)h={key:l};else {var u=t.prop.url;h={key:"url:".concat(u),url:u};}this.hitAreaManager.add(e,i-this.startYOffset,t.width,this.defaultStyle.lineHeight,h);}},clear:function(){var t=this.canvas;this.context.clearRect(0,0,t.width,t.height);},drawLine:function(t,e,i,n,s){this.autoRound&&(t=Math.round(t),e=Math.round(e));var r=this.context,o=r.lineCap;r.lineCap="butt",r.strokeStyle=s,r.lineWidth=n,r.beginPath(),r.moveTo(t,e),r.lineTo(t+i,e),r.stroke(),r.lineCap=o;},drawText:function(t,e,i,n){this.autoRound&&(t=Math.round(t),e=Math.round(e));var s=this.context;n.stroke&&"none"!==n.stroke&&n.strokeThickness>0&&(n.syncShadow(s,n.shadowStroke),s.strokeText(i,t,e)),n.color&&"none"!==n.color&&(n.syncShadow(s,n.shadowFill),s.fillText(i,t,e));},drawImage:function(t,e,i,n){e-=this.startYOffset,this.parent.imageManager.draw(i,this.context,t,e,this.autoRound);}},Ne=Phaser.Utils.Objects.GetValue,Ke=Ie,Je=je,Ze=function(){function t(e){n(this,t),this.prop={},this.resetFromJSON(e);}return r(t,[{key:"resetFromJSON",value:function(t){this.text=Ne(t,"text",""),this.x=Ne(t,"x",0),this.y=Ne(t,"y",0),this.width=Ne(t,"width",0);var e=Ne(t,"prop",null);null===e&&(e={}),this.prop=e,this.newLineMode=Ne(t,"newLineMode",0),this.startIndex=Ne(t,"startIndex",0);}},{key:"plainText",get:function(){var t=this.text;return this.newLineMode===Je&&(t+="\n"),t}},{key:"wrapText",get:function(){var t=this.text;return this.newLineMode!==Ke&&(t+="\n"),t}},{key:"rawTextLength",get:function(){var t=this.text.length;return this.newLineMode===Je&&(t+=1),t}},{key:"endIndex",get:function(){return this.startIndex+this.rawTextLength}},{key:"lastX",get:function(){return this.x+this.width}},{key:"isTextPen",get:function(){return ""!==this.text}},{key:"isImagePen",get:function(){return !!this.prop.img}},{key:"hasAreaMarker",get:function(){return !!this.prop.area||!!this.prop.url}}]),t}(),qe=function(t,e){var i=Array.isArray(t);if(void 0===e?e=i?[]:{}:xt(e),i){e.length=t.length;for(var n=0,s=t.length;n=this.lines.length)return this.getLineEndIndex(t);var e=this.lines[t];return e&&e[0]?e[0].startIndex:0}},{key:"getLineEndIndex",value:function(t){t>=this.lines.length&&(t=this.lines.length-1);var e,i,n=!1;for(e=t;e>=0&&!(n=null!=(i=this.lines[e])&&i.length>0);e--);return n?i[i.length-1].endIndex:0}},{key:"getLineWidth",value:function(t){var e=this.lines[t];if(!e)return 0;var i=e[e.length-1];return null==i?0:i.lastX}},{key:"getMaxLineWidth",value:function(){if(void 0!==this.maxLinesWidth)return this.maxLinesWidth;for(var t,e=0,i=0,n=this.lines.length;ie&&(e=t);return this.maxLinesWidth=e,e}},{key:"getLineWidths",value:function(){for(var t=[],e=0,i=this.lines.length;e=t&&h<=e||(o=o.substring(t-a,e-a)),this.tagToTextScope?c+=this.tagToText.call(this.tagToTextScope,o,l,u):c+=this.tagToText(o,l,u),u=l,!(h>=e)));d++);return c}},{key:"length",get:function(){return this.lines.length},set:function(t){this.clear();}}]),t}(),ii={},ni=Phaser.Geom.Rectangle,si=new st,ri=function(){function t(){n(this,t),this.hitAreas=[];}return r(t,[{key:"destroy",value:function(){this.clear();}},{key:"clear",value:function(){for(var t=0,e=this.hitAreas.length;ts){""!==S?a.push(o.getLine(S,P,di)):0===O&&r>0&&a.push(o.getLine("",0,di)),a.push.apply(a,m(t(b,i,vi,s,0,o)));var E=a.pop();S=E.text,P=E.width,o.freeLine(E)," "===S&&(S="",P=0);}else (w=P+x)>l?(a.push(o.getLine(S,P,di)),S=b,P=x,l=s):(S+=b,P=w),C&&a.push(o.getLine(S,P,u));}return a},ki=Phaser.Utils.Objects.GetValue,mi=Ae,bi=Ie,xi=function(){function t(e){n(this,t),this.parent=e.parent,this.scene=this.parent.scene,this.context=ki(e,"context",null),this.canvas=this.context.canvas,this.parser=ki(e,"parser",null),this.defaultStyle=ki(e,"style",null),this.autoRound=!0,this.pensPool=e.pensPool,this.linesPool=e.linesPool,this.wrapTextLinesPool=e.wrapTextLinesPool,this.penManager=this.newPenManager(),this._tmpPenManager=null,this.hitAreaManager=new ri,this.lastHitAreaKey=null,this.urlTagCursorStyle=null;var i=this.context;this.getTextWidth=function(t){return i.measureText(t).width};}return r(t,[{key:"destroy",value:function(){this.parent=void 0,this.scene=void 0,this.context=void 0,this.canvas=void 0,this.parser=void 0,this.defaultStyle=void 0,this.penManager&&(this.penManager.destroy(),this.penManager=void 0),this._tmpPenManager&&(this._tmpPenManager.destroy(),this._tmpPenManager=void 0),this.hitAreaManager&&(this.hitAreaManager.destroy(),this.hitAreaManager=void 0),this.pensPool=void 0,this.linesPool=void 0,this.wrapTextLinesPool=void 0;}},{key:"updatePenManager",value:function(t,e,i,n,s){if(void 0===s&&(s=this.penManager),s.clear(),""===t)return s;var r=this.parent.style;if(r.isWrapFitMode){var o=this.parent.padding;i=r.fixedWidth-o.left-o.right;}for(var a,h,l,u,c,d=this.canvas,f=this.context,p=function(t){return f.measureText(t).width},v=0,g=0,y=r.wrapCallback,k=r.wrapCallbackScope,m=!0,b=this.parser.splitText(t),x=this.wrapTextLinesPool,C=0,w=b.length;C0&&e!==mi&&i0&&t>e&&(t=e),t}},{key:"linesWidth",get:function(){return Math.ceil(this.penManager.getMaxLineWidth())}},{key:"linesHeight",get:function(){var t=this.desplayLinesCount,e=this.defaultStyle.lineHeight*t;return t>0&&(e-=this.defaultStyle.lineSpacing),e}},{key:"imageManager",get:function(){return this.parent.imageManager}},{key:"rtl",get:function(){return this.parent.style.rtl}},{key:"newPenManager",value:function(){return new ei({pensPool:this.pensPool,linesPool:this.linesPool,tagToText:this.parser.propToTagText,tagToTextScope:this.parser})}},{key:"tmpPenManager",get:function(){return null===this._tmpPenManager&&(this._tmpPenManager=this.newPenManager()),this._tmpPenManager}},{key:"getPlainText",value:function(t,e,i){var n;if(null==t)n=this.penManager.plainText;else {var s=this.parser.splitText(t,1);n="";for(var r=0,o=s.length;r * @copyright 2018 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */Object.assign(xi.prototype,He,Ci);var wi=function(t){a(i,t);var e=d(i);function i(){return n(this,i),e.apply(this,arguments)}return r(i,[{key:"freeLine",value:function(t){if(t)return this.push(t),this}},{key:"freeLines",value:function(t){if(t)return this.pushMultiple(t),this}},{key:"getLine",value:function(t,e,i){var n=this.pop();return null===n&&(n={}),n.text=t,n.width=e,n.newLineMode=i,n}}]),i}(st),Si=Phaser.Utils.Objects.IsPlainObject,Pi=Phaser.Utils.Objects.GetValue,Ti=function(t,e){Si(t)?t=(e=t).key:void 0===e&&(e={key:t}),e.hasOwnProperty("key")||(e.key=t);var i=e.key,n=e.frame,s=e.width,r=e.height;if(void 0===s||void 0===r){var o=this.textureManager.getFrame(i,n),a=o?o.cutWidth:0,h=o?o.cutHeight:0;void 0===s&&void 0===r?(s=a,r=h):void 0===s?s=a*(r/h):void 0===r&&(r=h*(s/a));}this.images[t]={key:i,frame:n,width:s,height:r,y:Pi(e,"y",0),left:Pi(e,"left",0),right:Pi(e,"right",0),originX:Pi(e,"originX",0),originY:Pi(e,"originY",0)};},Oi=function(){function t(e){n(this,t),this.textureManager=e.sys.textures,this.images={};}return r(t,[{key:"destroy",value:function(){this.textureManager=void 0,this.images=void 0;}},{key:"add",value:function(t,e){if("string"==typeof t)Ti.call(this,t,e);else if(Array.isArray(t))for(var i=0,n=(s=t).length;i").concat(t,""):e.hasOwnProperty("_style")?"").concat(t,""):t}},{key:"destroy",value:function(){this.tags=void 0;}},{key:"isTextTag",value:function(t){var e=this.tags[t];return !!e&&null==e.img}}]),t}(),gn=function(t){for(var e,i,n,s={},r=0,o=(t=t.split(";")).length;r=1&&(n.color=a[0]),h>=2&&(n.thickness=parseInt(a[1].replace("px","")));break;case"shadow":a=n.split(" ");n={},(h=a.length)>=1&&(n.color=a[0]),h>=2&&(n.offsetX=parseInt(a[1].replace("px",""))),h>=3&&(n.offsetY=parseInt(a[2].replace("px",""))),h>=4&&(n.blur=parseInt(a[3].replace("px","")));break;case"u":case"underline":case"s":case"strikethrough":var h;a=n.split(" ");n={},(h=a.length)>=1&&(n.color=a[0]),h>=2&&(n.thickness=parseInt(a[1].replace("px",""))),h>=3&&(n.offset=parseInt(a[2].replace("px",""))),"underline"===i?i="u":"strikethrough"===i&&(i="s");break;case"y":n=parseFloat(n);}s[i]=n;}return s},yn=function(t){return 0===(t=t.replace(wn,"")).length},kn=/<\s*class=["|']([^"|']+)["|']\s*\>([\s\S]*?)<\s*\/class\s*\>|<\s*style=["|']([^"|']+)["|']\s*\>([\s\S]*?)<\s*\/style\s*\>/g,mn=/<\s*class=/i,bn=/<\s*class=["|']([^"|']+)["|']\s*\>([\s\S]*?)<\s*\/class\s*\>/,xn=/<\s*style=/i,Cn=/<\s*style=["|']([^"|']+)["|']\s*\>([\s\S]*?)<\s*\/style\s*\>/,wn=/^\s+|\s+$/,Sn=Phaser.Utils.Objects.GetValue,Pn=function(t){a(i,t);var e=d(i);function i(t,s,r,o,a){n(this,i);var h=Sn(a,"tags",void 0),l=new vn(h);return e.call(this,t,s,r,o,a,"rexTagText",l)}return r(i,[{key:"addTag",value:function(t,e){return this.parser.addTag(t,e),this.updateText(!0)}},{key:"addTags",value:function(t){for(var e in t)this.parser.addTag(e,t[e]);return this.updateText(!0)}},{key:"getTag",value:function(t){return this.parser.getTag(t)}},{key:"preDestroy",value:function(){p(h(i.prototype),"preDestroy",this).call(this),this.parser.destroy(),this.parser=void 0;}}]),i}(Wi);T.register("tagText",(function(t,e,i,n){var s=new Pn(this.scene,t,e,i,n);return this.scene.add.existing(s),s})),Z(window,"RexPlugins.UI.TagText",Pn);var Tn=Phaser.Utils.Objects.GetValue,On=function(t,e){return void 0===e?t:t[e]},Mn=function(t,e,n){void 0===t&&(t={}),void 0===e&&(e=0);var s=i(e);return "string"===s?t[e]=n:"number"===s?(t.left=e,t.right=e,t.top=e,t.bottom=e):(t.left=Tn(e,"left",0),t.right=Tn(e,"right",0),t.top=Tn(e,"top",0),t.bottom=Tn(e,"bottom",0)),t},En=function(){function t(e,i){n(this,t),this.setParent(e),this.type=i,this.renderable=!1,this.reset().setActive();}return r(t,[{key:"destroy",value:function(){this.parent.removeChild(this);}},{key:"setParent",value:function(t){return this.parent=t,this}},{key:"scene",get:function(){return this.parent.scene}},{key:"canvas",get:function(){return this.parent?this.parent.canvas:null}},{key:"context",get:function(){return this.parent?this.parent.context:null}},{key:"setDirty",value:function(t){return t&&this.parent&&(this.parent.dirty=!0),this}},{key:"active",get:function(){return this._active},set:function(t){this.setDirty(this._active!=t),this._active=t;}},{key:"setActive",value:function(t){return void 0===t&&(t=!0),this.active=t,this}},{key:"modifyPorperties",value:function(t){return this}},{key:"onFree",value:function(){this.reset().setParent();}},{key:"reset",value:function(){return this}},{key:"render",value:function(){}},{key:"contains",value:function(t,e){return !1}}]),t}();Object.assign(En.prototype,Ct);var _n,Rn,Ln,Bn,Dn,In={renderContent:function(){},render:function(){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}},jn=Phaser.Math.RotateAround,zn=Phaser.Geom.Rectangle,An=function(t){void 0===Rn&&(Rn=new zn);var e=t.drawTLX,i=t.drawTLY;return Rn.setTo(e,i,t.drawTRX-e,t.drawBLY-i),Rn},Fn=Phaser.Math.RotateAround,Wn=function(t,e,i,n){return void 0===n?n={}:!0===n&&(void 0===Ln&&(Ln={}),n=Ln),n.x=e,n.y=i,0!==t.rotation&&Fn(n,0,0,t.rotation),n.x=n.x*t.scaleX+t.drawX,n.y=n.y*t.scaleY+t.drawY,n},Yn=Phaser.GameObjects.Components.TransformMatrix,Vn={},Xn=function(t,e,i,n,s){var r=Wn(e,i,n,!0),o=function(t,e,i,n){void 0===n?n={}:!0===n&&(n=Vn);var s=e-t.width*t.originX,r=i-t.height*t.originY;return void 0===Bn&&(Bn=new Yn,Dn=new Yn),t.parentContainer?t.getWorldTransformMatrix(Bn,Dn):Bn.applyITRS(t.x,t.y,t.rotation,t.scaleX,t.scaleY),Bn.transformPoint(s,r,n),n}(t,r.x,r.y,s);return o},Gn=function(t,e,i,n,s){"number"!=typeof i&&(s=i,i=0,n=0);var r=e.drawCenterX+i,o=e.drawCenterY+n;return Xn(t,e,r,o,s)},Un={contains:function(t,e){if(0===this.width||0===this.height)return !1;var i=function(t,e,i,n){return void 0===n?n={}:!0===n&&(void 0===_n&&(_n={}),n=_n),n.x=(t-i.drawX)/i.scaleX,n.y=(e-i.drawY)/i.scaleY,0!==i.rotation&&jn(n,0,0,-i.rotation),n}(t,e,this,!0);return An(this).contains(i.x,i.y)},getWorldPosition:function(t,e,i){return Gn(this.parent,this,t,e,i)},scrollTo:function(){var t,e,i=this.parent,n=this.drawX+this.drawTLX,s=n+this.width;t=n<0?0-n:s>i.width?i.width-s:0;var r=this.drawY+this.drawTLY,o=r+this.height;return e=r<0?0-r:o>i.height?i.height-o:0,i._textOX+=t,i._textOY+=e,this}};Object.assign(Un,In);var Hn=Phaser.Math.DegToRad,Nn=Phaser.Math.RadToDeg,Kn=Phaser.Utils.Objects.GetValue,Jn=function(t){a(i,t);var e=d(i);function i(t,s){var r;return n(this,i),(r=e.call(this,t,s)).renderable=!0,r.scrollFactorX=1,r.scrollFactorY=1,r.toLocalPosition=!0,r.originX=0,r.offsetX=0,r.offsetY=0,r}return r(i,[{key:"visible",get:function(){return this._visible},set:function(t){this.setDirty(this._visible!=t),this._visible=t;}},{key:"setVisible",value:function(t){return void 0===t&&(t=!0),this.visible=t,this}},{key:"alpha",get:function(){return this._alpha},set:function(t){this.setDirty(this._alpha!=t),this._alpha=t;}},{key:"setAlpha",value:function(t){return this.alpha=t,this}},{key:"x",get:function(){return this._x},set:function(t){this.setDirty(this._x!=t),this._x=t;}},{key:"setX",value:function(t){return this.x=t,this}},{key:"y",get:function(){return this._y},set:function(t){this.setDirty(this._y!=t),this._y=t;}},{key:"setY",value:function(t){return this.y=t,this}},{key:"setPosition",value:function(t,e){return this.x=t,this.y=e,this}},{key:"setInitialPosition",value:function(t,e){return this.x0=t,this.y0=e,this}},{key:"setScrollFactorX",value:function(t){return this.scrollFactorX=t,this}},{key:"setScrollFactorY",value:function(t){return this.scrollFactorY=t,this}},{key:"setScrollFactor",value:function(t,e){return void 0===e&&(e=t),this.scrollFactorX=t,this.scrollFactorY=e,this}},{key:"rotation",get:function(){return this._rotation},set:function(t){this.setDirty(this._rotation!=t),this._rotation=t;}},{key:"setRotation",value:function(t){return this.rotation=t,this}},{key:"angle",get:function(){return Nn(this._rotation)},set:function(t){this.rotation=Hn(t);}},{key:"setAngle",value:function(t){return this.angle=t,this}},{key:"scaleX",get:function(){return this._scaleX},set:function(t){this.setDirty(this._scaleX!==t),this._scaleX=t;}},{key:"setScaleX",value:function(t){return this.scaleX=t,this}},{key:"width",get:function(){return 0},set:function(t){}},{key:"setWidth",value:function(t,e){return void 0===e&&(e=!1),this.width=t,e&&(this.scaleY=this.scaleX),this}},{key:"leftSpace",get:function(){return this._leftSpace},set:function(t){this.setDirty(this._leftSpace!==t),this._leftSpace=t;}},{key:"setLeftSpace",value:function(t){return this.leftSpace=t,this}},{key:"rightSpace",get:function(){return this._rightSpace},set:function(t){this.setDirty(this._rightSpace!==t),this._rightSpace=t;}},{key:"setRightSpace",value:function(t){return this.rightSpace=t,this}},{key:"outerWidth",get:function(){return this.width+this.leftSpace+this.rightSpace}},{key:"scaleY",get:function(){return this._scaleY},set:function(t){this.setDirty(this._scaleY!==t),this._scaleY=t;}},{key:"setScaleY",value:function(t){return this.scaleY=t,this}},{key:"height",get:function(){return 0},set:function(t){}},{key:"setHeight",value:function(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}},{key:"setScale",value:function(t,e){return void 0===e&&(e=t),this.scaleX=t,this.scaleY=e,this}},{key:"setOrigin",value:function(t){return this.originX=t,this}},{key:"setAlign",value:function(t){return this.align=t,this}},{key:"modifyPorperties",value:function(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=Kn(t,"width",void 0),i=Kn(t,"height",void 0),n=Kn(t,"scaleX",void 0),s=Kn(t,"scaleY",void 0);return void 0!==e?void 0===i&&void 0===s?this.setWidth(e,!0):this.setWidth(e):void 0!==n&&this.setScaleX(n),void 0!==i?void 0===e&&void 0===n?this.setHeight(i,!0):this.setHeight(i):void 0!==s&&this.setScaleY(s),t.hasOwnProperty("leftSpace")&&this.setLeftSpace(t.leftSpace),t.hasOwnProperty("rightSpace")&&this.setRightSpace(t.rightSpace),t.hasOwnProperty("align")&&this.setAlign(t.align),this}},{key:"setDrawBelowCallback",value:function(t){return this.drawBelowCallback=t,this}},{key:"setDrawAboveCallback",value:function(t){return this.drawAboveCallback=t,this}},{key:"reset",value:function(){return this.setVisible().setAlpha(1).setPosition(0,0).setRotation(0).setScale(1,1).setLeftSpace(0).setRightSpace(0).setOrigin(0).setAlign().setDrawBelowCallback().setDrawAboveCallback(),this}},{key:"willRender",get:function(){return this.visible&&this.alpha>0}},{key:"drawX",get:function(){var t=this.x+this.leftSpace+this.offsetX-this.originX*this.width;return this.parent._textOX*this.scrollFactorX+t}},{key:"drawY",get:function(){var t=this.y+this.offsetY;return this.parent._textOY*this.scrollFactorY+t}},{key:"drawTLX",get:function(){return 0}},{key:"drawTLY",get:function(){return 0}},{key:"drawBLX",get:function(){return 0}},{key:"drawBLY",get:function(){return 0}},{key:"drawTRX",get:function(){return 0}},{key:"drawTRY",get:function(){return 0}},{key:"drawBRX",get:function(){return 0}},{key:"drawBRY",get:function(){return 0}},{key:"drawCenterX",get:function(){return (this.drawTRX+this.drawTLX)/2}},{key:"drawCenterY",get:function(){return (this.drawBLY+this.drawTLY)/2}}]),i}(En);Object.assign(Jn.prototype,Un);var Zn=function(t,e,i){return e.hasOwnProperty(t)?e[t]:i[t]},qn=Phaser.Utils.Objects.GetValue,$n=function(t){a(i,t);var e=d(i);function i(t,s){var r;return n(this,i),(r=e.call(this,t,"background")).setScrollFactor(0),r.setColor(qn(s,"color",null),qn(s,"color2",null),qn(s,"horizontalGradient",!0)),r.setStroke(qn(s,"stroke",null),qn(s,"strokeThickness",2)),r.setCornerRadius(qn(s,"cornerRadius",0),qn(s,"cornerIteration",null)),r}return r(i,[{key:"color",get:function(){return this._color},set:function(t){t=ye(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t;}},{key:"color2",get:function(){return this._color2},set:function(t){t=ye(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t;}},{key:"horizontalGradient",get:function(){return this._horizontalGradient},set:function(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t;}},{key:"setColor",value:function(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}},{key:"stroke",get:function(){return this._stroke},set:function(t){t=ye(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t;}},{key:"strokeThickness",get:function(){return this._strokeThickness},set:function(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t;}},{key:"setStroke",value:function(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}},{key:"cornerRadius",get:function(){return this._cornerRadius},set:function(t){this.setDirty(this._cornerRadius!=t),this._cornerRadius=t;}},{key:"cornerIteration",get:function(){return this._cornerIteration},set:function(t){this.setDirty(this._cornerIteration!=t),this._cornerIteration=t;}},{key:"modifyStyle",value:function(t){return t.hasOwnProperty("color")&&this.setColor(t.color,Zn("color2",t,this),Zn("horizontalGradient",t,this)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,Zn("strokeThickness",t,this)),t.hasOwnProperty("cornerRadius")&&this.setCornerRadius(t.cornerRadius,Zn("cornerIteration",t,this)),this}},{key:"modifyPorperties",value:function(t){return p(h(i.prototype),"modifyPorperties",this).call(this,t),this.modifyStyle(t),this}},{key:"setCornerRadius",value:function(t,e){return this.cornerRadius=t,this.cornerIteration=e,this}},{key:"renderContent",value:function(){we(this.parent,this.color,this.stroke,this.strokeThickness,this.cornerRadius,this.color2,this.horizontalGradient,this.cornerIteration);}}]),i}(Jn),Qn=Phaser.Utils.Objects.GetValue,ts=function(t){a(i,t);var e=d(i);function i(t,s){var r;return n(this,i),(r=e.call(this,t,"innerbounds")).setScrollFactor(0),r.setColor(Qn(s,"color",null),Qn(s,"color2",null),Qn(s,"horizontalGradient",!0)),r.setStroke(Qn(s,"stroke",null),Qn(s,"strokeThickness",2)),r}return r(i,[{key:"color",get:function(){return this._color},set:function(t){t=ye(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t;}},{key:"color2",get:function(){return this._color2},set:function(t){t=ye(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t;}},{key:"horizontalGradient",get:function(){return this._horizontalGradient},set:function(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t;}},{key:"setColor",value:function(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}},{key:"stroke",get:function(){return this._stroke},set:function(t){t=ye(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t;}},{key:"strokeThickness",get:function(){return this._strokeThickness},set:function(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t;}},{key:"setStroke",value:function(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}},{key:"modifyPorperties",value:function(t){p(h(i.prototype),"modifyPorperties",this).call(this,t),t.hasOwnProperty("color")&&this.setColor(t.color,Qn(t,"color2",null),Qn(t,"horizontalGradient",!0)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,Qn(t,"strokeThickness",2));}},{key:"renderContent",value:function(){var t=this.parent.padding,e=t.left,i=t.top,n=this.parent.width-t.left-t.right,s=this.parent.height-t.top-t.bottom,r=this.context;if(null!=this.color){var o,a;if(null!=this.color2)(a=this.horizontalGradient?r.createLinearGradient(0,0,n,0):r.createLinearGradient(0,0,0,s)).addColorStop(0,this.color),a.addColorStop(1,this.color2),o=a;else o=this.color;r.fillStyle=o,r.fillRect(e,i,n,s);}null!=this.stroke&&this.strokeThickness>0&&(r.strokeStyle=this.stroke,r.lineWidth=this.strokeThickness,r.strokeRect(e,i,n,s));}}]),i}(Jn),es=Phaser.Utils.Objects.GetValue,is=function(){function t(e,i){n(this,t),this.parent=e,this.set(i);}return r(t,[{key:"toJSON",value:function(){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}}},{key:"set",value:function(t){return this.setBold(es(t,"bold",!1)),this.setItalic(es(t,"italic",!1)),this.setFontSize(es(t,"fontSize","16px")),this.setFontFamily(es(t,"fontFamily","Courier")),this.setColor(es(t,"color","#fff")),this.setStrokeStyle(es(t,"stroke",null),es(t,"strokeThickness",0)),this.setShadow(es(t,"shadowColor",null),es(t,"shadowOffsetX",0),es(t,"shadowOffsetY",0),es(t,"shadowBlur",0)),this.setOffset(es(t,"offsetX",0),es(t,"offsetY",0)),this.setSpace(es(t,"leftSpace",0),es(t,"rightSpace",0)),this.setAlign(es(t,"align",void 0)),this.setBackgroundColor(es(t,"backgroundColor",null)),this.setBackgroundHeight(es(t,"backgroundHeight",void 0)),this.setBackgroundBottomY(es(t,"backgroundBottomY",void 0)),this}},{key:"modify",value:function(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(Zn("stroke",t,this),Zn("strokeThickness",t,this)),t.hasOwnProperty("shadowColor")&&this.setShadowColor(t.shadowColor),(t.hasOwnProperty("shadowOffsetX")||t.hasOwnProperty("shadowOffsetY"))&&this.setShadowOffset(Zn("shadowOffsetX",t,this),Zn("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}},{key:"setUpdateTextFlag",value:function(){return this.parent&&(this.parent.updateTextFlag=!0),this}},{key:"clone",value:function(){return new t(null,this.toJSON())}},{key:"copyFrom",value:function(t){return this.set(t.toJSON()),this}},{key:"copyTo",value:function(t){return t.set(this.toJSON()),this}},{key:"setBold",value:function(t){return void 0===t&&(t=!0),this.bold=t,this.setUpdateTextFlag(),this}},{key:"setItalic",value:function(t){return void 0===t&&(t=!0),this.italic=t,this.setUpdateTextFlag(),this}},{key:"fontStyle",get:function(){return this.bold&&this.italic?"bold italic":this.bold?"bold":this.italic?"italic":""}},{key:"setFontSize",value:function(t){return "number"==typeof t&&(t="".concat(t,"px")),this.fontSize=t,this.setUpdateTextFlag(),this}},{key:"setFontFamily",value:function(t){return this.fontFamily=t,this.setUpdateTextFlag(),this}},{key:"font",get:function(){return "".concat(this.fontStyle," ").concat(this.fontSize," ").concat(this.fontFamily)}},{key:"setColor",value:function(t){return this.color=ye(t),this}},{key:"hasFill",get:function(){return null!=this.color}},{key:"setStrokeStyle",value:function(t,e){return this.stroke=ye(t),void 0!==e&&(this.strokeThickness=e),this}},{key:"setStrokeThickness",value:function(t){return this.strokeThickness=t,this}},{key:"hasStroke",get:function(){return null!=this.stroke&&this.strokeThickness>0}},{key:"setShadowColor",value:function(t){return this.shadowColor=ye(t),this}},{key:"setShadowOffset",value:function(t,e){return void 0===t&&(t=0),void 0===e&&(e=0),this.shadowOffsetX=t,this.shadowOffsetY=e,this}},{key:"setShadowBlur",value:function(t){return void 0===t&&(t=0),this.shaodwBlur=t,this}},{key:"setShadow",value:function(t,e,i,n){return this.setShadowColor(t).setShadowOffset(e,i).setShadowBlur(n),this}},{key:"setBackgroundColor",value:function(t){return this.backgroundColor=ye(t),this}},{key:"hasBackgroundColor",get:function(){return null!=this.backgroundColor}},{key:"setBackgroundHeight",value:function(t){return this.backgroundHeight=t,this}},{key:"setBackgroundBottomY",value:function(t){return this.backgroundBottomY=t,this}},{key:"setOffsetX",value:function(t){return void 0===t&&(t=0),this.offsetX=t,this}},{key:"setOffsetY",value:function(t){return void 0===t&&(t=0),this.offsetY=t,this}},{key:"setOffset",value:function(t,e){return this.setOffsetX(t).setOffsetY(e),this}},{key:"setLeftSpace",value:function(t){return void 0===t&&(t=0),this.leftSpace=t,this}},{key:"setRightSpace",value:function(t){return void 0===t&&(t=0),this.rightSpace=t,this}},{key:"setSpace",value:function(t,e){return this.setLeftSpace(t).setRightSpace(e),this}},{key:"setAlign",value:function(t){return this.align=t,this}},{key:"syncFont",value:function(t){return t.font=this.font,this}},{key:"syncStyle",value:function(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}},{key:"syncShadow",value:function(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);}},{key:"getTextMetrics",value:function(t,e){return this.syncFont(t).syncStyle(t),t.measureText(e)}}]),t}(),ns=Phaser.Utils.Array.Remove,ss=Phaser.Utils.Array.Remove,rs="text",os="image",as="drawer",hs="space",ls="command",us=function(t){return t.type===rs&&"\n"===t.text},cs=function(t){return t.type===rs&&"\f"===t.text},ds=function(t){return t.type===rs},fs=function(t){return t.type===ls},ps=function(t){a(i,t);var e=d(i);function i(t,s,r){var o;return n(this,i),(o=e.call(this,t,rs)).updateTextFlag=!1,o.style=new is(u(o),r),o.setText(s),o}return r(i,[{key:"autoRound",get:function(){return this.parent.autoRound}},{key:"offsetX",get:function(){return this.style.offsetX},set:function(t){this.style&&(this.style.offsetX=t);}},{key:"offsetY",get:function(){return this.style.offsetY},set:function(t){this.style&&(this.style.offsetY=t);}},{key:"leftSpace",get:function(){return this.style.leftSpace*this.scaleX},set:function(t){this.style&&(this.style.leftSpace=t),g(h(i.prototype),"leftSpace",t,this,!0);}},{key:"rightSpace",get:function(){return this.style.rightSpace*this.scaleX},set:function(t){this.style&&(this.style.rightSpace=t),g(h(i.prototype),"rightSpace",t,this,!0);}},{key:"align",get:function(){return this.style.align},set:function(t){this.style&&(this.style.align=t);}},{key:"modifyStyle",value:function(t){return this.setDirty(!0),this.style.modify(t),this.updateTextFlag&&this.updateTextSize(),this}},{key:"modifyPorperties",value:function(t){return t?(this.modifyStyle(t),p(h(i.prototype),"modifyPorperties",this).call(this,t),this):this}},{key:"setText",value:function(t){return this.setDirty(this.text!=t),this.text=t,this.updateTextSize(),this}},{key:"updateTextSize",value:function(){var t=this.text;if("\n"===t||"\f"===t||""===t)this.clearTextSize();else {var e,i,n=this.style.getTextMetrics(this.context,this.text);this.textWidth=n.width,"actualBoundingBoxAscent"in n?(e=n.actualBoundingBoxAscent,i=n.actualBoundingBoxDescent):(e=0,i=0),this.textHeight=e+i,this.ascent=e,this.descent=i;}return this.updateTextFlag=!1,this}},{key:"clearTextSize",value:function(){return this.textWidth=0,this.textHeight=0,this.ascent=0,this.descent=0,this}},{key:"copyTextSize",value:function(t){return this.textWidth=t.textWidth,this.textHeight=t.textHeight,this.ascent=t.ascent,this.descent=t.descent,this}},{key:"width",get:function(){return this.textWidth*this.scaleX},set:function(t){this.textWidth>0?this.scaleX=t/this.textWidth:this.scaleX=1;}},{key:"height",get:function(){return this.textHeight*this.scaleY},set:function(t){this.textHeight>0?this.scaleY=t/this.textHeight:this.scaleY=1;}},{key:"willRender",get:function(){return 0!==this.textWidth&&p(h(i.prototype),"willRender",this)}},{key:"renderContent",value:function(){var t=this.context,e=this.style;if(e.hasBackgroundColor){t.fillStyle=e.backgroundColor;var i=this.drawTLX,n=this.drawTRX-i,s=e.backgroundBottomY;null==s&&(s=this.drawBLY);var r=e.backgroundHeight;null==r&&(r=s-this.drawTLY);var o=s-r;t.fillRect(i,o,n,r);}var a=e.hasFill,h=e.hasStroke;(a||h)&&(e.syncFont(t).syncStyle(t),h&&(e.syncShadow(t),t.strokeText(this.text,0,0)),a&&(e.syncShadow(t),t.fillText(this.text,0,0)));}},{key:"drawTLX",get:function(){return -this.leftSpace}},{key:"drawTLY",get:function(){return -this.ascent}},{key:"drawBLX",get:function(){return -this.leftSpace}},{key:"drawBLY",get:function(){return this.descent}},{key:"drawTRX",get:function(){return this.textWidth+this.rightSpace}},{key:"drawTRY",get:function(){return -this.ascent}},{key:"drawBRX",get:function(){return this.textWidth+this.rightSpace}},{key:"drawBRY",get:function(){return this.descent}}]),i}(Jn),vs=function(t,e){var i=this.createCharChildren(t,e);return this.addChild(i),this},gs=function(t){a(i,t);var e=d(i);function i(t,s,r){var o;return n(this,i),(o=e.call(this,t,os)).setTexture(s,r),o}return r(i,[{key:"frameWidth",get:function(){return this.frameObj?this.frameObj.cutWidth:0}},{key:"frameHeight",get:function(){return this.frameObj?this.frameObj.cutHeight:0}},{key:"offsetY",get:function(){return -this.height},set:function(t){}},{key:"key",get:function(){return this._key},set:function(t){this.setDirty(this._key!=t),this._key=t;}},{key:"frame",get:function(){return this._frame},set:function(t){this.setDirty(this._frame!=t),this._frame=t;}},{key:"setTexture",value:function(t,e){return this.key=t,this.frame=e,this.frameObj=this.scene.sys.textures.getFrame(t,e),this}},{key:"width",get:function(){return this.frameWidth*this.scaleX},set:function(t){this.setDirty(this.width!==t),this.scaleX=t/this.frameWidth;}},{key:"height",get:function(){return this.frameHeight*this.scaleY},set:function(t){this.setDirty(this.height!==t),this.scaleY=t/this.frameHeight;}},{key:"setHeight",value:function(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}},{key:"renderContent",value:function(){var t=this.context,e=this.frameObj,i=this.frameWidth,n=this.frameHeight;t.drawImage(e.source.image,e.cutX,e.cutY,i,n,0,0,i,n);}},{key:"drawTLX",get:function(){return -this.leftSpace}},{key:"drawTLY",get:function(){return 0}},{key:"drawBLX",get:function(){return -this.leftSpace}},{key:"drawBLY",get:function(){return this.frameHeight}},{key:"drawTRX",get:function(){return this.frameWidth+this.rightSpace}},{key:"drawTRY",get:function(){return 0}},{key:"drawBRX",get:function(){return this.frameWidth+this.rightSpace}},{key:"drawBRY",get:function(){return this.frameHeight}}]),i}(Jn),ys=function(t,e,i){var n=this.createImageChild(t,e,i);return this.addChild(n),this},ks=function(t){a(i,t);var e=d(i);function i(t,s,r,o){var a;return n(this,i),(a=e.call(this,t,as)).setRenderCallback(s),a.setDrawerSize(r,o),a}return r(i,[{key:"setRenderCallback",value:function(t){return t?this.renderContent=t.bind(this):delete this.renderContent,this}},{key:"setDrawerSize",value:function(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}},{key:"onFree",value:function(){p(h(i.prototype),"onFree",this).call(this),this.setRenderCallback();}},{key:"width",get:function(){return this.drawerWidth*this.scaleX},set:function(t){this.setDirty(this.width!==t),this.scaleX=this.drawerWidth>0?t/this.drawerWidth:1;}},{key:"height",get:function(){return this.drawerHeight*this.scaleY},set:function(t){this.setDirty(this.height!==t),this.scaleY=this.drawerHeight>0?t/this.drawerHeight:1;}},{key:"offsetY",get:function(){return -this.height},set:function(t){}},{key:"drawTLX",get:function(){return -this.leftSpace}},{key:"drawTLY",get:function(){return 0}},{key:"drawBLX",get:function(){return -this.leftSpace}},{key:"drawBLY",get:function(){return this.drawerHeight}},{key:"drawTRX",get:function(){return this.drawerWidth+this.rightSpace}},{key:"drawTRY",get:function(){return 0}},{key:"drawBRX",get:function(){return this.drawerWidth+this.rightSpace}},{key:"drawBRY",get:function(){return this.drawerHeight}}]),i}(Jn),ms=function(t){a(i,t);var e=d(i);function i(t,s){var r;return n(this,i),(r=e.call(this,t,hs)).setSpaceWidth(s),r}return r(i,[{key:"width",get:function(){return this.spaceWidth*this.scaleX},set:function(t){this.spaceWidth>0?this.scaleX=t/this.spaceWidth:this.scaleX=1;}},{key:"setSpaceWidth",value:function(t){return this.spaceWidth=t,this}}]),i}(Jn),bs=function(t){var e=this.createSpaceChild(t);return this.addChild(e),this},xs=function(t){a(i,t);var e=d(i);function i(t,s,r,o,a){var h;return n(this,i),(h=e.call(this,t,ls)).setName(s).setParameter(o).setCallback(r,a),h}return r(i,[{key:"setName",value:function(t){return this.name=t,this}},{key:"setParameter",value:function(t){return this.param=t,this}},{key:"setCallback",value:function(t,e){return this.callback=t,this.scope=e,this}},{key:"exec",value:function(){return this.scope?this.callback.call(this.scope,this.param,this.name):this.callback(this.param,this.name)}},{key:"onFree",value:function(){p(h(i.prototype),"onFree",this).call(this),this.setName().setCallback().setParameter();}}]),i}(En),Cs=function(t,e,i,n){var s=this.createCommandChild(t,e,i,n);return this.addChild(s),this},ws=function(t,e,i,n){void 0===n&&(n={word:[],width:0}),n.word.length=0;for(var s=t.length,r=e,o=n.word,a=0;r0&&!a){var h=this.fixedHeight-n;if(i>0)r=h/i;else r=(l=Ts.call(this)).height,o=l.ascent,i=Math.floor((h-o)/r);}else {var l;r=(l=Ts.call(this)).height,o=l.ascent;}}else if(this.fixedHeight>0){if(void 0===(i=Ms(t,"maxLines"))){h=this.fixedHeight-n;i=Math.floor(h/r);}}else i=Ms(t,"maxLines",0);void 0===o&&(o=r);var u=0===i,c=Ms(t,"wrapWidth",void 0);void 0===c&&(c=this.fixedWidth>0?this.fixedWidth-s:1/0);for(var d=Ms(t,"letterSpacing",0),f=Ms(t,"hAlign",0),p=Ms(t,"vAlign",0),v=Ms(t,"charWrap",!1),g={callback:"runWordWrap",start:e,isLastPage:!1,padding:this.wrapPadding,ascent:o,lineHeight:r,maxLines:i,wrapWidth:c,letterSpacing:d,hAlign:f,vAlign:p,charWrap:v,children:[],lines:[],maxLineWidth:0,linesHeight:0},y=this.children,k=0,m=y.length;k0&&(M.push({children:E,width:_}),R=Math.max(R,_)),g.start+=O.length,g.isLastPage=!L&&g.start===T,g.maxLineWidth=R,g.linesHeight=M.length*r;var F=this.fixedWidth>0?this.fixedWidth:g.maxLineWidth+s,W=this.fixedHeight>0?this.fixedHeight:g.linesHeight+n;!function(t,e,i){var n,s,r=t.hAlign,o=t.vAlign,a=t.linesHeight;switch(o){case 1:case"center":s=(i-a)/2;break;case 2:case"bottom":s=i-a;break;default:s=0;}for(var h=t.lines,l=0,u=h.length;l0?(o=this.fixedWidth-s)/i:0;else if(this.fixedWidth>0){if(void 0===(i=Rs(t,"maxLines",void 0))){var o=this.fixedWidth-s;i=Math.floor(o/r)+1;}}else i=Rs(t,"maxLines",0);var a=0===i,h=Rs(t,"fixedChildHeight",void 0);if(void 0===h){var l=Rs(t,"charPerLine",void 0);if(void 0!==l){var u=this.fixedHeight-n;h=Math.floor(u/l);}}var c=Rs(t,"wrapHeight",void 0);void 0===c&&(c=this.fixedHeight>0?this.fixedHeight-n:1/0);for(var d=Rs(t,"letterSpacing",0),f=Rs(t,"rtl",!0),p=Rs(t,"hAlign",f?2:0),v=Rs(t,"vAlign",0),g={callback:"runVerticalWrap",start:e,isLastPage:!1,padding:this.wrapPadding,lineWidth:r,maxLines:i,fixedChildHeight:h,wrapHeight:c,letterSpacing:d,hAlign:p,vAlign:v,rtl:f,children:[],lines:[],maxLineHeight:0,linesWidth:0},y=this.children,k=0,m=y.length;k0&&(M.push({children:E,height:_}),R=Math.max(R,_)),g.start+=O.length,g.isLastPage=g.start===T,g.maxLineHeight=R,g.linesWidth=M.length*r;var z=this.fixedWidth>0?this.fixedWidth:g.linesWidth+s,A=this.fixedHeight>0?this.fixedHeight:g.maxLineHeight+n;!function(t,e,i){var n,s,r=t.hAlign,o=t.vAlign,a=t.rtl,h=t.lines,l=t.lineWidth,u=t.linesWidth;switch(r){case 1:case"center":n=(e-u)/2;break;case 2:case"right":n=e-u;break;default:n=0;}a&&(n+=l);for(var c=0,d=h.length;c0?t:this.width,e>0?e:this.height),this):this},setPadding:function(t,e){var i=this.padding,n=i.left,s=i.right,r=i.top,o=i.bottom;return Mn(i,t,e),this.dirty=this.dirty||n!=i.left||s!=i.right||r!=i.top||o!=i.bottom,this},getPadding:function(t){return On(this.padding,t)},modifyTextStyle:function(t){return this.textStyle.modify(t),this},modifyDefaultTextStyle:function(t){return this.defaultTextStyle.modify(t),this},resetTextStyle:function(){return this.textStyle.copyFrom(this.defaultTextStyle),this},setTestString:function(t){return this.testString=t,this},removeChild:function(t){return this.poolManager.free(t),ns(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 ss(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,n,s,r=Array.isArray(t);void 0===e||e===this.children.length?r?(i=this.children).push.apply(i,m(t)):this.children.push(t):r?(n=this.children).splice.apply(n,[e,0].concat(m(t))):this.children.splice(e,0,t);(this.lastAppendedChildren.length=0,r)?(s=this.lastAppendedChildren).push.apply(s,m(t)):this.lastAppendedChildren.push(t);return this},createCharChild:function(t,e){e&&this.textStyle.modify(e);var i=this.poolManager.allocate(rs);return null===i?i=new ps(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=[],n=0,s=t.length;ne&&(n=e,s=t);})),s},getCharWorldPosition:function(t,e,i,n){return "number"==typeof t&&(t=this.getCharChild(t,!0)),Gn(this,t,e,i,n)},setToMinSize:function(){for(var t=this.children,e=0,i=0,n=0,s=t.length;n=i.length&&(t=i.length);for(var n=0,s=0;s1?i-1:0),s=1;s0&&void 0!==t.setTint},useAlphaFadeEffect:function(t){return (void 0===this.fadeMode||1===this.fadeMode)&&this.fadeTime>0&&void 0!==t.setAlpha},useRevealEffect:function(t){return this.fadeMode>=2&&this.fadeMode<=5&&this.fadeTime>0&&(t.preFX||t.postFX)},fadeBob:function(t,e,i,n){var s=t.gameObject;if(this.useTintFadeEffect(s))void 0!==e&&t.setProperty("tintGray",255*e),t.easeProperty("tintGray",Math.floor(255*i),this.fadeTime,"Linear",0,!1,n);else if(this.useAlphaFadeEffect(s))void 0!==e&&t.setProperty("alpha",e),t.easeProperty("alpha",i,this.fadeTime,"Linear",0,!1,n);else if(this.useRevealEffect(s)){var r;switch(fr(s,"reveal"),this.fadeMode){case 2:r="revealUp";break;case 3:r="revealDown";break;case 4:r="revealLeft";break;case 5:r="revealRight";}void 0===e&&(e=0),s[r]=e,t.easeProperty(r,i,this.fadeTime,"Linear",0,!1,n),t.getTweenTask(r).once("complete",(function(){s[r]=null;}));}else n&&n(s);return this}},gr=function(t){return t>>16&255},yr=function(t){return t>>8&255},kr=function(t){return 255&t},mr=Phaser.Events.EventEmitter,br=function(t,e,i,n,s,r){return void 0===r?r={}:!0===r&&(r=xr),"number"!=typeof i&&(i=0,n=0),r.x=s.x+s.width*t+i,r.y=s.y+s.height*e+n,r},xr={},Cr=function(t,e,i,n,s,r,o){if(t.hasOwnProperty("vp"))return t;"function"==typeof i&&(o=i,i=void 0),"function"==typeof s&&(o=s,s=void 0),void 0===i&&(i=.5),void 0===n&&(n=.5),void 0===s&&(s=0),void 0===r&&(r=0),void 0===o&&(o=br),function(t){if(t.events)return t;var e=new mr,i=t.x;Object.defineProperty(t,"x",{get:function(){return i},set:function(n){i!==n&&(i=n,e.emit("update",t));}});var n=t.y;Object.defineProperty(t,"y",{get:function(){return n},set:function(i){n!==i&&(n=i,e.emit("update",t));}});var s=t.width;Object.defineProperty(t,"width",{get:function(){return s},set:function(i){s!==i&&(s=i,e.emit("update",t));}});var r=t.height;Object.defineProperty(t,"height",{get:function(){return r},set:function(i){r!==i&&(r=i,e.emit("update",t));}}),t.events=e;}(e);var a=e.events;t.vp=e;var h=function(){o(i,n,s,r,e,t);};a.on("update",h),t.once("destroy",(function(){a.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 n},set:function(t){n!==t&&(n=t,h());}}),Object.defineProperty(t,"vpxOffset",{get:function(){return s},set:function(t){s!==t&&(s=t,h());}}),Object.defineProperty(t,"vpyOffset",{get:function(){return r},set:function(t){r!==t&&(r=t,h());}}),h();},wr=Phaser.Utils.Array.Remove,Sr={has:function(t){return this.bobs.hasOwnProperty(t)},exists:function(t){return this.bobs.hasOwnProperty(t)},get:function(t){return this.bobs[t]},getGO:function(t){var e=this.get(t);return e?e.gameObject:null},addGO:function(t,e){this.remove(t,!0),this.useTintFadeEffect(e)&&function(t,e){if(t.hasOwnProperty("tintR"))return t;void 0===e&&(e=16777215);var i=gr(e),n=yr(e),s=kr(e);Object.defineProperty(t,"tint",{get:function(){return e},set:function(r){r=16777215&Math.floor(r),t.setTint&&t.setTint(r),e!==r&&(i=gr(e=r),n=yr(e),s=kr(e));}}),Object.defineProperty(t,"tintR",{get:function(){return i},set:function(n){n=255&Math.floor(n),i!==n&&(i=n,t.tint=(255&n)<<16|65535&e);}}),Object.defineProperty(t,"tintG",{get:function(){return n},set:function(i){i=255&Math.floor(i),n!==i&&(n=i,t.tint=(255&i)<<8|16711935&e);}}),Object.defineProperty(t,"tintB",{get:function(){return s},set:function(i){i=255&Math.floor(i),s!==i&&(s=i,t.tint=255&i|16776960&e);}}),Object.defineProperty(t,"tintGray",{get:function(){return Math.floor((i+n+s)/3)},set:function(e){e=255&Math.floor(e),i===e&&n===e&&s===e||(i=e,n=e,s=e,t.tint=(255&e)<<16|(255&e)<<8|255&e);}}),t.tint=e;}(e),this.viewportCoordinateEnable&&Cr(e,this.viewport),this.effectPropertiesConfig&&fr(e,this.effectPropertiesConfig),e.once("destroy",(function(){wr(this.removedGOs,e),this.isEmpty&&this.emit("empty");}),this);var i=new this.BobClass(this,e,t);return this.bobs[t]=i,this},add:function(t){for(var e=this.createGameObjectCallback,i=this.createGameObjectScope,n=arguments.length,s=new Array(n>1?n-1:0),r=1;r2?n-2:0),r=2;r0?-this.delay:0,this.state=this.nowTime>=0?ko:yo,this.repeatCounter=0,this}},{key:"stop",value:function(){return this.state=go,this}},{key:"update",value:function(t,e){this.state!==go&&this.state!==bo&&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=mo)):(this.nowTime=this.duration,this.state=bo):this.nowTime>=0&&(this.state=ko));}},{key:"t",get:function(){var t;switch(this.state){case go:case yo:case mo:t=0;break;case ko:t=this.nowTime/this.duration;break;case bo:t=1;}return po(t,0,1)},set:function(t){(t=po(t,-1,1))<0?(this.state=yo,this.nowTime=-this.delay*t):(this.state=ko,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++);}},{key:"setT",value:function(t){return this.t=t,this}},{key:"isIdle",get:function(){return this.state===go}},{key:"isDelay",get:function(){return this.state===yo}},{key:"isCountDown",get:function(){return this.state===ko}},{key:"isRunning",get:function(){return this.state===yo||this.state===ko}},{key:"isDone",get:function(){return this.state===bo}},{key:"isOddIteration",get:function(){return 1==(1&this.repeatCounter)}},{key:"isEvenIteration",get:function(){return 0==(1&this.repeatCounter)}}]),t}(),go=0,yo=1,ko=2,mo=3,bo=-1,xo=function(t){a(i,t);var e=d(i);function i(t,s){var r;return n(this,i),(r=e.call(this,t,s)).timer=new vo,r}return r(i,[{key:"shutdown",value:function(t){this.isShutdown||(p(h(i.prototype),"shutdown",this).call(this,t),this.timer.destroy(),this.timer=void 0);}},{key:"start",value:function(){return this.timer.start(),p(h(i.prototype),"start",this).call(this),this}},{key:"stop",value:function(){return this.timer.stop(),p(h(i.prototype),"stop",this).call(this),this}},{key:"complete",value:function(){return this.timer.stop(),p(h(i.prototype),"complete",this).call(this),this}}]),i}(uo),Co=Phaser.Utils.Objects.GetValue,wo=Phaser.Utils.Objects.GetAdvancedValue,So=Phaser.Tweens.Builders.GetEaseFunction,Po=function(t){a(i,t);var e=d(i);function i(){return n(this,i),e.apply(this,arguments)}return r(i,[{key:"resetFromJSON",value:function(t){return this.timer.resetFromJSON(Co(t,"timer")),this.setEnable(Co(t,"enable",!0)),this.setTarget(Co(t,"target",this.parent)),this.setDelay(wo(t,"delay",0)),this.setDuration(wo(t,"duration",1e3)),this.setEase(Co(t,"ease","Linear")),this.setRepeat(Co(t,"repeat",0)),this}},{key:"setEnable",value:function(t){return null==t&&(t=!0),this.enable=t,this}},{key:"setTarget",value:function(t){return void 0===t&&(t=this.parent),this.target=t,this}},{key:"setDelay",value:function(t){return this.delay=t,this}},{key:"setDuration",value:function(t){return this.duration=t,this}},{key:"setRepeat",value:function(t){return this.repeat=t,this}},{key:"setRepeatDelay",value:function(t){return this.repeatDelay=t,this}},{key:"setEase",value:function(t){return void 0===t&&(t="Linear"),this.ease=t,this.easeFn=So(t),this}},{key:"start",value:function(){return this.timer.isRunning||p(h(i.prototype),"start",this).call(this),this}},{key:"restart",value:function(){return this.timer.stop(),this.start.apply(this,arguments),this}},{key:"stop",value:function(t){return void 0===t&&(t=!1),p(h(i.prototype),"stop",this).call(this),t&&(this.timer.setT(1),this.updateGameObject(this.target,this.timer),this.complete()),this}},{key:"update",value:function(t,e){if(!this.isRunning||!this.enable||!this.parent.active)return this;var i=this.target,n=this.timer;return n.update(t,e),n.isDelay||this.updateGameObject(i,n),this.emit("update",i,this),n.isDone&&this.complete(),this}},{key:"updateGameObject",value:function(t,e){}}]),i}(xo),To=Phaser.Sound.BaseSound,Oo=function(t){return t instanceof To},Mo=Phaser.Utils.Objects.GetValue,Eo=Phaser.Utils.Objects.GetAdvancedValue,_o=Phaser.Math.Linear,Ro=function(t){a(i,t);var e=d(i);function i(t,s,r){var o;return n(this,i),Oo(t)&&(r=s,s=t,t=void 0),s.active=!0,s.scene=t,s.game=s.manager.game,(o=e.call(this,s,r)).volume={},o.resetFromJSON(r),o}return r(i,[{key:"resetFromJSON",value:function(t){return p(h(i.prototype),"resetFromJSON",this).call(this,t),this.setMode(Mo(t,"mode",0)),this.setEnable(Mo(t,"enable",!0)),this.setVolumeRange(Eo(t,"volume.start",this.parent.volume),Eo(t,"volume.end",0)),this}},{key:"setMode",value:function(t){return "string"==typeof t&&(t=Lo[t]),this.mode=t,this}},{key:"setVolumeRange",value:function(t,e){return this.volume.start=t,this.volume.end=e,this}},{key:"start",value:function(){return this.timer.isRunning||(this.parent.setVolume(this.volume.start),this.timer.setDelay(this.delay).setDuration(this.duration),p(h(i.prototype),"start",this).call(this)),this}},{key:"updateGameObject",value:function(t,e){t.volume=_o(this.volume.start,this.volume.end,e.t);}},{key:"complete",value:function(){switch(p(h(i.prototype),"complete",this).call(this),this.mode){case 1:this.parent.stop();break;case 2:this.parent.destroy();}return this}}]),i}(Po),Lo={stop:1,destroy:2},Bo=function(t,e,i,n,s){Oo(t)&&(s=n,n=i,i=e,e=t,t=void 0),void 0===n&&(n=1),void 0===s&&(s=0);var r,o={mode:0,volume:{start:s,end:n},duration:i};return "string"==typeof e&&(e=t.sys.sound.add(e)),e.hasOwnProperty("_fade")?(r=e._fade).stop().resetFromJSON(o):(r=new Ro(t,e,o),e._fade=r),r.start(),e.isPlaying||e.setVolume(s).play(),e},Do=function(t,e,i,n){Oo(t)&&(n=i,i=e,e=t,t=void 0),void 0===n&&(n=!0);var s,r={mode:n?2:1,volume:{start:e.volume,end:0},duration:i};return e.hasOwnProperty("_fade")?(s=e._fade).stop().resetFromJSON(r):(s=new Ro(t,e,r),e._fade=s),s.start(),e.isPlaying||e.play(),e},Io=Phaser.Utils.Objects.GetValue,jo={setBackgroundMusicLoop:function(t){return void 0===t&&(t=!0),this.backgroundMusicLoop=t,this},setBackgroundMusicFadeTime:function(t){return this.backgroundMusicFadeTime=t,this},getBackgroundMusic:function(){return this.backgroundMusic},setCurrentBackgroundMusic:function(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:function(t,e){if(this.backgroundMusic&&this.backgroundMusic.key===t)return this;this.stopBackgroundMusic();var i=this.sound.add(t,{loop:Io(e,"loop",this.backgroundMusicLoop),mute:Io(e,"mute",this.backgroundMusicMute),volume:Io(e,"volume",this.backgroundMusicVolume),detune:Io(e,"detune",0),rate:Io(e,"rate",1)});return this.setCurrentBackgroundMusic(i),this.backgroundMusicFadeTime>0&&this.fadeInBackgroundMusic(this.backgroundMusicFadeTime),this},pauseBackgroundMusic:function(){return this.backgroundMusic&&this.backgroundMusic.pause(),this},resumeBackgroundMusic:function(){return this.backgroundMusic&&this.backgroundMusic.resume(),this},stopBackgroundMusic:function(){return this.backgroundMusic&&(this.backgroundMusicFadeTime>0?this.fadeOutBackgroundMusic(this.backgroundMusicFadeTime,!0):(this.backgroundMusic.stop(),this.backgroundMusic.destroy(),this.backgroundMusic=void 0)),this},fadeInBackgroundMusic:function(t){return this.backgroundMusic&&Bo(this.backgroundMusic,t,this.backgroundMusicVolume,0),this},fadeOutBackgroundMusic:function(t,e){return this.backgroundMusic&&Do(this.backgroundMusic,t,e),this},crossFadeBackgroundMusic:function(t,e){var i=this.backgroundMusicFadeTime;return this.backgroundMusicFadeTime=0,this.fadeOutBackgroundMusic(e,!0).playBackgroundMusic(t).fadeInBackgroundMusic(e),this.backgroundMusicFadeTime=i,this},setBackgroundMusicMute:function(t){return void 0===t&&(t=!0),this.backgroundMusicMute=t,this},setBackgroundMusicVolume:function(t){return this.backgroundMusicVolume=t,this},setBackgroundMusicRate:function(t){return this.backgroundMusic&&this.backgroundMusic.setRate(t),this},setBackgroundMusicDetune:function(t){return this.backgroundMusic&&this.backgroundMusic.setDetune(t),this}},zo=Phaser.Utils.Objects.GetValue,Ao={setBackgroundMusic2Loop:function(t){return void 0===t&&(t=!0),this.backgroundMusic2Loop=t,this},setBackgroundMusic2FadeTime:function(t){return this.backgroundMusic2FadeTime=t,this},getBackgroundMusic2:function(){return this.backgroundMusic2},setCurrentBackgroundMusic2:function(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:function(t,e){if(this.backgroundMusic2&&this.backgroundMusic2.key===t)return this;this.stopBackgroundMusic2();var i=this.sound.add(t,{loop:zo(e,"loop",this.backgroundMusicLoop),mute:zo(e,"mute",this.backgroundMusic2Mute),volume:zo(e,"volume",this.backgroundMusic2Volume),detune:zo(e,"detune",0),rate:zo(e,"rate",1)});return this.setCurrentBackgroundMusic2(i),this.backgroundMusic2FadeTime>0&&this.fadeInBackgroundMusic2(this.backgroundMusic2FadeTime),this},pauseBackgroundMusic2:function(){return this.backgroundMusic2&&this.backgroundMusic2.pause(),this},resumeBackgroundMusic2:function(){return this.backgroundMusic2&&this.backgroundMusic2.resume(),this},stopBackgroundMusic2:function(){return this.backgroundMusic2&&(this.backgroundMusic2FadeTime>0?this.fadeOutBackgroundMusic2(this.backgroundMusic2FadeTime,!0):(this.backgroundMusic2.stop(),this.backgroundMusic2.destroy(),this.backgroundMusic2=void 0)),this},fadeInBackgroundMusic2:function(t){return this.backgroundMusic2&&Bo(this.backgroundMusic2,t,this.backgroundMusic2Volume,0),this},fadeOutBackgroundMusic2:function(t,e){return this.backgroundMusic2&&Do(this.backgroundMusic2,t,e),this},crossFadeBackgroundMusic2:function(t,e){var i=this.backgroundMusic2FadeTime;return this.backgroundMusic2FadeTime=0,this.fadeOutBackgroundMusic2(e,!0).playBackgroundMusic2(t).fadeInBackgroundMusic2(e),this.backgroundMusic2FadeTime=i,this},setBackgroundMusic2Mute:function(t){return void 0===t&&(t=!0),this.backgroundMusic2Mute=t,this},setBackgroundMusic2Volume:function(t){return this.backgroundMusic2Volume=t,this},setBackgroundMusic2Rate:function(t){return this.backgroundMusic2&&this.backgroundMusic2.setRate(t),this},setBackgroundMusic2Detune:function(t){return this.backgroundMusic2&&this.backgroundMusic2.setDetune(t),this}},Fo=Phaser.Utils.Array.Remove,Wo=Phaser.Utils.Objects.GetValue,Yo={getSoundEffects:function(){return this.soundEffects},getLastSoundEffect:function(){return this.soundEffects[this.soundEffects.length-1]},playSoundEffect:function(t,e){var i=this.sound.add(t,{mute:Wo(e,"mute",this.soundEffectsMute),volume:Wo(e,"volume",this.soundEffectsVolume),detune:Wo(e,"detune",0),rate:Wo(e,"rate",1)});return this.soundEffects.push(i),i.once("complete",(function(){i.destroy(),this.sound&&Fo(this.soundEffects,i);}),this).once("destroy",(function(){this.sound&&Fo(this.soundEffects,i);}),this).play(),this},stopAllSoundEffects:function(){for(var t=this.soundEffects.length-1;t>=0;t--){var e=this.soundEffects[t];e.stop(),e.destroy();}return this},fadeInSoundEffect:function(t){var e=this.getLastSoundEffect();return e&&Bo(e,t,this.soundEffectsVolume,0),this},fadeOutSoundEffect:function(t,e){var i=this.getLastSoundEffect();return i&&Do(i,t,e),this},fadeOutAllSoundEffects:function(t,e){for(var i=this.soundEffects.length-1;i>=0;i--)Do(this.soundEffects[i],t,e);return this},setSoundEffectMute:function(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:function(t,e){if(void 0===e&&(e=!1),e){var i=this.getLastSoundEffect();i&&i.setVolume(t);}else this.soundEffectsVolume=t;return this},setSoundEffectDetune:function(t,e){var i;void 0===e&&(e=!1);for(var n=0,s=(i=e?[this.getLastSoundEffect()]:this.soundEffects).length;n=0;t--){var e=this.soundEffects[t];e.stop(),e.destroy();}return this},fadeInSoundEffect2:function(t){var e=this.getLastSoundEffect2();return e&&Bo(e,t,this.soundEffects2Volume,0),this},fadeOutSoundEffect2:function(t,e){var i=this.getLastSoundEffect2();return i&&Do(i,t,e),this},fadeOutAllSoundEffects2:function(t,e){for(var i=this.soundEffects2.length-1;i>=0;i--)Do(this.soundEffects2[i],t,e);return this},setSoundEffect2Mute:function(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:function(t,e){if(void 0===e&&(e=!1),e){var i=this.getLastSoundEffect2();i&&i.setVolume(t);}else this.soundEffects2Volume=t;return this},setSoundEffect2Detune:function(t,e){var i;void 0===e&&(e=!1);for(var n=0,s=(i=e?[this.getLastSoundEffect2()]:this.soundEffects2).length;n=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}},{key:"backgroundMusicMute",get:function(){return this._backgroundMusicMute},set:function(t){this._backgroundMusicMute=t,this.backgroundMusic&&this.backgroundMusic.setMute(mute);}},{key:"backgroundMusicVolume",get:function(){return this._backgroundMusicVolume},set:function(t){this._backgroundMusicVolume=t,this.backgroundMusic&&this.backgroundMusic.setVolume(t);}},{key:"backgroundMusic2Mute",get:function(){return this._backgroundMusic2Mute},set:function(t){this._backgroundMusic2Mute=t,this.backgroundMusic2&&this.backgroundMusic2.setMute(mute);}},{key:"backgroundMusic2Volume",get:function(){return this._backgroundMusic2Volume},set:function(t){this._backgroundMusic2Volume=t,this.backgroundMusic2&&this.backgroundMusic2.setVolume(t);}},{key:"soundEffectsMute",get:function(){return this._soundEffectsMute},set:function(t){this._soundEffectsMute=t;for(var e=this.soundEffects,i=0,n=e.length;i2?n-2:0),r=2;r3?s-3:0),o=3;o");this.setDelimiters(i[0],i[1]),this.setTranslateTagNameCallback(bt(e,"translateTagNameCallback")),this.isRunning=!1,this.isPaused=!1,this.skipEventFlag=!1,this.justCompleted=!1,this.lastTagStart=null,this.lastTagEnd=null,this.lastContent=null;}return r(t,[{key:"shutdown",value:function(){this.destroyEventEmitter();}},{key:"destroy",value:function(){this.shutdown();}},{key:"setMultipleLinesTagEnable",value:function(t){return void 0===t&&(t=!0),this.multipleLinesTagEnable=t,this}},{key:"setDelimiters",value:function(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("".concat(t,"(.+?)").concat(e),i),this}},{key:"setTranslateTagNameCallback",value:function(t){return this.translateTagNameCallback=t,this}},{key:"setValueConverter",value:function(t){return !0===t?t=ga:t||(t=ka),this.valueConverter=t,this}},{key:"setLoopEnable",value:function(t){return void 0===t&&(t=!0),this.loopEnable=t,this}},{key:"setSource",value:function(t){return this.source=t,this}},{key:"resetIndex",value:function(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}},{key:"start",value:function(t){return this.setSource(t).restart(),this}},{key:"restart",value:function(){this.resetIndex().next();}},{key:"next",value:function(){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");return s.setDelimiters(r[0],r[1]),s}return r(i,[{key:"setTagExpression",value:function(t){return t||(t=ba),this.tagExpression=t,this}},{key:"setValueExpression",value:function(t){return t||(t=ba),this.valueExpression=t,this}},{key:"setDelimiters",value:function(t,e){p(h(i.prototype),"setDelimiters",this).call(this,t,e);var n="(".concat(this.tagExpression,")(=(").concat(this.valueExpression,"))?");if(this.reTag=RegExp(n,"i"),this.tagExpression!==ba||this.valueExpression!==ba){var s="".concat(this.tagExpression,"(=").concat(this.valueExpression,")?"),r="/".concat(this.tagExpression);t=qi(this.delimiterLeft),e=qi(this.delimiterRight);var o=this.multipleLinesTagEnable?"gs":"gi";this.reSplit=RegExp("".concat(t,"((").concat(s,")|(").concat(r,"))").concat(e),o);}return this}},{key:"onTag",value:function(t){var e=t.match(this.reTag),i=e[1],n="/"===i.charAt(0);if(n&&(i=i.substring(1,i.length)),this.translateTagNameCallback&&(i=this.translateTagNameCallback(i)),this.skipEventFlag=!1,n)this.emit("-".concat(i)),this.skipEventFlag||this.emit("-",i),this.lastTagEnd=i;else {var s=function(t,e){if(null==t)return [];void 0===e&&(e=ga);for(var i=t.split(","),n=0,s=i.length;n1?s-1:0),o=1;o1&&-1!==e.indexOf("|")?e.split("|"):[e]).length;r0){var o=this.timeline.addTimer({name:Ph,target:s,duration:r.duration,yoyo:r.yoyo,onStart:r.onStart,onProgress:r.onProgress,onComplete:r.onComplete});this.skipTypingAnimation&&o.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&&((i=a).type===rs&&" "===i.text));else if(n+=this.speed+e,e=0,n>0){this.typingTimer=this.timeline.addTimer({name:"delay",target:this,duration:n,onComplete:function(e,i,n){e.typingTimer=void 0,t.call(e,n.remainder);}});break}}else fs(s)&&s.exec();}this.minSizeEnable&&this.textPlayer.setToMinSize(),this.inTypingProcessLoop=!1;},pause:function(){return this.timeline.pause(),this},resume:function(){return this.timeline.resume(),this},pauseTyping:function(){return this.isTypingPaused||(this.typingTimer?(this.typingTimer.pause(),this.isTypingPaused=!0):this.inTypingProcessLoop&&(this.inTypingProcessLoop=!1,this.isTypingPaused=!0)),this},resumeTyping:function(t){return this.isTypingPaused?(void 0===t&&(t=0),this.typingTimer?(this.isTypingPaused=!1,this.typingTimer.resume(),this.typingTimer.remainder+=t):this.isTypingPaused&&(this.isTypingPaused=!1,this.typing(t)),this):this},wait:function(t){return this.ignoreWait||(this.pauseTyping(),_h(this.textPlayer,t,this.resumeTyping,this)),this},setIgnoreWait:function(t){return void 0===t&&(t=!0),this.ignoreWait=t,this},setSkipSpaceEnable:function(t){return void 0===t&&(t=!0),this.skipSpaceEnable=t,this},setSkipTypingAnimation:function(t){if(void 0===t&&(t=!0),this.skipTypingAnimation=t,t)for(var e=this.timeline.getTimers(Ph),i=0,n=e.length;i0&&o.chainAnimation(i,n);},Xh=function(t){var e,i,n=k(t);e=n[0],i=n.slice(1);var s=this.getGameObjectManager(e);s.stopAnimation.apply(s,m(i));},Gh=function(t){var e,i,n=k(t);e=n[0],i=n.slice(1);var s=this.getGameObjectManager(e);s.pauseAnimation.apply(s,m(i));},Uh=function(t){var e,i,n=k(t);e=n[0],i=n.slice(1);var s=this.getGameObjectManager(e);s.chainAnimation.apply(s,m(i));},Hh=[function(t,e,i){var n=i.name;e.on("+",(function(i){if(!e.skipEventFlag){var s,r=i.split(".");if(Yh(r,n)){s=r[1];for(var o=arguments.length,a=new Array(o>1?o-1:0),h=1;h0)){var a=this.getGameObjectManager(e);a.hasMethod(i,n)?a.call.apply(a,[i,n].concat(m(s))):a.setProperty(i,n,s[0]);}},Qh={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},tl=function(t){var e,i,n,s,r,o,a,h,l=y(t,8);e=l[0],i=l[1],n=l[2],s=l[3],r=l[4],o=l[5],a=l[6],h=l[7];var u=this.getGameObjectManager(e),c=u.getProperty(i,n);if("number"==typeof c){h.endsWith("Left")||h.endsWith("Up")?h.startsWith("to")||h.startsWith("yoyo")?s=c-s:h.startsWith("from")&&(u.setProperty(i,n,c-s),s=c):h.endsWith("Right")||h.endsWith("Down")?h.startsWith("to")||h.startsWith("yoyo")?s=c+s:h.startsWith("from")&&(u.setProperty(i,n,c+s),s=c):"from"===h&&(u.setProperty(i,n,s),s=c);var d=h.startsWith("yoyo");u.easeProperty(i,n,s,r,o,a,d);}},el=[function(t,e,i){var n=i.name;e.on("+",(function(i){if(!e.skipEventFlag){var s,r=i.split(".");if(Kh(r,n)){s=r[1];for(var o=arguments.length,a=new Array(o>1?o-1:0),h=1;h1?a-1:0),l=1;l0)return gl.length=0,!0;return gl.length=0,!1},gl=[],yl=void 0,kl=Phaser.Utils.Objects.GetValue,ml=function(t,e,i){var n,s;for(var r in void 0===i&&(i={}),t)n=t[r],void 0!==(s=kl(e,r,n[1]))&&(i[n[0]]=s);return i},bl=function(t){t.addEventListener("touchstart",xl,!1),t.addEventListener("touchmove",xl,!1),t.addEventListener("touchend",xl,!1),t.addEventListener("mousedown",xl,!1),t.addEventListener("mouseup",xl,!1),t.addEventListener("mousemove",xl,!1);},xl=function(t){t.stopPropagation();},Cl=Phaser.Utils.Objects.GetValue,wl={open:function(){return this.isOpened||this.readOnly||((t=this)!==yl&&(void 0!==yl&&yl.close(),yl=t),this.isOpened=!0,this.node||(this.node=function(t,e){var i,n=Cl(e,"inputType",void 0);void 0===n&&(n=Cl(e,"type","text")),"textarea"===n?(i=document.createElement("textarea")).style.resize="none":(i=document.createElement("input")).type=n;var s=Cl(e,"style",void 0),r=i.style;ml(dl,s,r),r.position="absolute",r.opacity=0,r.pointerEvents="none",r.zIndex=0,r.transform="scale(0)",ml(cl,e,i),bl(i);var o=t.scene.sys.scale;return (o.isFullscreen?o.fullscreenTarget:document.body).appendChild(i),i}(this,this.nodeConfig)),this.setFocus(),this.initText(),this.enterCloseEnable&&this.scene.input.keyboard.once("keydown-ENTER",this.close,this),this.scene.sys.events.on("postupdate",this.updateText,this),this.scene.input.on("pointerdown",this.onClickOutside,this),this.onOpenCallback&&this.onOpenCallback(this.parent,this),this.emit("open",this)),this;var t;},close:function(){return this.isOpened?(this===yl&&(yl=void 0),this.setBlur(),this.isOpened=!1,this.updateText(),this.scene.sys.events.off("postupdate",this.updateText,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),this):this}},Sl=Phaser.Utils.Objects.GetValue,Pl=function(t){a(i,t);var e=d(i);function i(t,s){var r;n(this,i),r=e.call(this,t);var o=Sl(s,"inputType",void 0);void 0===o&&(o=Sl(s,"type","text")),r.setEnterCloseEnable(Sl(s,"enterClose","textarea"!==o));var a=Sl(s,"onOpen",void 0);a||(a=Sl(s,"onFocus",void 0)),r.onOpenCallback=a;var h=Sl(s,"onClose",void 0);return h||(h=Sl(s,"onBlur",void 0)),r.onCloseCallback=h,r.onUpdateCallback=Sl(s,"onUpdate",void 0),r.isOpened=!1,t.on("pointerdown",(function(){this.open();}),u(r)).setInteractive(),r.nodeConfig=function(t){void 0===t&&(t={});var e={};return fl(t,e,"inputType"),fl(t,e,"type"),fl(t,e,"style"),fl(t,e,dl),fl(t,e,cl),e}(s),r.node=void 0,r}return r(i,[{key:"destroy",value:function(){this.close(),p(h(i.prototype),"destroy",this).call(this);}},{key:"onClickOutside",value:function(t){pl(this.parent,t)||this.close();}},{key:"setEnterCloseEnable",value:function(t){return void 0===t&&(t=!0),this.enterCloseEnable=t,this}},{key:"initText",value:function(){}},{key:"updateText",value:function(){}},{key:"text",get:function(){return this.node?this.node.value:""},set:function(t){this.node&&(this.node.value=t);}},{key:"setText",value:function(t){return this.text=t,this}},{key:"maxLength",get:function(){return this.nodeConfig.maxLength},set:function(t){this.nodeConfig.maxLength=t,this.node&&(this.node.maxLength=t);}},{key:"setMaxLength",value:function(t){return this.maxLength=t,this}},{key:"minLength",get:function(){return this.nodeConfig.minLength},set:function(t){this.nodeConfig.minLength=t,this.node&&(this.node.minLength=t);}},{key:"setMinLength",value:function(t){return this.minLength=t,this}},{key:"placeholder",get:function(){return this.node.placeholder},set:function(t){this.node&&(this.node.placeholder=t);}},{key:"setPlaceholder",value:function(t){return this.placeholder=t,this}},{key:"selectText",value:function(t,e){return this.node?(void 0===t?this.node.select():this.node.setSelectionRange(t,e),this):this}},{key:"selectAll",value:function(){return this.selectText(),this}},{key:"selectionStart",get:function(){return this.node?this.node.selectionStart:0}},{key:"selectionEnd",get:function(){return this.node?this.node.selectionEnd:0}},{key:"selectedText",get:function(){if(!this.node)return "";var t=this.node;return t.value.substring(t.selectionStart,t.selectionEnd)}},{key:"cursorPosition",get:function(){return this.node?this.node.selectionStart:0},set:function(t){this.node&&this.node.setSelectionRange(t,t);}},{key:"setCursorPosition",value:function(t){return void 0===t?t=this.text.length:t<0&&(t=this.text.length+t),this.cursorPosition=t,this}},{key:"tooltip",get:function(){return this.node?this.node.title:""},set:function(t){if(!this.node)return this;this.node.title=t;}},{key:"setTooltip",value:function(t){return this.tooltip=t,this}},{key:"setTextChangedCallback",value:function(t){return this.onTextChanged=t,this}},{key:"readOnly",get:function(){return this.nodeConfig.readOnly},set:function(t){this.nodeConfig.readOnly=t,this.node&&(this.node.readOnly=t);}},{key:"setReadOnly",value:function(t){return void 0===t&&(t=!0),this.readOnly=t,this}},{key:"spellCheck",get:function(){return this.node?this.node.spellcheck:""},set:function(t){this.node&&(this.node.spellcheck=t);}},{key:"setSpellCheck",value:function(t){return this.spellCheck=t,this}},{key:"fontColor",get:function(){if(this.node)return this.node.style.color},set:function(t){this.node&&(this.node.style.color=t);}},{key:"setFontColor",value:function(t){return this.fontColor=t,this}},{key:"setStyle",value:function(t,e){return this.node?(this.node.style[t]=e,this):this}},{key:"getStyle",value:function(t){if(this.node)return this.node.style[t]}},{key:"scrollToBottom",value:function(){return this.node?(this.node.scrollTop=this.node.scrollHeight,this):this}},{key:"setEnabled",value:function(t){return this.node?(void 0===t&&(t=!0),this.node.disabled=!t,this):this}},{key:"setBlur",value:function(){return this.node?(this.node.blur(),this):this}},{key:"setFocus",value:function(){return this.node?(this.node.focus(),this):this}},{key:"isFocused",get:function(){return this.isOpened}}]),i}(ro);Object.assign(Pl.prototype,wl);var Tl=function(t,e,i){t=t.replace(" ","");var n=i.previousText;if(t===n)return t;if(isNaN(t)){i.emit("nan",t,i),t=n;var s=i.cursorPosition-1;i.setText(t),i.setCursorPosition(s);}else i.previousText=t;return t},Ol=function(t){var e=t.prevSelectionStart;if(null!==e){for(var i=t.prevSelectionEnd,n=t.parent,s=e;s=s&&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!=n&&(s=e.getCharChild(n))&&("\n"===s.text&&s.copyTextSize(e.lastInsertCursor),s.scrollTo(),e.emit("cursorin",s,n,e)),e.emit("movecursor",n,t.prevCursorPosition,e),t.prevCursorPosition=n;}}(this)):(Ol(this),Ml(this)),this}},{key:"setNumberInput",value:function(){return this.onUpdateCallback=Tl,this}},{key:"setSelectAllWhenFocusEnable",value:function(t){return void 0===t&&(t=!0),this.selectAllWhenFocus=t,this}}]),i}(Pl),Rl=Phaser.Utils.Objects.GetValue,Ll=["inputType","onOpen","onFocus","onClose","onBlur","onUpdate","enterClose","readOnly","maxLength","minLength","selectAll"],Bl=function(t,e){if(t&&"number"!=typeof t){if(t.hasOwnProperty(e))return !0;if(-1!==e.indexOf(".")){for(var i=e.split("."),n=t,s=0;st.length?i:t})),l.value=t.join(c);}else l.value=t.join(i.slice(a,a+l.count));a+=l.count,l.added||(h+=l.count);}}var d=e[o-1];return o>1&&"string"==typeof d.value&&(d.added||d.removed)&&t.equals("",d.value)&&(e[o-2].value+=d.value,e.pop()),e}Fl.prototype={diff:function(t,e){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=i.callback;"function"==typeof i&&(n=i,i={}),this.options=i;var s=this;function r(t){return n?(setTimeout((function(){n(void 0,t);}),0),!0):t}t=this.castInput(t),e=this.castInput(e),t=this.removeEmpty(this.tokenize(t));var o=(e=this.removeEmpty(this.tokenize(e))).length,a=t.length,h=1,l=o+a;i.maxEditLength&&(l=Math.min(l,i.maxEditLength));var u=[{newPos:-1,components:[]}],c=this.extractCommon(u[0],e,t,0);if(u[0].newPos+1>=o&&c+1>=a)return r([{value:this.join(e),count:e.length}]);function d(){for(var i=-1*h;i<=h;i+=2){var n=void 0,l=u[i-1],c=u[i+1],d=(c?c.newPos:0)-i;l&&(u[i-1]=void 0);var f=l&&l.newPos+1=o&&d+1>=a)return r(Wl(s,n.components,e,t,s.useLongestToken));u[i]=n;}else u[i]=void 0;}var v;h++;}if(n)!function t(){setTimeout((function(){if(h>l)return n();d()||t();}),0);}();else for(;h<=l;){var f=d();if(f)return f}},pushComponent:function(t,e,i){var n=t[t.length-1];n&&n.added===e&&n.removed===i?t[t.length-1]={count:n.count+1,added:e,removed:i}:t.push({count:1,added:e,removed:i});},extractCommon:function(t,e,i,n){for(var s=e.length,r=i.length,o=t.newPos,a=o-n,h=0;o+10,o=0,a=e.length;o0;this.dirty=this.dirty||this._radiusTL!==t||this._convexTL!==e,this._convexTL=e,this._radiusTL=Math.abs(t);}},{key:"radiusTR",get:function(){return this._radiusTR},set:function(t){var e=t>0;this.dirty=this.dirty||this._radiusTR!==t||this._convexTR!==e,this._convexTR=e,this._radiusTR=Math.abs(t);}},{key:"radiusBL",get:function(){return this._radiusBL},set:function(t){var e=t>0;this.dirty=this.dirty||this._radiusBL!==t||this._convexBL!==e,this._convexBL=e,this._radiusBL=Math.abs(t);}},{key:"radiusBR",get:function(){return this._radiusBR},set:function(t){var e=t>0;this.dirty=this.dirty||this._radiusBR!==t||this._convexBR!==e,this._convexBR=e,this._radiusBR=Math.abs(t);}},{key:"radius",get:function(){return Math.max(this.radiusTL,this.radiusTR,this.radiusBL,this.radiusBR)},set:function(t){"number"==typeof t?(this.radiusTL=t,this.radiusTR=t,this.radiusBL=t,this.radiusBR=t):(this.radiusTL=Hu(t,"tl",0),this.radiusTR=Hu(t,"tr",0),this.radiusBL=Hu(t,"bl",0),this.radiusBR=Hu(t,"br",0));}},{key:"setRadius",value:function(t){return void 0===t&&(t=0),this.radius=t,this}},{key:"iterations",get:function(){return this._iterations},set:function(t){this.dirty=this.dirty||this._iterations!==t,this._iterations=t;}},{key:"setIterations",value:function(t){return this.iterations=t,this}},{key:"updateData",value:function(){var t=this.pathData;t.length=0;var e,n=this.width,s=this.height,r=this.iterations+1;(e=this.radiusTL)>0?this._convexTL?Gt(e,e,e,e,180,270,!1,r,t):Gt(0,0,e,e,90,0,!0,r,t):Vt(0,0,t);(e=this.radiusTR)>0?this._convexTR?Gt(n-e,e,e,e,270,360,!1,r,t):Gt(n,0,e,e,180,90,!0,r,t):Vt(n,0,t);(e=this.radiusBR)>0?this._convexBR?Gt(n-e,s-e,e,e,0,90,!1,r,t):Gt(n,s,e,e,270,180,!0,r,t):Vt(n,s,t);(e=this.radiusBL)>0?this._convexBL?Gt(e,s-e,e,e,90,180,!1,r,t):Gt(0,s,e,e,360,270,!0,r,t):Vt(0,s,t);return t.push(t[0],t[1]),Ou(this.x,this.y,t),p(h(i.prototype),"updateData",this).call(this),this}}]),i}(vu),Ku=Phaser.Renderer.WebGL.Utils.getTintAppendFloatAlpha,Ju=function(t){a(i,t);var e=d(i);function i(t,s,r,o,a,h){var l;return n(this,i),void 0===t&&(t=0),void 0===s&&(s=0),void 0===r&&(r=0),void 0===o&&(o=0),void 0===a&&(a=0),void 0===h&&(h=0),(l=e.call(this)).pathData=[],l.closePath=!0,l.setP0(t,s),l.setP1(r,o),l.setP2(a,h),l}return r(i,[{key:"x0",get:function(){return this._x0},set:function(t){this.dirty=this.dirty||this._x0!==t,this._x0=t;}},{key:"y0",get:function(){return this._y0},set:function(t){this.dirty=this.dirty||this._y0!==t,this._y0=t;}},{key:"setP0",value:function(t,e){return this.x0=t,this.y0=e,this}},{key:"x1",get:function(){return this._x1},set:function(t){this.dirty=this.dirty||this._x1!==t,this._x1=t;}},{key:"y1",get:function(){return this._y1},set:function(t){this.dirty=this.dirty||this._y1!==t,this._y1=t;}},{key:"setP1",value:function(t,e){return this.x1=t,this.y1=e,this}},{key:"x2",get:function(){return this._x2},set:function(t){this.dirty=this.dirty||this._x2!==t,this._x2=t;}},{key:"y2",get:function(){return this._y2},set:function(t){this.dirty=this.dirty||this._y2!==t,this._y2=t;}},{key:"setP2",value:function(t,e){return this.dirty=this.dirty||this.x2!==t||this.y2!==e,this.x2=t,this.y2=e,this}},{key:"updateData",value:function(){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),p(h(i.prototype),"updateData",this).call(this),this}},{key:"webglRender",value:function(t,e,i,n,s){if(this.isFilled){var r=Ku(this.fillColor,this.fillAlpha*i),o=this.x0-n,a=this.y0-s,h=this.x1-n,l=this.y1-s,u=this.x2-n,c=this.y2-s,d=e.getX(o,a),f=e.getY(o,a),p=e.getX(h,l),v=e.getY(h,l),g=e.getX(u,c),y=e.getY(u,c);t.batchTri(d,f,p,v,g,y,r,r,r);}this.isStroked&&Kt(t,this,i,n,s);}},{key:"canvasRender",value:function(t,e,i){var n=this.x1-e,s=this.y1-i,r=this.x2-e,o=this.y2-i,a=this.x3-e,h=this.y3-i;t.beginPath(),t.moveTo(n,s),t.lineTo(r,o),t.lineTo(a,h),t.closePath(),this.isFilled&&(Zt(t,this),t.fill()),this.isStroked&&(qt(t,this),t.stroke());}}]),i}(fu),Zu={buildShapes:function(){this.addShape((new Nu).setName("box")).addShape((new Xu).setName("checker"));},updateShapes:function(){var t=this.width/2,e=this.height/2,i=Math.min(t,e),n=2*i,s=t-i,r=e-i,o=this.boxLineWidth,a=Math.max(n/10,2),h=this.getShape("box"),l=this.getShape("checker");if(this.isSizeChanged){var u=n*(1-this.boxSize)/2,c=o/2,d=n*this.boxSize-o;h.setTopLeftPosition(s+c+u,r+c+u).setSize(d,d),this.isCircleShape?h.setRadius(d/2):h.setRadius(0);u=n*(1-this.checkerSize)/2;var f=n*this.checkerSize/4,p=1*f,v=2*f,g=3*f;l.startAt(p,v).lineTo(v,g).lineTo(g,p).offset(s+u,r+u).end();}this.checked?(h.fillStyle(this.boxFillColor,this.boxFillAlpha).lineStyle(o,this.boxStrokeColor,this.boxStrokeAlpha),l.lineStyle(a,this.checkerColor)):(h.fillStyle(this.uncheckedBoxFillColor,this.uncheckedBoxFillAlpha).lineStyle(o,this.uncheckedBoxStrokeColor,this.uncheckedBoxStrokeAlpha),l.lineStyle()),this.checked&&l.setDisplayPathSegment(this.checkerAnimProgress);}},qu=Phaser.Utils.Objects.GetValue,$u=Phaser.Math.Linear,Qu=function(t){a(i,t);var e=d(i);function i(t,s){var r;return n(this,i),(r=e.call(this,t,s)).resetFromJSON(),r.boot(),r}return r(i,[{key:"start",value:function(t){if(this.timer.isRunning)return this;var e=this.target;this.propertyKey=qu(t,"key","value");var n=e[this.propertyKey];return this.fromValue=qu(t,"from",n),this.toValue=qu(t,"to",n),this.setEase(qu(t,"ease",this.ease)),this.setDuration(qu(t,"duration",this.duration)),this.setRepeat(qu(t,"repeat",0)),this.setDelay(qu(t,"delay",0)),this.setRepeatDelay(qu(t,"repeatDelay",0)),this.timer.setDuration(this.duration).setRepeat(this.repeat).setDelay(this.delay).setRepeatDelay(this.repeatDelay),e[this.propertyKey]=this.fromValue,p(h(i.prototype),"start",this).call(this),this}},{key:"updateGameObject",value:function(t,e){var i=e.t;i=this.easeFn(i),t[this.propertyKey]=$u(this.fromValue,this.toValue,i);}}]),i}(Po),tc={setCheckerAnimationDuration:function(t){return void 0===t&&(t=0),this.checkerAnimDuration=t,this},playCheckerAnimation:function(){return void 0===this.checkerAnimProgressTask&&(this.checkerAnimProgressTask=new Qu(this,{eventEmitter:null})),this.checkerAnimProgressTask.restart({key:"checkerAnimProgress",from:0,to:1,duration:this.checkerAnimDuration}),this},stopCheckerAnimation:function(){return void 0===this.checkerAnimProgressTask||this.checkerAnimProgressTask.stop(),this}},ec={};Object.assign(ec,cu,{setBoxSize:function(t){return this.dirty=this.dirty||this.boxSize!==t,this.boxSize=t,this},setCheckerSize:function(t){return this.dirty=this.dirty||this.checkerSize!==t,this.checkerSize=t,this}},Zu,tc);var ic=Phaser.Utils.Objects.GetValue,nc=Phaser.Utils.Objects.IsPlainObject,sc=23730,rc=function(t){a(i,t);var e=d(i);function i(t,s,r,o,a,h,l){var u;n(this,i),nc(s)?(s=ic(l=s,"x",0),r=ic(l,"y",0),o=ic(l,"width",2),a=ic(l,"height",2),h=ic(l,"color",sc)):nc(h)&&(h=ic(l=h,"color",sc)),(u=e.call(this,t,s,r,o,a)).type="rexCheckbox",void 0===h&&(h=sc),u.setBoxShape(ic(l,"circleBox",!1)),u.setBoxFillStyle(h,ic(l,"boxFillAlpha",1)),u.setUncheckedBoxFillStyle(ic(l,"uncheckedColor",null),ic(l,"uncheckedBoxFillAlpha",1)),u.setBoxStrokeStyle(ic(l,"boxLineWidth",4),ic(l,"boxStrokeColor",h),ic(l,"boxStrokeAlpha",1)),u.setUncheckedBoxStrokeStyle(u.boxLineWidth,ic(l,"uncheckedBoxStrokeColor",u.boxStrokeColor),ic(l,"uncheckedBoxStrokeAlpha",u.boxStrokeAlpha)),u.setCheckerStyle(ic(l,"checkerColor",16777215),ic(l,"checkerAlpha",1)),u.setBoxSize(ic(l,"boxSize",1)),u.setCheckerSize(ic(l,"checkerSize",1)),u.setCheckerAnimationDuration(ic(l,"animationDuration",150)),u.buildShapes();var c=ic(l,"checked");return void 0===c&&(c=ic(l,"value",!1)),u.setValue(c),u}return r(i,[{key:"value",get:function(){return this._value},set:function(t){t=!!t,this._value!==t&&(this.dirty=!0,this._value=t,t?this.playCheckerAnimation():this.stopCheckerAnimation(),this.emit("valuechange",t));}},{key:"setValue",value:function(t){return this.value=t,this}},{key:"toggleValue",value:function(){return this.setValue(!this.value),this}},{key:"checked",get:function(){return this.value},set:function(t){this.value=t;}},{key:"setChecked",value:function(t){return void 0===t&&(t=!0),this.setValue(t),this}},{key:"toggleChecked",value:function(){return this.toggleValue(),this}},{key:"checkerAnimProgress",get:function(){return this._checkerAnimProgress},set:function(t){this._checkerAnimProgress!==t&&(this._checkerAnimProgress=t,this.dirty=!0);}}]),i}(uu);Object.assign(rc.prototype,ec);var oc=Phaser.Utils.Objects.GetValue,ac=function(t){a(i,t);var e=d(i);function i(t,s){var r;return n(this,i),(r=e.call(this,t,s))._enable=void 0,t.setInteractive(oc(s,"inputConfig",void 0)),r.resetFromJSON(s),r.boot(),r}return r(i,[{key:"resetFromJSON",value:function(t){return this.pointer=void 0,this.lastClickTime=void 0,this.setEnable(oc(t,"enable",!0)),this.setMode(oc(t,"mode",1)),this.setClickInterval(oc(t,"clickInterval",100)),this.setDragThreshold(oc(t,"threshold",void 0)),this}},{key:"boot",value:function(){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);}},{key:"shutdown",value:function(t){this.isShutdown||(this.pointer=null,p(h(i.prototype),"shutdown",this).call(this,t));}},{key:"enable",get:function(){return this._enable},set:function(t){if(this._enable!==t){t||this.cancel(),this._enable=t;var e=t?"enable":"disable";this.emit(e,this,this.parent);}}},{key:"setEnable",value:function(t){return void 0===t&&(t=!0),this.enable=t,this}},{key:"toggleEnable",value:function(){return this.setEnable(!this.enable),this}},{key:"setMode",value:function(t){return "string"==typeof t&&(t=hc[t]),this.mode=t,this}},{key:"setClickInterval",value:function(t){return this.clickInterval=t,this}},{key:"setDragThreshold",value:function(t){return this.dragThreshold=t,this}},{key:"onPress",value:function(t,e,i,n){void 0===this.pointer&&(this.pointer=t,this.emit("down",this,this.parent,t,n),0===this.mode&&this.click(t.downTime,t,n));}},{key:"onRelease",value:function(t,e,i,n){this.pointer===t&&(this.emit("up",this,this.parent,t,n),1===this.mode&&this.click(t.upTime,t,n),this.pointer=void 0);}},{key:"onPointOut",value:function(t,e){this.pointer===t&&this.cancel();}},{key:"onMove",value:function(t,e,i,n){this.pointer===t&&void 0!==this.dragThreshold&&1===this.mode&&t.getDistance()>=this.dragThreshold&&this.cancel();}},{key:"click",value:function(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 n=this.lastClickTime;return void 0!==n&&t-n<=this.clickInterval||(this.lastClickTime=t,this.emit("click",this,this.parent,e,i)),this}},{key:"cancel",value:function(){return this.pointer=void 0,this}},{key:"onOver",value:function(t,e,i,n){return this.enable?(this.emit("over",this,this.parent,t,n),this):this}},{key:"onOut",value:function(t,e){return this.enable?(this.emit("out",this,this.parent,t,e),this):this}}]),i}(ro),hc={press:0,pointerdown:0,release:1,pointerup:1},lc=Phaser.Utils.Objects.GetValue,uc=function(t){a(i,t);var e=d(i);function i(t,s,r,o,a,h,l){var c;return n(this,i),(c=e.call(this,t,s,r,o,a,h,l))._click=new ac(u(c),lc(l,"click")),c._click.on("click",(function(){this.toggleValue();}),u(c)),c.setReadOnly(lc(l,"readOnly",!1)),c}return r(i,[{key:"readOnly",get:function(){return !this._click.enable},set:function(t){this._click.enable=!t;}},{key:"setReadOnly",value:function(t){return void 0===t&&(t=!0),this.readOnly=t,this}}]),i}(rc);T.register("checkbox",(function(t,e,i,n,s,r){var o=new uc(this.scene,t,e,i,n,s,r);return this.scene.add.existing(o),o})),Z(window,"RexPlugins.UI.Checkbox",uc);var cc={setTrackFillStyle:function(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:function(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:function(t,e){return void 0===e&&(e=1),this.dirty=this.dirty||this.thumbColor!==t||this.checkAlpha!==e,this.thumbColor=t,this.thumbAlpha=e,this}},dc={setTrackSize:function(t,e){return this.dirty=this.dirty||this.trackWidth!==t||this.trackHeight!==e,this.trackWidth=t,this.trackHeight=e,this},setTrackRadius:function(t){return this.dirty=this.dirty||this.trackRadius!==t,this.trackRadius=t,this},setThumbSize:function(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:function(t){return this.dirty=this.dirty||this.thumbRadius!==t,this.thumbRadius=t,this}},fc={setThumbPosition:function(t,e){return void 0===e&&(e=1-t),this.thumbLeftX=t,this.thumbRightX=e,this},setRTL:function(t){return void 0===t&&(t=!0),this.rtl=t,this}},pc=function(t,e,i){return (e-t)*i+t},vc=Phaser.Math.Linear,gc={buildShapes:function(){this.addShape((new Nu).setName("track")).addShape((new Nu).setName("thumb"));},updateShapes:function(){var t=this.width,e=this.height,i=this.value?this.toggleAnimProgress:1-this.toggleAnimProgress,n=this.getShape("track");if(this.isSizeChanged){var s=t*this.trackWidth,r=e*this.trackHeight,o=(t-s)/2,a=(e-r)/2,h=e*this.trackRadius;n.setTopLeftPosition(o,a).setSize(s,r).setRadius(h);}var l,u,c,d=(l=this.falseValueTrackColor,u=this.trackFillColor,c=i,(255&pc(gr(l),gr(u),c))<<16|(255&pc(yr(l),yr(u),c))<<8|255&pc(kr(l),kr(u),c)),f=vc(this.falseValueTrackFillAlpha,this.trackFillAlpha,i);n.fillStyle(d,f);var p=this.getShape("thumb");if(this.isSizeChanged){var v=t*this.thumbWidth,g=e*this.thumbHeight,y=e*this.thumbRadius;p.setSize(v,g).setRadius(y);}var k=vc(this.thumbLeftX,this.thumbRightX,i)*t;this.rtl&&(k=t-k);var m=e/2;p.setCenterPosition(k,m),p.fillStyle(this.thumbColor,this.thumbAlpha);}},yc={setToggleAnimationDuration:function(t){return void 0===t&&(t=0),this.toggleAnimDuration=t,this},playToggleAnimation:function(){return void 0===this.toggleAnimProgressTask&&(this.toggleAnimProgressTask=new Qu(this,{eventEmitter:null})),this.toggleAnimProgressTask.restart({key:"toggleAnimProgress",from:0,to:1,duration:this.toggleAnimDuration}),this},stopToggleAnimation:function(){return void 0===this.toggleAnimProgressTask||this.toggleAnimProgressTask.stop(),this}},kc={};Object.assign(kc,cc,dc,fc,gc,yc);var mc=Phaser.Utils.Objects.GetValue,bc=Phaser.Utils.Objects.IsPlainObject,xc=23730,Cc=function(t){a(i,t);var e=d(i);function i(t,s,r,o,a,h,l){var u;n(this,i),bc(s)?(s=mc(l=s,"x",0),r=mc(l,"y",0),o=mc(l,"width",2),a=mc(l,"height",2),h=mc(l,"color",xc)):bc(h)&&(h=mc(l=h,"color",xc)),(u=e.call(this,t,s,r,o,a)).type="rexToggleSwitch",void 0===h&&(h=xc),u.setTrackFillStyle(h,mc(l,"trackFillAlpha",1)),u.setFalseValueTrackFillStyle(mc(l,"falseValueTrackColor",function(t){var e=.3*gr(t)+.59*yr(t)+.11*kr(t);return (255&e)<<16|(255&e)<<8|255&e}(h)),mc(l,"falseValueTrackFillAlpha",1)),u.setThumbStyle(mc(l,"thumbColor",16777215),mc(l,"thumbAlpha",1)),u.setTrackSize(mc(l,"trackWidth",.9),mc(l,"trackHeight",.5)),u.setTrackRadius(mc(l,"trackRadius",.5*u.trackHeight));var c=mc(l,"thumbHeight",void 0),d=mc(l,"thumbWidth",c);return void 0===d&&(d=.9*u.trackHeight),u.setThumbSize(d,c),u.setThumbRadius(mc(l,"thumbRadius",.5*u.thumbHeight)),u.setThumbPosition(mc(l,"thumbLeft",.3),mc(l,"thumbRight",void 0)),u.setRTL(mc(l,"rtl",!1)),u.setToggleAnimationDuration(mc(l,"animationDuration",150)),u.buildShapes(),u.setValue(mc(l,"value",!1),0),u}return r(i,[{key:"value",get:function(){return this._value},set:function(t){t=!!t,this._value!==t&&(this.dirty=!0,this._value=t,this.playToggleAnimation(),this.emit("valuechange",t));}},{key:"setValue",value:function(t,e){void 0===e&&(e=this.toggleAnimDuration);var i=this.toggleAnimDuration;return this.toggleAnimDuration=e,this.value=t,this.toggleAnimDuration=i,this}},{key:"toggleValue",value:function(t){return this.setValue(!this.value,t),this}},{key:"toggleAnimProgress",get:function(){return this._toggleAnimProgress},set:function(t){this._toggleAnimProgress!==t&&(this._toggleAnimProgress=t,this.dirty=!0);}}]),i}(uu);Object.assign(Cc.prototype,kc);var wc=Phaser.Utils.Objects.GetValue,Sc=function(t){a(i,t);var e=d(i);function i(t,s,r,o,a,h,l){var c;return n(this,i),(c=e.call(this,t,s,r,o,a,h,l))._click=new ac(u(c),wc(l,"click")),c._click.on("click",(function(){this.toggleValue();}),u(c)),c.setReadOnly(wc(l,"readOnly",!1)),c}return r(i,[{key:"readOnly",get:function(){return !this._click.enable},set:function(t){this._click.enable=!t;}},{key:"setReadOnly",value:function(t){return void 0===t&&(t=!0),this.readOnly=t,this}}]),i}(Cc);T.register("toggleSwitch",(function(t,e,i,n,s,r){var o=new Sc(this.scene,t,e,i,n,s,r);return this.scene.add.existing(o),o})),Z(window,"RexPlugins.UI.ToggleSwitch",Sc);var Pc={loadFromURL:function(t,e){var i=this,n=new Image;return n.onload=function(){i.width!==n.width||i.height!==n.height?i.resize(n.width,n.height):i.clear(),i.context.drawImage(n,0,0),i.updateTexture(),e&&e(),n.onload=null,n.src="",n.remove();},n.src=t,this},loadFromURLPromise:function(t){var e=this;return new Promise((function(i,n){e.loadFromURL(t,i);}))},loadFromFile:function(t,e){var i=URL.createObjectURL(t);return this.loadFromURL(i,(function(){URL.revokeObjectURL(i),e&&e();})),this},loadFromFilePromise:function(t){var e=this;return new Promise((function(i,n){e.loadFromFile(t,i);}))}},Tc=function(t){a(i,t);var e=d(i);function i(){return n(this,i),e.apply(this,arguments)}return r(i)}(pe);Object.assign(Tc.prototype,Pc),T.register("canvas",(function(t,e,i,n){var s=new Tc(this.scene,t,e,i,n);return this.scene.add.existing(s),s})),Z(window,"RexPlugins.UI.Canvas",Tc);var Oc=Phaser.Utils.Objects.GetValue,Mc=function(t){a(s,t);var e=d(s);function s(t,i,r,o,a,h){var l;return n(this,s),(l=e.call(this,t,i,r)).type="rexCircleMaskImage",l.setTexture(o,a,h),l}return r(s,[{key:"setTexture",value:function(t,e,n){"object"===i(e)&&(n=e,e=void 0),"string"==typeof n&&(n={maskType:n});var s=Oc(n,"maskType",0),r=Oc(n,"backgroundColor",void 0),o=Oc(n,"strokeColor",void 0),a=Oc(n,"strokeWidth",null!=o?10:0);if(void 0===s?s=0:"string"==typeof s&&(s=Ec[s]),this._textureKey=t,this._frameName=e,null===s)return this.loadTexture(t,e),this.dirty=!0,this;var h=this.scene.sys.textures.getFrame(t,e);if(!h)return this;h.cutWidth!==this.width||h.cutHeight!==this.height?this.setCanvasSize(h.cutWidth,h.cutHeight):this.clear();var l=this.canvas,u=this.context,c=l.width,d=l.height;null!=r&&(u.fillStyle=r,u.fillRect(0,0,c,d)),u.save(),u.beginPath();var f=a/2;switch(s){case 1:var p=(k=Math.floor(c/2))-f,v=(m=Math.floor(d/2))-f;u.ellipse(k,m,p,v,0,0,2*Math.PI);break;case 2:var g=Oc(n,"radius",0),y=Oc(n,"iteration",void 0);me(u,f,f,c-a,d-a,g,y);break;default:var k=Math.floor(c/2),m=Math.floor(d/2),b=Math.min(k,m)-f;u.arc(k,m,b,0,2*Math.PI);}return null!=o&&(u.strokeStyle=o,u.lineWidth=a,u.stroke()),u.clip(),this.loadTexture(t,e),u.restore(),this.dirty=!0,this}},{key:"resize",value:function(t,e){return this.setDisplaySize(t,e),this}}]),s}(pe),Ec={circle:0,ellipse:1,roundRectangle:2};T.register("circleMaskImage",(function(t,e,i,n,s){var r=new Mc(this.scene,t,e,i,n,s);return this.scene.add.existing(r),r})),Z(window,"RexPlugins.UI.CircleMaskImage",Mc);var _c=Phaser.Utils.Objects.GetValue,Rc=function(t){a(s,t);var e=d(s);function s(t,i,r,o,a,h){var l;return n(this,s),(l=e.call(this,t,i,r)).type="rexAlphaMaskImage",l.maskFrame=null,l.setTexture(o,a,h),l}return r(s,[{key:"setTexture",value:function(t,e,n){"object"===i(e)&&(n=e,e=void 0),"string"==typeof n&&(n={mask:{key:n}});var s=_c(n,"mask.key"),r=_c(n,"mask.frame"),o=_c(n,"mask.invertAlpha",!1),a=_c(n,"mask.scale"),h=_c(n,"backgroundColor");if(s){this._maskKey=s,this._maskFrame=r,this._maskScale=a;var l=s?this.scene.sys.textures.get(s):null;this.maskFrame=l?l.get(r):null;}this._textureKey=t,this._frameName=e;var u=this.maskFrame;if(null===u)return this.loadTexture(t,e),this.dirty=!0,this;var c=null!=h;this.loadTexture(t,e);var d,f,p=this.canvas,v=this.context,g=p.width,y=p.height;v.save(),v.globalCompositeOperation=o?"destination-out":"destination-in",null!=this._maskScale?(d=u.cutWidth*this._maskScale,f=u.cutHeight*this._maskScale):(d=g,f=y);var k=(g-d)/2,m=(y-f)/2;return this.drawFrame(this._maskKey,this._maskFrame,k,m,d,f),v.restore(),c&&(v.save(),v.globalCompositeOperation="destination-over",v.fillStyle=h,v.fillRect(0,0,g,y),v.restore()),this.dirty=!0,this}},{key:"resize",value:function(t,e){return this.setDisplaySize(t,e),this}}]),s}(pe);T.register("alphaMaskImage",(function(t,e,i,n,s){var r=new Rc(this.scene,t,e,i,n,s);return this.scene.add.existing(r),r})),Z(window,"RexPlugins.UI.AlphaMaskImage",Rc);var Lc=Phaser.Math.Linear,Bc=Phaser.Math.Percent,Dc={setValue:function(t,e,i){return null==t||(void 0!==e&&(t=Bc(t,e,i)),this.value=t),this},addValue:function(t,e,i){return void 0!==e&&(t=Bc(t,e,i)),this.value+=t,this},getValue:function(t,e){var i=this.value;return void 0!==t&&(i=Lc(t,e,i)),i}},Ic=Phaser.Math.Percent,jc={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=Ic(t,e,i)),void 0===this.easeValueTask&&(this.easeValueTask=new Qu(this,{eventEmitter:null})),this.easeValueTask.restart({key:this.easeValuePropName,to:t,duration:this.easeValueDuration,ease:this.easeFunction})),this},easeValueRepeat:function(t,e,i,n){return void 0===i&&(i=-1),void 0===n&&(n=0),void 0===this.easeValueTask&&(this.easeValueTask=new Qu(this,{eventEmitter:null})),this.easeValueTask.restart({key:this.easeValuePropName,from:t,to:e,duration:this.easeValueDuration,ease:this.easeFunction,repeat:i,repeatDelay:n}),this}},zc=Phaser.Utils.Objects.GetValue,Ac=Phaser.Math.Clamp;function Fc(t){var e=function(t){a(i,t);var e=d(i);function i(){return n(this,i),e.apply(this,arguments)}return r(i,[{key:"bootProgressBase",value:function(t){this.eventEmitter=zc(t,"eventEmitter",this);var e=zc(t,"valuechangeCallback",null);if(null!==e){var i=zc(t,"valuechangeCallbackScope",void 0);this.eventEmitter.on("valuechange",e,i);}return this.setEaseValuePropName("value").setEaseValueDuration(zc(t,"easeValue.duration",0)).setEaseValueFunction(zc(t,"easeValue.ease","Linear")),this}},{key:"value",get:function(){return this._value},set:function(t){t=Ac(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);}}]),i}(t);return Object.assign(e.prototype,Dc,jc),e}var Wc=Phaser.Math.RadToDeg,Yc=Phaser.Math.DegToRad,Vc=function(t,e,i,n,s,r,o,a){var h=360===Math.abs(o-r),l=Yc(r),u=Yc(o),c=Math.cos(l),d=Math.sin(l),f=Math.cos(u),p=Math.sin(u);return t.startAt(e+c*n,i+d*n),t.arc(e,i,n,r,o,a),h&&0===s||(t.lineTo(e+f*s,i+p*s),s>0&&t.arc(e,i,s,o,r,!a)),t.close(),t},Xc={buildShapes:function(){this.addShape((new Xu).setName("track")).addShape((new Xu).setName("bar")).addShape((new ku).setName("center"));},updateShapes:function(){var t=this.radius,e=this.thickness*this.radius,i=this.radius,n=i-e,s=this.getShape("track");null!=this.trackColor&&this.thickness>0?(s.fillStyle(this.trackColor),Vc(s,t,t,i,n,0,360,!1)):s.reset();var r=this.getShape("bar");if(null!=this.barColor&&this.thickness>0){var o,a,h;if(1===this.value)o=!1,a=0,h=360;else o=this.anticlockwise,a=Wc(this.startAngle),h=360*(o?1-this.value:this.value)+a;r.fillStyle(this.barColor),Vc(r,t,t,i,n,a,h,!1);}else r.reset();var l=this.getShape("center");this.centerColor&&n>0?l.setCenterPosition(t,t).setRadius(n).fillStyle(this.centerColor):l.reset();}},Gc=Phaser.Utils.Objects.GetValue,Uc=Phaser.Utils.Objects.IsPlainObject,Hc=Phaser.Math.Clamp,Nc=Phaser.Math.DegToRad(270),Kc=function(t){a(i,t);var e=d(i);function i(t,s,r,o,a,h,l){var u;n(this,i),Uc(s)&&(s=Gc(l=s,"x",0),r=Gc(l,"y",0),o=Gc(l,"radius",1),a=Gc(l,"barColor",void 0),h=Gc(l,"value",0)),void 0===o&&(o=1);var c=2*o;return (u=e.call(this,t,s,r,c,c)).type="rexCircularProgress",u.bootProgressBase(l),u.setRadius(o),u.setTrackColor(Gc(l,"trackColor",void 0)),u.setBarColor(a),u.setCenterColor(Gc(l,"centerColor",void 0)),u.setThickness(Gc(l,"thickness",.2)),u.setStartAngle(Gc(l,"startAngle",Nc)),u.setAnticlockwise(Gc(l,"anticlockwise",!1)),u.buildShapes(),u.setValue(h),u}return r(i,[{key:"resize",value:function(t,e){return (t=Math.floor(Math.min(t,e)))===this.width||(p(h(i.prototype),"resize",this).call(this,t,t),this.setRadius(t/2)),this}},{key:"radius",get:function(){return this._radius},set:function(t){this.dirty=this.dirty||this._radius!=t,this._radius=t;var e=2*t;this.resize(e,e);}},{key:"setRadius",value:function(t){return this.radius=t,this}},{key:"trackColor",get:function(){return this._trackColor},set:function(t){this.dirty=this.dirty||this._trackColor!=t,this._trackColor=t;}},{key:"setTrackColor",value:function(t){return this.trackColor=t,this}},{key:"barColor",get:function(){return this._barColor},set:function(t){this.dirty=this.dirty||this._barColor!=t,this._barColor=t;}},{key:"setBarColor",value:function(t){return this.barColor=t,this}},{key:"startAngle",get:function(){return this._startAngle},set:function(t){this.dirty=this.dirty||this._startAngle!=t,this._startAngle=t;}},{key:"setStartAngle",value:function(t){return this.startAngle=t,this}},{key:"anticlockwise",get:function(){return this._anticlockwise},set:function(t){this.dirty=this.dirty||this._anticlockwise!=t,this._anticlockwise=t;}},{key:"setAnticlockwise",value:function(t){return void 0===t&&(t=!0),this.anticlockwise=t,this}},{key:"thickness",get:function(){return this._thickness},set:function(t){t=Hc(t,0,1),this.dirty=this.dirty||this._thickness!=t,this._thickness=t;}},{key:"setThickness",value:function(t){return this.thickness=t,this}},{key:"centerColor",get:function(){return this._centerColor},set:function(t){this.dirty=this.dirty||this._centerColor!=t,this._centerColor=t;}},{key:"setCenterColor",value:function(t){return this.centerColor=t,this}}]),i}(Fc(uu));Object.assign(Kc.prototype,Xc),T.register("circularProgress",(function(t,e,i,n,s,r){var o=new Kc(this.scene,t,e,i,n,s,r);return this.scene.add.existing(o),o})),Z(window,"RexPlugins.UI.CircularProgress",Kc);var Jc=function(t,e,i,n,s,r,o,a,h,l,u,c){void 0===l&&(l=0),void 0===u&&(u=2*Math.PI),void 0===c&&(c=!1),e.beginPath(),e.ellipse(i,n,s,r,0,l,u,c),null!=o&&(e.fillStyle=o,e.fill()),null!=a&&(e.strokeStyle=a,e.lineWidth=h,e.stroke());},Zc=function(){var t,e=this.radius,i=this.thickness*this.radius,n=this.radius-i/2,s=this.radius-i,r=(this.canvas,this.context);if(this.trackColor&&i>0&&(r.save(),Jc(0,r,e,e,n,n,void 0,this.trackColor,i),r.restore()),this.barColor&&n>0){var o,a,h;if(1===this.value)o=!1,a=0,h=2*Math.PI;else o=this.anticlockwise,a=this.startAngle,h=2*Math.PI*(o?1-this.value:this.value)+a;r.save(),Jc(0,r,e,e,n,n,void 0,this.barColor,i,a,h,o),r.restore();}this.centerColor&&s>0&&(this.centerColor2?((t=this.context.createRadialGradient(e,e,0,e,e,s)).addColorStop(0,this.centerColor),t.addColorStop(1,this.centerColor2)):t=this.centerColor,r.save(),Jc(0,r,e,e,s,s,t),r.restore());this.textFormatCallback&&(this.textColor||this.textStrokeColor)&&(r.save(),function(t,e,i,n,s,r,o,a,h,l,u){void 0===h&&null!=a&&(h=2),void 0===l&&(l="start"),void 0===u&&(u="alphabetic"),e.font=r,e.textAlign=l,e.textBaseline=u,e.fillStyle=o,e.strokeStyle=a,e.lineWidth=h,e.lineCap="round",e.lineJoin="round",null!=a&&"none"!==a&&h>0&&e.strokeText(s,i,n),null!=o&&"none"!==o&&e.fillText(s,i,n);}(0,r,e,e,this.getFormatText(),this.textFont,this.textColor,this.textStrokeColor,this.textStrokeThickness,"center","middle"),r.restore());},qc=Phaser.Utils.Objects.GetValue,$c=Phaser.Utils.Objects.IsPlainObject,Qc=Phaser.Math.Clamp,td=Phaser.Math.DegToRad(270),ed=function(t){a(i,t);var e=d(i);function i(t,s,r,o,a,h,l){var u;n(this,i),$c(s)&&(s=qc(l=s,"x",0),r=qc(l,"y",0),o=qc(l,"radius",1),a=qc(l,"barColor",void 0),h=qc(l,"value",0));var c=2*o;(u=e.call(this,t,s,r,c,c)).type="rexCircularProgressCanvas",u.bootProgressBase(l),u.setRadius(o),u.setTrackColor(qc(l,"trackColor",void 0)),u.setBarColor(a),u.setCenterColor(qc(l,"centerColor",void 0)),u.setThickness(qc(l,"thickness",.2)),u.setStartAngle(qc(l,"startAngle",td)),u.setAnticlockwise(qc(l,"anticlockwise",!1)),u.setTextColor(qc(l,"textColor",void 0)),u.setTextStrokeColor(qc(l,"textStrokeColor",void 0),qc(l,"textStrokeThickness",void 0));var d=qc(l,"textFont",void 0);return d?u.setTextFont(d):u.setTextFont(qc(l,"textSize","16px"),qc(l,"textFamily","Courier"),qc(l,"textStyle","")),u.setTextFormatCallback(qc(l,"textFormatCallback",void 0),qc(l,"textFormatCallbackScope",void 0)),u.setValue(h),u}return r(i,[{key:"resize",value:function(t,e){return (t=Math.floor(Math.min(t,e)))===this.width||(p(h(i.prototype),"resize",this).call(this,t,t),this.setRadius(t/2)),this}},{key:"radius",get:function(){return this._radius},set:function(t){this.dirty=this.dirty||this._radius!=t,this._radius=t;var e=2*t;this.resize(e,e);}},{key:"setRadius",value:function(t){return this.radius=t,this}},{key:"trackColor",get:function(){return this._trackColor},set:function(t){t=ye(t,this.canvas,this.context),this.dirty=this.dirty||this._trackColor!=t,this._trackColor=t;}},{key:"setTrackColor",value:function(t){return this.trackColor=t,this}},{key:"barColor",get:function(){return this._barColor},set:function(t){t=ye(t,this.canvas,this.context),this.dirty=this.dirty||this._barColor!=t,this._barColor=t;}},{key:"setBarColor",value:function(t){return this.barColor=t,this}},{key:"startAngle",get:function(){return this._startAngle},set:function(t){this.dirty=this.dirty||this._startAngle!=t,this._startAngle=t;}},{key:"setStartAngle",value:function(t){return this.startAngle=t,this}},{key:"anticlockwise",get:function(){return this._anticlockwise},set:function(t){this.dirty=this.dirty||this._anticlockwise!=t,this._anticlockwise=t;}},{key:"setAnticlockwise",value:function(t){return void 0===t&&(t=!0),this.anticlockwise=t,this}},{key:"thickness",get:function(){return this._thickness},set:function(t){t=Qc(t,0,1),this.dirty=this.dirty||this._thickness!=t,this._thickness=t;}},{key:"setThickness",value:function(t){return this.thickness=t,this}},{key:"centerColor",get:function(){return this._centerColor},set:function(t){t=ye(t,this.canvas,this.context),this.dirty=this.dirty||this._centerColor!=t,this._centerColor=t;}},{key:"centerColor2",get:function(){return this._centerColor2},set:function(t){t=ye(t,this.canvas,this.context),this.dirty=this.dirty||this._centerColor2!=t,this._centerColor2=t;}},{key:"setCenterColor",value:function(t,e){return this.centerColor=t,this.centerColor2=e,this}},{key:"textColor",get:function(){return this._textColor},set:function(t){t=ye(t,this.canvas,this.context),this.dirty=this.dirty||this._textColor!=t,this._textColor=t;}},{key:"setTextColor",value:function(t){return this.textColor=t,this}},{key:"textStrokeColor",get:function(){return this._textStrokeColor},set:function(t){t=ye(t,this.canvas,this.context),this.dirty=this.dirty||this._textStrokeColor!=t,this._textStrokeColor=t;}},{key:"textStrokeThickness",get:function(){return this._textStrokeThickness},set:function(t){this.dirty=this.dirty||this._textStrokeThickness!=t,this._textStrokeThickness=t;}},{key:"setTextStrokeColor",value:function(t,e){return void 0===e&&(e=2),this.textStrokeColor=t,this.textStrokeThickness=e,this}},{key:"textFont",get:function(){return this._textFont},set:function(t){this.dirty=this.dirty||this._textFont!=t,this._textFont=t;}},{key:"setTextFont",value:function(t,e,i){var n;return n=void 0===e?t:i+" "+t+" "+e,this.textFont=n,this}},{key:"setTextFormatCallback",value:function(t,e){return this.textFormatCallback=t,this.textFormatCallbackScope=e,this}},{key:"updateTexture",value:function(){return this.clear(),Zc.call(this),p(h(i.prototype),"updateTexture",this).call(this),this}},{key:"getFormatText",value:function(t){return void 0===t&&(t=this.value),this.textFormatCallbackScope?this.textFormatCallback(t):this.textFormatCallback.call(this.textFormatCallbackScope,t)}}]),i}(Fc(pe));T.register("circularProgressCanvas",(function(t,e,i,n,s,r){var o=new ed(this.scene,t,e,i,n,s,r);return this.scene.add.existing(o),o})),Z(window,"RexPlugins.UI.CircularProgressCanvas",ed);var id=function(t,e,i,n,s,r){var o=(e+n)/2;return r>=0?t.startAt(o+r,i).lineTo(n+r,i).lineTo(n,s).lineTo(e,s).lineTo(e+r,i).lineTo(o+r,i):t.startAt(o,i).lineTo(n,i).lineTo(n-r,s).lineTo(e-r,s).lineTo(e,i).lineTo(o,i),t},nd=Phaser.Utils.Objects.GetValue,sd=Phaser.Utils.Objects.IsPlainObject,rd=function(t){a(i,t);var e=d(i);function i(t,s,r,o,a,h,l,u){var c;return n(this,i),sd(s)?(s=nd(u=s,"x",0),r=nd(u,"y",0),o=nd(u,"width",2),a=nd(u,"height",2),h=nd(u,"barColor",void 0),l=nd(u,"value",0)):sd(o)?(o=nd(u=o,"width",2),a=nd(u,"height",2),h=nd(u,"barColor",void 0),l=nd(u,"value",0)):sd(h)&&(h=nd(u=h,"barColor",void 0),l=nd(u,"value",0)),(c=e.call(this,t,s,r,o,a,u)).type="rexLineProgress",c.bootProgressBase(u),c.addShape((new Xu).setName("trackFill")).addShape((new Xu).setName("bar")).addShape((new Xu).setName("trackStroke")),c.setTrackColor(nd(u,"trackColor",void 0)),c.setBarColor(h),c.setTrackStroke(nd(u,"trackStrokeThickness",2),nd(u,"trackStrokeColor",void 0)),c.setSkewX(nd(u,"skewX",0)),c.setRTL(nd(u,"rtl",!1)),c.setValue(l),c}return r(i,[{key:"trackColor",get:function(){return this._trackColor},set:function(t){this.dirty=this.dirty||this._trackColor!=t,this._trackColor=t;}},{key:"setTrackColor",value:function(t){return this.trackColor=t,this}},{key:"trackStrokeColor",get:function(){return this._trackStrokeColor},set:function(t){this.dirty=this.dirty||this._trackStrokeColor!=t,this._trackStrokeColor=t;}},{key:"trackStrokeThickness",get:function(){return this._trackStrokeThickness},set:function(t){this.dirty=this.dirty||this._trackStrokeThickness!=t,this._trackStrokeThickness=t;}},{key:"setTrackStroke",value:function(t,e){return this.trackStrokeThickness=t,this.trackStrokeColor=e,this}},{key:"barColor",get:function(){return this._barColor},set:function(t){this.dirty=this.dirty||this._barColor!=t,this._barColor=t;}},{key:"setBarColor",value:function(t){return this.barColor=t,this}},{key:"skewX",get:function(){return this._skewX},set:function(t){this.dirty=this.dirty||this._skewX!=t,this._skewX=t;}},{key:"setSkewX",value:function(t){return this.skewX=t,this}},{key:"rtl",get:function(){return this._rtl},set:function(t){t=!!t,this.dirty=this.dirty||this._rtl!=t,this._rtl=t;}},{key:"setRTL",value:function(t){return void 0===t&&(t=!0),this.rtl=t,this}}]),i}(Fc(uu)),od={updateShapes:function(){var t=this.skewX,e=this.width-Math.abs(t),i=this.height,n=this.getShape("trackFill");n.fillStyle(this.trackColor),n.isFilled&&id(n,0,0,e,i,t).close();var s,r,o=this.getShape("bar");(o.fillStyle(this.barColor),o.isFilled)&&(this.rtl?(s=e*(1-this.value),r=e):(s=0,r=e*this.value),id(o,s,0,r,i,t).close());var a=this.getShape("trackStroke");a.lineStyle(this.trackStrokeThickness,this.trackStrokeColor),a.isStroked&&id(a,0,0,e,i,t).end();}};Object.assign(rd.prototype,od),T.register("lineProgress",(function(t,e,i,n,s,r,o){var a=new rd(this.scene,t,e,i,n,s,r,o);return this.scene.add.existing(a),a})),Z(window,"RexPlugins.UI.LineProgress",rd);var ad=function(t,e,i,n,s,r,o){void 0===o&&(o="round"),function(t,e){t.save(),t.beginPath();var i=e[0];t.moveTo(i.x,i.y);for(var n=1,s=e.length;n0&&(r.save(),ad(0,r,this.trackPoints,void 0,this.trackStrokeColor,this.trackStrokeThickness),r.restore());},ld=function(t,e,i,n,s,r){void 0===r&&(r=[]),r.length=4;for(var o=0;o<4;o++)r[o]||(r[o]={});var a;return s>=0?((a=r[0]).x=t+s,a.y=e,(a=r[1]).x=i+s,a.y=e,(a=r[2]).x=i,a.y=n,(a=r[3]).x=t,a.y=n):((a=r[0]).x=t,a.y=e,(a=r[1]).x=i,a.y=e,(a=r[2]).x=i-s,a.y=n,(a=r[3]).x=t-s,a.y=n),r},ud=Phaser.Utils.Objects.GetValue,cd=Phaser.Utils.Objects.IsPlainObject,dd=function(t){a(i,t);var e=d(i);function i(t,s,r,o,a,h,l,u){var c;return n(this,i),cd(s)?(s=ud(u=s,"x",0),r=ud(u,"y",0),o=ud(u,"width",2),a=ud(u,"height",2),h=ud(u,"barColor",void 0),l=ud(u,"value",0)):cd(o)?(o=ud(u=o,"width",2),a=ud(u,"height",2),h=ud(u,"barColor",void 0),l=ud(u,"value",0)):cd(h)&&(h=ud(u=h,"barColor",void 0),l=ud(u,"value",0)),(c=e.call(this,t,s,r,o,a)).type="rexLineProgressCanvas",c.trackPoints=[],c.barPoints=[],c.bootProgressBase(u),c.setTrackColor(ud(u,"trackColor",void 0)),c.setBarColor(h,ud(u,"barColor2",void 0),ud(u,"isHorizontalGradient",void 0)),c.setTrackStroke(ud(u,"trackStrokeThickness",2),ud(u,"trackStrokeColor",void 0)),c.setSkewX(ud(u,"skewX",0)),c.setRTL(ud(u,"rtl",!1)),c.setValue(l),c}return r(i,[{key:"trackColor",get:function(){return this._trackColor},set:function(t){t=ye(t,this.canvas,this.context),this.dirty=this.dirty||this._trackColor!=t,this._trackColor=t;}},{key:"setTrackColor",value:function(t){return this.trackColor=t,this}},{key:"trackStrokeColor",get:function(){return this._trackStrokeColor},set:function(t){t=ye(t,this.canvas,this.context),this.dirty=this.dirty||this._trackStrokeColor!=t,this._trackStrokeColor=t;}},{key:"trackStrokeThickness",get:function(){return this._trackStrokeThickness},set:function(t){this.dirty=this.dirty||this._trackStrokeThickness!=t,this._trackStrokeThickness=t;}},{key:"setTrackStroke",value:function(t,e){return this.trackStrokeThickness=t,this.trackStrokeColor=e,this}},{key:"barColor",get:function(){return this._barColor},set:function(t){t=ye(t,this.canvas,this.context),this.dirty=this.dirty||this._barColor!=t,this._barColor=t;}},{key:"barColor2",get:function(){return this._barColor2},set:function(t){t=ye(t,this.canvas,this.context),this.dirty=this.dirty||this._barColor2!=t,this._barColor2=t;}},{key:"isHorizontalGradient",get:function(){return this._isHorizontalGradient},set:function(t){this.dirty|=this._isHorizontalGradient!=t,this._isHorizontalGradient=t;}},{key:"setBarColor",value:function(t,e,i){return void 0===i&&(i=!0),this.barColor=t,this.barColor2=e,this.isHorizontalGradient=i,this}},{key:"skewX",get:function(){return this._skewX},set:function(t){this.dirty=this.dirty||this._skewX!=t,this._skewX=t;}},{key:"setSkewX",value:function(t){return this.skewX=t,this}},{key:"rtl",get:function(){return this._rtl},set:function(t){t=!!t,this.dirty=this.dirty||this._rtl!=t,this._rtl=t;}},{key:"setRTL",value:function(t){return void 0===t&&(t=!0),this.rtl=t,this}},{key:"updateTexture",value:function(){return this.clear(),hd.call(this),p(h(i.prototype),"updateTexture",this).call(this),this}}]),i}(Fc(pe));T.register("circularProgressCanvas",(function(t,e,i,n,s,r,o){var a=new dd(this.scene,t,e,i,n,s,r,o);return this.scene.add.existing(a),a})),Z(window,"RexPlugins.UI.LineProgressCanvas",dd),Phaser.Math.Wrap;var fd=Phaser.Math.Linear,pd=function(){var t,e,i,n,s,r,o=this.getShape("triangle"),a=this.padding,h=this.width-a.right,l=0+a.left,u=this.height-a.bottom,c=0+a.top,d=(l+h)/2,f=(c+u)/2,p={0:{a:{x:l,y:c},b:{x:h,y:f},c:{x:l,y:u}},1:{a:{x:l,y:c},b:{x:d,y:u},c:{x:h,y:c}},2:{a:{x:h,y:c},b:{x:l,y:f},c:{x:h,y:u}},3:{a:{x:l,y:u},b:{x:d,y:c},c:{x:h,y:u}}};if(void 0===this.previousDirection){var v=p[this.direction],g=v.a,y=v.b,k=v.c;t=g.x,e=g.y,i=y.x,n=y.y,s=k.x,r=k.y;}else {var m=p[this.previousDirection],b=p[this.direction],x=this.easeDirectionProgress;t=fd(m.a.x,b.a.x,x),e=fd(m.a.y,b.a.y,x),i=fd(m.b.x,b.b.x,x),n=fd(m.b.y,b.b.y,x),s=fd(m.c.x,b.c.x,x),r=fd(m.c.y,b.c.y,x);}o.startAt(t,e).lineTo(i,n).lineTo(s,r),this.arrowOnly?o.end():o.close();},vd=(0, Phaser.Math.DegToRad)(120),gd=function(t){t=this.getShape("triangle");var e=this.width/2,i=this.height/2,n=Math.min(e,i)*this.radius,s=this.verticeRotation;t.startAt(e+n*Math.cos(s+vd),i+n*Math.sin(s+vd)).lineTo(e+n*Math.cos(s),i+n*Math.sin(s)).lineTo(e+n*Math.cos(s-vd),i+n*Math.sin(s-vd)),this.arrowOnly?t.end():t.close();},yd={buildShapes:function(){this.addShape((new Xu).setName("triangle"));},updateShapes:function(){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?pd.call(this):gd.call(this);}},kd={setEaseDuration:function(t){return void 0===t&&(t=0),this.easeDuration=t,this},playEaseDirectionation:function(){return void 0===this.easeDirectionProgressTask&&(this.easeDirectionProgressTask=new Qu(this,{eventEmitter:null})),this.easeDirectionProgressTask.restart({key:"easeDirectionProgress",from:0,to:1,duration:this.easeDuration}),this},stopEaseDirection:function(){return void 0===this.easeDirectionProgressTask||this.easeDirectionProgressTask.stop(),this}},md=Phaser.Utils.Objects.GetValue,bd=Phaser.Utils.Objects.IsPlainObject,xd=Phaser.Math.DegToRad,Cd=Phaser.Math.RadToDeg,wd=function(t){a(s,t);var e=d(s);function s(t,i,r,o,a,h,l){var u,c,d,f,p,v,g,y,k;if(n(this,s),bd(i)){var m=i;i=m.x,r=m.y,o=m.width,a=m.height,h=m.color,l=m.alpha,c=m.strokeColor,d=m.strokeAlpha,f=m.strokeWidth,p=m.arrowOnly,v=m.direction,g=m.easeDuration,y=m.padding,k=m.radius;}return void 0===i&&(i=0),void 0===r&&(r=0),void 0===o&&(o=1),void 0===a&&(a=o),void 0===p&&(p=!1),void 0===v&&(v=0),void 0===g&&(g=0),void 0===y&&(y=0),void 0===k&&(k=void 0),(u=e.call(this,t,i,r,o,a)).type="rexTriangle",u.setFillStyle(h,l),void 0!==c&&void 0===f&&(f=2),u.setStrokeStyle(f,c,d),u.setArrowOnly(p),u.setDirection(v,g),u.setPadding(y),u.setRadius(k),u.buildShapes(),u}return r(s,[{key:"arrowOnly",get:function(){return this._arrowOnly},set:function(t){this.dirty=this.dirty||this._arrowOnly!=t,this._arrowOnly=t;}},{key:"setArrowOnly",value:function(t){return void 0===t&&(t=!0),this.arrowOnly=t,this}},{key:"direction",get:function(){return this._direction},set:function(t){t=Pd(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());}},{key:"setDirection",value:function(t,e){return void 0!==e&&this.setEaseDuration(e),this.direction=t,this}},{key:"toggleDirection",value:function(t){return this.setDirection(this.direction+2,t),this}},{key:"easeDirectionProgress",get:function(){return this._easeDirectionProgress},set:function(t){this._easeDirectionProgress!==t&&(this._easeDirectionProgress=t,this.dirty=!0);}},{key:"setPadding",value:function(t,e,n,s){if("object"===i(t)){var r=t,o=md(r,"x",null);null!==o?(t=o,n=o):(t=md(r,"left",0),n=md(r,"right",t));var a=md(r,"y",null);null!==a?(e=a,s=a):(e=md(r,"top",0),s=md(r,"bottom",e));}else void 0===t&&(t=0),void 0===e&&(e=t),void 0===n&&(n=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!=n||this.padding.bottom!=s,this.padding.left=t,this.padding.top=e,this.padding.right=n,this.padding.bottom=s,this.setRadius(),this}},{key:"radius",get:function(){return this._radius},set:function(t){this.dirty=this.dirty||this._radius!=t,this._radius=t;}},{key:"setRadius",value:function(t){return this.radius=t,this.shapeMode=null==t?0:1,this}},{key:"verticeRotation",get:function(){return this._verticeRotation},set:function(t){this.dirty=this.dirty||this._verticeRotation!=t,this._verticeRotation=t;}},{key:"setVerticeRotation",value:function(t){return this.verticeRotation=t,this}},{key:"verticeAngle",get:function(){return Cd(this.verticeRotation)},set:function(t){this.verticeRotation=xd(t);}},{key:"setVerticeAngle",value:function(t){return this.verticeAngle=t,this}}]),s}(uu),Sd={right:0,down:1,left:2,up:3},Pd=function(t){return "string"==typeof t&&(t=Sd[t]),t%=4};Object.assign(wd.prototype,yd,kd),T.register("triangle",(function(t,e,i,n,s,r){var o=new wd(this.scene,t,e,i,n,s,r);return this.scene.add.existing(o),o})),Z(window,"RexPlugins.UI.Triangle",wd),lt();var Td=Phaser.GameObjects.Zone,Od=Phaser.Utils.Array.Add,Md=Phaser.Utils.Array.Remove,Ed=function(t){a(i,t);var e=d(i);function i(t,s,r,o,a){var h;return n(this,i),void 0===s&&(s=0),void 0===r&&(r=0),void 0===o&&(o=1),void 0===a&&(a=1),(h=e.call(this,t,s,r,o,a)).children=[],h}return r(i,[{key:"destroy",value:function(t){if(this.scene&&!this.ignoreDestroy){if(t)for(var e,n=this.children.length-1;n>=0;n--)(e=this.children[n]).parentContainer||e.displayList||e.destroy(t);this.clear(!t),p(h(i.prototype),"destroy",this).call(this,t);}}},{key:"contains",value:function(t){return -1!==this.children.indexOf(t)}},{key:"add",value:function(t){var e=this;return Od(this.children,t,0,(function(t){t.once("destroy",e.onChildDestroy,e);}),this),this}},{key:"remove",value:function(t,e){var i=this;return Md(this.children,t,(function(t){t.off("destroy",i.onChildDestroy,i),e&&t.destroy();})),this}},{key:"onChildDestroy",value:function(t,e){this.remove(t,!1);}},{key:"clear",value:function(t){for(var e,i=0,n=this.children.length;i0;){var n=i.shift();!e(n)&&n.isRexContainerLite&&i.push.apply(i,m(n.children));}},uf=Phaser.Utils.Array,cf={getChildren:function(t){if(t)for(var e=0,i=this.children.length;e=0;e--)this.remove(this.backgroundChildren[e],t);return this}},Pp=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},Tp=/(\S+)\[(\d+)\]/i,Op={getInnerPadding:function(t){return On(this.space,t)},setInnerPadding:function(t,e){return Mn(this.space,t,e),this},getOuterPadding:function(t){return On(this.getSizerConfig(this).padding,t)},setOuterPadding:function(t,e){return Mn(this.getSizerConfig(this).padding,t,e),this},getChildOuterPadding:function(t,e){return "string"==typeof t&&(t=this.getElement(t)),On(this.getSizerConfig(t).padding,e)},setChildOuterPadding:function(t,e,i){return "string"==typeof t&&(t=this.getElement(t)),Mn(this.getSizerConfig(t).padding,e,i),this}},Mp=function(t){var e=this.childrenWidth,i=void 0!==this.minWidth?this.minWidth:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn("Layout width warn: ".concat(this.constructor.name,"'s minWidth (").concat(i,") < childrenWidth (").concat(e,")"))):this.layoutWarnEnable&&(i>t||e>t)&&console.warn("Layout width warn: ".concat(this.constructor.name,"'s minWidth (").concat(i,") or childrenWidth (").concat(e," > targetWidth ").concat(t,")")),t},Ep=function(t){var e=this.childrenHeight,i=void 0!==this.minHeight?this.minHeight:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn("Layout height warn: ".concat(this.constructor.name,"'s minHeight (").concat(i,") < childrenHeight (").concat(e,")"))):this.layoutWarnEnable&&(i>t||e>t)&&console.warn("Layout height warn: ".concat(this.constructor.name,"'s minHeight (").concat(i,") or childrenHeight (").concat(e,") > targetHeight (").concat(t,")")),t},_p={getShownChildren:function(t){void 0===t&&(t=[]);for(var e,i=this.children,n=0,s=i.length;n0;){var i=e.shift();i.rexSizer&&i.rexSizer.hidden||(i!==this&&t.push(i),i.isRexContainerLite&&e.push.apply(e,m(i.children)));}return t}},Rp=function(){this._childrenWidth=void 0,this._childrenHeight=void 0;for(var t,e=this.getChildrenSizers(),i=0,n=e.length;i0){var e=t.runTransitionInCallback();t.delayCall(e,this.next,this);}else this.next();}},{key:"exit_TRANS_OPNE",value:function(){this.parent.removeDelayCall();}},{key:"next_OPEN",value:function(){return "TRANS_CLOSE"}},{key:"enter_OPEN",value:function(){this.parent.onOpen();}},{key:"exit_OPEN",value:function(){this.parent.removeDelayCall();}},{key:"next_TRANS_CLOSE",value:function(){return "CLOSE"}},{key:"enter_TRANS_CLOSE",value:function(){var t=this.parent;if(t.transitOutTime>0){var e=t.runTransitionOutCallback();t.delayCall(e,this.next,this);}else this.next();}},{key:"exit_TRANS_CLOSE",value:function(){this.parent.removeDelayCall();}},{key:"next_CLOSE",value:function(){return "TRANS_OPNE"}},{key:"enter_CLOSE",value:function(){this.parent.onClose();}},{key:"exit_CLOSE",value:function(){}},{key:"canOpen",value:function(){return "IDLE"===this.state||"CLOSE"===this.state}},{key:"canClose",value:function(){return "IDLE"===this.state||"OPEN"===this.state}}]),i}(jv),Av={delayCall:function(t,e,i){return this.delayCallTimer=function(t,e,i,n,s){var r=no(t);return r.time.delayedCall(e,(function(){r.game.events.once("poststep",(function(){i.call(n,s);}));}))}(this,t,e,i),this},removeDelayCall:function(){return this.delayCallTimer&&(this.delayCallTimer.remove(!1),this.delayCallTimer=void 0),this}},Fv={setTransitInTime:function(t){return this.transitInTime=t,this},setTransitOutTime:function(t){return this.transitOutTime=t,this},setTransitInCallback:function(t){return t||(t=D),this.transitInCallback=t,this},setTransitOutCallback:function(t){return t||(t=D),this.transitOutCallback=t,this}},Wv={runTransitionInCallback:function(){return this.transitInCallback(this.parent,this.transitInTime),this.transitInTime},onOpen:function(){},requestOpen:function(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}},Yv={runTransitionOutCallback:function(){return this.transitOutCallback(this.parent,this.transitOutTime),this.transitOutTime},onClose:function(){this.oneShotMode&&this.parent.destroy();},requestClose:function(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}},Vv={};Object.assign(Vv,Av,Fv,Wv,Yv);var Xv=Phaser.Utils.Objects.GetValue,Gv=function(t){a(i,t);var e=d(i);function i(t,s){var r;return n(this,i),(r=e.call(this,t,s)).setTransitInTime(Xv(s,"duration.in",200)),r.setTransitOutTime(Xv(s,"duration.out",200)),r.setTransitInCallback(Xv(s,"transitIn")),r.setTransitOutCallback(Xv(s,"transitOut")),r.oneShotMode=Xv(s,"destroy",!1),r.delayCallTimer=void 0,r._state=new zv(u(r),{eventEmitter:!1,initState:Xv(s,"initState","IDLE")}),r.openEventData=void 0,r.closeEventData=void 0,r}return r(i,[{key:"state",get:function(){return this._state.state}},{key:"shutdown",value:function(t){this.isShutdown||(this.transitInCallback=void 0,this.transitOutCallback=void 0,this.openEventData=void 0,this.closeEventData=void 0,this.removeDelayCall(),p(h(i.prototype),"shutdown",this).call(this,t));}}]),i}(ro);Object.assign(Gv.prototype,Vv);var Uv=function(t){a(i,t);var e=d(i);function i(t,s,r){var o;return n(this,i),(o=e.call(this,t,0,0,2,2,s,1)).setAlpha(r),o.setScrollFactor(0),o.boot(),o}return r(i,[{key:"boot",value:function(){this.scene.sys.events.on("prerender",this.resize,this);}},{key:"destroy",value:function(t){this.scene&&!this.ignoreDestroy&&(this.scene.sys.events.off("prerender",this.resize,this),p(h(i.prototype),"destroy",this).call(this,t));}},{key:"tint",get:function(){return this.fillColor},set:function(t){this.setFillStyle(t,this.fillAlpha);}},{key:"resize",value:function(){var t=this.scene,e=t.sys.scale.gameSize,i=t.sys.cameras.main,n=e.width,s=e.height,r=1/i.zoom,o=n/2,a=s/2,h=n*r,l=s*r;this.x===o&&this.y===a||this.setPosition(o,a),this.width===h&&this.height===l||this.setSize(h,l).setOrigin(.5);}}]),i}(Phaser.GameObjects.Rectangle),Hv=Phaser.Utils.Objects.GetValue,Nv=function(t){a(i,t);var e=d(i);function i(t,s){var r;return n(this,i),(r=e.call(this,t,{eventEmitter:!1})).resetFromJSON(s),r.boot(),r}return r(i,[{key:"resetFromJSON",value:function(t){return this.setHitAreaMode(Hv(t,"hitAreaMode",0)),this.setEnable(Hv(t,"enable",!0)),this.setStopMode(Hv(t,"stopAllLevels",!0)),this}},{key:"boot",value:function(){this.parent.on("pointerdown",(function(t,e,i,n){this.stopAllLevels&&n.stopPropagation();}),this).on("pointerup",(function(t,e,i,n){this.stopAllLevels&&n.stopPropagation();}),this).on("pointermove",(function(t,e,i,n){this.stopAllLevels&&n.stopPropagation();}),this).on("pointerover",(function(t,e,i,n){this.stopAllLevels&&n.stopPropagation();}),this).on("pointerout",(function(t,e){this.stopAllLevels&&e.stopPropagation();}),this);}},{key:"setHitAreaMode",value:function(t){"string"==typeof t&&(t=Kv[t]);var e=this.parent;return e.input&&e.removeInteractive(),0===t?e.setInteractive():e.setInteractive({hitArea:{},hitAreaCallback:function(){return !0}}),this}},{key:"setEnable",value:function(t){return void 0===t&&(t=!0),t?this.parent.setInteractive():this.parent.disableInteractive(),this.enable=t,this}},{key:"setStopMode",value:function(t){return void 0===t&&(t=!0),this.stopAllLevels=t,this}},{key:"toggleEnable",value:function(){return this.setEnable(!this.enable),this}}]),i}(ro),Kv={default:0,fullWindow:1},Jv=Phaser.Utils.Objects.GetValue,Zv=function(t){a(i,t);var e=d(i);function i(t,s){var r;n(this,i);var o=Jv(s,"color",0),a=Jv(s,"alpha",.8);return (r=e.call(this,t,o,a)).touchEventStop=new Nv(u(r),{hitAreaMode:1}),r}return r(i)}(Uv),qv=function(t,e){void 0!==t._modalScaleSave?(t.scaleX=t._modalScaleSave,t.scaleY=t._modalScaleSave):t._modalScaleSave=t.scaleX,Fp(t,e);},$v=function(t,e){Wp(t,e,void 0,void 0,!1);},Qv=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Zp(t,e);},tg=function(t,e){qp(t,e,!1);},eg=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Zp(t,e,t.alpha);},ig=function(t,e){qp(t,e,!1);},ng=function(t,e,i,n,s){return !!t&&(!(n&&!n(t,e,i))&&(!!Dr(t,!0).contains(e,i)&&!(s&&!s(t,e,i))))},sg=Phaser.Utils.Objects.GetValue,rg=function(t){a(i,t);var e=d(i);function i(t,s){var r;n(this,i),void 0===s&&(s={}),null==s.transitIn&&(s.transitIn=og.popUp),null==s.transitOut&&(s.transitOut=og.scaleDown),s.destroy=sg(s,"destroy",!0),r=e.call(this,t,s);var o=sg(s,"cover");r.cover=!1!==o?function(t,e){var i=t.scene,n=new Zv(i,e);return i.add.existing(n),t.isRexContainerLite?(t.pin(n,{syncPosition:!1,syncRotation:!1,syncScale:!1,syncAlpha:!1,syncScrollFactor:!1}),t.moveDepthBelow(n)):i.children.moveBelow(n,t),n}(t,o):void 0,r.cover&&(r.setCoverTransitInCallback(sg(o,"transitIn",eg)),r.setCoverTransitOutCallback(sg(o,"transitOut",ig)));var a=sg(s,"touchOutsideClose",!1),h=sg(s,"duration.hold",-1),l=sg(s,"timeOutClose",h>=0),c=sg(s,"anyTouchClose",!1);return sg(s,"manualClose",!1)&&(a=!1,c=!1,l=!1),c&&(a=!1),l?r.setDisplayTime(h):r.setDisplayTime(-1),c?r.once("open",r.anyTouchClose,u(r)):a&&r.once("open",r.touchOutsideClose,u(r)),sg(s,"openOnStart",!0)&&r.delayCall(0,r.requestOpen,u(r)),r}return r(i,[{key:"shutdown",value:function(t){this.isShutdown||(this.cover||this.scene.input.off("pointerup",this.touchCloseCallback,this),this.cover&&!t&&(this.cover.destroy(),this.cover=void 0),p(h(i.prototype),"shutdown",this).call(this,t));}},{key:"touchOutsideClose",value:function(){return this.cover?this.cover.on("pointerup",this.touchCloseCallback,this):this.scene.input.on("pointerup",this.touchCloseCallback,this),this.clickOutsideTest=!0,this}},{key:"anyTouchClose",value:function(){return this.cover?this.cover.once("pointerup",this.touchCloseCallback,this):this.scene.input.once("pointerup",this.touchCloseCallback,this),this}},{key:"touchCloseCallback",value:function(t){this.clickOutsideTest&&ng(this.parent,t.worldX,t.worldY)||this.requestClose();}},{key:"runTransitionInCallback",value:function(){var t=p(h(i.prototype),"runTransitionInCallback",this).call(this),e=this.cover;return e&&this.coverTransitInCallback&&this.coverTransitInCallback(e,t),t}},{key:"runTransitionOutCallback",value:function(){var t=p(h(i.prototype),"runTransitionOutCallback",this).call(this),e=this.cover;return e&&this.coverTransitOutCallback&&this.coverTransitOutCallback(e,t),t}},{key:"onOpen",value:function(){var t=this.displayTime;t>=0&&this.delayCall(t,this.requestClose,this),this.emit("open",this.parent,this),p(h(i.prototype),"onOpen",this).call(this);}},{key:"onClose",value:function(){this.emit("close",this.closeEventData),p(h(i.prototype),"onClose",this).call(this);}},{key:"setDisplayTime",value:function(t){return this.displayTime=t,this}},{key:"setTransitInCallback",value:function(t){switch("string"==typeof t&&(t=og[t]),t){case og.popUp:t=qv;break;case og.fadeIn:t=Qv;}return p(h(i.prototype),"setTransitInCallback",this).call(this,t),this}},{key:"setTransitOutCallback",value:function(t){switch("string"==typeof t&&(t=og[t]),t){case og.scaleDown:t=$v;break;case og.fadeOut:t=tg;}return p(h(i.prototype),"setTransitOutCallback",this).call(this,t),this}},{key:"setCoverTransitInCallback",value:function(t){return this.coverTransitInCallback=t,this}},{key:"setCoverTransitOutCallback",value:function(t){return this.coverTransitOutCallback=t,this}}]),i}(Gv),og={popUp:0,fadeIn:1,scaleDown:0,fadeOut:1},ag=function(t,e){var i=new rg(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},hg=function(t,e){t.emit("modal.requestClose",e);},lg=function(t){return t&&"function"==typeof t},ug={modal:function(t,e){return lg(t)&&(e=t,t=void 0),void 0===this._modalBehavior&&(this.onCreateModalBehavior&&this.onCreateModalBehavior(this,t),this._modalBehavior=ag(this,t)),e&&this._modalBehavior.once("close",e),this._modalBehavior.requestOpen(),this},modalPromise:function(t){var e=this;return new Promise((function(i,n){e.modal(t,i);}))},modalClose:function(t){return hg(this,t),this}},cg=function(t,e,i,n){if(e)return ng(t,e.worldX,e.worldY,i,n);for(var s=t.scene.input.manager,r=s.pointersTotal,o=s.pointers,a=0;a=this.dragThreshold||this.isPointerInside(t))&&this.cancel();}},{key:"click",value:function(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}},{key:"cancel",value:function(){return this.pointer=void 0,this}}]),i}(ro),Og={press:0,pointerdown:0,release:1,pointerup:1},Mg={onClickOutside:function(t,e,i,n){return t?("function"==typeof t&&(n=i,i=e,e=t,t=this),void 0===t._clickOutside&&(t._clickOutside=new Tg(t,n)),t._clickOutside.on("clickoutside",e,i),this):this},offClickOutside:function(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:function(t,e){return t&&"object"!==i(t)&&(e=t,t=this),void 0===t._clickOutside||t._clickOutside.setEnable(e),this},disableClickOutside:function(t){return t&&"object"!==i(t)&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(!1),this}},Eg=function(t){a(i,t);var e=d(i);function i(){var t;return n(this,i),(t=e.call(this,{eventEmitter:!1})).goto("IDLE"),t}return r(i,[{key:"setCooldownTime",value:function(t){return this.cooldownTime=t,this.cooldownMode=void 0!==t,this}},{key:"request",value:function(){return this.runMethod("request")}},{key:"update_IDLE",value:function(){this.compensationTime=0;}},{key:"request_IDLE",value:function(){return this.next(),!0}},{key:"next_IDLE",value:function(){if(this.cooldownMode)return "COOLDOWN"}},{key:"enter_COOLDOWN",value:function(){this.remainderTime=this.cooldownTime+this.compensationTime;}},{key:"update_COOLDOWN",value:function(t,e){this.remainderTime-=e,this.remainderTime<0&&(this.compensationTime=this.cooldownTime>e?-this.remainderTime:0,this.goto("IDLE"));}},{key:"request_COOLDOWN",value:function(){return !1}}]),i}(jv),_g=Phaser.Utils.Objects.GetValue,Rg=function(t){a(i,t);var e=d(i);function i(t,s){var r;return n(this,i),(r=e.call(this,t,s))._enable=void 0,r.cooldown=new Eg,r.parent.setInteractive(_g(s,"inputConfig",void 0)),r.resetFromJSON(s),r.boot(),r}return r(i,[{key:"resetFromJSON",value:function(t){return this.pointer=void 0,this.prevIsInTouch=!1,this.isInTouching=!1,this.setEnable(_g(t,"enable",!0)),this.setCooldown(_g(t,"cooldown",void 0)),this}},{key:"boot",value:function(){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);}},{key:"shutdown",value:function(t){this.isShutdown||(this.scene.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,p(h(i.prototype),"shutdown",this).call(this,t));}},{key:"enable",get:function(){return this._enable},set:function(t){if(this._enable!==t)return t||(this.prevIsInTouch=!1,this.isInTouching=!1,this.pointer=void 0),this._enable=t,this}},{key:"setEnable",value:function(t){return void 0===t&&(t=!0),this.enable=t,this}},{key:"cooldownTime",get:function(){return this.cooldown.cooldownTime},set:function(t){this.cooldown.setCooldownTime(t);}},{key:"setCooldown",value:function(t){return this.cooldownTime=t,this}},{key:"toggleEnable",value:function(){return this.setEnable(!this.enable),this}},{key:"onPointIn",value:function(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.pointer=t,this.isInTouching=!0);}},{key:"onPointOut",value:function(t){this.enable&&this.pointer===t&&(this.pointer=void 0,this.isInTouching=!1);}},{key:"preupdate",value:function(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;}}]),i}(ro),Lg={isPointerInBounds:function(t){return void 0===t?t=this:"string"==typeof t&&(t=this.getElement(t)),!!t&&cg(t)},onTouching:function(t,e,i,n){return t?("function"==typeof t&&(n=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new Rg(t,n)),t._inTouching.on("intouch",e,i),this):this},offTouching:function(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:function(t,e,i,n){return t?("function"==typeof t&&(n=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new Rg(t,n)),t._inTouching.on("touchend",e,i),this):this},offTouchingEnd:function(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:function(t,e){return t&&"object"!==i(t)&&(e=t,t=this),void 0===t._inTouching||t._inTouching.setEnable(e),this},disableTouching:function(t){return t&&"object"!==i(t)&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(!1),this}},Bg=function(t,e,i){for(var n,s=0,r=t.length;s0),this.onDragStart()));}},{key:"onPointerUp",value:function(t){this.enable&&((!this.bounds||this.bounds.contains(t.x,t.y))&&this.pointer===t&&(this.pointer=void 0,this.movedState=!1,this.tracerState=Jg,this.onDragEnd()));}},{key:"onPointerMove",value:function(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()));}}},{key:"dragCancel",value:function(){return this.tracerState===Zg&&this.onDragEnd(),this.pointer=void 0,this.tracerState=Jg,this}},{key:"onDragStart",value:function(){this.emit("dragstart",this);}},{key:"onDragEnd",value:function(){this.emit("dragend",this);}},{key:"onDrag",value:function(){this.emit("drag",this);}},{key:"preUpdate",value:function(t,e){}},{key:"postUpdate",value:function(t,e){}},{key:"startTicking",value:function(){p(h(i.prototype),"startTicking",this).call(this),this.scene.sys.events.on("preupdate",this.preUpdate,this),this.scene.sys.events.on("postupdate",this.postUpdate,this);}},{key:"stopTicking",value:function(){p(h(i.prototype),"stopTicking",this).call(this),this.scene&&(this.scene.sys.events.off("preupdate",this.preUpdate,this),this.scene.sys.events.off("postupdate",this.postUpdate,this));}},{key:"setRecongizedStateObject",value:function(t){return this.recongizedState=t,this}},{key:"state",get:function(){return this.recongizedState.state},set:function(t){this.recongizedState.state=t;}},{key:"cancel",value:function(){return this.state=qg,this}}]),i}(ao),Jg=0,Zg=1,qg="IDLE",$g=Phaser.Utils.Objects.GetValue,Qg=Phaser.Math.Distance.Between,ty=function(t){a(i,t);var e=d(i);function i(t,s){var r;n(this,i);var o=u(r=e.call(this,t,s)),a={states:{IDLE:{enter:function(){o.stop(),o.tapsCount=0,o.x=0,o.y=0,o.worldX=0,o.worldY=0;},exit:function(){var t=o.lastPointer;o.x=t.x,o.y=t.y,o.worldX=t.worldX,o.worldY=t.worldY;}},BEGIN:{enter:function(){o.start(),o.tapsCount=0,o.emit("tappingstart",o,o.gameObject,o.lastPointer);}},RECOGNIZED:{enter:function(){o.start(),o.emit("tap",o,o.gameObject,o.lastPointer),o.emit("".concat(o.tapsCount,"tap"),o,o.gameObject,o.lastPointer);}}},init:function(){this.state=ey;},eventEmitter:!1};return r.setRecongizedStateObject(new jv(a)),r}return r(i,[{key:"resetFromJSON",value:function(t){p(h(i.prototype),"resetFromJSON",this).call(this,t),this.setHoldTime($g(t,"time",250)),this.setTapInterval($g(t,"tapInterval",200)),this.setDragThreshold($g(t,"threshold",9)),this.setTapOffset($g(t,"tapOffset",10));var e=$g(t,"taps",void 0);return void 0!==e?this.setTaps(e):(this.setMaxTaps($g(t,"maxTaps",void 0)),this.setMinTaps($g(t,"minTaps",void 0))),this}},{key:"onDragStart",value:function(){switch(this.state){case ey:this.state=iy;break;case iy:var t=this.lastPointer;Qg(t.upX,t.upY,t.x,t.y)>this.tapOffset&&(this.state=ny,this.state=iy);break;case ny:this.state=iy;}}},{key:"onDragEnd",value:function(){this.state===iy&&(this.tapsCount++,this.emit("tapping",this,this.gameObject,this.lastPointer),void 0!==this.maxTaps&&this.tapsCount===this.maxTaps&&(this.state=ny));}},{key:"onDrag",value:function(){this.state!==ey&&this.pointer.getDistance()>this.dragThreshold&&(this.state=ey);}},{key:"preUpdate",value:function(t,e){if(this.isRunning&&this.enable&&this.state===iy){var i=this.lastPointer;if(i.isDown)t-i.downTime>this.holdTime&&(this.state=ey);else t-i.upTime>this.tapInterval&&(void 0===this.minTaps||this.tapsCount>=this.minTaps?this.state=ny:this.state=ey);}}},{key:"postUpdate",value:function(t,e){this.isRunning&&this.enable&&this.state===ny&&(this.state=ey);}},{key:"isTapped",get:function(){return this.state===ny}},{key:"setHoldTime",value:function(t){return this.holdTime=t,this}},{key:"setTapInterval",value:function(t){return this.tapInterval=t,this}},{key:"setDragThreshold",value:function(t){return this.dragThreshold=t,this}},{key:"setTapOffset",value:function(t){return this.tapOffset=t,this}},{key:"setMaxTaps",value:function(t){return this.maxTaps=t,this}},{key:"setMinTaps",value:function(t){return this.minTaps=t,this}},{key:"setTaps",value:function(t,e){return void 0===e&&(e=t),this.setMinTaps(t).setMaxTaps(e),this}}]),i}(Kg),ey="IDLE",iy="BEGIN",ny="RECOGNIZED",sy=Phaser.Utils.Objects.GetValue,ry=function(t){a(i,t);var e=d(i);function i(t,s){var r;n(this,i);var o=u(r=e.call(this,t,s)),a={states:{IDLE:{enter:function(){o.x=0,o.y=0,o.worldX=0,o.worldY=0;},exit:function(){var t=o.lastPointer;o.x=t.x,o.y=t.y,o.worldX=t.worldX,o.worldY=t.worldY;}},BEGIN:{enter:function(){o.start();},exit:function(){o.stop();}},RECOGNIZED:{enter:function(){o.emit("pressstart",o,o.gameObject,o.lastPointer);},exit:function(){o.emit("pressend",o,o.gameObject,o.lastPointer);}}},init:function(){this.state=oy;},eventEmitter:!1};return r.setRecongizedStateObject(new jv(a)),r}return r(i,[{key:"resetFromJSON",value:function(t){return p(h(i.prototype),"resetFromJSON",this).call(this,t),this.setDragThreshold(sy(t,"threshold",9)),this.setHoldTime(sy(t,"time",251)),this}},{key:"onDragStart",value:function(){this.state=ay,0===this.holdTime&&(this.state=hy);}},{key:"onDragEnd",value:function(){this.state=oy;}},{key:"onDrag",value:function(){this.state!==oy&&this.pointer.getDistance()>this.dragThreshold&&(this.state=oy);}},{key:"preUpdate",value:function(t,e){this.isRunning&&this.enable&&(this.state===ay&&t-this.pointer.downTime>=this.holdTime&&(this.state=hy));}},{key:"isPressed",get:function(){return this.state===hy}},{key:"setHoldTime",value:function(t){return this.holdTime=t,this}},{key:"setDragThreshold",value:function(t){return this.dragThreshold=t,this}}]),i}(Kg),oy="IDLE",ay="BEGIN",hy="RECOGNIZED",ly=Phaser.Utils.Objects.GetValue,uy=function(t){a(i,t);var e=d(i);function i(t,s){var r;n(this,i);var o=u(r=e.call(this,t,s)),a={states:{IDLE:{},BEGIN:{enter:function(){var t=o.pointer;o.startX=t.x,o.startY=t.y,o.startWorldX=t.worldX,o.startWorldY=t.worldY;}},RECOGNIZED:{enter:function(){o.emit("panstart",o,o.gameObject,o.lastPointer);},exit:function(){var t=o.lastPointer;o.endX=t.x,o.endY=t.y,o.endWorldX=t.worldX,o.endWorldY=t.worldY,o.emit("panend",o,o.gameObject,o.lastPointer);}}},init:function(){this.state=cy;},eventEmitter:!1};return r.setRecongizedStateObject(new jv(a)),r}return r(i,[{key:"resetFromJSON",value:function(t){return p(h(i.prototype),"resetFromJSON",this).call(this,t),this.setDragThreshold(ly(t,"threshold",10)),this}},{key:"onDragStart",value:function(){this.state=dy,0===this.dragThreshold&&(this.state=fy);}},{key:"onDragEnd",value:function(){this.state=cy;}},{key:"onDrag",value:function(){switch(this.state){case dy:this.pointer.getDistance()>=this.dragThreshold&&(this.state=fy);break;case fy:var t=this.pointer.position,e=this.pointer.prevPosition;this.dx=t.x-e.x,this.dy=t.y-e.y;var i=this.pointer;this.x=i.x,this.y=i.y,this.worldX=i.worldX,this.worldY=i.worldY,this.emit("pan",this,this.gameObject,this.lastPointer);}}},{key:"isPanned",get:function(){return this.state===fy}},{key:"setDragThreshold",value:function(t){return this.dragThreshold=t,this}}]),i}(Kg),cy="IDLE",dy="BEGIN",fy="RECOGNIZED",py=Phaser.Math.Distance.Between,vy=Phaser.Math.Angle.Between,gy={getDt:function(){return eu(this.scene)},getVelocity:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return py(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 vy(e.x,e.y,t.x,t.y)}},yy={"up&down":0,"left&right":1,"4dir":2,"8dir":3},ky={},my=Phaser.Utils.Objects.GetValue,by=Phaser.Math.RadToDeg,xy=function(t){a(i,t);var e=d(i);function i(t,s){var r;n(this,i);var o=u(r=e.call(this,t,s)),a={states:{IDLE:{enter:function(){o.x=0,o.y=0,o.worldX=0,o.worldY=0;},exit:function(){var t=o.lastPointer;o.x=t.x,o.y=t.y,o.worldX=t.worldX,o.worldY=t.worldY;}},BEGIN:{enter:function(){o.validDrag=!1;}},RECOGNIZED:{enter:function(){o.start(),o.updateDirectionStates(),o.emit("swipe",o,o.gameObject,o.lastPointer);},exit:function(){o.stop(),o.clearDirectionStates();}}},init:function(){this.state=Cy;},eventEmitter:!1};return r.setRecongizedStateObject(new jv(a)),r.clearDirectionStates(),r}return r(i,[{key:"resetFromJSON",value:function(t){return p(h(i.prototype),"resetFromJSON",this).call(this,t),this.setDragThreshold(my(t,"threshold",10)),this.setVelocityThreshold(my(t,"velocityThreshold",1e3)),this.setDirectionMode(my(t,"dir","8dir")),this}},{key:"onDragStart",value:function(){this.state=wy;}},{key:"onDragEnd",value:function(){this.state=Cy;}},{key:"onDrag",value:function(){this.state===wy&&(this.validDrag||(this.validDrag=0===this.dragThreshold||this.pointer.getDistance()>=this.dragThreshold),this.validDrag&&this.dragVelocity>this.velocityThreshold&&(this.state=Sy));}},{key:"postUpdate",value:function(t,e){this.isRunning&&this.enable&&this.state===Sy&&(this.state=Cy);}},{key:"isSwiped",get:function(){return this.state===Sy}},{key:"dragVelocity",get:function(){var t;switch(this.dirMode){case 0:t=this.getVelocityY();break;case 1:t=this.getVelocityX();break;default:t=this.getVelocity();}return t}},{key:"setDragThreshold",value:function(t){return this.dragThreshold=t,this}},{key:"setVelocityThreshold",value:function(t){return this.velocityThreshold=t,this}},{key:"setDirectionMode",value:function(t){return "string"==typeof t&&(t=yy[t]),this.dirMode=t,this}},{key:"updateDirectionStates",value:function(){return function(t,e,i){switch(void 0===i?i={}:!0===i&&(i=ky),i.left=!1,i.right=!1,i.up=!1,i.down=!1,t=(t+360)%360,e){case 0:t<180?i.down=!0:i.up=!0;break;case 1:t>90&&t<=270?i.left=!0:i.right=!0;break;case 2:t>45&&t<=135?i.down=!0:t>135&&t<=225?i.left=!0:t>225&&t<=315?i.up=!0:i.right=!0;break;case 3:t>22.5&&t<=67.5?(i.down=!0,i.right=!0):t>67.5&&t<=112.5?i.down=!0:t>112.5&&t<=157.5?(i.down=!0,i.left=!0):t>157.5&&t<=202.5?i.left=!0:t>202.5&&t<=247.5?(i.left=!0,i.up=!0):t>247.5&&t<=292.5?i.up=!0:t>292.5&&t<=337.5?(i.up=!0,i.right=!0):i.right=!0;}}(by(this.getVelocityAngle()),this.dirMode,this),this}},{key:"clearDirectionStates",value:function(){return this.left=!1,this.right=!1,this.up=!1,this.down=!1,this}}]),i}(Kg);Object.assign(xy.prototype,gy);var Cy="IDLE",wy="BEGIN",Sy="RECOGNIZED",Py=Phaser.Utils.Objects.GetValue,Ty=Phaser.Utils.Array.SpliceOne,Oy=Phaser.Math.Distance.Between,My=Phaser.Math.Angle.Between,Ey=function(){function t(e,i){n(this,t);var s=e.input.manager.pointersTotal-1;s<2&&e.input.addPointer(2-s),this.scene=e,this.setEventEmitter(Py(i,"eventEmitter",void 0)),this._enable=void 0,this.pointers=[],this.movedState={},this.resetFromJSON(i),this.boot();}return r(t,[{key:"resetFromJSON",value:function(t){return this.setEnable(Py(t,"enable",!0)),this.bounds=Py(t,"bounds",void 0),this.tracerState=Ry,this.pointers.length=0,xt(this.movedState),this}},{key:"boot",value:function(){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);}},{key:"shutdown",value:function(){this.scene&&(this.destroyEventEmitter(),this.pointers.length=0,xt(this.movedState),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);}},{key:"destroy",value:function(){this.shutdown();}},{key:"enable",get:function(){return this._enable},set:function(t){if(this._enable!==t)return t||this.dragCancel(),this._enable=t,this}},{key:"setEnable",value:function(t){return void 0===t&&(t=!0),this.enable=t,this}},{key:"toggleEnable",value:function(){return this.setEnable(!this.enable),this}},{key:"onPointerDown",value:function(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.tracerState){case Ry:this.tracerState=Ly,this.onDrag1Start();break;case Ly:this.tracerState=By,this.onDrag2Start();}}},{key:"onPointerUp",value:function(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],Ty(this.pointers,e),this.tracerState){case Ly:this.tracerState=Ry,this.onDrag1End();break;case By:this.tracerState=Ly,this.onDrag2End(),this.onDrag1Start();}}}},{key:"onPointerMove",value:function(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 Ly:this.onDrag1();break;case By:this.onDrag2();}}}},{key:"dragCancel",value:function(){return this.tracerState===By&&this.onDrag2End(),this.pointers.length=0,xt(this.movedState),this.tracerState=Ry,this}},{key:"onDrag1Start",value:function(){this.emit("drag1start",this);}},{key:"onDrag1End",value:function(){this.emit("drag1end",this);}},{key:"onDrag1",value:function(){this.emit("drag1",this);}},{key:"onDrag2Start",value:function(){this.emit("drag2start",this);}},{key:"onDrag2End",value:function(){this.emit("drag2end",this);}},{key:"onDrag2",value:function(){this.emit("drag2",this);}},{key:"distanceBetween",get:function(){if(this.tracerState!==By)return 0;var t=this.pointers[0],e=this.pointers[1];return Oy(t.x,t.y,e.x,e.y)}},{key:"angleBetween",get:function(){if(this.tracerState!==By)return 0;var t=this.pointers[0],e=this.pointers[1];return My(t.x,t.y,e.x,e.y)}},{key:"drag1Vector",get:function(){var t=this.pointers[0];if(t&&this.movedState[t.id]){var e=t.position,i=t.prevPosition;_y.x=e.x-i.x,_y.y=e.y-i.y;}else _y.x=0,_y.y=0;return _y}},{key:"centerX",get:function(){if(this.tracerState!==By)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return (t.x+e.x)/2}},{key:"centerY",get:function(){if(this.tracerState!==By)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return (t.y+e.y)/2}},{key:"prevCenterX",get:function(){if(this.tracerState!==By)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}},{key:"prevCenterY",get:function(){if(this.tracerState!==By)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}},{key:"movementCenterX",get:function(){return this.centerX-this.prevCenterX}},{key:"movementCenterY",get:function(){return this.centerY-this.prevCenterY}},{key:"setRecongizedStateObject",value:function(t){return this.recongizedState=t,this}},{key:"state",get:function(){return this.recongizedState.state},set:function(t){this.recongizedState.state=t;}},{key:"cancel",value:function(){return this.state=Dy,this}}]),t}();Object.assign(Ey.prototype,nr);var _y={},Ry=0,Ly=1,By=2,Dy="IDLE",Iy=Phaser.Utils.Objects.GetValue,jy=function(t){a(i,t);var e=d(i);function i(t,s){var r;n(this,i);var o=u(r=e.call(this,t,s)),a={states:{IDLE:{enter:function(){o.prevDistance=void 0,o.scaleFactor=1;}},BEGIN:{},RECOGNIZED:{enter:function(){o.emit("pinchstart",o);},exit:function(){o.emit("pinchend",o);}}},init:function(){this.state=zy;},eventEmitter:!1};return r.setRecongizedStateObject(new jv(a)),r}return r(i,[{key:"resetFromJSON",value:function(t){return p(h(i.prototype),"resetFromJSON",this).call(this,t),this.setDragThreshold(Iy(t,"threshold",0)),this}},{key:"onDrag2Start",value:function(){this.scaleFactor=1,this.prevDistance=this.distanceBetween,this.state=Ay,0===this.dragThreshold&&(this.state=Fy);}},{key:"onDrag2End",value:function(){this.state=zy;}},{key:"onDrag2",value:function(){switch(this.state){case Ay: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=Fy;}break;case Fy:t=this.distanceBetween;this.scaleFactor=t/this.prevDistance,this.emit("pinch",this),this.prevDistance=t;}}},{key:"isPinched",get:function(){return this.state===Fy}},{key:"setDragThreshold",value:function(t){return this.dragThreshold=t,this}}]),i}(Ey),zy="IDLE",Ay="BEGIN",Fy="RECOGNIZED",Wy=Phaser.Math.RotateAround,Yy=function(t,e,i,n){return Wy(t,e,i,n),t.rotation+=n,t},Vy={},Xy=Phaser.Utils.Objects.GetValue,Gy=Phaser.Math.Angle.WrapDegrees,Uy=Phaser.Math.Angle.ShortestBetween,Hy=Phaser.Math.RadToDeg,Ny=Phaser.Math.DegToRad,Ky=function(t){a(i,t);var e=d(i);function i(t,s){var r;n(this,i);var o=u(r=e.call(this,t,s)),a={states:{IDLE:{enter:function(){o.prevAngle=void 0,o.angle=0;}},BEGIN:{},RECOGNIZED:{enter:function(){o.emit("rotatestart",o);},exit:function(){o.emit("rotateend",o);}}},init:function(){this.state=Zy;},eventEmitter:!1};return r.setRecongizedStateObject(new jv(a)),r}return r(i,[{key:"resetFromJSON",value:function(t){return p(h(i.prototype),"resetFromJSON",this).call(this,t),this.setDragThreshold(Xy(t,"threshold",0)),this}},{key:"onDrag2Start",value:function(){this.prevAngle=Gy(Hy(this.angleBetween)),this.state=qy,0===this.dragThreshold&&(this.state=$y);}},{key:"onDrag2End",value:function(){this.state=Zy;}},{key:"onDrag2",value:function(){switch(this.state){case qy:if(this.pointers[0].getDistance()>=this.dragThreshold&&this.pointers[1].getDistance()>=this.dragThreshold){var t=Gy(Hy(this.angleBetween));this.angle=Uy(this.prevAngle,t),this.prevAngle=t,this.state=$y;}break;case $y:t=Gy(Hy(this.angleBetween));this.angle=Uy(this.prevAngle,t),this.prevAngle=t,this.emit("rotate",this);}}},{key:"isRotated",get:function(){return this.state===$y}},{key:"rotation",get:function(){return Ny(this.angle)}},{key:"setDragThreshold",value:function(t){return this.dragThreshold=t,this}}]),i}(Ey),Jy={spinObject:function(t,e){if(!this.isRotation)return this;void 0===e&&(e=this.pointers[0].camera);var i=this.movementCenterX,n=this.movementCenterY,s=function(t,e,i,n){return void 0===n?n={}:!0===n&&(n=Vy),i.getWorldPoint(t,e,n),n}(this.centerX,this.centerY,e,!0),r=s.x,o=s.y,a=this.rotation;if(Array.isArray(t))for(var h=t,l=0,u=h.length;l0?c.pop().setTexture(f,M):r(d,f,M),l&&d.add.existing(O);var E=b+w*T+a*w,_=x+S*P+h*S;u&&(O.setOrigin(a,h).setPosition(E,_).setScale(g,y).setRotation(k),Cm(O,b,x,k)),C.push(O);}return C},Sm={gridCutImage:function(t,e,i,n){void 0===n&&(n={}),n.objectPool=this.imagesPool;for(var s,r=wm(t,e,i,n),o=0,a=r.length;o=0;n--)(o=s[n])instanceof e&&(o.destroy(),Ym(s,n));else {n=0;for(var s,r=(s=t.postPipelines).length;nn&&(i.width=i.height*n),i}(t,{width:this.width,height:this.height},!0);return t.setDisplaySize(e.width,e.height),this.resetChildScaleState(t),this}},{key:"resize",value:function(t,e){return p(h(i.prototype),"resize",this).call(this,t,e),this.scaleImage(),this}},{key:"setTexture",value:function(t,e){var i=this.image;return i.setTexture(t,e),null!==t?(this.setChildVisible(i,!0),this.scaleImage()):this.setChildVisible(i,!1),this}}]),i}(If);Object.assign(Km.prototype,Pm),T.register("imageBox",(function(t,e,i,n,s){var r=new Km(this.scene,t,e,i,n,s);return this.scene.add.existing(r),r})),Z(window,"RexPlugins.UI.ImageBox",Km),T.register("fullWindowRectangle",(function(t,e){var i=new Uv(this.scene,t,e);return this.scene.add.existing(i),i})),Z(window,"RexPlugins.UI.FullWindowRectangle",Uv),T.register("cover",(function(t){var e=new Zv(this.scene,t);return this.scene.add.existing(e),e})),Z(window,"RexPlugins.UI.Cover",Zv);var Jm=function(t,e){if(this.scene.sys.scale.autoRound&&(t=Math.floor(t),e=Math.floor(e)),this.width===t&&this.height===e)return this;var i=this.node.style;return i.width="".concat(t,"px"),i.height="".concat(e,"px"),this.updateSize(),this},Zm={id:["id",void 0],text:["value",void 0],maxLength:["maxLength",void 0],minLength:["minLength",void 0],placeholder:["placeholder",void 0],tooltip:["title",void 0],readOnly:["readOnly",!1],spellCheck:["spellcheck",!1],autoComplete:["autocomplete","off"]},qm={align:["textAlign",void 0],paddingLeft:["padding-left",void 0],paddingRight:["padding-right",void 0],paddingTop:["padding-top",void 0],paddingBottom:["padding-bottom",void 0],fontFamily:["fontFamily",void 0],fontSize:["font-size",void 0],color:["color","#ffffff"],backgroundColor:["backgroundColor","transparent"],border:["border",0],borderColor:["borderColor","transparent"],outline:["outline","none"],direction:["direction",void 0]},$m={input:"textchange",click:"click",dblclick:"dblclick",mousedown:"pointerdown",mousemove:"pointermove",mouseup:"pointerup",touchstart:"pointerdown",touchmove:"pointermove",touchend:"pointerup",keydown:"keydown",keyup:"keyup",keypress:"keypress",compositionstart:"compositionStart",compositionend:"compositionEnd",compositionupdate:"compositionUpdate",focus:"focus",blur:"blur",select:"select"},Qm=Phaser.Utils.Objects.GetValue,tb=function(t,e,i,n){var s=Qm(n,"preventDefault",!1),r=Qm(n,"preTest"),o=function(n){e.addEventListener(n,(function(e){r&&!r(t,n)||t.emit(i[n],t,e),s&&e.preventDefault();}));};for(var a in i)o(a);},eb=Phaser.GameObjects.DOMElement,ib=Phaser.Utils.Objects.IsPlainObject,nb=Phaser.Utils.Objects.GetValue,sb=function(t){a(i,t);var e=d(i);function i(t,s,r,o,a,h){var l,c;n(this,i),ib(s)?(s=nb(h=s,"x",0),r=nb(h,"y",0),o=nb(h,"width",0),a=nb(h,"height",0)):ib(o)&&(o=nb(h=o,"width",0),a=nb(h,"height",0)),void 0===h&&(h={});var d=nb(h,"inputType",void 0);void 0===d&&(d=nb(h,"type","text")),"textarea"===d?(c=document.createElement("textarea")).style.resize="none":(c=document.createElement("input")).type=d,ml(Zm,h,c);var f=nb(h,"style",void 0);f=ml(qm,h,f);var p=c.style;for(var v in h)v in Zm||v in qm||v in p&&(f[v]=h[v]);return f["box-sizing"]="border-box",(l=e.call(this,t,s,r,c,f)).type="rexInputText",l.resize(o,a),tb(u(l),c,$m),bl(c),nb(h,"selectAll",!1)&&l.selectAll(),l._isFocused=!1,l.on("focus",(function(){this._isFocused=!0;}),u(l)).on("blur",(function(){this._isFocused=!1;}),u(l)),l}return r(i,[{key:"inputType",get:function(){return "textarea"===this.node.tagName.toLowerCase()?"textarea":this.node.type}},{key:"text",get:function(){return this.node.value},set:function(t){this.node.value=t;}},{key:"setText",value:function(t){return this.text=t,this}},{key:"maxLength",get:function(){return this.node.maxLength},set:function(t){this.node.maxLength=t;}},{key:"setMaxLength",value:function(t){return this.maxLength=t,this}},{key:"minLength",get:function(){return this.node.minLength},set:function(t){this.node.minLength=t;}},{key:"setMinLength",value:function(t){return this.minLength=t,this}},{key:"placeholder",get:function(){return this.node.placeholder},set:function(t){this.node.placeholder=t;}},{key:"setPlaceholder",value:function(t){return this.placeholder=t,this}},{key:"selectText",value:function(t,e){return void 0===t?this.node.select():this.node.setSelectionRange(t,e),this}},{key:"selectAll",value:function(){return this.selectText(),this}},{key:"selectionStart",get:function(){return this.node.selectionStart}},{key:"selectionEnd",get:function(){return this.node.selectionEnd}},{key:"selectedText",get:function(){var t=this.node;return t.value.substring(t.selectionStart,t.selectionEnd)}},{key:"cursorPosition",get:function(){return this.node.selectionStart},set:function(t){this.node.setSelectionRange(t,t);}},{key:"setCursorPosition",value:function(t){return void 0===t?t=this.text.length:t<0&&(t=this.text.length+t),this.cursorPosition=t,this}},{key:"tooltip",get:function(){return this.node.title},set:function(t){this.node.title=t;}},{key:"setTooltip",value:function(t){return this.tooltip=t,this}},{key:"setTextChangedCallback",value:function(t){return this.onTextChanged=t,this}},{key:"readOnly",get:function(){return this.node.readOnly},set:function(t){this.node.readOnly=t;}},{key:"setReadOnly",value:function(t){return void 0===t&&(t=!0),this.readOnly=t,this}},{key:"spellCheck",get:function(){return this.node.spellcheck},set:function(t){this.node.spellcheck=t;}},{key:"setSpellCheck",value:function(t){return this.spellCheck=t,this}},{key:"fontColor",get:function(){return this.node.style.color},set:function(t){this.node.style.color=t;}},{key:"setFontColor",value:function(t){return this.fontColor=t,this}},{key:"setStyle",value:function(t,e){return this.node.style[t]=e,this}},{key:"getStyle",value:function(t){return this.node.style[t]}},{key:"scrollToBottom",value:function(){return this.node.scrollTop=this.node.scrollHeight,this}},{key:"setEnabled",value:function(t){return void 0===t&&(t=!0),this.node.disabled=!t,this}},{key:"setBlur",value:function(){return this.node.blur(),this}},{key:"setFocus",value:function(){return this.node.focus(),this}},{key:"isFocused",get:function(){return this._isFocused}}]),i}(eb),rb={resize:Jm};Object.assign(sb.prototype,rb),T.register("inputText",(function(t){var e=new sb(this.scene,t);return this.scene.add.existing(e),e})),Z(window,"RexPlugins.UI.InputText",sb);var ob=Phaser.Utils.Objects.GetValue,ab=function(t,e){return void 0===t&&(t=0),new Promise((function(i,n){setTimeout((function(){i(e);}),t);}))},hb=function(t){var e=t.game,i=t.fileInput,n=t.closeDelay;return wh(X(e).events,"focus").then((function(){return ab(n)})).then((function(){var t={files:i.files};return Promise.resolve(t)}))},lb=Phaser.Utils.Objects.GetValue,ub=function(t){return this.setOrigin(t.originX,t.originY),this.setPosition(t.x,t.y),this.resize(t.displayWidth,t.displayHeight),this},cb=function(t,e,i,n,s,r){if(null===s||!1===s);else if(lg(s))s();else {var o=function(t,e,i){if(void 0===i)switch(e){case"image":case"svg":i="textures";break;case"animation":i="json";break;case"tilemapTiledJSON":case"tilemapCSV":i="tilemap";break;case"glsl":i="shader";break;default:i=e;}return t=X(t),"textures"===i?t.textures:t.cache[i]}(t,i,s);o.exists(n)&&o.remove(n);}var a=t.load;if(r&&a.once("filecomplete-".concat(i,"-").concat(n),(function(t,e,i){r(i);})),lg(e))e();else {var h=window.URL.createObjectURL(e);a[i](n,h);}a.start();},db={loadFile:function(t,e,i,n,s){var r=this.scene;return cb(r,t,e,i,n,s),this},loadFilePromise:function(t,e,i,n){var s=this.scene;return new Promise((function(r,o){cb(s,t,e,i,n,(function(t){r(t);}));}))}},fb=Phaser.GameObjects.DOMElement,pb=Phaser.Utils.Objects.IsPlainObject,vb=Phaser.Utils.Objects.GetValue,gb=function(t){a(i,t);var e=d(i);function i(t,s,r,o,a,h){var l;n(this,i),pb(s)?(s=vb(h=s,"x",0),r=vb(h,"y",0),o=vb(h,"width",0),a=vb(h,"height",0)):pb(o)&&(o=vb(h=o,"width",0),a=vb(h,"height",0));var c=document.createElement("input");c.type="file",c.style.display="none";var d=document.createElement("label");d.appendChild(c);var f=vb(h,"style",void 0);(l=e.call(this,t,s,r,d,f)).type="rexFileChooser",l.resetFromJSON(h),l.resize(o,a);var p=u(l);return c.onchange=function(){p.emit("change",p);},l.setCloseDelay(vb(h,"closeDelay",200)),c.onclick=function(){hb({game:t,fileInput:c,closeDelay:p.closeDelay}).then((function(){p.emit("select",p);}));},l}return r(i,[{key:"resetFromJSON",value:function(t){return this.setAccept(vb(t,"accept","")),this.setMultiple(vb(t,"multiple",!1)),this}},{key:"setAccept",value:function(t){return void 0===t&&(t=""),this.fileInput.setAttribute("accept",t),this}},{key:"setMultiple",value:function(t){return void 0===t&&(t=!0),t?this.fileInput.setAttribute("multiple",""):this.fileInput.removeAttribute("multiple"),this}},{key:"setCloseDelay",value:function(t){return void 0===t&&(t=200),this.closeDelay=t,this}},{key:"fileInput",get:function(){return this.node.children[0]}},{key:"open",value:function(){return this.fileInput.click(),this}},{key:"files",get:function(){return this.fileInput.files}}]),i}(fb),yb={resize:Jm,syncTo:ub};Object.assign(gb.prototype,yb,db),T.register("fileChooser",(function(t){var e=new gb(this.scene,t);return this.scene.add.existing(e),e})),Z(window,"RexPlugins.UI.FileChooser",gb);var kb={setDropEnable:function(t){return void 0===t&&(t=!0),this.dropEnable=t,this},toggleDropEnable:function(){return this.dropEnable=!this.dropEnable,this}},mb={resize:Jm,syncTo:ub};Object.assign(mb,kb,{addFilter:function(t,e){return this.filters||(this.filters={}),this.filters[t]=e,this},addFilters:function(t){for(var e in this.filters||(this.filters={}),t)this.filters[e]=t[e];return this}},db);var bb={dragenter:"dragenter",dragleave:"dragleave",dragover:"dragover",drop:"drop"},xb=Phaser.GameObjects.DOMElement,Cb=Phaser.Utils.Objects.IsPlainObject,wb=Phaser.Utils.Objects.GetValue,Sb=function(t){a(i,t);var e=d(i);function i(t,s,r,o,a,h){var l;n(this,i),Cb(s)?(s=wb(h=s,"x",0),r=wb(h,"y",0),o=wb(h,"width",0),a=wb(h,"height",0)):Cb(o)&&(o=wb(h=o,"width",0),a=wb(h,"height",0)),void 0===h&&(h={});var c=document.createElement("div"),d=wb(h,"style",void 0);(l=e.call(this,t,s,r,c,d)).type="rexFileDropZone",l.resize(o,a),l._files=[],l.setDropEnable(wb(h,"dropEnable",!0));var f=wb(h,"filters");return f&&l.addFilters(f),tb(u(l),c,bb,{preventDefault:!0,preTest:function(t){return t.dropEnable}}),l.on("drop",(function(t,e){this._files=e.dataTransfer.files;var i=this._files;if(i&&this.filters)for(var n in this.filters){for(var s=this.filters[n],r=[],o=0,a=i.length;o0&&this.emit("drop.".concat(n),r);}}),u(l)),l}return r(i,[{key:"files",get:function(){return this._files}}]),i}(xb);Object.assign(Sb.prototype,mb),T.register("fileDropZone",(function(t){var e=new Sb(this.scene,t);return this.scene.add.existing(e),e})),Z(window,"RexPlugins.UI.FileDropZone",Sb);var Pb=function(t){a(i,t);var e=d(i);function i(t,s){var r;return n(this,i),c(r=e.call(this,t),new Proxy(u(r),u(r)))}return r(i,[{key:"get",value:function(t,e){if(hr(t,e))return t[e];var i=t.parent;return hr(i,e)?i[e]:void 0}},{key:"set",value:function(t,e,i){return hr(t,e)?t[e]=i:hr(t.parent,e)&&(t.parent[e]=i),!0}},{key:"key",get:function(){return this.parent.texture.key},set:function(t){this.parent.setTexture(t,this.frame);}},{key:"frame",get:function(){return this.parent.frame.name},set:function(t){this.parent.setFrame(t);}},{key:"scale",get:function(){return this.parent.scaleX},set:function(t){this.parent.setScale(t);}}]),i}(ro),Tb=Phaser.Utils.Objects.GetValue,Ob=function(t){a(i,t);var e=d(i);function i(t,s){var r;n(this,i),(r=e.call(this,t,s)).style=Tb(s,"style",u(r));var o=Tb(s,"propertiesMap");return r.activeStyle=Mb(s,"active",o),r.hoverStyle=Mb(s,"hover",o),r.disableStyle=Mb(s,"disable",o),r.onModifyStyle=Tb(s,"onModifyStyle"),r}return r(i,[{key:"getStyle",value:function(t){return Il(this.style,t)}},{key:"modifyStyle",value:function(t){for(var e in t)this.style[e]=t[e];return this.onModifyStyle&&this.onModifyStyle(this.parent,t),this}},{key:"applyStyle",value:function(t){if(t){var e=this.getStyle(t);return jl(e,t)?void 0:(this.modifyStyle(t),e)}}},{key:"setActiveState",value:function(t){return Eb.call(this,"active",t),this}},{key:"setHoverState",value:function(t){return Eb.call(this,"hover",t),this}},{key:"setDisableState",value:function(t){return Eb.call(this,"disable",t),this}}]),i}(ro),Mb=function(t,e,i){var n=Dl(t,e);if(i)for(var s in n)i.hasOwnProperty(s)&&(n[i[s]]=n[s],delete n[s]);return n},Eb=function(t,e){void 0===e&&(e=!0);var i="".concat(t,"State"),n="".concat(t,"Style"),s="".concat(t,"StyleSave");this[i]!==e&&(this[i]=e,e?this[s]=this.applyStyle(this[n]):(this.applyStyle(this[s]),this[s]=void 0));},_b={addStyleManager:function(t){return this.styleManager=new Ob(this,t),this},setActiveState:function(t){return this.styleManager.setActiveState(t),this},setHoverState:function(t){return this.styleManager.setHoverState(t),this},setDisableState:function(t){return this.styleManager.setDisableState(t),this}},Rb=Phaser.GameObjects.Image,Lb=Phaser.Utils.Objects.GetValue,Bb=function(t){a(i,t);var e=d(i);function i(t,s){var r;n(this,i),void 0===s&&(s={});var o=Lb(s,"x",0),a=Lb(s,"y",0),h=Lb(s,"key",""),l=Lb(s,"frame",void 0);(r=e.call(this,t,o,a,h,l)).type="rexStatesImage";var c=Lb(s,"effects",!0);return c&&fr(u(r),c),r.style=new Pb(u(r),s),s.style=r.style,r.addStyleManager(s),delete s.style,r}return r(i)}(Rb);Object.assign(Bb.prototype,_b),T.register("statesImage",(function(t){var e=new Bb(this.scene,t);return this.scene.add.existing(e),e})),Z(window,"RexPlugins.UI.StatesImage",Bb);var Db=function(t){a(i,t);var e=d(i);function i(t,s){var r;return n(this,i),void 0===s&&(s={}),(r=e.call(this,t,s)).type="rexStatesRoundRectangleShape",s.style=u(r),s.propertiesMap=Ib,r.addStyleManager(s),delete s.style,delete s.propertiesMap,r}return r(i)}(se),Ib={color:"fillColor",alpha:"fillAlpha",strokeWidth:"lineWidth"};Object.assign(Db.prototype,_b),T.register("statesRoundRectangle",(function(t){var e=new Db(this.scene,t);return this.scene.add.existing(e),e})),Z(window,"RexPlugins.UI.StatesRoundRectangle",Db);var jb=function(t){a(i,t);var e=d(i);function i(t,s){var r;return n(this,i),c(r=e.call(this,t),new Proxy(u(r),u(r)))}return r(i,[{key:"get",value:function(t,e){if(hr(t,e))return t[e];var i=t.parent;return hr(i,e)?i[e]:void 0}},{key:"set",value:function(t,e,i){return hr(t,e)?t[e]=i:hr(t.parent,e)&&(t.parent[e]=i),!0}},{key:"key",get:function(){return this.parent.texture.key},set:function(t){this.parent.setTexture(t,this.frame);}},{key:"frame",get:function(){return this.parent.frame.name},set:function(t){this.parent.setFrame(t);}},{key:"leftWidth",get:function(){return this.parent.leftWidth},set:function(t){var e=this.parent;parent.setSlices(e.width,e.height,t,e.rightWidth,e.topHeight,e.bottomHeight);}},{key:"rightWidth",get:function(){return this.parent.rightWidth},set:function(t){var e=this.parent;parent.setSlices(e.width,e.height,e.leftWidth,t,e.topHeight,e.bottomHeight);}},{key:"topHeight",get:function(){return this.parent.topHeight},set:function(t){var e=this.parent;parent.setSlices(e.width,e.height,e.leftWidth,e.rightWidth,t,e.bottomHeight);}},{key:"bottomHeight",get:function(){return this.parent.bottomHeight},set:function(t){var e=this.parent;parent.setSlices(e.width,e.height,e.leftWidth,e.rightWidth,e.topHeight,t);}}]),i}(ro),zb=Phaser.GameObjects.NineSlice,Ab=Phaser.Utils.Objects.GetValue,Fb=function(t){a(i,t);var e=d(i);function i(t,s){var r;n(this,i),void 0===s&&(s={});var o=Ab(s,"x",0),a=Ab(s,"y",0),h=Ab(s,"key",null),l=Ab(s,"frame",null),c=Ab(s,"width",0),d=Ab(s,"height",0),f=Ab(s,"leftWidth",0),p=Ab(s,"rightWidth",0),v=Ab(s,"topHeight",0),g=Ab(s,"bottomHeight",0);(r=e.call(this,t,o,a,h,l,c,d,f,p,v,g)).type="rexStatesNineSlice";var y=Ab(s,"effects",!0);return y&&fr(u(r),y),r.style=new jb(u(r),s),s.style=r.style,r.addStyleManager(s),delete s.style,r}return r(i)}(zb);Object.assign(Fb.prototype,_b),T.register("statesNineSlice",(function(t){var e=new Fb(this.scene,t);return this.scene.add.existing(e),e})),Z(window,"RexPlugins.UI.StatesNineSlice",Fb);var Wb=Phaser.GameObjects.Text,Yb=Phaser.Utils.Objects.GetValue,Vb=function(t){a(i,t);var e=d(i);function i(t,s){var r;n(this,i),void 0===s&&(s={});var o=Yb(s,"x",0),a=Yb(s,"y",0),h=Yb(s,"text","");return (r=e.call(this,t,o,a,h,s)).type="rexStatesText",s.style=r.style,s.onModifyStyle=function(t,e){var i=e.hasOwnProperty("fontStyle")||e.hasOwnProperty("fontSize")||e.hasOwnProperty("fontFamily");t.style.update(i);},r.addStyleManager(s),delete s.style,r}return r(i)}(Wb);Object.assign(Vb.prototype,_b),T.register("statesText",(function(t){var e=new Vb(this.scene,t);return this.scene.add.existing(e),e})),Z(window,"RexPlugins.UI.StatesText",Vb);var Xb=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 n=!1;void 0===i.animation?i.animation={}:!1===i.animation&&(n=!0,i.animation={});var s=i.animation;n&&(s.duration=0);var r=s.onProgress;s.onProgress=function(e){r&&r(e),t.needRedraw();};var o=s.onComplete;return s.onComplete=function(e){o&&o(e),t.needRedraw();},e},Gb=function(t){a(i,t);var e=d(i);function i(t,s,r,o,a,h){var l;return n(this,i),(l=e.call(this,t,s,r,o,a)).type="rexChart",l.chart=void 0,void 0!==h&&l.setChart(h),l}return r(i,[{key:"destroy",value:function(t){this.scene&&(this.chart&&(this.chart.destroy(),this.chart=void 0),p(h(i.prototype),"destroy",this).call(this,t));}},{key:"resize",value:function(t,e){if(t===this.width&&e===this.height)return this;if(p(h(i.prototype),"resize",this).call(this,t,e),this.chart){var n=this.chart;n.height=this.canvas.height,n.width=this.canvas.width,n.aspectRatio=n.height?n.width/n.height:null,n.update();}return this}}]),i}(Tc),Ub={setChart:function(t){if(!window.Chart){return 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}return this.chart&&this.chart.destroy(),this.chart=new Chart(this.context,Xb(this,t)),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,n=0,s=i.length;n(h=0===this.orientation?Math.abs(a.left-t):Math.abs(a.top-e))&&(s=h,n=r);}var h;a=i[i.length-1];return s>(h=0===this.orientation?Math.abs(a.right-t):Math.abs(a.bottom-e))&&(s=h,n=r+1),n},Jb=Phaser.Utils.Objects.IsPlainObject,Zb=Phaser.Utils.Objects.GetValue,qb=Phaser.Display.Align.CENTER,$b={min:0,full:-1},Qb=function(t,e,n,s,r,o,a,h,l,u){gp.call(this,t);var c=t.isRexSpace,d=i(e);if(null===e)return this;if("number"===d);else if("string"===d)e=$b[e];else if(Jb(e)){var f;e=Zb(f=e,"proportion",void 0),n=Zb(f,"align",qb),s=Zb(f,"padding",0),r=Zb(f,"expand",!1),o=Zb(f,"key",void 0),a=Zb(f,"index",void 0),t.isRexSizer||(h=Zb(f,"minWidth",void 0),l=Zb(f,"minHeight",void 0)),u=Zb(f,"fitRatio",0);}return "string"==typeof n&&(n=Af[n]),void 0===e&&(e=c?1:0),void 0===n&&(n=qb),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===h&&(c?h=0:t.isRexSizer||(h=t._minWidth)),void 0===l&&(c?l=0:t.isRexSizer||(l=t._minHeight)),void 0===u&&(u=0),(f=this.getSizerConfig(t)).proportion=e,f.align=n,f.padding=pp(s),f.expand=r,f.fitRatio=0===e?u: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?Er(t):h:t.minHeight=void 0===l?_r(t):l),r&&(0===this.orientation?t.minHeight=l:t.minWidth=h)),void 0!==o&&this.addChildrenMap(o,t),this},tx={add:Qb,addSpace:function(t){return this.insertSpace(void 0,t),this},insertSpace:function(t,e){return void 0===e&&(e=1),Qb.call(this,new Nb(this.scene),{proportion:e,minWidth:0,minHeight:0,index:t}),this},insert:function(t,e,i,n,s,r,o,a){return Jb(i)&&(i.index=t),Qb.call(this,e,i,n,s,r,o,t,a),this},insertAtPosition:function(t,e,i,n,s,r,o,a,h){var l=Kb.call(this,t,e);return -1===l&&(l=void 0),this.insert(l,i,n,s,r,o,a,h),this}},ex=Phaser.Utils.Array.Remove,ix={remove:function(t,e){return this.getParentSizer(t)!==this||(ex(this.sizerChildren,t),bp.call(this,t,e)),this},removeAll:function(t){for(var e=this.sizerChildren.length-1;e>=0;e--)this.remove(this.sizerChildren[e],t);return this},clear:function(t){return this.sizerChildren.length=0,yk.call(this,t),this}},nx={getChildAlign:function(t){return this.getSizerConfig(t).align},setChildAlign:function(t,e){return "string"==typeof e&&(e=Af[e]),this.getSizerConfig(t).align=e,this}},sx={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,n,s=0,r=this.sizerChildren;if(0===this.orientation)for(var o=this.space.item,a=!0,h=0,l=r.length;h0&&this.proportionLength>0&&(i=n.proportion*this.proportionLength):n.expand&&(i=e-this.space.left-this.space.right-s.left-s.right);return i},getExpandedChildHeight:function(t,e){var i;void 0===e&&(e=this.height);var n=t.rexSizer,s=n.padding;0===this.orientation?n.expand&&(i=e-this.space.top-this.space.bottom-s.top-s.bottom):n.proportion>0&&this.proportionLength>0&&(i=n.proportion*this.proportionLength);return i},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,n=0,s=i.length;n0?(e=t-this.getChildrenWidth(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0;}return t},resolveHeight:function(t){t=Ep.call(this,t);if(void 0===this.proportionLength&&1===this.orientation){var e=t-this.childrenHeight;e>0?(e=t-this.getChildrenHeight(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0;}return t}};Object.assign(sx,tx,ix,nx,{getChildProportion:function(t){return this.getSizerConfig(t).proportion},setChildProportion:function(t,e){return this.getSizerConfig(t).proportion=e,this}},{getChildExpand:function(t){return this.getSizerConfig(t).expand},setChildExpand:function(t,e){return this.getSizerConfig(t).expand=e,this}});var rx=function(){for(var t,e,i=0,n=this.sizerChildren,s=0,r=n.length;s0&&(i+=e);return i},ox={x:0,h:0,horizontal:0,"left-to-right":0,y:1,v:1,vertical:1,"top-to-bottom":1},ax=function(t){return "string"==typeof t&&(t=ox[t]),t},hx=Phaser.Utils.Objects.IsPlainObject,lx=Phaser.Utils.Objects.GetValue,ux=function(t){a(i,t);var e=d(i);function i(t,s,r,o,a,h,l){var u;return n(this,i),hx(s)?(s=lx(l=s,"x",0),r=lx(l,"y",0),o=lx(l,"width",void 0),a=lx(l,"height",void 0),h=lx(l,"orientation",0)):hx(o)?(o=lx(l=o,"width",void 0),a=lx(l,"height",void 0),h=lx(l,"orientation",0)):hx(h)&&(h=lx(l=h,"orientation",0)),void 0===h&&(h=0),(u=e.call(this,t,s,r,o,a,l)).type="rexSizer",u.sizerChildren=[],u.setOrientation(h),u.setItemSpacing(lx(l,"space.item",0)),u.setStartChildIndex(lx(l,"startChildIndex",0)),u.setRTL(lx(l,"rtl",!1)),u.addChildrenMap("items",u.sizerChildren),u}return r(i,[{key:"setOrientation",value:function(t){return this.orientation=ax(t),this}},{key:"setItemSpacing",value:function(t){return this.space.item=t,this}},{key:"setStartChildIndex",value:function(t){return this.startChildIndex=t,this}},{key:"setRTL",value:function(t){return void 0===t&&(t=!0),this.rtl=t,this}},{key:"childrenProportion",get:function(){return void 0===this._childrenProportion&&(this._childrenProportion=rx.call(this)),this._childrenProportion}}]),i}(lk);Object.assign(ux.prototype,sx),T.register("sizer",(function(t,e,i,n,s,r){var o=new ux(this.scene,t,e,i,n,s,r);return this.scene.add.existing(o),o})),Z(window,"RexPlugins.UI.Sizer",ux);var cx=function(){return Array.prototype.reduce.call(arguments,dx,0)},dx=function(t,e){return t+e},fx=Phaser.Utils.Objects.IsPlainObject,px=Phaser.Utils.Objects.GetValue,vx=Phaser.Display.Align.CENTER,gx=function(t,e,i,n,s){if("number"==typeof t||"number"==typeof e)if(void 0===t){for(var r=0;r=0;e--){var i=this.sizerChildren[e];i&&this.remove(i,t);}return this},clear:function(t){return kx(this.sizerChildren,null),yk.call(this,t),this}},bx={setColumnSpace:function(t){if(this.space.column||(this.space.column=[]),this.space.column.length=this.columnCount-1,"number"==typeof t)kx(this.space.column,t);else for(var e=0,i=this.columnCount-1;e=0;n--){var s=n*this.columnCount+t;this.sizerChildren.splice(s,0,null);}return this.columnProportions.push(e),this.columnWidth.length+=1,this.space.column.splice(t,0,i),this},Sx={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);for(var e,i,n,s,r=0,o=this.sizerChildren,a=0;a0){var i=t-this.getChildrenWidth(!1);i>=0&&(this.proportionWidthLength=i/e);}else this.proportionWidthLength=0;}return t},resolveHeight:function(t){t=Ep.call(this,t);if(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,n;for(var s in this.sizerChildren)(e=this.sizerChildren[s])&&e.isRexSizer&&!e.ignoreLayout&&(n=this.getColumnWidth(parseInt(s)%this.columnCount),i=this.getExpandedChildWidth(e,n),i=e.resolveWidth(i),e.resolveChildrenWidth(i));},runWidthWrap:function(t){var e,i,n;for(var s in this.sizerChildren)!(e=this.sizerChildren[s])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(n=this.getColumnWidth(parseInt(s)%this.columnCount),i=this.getExpandedChildWidth(e,n),e.isRexSizer&&(i=e.resolveWidth(i)),e.runWidthWrap(i));return this},resetGrid:function(t,e,i,n,s){if(void 0===i&&(i=0),void 0===n&&(n=0),this.columnCount=t,this.rowCount=e,this.gridCount=t*e,this.removeAll(),this.sizerChildren.length=t*e,kx(this.sizerChildren,null),this.columnProportions=[],this.columnProportions.length=t,"number"==typeof i)kx(this.columnProportions,i);else for(var r=0;r0&&(e+=t);return e},Tx=function(){for(var t,e=0,i=0;i0&&(e+=t);return e},Ox=Phaser.Utils.Objects.IsPlainObject,Mx=Phaser.Utils.Objects.GetValue,Ex=function(t){a(i,t);var e=d(i);function i(t,s,r,o,a,h,l,u,c,d){var f;return n(this,i),Ox(s)?(s=Mx(d=s,"x",0),r=Mx(d,"y",0),o=Mx(d,"width",void 0),a=Mx(d,"height",void 0),h=Mx(d,"column",d.col||0),l=Mx(d,"row",0),u=Mx(d,"columnProportions",0),c=Mx(d,"rowProportions",0)):Ox(o)?(o=Mx(d=o,"width",void 0),a=Mx(d,"height",void 0),h=Mx(d,"column",d.col||0),l=Mx(d,"row",0),u=Mx(d,"columnProportions",0),c=Mx(d,"rowProportions",0)):Ox(h)?(h=Mx(d=h,"column",d.col||0),l=Mx(d,"row",0),u=Mx(d,"columnProportions",0),c=Mx(d,"rowProportions",0)):Ox(u)&&(u=Mx(d=u,"columnProportions",0),c=Mx(d,"rowProportions",0)),(f=e.call(this,t,s,r,o,a,d)).type="rexGridSizer",f.sizerChildren=[],f.addChildrenMap("items",f.sizerChildren),f.setCreateCellContainerCallback(Mx(d,"createCellContainerCallback")),f.setIndentLeft(Mx(d,"space.indentLeftOdd",0),Mx(d,"space.indentLeftEven",0)),f.setIndentTop(Mx(d,"space.indentTopOdd",0),Mx(d,"space.indentTopEven",0)),f.resetGrid(h,l,u,c,Mx(d,"space",void 0)),f}return r(i,[{key:"destroy",value:function(t){this.scene&&!this.ignoreDestroy&&(p(h(i.prototype),"destroy",this).call(this,t),this.columnProportions=void 0,this.rowProportions=void 0,this.columnWidth=void 0,this.rowHeight=void 0,this.createCellContainerCallback=void 0);}},{key:"setColumnProportion",value:function(t,e){return t>=this.columnProportions.length||(this.columnProportions[t]=e),this}},{key:"setRowProportion",value:function(t,e){return t>=this.rowProportions.length||(this.rowProportions[t]=e),this}},{key:"totalColumnProportions",get:function(){return void 0===this._totalColumnProportions&&(this._totalColumnProportions=Px.call(this)),this._totalColumnProportions}},{key:"totalRowProportions",get:function(){return void 0===this._totalRowProportions&&(this._totalRowProportions=Tx.call(this)),this._totalRowProportions}},{key:"getChildAt",value:function(t,e){return this.sizerChildren[e*this.columnCount+t]}},{key:"childToGridIndex",value:function(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)}},{key:"getColumnWidth",value:function(t){var e=this.columnProportions[t];return 0===e?this.columnWidth[t]:e*this.proportionWidthLength}},{key:"getRowHeight",value:function(t){var e=this.rowProportions[t];return 0===e?this.rowHeight[t]:e*this.proportionHeightLength}},{key:"setCreateCellContainerCallback",value:function(t){return this.createCellContainerCallback=t,this}}]),i}(lk);Object.assign(Ex.prototype,Sx),T.register("gridSizer",(function(t,e,i,n,s,r,o,a,h){var l=new Ex(this.scene,t,e,i,n,s,r,o,a,h);return this.scene.add.existing(l),l})),Z(window,"RexPlugins.UI.GridSizer",Ex);var _x=function(t,e,i,n){return e/t<=i?e/(n-1):0},Rx=function(t,e){void 0===e?e={lines:[],width:0,height:0}:(e.lines.length=0,e.width=0,e.height=0);for(var i,n,s,r,o=this.sizerChildren,a=this.space.item,h=this.space.line,l=this.space.indentLeftOdd,u=this.space.indentLeftEven,c=this.space.indentTopOdd,d=this.space.indentTopEven,f=0,p=e.lines,v=void 0,g=0,y=o.length;ga.height/2)){s>(h=Dx(a.left,a.centerY,t,e))&&(s=h,n=r);var h,l=i[r+1];if(!l||l.y!==a.y)s>(h=Dx(a.right,a.centerY,t,e))&&(s=h,n=r+1);}}return n},jx=Phaser.Utils.Objects.IsPlainObject,zx=Phaser.Utils.Objects.GetValue,Ax=Phaser.Display.Align.CENTER,Fx=function(t,e,i,n){if("\n"===t)return this.addNewLine(),this;var s;(gp.call(this,t),jx(e))&&(e=zx(s=e,"padding",0),i=zx(s,"key",void 0),n=zx(s,"index",void 0));return void 0===e&&(e=0),(s=this.getSizerConfig(t)).align=Ax,s.padding=pp(e),void 0===n||n>=this.sizerChildren.length?this.sizerChildren.push(t):this.sizerChildren.splice(n,0,t),void 0!==i&&this.addChildrenMap(i,t),this},Wx={add:function(t,e,i){if(dg(t))for(var n=t,s=0,r=n.length;s=0;e--)this.remove(this.sizerChildren[e],t);return this},clear:function(t){return this.sizerChildren.length=0,yk.call(this,t),this}},Xx={getChildrenWidth:function(){return this.rexSizer.hidden?0:this.maxChildWidth+this.space.left+this.space.right},getChildrenHeight:function(){return this.rexSizer.hidden?0:this.widthWrapResult.height+this.space.top+this.space.bottom},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,n=0,s=i.length;n=0;i--)DC.call(this,e[i],t);return this}},jC=function(t,e,i){if(t){var n=this.setValueCallback,s=this.setValueCallbackScope;n&&(s?n.call(s,t,e,i):n(t,e,i)),this.fireEvent("button.statechange",t,e,i);}},zC=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 n=t._selected;t._selected=i,jC.call(e,t,i,n);}},enumerable:!0,configurable:!0}),t.selected=!1;},AC={add:function(t){return this.buttons.push(t),t._click||(t._click=new ac(t,this.clickConfig),t._click.on("click",(function(t,e,i,n){this.fireEvent("button.click",e,i,n);}),this).on("enable",(function(t,e){this.fireEvent("button.enable",e);}),this).on("disable",(function(t,e){this.fireEvent("button.disable",e);}),this),t.on("pointerover",(function(e,i,n,s){this.fireEvent("button.over",t,e,s);}),this).on("pointerout",(function(e,i){this.fireEvent("button.out",t,e,i);}),this).on("pointerdown",(function(e,i,n,s){this.fireEvent("button.down",t,e,s);}),this).on("pointerup",(function(e,i){this.fireEvent("button.up",t,e,i);}),this)),this.buttonsType&&(void 0===t.name&&console.error("".concat(this.parent.constructor.name,": Option button miss value")),zC.call(this,t)),this},addMultiple:function(t){for(var e=0,i=t.length;e2?o-2:0),h=2;h=0;i--)tw.call(this,e[i],t);return this}},iw=Phaser.Utils.Objects.GetValue,nw=function(t){a(i,t);var e=d(i);function i(t,s){var r;n(this,i),void 0===s&&(s={});var o=iw(s,"row",0),a=iw(s,"column",s.col||0),h=iw(s,"createCellContainerCallback"),l=iw(s,"buttons",void 0),c=iw(s,"expand",!0),d=c?1:0;if(h&&(s.createCellContainerCallback=void 0),void 0!==l){o=Math.max(o,l.length);for(var f=0,p=l.length;fs&&sw.addNewLine(this);}else for(r=0,o=t.length;r=0;i--)lw.call(this,e[i],t);return this}},cw=Phaser.Utils.Objects.GetValue,dw=function(t){a(i,t);var e=d(i);function i(t,s){var r;n(this,i),void 0===s&&(s={});var o=s.space;"number"==typeof o&&(s.space={item:o,line:o}),(r=e.call(this,t,s)).type="rexFixWidthButtons",r.buttonGroup=new UC({parent:u(r),eventEmitter:cw(s,"eventEmitter",u(r)),groupName:cw(s,"groupName",void 0),clickConfig:cw(s,"click",void 0)}).setButtonsType(s);var a=cw(s,"background",void 0),h=cw(s,"buttons",void 0);return r.buttonsAlign=cw(s,"align",void 0),a&&r.addBackground(a),h&&r.addButtons(h),r.addChildrenMap("background",a),r.addChildrenMap("buttons",r.buttonGroup.buttons),r}return r(i,[{key:"destroy",value:function(t){this.scene&&!this.ignoreDestroy&&(p(h(i.prototype),"destroy",this).call(this,t),this.buttonGroup.destroy(),this.buttonGroup=void 0);}},{key:"buttons",get:function(){return this.buttonGroup.buttons}},{key:"groupName",get:function(){return this.buttonGroup.groupName},set:function(t){this.buttonGroup.groupName=t;}},{key:"eventEmitter",get:function(){return this.buttonGroup.eventEmitter}}]),i}(Kx);Object.assign(dw.prototype,ow,uw,GC,NC),T.register("fixWidthButtons",(function(t){var e=new dw(this.scene,t);return this.scene.add.existing(e),e})),Z(window,"RexPlugins.UI.FixWidthButtons",dw);var fw=Phaser.Utils.Objects.GetValue,pw=function(t){a(i,t);var e=d(i);function i(t,s){var r;n(this,i),(r=e.call(this,t,s)).type="rexFileSelectorButton";var o=new gb(t);return t.add.existing(o),r.addBackground(o),r.addChildrenMap("fileChooser",o),r.setAccept(fw(s,"accept","")),r.setMultiple(fw(s,"multiple",!1)),o.on("change",(function(t){var e=t.files;0!==e.length&&(e=Array.from(e),this.emit("select",e,this));}),u(r)),r}return r(i,[{key:"files",get:function(){return this.childrenMap.fileChooser.files}}]),i}(eC);Object.assign(pw.prototype,{setAccept:function(t){return this.childrenMap.fileChooser.setAccept(t),this},setMultiple:function(t){return this.childrenMap.fileChooser.setMultiple(t),this},loadFile:function(t,e,i,n,s){return this.childrenMap.fileChooser.loadFile(t,e,i,n,s),this},loadFilePromise:function(t,e,i,n){return this.childrenMap.fileChooser.loadFilePromise(t,e,i,n)}}),T.register("fileSelectorButton",(function(t){var e=new pw(this.scene,t);return this.scene.add.existing(e),e})),Z(window,"RexPlugins.UI.FileSelectorButton",pw);var vw={getChoice:function(t){var e=this.childrenMap.choicesSizer;return e?e.getButton(t):void 0},getAction:function(t){return this.childrenMap.actionsSizer.getButton(t)},getToolbar:function(t){return this.childrenMap.toolbarSizer.getButton(t)},getLeftToolbar:function(t){return this.childrenMap.leftToolbarSizer.getButton(t)},setChoiceEnable:function(t,e){var i=this.childrenMap.choicesSizer;return i&&i.setButtonEnable(t,e),this},setActionEnable:function(t,e){return this.childrenMap.actionsSizer.setButtonEnable(t,e),this},setToolbarEnable:function(t,e){return this.childrenMap.toolbarSizer.setButtonEnable(t,e),this},setLeftToolbarEnable:function(t,e){return this.childrenMap.leftToolbarSizer.setButtonEnable(t,e),this},toggleChoiceEnable:function(t){var e=this.childrenMap.choicesSizer;return e&&e.toggleButtonEnable(t),this},toggleActionEnable:function(t){return this.childrenMap.actionsSizer.toggleButtonEnable(t),this},toggleToolbarEnable:function(t){return this.childrenMap.toolbarSizer.toggleButtonEnable(t),this},toggleLeftToolbarEnable:function(t){return this.childrenMap.leftToolbarSizer.toggleButtonEnable(t),this},getChoiceEnable:function(t){var e=this.childrenMap.choicesSizer;return !!e&&e.getButtonEnable(t)},getActionEnable:function(t){return this.childrenMap.actionsSizer.getButtonEnable(t)},getToolbarEnable:function(t){return this.childrenMap.toolbarSizer.getButtonEnable(t)},getLeftToolbarEnable:function(t){return this.childrenMap.leftToolbarSizer.getButtonEnable(t)},emitChoiceClick:function(t){var e=this.childrenMap.choicesSizer;return e&&e.emitButtonClick(t),this},emitActionClick:function(t){return this.childrenMap.actionsSizer.emitButtonClick(t),this},emitToolbarClick:function(t){return this.childrenMap.toolbarSizer.emitButtonClick(t),this},emitLeftToolbarClick:function(t){return this.childrenMap.leftToolbarSizer.emitButtonClick(t),this},showChoice:function(t){var e=this.childrenMap.choicesSizer;return e&&e.showButton(t),this},showAction:function(t){return this.childrenMap.actionsSizer.showButton(t),this},showToolbar:function(t){return this.childrenMap.toolbarSizer.showButton(t),this},showLeftToolbar:function(t){return this.childrenMap.leftToolbarSizer.showButton(t),this},hideChoice:function(t){var e=this.childrenMap.choicesSizer;return e&&e.hideButton(t),this},hideAction:function(t){return this.childrenMap.actionsSizer.hideButton(t),this},hideToolbar:function(t){return this.childrenMap.toolbarSizer.hideButton(t),this},hideLeftToolbar:function(t){return this.childrenMap.leftToolbarSizer.hideButton(t),this},addChoice:function(t){var e=this.childrenMap.choicesSizer;return e&&e.addButton(t),this},addAction:function(t){return this.childrenMap.actionsSizer.addButton(t),this},addToolbar:function(t){return this.childrenMap.toolbarSizer.addButton(t),this},addLeftToolbar:function(t){return this.childrenMap.leftToolbarSizer.addButton(t),this},removeChoice:function(t,e){var i=this.childrenMap.choicesSizer;return i&&i.removeButton(t,e),this},removeAction:function(t,e){return this.childrenMap.actionsSizer.removeButton(t,e),this},removeToolbar:function(t,e){return this.childrenMap.toolbarSizer.removeButton(t,e),this},removeLeftToolbar:function(t,e){return this.childrenMap.leftToolbarSizer.removeButton(t,e),this},clearChoices:function(t){var e=this.childrenMap.choicesSizer;return e&&e.clearButtons(t),this},clearActions:function(t){return this.childrenMap.actionsSizer.clearButtons(t),this},clearToolbar:function(t){return this.childrenMap.toolbarSizer.clearButtons(t),this},clearLeftToolbar:function(t){return this.childrenMap.leftToolbarSizer.clearButtons(t),this},forEachChoice:function(t,e){var i=this.childrenMap.choicesSizer;return i&&i.forEachButtton(t,e),this},forEachAction:function(t,e){return this.childrenMap.actionsSizer.forEachButtton(t,e),this},forEachToolbar:function(t,e){return this.childrenMap.toolbarSizer.forEachButtton(t,e),this},forEachLeftToolbar:function(t,e){return this.childrenMap.leftToolbarSizer.forEachButtton(t,e),this},setAllButtonsEnable:function(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:function(){var t=this.childrenMap.choicesSizer;return t?t.getAllButtonsState():{}},getChoicesButtonState:function(t){var e=this.childrenMap.choicesSizer;return void 0===t?e?e.getAllButtonsState():{}:!!e&&e.getButtonState(t)},setChoicesButtonState:function(t,e){var i=this.childrenMap.choicesSizer;return i&&i.setButtonState(t,e),this},clearChoicesButtonStates:function(){var t=this.childrenMap.choicesSizer;return t&&t.clearAllButtonsState(),this},getChoicesSelectedButtonName:function(){var t=this.childrenMap.choicesSizer;return t?t.getSelectedButtonName():""},setChoicesSelectedButtonName:function(t){var e=this.childrenMap.choicesSizer;return e&&e.setSelectedButtonName(t),this}},gw={onCreateModalBehavior:function(t){t.on("button.click",(function(e,i,n,s,r){if("actions"===i){var o={index:n,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:function(t,e){return t&&!1===t.defaultBehavior?this.onCreateModalBehavior=!1:delete this.onCreateModalBehavior,ug.modal.call(this,t,e),this}},yw={};Object.assign(yw,vw,gw);var kw=Phaser.Utils.Objects.GetValue,mw=function(t){a(i,t);var e=d(i);function i(t,s){var r;n(this,i),void 0===s&&(s={}),s.orientation=1,(r=e.call(this,t,s)).type="rexDialog",r.eventEmitter=kw(s,"eventEmitter",u(r));var o,a,h,l,c=kw(s,"background",void 0),d=kw(s,"title",void 0),f=kw(s,"toolbar",void 0),p=kw(s,"toolbarBackground",void 0),v=kw(s,"leftToolbar",void 0),g=kw(s,"leftToolbarBackground",void 0),y=kw(s,"content",void 0),k=kw(s,"description",void 0),m=kw(s,"choices",void 0),b=kw(s,"choicesBackground",void 0),x=kw(s,"actions",void 0),C=kw(s,"actionsBackground",void 0),w=kw(s,"click",void 0);if(c&&r.addBackground(c),f&&(h=new JC(t,{groupName:"toolbar",background:p,buttons:f,orientation:0,space:{item:kw(s,"space.toolbarItem",0)},click:w,eventEmitter:r.eventEmitter})),v&&(l=new JC(t,{groupName:"leftToolbar",background:g,buttons:v,orientation:0,space:{item:kw(s,"space.leftToolbarItem",0)},click:w,eventEmitter:r.eventEmitter})),d||f||v){var S,P=!!d&&kw(s,"expand.title",!0),T=kw(s,"align.title","center"),O=!(d&&!P&&"center"===T||!d&&(f||v));S=O?new ux(t,{orientation:0}):new wk(t);var M=!!O||{height:!0};if(l&&S.add(l,{align:"left",expand:M}),d){O&&!P&&"right"===T&&S.addSpace();var E={left:kw(s,"space.titleLeft",0),right:kw(s,"space.titleRight",0)},_=P?1:0;S.add(d,{align:T,proportion:_,expand:M,padding:E}),O&&!P&&"left"===T&&S.addSpace();}h&&(O&&!d&&S.addSpace(),S.add(h,{align:"right",expand:M})),(y||k||m||x)&&(E={bottom:kw(s,"space.title",0),top:kw(s,"space.titleTop",0)});_=kw(s,"proportion.title",0);r.add(S,{padding:E,proportion:_,expand:!0});}if(y){var R=kw(s,"align.content","center"),L=kw(s,"space.content",0),B=(E={left:kw(s,"space.contentLeft",0),right:kw(s,"space.contentRight",0),bottom:k||m||x?L:0},_=kw(s,"proportion.content",0),kw(s,"expand.content",!0));r.add(y,{align:R,padding:E,proportion:_,expand:B});}if(k){R=kw(s,"align.description","center");var D=kw(s,"space.description",0);E={left:kw(s,"space.descriptionLeft",0),right:kw(s,"space.descriptionRight",0),bottom:m||x?D:0},_=kw(s,"proportion.description",0),B=kw(s,"expand.description",!0);r.add(k,{align:R,padding:E,proportion:_,expand:B});}if(m){var I=kw(s,"choicesType","").split("-"),j=bw(I,"wrap")?dw:bw(I,"grid")?nw:JC,z=bw(I,"radio")?"radio":bw(I,"checkboxes")?"checkboxes":void 0,A={left:kw(s,"space.choicesBackgroundLeft",0),right:kw(s,"space.choicesBackgroundRight",0),top:kw(s,"space.choicesBackgroundTop",0),bottom:kw(s,"space.choicesBackgroundBottom",0)},F=kw(s,"space.choice",0);j===JC?A.item=F:j===dw?(A.item=F,A.line=kw(s,"space.choiceLine",F)):(A.column=kw(s,"space.choiceColumn",F),A.row=kw(s,"space.choiceRow",F));var W={width:kw(s,"choicesWidth",void 0),height:kw(s,"choicesHeight",void 0),groupName:"choices",buttonsType:z,background:b,buttons:m,space:A,click:w,eventEmitter:r.eventEmitter,setValueCallback:kw(s,"choicesSetValueCallback",void 0),setValueCallbackScope:kw(s,"choicesSetValueCallbackScope",void 0)};j===JC&&(W.orientation=bw(I,"x")?0:1),o=new j(t,W);var Y=kw(s,"space.choices",0);E={left:kw(s,"space.choicesLeft",0),right:kw(s,"space.choicesRight",0),bottom:x?Y:0},R=kw(s,"align.choices","center"),_=kw(s,"proportion.choices",0),B=kw(s,"expand.choices",!0);r.add(o,{align:R,padding:E,proportion:_,expand:B}),r.buttonsType=z;}if(x){a=new JC(t,{groupName:"actions",background:C,buttons:x,orientation:0,space:{item:kw(s,"space.action",0)},expand:kw(s,"expand.actions",!1),align:kw(s,"align.actions","center"),click:w,eventEmitter:r.eventEmitter});E={left:kw(s,"space.actionsLeft",0),right:kw(s,"space.actionsRight",0),bottom:kw(s,"space.actionsBottom",0)},_=kw(s,"proportion.action",0);r.add(a,{align:"center",padding:E,proportion:_,expand:!0});}return Cw(u(r),"click"),Cw(u(r),"over"),Cw(u(r),"out"),Cw(u(r),"enable"),Cw(u(r),"disable"),r.addChildrenMap("background",c),r.addChildrenMap("title",d),r.addChildrenMap("toolbar",f),r.addChildrenMap("leftToolbar",v),r.addChildrenMap("content",y),r.addChildrenMap("description",k),r.addChildrenMap("choices",o?o.buttons:void 0),r.addChildrenMap("actions",a?a.buttons:void 0),r.addChildrenMap("choicesSizer",o),r.addChildrenMap("actionsSizer",a),r.addChildrenMap("toolbarSizer",h),r.addChildrenMap("leftToolbarSizer",l),r}return r(i)}(ux),bw=function(t,e){return -1!==t.indexOf(e)},xw={actions:"action",choices:"choice",toolbar:"toolbar",leftToolbar:"leftToolbar"},Cw=function(t,e){t.on("button.".concat(e),(function(i,n,s,r,o){xw.hasOwnProperty(n)&&t.emit("".concat(xw[n],".").concat(e),i,s,r,o);}));};Object.assign(mw.prototype,yw),T.register("dialog",(function(t){var e=new mw(this.scene,t);return this.scene.add.existing(e),e})),Z(window,"RexPlugins.UI.Dialog",mw);var ww=function(t,e,i){var n=new pC(t,e,i);return t.add.existing(n),n},Sw=function(t){this.childrenMap.title.resetDisplayContent(t.title);},Pw=function(t){var e=this.childrenMap.content;if(e.resetDisplayContent)e.resetDisplayContent(t.content);else {var i=t.content||"";e.setText(i);}},Tw=function(t){var e=this.childrenMap.actions;if(e){var i=t.buttons;if(i){for(var n=this.scene,s=this.defaultActionConfig,r=this.defaultActionButtonCreator,o=0,a=i.length;o=t.dragThreshold?"DRAG":"DRAGBEGIN":"IDLE"}},{key:"update_DRAGBEGIN",value:function(t,e){this.next();}},{key:"next_DRAG",value:function(){var t,e=this.parent;return e.dragState.isUp&&(t=e.outOfBounds?"BACK":e.slidingEnable?"SLIDE":"IDLE"),t}},{key:"update_DRAG",value:function(t,e){var i=this.parent;i.dragState.justMoved&&i.dragging(),this.next();}},{key:"enter_DRAG",value:function(){this.parent.onDragStart();}},{key:"exit_DRAG",value:function(){this.parent.onDragEnd();}},{key:"next_SLIDE",value:function(){var t,e=this.parent;return e.dragState.isDown?t="DRAG":e.isSliding||(t="IDLE"),t}},{key:"enter_SLIDE",value:function(){this.parent.onSliding();}},{key:"exit_SLIDE",value:function(){this.parent.stop();}},{key:"update_SLIDE",value:function(t,e){this.parent.sliding(t,e),this.next();}},{key:"next_BACK",value:function(){var t,e=this.parent;return e.dragState.isDown?t="DRAG":e.isPullBack||(t="IDLE"),t}},{key:"enter_BACK",value:function(){this.parent.onPullBack();}},{key:"exit_BACK",value:function(){this.parent.stop();}},{key:"update_BACK",value:function(t,e){this.parent.pullBack(t,e),this.next();}}]),i}(jv),vS=Phaser.Utils.Objects.GetValue,gS=Phaser.Math.Distance.Between,yS=function(t){a(i,t);var e=d(i);function i(t,s){var r;return n(this,i),(r=e.call(this,t,s))._enable=void 0,t.setInteractive(vS(s,"inputConfig",void 0)),r.resetFromJSON(s),r.boot(),r}return r(i,[{key:"resetFromJSON",value:function(t){return this.pointer=void 0,this.isInTouched=!1,this.holdStartTime=void 0,this.x=void 0,this.y=void 0,this.preX=void 0,this.preY=void 0,this.localX=void 0,this.localY=void 0,this.justMoved=!1,this.setEnable(vS(t,"enable",!0)),this.holdThreshold=vS(t,"holdThreshold",50),this.pointerOutReleaseEnable=vS(t,"pointerOutRelease",!0),this}},{key:"boot",value:function(){this.parent.on("pointerdown",this.onPointIn,this),this.parent.on("pointerup",this.onPointOut,this),this.pointerOutReleaseEnable&&this.parent.on("pointerout",this.onPointOut,this),this.parent.on("pointermove",this.onPointerMove,this),this.scene.sys.events.on("preupdate",this.preupdate,this);}},{key:"shutdown",value:function(t){this.isShutdown||(this.scene.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,p(h(i.prototype),"shutdown",this).call(this,t));}},{key:"enable",get:function(){return this._enable},set:function(t){this._enable!==t&&(t||(this.isInTouched=!1,this.pointer=void 0),this._enable=t);}},{key:"setEnable",value:function(t){return void 0===t&&(t=!0),this.enable=t,this}},{key:"toggleEnable",value:function(){return this.setEnable(!this.enable),this}},{key:"setPointerOutReleaseEnable",value:function(t){return void 0===t&&(t=!0),this.pointerOutReleaseEnable=t,this}},{key:"isDown",get:function(){return this.pointer&&this.pointer.isDown}},{key:"isUp",get:function(){return !this.isDown}},{key:"dx",get:function(){return this.x-this.preX}},{key:"dy",get:function(){return this.y-this.preY}},{key:"dt",get:function(){return eu(this.scene)}},{key:"speed",get:function(){return this.x===this.preX&&this.y===this.preY?0:gS(this.preX,this.preY,this.x,this.y)/(.001*this.dt)}},{key:"speedX",get:function(){return this.dx/(.001*this.dt)}},{key:"speedY",get:function(){return this.dy/(.001*this.dt)}},{key:"onPointIn",value:function(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.pointer=t,this.localX=e,this.localY=i);}},{key:"onPointOut",value:function(t){this.enable&&this.pointer===t&&(this.pointer=void 0);}},{key:"onPointerMove",value:function(t,e,i){this.enable&&t.isDown&&this.pointer===t&&(this.localX=e,this.localY=i);}},{key:"preupdate",value:function(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));}}}]),i}(ro),kS=Phaser.Utils.Objects.GetValue,mS=function(){function t(e){n(this,t),this.resetFromJSON(e);}return r(t,[{key:"resetFromJSON",value:function(t){return this.setValue(kS(t,"value",0)),this.setSpeed(kS(t,"speed",0)),this.setAcceleration(kS(t,"acceleration",0)),this}},{key:"reset",value:function(){this.setValue(0),this.setSpeed(0),this.setAcceleration(0);}},{key:"setValue",value:function(t){return this.value=t,this}},{key:"setSpeed",value:function(t){return this.speed=t,this}},{key:"setAcceleration",value:function(t){return this.acceleration=t,this}},{key:"updateSpeed",value:function(t){return 0!==this.acceleration&&(this.speed+=this.acceleration*t,this.speed<0&&(this.speed=0)),this}},{key:"getDeltaValue",value:function(t){return this.updateSpeed(t),this.speed<=0?0:this.speed*t}},{key:"update",value:function(t){return this.updateSpeed(t),this.speed>0&&(this.value+=this.getDeltaValue(t)),this}},{key:"isMoving",get:function(){return this.speed>0}}]),t}(),bS=function(){function t(){n(this,t),this.value,this.dir,this.movement=new mS;}return r(t,[{key:"init",value:function(t,e,i,n,s){return this.value=t,this.end=s,this.dir=void 0!==s?tthis.end&&(this.value=this.end):this.valuethis.maxValue}},{key:"overMin",value:function(t){return null!=this.minValue&&t0,Math.abs(e),i);}},{key:"sliding",value:function(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;}},{key:"onPullBack",value:function(){var t=this.value,e=this.outOfMinBound?this.minValue:this.maxValue,i=Math.abs(e-t),n=this.backDeceleration,s=Math.sqrt(2*n*i);this._slowDown.init(t,void 0,s,n,e);}},{key:"pullBack",value:function(t,e){e*=.001,this.value=this._slowDown.update(e).value,this._slowDown.isMoving||this._state.next();}},{key:"stop",value:function(){this._slowDown.stop();}}]),i}(ro),SS={y:0,v:0,vertical:0,x:1,h:1,horizontal:1},PS=Phaser.Utils.Objects.GetValue,TS=function(t){a(i,t);var e=d(i);function i(t,s){var r;(n(this,i),(r=e.call(this,t,s)).parent!==r.scene?r.focusMode=PS(s,"focus",!1):r.focusMode=!1,r.setSpeed(PS(s,"speed",.1)),r.setEnable(PS(s,"enable",!0)),r.focusMode)?(t=r.parent).setInteractive(PS(s,"inputConfig",void 0)).on("wheel",(function(t,e,i,n,s){this.enable&&this.scroll(i);}),u(r)):r.scene.input.on("wheel",r.onSceneScroll,u(r));return r}return r(i,[{key:"destroy",value:function(){this.focusMode||this.scene.input.off("wheel",this.onSceneScroll,this);}},{key:"onSceneScroll",value:function(t,e,i,n,s,r){this.enable&&this.scroll(n);}},{key:"setEnable",value:function(t){return void 0===t&&(t=!0),this.enable=t,this}},{key:"setSpeed",value:function(t){return this.speed=t,this}},{key:"scroll",value:function(t){t*=this.speed,this.emit("scroll",t,this.parent,this);}}]),i}(ro),OS=Phaser.Utils.Objects.GetValue,MS=function(t,e,i,n){var s,r,o,a,h="Y"===(i=i.toUpperCase()),l=2===t.scrollMode,u=t.childrenMap.child,c="slider".concat(i);if(s=l||n.hasOwnProperty(c)?OS(n,c,void 0):OS(n,"slider",void 0)){var d,f,p;!0===s&&(s={}),s.orientation=h?1:0,r=function(t,e){void 0===e&&(e={});var i=qe(e);(e={slider:i}).orientation=i.orientation,delete i.orientation,e.background=i.background,delete i.background,e.buttons=i.buttons,delete i.buttons;var n=new fS(t,e);t.add.existing(n);var s=n.childrenMap.slider;return n.addChildrenMap("track",s.childrenMap.track),n.addChildrenMap("indicator",s.childrenMap.indicator),n.addChildrenMap("thumb",s.childrenMap.thumb),n}(t.scene,s);var v=OS(s,"position",0);"string"==typeof v&&(v=ES[v]);var g=OS(n,"space.slider".concat(i),void 0);void 0===g&&void 0===(g=OS(n,"space.slider",void 0))&&(g=l?0:OS(n,"space.child",0));var y="number"==typeof g;h?0===v?(d=2,f=1,p=y?{left:g}:g):(d=0,f=1,p=y?{right:g}:g):0===v?(d=1,f=2,p=y?{top:g}:g):(d=1,f=0,p=y?{bottom:g}:g),e.add(r,{column:d,row:f,align:"center",padding:p,expand:!0}),t["hideUnscrollableSlider".concat(i)]=OS(s,"hideUnscrollableSlider",!1),t["adaptThumb".concat(i,"SizeMode")]=OS(s,"adaptThumbSize",!1),t["minThumb".concat(i,"Size")]=OS(s,"minThumbSize",void 0);}else t["hideUnscrollableSlider".concat(i)]=!1,t["adaptThumb".concat(i,"SizeMode")]=!1,t["minThumb".concat(i,"Size")]=void 0;var k="scroller".concat(i);(o=l||n.hasOwnProperty(k)?OS(n,k,!0):OS(n,"scroller",!0))&&u&&(!0===o&&(o={}),o.orientation=h?0:1,a=new wS(u,o));var m,b,x,C,w=OS(n,l?"mouseWheelScroller".concat(i):"mouseWheelScroller",!1);(w&&u&&(m=new TS(u,w)),t.addChildrenMap("slider".concat(i),r),t.addChildrenMap("scroller".concat(i),a),t.addChildrenMap("mouseWheelScroller".concat(i),m),l&&!h||(t.hideUnscrollableSlider=t["hideUnscrollableSlider".concat(i)],t.adaptThumbSizeMode=t["adaptThumb".concat(i,"SizeMode")],t.minThumbSize=t["minThumb".concat(i,"Size")],t.addChildrenMap("slider",r),t.addChildrenMap("scroller",a),t.addChildrenMap("mouseWheelScroller",m)),r)&&(l?(b=h?"t":"s",C="scroll".concat(i)):(b="t",C="scroll"),r.on("valuechange",(function(e){t[b]=e,t.emit(C,t);})));a&&(l?(x="childO".concat(i),C="scroll".concat(i)):(x="childOY",C="scroll"),a.on("valuechange",(function(e){t[x]=e,t.emit(C,t);})));if(m){var S="addChildO".concat(i);m.on("scroll",(function(e){t[S](-e,!0);}));}},ES={right:0,left:1,bottom:0,top:1},_S=Phaser.Utils.Objects.GetValue,RS=function(t,e){var i=t.scene,n=[0,1,0],s=[0,1,0],r=_S(e,"width"),o=_S(e,"height");r||(n[1]=0),o||(s[1]=0);var a=new Ex(i,{column:3,row:3,columnProportions:n,rowProportions:s});switch(function(t,e,i){var n=Aw(i,"child"),s=Aw(n,"gameObject",void 0);if(s){var r=Aw(i,"space.child",0);t.childMargin={};var o=t.childMargin,a={};if("number"==typeof r)switch(t.scrollMode){case 0:case 1:o.top=0,o.bottom=0,o.left=0,o.right=0;break;default:o.top=r,o.bottom=r,o.left=r,o.right=r;}else switch(t.scrollMode){case 0:o.top=Aw(r,"top",0),o.bottom=Aw(r,"bottom",0),a.left=Aw(r,"left",0),a.right=Aw(r,"right",0);break;case 1:o.top=Aw(r,"left",0),o.bottom=Aw(r,"right",0),a.top=Aw(r,"top",0),a.bottom=Aw(r,"bottom",0);break;default:o.top=Aw(r,"top",0),o.bottom=Aw(r,"bottom",0),o.left=Aw(r,"left",0),o.right=Aw(r,"right",0);}e.add(s,{column:1,row:1,align:Aw(n,"align","center"),padding:a,expand:{width:Aw(n,"expandWidth",!0),height:Aw(n,"expandHeight",!0)}});}t.addChildrenMap("child",s);}(t,a,e),t.scrollMode){case 0:MS(t,a,"y",e);break;case 1:MS(t,a,"x",e);break;default:MS(t,a,"y",e),MS(t,a,"x",e);}return a},LS=function(t){var e,i,n,s;switch(this.scrollMode){case 0:case 1:e=this.topChildOY,i=this.bottomChildOY,n=this.childrenMap.scroller,s=this.childrenMap.slider;break;default:"Y"===(t=t.toUpperCase())?(e=this.topChildOY,i=this.bottomChildOY):(e=this.leftChildOX,i=this.rightChildOX),n=this.childrenMap["scroller".concat(t)],s=this.childrenMap["slider".concat(t)];}n&&n.setBounds(e,i),s&&s.setEnable(e!==i);},BS=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".concat(t)],i=this["hideUnscrollableSlider".concat(t)],n=this["isOverflow".concat(t)];e&&i&&this.setChildVisible(e,n);}},DS=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,n=a.childrenMap.thumb,s=this.minThumbSize;if(0===this.scrollMode){var r=i.displayHeight*e;void 0!==s&&r0?t.setText(e).getTextBounds().wrappedText.split("\n"):e.split("\n");}return i},VS=function(t){return (t-this.textLineSpacing)/(this.textLineHeight+this.textLineSpacing)},XS=function(t){return t*(this.textLineHeight+this.textLineSpacing)-this.textLineSpacing},GS=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 n=this.lines.getLineStartIndex(t),s=this.lines.getLineEndIndex(i-1);e=this.lines.getSliceTagText(n,s,!0);}return e},US=function(t,e){switch(WS(t)){case 0:var i=(s=t.style).wordWrapWidth,n=s.wordWrapCallback;s.wordWrapWidth=0,s.wordWrapCallback=void 0,t.setText(e),s.wordWrapWidth=i,s.wordWrapCallback=n;break;case 1:var s,r=(s=t.style).wrapMode;s.wrapMode=0,t.setText(e),s.wrapMode=r;break;case 2:var o=t._maxWidth;t._maxWidth=0,t.setText(e),t._maxWidth=o;}},HS=function(){var t=this.textObject.rexSizer;this.textObject.y+=t.offsetY-t.preOffsetY,t.preOffsetY=t.offsetY,this.resetChildPositionState(this.textObject),this.textCropEnable&&NS.call(this);},NS=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);}},KS=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 n=t.style,s=Math.max(e,0);0===this.textObjectType?n.wordWrapWidth=s:(0===n.wrapMode&&(n.wrapMode=1),n.wrapWidth=s);break;case 2:t.setMaxWidth(e);}this.setText();}},JS={setText:function(t){return void 0!==t&&(this.text=t),this.lines=YS(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(VS.call(this,-this.textOY)),0),e=XS.call(this,t)+this.textOY,i=GS.call(this,t);return US(this.textObject,i),this.textObject.rexSizer.offsetY=e,HS.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,Rp.call(this),this},layoutChildren:function(){var t,e,i,n,s,r,o,a=this.left,h=this.top;(t=this.textObject).rexSizer.hidden||(n=a+(i=(e=t.rexSizer).padding).left,s=h+i.top,r=this.width-i.left-i.right,o=this.height-i.top-i.bottom,KS.call(this,t,r,o),hp(t,n,s,r,o,e.align),e.preOffsetY=0,HS.call(this),this.textMask&&(this.textMask.setPosition().resize(),this.resetChildPositionState(this.textMask)));}},ZS=Phaser.Utils.Objects.IsPlainObject,qS=Phaser.Utils.Objects.GetValue,$S=Phaser.Display.Align.TOP_LEFT,QS=function(t){a(i,t);var e=d(i);function i(t,s,r,o,a,h){var l;n(this,i),ZS(s)?(s=qS(h=s,"x",0),r=qS(h,"y",0),o=qS(h,"width",void 0),a=qS(h,"height",void 0)):ZS(o)&&(o=qS(h=o,"width",void 0),a=qS(h,"height",void 0)),(l=e.call(this,t,s,r,o,a,h)).type="rexTextBlock",l.textObject=void 0,l.linesCount=0,l.textMask=void 0,l.textObjectType=void 0,l._textLineHeight=void 0,l._textLineSpacing=void 0,l._visibleLinesCount=void 0,l._textHeight=void 0,l._textVisibleHeight=void 0,l._textObjectRealHeight=0,l.lines=void 0,l.text=qS(h,"content",""),l._textOY=0,l.execeedTopState=!1,l.execeedBottomState=!1,l.setClampMode(qS(h,"clamplTextOY",!0)),l.alwaysScrollable=qS(h,"alwaysScrollable",!1);var c=qS(h,"background",void 0),d=qS(h,"text",void 0);void 0===d&&(d=tP(t)),l.textCropEnable=qS(h,"textCrop",!!d.setCrop);var f=qS(h,"textMask",!l.textCropEnable);c&&l.addBackground(c),l.add(d),l.sizerChildren=[d];var p=l.getSizerConfig(d);return p.align=$S,p.padding=pp(0),p.expand=!0,l.textObject=d,l.textObjectType=WS(d),p.preOffsetY=0,p.offsetY=0,f&&(l.textMask=Qx.call(u(l),l.textObject,u(l))),l.addChildrenMap("background",c),l.addChildrenMap("text",d),l}return r(i,[{key:"destroy",value:function(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;}p(h(i.prototype),"destroy",this).call(this,t);}}},{key:"setClampMode",value:function(t){return void 0===t&&(t=!0),this.clampTextOY=t,this}},{key:"textLineHeight",get:function(){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}},{key:"textLineSpacing",get:function(){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}},{key:"visibleLinesCount",get:function(){return void 0===this._visibleLinesCount&&(this._visibleLinesCount=Math.floor(VS.call(this,this._textObjectRealHeight))),this._visibleLinesCount}},{key:"topTextOY",get:function(){return 0}},{key:"bottomTextOY",get:function(){return -this.textVisibleHeight}},{key:"textHeight",get:function(){return void 0===this._textHeight&&(this._textHeight=XS.call(this,this.linesCount)),this._textHeight}},{key:"textObjectHeight",get:function(){return this._textObjectRealHeight-(this.textLineHeight+this.textLineSpacing)}},{key:"textVisibleHeight",get:function(){if(void 0===this._textVisibleHeight){var t=this.textHeight-this.textObjectHeight;!this.alwaysScrollable&&t<0&&(t=0),this._textVisibleHeight=t;}return this._textVisibleHeight}},{key:"textOYExceedTop",value:function(t){return void 0===t&&(t=this.textOY),t>this.topTextOY}},{key:"textOYExeceedBottom",value:function(t){return void 0===t&&(t=this.textOY),tthis.linesCount?t=0:n?t=e:s&&(t=i)),this._textOY!==t&&(this._textOY=t,this.updateTextObject()),n&&(this.execeedTopState||this.emit("execeedtop",this,t,e)),this.execeedTopState=n,s&&(this.execeedBottomState||this.emit("execeedbottom",this,t,i)),this.execeedBottomState=s;}},{key:"setTextOY",value:function(t){return this.textOY=t,this}},{key:"t",get:function(){var t=this.textVisibleHeight;return 0===t?0:this.textOY/-t},set:function(t){this.textOY=-this.textVisibleHeight*t;}},{key:"setTextOYByPercentage",value:function(t){return this.t=t,this}}]),i}(lk),tP=function(t){return t.add.text(0,0,"")};Object.assign(QS.prototype,JS);Phaser.Math.Clamp;var eP={scrollToLine:function(t){return this.setChildOY(-this.lineHeight*t),this},scrollToNextLine:function(t){void 0===t&&(t=1);var e=this.lineIndex+t;return this.scrollToLine(e),this}},iP=Phaser.Utils.Objects.GetValue,nP=function(t){a(i,t);var e=d(i);function i(t,s){var r;n(this,i),void 0===s&&(s={}),s.scrollMode=0;var o=iP(s,"text",void 0),a=iP(s,"textWidth",void 0),h=iP(s,"textHeight",void 0),l=iP(s,"textCrop",!!o.setCrop),u=iP(s,"textMask",!l),c=iP(s,"content",""),d=new QS(t,{width:a,height:h,text:o,textMask:u,textCrop:l&&!u,content:c,clamplTextOY:iP(s,"clamplChildOY",!1),alwaysScrollable:iP(s,"alwaysScrollable",!1)});t.add.existing(d),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}});}(d),s.scrollMode=0,s.type="rexTextArea",s.child={gameObject:d,expandWidth:void 0===a,expandHeight:void 0===h};var f=iP(s,"space",void 0);return f&&(f.child=iP(f,"text",0)),(r=e.call(this,t,s)).addChildrenMap("text",o),r}return r(i,[{key:"text",get:function(){return this.childrenMap.child.text}},{key:"lineHeight",get:function(){var t=this.childrenMap.child;return t.textLineHeight+t.textLineSpacing}},{key:"lineIndex",get:function(){return Math.floor(-this.childOY/this.lineHeight)}},{key:"linesCount",get:function(){return this.childrenMap.child.linesCount}},{key:"contentHeight",get:function(){return this.childrenMap.child.textHeight}}]),i}(AS);Object.assign(nP.prototype,{setText:function(t){return this.childrenMap.child.setText(t),this.resizeController(),this},appendText:function(t){return this.setText(this.text+t),this}},eP);var sP=Phaser.Utils.Objects.GetValue,rP=function(t,e,i){e=e?M(e):{};var n=sP(i,"background",iC),s=sP(i,"text",rC),r=sP(i,"track",iC),o=sP(i,"thumb",iC);n?e.background=n(t,e.background):delete e.background,s?e.text=s(t,e.text):delete e.text;var a=e.slider;!1!==a&&(void 0===a&&(a={}),r?a.track=r(t,a.track):delete a.track,o?a.thumb=o(t,a.thumb):delete a.thumb,e.slider=a);var h=new nP(t,e);return t.add.existing(h),h},oP=Phaser.Utils.Objects.GetValue,aP=Phaser.Utils.Objects.GetValue,hP=function(t){a(i,t);var e=d(i);function i(t,s,r){var o;n(this,i),s=s?M(s):{},void 0===r&&(r={});var a=aP(r,"background",iC);a?s.background=a(t,s.background):delete s.background,s.title=ww(t,s.title,r.title),s.content=function(t,e,i){var n,s=oP(e,"$type");void 0===s&&e&&(e.hasOwnProperty("slider")||e.hasOwnProperty("scroller"))&&(s="textarea"),n="textarea"===s?new rP(t,e,i):new ww(t,e,i);return t.add.existing(n),n}(t,s.content,r.content),s.content instanceof nP&&Bl(s,"height")&&!Bl(s,"proportion.content")&&Z(s,"proportion.content",1);var h=s.button,l=s.buttonA||h,c=s.buttonB||h,d=s.buttonMode;void 0===d&&(d=l&&c?2:l?1:0);var f=r.button,p=r.buttonA||f,v=r.buttonB||f;switch(d){case 2:s.actions=[ww(t,l,p),ww(t,c,v)];break;case 1:s.actions=[ww(t,l,p)];break;case 0:break;default:s.actions=[];}var g=s.choice;g&&(s.choices=[]),(o=e.call(this,t,s)).type="rexConfirmDialog",o.buttonMode=d,o.defaultActionConfig=h,o.defaultActionButtonCreator=f,o.defaultChoiceConfig=g,o.defaultChoiceCreator=r.choice;var y=o.childrenMap.actions;return o.addChildrenMap("buttonA",y?y[0]:null),o.addChildrenMap("buttonB",y?y[1]:null),Dw.call(u(o)),o}return r(i)}(mw);Object.assign(hP.prototype,Mw),T.register("confirmDialog",(function(t,e){var i=new hP(this.scene,t,e);return this.scene.add.existing(i),i})),Z(window,"RexPlugins.UI.ConfirmDialog",hP);var lP=Phaser.Utils.Objects.GetValue,uP=function(t,e,i){var n=lP(t,"proportion.".concat(e),i.proportion),s=lP(t,"align.".concat(e),"center"),r=lP(t,"space.".concat(e),void 0);if("number"==typeof r&&i.paddingKey){var o=r;(r={})[i.paddingKey]=o;}return {proportion:n,align:s,padding:r,expand:lP(t,"expand.".concat(e),!0)}},cP=function(t){return uP(t,"header",{proportion:0,paddingKey:"bottom"})},dP=function(t){return uP(t,"leftSide",{proportion:0,paddingKey:"right"})},fP=function(t){return uP(t,"content",{proportion:1})},pP=function(t){return uP(t,"rightSide",{proportion:0,paddingKey:"left"})},vP=function(t){return uP(t,"footer",{proportion:0,paddingKey:"top"})},gP=function(t,e){var i=new ux(t,{orientation:e});return t.add.existing(i),i},yP=Phaser.Utils.Objects.GetValue,kP=[function(t){var e=this.scene,i=t.header;i&&this.add(i,cP(t));var n=gP(e,0);this.add(n,{proportion:1,align:"center",padding:0,expand:!0});var s=t.leftSide;s&&n.add(s,dP(t));var r=t.content;r&&n.add(r,fP(t));var o=t.rightSide;o&&n.add(o,pP(t));var a=t.footer;a&&this.add(a,vP(t));},function(t){var e=this.scene,i=t.header;i&&this.add(i,cP(t));var n=gP(e,0);this.add(n,{proportion:1,align:"center",padding:0,expand:!0});var s=t.leftSide;s&&n.add(s,dP(t));var r=gP(e,1);n.add(r,{proportion:1,align:"center",padding:0,expand:!0});var o=gP(e,0);r.add(o,{proportion:1,align:"center",padding:0,expand:!0});var a=t.content;a&&o.add(a,fP(t));var h=t.rightSide;h&&o.add(h,pP(t));var l=t.footer;l&&r.add(l,vP(t));},function(t){var e=this.scene,i=t.header;i&&this.add(i,cP(t));var n=gP(e,0);this.add(n,{proportion:1,align:"center",padding:0,expand:!0});var s=gP(e,1);n.add(s,{proportion:1,align:"center",padding:0,expand:!0});var r=gP(e,0);s.add(r,{proportion:1,align:"center",padding:0,expand:!0});var o=t.leftSide;o&&r.add(o,dP(t));var a=t.content;a&&r.add(a,fP(t));var h=t.footer;h&&s.add(h,vP(t));var l=t.rightSide;l&&n.add(l,pP(t));},function(t){var e=this.scene,i=t.header;i&&this.add(i,cP(t));var n=gP(e,0);this.add(n,{proportion:1,align:"center",padding:0,expand:!0});var s=t.leftSide;s&&n.add(s,dP(t));var r=gP(e,1);n.add(r,{proportion:1,align:"center",padding:0,expand:!0});var o=t.content;o&&r.add(o,fP(t));var a=t.footer;a&&r.add(a,vP(t));var h=t.rightSide;h&&n.add(h,pP(t));}],mP={FFF:0,LFF:1,FFR:2,LFR:3},bP=function(t){a(i,t);var e=d(i);function i(t,s){var r;return n(this,i),void 0===s&&(s={}),s.orientation=1,(r=e.call(this,t,s)).type="rexHolyGrail",r.build(s),r}return r(i)}(ux),xP={build:function(t){this.clear(!0);var e=yP(t,"background",void 0);e&&this.addBackground(e);var i=yP(t,"layoutMode",0);"string"==typeof i&&(i=mP[i.toUpperCase()]),(kP[i]||kP[0]).call(this,t),this.addChildrenMap("background",t.background),this.addChildrenMap("header",t.header),this.addChildrenMap("leftSide",t.leftSide),this.addChildrenMap("content",t.content),this.addChildrenMap("rightSide",t.rightSide),this.addChildrenMap("footer",t.footer);}};Object.assign(bP.prototype,xP),T.register("holyGrail",(function(t){var e=new bP(this.scene,t);return this.scene.add.existing(e),e})),Z(window,"RexPlugins.UI.HolyGrail",bP);var CP={getButtonsSizer:function(t){return this.childrenMap["".concat(t,"ButtonsSizer")]},getButton:function(t,e){var i=this.getButtonsSizer(t);return i?i.getButton(e):void 0},setButtonEnable:function(t,e,i){return this.getButtonsSizer(t).setButtonEnable(e,i),this},setLeftButtonEnable:function(t,e){return this.childrenMap.leftButtonsSizer.setButtonEnable(t,e),this},setRightButtonEnable:function(t,e){return this.childrenMap.rightButtonsSizer.setButtonEnable(t,e),this},setTopButtonEnable:function(t,e){return this.childrenMap.topButtonsSizer.setButtonEnable(t,e),this},setBottomButtonEnable:function(t,e){return this.childrenMap.bottomButtonsSizer.setButtonEnable(t,e),this},toggleButtonEnable:function(t,e){return this.getButtonsSizer(t).toggleButtonEnable(e),this},toggleLeftButtonEnable:function(t){return this.childrenMap.leftButtonsSizer.toggleButtonEnable(t),this},toggleRightButtonEnable:function(t){return this.childrenMap.rightButtonsSizer.toggleButtonEnable(t),this},toggleTopButtonEnable:function(t){return this.childrenMap.topButtonsSizer.toggleButtonEnable(t),this},toggleBottomButtonEnable:function(t){return this.childrenMap.bottomButtonsSizer.toggleButtonEnable(t),this},getButtonEnable:function(t,e){return this.getButtonsSizer(t).getButtonEnable(e)},getLeftButtonEnable:function(t){return this.childrenMap.leftButtonsSizer.getButtonEnable(t)},getRightButtonEnable:function(t){return this.childrenMap.rightButtonsSizer.getButtonEnable(t)},getTopButtonEnable:function(t){return this.childrenMap.topButtonsSizer.getButtonEnable(t)},getBottomButtonEnable:function(t){return this.childrenMap.bottomButtonsSizer.getButtonEnable(t)},emitButtonClick:function(t,e){var i=this.getButtonsSizer(t);return i?(i.emitButtonClick(e),this):this},emitLeftButtonClick:function(t){return this.childrenMap.leftButtonsSizer.emitButtonClick(t),this},emitRightButtonClick:function(t){return this.childrenMap.rightButtonsSizer.emitButtonClick(t),this},emitTopButtonClick:function(t){return this.childrenMap.topButtonsSizer.emitButtonClick(t),this},emitBottomButtonClick:function(t){return this.childrenMap.bottomButtonsSizer.emitButtonClick(t),this},getLeftButton:function(t){return this.childrenMap.leftButtonsSizer.getButton(t)},getRightButton:function(t){return this.childrenMap.rightButtonsSizer.getButton(t)},getTopButton:function(t){return this.childrenMap.topButtonsSizer.getButton(t)},getBottomButton:function(t){return this.childrenMap.bottomButtonsSizer.getButton(t)},showButton:function(t,e){return wv(this.getButton(t,e)),this},showLeftButton:function(t){return wv(this.getLeftButton(t)),this},showRightButton:function(t){return wv(this.getRightButton(t)),this},showTopButton:function(t){return wv(this.getTopButton(t)),this},showBottomButton:function(t){return wv(this.getBottomButton(t)),this},hideButton:function(t,e){return Sv(this.getButton(t,e)),this},hideLeftButton:function(t){return Sv(this.getLeftButton(t)),this},hideRightButton:function(t){return Sv(this.getRightButton(t)),this},hideTopButton:function(t){return Sv(this.getTopButton(t)),this},hideBottomButton:function(t){return Sv(this.getBottomButton(t)),this},addButton:function(t,e){return this.getButtonsSizer(t).addButton(e),this},addLeftButton:function(t){return this.addButton("left",t),this},addRightButton:function(t){return this.addButton("right",t),this},addTopButton:function(t){return this.addButton("top",t),this},removeButton:function(t,e,i){return this.getButtonsSizer(t).removeButton(e,i),this},removeLeftButton:function(t,e){return this.removeButton("left",t,e),this},removeRightButton:function(t,e){return this.removeButton("right",t,e),this},removeTopButton:function(t,e){return this.removeButton("top",t,e),this},removeBottomButton:function(t,e){return this.removeButton("bottom",t,e),this},clearButtons:function(t,e){return this.getButtonsSizer(t).clearButtons(e),this},clearLeftButtons:function(t){return this.clearButtons("left",t),this},clearRightButtons:function(t){return this.clearButtons("right",t),this},clearTopButtons:function(t){return this.clearButtons("top",t),this},clearBottomButtonss:function(t){return this.clearButtons("bottom",t),this},forEachButton:function(t,e,i){return this.getButtonsSizer(t).forEachButtton(e,i),this},forEachLeftButton:function(t,e){return this.childrenMap.leftButtonsSizer.forEachButtton(t,e),this},forEachRightButton:function(t,e){return this.childrenMap.rightButtonsSizer.forEachButtton(t,e),this},forEachTopButton:function(t,e){return this.childrenMap.topButtonsSizer.forEachButtton(t,e),this},forEachBottomButton:function(t,e){return this.childrenMap.bottomButtonsSizer.forEachButtton(t,e),this}},wP=Phaser.Utils.Objects.GetValue,SP=function(t){a(i,t);var e=d(i);function i(t,s){var r;n(this,i),void 0===s&&(s={}),s.column=3,s.row=3,(r=e.call(this,t,s)).type="rexTabs",r.eventEmitter=wP(s,"eventEmitter",u(r));var o,a,h,l,c=wP(s,"background",void 0),d=wP(s,"panel",void 0),f=wP(s,"leftButtons",void 0),p=wP(s,"leftButtonsBackground",void 0),v=wP(s,"rightButtons",void 0),g=wP(s,"rightButtonsBackground",void 0),y=wP(s,"topButtons",void 0),k=wP(s,"topButtonsBackground",void 0),m=wP(s,"bottomButtons",void 0),b=wP(s,"bottomButtonsBackground",void 0),x=wP(s,"click",void 0);if(c&&r.addBackground(c),d&&r.add(d,1,1,"center",0,!0),f){var C=wP(s,"space.leftButtonsOffset",0),w=wP(s,"space.leftButton",0);o=new JC(t,{groupName:"left",background:p,buttons:f,orientation:1,space:{item:w},align:wP(s,"align.leftButtons",void 0),click:x,eventEmitter:r.eventEmitter});var S={top:C};r.add(o,0,1,"top",S,!1);}if(v){var P=wP(s,"space.rightButtonsOffset",0),T=wP(s,"space.rightButton",0);a=new JC(t,{groupName:"right",background:g,buttons:v,orientation:1,space:{item:T},align:wP(s,"align.rightButtons",void 0),click:x,eventEmitter:r.eventEmitter});S={top:P};r.add(a,2,1,"top",S,!1);}if(y){var O=wP(s,"space.topButtonsOffset",0),M=wP(s,"space.topButton",0);h=new JC(t,{groupName:"top",background:k,buttons:y,orientation:0,space:{item:M},align:wP(s,"align.topButtons",void 0),click:x,eventEmitter:r.eventEmitter});S={left:O};r.add(h,1,0,"left",S,!1);}if(m){var E=wP(s,"space.bottomButtonsOffset",0),_=wP(s,"space.bottomButton",0);l=new JC(t,{groupName:"bottom",background:b,buttons:m,orientation:0,space:{item:_},align:wP(s,"align.bottomButtons",void 0),click:x,eventEmitter:r.eventEmitter});S={left:E};r.add(l,1,2,"left",S,!1);}return r.addChildrenMap("background",c),r.addChildrenMap("panel",d),r.addChildrenMap("leftButtons",f),r.addChildrenMap("rightButtons",v),r.addChildrenMap("topButtons",y),r.addChildrenMap("bottomButtons",m),r.addChildrenMap("leftButtonsSizer",o),r.addChildrenMap("rightButtonsSizer",a),r.addChildrenMap("topButtonsSizer",h),r.addChildrenMap("bottomButtonsSizer",l),r}return r(i)}(Ex);Object.assign(SP.prototype,CP),T.register("tabs",(function(t){var e=new SP(this.scene,t);return this.scene.add.existing(e),e})),Z(window,"RexPlugins.UI.Tabs",SP),T.register("slider",(function(t){var e=new lS(this.scene,t);return this.scene.add.existing(e),e})),Z(window,"RexPlugins.UI.Slider",lS);var PP=function(){function t(e,i){n(this,t),this.container=null,this._deltaHeight=0,this.setParent(e);}return r(t,[{key:"setParent",value:function(t){this.parent=t,this.parentContainer=t.getParentContainer();}},{key:"destroy",value:function(t){void 0===t&&(t=!1),t||this.destroyContainer(),this.deltaHeight=0,this.data=void 0,this.container=null,this.parent=void 0,this.parentContainer=void 0;}},{key:"table",get:function(){return this.parent}},{key:"scrollMode",get:function(){return this.parentContainer.scrollMode}},{key:"colIndx",get:function(){return this.parent.cellIndxeToColIndex(this.index)}},{key:"rowIndx",get:function(){return this.parent.cellIndxeToRowIndex(this.index)}},{key:"getContainer",value:function(){return this.container}},{key:"setContainer",value:function(t){return t?(this.container&&this.container.destroy(),this.container=t,this.parentContainer.add(t),this):(this.destroyContainer(),this)}},{key:"destroyContainer",value:function(){return this.container&&(this.container.destroy(),this.container=null),this}},{key:"popContainer",value:function(){if(this.container){var t=this.container;return this.container=null,this.parentContainer.remove(t),t}return null}},{key:"setXY",value:function(t,e){return this.container&&this.parentContainer.setChildLocalPosition(this.container,t,e),this}},{key:"setCellContainerAlign",value:function(t){return "string"==typeof t&&(t=Af[t]),this.cellContainerAlign=t,this}},{key:"deltaHeight",get:function(){return this._deltaHeight},set:function(t){null==t&&(t=0);var e=this.parent;0===this._deltaHeight&&0!==t?e.nonZeroDeltaHeightCount++:0!==this._deltaHeight&&0===t&&e.nonZeroDeltaHeightCount--;var i=this._deltaHeight!==t;if(this._deltaHeight=t,i){e.resetTotalRowsHeight();var n=0===this.scrollMode?"cellheightchange":"cellwidthchange";this.parentContainer.emit(n,this,this.container,this.parentContainer);}}},{key:"deltaWidth",get:function(){return this.deltaHeight},set:function(t){this.deltaHeight=t;}},{key:"setDeltaHeight",value:function(t){return this.deltaHeight=t,this}},{key:"setDeltaWidth",value:function(t){return this.deltaHeight=t,this}},{key:"height",get:function(){return 0===this.scrollMode?this.deltaHeight+this.parent.defaultCellHeight:this.parent.defaultCellWidth},set:function(t){1!==this.scrollMode&&this.setDeltaHeight(t-this.parent.defaultCellHeight);}},{key:"setHeight",value:function(t){return this.height=t,this}},{key:"width",get:function(){return 0===this.scrollMode?this.parent.defaultCellWidth:this.deltaHeight+this.parent.defaultCellHeight},set:function(t){0!==this.scrollMode&&this.setDeltaHeight(t-this.parent.defaultCellHeight);}},{key:"setWidth",value:function(t){return this.width=t,this}},{key:"scene",get:function(){return this.parentContainer.scene}}]),t}();Object.assign(PP.prototype,Ct);var TP=Phaser.Utils.Objects.GetValue,OP=Phaser.Utils.Array.SpliceOne,MP=function(){function t(e,i){n(this,t),this.parent=e,this.cells=[],this.cellPool=new st,this.resetFromJSON(i);}return r(t,[{key:"resetFromJSON",value:function(t){void 0===t&&(t={}),this.colCount=void 0,this.nonZeroDeltaHeightCount=0,this.resetTotalRowsHeight();var e=t.cellHeight;void 0===e&&(e=30);var i=t.cellWidth;return void 0===i&&(i=30),this.setDefaultCellHeight(e),this.setDefaultCellWidth(i),this.initCells(TP(t,"cellsCount",0)),this.setColumnCount(TP(t,"columns",1)),this}},{key:"destroy",value:function(t){this.cellPool.destroy(),this.cells=void 0,this.parent=void 0;}},{key:"defaultCellHeightMode",get:function(){return 0===this.nonZeroDeltaHeightCount}},{key:"setDefaultCellHeight",value:function(t){return this.defaultCellHeight=t,this}},{key:"setDefaultCellWidth",value:function(t){return this.defaultCellWidth=t,this}},{key:"initCells",value:function(t){var e=this.cells;e.length=t;for(var i=0;i=0&&t=0&&i0&&n)){if(0===r)return 2===e&&(i+=1),i;if(1===e){var o=i;(n=(i+=1)>=0&&i=this.colCount?null:e*this.colCount+t}},{key:"rowIndexToHeight",value:function(t,e){if(this.defaultCellHeightMode)return (e-t+1)*this.defaultCellHeight;for(var i=0,n=t;n<=e;n++)i+=this.getRowHeight(n);return i}},{key:"colIndexToWidth",value:function(t,e){return (e-t+1)*this.defaultCellWidth}},{key:"getRowHeight",value:function(t){var e=this.colCount;if(e<=1)return this.getCellHeight(this.colRowToCellIndex(0,t));for(var i,n=0,s=0;sthis.topTableOY,r=tthis.leftTableOX,r=tt?this.removeCells(t,e-t):this.insertNewCells(e,t-e)),this},insertNewCells:function(t,e){return "object"===i(t)&&(t=t.index),void 0===e&&(e=1),e<=0||(t=GP(t,0,this.cellsCount),this.table.insertNewCells(t,e)),this},removeCells:function(t,e){if("object"===i(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 n,s=t,r=t+e;sb.bottom&&(l=c.getTopLeft().y,t.setOrigin(0,1).setPosition(h+d,l+f));},IT={down:0,up:1},jT=Phaser.Utils.Objects.GetValue,zT=function(t){a(i,t);var e=d(i);function i(t,s){var r;n(this,i),void 0===s&&(s={}),null==s.transitIn&&(s.transitIn=function(t,e){Fp(t,e,"y","Cubic");}),null==s.transitOut&&(s.transitOut=function(t,e){!function(t,e,i,n,s){void 0===n&&(n="Linear");var r={mode:0};switch(i){case 0:case"x":r.end={x:0};break;case 1:case"y":r.end={y:0};break;default:r.end=0;}r.duration=e,r.ease=n,void 0===s?s=new zp(t,r):s.resetFromJSON(r),s.restart();}(t,e,"y","Linear");}),s.manualClose=!0,s.clickOutsideClose=!0,s.destroy=!0,r=e.call(this,t,s),DT(t,s),t.isRexSizer&&t.layout();var o=jT(s,"touchOutsideClose",!1),a=jT(s,"anyTouchClose",!1);return a&&(o=!1),a?r.once("open",r.anyTouchClose,u(r)):o&&r.once("open",r.touchOutsideClose,u(r)),r.requestOpen(),r}return r(i,[{key:"shutdown",value:function(t){this.isShutdown||(this.scene.input.off("pointerup",this.touchCloseCallback,this),p(h(i.prototype),"shutdown",this).call(this,t));}},{key:"touchOutsideClose",value:function(){return this.scene.input.on("pointerup",this.touchCloseCallback,this),this.clickOutsideTest=!0,this}},{key:"anyTouchClose",value:function(){return this.scene.input.once("pointerup",this.touchCloseCallback,this),this}},{key:"touchCloseCallback",value:function(t){this.clickOutsideTest&&ng(this.parent,t.worldX,t.worldY)||this.requestClose();}},{key:"onOpen",value:function(){this.emit("open",this.parent,this),p(h(i.prototype),"onOpen",this).call(this);}},{key:"onClose",value:function(){this.emit("close",this.parent,this),p(h(i.prototype),"onClose",this).call(this);}}]),i}(Gv),AT={openListPanel:function(){if(this.listPanel)return this;var t,e=LT.call(this);e.on("button.over",(function(t,i,n,s){this.listOnButtonOver&&this.listOnButtonOver.call(this,t,i,n,s),this.emit("button.over",this,e,t,i,n,s);}),this).on("button.out",(function(t,i,n,s){this.listOnButtonOut&&this.listOnButtonOut.call(this,t,i,n,s),this.emit("button.out",this,e,t,i,n,s);}),this),t=this.listAlignMode&&"label"!==this.listAlignMode?this.getElement(this.listAlignMode):this;var i=new zT(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,anyTouchClose:!0}).on("open",(function(){e.on("button.click",(function(t,i,n,s){this.listOnButtonClick&&this.listOnButtonClick.call(this,t,i,n,s),this.emit("button.click",this,e,t,i,n,s);}),this),this.emit("list.open",this,e);}),this).on("close",(function(){this.listPanel=void 0,this.dropDownBehavior=void 0;}),this);return this.listPanel=e,this.dropDownBehavior=i,this.pin(e),this},closeListPanel:function(){return this.dropDownBehavior?(this.dropDownBehavior.requestClose(),this):this},toggleListPanel:function(){return this.listPanel?this.closeListPanel():this.openListPanel(),this}};Object.assign(AT,_T);var FT=Phaser.Utils.Objects.GetValue,WT=function(t){a(i,t);var e=d(i);function i(t,s){var r;n(this,i),(r=e.call(this,t,s)).type="rexDropDownList",r.timer=void 0,r.setOptions(FT(s,"options"));var o=FT(s,"list");return r.setWrapEnable(FT(o,"wrap",!1)),r.setCreateButtonCallback(FT(o,"createButtonCallback")),r.setCreateListBackgroundCallback(FT(o,"createBackgroundCallback")),r.setButtonClickCallback(FT(o,"onButtonClick")),r.setButtonOverCallback(FT(o,"onButtonOver")),r.setButtonOutCallback(FT(o,"onButtonOut")),r.setListExpandDirection(FT(o,"expandDirection")),r.setListEaseInDuration(FT(o,"easeIn",500)),r.setListEaseOutDuration(FT(o,"easeOut",100)),r.setListTransitInCallback(FT(o,"transitIn")),r.settListTransitOutCallback(FT(o,"transitOut")),r.setListSize(FT(o,"width"),FT(o,"height")),r.setListAlignmentMode(FT(o,"alignParent","text")),r.setListAlignmentSide(FT(o,"alignSide","")),r.setListBounds(FT(o,"bounds")),r.setListSpace(FT(o,"space")),r.setListDraggable(FT(o,"draggable",!1)),r.setValueChangeCallback(FT(s,"setValueCallback"),FT(s,"setValueCallbackScope")),r.setValue(FT(s,"value")),r.onClick(r.toggleListPanel,u(r)),r}return r(i,[{key:"destroy",value:function(t){this.scene&&!this.ignoreDestroy&&(this.listPanel&&(this.listPanel.destroy(t),this.listPanel=void 0),p(h(i.prototype),"destroy",this).call(this,t));}},{key:"setOptions",value:function(t){return void 0===t&&(t=[]),this.options=t,this}},{key:"setValueChangeCallback",value:function(t,e){return this.valueChangeCallback=t,this.valueChangeCallbackScope=e,this}},{key:"setValue",value:function(t){return this.value=t,this}},{key:"value",get:function(){return this._value},set:function(t){if(this._value!==t){var e=this._value;this._value=t;var i=this.valueChangeCallback,n=this.valueChangeCallbackScope;i&&(n?i.call(n,this,t,e):i(this,t,e)),this.emit("valuechange",this,t,e);}}},{key:"emitButtonClick",value:function(t){var e=this.options[t];return e?(this.emit("button.click",this,void 0,e,t),this):this}}]),i}(eC);Object.assign(WT.prototype,AT),T.register("dropDownList",(function(t){var e=new WT(this.scene,t);return this.scene.add.existing(e),e})),Z(window,"RexPlugins.UI.DropDownList",WT);var YT=function(t,e,i){void 0===i&&(i={});var n=(e=e?M(e):{}).label||e.button,s=e.button||e.label;delete e.label,delete e.button;var r=i.label||i.button||i,o=i.button||i.label||i,a=fC(t,n,r);return a.list=e.list||{},a.list.createButtonCallback=function(t,e){var i=ww(t,s,o).resetDisplayContent({text:e.text});return e.hasOwnProperty("value")&&(i.value=e.value),i},a.list.onButtonOver=function(t,e,i,n){t.setHoverState&&t.setHoverState(!0);},a.list.onButtonOut=function(t,e,i,n){t.setHoverState&&t.setHoverState(!1);},a},VT=function(t){a(i,t);var e=d(i);function i(t,s,r){var o;return n(this,i),s=YT(t,s,r),(o=e.call(this,t,s)).type="rexSimpleDropDownList",o}return r(i,[{key:"setOptions",value:function(t){void 0===t&&(t=[]);for(var e=0,n=t.length;e=this.pageCount-1}},{key:"totalLinesCount",get:function(){return this.lines?this.lines.length:0}},{key:"startLineIndex",get:function(){return this._startLineIndex},set:function(t){t=ZT(t,0,this.totalLinesCount-1),this._startLineIndex=t;}},{key:"setStartLineIndex",value:function(t){return this.startLineIndex=t,this}},{key:"pageLinesCount",get:function(){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,n;switch(WS(t)){case 0:case 1:e=t.height-t.padding.top-t.padding.bottom,i=t.lineSpacing,n=t.style.metrics.fontSize+t.style.strokeThickness;break;case 2:e=t.height,i=0;var s=t.fontSize/t.fontData.size;n=t.fontData.lineHeight*s;}return (e-i)/(n+i)}(this.parent));break;case 2:t=this.totalLinesCount;}return t}},{key:"content",get:function(){return this.sections.join(this.pageBreak)}}]),i}(ro);Object.assign(qT.prototype,KT);var $T,QT=Phaser.Utils.Objects.GetFastValue,tO=Phaser.Utils.Objects.GetValue,eO=function(t){a(i,t);var e=d(i);function i(t,s){var r;return n(this,i),(r=e.call(this,t,s)).timer=null,r.resetFromJSON(s),r}return r(i,[{key:"resetFromJSON",value:function(t){this.setTextWrapEnable(tO(t,"wrap",!1)),this.setTypeMode(tO(t,"typeMode",0)),this.setTypingSpeed(tO(t,"speed",333)),this.setTextCallback=QT(t,"setTextCallback",null),this.setTextCallbackScope=QT(t,"setTextCallbackScope",null),this.setTypingContent(QT(t,"text","")),this.typingIdx=QT(t,"typingIdx",0),this.insertIdx=null,this.insertChar=null;var e=QT(t,"elapsed",null);return null!==e&&this.start(void 0,void 0,this.typingIdx,e),this}},{key:"shutdown",value:function(t){this.isShutdown||(this.freeTimer(),p(h(i.prototype),"shutdown",this).call(this,t));}},{key:"setTypeMode",value:function(t){return "string"==typeof t&&(t=nO[t]),this.typeMode=t,this}},{key:"setTypeSpeed",value:function(t){return this.speed=t,this}},{key:"setTypingSpeed",value:function(t){return this.speed=t,this}},{key:"setTextWrapEnable",value:function(t){return void 0===t&&(t=!0),this.textWrapEnable=t,this}},{key:"text",get:function(){return this._text},set:function(t){var e=iO(t);this.textWrapEnable&&(e=function(t,e){switch(WS(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;}},{key:"isTyping",get:function(){return null!==this.getTimer()}},{key:"isLastChar",get:function(){return this.typingIdx===this.textLen}},{key:"start",value:function(t,e,i,n){return void 0!==t&&this.setTypingContent(t),void 0!==e&&(this.speed=e),void 0===i&&(i=0),this.typingIdx=i+1,0===this.speed?this.stop(!0):(this.setText(""),this.startTimer(n)),this}},{key:"appendText",value:function(t){var e=this.text.concat(iO(t));return this.isTyping?this.setTypingContent(e):this.start(e,void 0,this.textLen),this}},{key:"stop",value:function(t){if(this.getTimer()&&this.freeTimer(),t){for(;!this.isLastChar;)this.getTypingString(this.text,this.typingIdx,this.textLen,this.typeMode),this.emit("typechar",this.insertChar),this.typingIdx++;this.setText(this.text),this.emit("type"),this.emit("complete",this,this.parent);}return this}},{key:"pause",value:function(){var t=this.getTimer();return t&&(t.paused=!0),this}},{key:"resume",value:function(){var t=this.getTimer();return t&&(t.paused=!1),this}},{key:"setTypingContent",value:function(t){return this.text=t,this.textLen=this.getTextLength(this.text),this}},{key:"onTyping",value:function(){var t=this.getTypingString(this.text,this.typingIdx,this.textLen,this.typeMode);this.setText(t),this.emit("typechar",this.insertChar),this.emit("type"),this.isLastChar?(this.freeTimer(),this.emit("complete",this,this.parent)):(this.timer.delay=this.speed,this.typingIdx++);}},{key:"getTypingString",value:function(t,e,i,n){var s;if(0===n){var r=0,o=e;this.insertIdx=o,s=this.getSubString(t,r,o);}else if(1===n){r=(o=i)-e;this.insertIdx=0,s=this.getSubString(t,r,o);}else if(2===n){var a=i/2;o=(r=Math.floor(a-e/2))+e;this.insertIdx=e%2?e:0,s=this.getSubString(t,r,o);}else if(3===n){var h,l=Math.floor(e/2);if(l>0){r=(o=i)-l;h=this.getSubString(t,r,o);}else h="";var u,c=e-l;if(c>0){o=(r=0)+c;this.insertIdx=o,u=this.getSubString(t,r,o);}else u="",this.insertIdx=0;s=u+h;}return this.insertChar=s.charAt(this.insertIdx-1),s}},{key:"startTimer",value:function(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}},{key:"getTimer",value:function(){return this.timer}},{key:"freeTimer",value:function(){return this.timer&&(this.timer.remove(),this.timer=null),this}},{key:"setText",value:function(t){this.setTextCallback&&(t=this.setTextCallbackScope?this.setTextCallback.call(this.setTextCallbackScope,t,this.isLastChar,this.insertIdx):this.setTextCallback(t,this.isLastChar,this.insertIdx)),this.textWrapEnable?US(this.parent,t):this.parent.setText(t);}},{key:"getTextLength",value:function(t){var e=this.parent;return e.getPlainText?e.getPlainText(t).length:t.length}},{key:"getSubString",value:function(t,e,i){var n=this.parent;return n.getSubString?n.getSubString(t,e,i):t.slice(e,i)}}]),i}(ro),iO=function(t){return Array.isArray(t)?t=t.join("\n"):"number"==typeof t&&(t=t.toString()),t},nO={"left-to-right":0,"right-to-left":1,"middle-to-sides":2,"sides-to-middle":3},sO=Phaser.Utils.Objects.GetValue,rO=function(t){a(i,t);var e=d(i);function i(t,s){return n(this,i),void 0===s&&(s={}),s.hasOwnProperty("layoutMode")||(s.layoutMode=1),e.call(this,t,s)}return r(i)}((void 0===$T&&($T="rexTextBox"),function(t){a(i,t);var e=d(i);function i(t,s){var r;n(this,i),(r=e.call(this,t,s)).type=$T;var o=r.childrenMap.text;return r.page=new qT(o,sO(s,"page",void 0)),r.typing=new eO(o,sO(s,"typing",s.type)),r.typing.on("complete",r.onPageEnd,u(r)).on("type",r.onType,u(r)).on("typechar",r.onTypeChar,u(r)),r.textWidth=o.width,r.textHeight=o.height,r}return r(i,[{key:"start",value:function(t,e){return this.page.setText(t),void 0!==e&&this.setTypingSpeed(e),this.emit("start"),this.typeNextPage(),this}},{key:"typeNextPage",value:function(){if(this.isLastPage)this.emit("complete");else {var t=this.page.getNextPage();this.typing.start(t);}return this}},{key:"pause",value:function(){return this.isTyping&&(this.typing.pause(),this.emit("pause")),this}},{key:"resume",value:function(){return this.isTyping||(this.emit("resume"),this.typing.resume()),this}},{key:"stop",value:function(t){return this.typing.stop(t),this}},{key:"showLastPage",value:function(){return this.typing.stop(),this.page.showLastPage(),this.emit("type"),this.onPageEnd(),this}},{key:"setTypeSpeed",value:function(t){return this.typing.setTypingSpeed(t),this}},{key:"setTypingSpeed",value:function(t){return this.typing.setTypingSpeed(t),this}},{key:"isTyping",get:function(){return this.typing.isTyping}},{key:"isLastPage",get:function(){return this.page.isLastPage}},{key:"isFirstPage",get:function(){return this.page.isFirstPage}},{key:"pageCount",get:function(){return this.page.pageCount}},{key:"pageIndex",get:function(){return this.page.pageIndex}},{key:"typingSpeed",get:function(){return this.typing.speed}},{key:"onType",value:function(){var t=this.childrenMap.text;this.textWidth===t.width&&this.textHeight===t.height||(this.textWidth=t.width,this.textHeight=t.height,this.getTopmostSizer().layout()),this.emit("type");}},{key:"onTypeChar",value:function(t){this.emit("typechar",t);}},{key:"onPageEnd",value:function(){var t=this.isLastPage;this.emit("pageend"),t&&this.emit("complete");}}]),i}(bC)));T.register("textBox",(function(t){var e=new rO(this.scene,t);return this.scene.add.existing(e),e})),Z(window,"RexPlugins.UI.TextBox",rO);var oO=Phaser.Utils.Objects.GetValue,aO=function(t){a(i,t);var e=d(i);function i(t,s){var r;n(this,i),(r=e.call(this,t,s)).type="rexNumberBar";var o,a=oO(s,"background",void 0),h=oO(s,"icon",void 0),l=oO(s,"iconMask",void 0),c=oO(s,"slider",void 0),d=oO(s,"text",void 0),f=oO(s,"space.icon",0),p=oO(s,"space.slider",0);(a&&r.addBackground(a),h)&&(0===r.orientation?(c||d)&&(v={right:f}):(c||d)&&(v={bottom:f}),r.add(h,{proportion:0,align:"center",padding:v}),l&&(l=Qx.call(u(r),h,h,1)));if(c){var v,g;if(c.orientation=r.orientation,c.eventEmitter=u(r),c.value=null,c.hasOwnProperty("input")||(c.input=-1),o=new lS(t,c),t.add.existing(o),0===r.orientation?d&&(v={right:p}):d&&(v={bottom:p}),0===r.orientation)g=void 0===oO(c,"width",void 0)?1:0;else g=void 0===oO(c,"height",void 0)?1:0;r.add(o,{proportion:g,align:"center",padding:v});}d&&r.add(d),r.addChildrenMap("background",a),r.addChildrenMap("icon",h),r.addChildrenMap("iconMask",l),r.addChildrenMap("slider",o),r.addChildrenMap("text",d);var y=oO(s,"valuechangeCallback",null);if(null!==y){var k=oO(s,"valuechangeCallbackScope",void 0);r.on("valuechange",y,k);}return r.setEnable(oO(s,"enable",void 0)),r.setValue(oO(s,"value",0)),r}return r(i,[{key:"enable",get:function(){return !!this.childrenMap.slider&&this.childrenMap.slider.enable},set:function(t){this.childrenMap.slider&&this.childrenMap.slider.setEnable(t);}},{key:"setEnable",value:function(t){return void 0===t&&(t=!0),this.enable=t,this}},{key:"value",get:function(){return this.childrenMap.slider?this.childrenMap.slider.value:0},set:function(t){this.childrenMap.slider&&(this.childrenMap.slider.value=t);}},{key:"setValue",value:function(t,e,i){return this.childrenMap.slider&&this.childrenMap.slider.setValue(t,e,i),this}},{key:"addValue",value:function(t,e,i){return this.childrenMap.slider&&this.childrenMap.slider.addValue(t,e,i),this}},{key:"getValue",value:function(t,e){return this.childrenMap.slider?this.childrenMap.slider.getValue(t,e):0}},{key:"easeValueTo",value:function(t,e,i){return this.childrenMap.slider&&this.childrenMap.slider.easeValueTo(t,e,i),this}},{key:"stopEaseValue",value:function(){return this.childrenMap.slider&&this.childrenMap.slider.stopEaseValue(),this}},{key:"setEaseValueDuration",value:function(t){return this.childrenMap.slider&&this.childrenMap.slider.setEaseValueDuration(t),this}},{key:"setEaseValueFunction",value:function(t){return this.childrenMap.slider&&this.childrenMap.slider.setEaseValueFunction(t),this}},{key:"text",get:function(){var t=this.childrenMap.text;return void 0===t?"":t.text?t.text:t.getData("text")},set:function(t){var e=this.childrenMap.text;void 0!==e&&(e.setText?e.setText(t):e.setData("text",t));}},{key:"setText",value:function(t){return this.text=t,this}}]),i}(ux);T.register("numberBar",(function(t){var e=new aO(this.scene,t);return this.scene.add.existing(e),e})),Z(window,"RexPlugins.UI.NumberBar",aO),T.register("scrollBar",(function(t){var e=new fS(this.scene,t);return this.scene.add.existing(e),e})),Z(window,"RexPlugins.UI.ScrollBar",fS);var hO=Phaser.Utils.Objects.GetValue,lO={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"},uO=function(t){a(i,t);var e=d(i);function i(t,s){var r;n(this,i),(r=e.call(this,t,s)).type="rexBadge";var o=hO(s,"background",void 0);o&&r.addBackground(o),r.addChildrenMap("background",o);var a=hO(s,"main",void 0);for(var h in a&&r.add(a,{key:"main",align:"center",expand:!1}),r.addChildrenMap("main",a),lO){var l=hO(s,h,void 0);l&&(r.add(l,{key:h,align:lO[h],expand:!1}),r.addChildrenMap(h,l));}return r}return r(i)}(wk);T.register("badgeLabel",(function(t){var e=new uO(this.scene,t);return this.scene.add.existing(e),e})),Z(window,"RexPlugins.UI.BadgeLabel",uO);var cO=wk.prototype.add,dO=function(t,e,i,n,s,r,o,a,h){return t.setVisible(!1),cO.call(this,t,e,i,n,s,r,o,a,h),this},fO={add:dO,addPage:dO},pO=If.prototype.setChildVisible,vO={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?(pO.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 n=this.currentPage;return n&&(pO.call(this,n,!0),this.emit("pagevisible",n,this._currentKey,this),void 0===e&&(e=this.fadeInDuration),e>0&&n.setAlpha(0).fadeIn(e,1)),this},hasPage:function(t){return this.sizerChildren.hasOwnProperty(t)}};Object.assign(vO,fO);var gO=Phaser.Utils.Objects.GetValue,yO=function(t){a(i,t);var e=d(i);function i(t,s){var r;return n(this,i),(r=e.call(this,t,s)).type="rexPages",r.childrenMap=r.sizerChildren,r._previousKey=void 0,r._currentKey=void 0,r.setSwapMode(gO(s,"swapMode",0)),r.setFadeInDuration(gO(s,"fadeIn",0)),r}return r(i,[{key:"setSwapMode",value:function(t){return "string"==typeof t&&(t=kO[t]),this.swapMode=t,this}},{key:"setFadeInDuration",value:function(t){return this.fadeInDuration=t,this}},{key:"previousKey",get:function(){return this._previousKey}},{key:"currentKey",get:function(){return this._currentKey},set:function(t){this.swapPage(t);}},{key:"currentPage",get:function(){return this.getPage(this.currentKey)}},{key:"previousPage",get:function(){return this.getPage(this.previousKey)}},{key:"keys",get:function(){return Object.keys(this.sizerChildren)}}]),i}(wk);Object.assign(yO.prototype,vO);var kO={invisible:0,destroy:1};T.register("pages",(function(t){var e=new yO(this.scene,t);return this.scene.add.existing(e),e})),Z(window,"RexPlugins.UI.Pages",yO);var mO=function(t){a(i,t);var e=d(i);function i(){return n(this,i),e.apply(this,arguments)}return r(i,[{key:"tint",get:function(){return 0===this.vertices.length?16777215:this.vertices[0].color}},{key:"setInteractive",value:function(){var t=function(t,e,i){for(var n=this.faces,s=0;s=e.length))return e[t].name},getPageIndex:function(t){for(var e=this.getElement("tabs.buttons"),i=0,n=e.length;ithis.topChildOY}},{key:"childOYExeceedBottom",value:function(t){return void 0===t&&(t=this.childOY),tthis.leftChildOX}},{key:"childOXExeceedRight",value:function(t){return void 0===t&&(t=this.childOX),tthis.childHeight?t=0:n?t=e:s&&(t=i)),this._childOY!==t&&(this._childOY=t,this.resetChildPosition()),n&&(this.execeedTopState||this.emit("execeedtop",this,t,e)),this.execeedTopState=n,s&&(this.execeedBottomState||this.emit("execeedbottom",this,t,i)),this.execeedBottomState=s;}},{key:"childOX",get:function(){return this._childOX},set:function(t){var e=this.leftChildOX,i=this.rightChildOX,n=this.childOXExceedLeft(t),s=this.childOXExeceedRight(t);this.clampChildOX&&(this.childVisibleWidth>this.childWidth?t=0:n?t=e:s&&(t=i)),this._childOX!==t&&(this._childOX=t,this.resetChildPosition()),n&&(this.execeedLeftState||this.emit("execeedleft",this,t,e)),this.execeedLeftState=n,s&&(this.execeedRightState||this.emit("execeedright",this,t,i)),this.execeedRightState=s;}},{key:"setChildOY",value:function(t){return this.childOY=t,this}},{key:"setChildOX",value:function(t){return this.childOX=t,this}},{key:"t",get:function(){var t=this.visibleHeight;return 0===t?0:this.childOY/-t},set:function(t){this.childOY=-this.visibleHeight*t;}},{key:"s",get:function(){var t=this.visibleWidth;return 0===t?0:this.childOX/-t},set:function(t){this.childOX=-this.visibleWidth*t;}},{key:"setChildOYByPercentage",value:function(t){return this.t=t,this}},{key:"setChildOXByPercentage",value:function(t){return this.s=t,this}}]),i}(lk);Object.assign(LM.prototype,MM);var BM=["top","bottom","centerY","center"],DM=["left","right","centerX","center"],IM=function(t,e,i){var n,s="Y"===(e=e.toUpperCase()),r=this.childrenMap.child;if(s){if(i)for(var o=0,a=BM.length;o=0?0:Math.abs(l)<=Math.abs(u)?l:u;}}else {if(i)for(o=0,a=DM.length;o=0?0:Math.abs(c)<=Math.abs(d)?c:d;}}switch(this.scrollMode){case 0:case 1:this.childOY+=n;break;default:this["childO".concat(e)]+=n;}},jM=Phaser.Utils.Objects.GetValue,zM=function(t){a(i,t);var e=d(i);function i(t,s){var r;n(this,i),void 0===s&&(s={});var o=jw(s),a=jM(s,"panel",void 0);void 0===a&&(a={}),a.scrollMode=o,a.clamplChildOY=jM(s,"clamplChildOY",!1),a.clamplChildOX=jM(s,"clamplChildOX",!1);var h,l,u=new LM(t,a);switch(t.add.existing(u),o){case 0:h=jM(s,"expand.panel",!0),l=!0;break;case 1:h=!0,l=jM(s,"expand.panel",!0);break;default:h=!0,l=!0;}s.type="rexScrollablePanel",s.child={gameObject:u,expandWidth:h,expandHeight:l,align:jM(s,"align.panel","center")};var c=jM(s,"space",void 0);return c&&(c.child=jM(c,"panel",0)),(r=e.call(this,t,s)).addChildrenMap("panel",u.child),r.addChildrenMap("panelLayer",u.maskLayer),r.addChildrenMap("mask",u.maskGameObject),r.addChildrenMap("scrollableBlock",u),r}return r(i,[{key:"setChildrenInteractive",value:function(t){return void 0===t&&(t={}),t.hasOwnProperty("eventEmitter")||(t.eventEmitter=this),t.hasOwnProperty("targets")||(t.targets=[this.childrenMap.panel]),ok(this.childrenMap.child,t),this}}]),i}(AS),AM={scrollToChild:function(t,e){if(!this.hasChild(t))return this;switch(this.scrollMode){case 0:IM.call(this,t,"y",e);break;case 1:IM.call(this,t,"x",e);break;default:IM.call(this,t,"y",e),IM.call(this,t,"x",e);}return this}};Object.assign(zM.prototype,AM),T.register("scrollablePanel",(function(t){var e=new zM(this.scene,t);return this.scene.add.existing(e),e})),Z(window,"RexPlugins.UI.ScrollablePanel",zM);var FM=function(t,e){t.popUp(e);},WM=function(t,e){t.scaleDown(e);},YM=function(t,e){t.fadeIn(e);},VM=function(t,e){t.fadeOut(e);},XM=function t(e,i,n){var s,r=bt(n,"reverse",!1);if(dg(e[0]))if(r)for(o=(a=e.length)-1;o>=0;o--)s=t(e[o],i,n);else for(var o=0,a=e.length;on?1:it)return this;for(var e=this.commands.length-1;;){var i=this.commands[this.index],n=i[1];if(dg(n)||(n=Ru(KM,i,1)),XM(n,this.scope),this.emit("runcommand",n,this.scope),this.index===e)return this.complete(),this;if(this.index++,this.nextTime=this.getNextDt(this.nextTime),this.nextTime>t)return this}}},{key:"complete",value:function(){this.clock.stop(),this.state=2,this.emit("complete",this.parent,this);}},{key:"getNextDt",value:function(t){var e=this.commands[this.index][0];return 1===this.timeUnit&&(e*=1e3),1===this.dtMode&&(e+=t),e}},{key:"setDtMode",value:function(t){return "string"==typeof t&&(t=ZM[t]),this.dtMode=t,this}},{key:"setTimeUnit",value:function(t){return "string"==typeof t&&(t=JM[t]),this.timeUnit=t,this}}]),i}(ro),KM=[],JM={ms:0,s:1,sec:1},ZM={abs:0,absolute:0,inc:1,increment:1},qM=Phaser.Utils.Objects.GetValue,$M=function(t){a(i,t);var e=d(i);function i(t,s){var r;return n(this,i),void 0===s&&(s={text:createDefaultTextObject(t)}),(r=e.call(this,t,s)).type="rexToast",r.setTransitInTime(qM(s,"duration.in",200)),r.setDisplayTime(qM(s,"duration.hold",1200)),r.setTransitOutTime(qM(s,"duration.out",200)),r.setTransitInCallback(qM(s,"transitIn",QM.popUp)),r.setTransitOutCallback(qM(s,"transitOut",QM.scaleDown)),r.player=new NM(u(r),{dtMode:1}),r.messages=[],r.scaleX0=void 0,r.scaleY0=void 0,r.setVisible(!1),r}return r(i,[{key:"destroy",value:function(t){this.scene&&!this.ignoreDestroy&&(this.player.destroy(),this.player=void 0,this.messages=void 0,p(h(i.prototype),"destroy",this).call(this,t));}},{key:"setDisplayTime",value:function(t){return this.displayTime=t,this}},{key:"setTransitOutTime",value:function(t){return this.transitOutTime=t,this}},{key:"setTransitInTime",value:function(t){return this.transitInTime=t,this}},{key:"setTransitInCallback",value:function(t){switch("string"==typeof t&&(t=QM[t]),t){case QM.popUp:t=FM;break;case QM.fadeIn:t=YM;}return t||(t=D),this.transitInCallback=t,this}},{key:"setTransitOutCallback",value:function(t){switch("string"==typeof t&&(t=QM[t]),t){case QM.scaleDown:t=WM;break;case QM.fadeOut:t=VM;}return t||(t=D),this.transitOutCallback=t,this}},{key:"setScale",value:function(t,e){return void 0===e&&(e=t),this.scaleX0=t,this.scaleY0=e,p(h(i.prototype),"setScale",this).call(this,t,e),this}},{key:"showMessage",value:function(t){if(void 0===this.scaleX0&&(this.scaleX0=this.scaleX),void 0===this.scaleY0&&(this.scaleY0=this.scaleY),void 0===t){if(0===this.messages.length)return this;t=this.messages.shift();}if(this.player.isPlaying)return this.messages.push(t),this;this.setScale(this.scaleX0,this.scaleY0).setVisible(!0),"string"==typeof t?this.setText(t):t(this),this.layout();var e=[[0,[this.transitInCallback,this,this.transitInTime]],[this.transitInTime,[D]],[this.displayTime,[this.transitOutCallback,this,this.transitOutTime]],[this.transitOutTime,[this.setVisible,!1]],[30,[D]]];return this.player.load(e,this).once("complete",(function(){this.showMessage();}),this).start(),this}}]),i}(eC),QM={popUp:0,fadeIn:1,scaleDown:0,fadeOut:1};T.register("toast",(function(t){var e=new $M(this.scene,t);return this.scene.add.existing(e),e})),Z(window,"RexPlugins.UI.Toast",$M);for(var tE,eE=function(t,e,i){void 0===i&&(i=!0),i?e=e?M(e):{}:e||(e={});var n=new Ql(t,e);return t.add.existing(n),n},iE=["AliceBlue","AntiqueWhite","Aqua","Aquamarine","Azure","Beige","Bisque","Black","BlanchedAlmond","Blue","BlueViolet","Brown","BurlyWood","CadetBlue","Chartreuse","Chocolate","Coral","CornflowerBlue","Cornsilk","Crimson","Cyan","DarkBlue","DarkCyan","DarkGoldenRod","DarkGray","DarkGrey","DarkGreen","DarkKhaki","DarkMagenta","DarkOliveGreen","DarkOrange","DarkOrchid","DarkRed","DarkSalmon","DarkSeaGreen","DarkSlateBlue","DarkSlateGray","DarkSlateGrey","DarkTurquoise","DarkViolet","DeepPink","DeepSkyBlue","DimGray","DimGrey","DodgerBlue","FireBrick","FloralWhite","ForestGreen","Fuchsia","Gainsboro","GhostWhite","Gold","GoldenRod","Gray","Grey","Green","GreenYellow","HoneyDew","HotPink","IndianRed","Indigo","Ivory","Khaki","Lavender","LavenderBlush","LawnGreen","LemonChiffon","LightBlue","LightCoral","LightCyan","LightGoldenRodYellow","LightGray","LightGrey","LightGreen","LightPink","LightSalmon","LightSeaGreen","LightSkyBlue","LightSlateGray","LightSlateGrey","LightSteelBlue","LightYellow","Lime","LimeGreen","Linen","Magenta","Maroon","MediumAquaMarine","MediumBlue","MediumOrchid","MediumPurple","MediumSeaGreen","MediumSlateBlue","MediumSpringGreen","MediumTurquoise","MediumVioletRed","MidnightBlue","MintCream","MistyRose","Moccasin","NavajoWhite","Navy","OldLace","Olive","OliveDrab","Orange","OrangeRed","Orchid","PaleGoldenRod","PaleGreen","PaleTurquoise","PaleVioletRed","PapayaWhip","PeachPuff","Peru","Pink","Plum","PowderBlue","Purple","RebeccaPurple","Red","RosyBrown","RoyalBlue","SaddleBrown","Salmon","SandyBrown","SeaGreen","SeaShell","Sienna","Silver","SkyBlue","SlateBlue","SlateGray","SlateGrey","Snow","SpringGreen","SteelBlue","Tan","Teal","Thistle","Tomato","Turquoise","Violet","Wheat","White","WhiteSmoke","Yellow","YellowGreen"],nE=[15792383,16444375,65535,8388564,15794175,16119260,16770244,0,16772045,255,9055202,10824234,14596231,6266528,8388352,13789470,16744272,6591981,16775388,14423100,65535,139,35723,12092939,11119017,11119017,25600,12433259,9109643,5597999,16747520,10040012,9109504,15308410,9419919,4734347,3100495,3100495,52945,9699539,16716947,49151,6908265,6908265,2003199,11674146,16775920,2263842,16711935,14474460,16316671,16766720,14329120,8421504,8421504,32768,11403055,15794160,16738740,13458524,4915330,16777200,15787660,15132410,16773365,8190976,16775885,11393254,15761536,14745599,16448210,13882323,13882323,9498256,16758465,16752762,2142890,8900346,7833753,7833753,11584734,16777184,65280,3329330,16445670,16711935,8388608,6737322,205,12211667,9662683,3978097,8087790,64154,4772300,13047173,1644912,16121850,16770273,16770229,16768685,128,16643558,8421376,7048739,16753920,16729344,14315734,15657130,10025880,11529966,14381203,16773077,16767673,13468991,16761035,14524637,11591910,8388736,6697881,16711680,12357519,4286945,9127187,16416882,16032864,3050327,16774638,10506797,12632256,8900331,6970061,7372944,7372944,16775930,65407,4620980,13808780,32896,14204888,16737095,4251856,15631086,16113331,16777215,16119285,16776960,10145074],sE={},rE=0,oE=iE.length;rE0&&{height:this.colorComponentsHeight,formatLabel:this.colorComponentsFormatLabelConfig,inputText:this.colorComponentsInputTextConfig,space:this.colorComponentsSpace};var o=new UE(t,{width:n,height:r,background:e,space:this.colorPickerSpace,hPalette:{position:this.colorPickerHPalettePosition},colorComponents:s,value:this.value});return t.add.existing(o),o},NE={openColorPicker:function(){if(!this.colorPicker){var t=HE.call(this).layout(),e=new zT(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(NE,vE);var KE=Phaser.Utils.Objects.GetValue,JE=function(t){a(i,t);var e=d(i);function i(t,s){var r;n(this,i),void 0===s&&(s={}),(r=e.call(this,t,s)).type="rexColorInput",s.hasOwnProperty("colorPicker")||(s.colorPicker={background:{color:0}});var o=s.colorPicker,a=!1!==o&&null!==o;if(a){var h;r.setColorPickerSize(KE(o,"width",160),KE(o,"height",170));var l=KE(o,"background");h=l?function(t){return iC(t,l)}:KE(o,"createBackgroundCallback"),r.setCreateColorPickerBackgroundCallback(h),r.setColorPickerHPalettePosition(KE(o,"hPalettePosition",0)),r.setColorPickerExpandDirection(KE(o,"expandDirection")),r.setColorPickerEaseInDuration(KE(o,"easeIn",200)),r.setColorPickerEaseOutDuration(KE(o,"easeOut",200)),r.setColorPickerTransitInCallback(KE(o,"transitIn")),r.setColorPickerTransitOutCallback(KE(o,"transitOut")),r.setColorPickerBounds(KE(o,"bounds"));var c=KE(o,"space");void 0===c&&(c={left:10,right:10,top:10,bottom:10,item:8}),r.setColorPickerSpace(c);}var d=s.colorComponents;if(a&&(!1!==d&&null!==d)){r.setColorComponentsHeight(KE(d,"height",30)),r.setColorComponentsFormatLabelConfig(KE(d,"formatLabel"));var f=KE(d,"inputText");f||(f=KE(s,"inputText")),r.setColorComponentsInputTextConfig(f);var p=KE(d,"space");void 0===p&&(p={item:8}),r.setColorComponentsSpace(p);}var v=r.childrenMap.swatch;return v&&a&&r.onClick(v,r.openColorPicker,u(r)),r}return r(i)}(pE);Object.assign(JE.prototype,NE),T.register("colorInput",(function(t){var e=new JE(this.scene,t);return this.scene.add.existing(e),e})),Z(window,"RexPlugins.UI.ColorInput",JE),T.register("colorInputLite",(function(t){var e=new pE(this.scene,t);return this.scene.add.existing(e),e})),Z(window,"RexPlugins.UI.ColorInputBase",pE),T.register("colorPicker",(function(t){var e=new jE(this.scene,t);return this.scene.add.existing(e),e})),Z(window,"RexPlugins.UI.ColorPicker",jE),T.register("colorComponents",(function(t){var e=new XE(this.scene,t);return this.scene.add.existing(e),e})),Z(window,"RexPlugins.UI.ColorComponents",XE);var ZE=function(t,e){return function(i,n,s,r){"panel"!==n&&s.moveChild(i,r?0:t,e);}},qE=function(t,e){return function(i,n,s,r){"panel"===n&&s.moveChild(i,r?0:t,e);}},$E={visible:{show:function(){return function(t,e,i,n){"panel"!==e&&i.setChildVisible(t,!0);}},hide:function(){return function(t,e,i,n){"panel"!==e&&i.setChildVisible(t,!1);}}},fade:{show:function(t,e){return void 0===e&&(e=1),function(i,n,s,r){"panel"!==n&&s.fadeChild(i,r?0:t,e);}},hide:function(t,e){return void 0===e&&(e=0),function(i,n,s,r){"panel"!==n&&s.fadeChild(i,r?0:t,e);}}},move:{show:ZE,hide:ZE},"move-panel":{show:qE,hide:qE}},QE=If.prototype.setChildVisible,t_={setChildVisible:function(t,e){if("string"==typeof t){var i=t;t=this.sizerChildren[i];}else i=bk(this.sizerChildren,t);return void 0===e&&(e=this.currentChildKey===i),QE.call(this,t,e),this}},e_={fadeChild:function(t,e,i){var n;return "string"==typeof t?(n=t,t=this.sizerChildren[n]):n=bk(this.sizerChildren,t),void 0===e&&(e=500),void 0===i&&(i=this.currentChildKey===n?1:0),t.fadeIn(e,{start:t.alpha,end:i}),this},fadeChildPromise:function(t,e,i){return "string"==typeof t&&(t=this.sizerChildren[key]),this.fadeChild(t,e,i),t._fade?Sh(t._fade):Promise.resolve()}},i_={moveChild:function(t,e,i,n){var s;"string"==typeof t?(s=t,t=this.sizerChildren[s]):s=bk(this.sizerChildren,t),void 0===e&&(e=500);var r,o,a,h,l=this.currentChildKey===s;if(void 0===n)switch(s){case"leftSide":case"rightSide":n=Er(t);break;case"topSide":case"bottomSide":n=_r(t);break;default:if(l)switch(this.previousChildKey){case"leftSide":case"rightSide":n=Er(this.sizerChildren[this.previousChildKey]);break;case"topSide":case"bottomSide":n=_r(this.sizerChildren[this.previousChildKey]);break;default:n=0;}else switch(this.currentChildKey){case"leftSide":case"rightSide":n=Er(this.sizerChildren[this.currentChildKey]);break;case"topSide":case"bottomSide":n=_r(this.sizerChildren[this.currentChildKey]);break;default:n=0;}}if(l)switch(s){case"panel":switch(this.previousChildKey){case"leftSide":r=!0;break;case"rightSide":o=!0;break;case"topSide":a=!0;break;case"bottomSide":h=!0;}break;case"leftSide":o=!0;break;case"rightSide":r=!0;break;case"topSide":h=!0;break;case"bottomSide":a=!0;}else switch(s){case"panel":switch(this.currentChildKey){case"leftSide":o=!0;break;case"rightSide":r=!0;break;case"topSide":h=!0;break;case"bottomSide":a=!0;}break;case"leftSide":r=!0;break;case"rightSide":o=!0;break;case"topSide":a=!0;break;case"bottomSide":h=!0;}return r?t.moveTo(e,"-=".concat(n),void 0,i):o?t.moveTo(e,"+=".concat(n),void 0,i):a?t.moveTo(e,void 0,"-=".concat(n),i):h?t.moveTo(e,void 0,"+=".concat(n),i):t.moveTo(0),this},moveChildPromise:function(t,e,i,n){return "string"==typeof t&&(t=this.sizerChildren[key]),this.moveChild(t,e,i,n),t._easeMove?Sh(t._easeMove):Promise.resolve()}},n_={};Object.assign(n_,t_,e_,i_);var s_=Phaser.Utils.Objects.GetValue,r_=function(t){a(i,t);var e=d(i);function i(t,s){var r;n(this,i),(r=e.call(this,t,s)).type="rexSides",r.childrenMap=r.sizerChildren,r.previousChildKey=void 0,r.currentChildKey=void 0;var o=s_(s,"showChildCallback",void 0);if(o)if(lg(o)){var a=s_(s,"showChildCallbackScope",void 0);r.on("showchild",o,a);var h=s_(s,"hideChildCallback",void 0),l=s_(s,"hideChildCallbackScope",void 0);r.on("hidechild",h,l);}else {var u=function(t){var e,i,n,s,r=k("string"==typeof t?[t]:t);return e=r[0],i=r.slice(1),$E.hasOwnProperty(e)?(n=$E[e].show.apply(null,i),s=$E[e].hide.apply(null,i)):(n=D,s=D),{show:n,hide:s}}(o);r.on("showchild",u.show),r.on("hidechild",u.hide);}var c=s_(s,"background",void 0),d=s_(s,"panel",void 0),f=s_(s,"leftSide",void 0),p=s_(s,"rightSide",void 0),v=s_(s,"topSide",void 0),g=s_(s,"bottomSide",void 0);if(c&&r.addBackground(c),d&&r.add(d,"panel","center",0,!0),f){var y=s_(s,"expand.left",!0);r.add(f,"leftSide","left-top",0,{height:y});}if(p){y=s_(s,"expand.right",!0);r.add(p,"rightSide","right-top",0,{height:y});}if(v){y=s_(s,"expand.top",!0);r.add(v,"topSide","left-top",0,{width:y});}if(g){y=s_(s,"expand.bottom",!0);r.add(g,"bottomSide","left-bottom",0,{width:y});}return r}return r(i,[{key:"reset",value:function(){return this.previousChildKey=void 0,this.currentChildKey="panel",this.showChild("panel",!0),this.hideChild("leftSide",!0),this.hideChild("rightSide",!0),this.hideChild("topSide",!0),this.hideChild("bottomSide",!0),this}}]),i}(wk);Object.assign(r_.prototype,{showChild:function(t,e){var i=this.sizerChildren[t];return i&&(this.emit("showchild",i,t,this,e),this.resetChildState(i)),this},hideChild:function(t,e){var i=this.sizerChildren[t];return i&&(this.emit("hidechild",i,t,this,e),this.resetChildState(i)),this},swapChild:function(t,e){return this.currentChildKey===t||("panel"===this.currentChildKey||"panel"===t?(this.previousChildKey=this.currentChildKey,this.currentChildKey=t,this.hideChild(this.previousChildKey,e),this.showChild(this.currentChildKey,e)):(this.swapChild("panel",e),this.swapChild(t,e))),this},showPanel:function(t){return this.swapChild("panel",t),this},showLeftSide:function(){return this.swapChild("leftSide"),this},showRightSide:function(){return this.swapChild("rightSide"),this},showTopSide:function(){return this.swapChild("topSide"),this},showBottomSide:function(){return this.swapChild("bottomSide"),this},hideLeftSide:function(){return "leftSide"==this.currentChildKey&&this.showPanel(),this},hideRightSide:function(){return "rightSide"==this.currentChildKey&&this.showPanel(),this},hideTopSide:function(){return "topSide"==this.currentChildKey&&this.showPanel(),this},hideBottomSide:function(){return "bottomSide"==this.currentChildKey&&this.showPanel(),this},toggleLeftSide:function(){var t="panel"!==this.currentChildKey?"panel":"leftSide";return this.swapChild(t),this},toggleRightSide:function(){var t="panel"!==this.currentChildKey?"panel":"rightSide";return this.swapChild(t),this},toggleTopSide:function(){var t="panel"!==this.currentChildKey?"panel":"topSide";return this.swapChild(t),this},toggleBottomSide:function(){var t="panel"!==this.currentChildKey?"panel":"bottomSide";return this.swapChild(t),this}},n_),T.register("sides",(function(t){var e=new r_(this.scene,t);return this.scene.add.existing(e),e})),Z(window,"RexPlugins.UI.Sides",r_);var o_=function(t){a(i,t);var e=d(i);function i(t,s){var r;return n(this,i),s=fC(t,s),(r=e.call(this,t,s)).type="rexTweaker.Title",r}return r(i,[{key:"setTitle",value:function(t){return (t=t?M(t):{}).hasOwnProperty("text")||(t.hasOwnProperty("title")?t.text=t.title:t.text=""),this.resetDisplayContent(t),this}}]),i}(eC),a_=function(t){a(i,t);var e=d(i);function i(t,s){var r;n(this,i),void 0===s&&(s={}),(r=e.call(this,t,s)).type="rexTweaker.FolderTitle";var o=new wd(t,s.expandedIcon);return t.add.existing(o),r.addSpace().add(o,{proportion:0,expand:!1,padding:1,fitRatio:1}),r.addChildrenMap("expandedIcon",o),r}return r(i,[{key:"setExpandedState",value:function(t){void 0===t&&(t=!0);var e=t?"down":"right";return this.childrenMap.expandedIcon.setDirection(e),this}}]),i}(o_),h_=function(t,e){var i=new aR(t,e);return t.add.existing(i),i},l_=function(t,e,i){return iC(t,i)},u_=function(t){a(i,t);var e=d(i);function i(t,s){var r;return n(this,i),(r=e.call(this,t,s)).type="rexTweaker.Folder",r}return r(i,[{key:"setTitle",value:function(t){return this.childrenMap.title.setTitle(t),this}}]),i}(OM);Object.assign(u_.prototype,{setBindingTarget:function(t){return this.childrenMap.child.setBindingTarget(t),this}},{getMaxInputRowTitleWidth:function(){return this.childrenMap.child.getMaxInputRowTitleWidth()+this.getInnerPadding("left")},setInputRowTitleWidth:function(t){return t-=this.getInnerPadding("left"),this.childrenMap.child.setInputRowTitleWidth(t),this}});var c_=Phaser.Utils.Objects.GetValue,d_=Phaser.Utils.Objects.GetValue,f_={getMaxInputRowTitleWidth:function(){for(var t=0,e=this.childrenMap.pages.children,i=0,n=e.length;i1?e-1:0),n=1;n0?0:1,o.setMinWidth(this.itemWidth)),this.add(o,{proportion:r,expand:!0}),n.onValueChange&&a.on("valuechange",n.onValueChange),n.onValidate&&a.setValidateCallback(n.onValidate),o.setAutoUpdateEnable(n.autoUpdate),o.setBindingTarget(t,e),n.monitor&&o.startMonitorTarget(),n.key&&this.root.addChildrenMap(n.key,o),this},addButton:nR,addButtons:nR,addSeparator:function(t){var e=this.scene,i=sR(this.styles,"separator"),n=l_(e,0,i);return this.add(n,{expand:!0}),this},setBindingTarget:function(t){for(var e=this.sizerChildren,i=0,n=e.length;is?r:-r),u.localY=d+(c>n?o:-o);}},zR=Phaser.Utils.Objects.IsPlainObject,AR=Phaser.Utils.Objects.GetValue,FR=Phaser.Math.DegToRad,WR=Phaser.Math.RadToDeg,YR=function(t){a(i,t);var e=d(i);function i(t,s,r,o,a){var h;if(n(this,i),zR(s)){var l=s;s=AR(l,"x",0),r=AR(l,"y",0),o=AR(l,"key",null),a=AR(l,"frame",null);}return (h=e.call(this,t,s,r,o,a)).type="rexSkewmage",h._skewX=0,h._skewY=0,h}return r(i,[{key:"skewX",get:function(){return this._skewX},set:function(t){this._skewX=t,jR(this,this._skewX,this._skewY);}},{key:"skewXDeg",get:function(){return WR(this._skewX)},set:function(t){this.skewX=FR(t);}},{key:"skewY",get:function(){return this._skewY},set:function(t){this._skewY=t,jR(this,this._skewX,this._skewY);}},{key:"skewYDeg",get:function(){return WR(this._skewY)},set:function(t){this.skewY=FR(t);}},{key:"setSkewX",value:function(t){return this.skewX=t,this}},{key:"setSkewY",value:function(t){return this.skewY=t,this}},{key:"setSkew",value:function(t,e){return void 0===e&&(e=t),this.skewX=t,this.skewY=e,this}},{key:"setSkewXDeg",value:function(t){return this.skewXDeg=t,this}},{key:"setSkewYDeg",value:function(t){return this.skewYDeg=t,this}},{key:"setSkewDeg",value:function(t,e){return void 0===e&&(e=t),this.skewXDeg=t,this.skewYDeg=e,this}}]),i}(IR),VR=Phaser.Utils.Objects.IsPlainObject,XR=Phaser.Utils.Objects.GetValue,GR=function(t){a(i,t);var e=d(i);function i(){return n(this,i),e.apply(this,arguments)}return r(i,[{key:"skewState",get:function(){return this.isRunning}}]),i}(sM(function(t){a(i,t);var e=d(i);function i(t,s,r,o,a){var h;if(n(this,i),VR(s)){var l=s;s=XR(l,"x",0),r=XR(l,"y",0),o=XR(l,"width",32),a=XR(l,"height",32);}var u=BO(t,o,a);return (h=e.call(this,t,s,r,u,null)).type="rexSkewRenderTexture",h.rt=h.texture,h}return r(i,[{key:"destroy",value:function(t){this.scene&&!this.ignoreDestroy&&(p(h(i.prototype),"destroy",this).call(this,t),this.rt.destroy(),this.rt=null);}}]),i}(YR)));T.register("skew",(function(t,e){return new GR(t,e)})),Z(window,"RexPlugins.UI.Skew",GR),T.register("anchor",(function(t,e){return new Bp(t,e)})),Z(window,"RexPlugins.UI.Anchor",Bp),T.register("textTyping",(function(t,e){return new eO(t,e)})),Z(window,"RexPlugins.UI.TextTyping",eO),T.register("textPage",(function(t,e){return new qT(t,e)})),Z(window,"RexPlugins.UI.TextPage",qT);var UR=void 0,HR=Phaser.Utils.Objects.GetValue,NR=Phaser.Utils.Objects.Clone,KR=function(t){return t.hasOwnProperty("align")?t.align:t.hasOwnProperty("halign")?t.halign:"left"},JR=Phaser.Utils.Objects.GetValue,ZR=Phaser.Utils.Objects.Merge,qR={open:function(t,e){var i;void 0===t&&(t={}),t=ZR(t,this.openConfig),(i=this)!==UR&&(void 0!==UR&&UR.close(),UR=i),lg(t)&&(e=t,t=void 0);var n=JR(t,"inputType",void 0);void 0===n&&(n=JR(t,"type","text")),void 0===e&&(e=JR(t,"onClose",void 0));var s=JR(t,"onOpen",void 0),r=JR(t,"onTextChanged",void 0);return this.inputText=function(t,e){void 0===e&&(e={}),e=NR(e);var i=t.scene,n=t.style,s=HR(e,"backgroundColor",n.backgroundColor);null===s&&(s="transparent"),e.text=HR(e,"text",t.text),e.fontFamily=HR(e,"fontFamily",n.fontFamily),e.fontSize=HR(e,"fontSize",n.fontSize),e.color=HR(e,"color",n.color),e.backgroundColor=s,e.direction=HR(e,"rtl",n.rtl)?"rtl":"ltr",e.align=HR(e,"align",KR(n)),"rtl"===e.direction&&lC(t)&&(e.align="right");var r=new sb(i,t.x,t.y,HR(e,"width",t.width),HR(e,"height",t.height),e);r.setOrigin(t.originX,t.originY).setScrollFactor(t.scrollFactorX,t.scrollFactorY);var o=t.parentContainer;return o?o.add(r):i.add.existing(r),r}(this.parent,t).on("textchange",(function(t){var e=t.text;r?r(this.parent,e):this.parent.text=e;}),this).setFocus(),this.parent.setVisible(!1),this.onClose=e,JR(t,"enterClose","textarea"!==n)&&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),s&&s(this.parent),this.emit("open",this.parent);}),this),this},close:function(){return this===UR&&(UR=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}},$R=Phaser.Utils.Objects.GetValue,QR=function(t){a(i,t);var e=d(i);function i(t,s){var r;return n(this,i),(r=e.call(this,t)).inputText=void 0,r.onClose=void 0,r.delayCall=void 0,r.setOpenConfig(s),$R(s,"clickEnable",!0)&&t.on("pointerdown",(function(){this.open();}),u(r)).setInteractive(),r}return r(i,[{key:"shutdown",value:function(t){this.isShutdown||(this.close(),p(h(i.prototype),"shutdown",this).call(this,t));}},{key:"setOpenConfig",value:function(t){return void 0===t&&(t={}),this.openConfig=t,this}},{key:"isOpened",get:function(){return void 0!==this.inputText}},{key:"text",get:function(){return this.isOpened?this.inputText.text:this.parent.text}}]),i}(ro);Object.assign(QR.prototype,qR);T.register("textEdit",(function(t,e){return new QR(t,e)})),Z(window,"RexPlugins.UI.TextEdit",QR);var tL=65535,eL=function(t,e,i){if(null==e)return t;if(0===e)return sL(t,0,i),t;var n=t.text.length;if(0===n)return sL(t,e,i),t;var s=Math.floor(1.5*e/n);void 0!==i&&s>i&&(s=Math.floor(i));for(var r={},o=nL(t,s,e,i,r),a=0;a<=tL&&0!==o;a++){if((s+=o)<0){s=0;break}o=nL(t,s,e,i,r);}return a===tL&&console.warn("FontSizeFit: Test count exceeds ".concat(tL)),t.setFontSize(s),sL(t,e,i),t},iL=function(t,e,i){return void 0===i[e]&&(t.setFontSize(e),i[e]={width:t.width,height:t.height}),i[e]},nL=function(t,e,i,n,s){var r,o=iL(t,e,s),a=iL(t,e+1,s);if(void 0!==n)if(o.height<=n&&a.height>n)r=0;else {if(o.height>n)return -1;r=Math.floor(n-o.height);}if(o.width<=i&&a.width>i)return 0;if(o.width>i)return -1;var h=Math.floor(i-o.width);return void 0===r?h:Math.min(h,r)},sL=function(t,e,i){var n=t.style;n&&(n.fixedWidth=e,n.parent.width=e,void 0!==i&&(n.fixedHeight=i,n.parent.height=i),n.update(!1));},rL=Phaser.Utils.Objects.GetValue,oL=function(t){a(i,Phaser.Plugins.ScenePlugin);var e=d(i);function i(t,s){var r;return n(this,i),(r=e.call(this,t,s)).add=new T(t),r}return r(i,[{key:"start",value:function(){this.scene.events.on("destroy",this.destroy,this);}},{key:"isInTouching",value:function(t,e,i,n){return !!t.visible&&cg(t,e,i,n)}},{key:"viewport",get:function(){return Jr(this.scene,this.scene.cameras.main,!0)}}]),i}(),aL={getParentSizer:Ld,getTopmostSizer:Bd,hide:Sv,show:wv,isShown:Pv,edit:function(t,e,i){return t._edit||(t._edit=new QR(t,{clickEnable:!1})),t._edit.open(e,i),t._edit},wrapExpandText:uC,fontSizeExpandText:function(t,e){"number"==typeof e&&(e={minWidth:e});var i=rL(e,"minWidth",0),n=rL(e,"minHeight",0),s=rL(e,"fitHeight",!1);return t._minWidth=i,t._minHeight=n,s?(t.runWidthWrap=function(e){return t.setFixedSize&&t.setFixedSize(0,0),t.setFontSize(1),t},t.resize=function(e,i){return eL(t,e,i),t}):(t.runWidthWrap=function(e){return t.setFixedSize&&t.setFixedSize(0,0),eL(t,e,void 0),t},t.resize=function(e,i){return t.width===e&&t.height===i||t.setFixedSize(e,i),t}),t},fontSizeResize:eL,setFontSizeToFitWidth:eL,waitEvent:wh,waitComplete:Sh,delayPromise:ab,setChildrenInteractive:ok,fadeIn:Zp,fadeOutDestroy:qp,easeMoveTo:av,easeMoveFrom:hv,modal:ag,modalPromise:function(t,e){var i=ag(t,e);return new Promise((function(t,e){i.once("close",(function(e){t(e);}));}))},modalClose:hg,requestDrag:lR,openFileChooser:function(t,e){var i=lb(e,"closeDelay",200),n=function(t){var e=document.createElement("input");e.type="file";var i=ob(t,"accept",""),n=ob(t,"multiple",!1);return e.setAttribute("accept",i),n?e.setAttribute("multiple",""):e.removeAttribute("multiple"),e}(e);return n.click(),hb({game:t,fileInput:n,closeDelay:i}).then((function(t){return n.remove(),Promise.resolve(t)}))}};return Object.assign(oL.prototype,aL),oL})); + */Object.assign(xi.prototype,He,Ci);var wi=function(t){a(i,t);var e=d(i);function i(){return n(this,i),e.apply(this,arguments)}return r(i,[{key:"freeLine",value:function(t){if(t)return this.push(t),this}},{key:"freeLines",value:function(t){if(t)return this.pushMultiple(t),this}},{key:"getLine",value:function(t,e,i){var n=this.pop();return null===n&&(n={}),n.text=t,n.width=e,n.newLineMode=i,n}}]),i}(st),Si=Phaser.Utils.Objects.IsPlainObject,Pi=Phaser.Utils.Objects.GetValue,Ti=function(t,e){Si(t)?t=(e=t).key:void 0===e&&(e={key:t}),e.hasOwnProperty("key")||(e.key=t);var i=e.key,n=e.frame,s=e.width,r=e.height;if(void 0===s||void 0===r){var o=this.textureManager.getFrame(i,n),a=o?o.cutWidth:0,h=o?o.cutHeight:0;void 0===s&&void 0===r?(s=a,r=h):void 0===s?s=a*(r/h):void 0===r&&(r=h*(s/a));}this.images[t]={key:i,frame:n,width:s,height:r,y:Pi(e,"y",0),left:Pi(e,"left",0),right:Pi(e,"right",0),originX:Pi(e,"originX",0),originY:Pi(e,"originY",0)};},Oi=function(){function t(e){n(this,t),this.textureManager=e.sys.textures,this.images={};}return r(t,[{key:"destroy",value:function(){this.textureManager=void 0,this.images=void 0;}},{key:"add",value:function(t,e){if("string"==typeof t)Ti.call(this,t,e);else if(Array.isArray(t))for(var i=0,n=(s=t).length;i").concat(t,""):e.hasOwnProperty("_style")?"").concat(t,""):t}},{key:"destroy",value:function(){this.tags=void 0;}},{key:"isTextTag",value:function(t){var e=this.tags[t];return !!e&&null==e.img}}]),t}(),gn=function(t){for(var e,i,n,s={},r=0,o=(t=t.split(";")).length;r=1&&(n.color=a[0]),h>=2&&(n.thickness=parseInt(a[1].replace("px","")));break;case"shadow":a=n.split(" ");n={},(h=a.length)>=1&&(n.color=a[0]),h>=2&&(n.offsetX=parseInt(a[1].replace("px",""))),h>=3&&(n.offsetY=parseInt(a[2].replace("px",""))),h>=4&&(n.blur=parseInt(a[3].replace("px","")));break;case"u":case"underline":case"s":case"strikethrough":var h;a=n.split(" ");n={},(h=a.length)>=1&&(n.color=a[0]),h>=2&&(n.thickness=parseInt(a[1].replace("px",""))),h>=3&&(n.offset=parseInt(a[2].replace("px",""))),"underline"===i?i="u":"strikethrough"===i&&(i="s");break;case"y":n=parseFloat(n);}s[i]=n;}return s},yn=function(t){return 0===(t=t.replace(wn,"")).length},kn=/<\s*class=["|']([^"|']+)["|']\s*\>([\s\S]*?)<\s*\/class\s*\>|<\s*style=["|']([^"|']+)["|']\s*\>([\s\S]*?)<\s*\/style\s*\>/g,mn=/<\s*class=/i,bn=/<\s*class=["|']([^"|']+)["|']\s*\>([\s\S]*?)<\s*\/class\s*\>/,xn=/<\s*style=/i,Cn=/<\s*style=["|']([^"|']+)["|']\s*\>([\s\S]*?)<\s*\/style\s*\>/,wn=/^\s+|\s+$/,Sn=Phaser.Utils.Objects.GetValue,Pn=function(t){a(i,t);var e=d(i);function i(t,s,r,o,a){n(this,i);var h=Sn(a,"tags",void 0),l=new vn(h);return e.call(this,t,s,r,o,a,"rexTagText",l)}return r(i,[{key:"addTag",value:function(t,e){return this.parser.addTag(t,e),this.updateText(!0)}},{key:"addTags",value:function(t){for(var e in t)this.parser.addTag(e,t[e]);return this.updateText(!0)}},{key:"getTag",value:function(t){return this.parser.getTag(t)}},{key:"preDestroy",value:function(){p(h(i.prototype),"preDestroy",this).call(this),this.parser.destroy(),this.parser=void 0;}}]),i}(Wi);T.register("tagText",(function(t,e,i,n){var s=new Pn(this.scene,t,e,i,n);return this.scene.add.existing(s),s})),Z(window,"RexPlugins.UI.TagText",Pn);var Tn=Phaser.Utils.Objects.GetValue,On=function(t,e){return void 0===e?t:t[e]},Mn=function(t,e,n){void 0===t&&(t={}),void 0===e&&(e=0);var s=i(e);return "string"===s?t[e]=n:"number"===s?(t.left=e,t.right=e,t.top=e,t.bottom=e):(t.left=Tn(e,"left",0),t.right=Tn(e,"right",0),t.top=Tn(e,"top",0),t.bottom=Tn(e,"bottom",0)),t},En=function(){function t(e,i){n(this,t),this.setParent(e),this.type=i,this.renderable=!1,this.reset().setActive();}return r(t,[{key:"destroy",value:function(){this.parent.removeChild(this);}},{key:"setParent",value:function(t){return this.parent=t,this}},{key:"scene",get:function(){return this.parent.scene}},{key:"canvas",get:function(){return this.parent?this.parent.canvas:null}},{key:"context",get:function(){return this.parent?this.parent.context:null}},{key:"setDirty",value:function(t){return t&&this.parent&&(this.parent.dirty=!0),this}},{key:"active",get:function(){return this._active},set:function(t){this.setDirty(this._active!=t),this._active=t;}},{key:"setActive",value:function(t){return void 0===t&&(t=!0),this.active=t,this}},{key:"modifyPorperties",value:function(t){return this}},{key:"onFree",value:function(){this.reset().setParent();}},{key:"reset",value:function(){return this}},{key:"render",value:function(){}},{key:"contains",value:function(t,e){return !1}}]),t}();Object.assign(En.prototype,Ct);var _n,Rn,Ln,Bn,Dn,In={renderContent:function(){},render:function(){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}},jn=Phaser.Math.RotateAround,zn=Phaser.Geom.Rectangle,An=function(t){void 0===Rn&&(Rn=new zn);var e=t.drawTLX,i=t.drawTLY;return Rn.setTo(e,i,t.drawTRX-e,t.drawBLY-i),Rn},Fn=Phaser.Math.RotateAround,Wn=function(t,e,i,n){return void 0===n?n={}:!0===n&&(void 0===Ln&&(Ln={}),n=Ln),n.x=e,n.y=i,0!==t.rotation&&Fn(n,0,0,t.rotation),n.x=n.x*t.scaleX+t.drawX,n.y=n.y*t.scaleY+t.drawY,n},Yn=Phaser.GameObjects.Components.TransformMatrix,Xn={},Vn=function(t,e,i,n,s){var r=Wn(e,i,n,!0),o=function(t,e,i,n){void 0===n?n={}:!0===n&&(n=Xn);var s=e-t.width*t.originX,r=i-t.height*t.originY;return void 0===Bn&&(Bn=new Yn,Dn=new Yn),t.parentContainer?t.getWorldTransformMatrix(Bn,Dn):Bn.applyITRS(t.x,t.y,t.rotation,t.scaleX,t.scaleY),Bn.transformPoint(s,r,n),n}(t,r.x,r.y,s);return o},Gn=function(t,e,i,n,s){"number"!=typeof i&&(s=i,i=0,n=0);var r=e.drawCenterX+i,o=e.drawCenterY+n;return Vn(t,e,r,o,s)},Un={contains:function(t,e){if(0===this.width||0===this.height)return !1;var i=function(t,e,i,n){return void 0===n?n={}:!0===n&&(void 0===_n&&(_n={}),n=_n),n.x=(t-i.drawX)/i.scaleX,n.y=(e-i.drawY)/i.scaleY,0!==i.rotation&&jn(n,0,0,-i.rotation),n}(t,e,this,!0);return An(this).contains(i.x,i.y)},getWorldPosition:function(t,e,i){return Gn(this.parent,this,t,e,i)}};Object.assign(Un,In);var Hn=Phaser.Math.DegToRad,Nn=Phaser.Math.RadToDeg,Kn=Phaser.Utils.Objects.GetValue,Jn=function(t){a(i,t);var e=d(i);function i(t,s){var r;return n(this,i),(r=e.call(this,t,s)).renderable=!0,r.scrollFactorX=1,r.scrollFactorY=1,r.toLocalPosition=!0,r.originX=0,r.offsetX=0,r.offsetY=0,r}return r(i,[{key:"visible",get:function(){return this._visible},set:function(t){this.setDirty(this._visible!=t),this._visible=t;}},{key:"setVisible",value:function(t){return void 0===t&&(t=!0),this.visible=t,this}},{key:"alpha",get:function(){return this._alpha},set:function(t){this.setDirty(this._alpha!=t),this._alpha=t;}},{key:"setAlpha",value:function(t){return this.alpha=t,this}},{key:"x",get:function(){return this._x},set:function(t){this.setDirty(this._x!=t),this._x=t;}},{key:"setX",value:function(t){return this.x=t,this}},{key:"y",get:function(){return this._y},set:function(t){this.setDirty(this._y!=t),this._y=t;}},{key:"setY",value:function(t){return this.y=t,this}},{key:"setPosition",value:function(t,e){return this.x=t,this.y=e,this}},{key:"setInitialPosition",value:function(t,e){return this.x0=t,this.y0=e,this}},{key:"setScrollFactorX",value:function(t){return this.scrollFactorX=t,this}},{key:"setScrollFactorY",value:function(t){return this.scrollFactorY=t,this}},{key:"setScrollFactor",value:function(t,e){return void 0===e&&(e=t),this.scrollFactorX=t,this.scrollFactorY=e,this}},{key:"rotation",get:function(){return this._rotation},set:function(t){this.setDirty(this._rotation!=t),this._rotation=t;}},{key:"setRotation",value:function(t){return this.rotation=t,this}},{key:"angle",get:function(){return Nn(this._rotation)},set:function(t){this.rotation=Hn(t);}},{key:"setAngle",value:function(t){return this.angle=t,this}},{key:"scaleX",get:function(){return this._scaleX},set:function(t){this.setDirty(this._scaleX!==t),this._scaleX=t;}},{key:"setScaleX",value:function(t){return this.scaleX=t,this}},{key:"width",get:function(){return 0},set:function(t){}},{key:"setWidth",value:function(t,e){return void 0===e&&(e=!1),this.width=t,e&&(this.scaleY=this.scaleX),this}},{key:"leftSpace",get:function(){return this._leftSpace},set:function(t){this.setDirty(this._leftSpace!==t),this._leftSpace=t;}},{key:"setLeftSpace",value:function(t){return this.leftSpace=t,this}},{key:"rightSpace",get:function(){return this._rightSpace},set:function(t){this.setDirty(this._rightSpace!==t),this._rightSpace=t;}},{key:"setRightSpace",value:function(t){return this.rightSpace=t,this}},{key:"outerWidth",get:function(){return this.width+this.leftSpace+this.rightSpace}},{key:"scaleY",get:function(){return this._scaleY},set:function(t){this.setDirty(this._scaleY!==t),this._scaleY=t;}},{key:"setScaleY",value:function(t){return this.scaleY=t,this}},{key:"height",get:function(){return 0},set:function(t){}},{key:"setHeight",value:function(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}},{key:"setScale",value:function(t,e){return void 0===e&&(e=t),this.scaleX=t,this.scaleY=e,this}},{key:"setOrigin",value:function(t){return this.originX=t,this}},{key:"setAlign",value:function(t){return this.align=t,this}},{key:"modifyPorperties",value:function(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=Kn(t,"width",void 0),i=Kn(t,"height",void 0),n=Kn(t,"scaleX",void 0),s=Kn(t,"scaleY",void 0);return void 0!==e?void 0===i&&void 0===s?this.setWidth(e,!0):this.setWidth(e):void 0!==n&&this.setScaleX(n),void 0!==i?void 0===e&&void 0===n?this.setHeight(i,!0):this.setHeight(i):void 0!==s&&this.setScaleY(s),t.hasOwnProperty("leftSpace")&&this.setLeftSpace(t.leftSpace),t.hasOwnProperty("rightSpace")&&this.setRightSpace(t.rightSpace),t.hasOwnProperty("align")&&this.setAlign(t.align),this}},{key:"setDrawBelowCallback",value:function(t){return this.drawBelowCallback=t,this}},{key:"setDrawAboveCallback",value:function(t){return this.drawAboveCallback=t,this}},{key:"reset",value:function(){return this.setVisible().setAlpha(1).setPosition(0,0).setRotation(0).setScale(1,1).setLeftSpace(0).setRightSpace(0).setOrigin(0).setAlign().setDrawBelowCallback().setDrawAboveCallback(),this}},{key:"willRender",get:function(){return this.visible&&this.alpha>0}},{key:"drawX",get:function(){var t=this.x+this.leftSpace+this.offsetX-this.originX*this.width;return this.parent._textOX*this.scrollFactorX+t}},{key:"drawY",get:function(){var t=this.y+this.offsetY;return this.parent._textOY*this.scrollFactorY+t}},{key:"drawTLX",get:function(){return 0}},{key:"drawTLY",get:function(){return 0}},{key:"drawBLX",get:function(){return 0}},{key:"drawBLY",get:function(){return 0}},{key:"drawTRX",get:function(){return 0}},{key:"drawTRY",get:function(){return 0}},{key:"drawBRX",get:function(){return 0}},{key:"drawBRY",get:function(){return 0}},{key:"drawCenterX",get:function(){return (this.drawTRX+this.drawTLX)/2}},{key:"drawCenterY",get:function(){return (this.drawBLY+this.drawTLY)/2}}]),i}(En);Object.assign(Jn.prototype,Un);var Zn=function(t,e,i){return e.hasOwnProperty(t)?e[t]:i[t]},qn=Phaser.Utils.Objects.GetValue,$n=function(t){a(i,t);var e=d(i);function i(t,s){var r;return n(this,i),(r=e.call(this,t,"background")).setScrollFactor(0),r.setColor(qn(s,"color",null),qn(s,"color2",null),qn(s,"horizontalGradient",!0)),r.setStroke(qn(s,"stroke",null),qn(s,"strokeThickness",2)),r.setCornerRadius(qn(s,"cornerRadius",0),qn(s,"cornerIteration",null)),r}return r(i,[{key:"color",get:function(){return this._color},set:function(t){t=ye(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t;}},{key:"color2",get:function(){return this._color2},set:function(t){t=ye(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t;}},{key:"horizontalGradient",get:function(){return this._horizontalGradient},set:function(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t;}},{key:"setColor",value:function(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}},{key:"stroke",get:function(){return this._stroke},set:function(t){t=ye(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t;}},{key:"strokeThickness",get:function(){return this._strokeThickness},set:function(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t;}},{key:"setStroke",value:function(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}},{key:"cornerRadius",get:function(){return this._cornerRadius},set:function(t){this.setDirty(this._cornerRadius!=t),this._cornerRadius=t;}},{key:"cornerIteration",get:function(){return this._cornerIteration},set:function(t){this.setDirty(this._cornerIteration!=t),this._cornerIteration=t;}},{key:"modifyStyle",value:function(t){return t.hasOwnProperty("color")&&this.setColor(t.color,Zn("color2",t,this),Zn("horizontalGradient",t,this)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,Zn("strokeThickness",t,this)),t.hasOwnProperty("cornerRadius")&&this.setCornerRadius(t.cornerRadius,Zn("cornerIteration",t,this)),this}},{key:"modifyPorperties",value:function(t){return p(h(i.prototype),"modifyPorperties",this).call(this,t),this.modifyStyle(t),this}},{key:"setCornerRadius",value:function(t,e){return this.cornerRadius=t,this.cornerIteration=e,this}},{key:"renderContent",value:function(){we(this.parent,this.color,this.stroke,this.strokeThickness,this.cornerRadius,this.color2,this.horizontalGradient,this.cornerIteration);}}]),i}(Jn),Qn=Phaser.Utils.Objects.GetValue,ts=function(t){a(i,t);var e=d(i);function i(t,s){var r;return n(this,i),(r=e.call(this,t,"innerbounds")).setScrollFactor(0),r.setColor(Qn(s,"color",null),Qn(s,"color2",null),Qn(s,"horizontalGradient",!0)),r.setStroke(Qn(s,"stroke",null),Qn(s,"strokeThickness",2)),r}return r(i,[{key:"color",get:function(){return this._color},set:function(t){t=ye(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t;}},{key:"color2",get:function(){return this._color2},set:function(t){t=ye(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t;}},{key:"horizontalGradient",get:function(){return this._horizontalGradient},set:function(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t;}},{key:"setColor",value:function(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}},{key:"stroke",get:function(){return this._stroke},set:function(t){t=ye(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t;}},{key:"strokeThickness",get:function(){return this._strokeThickness},set:function(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t;}},{key:"setStroke",value:function(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}},{key:"modifyPorperties",value:function(t){p(h(i.prototype),"modifyPorperties",this).call(this,t),t.hasOwnProperty("color")&&this.setColor(t.color,Qn(t,"color2",null),Qn(t,"horizontalGradient",!0)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,Qn(t,"strokeThickness",2));}},{key:"renderContent",value:function(){var t=this.parent.padding,e=t.left,i=t.top,n=this.parent.width-t.left-t.right,s=this.parent.height-t.top-t.bottom,r=this.context;if(null!=this.color){var o,a;if(null!=this.color2)(a=this.horizontalGradient?r.createLinearGradient(0,0,n,0):r.createLinearGradient(0,0,0,s)).addColorStop(0,this.color),a.addColorStop(1,this.color2),o=a;else o=this.color;r.fillStyle=o,r.fillRect(e,i,n,s);}null!=this.stroke&&this.strokeThickness>0&&(r.strokeStyle=this.stroke,r.lineWidth=this.strokeThickness,r.strokeRect(e,i,n,s));}}]),i}(Jn),es=Phaser.Utils.Objects.GetValue,is=function(){function t(e,i){n(this,t),this.parent=e,this.set(i);}return r(t,[{key:"toJSON",value:function(){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}}},{key:"set",value:function(t){return this.setBold(es(t,"bold",!1)),this.setItalic(es(t,"italic",!1)),this.setFontSize(es(t,"fontSize","16px")),this.setFontFamily(es(t,"fontFamily","Courier")),this.setColor(es(t,"color","#fff")),this.setStrokeStyle(es(t,"stroke",null),es(t,"strokeThickness",0)),this.setShadow(es(t,"shadowColor",null),es(t,"shadowOffsetX",0),es(t,"shadowOffsetY",0),es(t,"shadowBlur",0)),this.setOffset(es(t,"offsetX",0),es(t,"offsetY",0)),this.setSpace(es(t,"leftSpace",0),es(t,"rightSpace",0)),this.setAlign(es(t,"align",void 0)),this.setBackgroundColor(es(t,"backgroundColor",null)),this.setBackgroundHeight(es(t,"backgroundHeight",void 0)),this.setBackgroundBottomY(es(t,"backgroundBottomY",void 0)),this}},{key:"modify",value:function(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(Zn("stroke",t,this),Zn("strokeThickness",t,this)),t.hasOwnProperty("shadowColor")&&this.setShadowColor(t.shadowColor),(t.hasOwnProperty("shadowOffsetX")||t.hasOwnProperty("shadowOffsetY"))&&this.setShadowOffset(Zn("shadowOffsetX",t,this),Zn("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}},{key:"setUpdateTextFlag",value:function(){return this.parent&&(this.parent.updateTextFlag=!0),this}},{key:"clone",value:function(){return new t(null,this.toJSON())}},{key:"copyFrom",value:function(t){return this.set(t.toJSON()),this}},{key:"copyTo",value:function(t){return t.set(this.toJSON()),this}},{key:"setBold",value:function(t){return void 0===t&&(t=!0),this.bold=t,this.setUpdateTextFlag(),this}},{key:"setItalic",value:function(t){return void 0===t&&(t=!0),this.italic=t,this.setUpdateTextFlag(),this}},{key:"fontStyle",get:function(){return this.bold&&this.italic?"bold italic":this.bold?"bold":this.italic?"italic":""}},{key:"setFontSize",value:function(t){return "number"==typeof t&&(t="".concat(t,"px")),this.fontSize=t,this.setUpdateTextFlag(),this}},{key:"setFontFamily",value:function(t){return this.fontFamily=t,this.setUpdateTextFlag(),this}},{key:"font",get:function(){return "".concat(this.fontStyle," ").concat(this.fontSize," ").concat(this.fontFamily)}},{key:"setColor",value:function(t){return this.color=ye(t),this}},{key:"hasFill",get:function(){return null!=this.color}},{key:"setStrokeStyle",value:function(t,e){return this.stroke=ye(t),void 0!==e&&(this.strokeThickness=e),this}},{key:"setStrokeThickness",value:function(t){return this.strokeThickness=t,this}},{key:"hasStroke",get:function(){return null!=this.stroke&&this.strokeThickness>0}},{key:"setShadowColor",value:function(t){return this.shadowColor=ye(t),this}},{key:"setShadowOffset",value:function(t,e){return void 0===t&&(t=0),void 0===e&&(e=0),this.shadowOffsetX=t,this.shadowOffsetY=e,this}},{key:"setShadowBlur",value:function(t){return void 0===t&&(t=0),this.shaodwBlur=t,this}},{key:"setShadow",value:function(t,e,i,n){return this.setShadowColor(t).setShadowOffset(e,i).setShadowBlur(n),this}},{key:"setBackgroundColor",value:function(t){return this.backgroundColor=ye(t),this}},{key:"hasBackgroundColor",get:function(){return null!=this.backgroundColor}},{key:"setBackgroundHeight",value:function(t){return this.backgroundHeight=t,this}},{key:"setBackgroundBottomY",value:function(t){return this.backgroundBottomY=t,this}},{key:"setOffsetX",value:function(t){return void 0===t&&(t=0),this.offsetX=t,this}},{key:"setOffsetY",value:function(t){return void 0===t&&(t=0),this.offsetY=t,this}},{key:"setOffset",value:function(t,e){return this.setOffsetX(t).setOffsetY(e),this}},{key:"setLeftSpace",value:function(t){return void 0===t&&(t=0),this.leftSpace=t,this}},{key:"setRightSpace",value:function(t){return void 0===t&&(t=0),this.rightSpace=t,this}},{key:"setSpace",value:function(t,e){return this.setLeftSpace(t).setRightSpace(e),this}},{key:"setAlign",value:function(t){return this.align=t,this}},{key:"syncFont",value:function(t){return t.font=this.font,this}},{key:"syncStyle",value:function(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}},{key:"syncShadow",value:function(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);}},{key:"getTextMetrics",value:function(t,e){return this.syncFont(t).syncStyle(t),t.measureText(e)}}]),t}(),ns=Phaser.Utils.Array.Remove,ss=Phaser.Utils.Array.Remove,rs="text",os="image",as="drawer",hs="space",ls="command",us=function(t){return t.type===rs&&"\n"===t.text},cs=function(t){return t.type===rs&&"\f"===t.text},ds=function(t){return t.type===rs},fs=function(t){return t.type===ls},ps=function(t){a(i,t);var e=d(i);function i(t,s,r){var o;return n(this,i),(o=e.call(this,t,rs)).updateTextFlag=!1,o.style=new is(u(o),r),o.setText(s),o}return r(i,[{key:"autoRound",get:function(){return this.parent.autoRound}},{key:"offsetX",get:function(){return this.style.offsetX},set:function(t){this.style&&(this.style.offsetX=t);}},{key:"offsetY",get:function(){return this.style.offsetY},set:function(t){this.style&&(this.style.offsetY=t);}},{key:"leftSpace",get:function(){return this.style.leftSpace*this.scaleX},set:function(t){this.style&&(this.style.leftSpace=t),g(h(i.prototype),"leftSpace",t,this,!0);}},{key:"rightSpace",get:function(){return this.style.rightSpace*this.scaleX},set:function(t){this.style&&(this.style.rightSpace=t),g(h(i.prototype),"rightSpace",t,this,!0);}},{key:"align",get:function(){return this.style.align},set:function(t){this.style&&(this.style.align=t);}},{key:"modifyStyle",value:function(t){return this.setDirty(!0),this.style.modify(t),this.updateTextFlag&&this.updateTextSize(),this}},{key:"modifyPorperties",value:function(t){return t?(this.modifyStyle(t),p(h(i.prototype),"modifyPorperties",this).call(this,t),this):this}},{key:"setText",value:function(t){return this.setDirty(this.text!=t),this.text=t,this.updateTextSize(),this}},{key:"updateTextSize",value:function(){var t=this.text;if("\n"===t||"\f"===t||""===t)this.clearTextSize();else {var e,i,n=this.style.getTextMetrics(this.context,this.text);this.textWidth=n.width,"actualBoundingBoxAscent"in n?(e=n.actualBoundingBoxAscent,i=n.actualBoundingBoxDescent):(e=0,i=0),this.textHeight=e+i,this.ascent=e,this.descent=i;}return this.updateTextFlag=!1,this}},{key:"clearTextSize",value:function(){return this.textWidth=0,this.textHeight=0,this.ascent=0,this.descent=0,this}},{key:"copyTextSize",value:function(t){return this.textWidth=t.textWidth,this.textHeight=t.textHeight,this.ascent=t.ascent,this.descent=t.descent,this}},{key:"width",get:function(){return this.textWidth*this.scaleX},set:function(t){this.textWidth>0?this.scaleX=t/this.textWidth:this.scaleX=1;}},{key:"height",get:function(){return this.textHeight*this.scaleY},set:function(t){this.textHeight>0?this.scaleY=t/this.textHeight:this.scaleY=1;}},{key:"willRender",get:function(){return 0!==this.textWidth&&p(h(i.prototype),"willRender",this)}},{key:"renderContent",value:function(){var t=this.context,e=this.style;if(e.hasBackgroundColor){t.fillStyle=e.backgroundColor;var i=this.drawTLX,n=this.drawTRX-i,s=e.backgroundBottomY;null==s&&(s=this.drawBLY);var r=e.backgroundHeight;null==r&&(r=s-this.drawTLY);var o=s-r;t.fillRect(i,o,n,r);}var a=e.hasFill,h=e.hasStroke;(a||h)&&(e.syncFont(t).syncStyle(t),h&&(e.syncShadow(t),t.strokeText(this.text,0,0)),a&&(e.syncShadow(t),t.fillText(this.text,0,0)));}},{key:"drawTLX",get:function(){return -this.leftSpace}},{key:"drawTLY",get:function(){return -this.ascent}},{key:"drawBLX",get:function(){return -this.leftSpace}},{key:"drawBLY",get:function(){return this.descent}},{key:"drawTRX",get:function(){return this.textWidth+this.rightSpace}},{key:"drawTRY",get:function(){return -this.ascent}},{key:"drawBRX",get:function(){return this.textWidth+this.rightSpace}},{key:"drawBRY",get:function(){return this.descent}}]),i}(Jn),vs=function(t,e){var i=this.createCharChildren(t,e);return this.addChild(i),this},gs=function(t){a(i,t);var e=d(i);function i(t,s,r){var o;return n(this,i),(o=e.call(this,t,os)).setTexture(s,r),o}return r(i,[{key:"frameWidth",get:function(){return this.frameObj?this.frameObj.cutWidth:0}},{key:"frameHeight",get:function(){return this.frameObj?this.frameObj.cutHeight:0}},{key:"offsetY",get:function(){return -this.height},set:function(t){}},{key:"key",get:function(){return this._key},set:function(t){this.setDirty(this._key!=t),this._key=t;}},{key:"frame",get:function(){return this._frame},set:function(t){this.setDirty(this._frame!=t),this._frame=t;}},{key:"setTexture",value:function(t,e){return this.key=t,this.frame=e,this.frameObj=this.scene.sys.textures.getFrame(t,e),this}},{key:"width",get:function(){return this.frameWidth*this.scaleX},set:function(t){this.setDirty(this.width!==t),this.scaleX=t/this.frameWidth;}},{key:"height",get:function(){return this.frameHeight*this.scaleY},set:function(t){this.setDirty(this.height!==t),this.scaleY=t/this.frameHeight;}},{key:"setHeight",value:function(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}},{key:"renderContent",value:function(){var t=this.context,e=this.frameObj,i=this.frameWidth,n=this.frameHeight;t.drawImage(e.source.image,e.cutX,e.cutY,i,n,0,0,i,n);}},{key:"drawTLX",get:function(){return -this.leftSpace}},{key:"drawTLY",get:function(){return 0}},{key:"drawBLX",get:function(){return -this.leftSpace}},{key:"drawBLY",get:function(){return this.frameHeight}},{key:"drawTRX",get:function(){return this.frameWidth+this.rightSpace}},{key:"drawTRY",get:function(){return 0}},{key:"drawBRX",get:function(){return this.frameWidth+this.rightSpace}},{key:"drawBRY",get:function(){return this.frameHeight}}]),i}(Jn),ys=function(t,e,i){var n=this.createImageChild(t,e,i);return this.addChild(n),this},ks=function(t){a(i,t);var e=d(i);function i(t,s,r,o){var a;return n(this,i),(a=e.call(this,t,as)).setRenderCallback(s),a.setDrawerSize(r,o),a}return r(i,[{key:"setRenderCallback",value:function(t){return t?this.renderContent=t.bind(this):delete this.renderContent,this}},{key:"setDrawerSize",value:function(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}},{key:"onFree",value:function(){p(h(i.prototype),"onFree",this).call(this),this.setRenderCallback();}},{key:"width",get:function(){return this.drawerWidth*this.scaleX},set:function(t){this.setDirty(this.width!==t),this.scaleX=this.drawerWidth>0?t/this.drawerWidth:1;}},{key:"height",get:function(){return this.drawerHeight*this.scaleY},set:function(t){this.setDirty(this.height!==t),this.scaleY=this.drawerHeight>0?t/this.drawerHeight:1;}},{key:"offsetY",get:function(){return -this.height},set:function(t){}},{key:"drawTLX",get:function(){return -this.leftSpace}},{key:"drawTLY",get:function(){return 0}},{key:"drawBLX",get:function(){return -this.leftSpace}},{key:"drawBLY",get:function(){return this.drawerHeight}},{key:"drawTRX",get:function(){return this.drawerWidth+this.rightSpace}},{key:"drawTRY",get:function(){return 0}},{key:"drawBRX",get:function(){return this.drawerWidth+this.rightSpace}},{key:"drawBRY",get:function(){return this.drawerHeight}}]),i}(Jn),ms=function(t){a(i,t);var e=d(i);function i(t,s){var r;return n(this,i),(r=e.call(this,t,hs)).setSpaceWidth(s),r}return r(i,[{key:"width",get:function(){return this.spaceWidth*this.scaleX},set:function(t){this.spaceWidth>0?this.scaleX=t/this.spaceWidth:this.scaleX=1;}},{key:"setSpaceWidth",value:function(t){return this.spaceWidth=t,this}}]),i}(Jn),bs=function(t){var e=this.createSpaceChild(t);return this.addChild(e),this},xs=function(t){a(i,t);var e=d(i);function i(t,s,r,o,a){var h;return n(this,i),(h=e.call(this,t,ls)).setName(s).setParameter(o).setCallback(r,a),h}return r(i,[{key:"setName",value:function(t){return this.name=t,this}},{key:"setParameter",value:function(t){return this.param=t,this}},{key:"setCallback",value:function(t,e){return this.callback=t,this.scope=e,this}},{key:"exec",value:function(){return this.scope?this.callback.call(this.scope,this.param,this.name):this.callback(this.param,this.name)}},{key:"onFree",value:function(){p(h(i.prototype),"onFree",this).call(this),this.setName().setCallback().setParameter();}}]),i}(En),Cs=function(t,e,i,n){var s=this.createCommandChild(t,e,i,n);return this.addChild(s),this},ws=function(t,e,i,n){void 0===n&&(n={word:[],width:0}),n.word.length=0;for(var s=t.length,r=e,o=n.word,a=0;r0&&!a){var h=this.fixedHeight-n;if(i>0)r=h/i;else r=(l=Ts.call(this)).height,o=l.ascent,i=Math.floor((h-o)/r);}else {var l;r=(l=Ts.call(this)).height,o=l.ascent;}}else if(this.fixedHeight>0){if(void 0===(i=Ms(t,"maxLines"))){h=this.fixedHeight-n;i=Math.floor(h/r);}}else i=Ms(t,"maxLines",0);void 0===o&&(o=r);var u=0===i,c=Ms(t,"wrapWidth",void 0);void 0===c&&(c=this.fixedWidth>0?this.fixedWidth-s:1/0);for(var d=Ms(t,"letterSpacing",0),f=Ms(t,"hAlign",0),p=Ms(t,"vAlign",0),v=Ms(t,"charWrap",!1),g={callback:"runWordWrap",start:e,isLastPage:!1,padding:this.wrapPadding,ascent:o,lineHeight:r,maxLines:i,wrapWidth:c,letterSpacing:d,hAlign:f,vAlign:p,charWrap:v,children:[],lines:[],maxLineWidth:0,linesHeight:0},y=this.children,k=0,m=y.length;k0&&(M.push({children:E,width:_}),R=Math.max(R,_)),g.start+=O.length,g.isLastPage=!L&&g.start===T,g.maxLineWidth=R,g.linesHeight=M.length*r;var F=this.fixedWidth>0?this.fixedWidth:g.maxLineWidth+s,W=this.fixedHeight>0?this.fixedHeight:g.linesHeight+n;!function(t,e,i){var n,s,r=t.hAlign,o=t.vAlign,a=t.linesHeight;switch(o){case 1:case"center":s=(i-a)/2;break;case 2:case"bottom":s=i-a;break;default:s=0;}for(var h=t.lines,l=0,u=h.length;l0?(o=this.fixedWidth-s)/i:0;else if(this.fixedWidth>0){if(void 0===(i=Rs(t,"maxLines",void 0))){var o=this.fixedWidth-s;i=Math.floor(o/r)+1;}}else i=Rs(t,"maxLines",0);var a=0===i,h=Rs(t,"fixedChildHeight",void 0);if(void 0===h){var l=Rs(t,"charPerLine",void 0);if(void 0!==l){var u=this.fixedHeight-n;h=Math.floor(u/l);}}var c=Rs(t,"wrapHeight",void 0);void 0===c&&(c=this.fixedHeight>0?this.fixedHeight-n:1/0);for(var d=Rs(t,"letterSpacing",0),f=Rs(t,"rtl",!0),p=Rs(t,"hAlign",f?2:0),v=Rs(t,"vAlign",0),g={callback:"runVerticalWrap",start:e,isLastPage:!1,padding:this.wrapPadding,lineWidth:r,maxLines:i,fixedChildHeight:h,wrapHeight:c,letterSpacing:d,hAlign:p,vAlign:v,rtl:f,children:[],lines:[],maxLineHeight:0,linesWidth:0},y=this.children,k=0,m=y.length;k0&&(M.push({children:E,height:_}),R=Math.max(R,_)),g.start+=O.length,g.isLastPage=g.start===T,g.maxLineHeight=R,g.linesWidth=M.length*r;var z=this.fixedWidth>0?this.fixedWidth:g.linesWidth+s,A=this.fixedHeight>0?this.fixedHeight:g.maxLineHeight+n;!function(t,e,i){var n,s,r=t.hAlign,o=t.vAlign,a=t.rtl,h=t.lines,l=t.lineWidth,u=t.linesWidth;switch(r){case 1:case"center":n=(e-u)/2;break;case 2:case"right":n=e-u;break;default:n=0;}a&&(n+=l);for(var c=0,d=h.length;c0?t:this.width,e>0?e:this.height),this):this},setPadding:function(t,e){var i=this.padding,n=i.left,s=i.right,r=i.top,o=i.bottom;return Mn(i,t,e),this.dirty=this.dirty||n!=i.left||s!=i.right||r!=i.top||o!=i.bottom,this},getPadding:function(t){return On(this.padding,t)},modifyTextStyle:function(t){return this.textStyle.modify(t),this},modifyDefaultTextStyle:function(t){return this.defaultTextStyle.modify(t),this},resetTextStyle:function(){return this.textStyle.copyFrom(this.defaultTextStyle),this},setTestString:function(t){return this.testString=t,this},removeChild:function(t){return this.poolManager.free(t),ns(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 ss(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,n,s,r=Array.isArray(t);void 0===e||e===this.children.length?r?(i=this.children).push.apply(i,m(t)):this.children.push(t):r?(n=this.children).splice.apply(n,[e,0].concat(m(t))):this.children.splice(e,0,t);(this.lastAppendedChildren.length=0,r)?(s=this.lastAppendedChildren).push.apply(s,m(t)):this.lastAppendedChildren.push(t);return this},createCharChild:function(t,e){e&&this.textStyle.modify(e);var i=this.poolManager.allocate(rs);return null===i?i=new ps(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=[],n=0,s=t.length;ne&&(n=e,s=t);})),s},getCharWorldPosition:function(t,e,i,n){return "number"==typeof t&&(t=this.getCharChild(t,!0)),Gn(this,t,e,i,n)},setToMinSize:function(){for(var t=this.children,e=0,i=0,n=0,s=t.length;n=i.length&&(t=i.length);for(var n=0,s=0;s1?i-1:0),s=1;s0&&void 0!==t.setTint},useAlphaFadeEffect:function(t){return (void 0===this.fadeMode||1===this.fadeMode)&&this.fadeTime>0&&void 0!==t.setAlpha},useRevealEffect:function(t){return this.fadeMode>=2&&this.fadeMode<=5&&this.fadeTime>0&&(t.preFX||t.postFX)},fadeBob:function(t,e,i,n){var s=t.gameObject;if(this.useTintFadeEffect(s))void 0!==e&&t.setProperty("tintGray",255*e),t.easeProperty("tintGray",Math.floor(255*i),this.fadeTime,"Linear",0,!1,n);else if(this.useAlphaFadeEffect(s))void 0!==e&&t.setProperty("alpha",e),t.easeProperty("alpha",i,this.fadeTime,"Linear",0,!1,n);else if(this.useRevealEffect(s)){var r;switch(fr(s,"reveal"),this.fadeMode){case 2:r="revealUp";break;case 3:r="revealDown";break;case 4:r="revealLeft";break;case 5:r="revealRight";}void 0===e&&(e=0),s[r]=e,t.easeProperty(r,i,this.fadeTime,"Linear",0,!1,n),t.getTweenTask(r).once("complete",(function(){s[r]=null;}));}else n&&n(s);return this}},gr=function(t){return t>>16&255},yr=function(t){return t>>8&255},kr=function(t){return 255&t},mr=Phaser.Events.EventEmitter,br=function(t,e,i,n,s,r){return void 0===r?r={}:!0===r&&(r=xr),"number"!=typeof i&&(i=0,n=0),r.x=s.x+s.width*t+i,r.y=s.y+s.height*e+n,r},xr={},Cr=function(t,e,i,n,s,r,o){if(t.hasOwnProperty("vp"))return t;"function"==typeof i&&(o=i,i=void 0),"function"==typeof s&&(o=s,s=void 0),void 0===i&&(i=.5),void 0===n&&(n=.5),void 0===s&&(s=0),void 0===r&&(r=0),void 0===o&&(o=br),function(t){if(t.events)return t;var e=new mr,i=t.x;Object.defineProperty(t,"x",{get:function(){return i},set:function(n){i!==n&&(i=n,e.emit("update",t));}});var n=t.y;Object.defineProperty(t,"y",{get:function(){return n},set:function(i){n!==i&&(n=i,e.emit("update",t));}});var s=t.width;Object.defineProperty(t,"width",{get:function(){return s},set:function(i){s!==i&&(s=i,e.emit("update",t));}});var r=t.height;Object.defineProperty(t,"height",{get:function(){return r},set:function(i){r!==i&&(r=i,e.emit("update",t));}}),t.events=e;}(e);var a=e.events;t.vp=e;var h=function(){o(i,n,s,r,e,t);};a.on("update",h),t.once("destroy",(function(){a.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 n},set:function(t){n!==t&&(n=t,h());}}),Object.defineProperty(t,"vpxOffset",{get:function(){return s},set:function(t){s!==t&&(s=t,h());}}),Object.defineProperty(t,"vpyOffset",{get:function(){return r},set:function(t){r!==t&&(r=t,h());}}),h();},wr=Phaser.Utils.Array.Remove,Sr={has:function(t){return this.bobs.hasOwnProperty(t)},exists:function(t){return this.bobs.hasOwnProperty(t)},get:function(t){return this.bobs[t]},getGO:function(t){var e=this.get(t);return e?e.gameObject:null},addGO:function(t,e){this.remove(t,!0),this.useTintFadeEffect(e)&&function(t,e){if(t.hasOwnProperty("tintR"))return t;void 0===e&&(e=16777215);var i=gr(e),n=yr(e),s=kr(e);Object.defineProperty(t,"tint",{get:function(){return e},set:function(r){r=16777215&Math.floor(r),t.setTint&&t.setTint(r),e!==r&&(i=gr(e=r),n=yr(e),s=kr(e));}}),Object.defineProperty(t,"tintR",{get:function(){return i},set:function(n){n=255&Math.floor(n),i!==n&&(i=n,t.tint=(255&n)<<16|65535&e);}}),Object.defineProperty(t,"tintG",{get:function(){return n},set:function(i){i=255&Math.floor(i),n!==i&&(n=i,t.tint=(255&i)<<8|16711935&e);}}),Object.defineProperty(t,"tintB",{get:function(){return s},set:function(i){i=255&Math.floor(i),s!==i&&(s=i,t.tint=255&i|16776960&e);}}),Object.defineProperty(t,"tintGray",{get:function(){return Math.floor((i+n+s)/3)},set:function(e){e=255&Math.floor(e),i===e&&n===e&&s===e||(i=e,n=e,s=e,t.tint=(255&e)<<16|(255&e)<<8|255&e);}}),t.tint=e;}(e),this.viewportCoordinateEnable&&Cr(e,this.viewport),this.effectPropertiesConfig&&fr(e,this.effectPropertiesConfig),e.once("destroy",(function(){wr(this.removedGOs,e),this.isEmpty&&this.emit("empty");}),this);var i=new this.BobClass(this,e,t);return this.bobs[t]=i,this},add:function(t){for(var e=this.createGameObjectCallback,i=this.createGameObjectScope,n=arguments.length,s=new Array(n>1?n-1:0),r=1;r2?n-2:0),r=2;r0?-this.delay:0,this.state=this.nowTime>=0?ko:yo,this.repeatCounter=0,this}},{key:"stop",value:function(){return this.state=go,this}},{key:"update",value:function(t,e){this.state!==go&&this.state!==bo&&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=mo)):(this.nowTime=this.duration,this.state=bo):this.nowTime>=0&&(this.state=ko));}},{key:"t",get:function(){var t;switch(this.state){case go:case yo:case mo:t=0;break;case ko:t=this.nowTime/this.duration;break;case bo:t=1;}return po(t,0,1)},set:function(t){(t=po(t,-1,1))<0?(this.state=yo,this.nowTime=-this.delay*t):(this.state=ko,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++);}},{key:"setT",value:function(t){return this.t=t,this}},{key:"isIdle",get:function(){return this.state===go}},{key:"isDelay",get:function(){return this.state===yo}},{key:"isCountDown",get:function(){return this.state===ko}},{key:"isRunning",get:function(){return this.state===yo||this.state===ko}},{key:"isDone",get:function(){return this.state===bo}},{key:"isOddIteration",get:function(){return 1==(1&this.repeatCounter)}},{key:"isEvenIteration",get:function(){return 0==(1&this.repeatCounter)}}]),t}(),go=0,yo=1,ko=2,mo=3,bo=-1,xo=function(t){a(i,t);var e=d(i);function i(t,s){var r;return n(this,i),(r=e.call(this,t,s)).timer=new vo,r}return r(i,[{key:"shutdown",value:function(t){this.isShutdown||(p(h(i.prototype),"shutdown",this).call(this,t),this.timer.destroy(),this.timer=void 0);}},{key:"start",value:function(){return this.timer.start(),p(h(i.prototype),"start",this).call(this),this}},{key:"stop",value:function(){return this.timer.stop(),p(h(i.prototype),"stop",this).call(this),this}},{key:"complete",value:function(){return this.timer.stop(),p(h(i.prototype),"complete",this).call(this),this}}]),i}(uo),Co=Phaser.Utils.Objects.GetValue,wo=Phaser.Utils.Objects.GetAdvancedValue,So=Phaser.Tweens.Builders.GetEaseFunction,Po=function(t){a(i,t);var e=d(i);function i(){return n(this,i),e.apply(this,arguments)}return r(i,[{key:"resetFromJSON",value:function(t){return this.timer.resetFromJSON(Co(t,"timer")),this.setEnable(Co(t,"enable",!0)),this.setTarget(Co(t,"target",this.parent)),this.setDelay(wo(t,"delay",0)),this.setDuration(wo(t,"duration",1e3)),this.setEase(Co(t,"ease","Linear")),this.setRepeat(Co(t,"repeat",0)),this}},{key:"setEnable",value:function(t){return null==t&&(t=!0),this.enable=t,this}},{key:"setTarget",value:function(t){return void 0===t&&(t=this.parent),this.target=t,this}},{key:"setDelay",value:function(t){return this.delay=t,this}},{key:"setDuration",value:function(t){return this.duration=t,this}},{key:"setRepeat",value:function(t){return this.repeat=t,this}},{key:"setRepeatDelay",value:function(t){return this.repeatDelay=t,this}},{key:"setEase",value:function(t){return void 0===t&&(t="Linear"),this.ease=t,this.easeFn=So(t),this}},{key:"start",value:function(){return this.timer.isRunning||p(h(i.prototype),"start",this).call(this),this}},{key:"restart",value:function(){return this.timer.stop(),this.start.apply(this,arguments),this}},{key:"stop",value:function(t){return void 0===t&&(t=!1),p(h(i.prototype),"stop",this).call(this),t&&(this.timer.setT(1),this.updateGameObject(this.target,this.timer),this.complete()),this}},{key:"update",value:function(t,e){if(!this.isRunning||!this.enable||!this.parent.active)return this;var i=this.target,n=this.timer;return n.update(t,e),n.isDelay||this.updateGameObject(i,n),this.emit("update",i,this),n.isDone&&this.complete(),this}},{key:"updateGameObject",value:function(t,e){}}]),i}(xo),To=Phaser.Sound.BaseSound,Oo=function(t){return t instanceof To},Mo=Phaser.Utils.Objects.GetValue,Eo=Phaser.Utils.Objects.GetAdvancedValue,_o=Phaser.Math.Linear,Ro=function(t){a(i,t);var e=d(i);function i(t,s,r){var o;return n(this,i),Oo(t)&&(r=s,s=t,t=void 0),s.active=!0,s.scene=t,s.game=s.manager.game,(o=e.call(this,s,r)).volume={},o.resetFromJSON(r),o}return r(i,[{key:"resetFromJSON",value:function(t){return p(h(i.prototype),"resetFromJSON",this).call(this,t),this.setMode(Mo(t,"mode",0)),this.setEnable(Mo(t,"enable",!0)),this.setVolumeRange(Eo(t,"volume.start",this.parent.volume),Eo(t,"volume.end",0)),this}},{key:"setMode",value:function(t){return "string"==typeof t&&(t=Lo[t]),this.mode=t,this}},{key:"setVolumeRange",value:function(t,e){return this.volume.start=t,this.volume.end=e,this}},{key:"start",value:function(){return this.timer.isRunning||(this.parent.setVolume(this.volume.start),this.timer.setDelay(this.delay).setDuration(this.duration),p(h(i.prototype),"start",this).call(this)),this}},{key:"updateGameObject",value:function(t,e){t.volume=_o(this.volume.start,this.volume.end,e.t);}},{key:"complete",value:function(){switch(p(h(i.prototype),"complete",this).call(this),this.mode){case 1:this.parent.stop();break;case 2:this.parent.destroy();}return this}}]),i}(Po),Lo={stop:1,destroy:2},Bo=function(t,e,i,n,s){Oo(t)&&(s=n,n=i,i=e,e=t,t=void 0),void 0===n&&(n=1),void 0===s&&(s=0);var r,o={mode:0,volume:{start:s,end:n},duration:i};return "string"==typeof e&&(e=t.sys.sound.add(e)),e.hasOwnProperty("_fade")?(r=e._fade).stop().resetFromJSON(o):(r=new Ro(t,e,o),e._fade=r),r.start(),e.isPlaying||e.setVolume(s).play(),e},Do=function(t,e,i,n){Oo(t)&&(n=i,i=e,e=t,t=void 0),void 0===n&&(n=!0);var s,r={mode:n?2:1,volume:{start:e.volume,end:0},duration:i};return e.hasOwnProperty("_fade")?(s=e._fade).stop().resetFromJSON(r):(s=new Ro(t,e,r),e._fade=s),s.start(),e.isPlaying||e.play(),e},Io=Phaser.Utils.Objects.GetValue,jo={setBackgroundMusicLoop:function(t){return void 0===t&&(t=!0),this.backgroundMusicLoop=t,this},setBackgroundMusicFadeTime:function(t){return this.backgroundMusicFadeTime=t,this},getBackgroundMusic:function(){return this.backgroundMusic},setCurrentBackgroundMusic:function(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:function(t,e){if(this.backgroundMusic&&this.backgroundMusic.key===t)return this;this.stopBackgroundMusic();var i=this.sound.add(t,{loop:Io(e,"loop",this.backgroundMusicLoop),mute:Io(e,"mute",this.backgroundMusicMute),volume:Io(e,"volume",this.backgroundMusicVolume),detune:Io(e,"detune",0),rate:Io(e,"rate",1)});return this.setCurrentBackgroundMusic(i),this.backgroundMusicFadeTime>0&&this.fadeInBackgroundMusic(this.backgroundMusicFadeTime),this},pauseBackgroundMusic:function(){return this.backgroundMusic&&this.backgroundMusic.pause(),this},resumeBackgroundMusic:function(){return this.backgroundMusic&&this.backgroundMusic.resume(),this},stopBackgroundMusic:function(){return this.backgroundMusic&&(this.backgroundMusicFadeTime>0?this.fadeOutBackgroundMusic(this.backgroundMusicFadeTime,!0):(this.backgroundMusic.stop(),this.backgroundMusic.destroy(),this.backgroundMusic=void 0)),this},fadeInBackgroundMusic:function(t){return this.backgroundMusic&&Bo(this.backgroundMusic,t,this.backgroundMusicVolume,0),this},fadeOutBackgroundMusic:function(t,e){return this.backgroundMusic&&Do(this.backgroundMusic,t,e),this},crossFadeBackgroundMusic:function(t,e){var i=this.backgroundMusicFadeTime;return this.backgroundMusicFadeTime=0,this.fadeOutBackgroundMusic(e,!0).playBackgroundMusic(t).fadeInBackgroundMusic(e),this.backgroundMusicFadeTime=i,this},setBackgroundMusicMute:function(t){return void 0===t&&(t=!0),this.backgroundMusicMute=t,this},setBackgroundMusicVolume:function(t){return this.backgroundMusicVolume=t,this},setBackgroundMusicRate:function(t){return this.backgroundMusic&&this.backgroundMusic.setRate(t),this},setBackgroundMusicDetune:function(t){return this.backgroundMusic&&this.backgroundMusic.setDetune(t),this}},zo=Phaser.Utils.Objects.GetValue,Ao={setBackgroundMusic2Loop:function(t){return void 0===t&&(t=!0),this.backgroundMusic2Loop=t,this},setBackgroundMusic2FadeTime:function(t){return this.backgroundMusic2FadeTime=t,this},getBackgroundMusic2:function(){return this.backgroundMusic2},setCurrentBackgroundMusic2:function(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:function(t,e){if(this.backgroundMusic2&&this.backgroundMusic2.key===t)return this;this.stopBackgroundMusic2();var i=this.sound.add(t,{loop:zo(e,"loop",this.backgroundMusicLoop),mute:zo(e,"mute",this.backgroundMusic2Mute),volume:zo(e,"volume",this.backgroundMusic2Volume),detune:zo(e,"detune",0),rate:zo(e,"rate",1)});return this.setCurrentBackgroundMusic2(i),this.backgroundMusic2FadeTime>0&&this.fadeInBackgroundMusic2(this.backgroundMusic2FadeTime),this},pauseBackgroundMusic2:function(){return this.backgroundMusic2&&this.backgroundMusic2.pause(),this},resumeBackgroundMusic2:function(){return this.backgroundMusic2&&this.backgroundMusic2.resume(),this},stopBackgroundMusic2:function(){return this.backgroundMusic2&&(this.backgroundMusic2FadeTime>0?this.fadeOutBackgroundMusic2(this.backgroundMusic2FadeTime,!0):(this.backgroundMusic2.stop(),this.backgroundMusic2.destroy(),this.backgroundMusic2=void 0)),this},fadeInBackgroundMusic2:function(t){return this.backgroundMusic2&&Bo(this.backgroundMusic2,t,this.backgroundMusic2Volume,0),this},fadeOutBackgroundMusic2:function(t,e){return this.backgroundMusic2&&Do(this.backgroundMusic2,t,e),this},crossFadeBackgroundMusic2:function(t,e){var i=this.backgroundMusic2FadeTime;return this.backgroundMusic2FadeTime=0,this.fadeOutBackgroundMusic2(e,!0).playBackgroundMusic2(t).fadeInBackgroundMusic2(e),this.backgroundMusic2FadeTime=i,this},setBackgroundMusic2Mute:function(t){return void 0===t&&(t=!0),this.backgroundMusic2Mute=t,this},setBackgroundMusic2Volume:function(t){return this.backgroundMusic2Volume=t,this},setBackgroundMusic2Rate:function(t){return this.backgroundMusic2&&this.backgroundMusic2.setRate(t),this},setBackgroundMusic2Detune:function(t){return this.backgroundMusic2&&this.backgroundMusic2.setDetune(t),this}},Fo=Phaser.Utils.Array.Remove,Wo=Phaser.Utils.Objects.GetValue,Yo={getSoundEffects:function(){return this.soundEffects},getLastSoundEffect:function(){return this.soundEffects[this.soundEffects.length-1]},playSoundEffect:function(t,e){var i=this.sound.add(t,{mute:Wo(e,"mute",this.soundEffectsMute),volume:Wo(e,"volume",this.soundEffectsVolume),detune:Wo(e,"detune",0),rate:Wo(e,"rate",1)});return this.soundEffects.push(i),i.once("complete",(function(){i.destroy(),this.sound&&Fo(this.soundEffects,i);}),this).once("destroy",(function(){this.sound&&Fo(this.soundEffects,i);}),this).play(),this},stopAllSoundEffects:function(){for(var t=this.soundEffects.length-1;t>=0;t--){var e=this.soundEffects[t];e.stop(),e.destroy();}return this},fadeInSoundEffect:function(t){var e=this.getLastSoundEffect();return e&&Bo(e,t,this.soundEffectsVolume,0),this},fadeOutSoundEffect:function(t,e){var i=this.getLastSoundEffect();return i&&Do(i,t,e),this},fadeOutAllSoundEffects:function(t,e){for(var i=this.soundEffects.length-1;i>=0;i--)Do(this.soundEffects[i],t,e);return this},setSoundEffectMute:function(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:function(t,e){if(void 0===e&&(e=!1),e){var i=this.getLastSoundEffect();i&&i.setVolume(t);}else this.soundEffectsVolume=t;return this},setSoundEffectDetune:function(t,e){var i;void 0===e&&(e=!1);for(var n=0,s=(i=e?[this.getLastSoundEffect()]:this.soundEffects).length;n=0;t--){var e=this.soundEffects[t];e.stop(),e.destroy();}return this},fadeInSoundEffect2:function(t){var e=this.getLastSoundEffect2();return e&&Bo(e,t,this.soundEffects2Volume,0),this},fadeOutSoundEffect2:function(t,e){var i=this.getLastSoundEffect2();return i&&Do(i,t,e),this},fadeOutAllSoundEffects2:function(t,e){for(var i=this.soundEffects2.length-1;i>=0;i--)Do(this.soundEffects2[i],t,e);return this},setSoundEffect2Mute:function(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:function(t,e){if(void 0===e&&(e=!1),e){var i=this.getLastSoundEffect2();i&&i.setVolume(t);}else this.soundEffects2Volume=t;return this},setSoundEffect2Detune:function(t,e){var i;void 0===e&&(e=!1);for(var n=0,s=(i=e?[this.getLastSoundEffect2()]:this.soundEffects2).length;n=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}},{key:"backgroundMusicMute",get:function(){return this._backgroundMusicMute},set:function(t){this._backgroundMusicMute=t,this.backgroundMusic&&this.backgroundMusic.setMute(mute);}},{key:"backgroundMusicVolume",get:function(){return this._backgroundMusicVolume},set:function(t){this._backgroundMusicVolume=t,this.backgroundMusic&&this.backgroundMusic.setVolume(t);}},{key:"backgroundMusic2Mute",get:function(){return this._backgroundMusic2Mute},set:function(t){this._backgroundMusic2Mute=t,this.backgroundMusic2&&this.backgroundMusic2.setMute(mute);}},{key:"backgroundMusic2Volume",get:function(){return this._backgroundMusic2Volume},set:function(t){this._backgroundMusic2Volume=t,this.backgroundMusic2&&this.backgroundMusic2.setVolume(t);}},{key:"soundEffectsMute",get:function(){return this._soundEffectsMute},set:function(t){this._soundEffectsMute=t;for(var e=this.soundEffects,i=0,n=e.length;i2?n-2:0),r=2;r3?s-3:0),o=3;o");this.setDelimiters(i[0],i[1]),this.setTranslateTagNameCallback(bt(e,"translateTagNameCallback")),this.isRunning=!1,this.isPaused=!1,this.skipEventFlag=!1,this.justCompleted=!1,this.lastTagStart=null,this.lastTagEnd=null,this.lastContent=null;}return r(t,[{key:"shutdown",value:function(){this.destroyEventEmitter();}},{key:"destroy",value:function(){this.shutdown();}},{key:"setMultipleLinesTagEnable",value:function(t){return void 0===t&&(t=!0),this.multipleLinesTagEnable=t,this}},{key:"setDelimiters",value:function(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("".concat(t,"(.+?)").concat(e),i),this}},{key:"setTranslateTagNameCallback",value:function(t){return this.translateTagNameCallback=t,this}},{key:"setValueConverter",value:function(t){return !0===t?t=ga:t||(t=ka),this.valueConverter=t,this}},{key:"setLoopEnable",value:function(t){return void 0===t&&(t=!0),this.loopEnable=t,this}},{key:"setSource",value:function(t){return this.source=t,this}},{key:"resetIndex",value:function(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}},{key:"start",value:function(t){return this.setSource(t).restart(),this}},{key:"restart",value:function(){this.resetIndex().next();}},{key:"next",value:function(){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");return s.setDelimiters(r[0],r[1]),s}return r(i,[{key:"setTagExpression",value:function(t){return t||(t=ba),this.tagExpression=t,this}},{key:"setValueExpression",value:function(t){return t||(t=ba),this.valueExpression=t,this}},{key:"setDelimiters",value:function(t,e){p(h(i.prototype),"setDelimiters",this).call(this,t,e);var n="(".concat(this.tagExpression,")(=(").concat(this.valueExpression,"))?");if(this.reTag=RegExp(n,"i"),this.tagExpression!==ba||this.valueExpression!==ba){var s="".concat(this.tagExpression,"(=").concat(this.valueExpression,")?"),r="/".concat(this.tagExpression);t=qi(this.delimiterLeft),e=qi(this.delimiterRight);var o=this.multipleLinesTagEnable?"gs":"gi";this.reSplit=RegExp("".concat(t,"((").concat(s,")|(").concat(r,"))").concat(e),o);}return this}},{key:"onTag",value:function(t){var e=t.match(this.reTag),i=e[1],n="/"===i.charAt(0);if(n&&(i=i.substring(1,i.length)),this.translateTagNameCallback&&(i=this.translateTagNameCallback(i)),this.skipEventFlag=!1,n)this.emit("-".concat(i)),this.skipEventFlag||this.emit("-",i),this.lastTagEnd=i;else {var s=function(t,e){if(null==t)return [];void 0===e&&(e=ga);for(var i=t.split(","),n=0,s=i.length;n1?s-1:0),o=1;o1&&-1!==e.indexOf("|")?e.split("|"):[e]).length;r0){var o=this.timeline.addTimer({name:Ph,target:s,duration:r.duration,yoyo:r.yoyo,onStart:r.onStart,onProgress:r.onProgress,onComplete:r.onComplete});this.skipTypingAnimation&&o.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&&((i=a).type===rs&&" "===i.text));else if(n+=this.speed+e,e=0,n>0){this.typingTimer=this.timeline.addTimer({name:"delay",target:this,duration:n,onComplete:function(e,i,n){e.typingTimer=void 0,t.call(e,n.remainder);}});break}}else fs(s)&&s.exec();}this.minSizeEnable&&this.textPlayer.setToMinSize(),this.inTypingProcessLoop=!1;},pause:function(){return this.timeline.pause(),this},resume:function(){return this.timeline.resume(),this},pauseTyping:function(){return this.isTypingPaused||(this.typingTimer?(this.typingTimer.pause(),this.isTypingPaused=!0):this.inTypingProcessLoop&&(this.inTypingProcessLoop=!1,this.isTypingPaused=!0)),this},resumeTyping:function(t){return this.isTypingPaused?(void 0===t&&(t=0),this.typingTimer?(this.isTypingPaused=!1,this.typingTimer.resume(),this.typingTimer.remainder+=t):this.isTypingPaused&&(this.isTypingPaused=!1,this.typing(t)),this):this},wait:function(t){return this.ignoreWait||(this.pauseTyping(),_h(this.textPlayer,t,this.resumeTyping,this)),this},setIgnoreWait:function(t){return void 0===t&&(t=!0),this.ignoreWait=t,this},setSkipSpaceEnable:function(t){return void 0===t&&(t=!0),this.skipSpaceEnable=t,this},setSkipTypingAnimation:function(t){if(void 0===t&&(t=!0),this.skipTypingAnimation=t,t)for(var e=this.timeline.getTimers(Ph),i=0,n=e.length;i0&&o.chainAnimation(i,n);},Vh=function(t){var e,i,n=k(t);e=n[0],i=n.slice(1);var s=this.getGameObjectManager(e);s.stopAnimation.apply(s,m(i));},Gh=function(t){var e,i,n=k(t);e=n[0],i=n.slice(1);var s=this.getGameObjectManager(e);s.pauseAnimation.apply(s,m(i));},Uh=function(t){var e,i,n=k(t);e=n[0],i=n.slice(1);var s=this.getGameObjectManager(e);s.chainAnimation.apply(s,m(i));},Hh=[function(t,e,i){var n=i.name;e.on("+",(function(i){if(!e.skipEventFlag){var s,r=i.split(".");if(Yh(r,n)){s=r[1];for(var o=arguments.length,a=new Array(o>1?o-1:0),h=1;h0)){var a=this.getGameObjectManager(e);a.hasMethod(i,n)?a.call.apply(a,[i,n].concat(m(s))):a.setProperty(i,n,s[0]);}},Qh={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},tl=function(t){var e,i,n,s,r,o,a,h,l=y(t,8);e=l[0],i=l[1],n=l[2],s=l[3],r=l[4],o=l[5],a=l[6],h=l[7];var u=this.getGameObjectManager(e),c=u.getProperty(i,n);if("number"==typeof c){h.endsWith("Left")||h.endsWith("Up")?h.startsWith("to")||h.startsWith("yoyo")?s=c-s:h.startsWith("from")&&(u.setProperty(i,n,c-s),s=c):h.endsWith("Right")||h.endsWith("Down")?h.startsWith("to")||h.startsWith("yoyo")?s=c+s:h.startsWith("from")&&(u.setProperty(i,n,c+s),s=c):"from"===h&&(u.setProperty(i,n,s),s=c);var d=h.startsWith("yoyo");u.easeProperty(i,n,s,r,o,a,d);}},el=[function(t,e,i){var n=i.name;e.on("+",(function(i){if(!e.skipEventFlag){var s,r=i.split(".");if(Kh(r,n)){s=r[1];for(var o=arguments.length,a=new Array(o>1?o-1:0),h=1;h1?a-1:0),l=1;l0)return gl.length=0,!0;return gl.length=0,!1},gl=[],yl=void 0,kl=Phaser.Utils.Objects.GetValue,ml=function(t,e,i){var n,s;for(var r in void 0===i&&(i={}),t)n=t[r],void 0!==(s=kl(e,r,n[1]))&&(i[n[0]]=s);return i},bl=function(t){t.addEventListener("touchstart",xl,!1),t.addEventListener("touchmove",xl,!1),t.addEventListener("touchend",xl,!1),t.addEventListener("mousedown",xl,!1),t.addEventListener("mouseup",xl,!1),t.addEventListener("mousemove",xl,!1);},xl=function(t){t.stopPropagation();},Cl=Phaser.Utils.Objects.GetValue,wl={open:function(){return this.isOpened||this.readOnly||((t=this)!==yl&&(void 0!==yl&&yl.close(),yl=t),this.isOpened=!0,this.node||(this.node=function(t,e){var i,n=Cl(e,"inputType",void 0);void 0===n&&(n=Cl(e,"type","text")),"textarea"===n?(i=document.createElement("textarea")).style.resize="none":(i=document.createElement("input")).type=n;var s=Cl(e,"style",void 0),r=i.style;ml(dl,s,r),r.position="absolute",r.opacity=0,r.pointerEvents="none",r.zIndex=0,r.transform="scale(0)",ml(cl,e,i),bl(i);var o=t.scene.sys.scale;return (o.isFullscreen?o.fullscreenTarget:document.body).appendChild(i),i}(this,this.nodeConfig)),this.setFocus(),this.initText(),this.enterCloseEnable&&this.scene.input.keyboard.once("keydown-ENTER",this.close,this),this.scene.sys.events.on("postupdate",this.updateText,this),this.scene.input.on("pointerdown",this.onClickOutside,this),this.onOpenCallback&&this.onOpenCallback(this.parent,this),this.emit("open",this)),this;var t;},close:function(){return this.isOpened?(this===yl&&(yl=void 0),this.setBlur(),this.isOpened=!1,this.updateText(),this.scene.sys.events.off("postupdate",this.updateText,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),this):this}},Sl=Phaser.Utils.Objects.GetValue,Pl=function(t){a(i,t);var e=d(i);function i(t,s){var r;n(this,i),r=e.call(this,t);var o=Sl(s,"inputType",void 0);void 0===o&&(o=Sl(s,"type","text")),r.setEnterCloseEnable(Sl(s,"enterClose","textarea"!==o));var a=Sl(s,"onOpen",void 0);a||(a=Sl(s,"onFocus",void 0)),r.onOpenCallback=a;var h=Sl(s,"onClose",void 0);return h||(h=Sl(s,"onBlur",void 0)),r.onCloseCallback=h,r.onUpdateCallback=Sl(s,"onUpdate",void 0),r.isOpened=!1,t.on("pointerdown",(function(){this.open();}),u(r)).setInteractive(),r.nodeConfig=function(t){void 0===t&&(t={});var e={};return fl(t,e,"inputType"),fl(t,e,"type"),fl(t,e,"style"),fl(t,e,dl),fl(t,e,cl),e}(s),r.node=void 0,r}return r(i,[{key:"destroy",value:function(){this.close(),p(h(i.prototype),"destroy",this).call(this);}},{key:"onClickOutside",value:function(t){pl(this.parent,t)||this.close();}},{key:"setEnterCloseEnable",value:function(t){return void 0===t&&(t=!0),this.enterCloseEnable=t,this}},{key:"initText",value:function(){}},{key:"updateText",value:function(){}},{key:"text",get:function(){return this.node?this.node.value:""},set:function(t){this.node&&(this.node.value=t);}},{key:"setText",value:function(t){return this.text=t,this}},{key:"maxLength",get:function(){return this.nodeConfig.maxLength},set:function(t){this.nodeConfig.maxLength=t,this.node&&(this.node.maxLength=t);}},{key:"setMaxLength",value:function(t){return this.maxLength=t,this}},{key:"minLength",get:function(){return this.nodeConfig.minLength},set:function(t){this.nodeConfig.minLength=t,this.node&&(this.node.minLength=t);}},{key:"setMinLength",value:function(t){return this.minLength=t,this}},{key:"placeholder",get:function(){return this.node.placeholder},set:function(t){this.node&&(this.node.placeholder=t);}},{key:"setPlaceholder",value:function(t){return this.placeholder=t,this}},{key:"selectText",value:function(t,e){return this.node?(void 0===t?this.node.select():this.node.setSelectionRange(t,e),this):this}},{key:"selectAll",value:function(){return this.selectText(),this}},{key:"selectionStart",get:function(){return this.node?this.node.selectionStart:0}},{key:"selectionEnd",get:function(){return this.node?this.node.selectionEnd:0}},{key:"selectedText",get:function(){if(!this.node)return "";var t=this.node;return t.value.substring(t.selectionStart,t.selectionEnd)}},{key:"cursorPosition",get:function(){return this.node?this.node.selectionStart:0},set:function(t){this.node&&this.node.setSelectionRange(t,t);}},{key:"setCursorPosition",value:function(t){return void 0===t?t=this.text.length:t<0&&(t=this.text.length+t),this.cursorPosition=t,this}},{key:"tooltip",get:function(){return this.node?this.node.title:""},set:function(t){if(!this.node)return this;this.node.title=t;}},{key:"setTooltip",value:function(t){return this.tooltip=t,this}},{key:"setTextChangedCallback",value:function(t){return this.onTextChanged=t,this}},{key:"readOnly",get:function(){return this.nodeConfig.readOnly},set:function(t){this.nodeConfig.readOnly=t,this.node&&(this.node.readOnly=t);}},{key:"setReadOnly",value:function(t){return void 0===t&&(t=!0),this.readOnly=t,this}},{key:"spellCheck",get:function(){return this.node?this.node.spellcheck:""},set:function(t){this.node&&(this.node.spellcheck=t);}},{key:"setSpellCheck",value:function(t){return this.spellCheck=t,this}},{key:"fontColor",get:function(){if(this.node)return this.node.style.color},set:function(t){this.node&&(this.node.style.color=t);}},{key:"setFontColor",value:function(t){return this.fontColor=t,this}},{key:"setStyle",value:function(t,e){return this.node?(this.node.style[t]=e,this):this}},{key:"getStyle",value:function(t){if(this.node)return this.node.style[t]}},{key:"scrollToBottom",value:function(){return this.node?(this.node.scrollTop=this.node.scrollHeight,this):this}},{key:"setEnabled",value:function(t){return this.node?(void 0===t&&(t=!0),this.node.disabled=!t,this):this}},{key:"setBlur",value:function(){return this.node?(this.node.blur(),this):this}},{key:"setFocus",value:function(){return this.node?(this.node.focus(),this):this}},{key:"isFocused",get:function(){return this.isOpened}}]),i}(ro);Object.assign(Pl.prototype,wl);var Tl=function(t,e,i){t=t.replace(" ","");var n=i.previousText;if(t===n)return t;if(isNaN(t)){i.emit("nan",t,i),t=n;var s=i.cursorPosition-1;i.setText(t),i.setCursorPosition(s);}else i.previousText=t;return t},Ol=function(t){var e=t.prevSelectionStart;if(null!==e){for(var i=t.prevSelectionEnd,n=t.parent,s=e;s=s&&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!=n&&(s=e.getCharChild(n))&&("\n"===s.text&&s.copyTextSize(e.lastInsertCursor),function(t){var e,i,n=t.parent,s=n.width,r=n.height,o=t.drawX,a=t.drawY,h=o+t.drawTLX,l=o+t.drawTRX,u=a+t.drawTLY,c=a+t.drawBLY;e=h<0?0-h:l>s?s-l:0,i=u<0?0-u:c>r?r-c:0,n._textOX+=e,n._textOY+=i;}(s),e.emit("cursorin",s,n,e)),e.emit("movecursor",n,t.prevCursorPosition,e),t.prevCursorPosition=n;}}(this)):(Ol(this),Ml(this)),this}},{key:"setNumberInput",value:function(){return this.onUpdateCallback=Tl,this}},{key:"setSelectAllWhenFocusEnable",value:function(t){return void 0===t&&(t=!0),this.selectAllWhenFocus=t,this}}]),i}(Pl),Rl=Phaser.Utils.Objects.GetValue,Ll=["inputType","onOpen","onFocus","onClose","onBlur","onUpdate","enterClose","readOnly","maxLength","minLength","selectAll"],Bl=function(t,e){if(t&&"number"!=typeof t){if(t.hasOwnProperty(e))return !0;if(-1!==e.indexOf(".")){for(var i=e.split("."),n=t,s=0;st.length?i:t})),l.value=t.join(c);}else l.value=t.join(i.slice(a,a+l.count));a+=l.count,l.added||(h+=l.count);}}var d=e[o-1];return o>1&&"string"==typeof d.value&&(d.added||d.removed)&&t.equals("",d.value)&&(e[o-2].value+=d.value,e.pop()),e}Fl.prototype={diff:function(t,e){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=i.callback;"function"==typeof i&&(n=i,i={}),this.options=i;var s=this;function r(t){return n?(setTimeout((function(){n(void 0,t);}),0),!0):t}t=this.castInput(t),e=this.castInput(e),t=this.removeEmpty(this.tokenize(t));var o=(e=this.removeEmpty(this.tokenize(e))).length,a=t.length,h=1,l=o+a;i.maxEditLength&&(l=Math.min(l,i.maxEditLength));var u=[{newPos:-1,components:[]}],c=this.extractCommon(u[0],e,t,0);if(u[0].newPos+1>=o&&c+1>=a)return r([{value:this.join(e),count:e.length}]);function d(){for(var i=-1*h;i<=h;i+=2){var n=void 0,l=u[i-1],c=u[i+1],d=(c?c.newPos:0)-i;l&&(u[i-1]=void 0);var f=l&&l.newPos+1=o&&d+1>=a)return r(Wl(s,n.components,e,t,s.useLongestToken));u[i]=n;}else u[i]=void 0;}var v;h++;}if(n)!function t(){setTimeout((function(){if(h>l)return n();d()||t();}),0);}();else for(;h<=l;){var f=d();if(f)return f}},pushComponent:function(t,e,i){var n=t[t.length-1];n&&n.added===e&&n.removed===i?t[t.length-1]={count:n.count+1,added:e,removed:i}:t.push({count:1,added:e,removed:i});},extractCommon:function(t,e,i,n){for(var s=e.length,r=i.length,o=t.newPos,a=o-n,h=0;o+10,o=0,a=e.length;o0;this.dirty=this.dirty||this._radiusTL!==t||this._convexTL!==e,this._convexTL=e,this._radiusTL=Math.abs(t);}},{key:"radiusTR",get:function(){return this._radiusTR},set:function(t){var e=t>0;this.dirty=this.dirty||this._radiusTR!==t||this._convexTR!==e,this._convexTR=e,this._radiusTR=Math.abs(t);}},{key:"radiusBL",get:function(){return this._radiusBL},set:function(t){var e=t>0;this.dirty=this.dirty||this._radiusBL!==t||this._convexBL!==e,this._convexBL=e,this._radiusBL=Math.abs(t);}},{key:"radiusBR",get:function(){return this._radiusBR},set:function(t){var e=t>0;this.dirty=this.dirty||this._radiusBR!==t||this._convexBR!==e,this._convexBR=e,this._radiusBR=Math.abs(t);}},{key:"radius",get:function(){return Math.max(this.radiusTL,this.radiusTR,this.radiusBL,this.radiusBR)},set:function(t){"number"==typeof t?(this.radiusTL=t,this.radiusTR=t,this.radiusBL=t,this.radiusBR=t):(this.radiusTL=Hu(t,"tl",0),this.radiusTR=Hu(t,"tr",0),this.radiusBL=Hu(t,"bl",0),this.radiusBR=Hu(t,"br",0));}},{key:"setRadius",value:function(t){return void 0===t&&(t=0),this.radius=t,this}},{key:"iterations",get:function(){return this._iterations},set:function(t){this.dirty=this.dirty||this._iterations!==t,this._iterations=t;}},{key:"setIterations",value:function(t){return this.iterations=t,this}},{key:"updateData",value:function(){var t=this.pathData;t.length=0;var e,n=this.width,s=this.height,r=this.iterations+1;(e=this.radiusTL)>0?this._convexTL?Gt(e,e,e,e,180,270,!1,r,t):Gt(0,0,e,e,90,0,!0,r,t):Xt(0,0,t);(e=this.radiusTR)>0?this._convexTR?Gt(n-e,e,e,e,270,360,!1,r,t):Gt(n,0,e,e,180,90,!0,r,t):Xt(n,0,t);(e=this.radiusBR)>0?this._convexBR?Gt(n-e,s-e,e,e,0,90,!1,r,t):Gt(n,s,e,e,270,180,!0,r,t):Xt(n,s,t);(e=this.radiusBL)>0?this._convexBL?Gt(e,s-e,e,e,90,180,!1,r,t):Gt(0,s,e,e,360,270,!0,r,t):Xt(0,s,t);return t.push(t[0],t[1]),Ou(this.x,this.y,t),p(h(i.prototype),"updateData",this).call(this),this}}]),i}(vu),Ku=Phaser.Renderer.WebGL.Utils.getTintAppendFloatAlpha,Ju=function(t){a(i,t);var e=d(i);function i(t,s,r,o,a,h){var l;return n(this,i),void 0===t&&(t=0),void 0===s&&(s=0),void 0===r&&(r=0),void 0===o&&(o=0),void 0===a&&(a=0),void 0===h&&(h=0),(l=e.call(this)).pathData=[],l.closePath=!0,l.setP0(t,s),l.setP1(r,o),l.setP2(a,h),l}return r(i,[{key:"x0",get:function(){return this._x0},set:function(t){this.dirty=this.dirty||this._x0!==t,this._x0=t;}},{key:"y0",get:function(){return this._y0},set:function(t){this.dirty=this.dirty||this._y0!==t,this._y0=t;}},{key:"setP0",value:function(t,e){return this.x0=t,this.y0=e,this}},{key:"x1",get:function(){return this._x1},set:function(t){this.dirty=this.dirty||this._x1!==t,this._x1=t;}},{key:"y1",get:function(){return this._y1},set:function(t){this.dirty=this.dirty||this._y1!==t,this._y1=t;}},{key:"setP1",value:function(t,e){return this.x1=t,this.y1=e,this}},{key:"x2",get:function(){return this._x2},set:function(t){this.dirty=this.dirty||this._x2!==t,this._x2=t;}},{key:"y2",get:function(){return this._y2},set:function(t){this.dirty=this.dirty||this._y2!==t,this._y2=t;}},{key:"setP2",value:function(t,e){return this.dirty=this.dirty||this.x2!==t||this.y2!==e,this.x2=t,this.y2=e,this}},{key:"updateData",value:function(){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),p(h(i.prototype),"updateData",this).call(this),this}},{key:"webglRender",value:function(t,e,i,n,s){if(this.isFilled){var r=Ku(this.fillColor,this.fillAlpha*i),o=this.x0-n,a=this.y0-s,h=this.x1-n,l=this.y1-s,u=this.x2-n,c=this.y2-s,d=e.getX(o,a),f=e.getY(o,a),p=e.getX(h,l),v=e.getY(h,l),g=e.getX(u,c),y=e.getY(u,c);t.batchTri(d,f,p,v,g,y,r,r,r);}this.isStroked&&Kt(t,this,i,n,s);}},{key:"canvasRender",value:function(t,e,i){var n=this.x1-e,s=this.y1-i,r=this.x2-e,o=this.y2-i,a=this.x3-e,h=this.y3-i;t.beginPath(),t.moveTo(n,s),t.lineTo(r,o),t.lineTo(a,h),t.closePath(),this.isFilled&&(Zt(t,this),t.fill()),this.isStroked&&(qt(t,this),t.stroke());}}]),i}(fu),Zu={buildShapes:function(){this.addShape((new Nu).setName("box")).addShape((new Vu).setName("checker"));},updateShapes:function(){var t=this.width/2,e=this.height/2,i=Math.min(t,e),n=2*i,s=t-i,r=e-i,o=this.boxLineWidth,a=Math.max(n/10,2),h=this.getShape("box"),l=this.getShape("checker");if(this.isSizeChanged){var u=n*(1-this.boxSize)/2,c=o/2,d=n*this.boxSize-o;h.setTopLeftPosition(s+c+u,r+c+u).setSize(d,d),this.isCircleShape?h.setRadius(d/2):h.setRadius(0);u=n*(1-this.checkerSize)/2;var f=n*this.checkerSize/4,p=1*f,v=2*f,g=3*f;l.startAt(p,v).lineTo(v,g).lineTo(g,p).offset(s+u,r+u).end();}this.checked?(h.fillStyle(this.boxFillColor,this.boxFillAlpha).lineStyle(o,this.boxStrokeColor,this.boxStrokeAlpha),l.lineStyle(a,this.checkerColor)):(h.fillStyle(this.uncheckedBoxFillColor,this.uncheckedBoxFillAlpha).lineStyle(o,this.uncheckedBoxStrokeColor,this.uncheckedBoxStrokeAlpha),l.lineStyle()),this.checked&&l.setDisplayPathSegment(this.checkerAnimProgress);}},qu=Phaser.Utils.Objects.GetValue,$u=Phaser.Math.Linear,Qu=function(t){a(i,t);var e=d(i);function i(t,s){var r;return n(this,i),(r=e.call(this,t,s)).resetFromJSON(),r.boot(),r}return r(i,[{key:"start",value:function(t){if(this.timer.isRunning)return this;var e=this.target;this.propertyKey=qu(t,"key","value");var n=e[this.propertyKey];return this.fromValue=qu(t,"from",n),this.toValue=qu(t,"to",n),this.setEase(qu(t,"ease",this.ease)),this.setDuration(qu(t,"duration",this.duration)),this.setRepeat(qu(t,"repeat",0)),this.setDelay(qu(t,"delay",0)),this.setRepeatDelay(qu(t,"repeatDelay",0)),this.timer.setDuration(this.duration).setRepeat(this.repeat).setDelay(this.delay).setRepeatDelay(this.repeatDelay),e[this.propertyKey]=this.fromValue,p(h(i.prototype),"start",this).call(this),this}},{key:"updateGameObject",value:function(t,e){var i=e.t;i=this.easeFn(i),t[this.propertyKey]=$u(this.fromValue,this.toValue,i);}}]),i}(Po),tc={setCheckerAnimationDuration:function(t){return void 0===t&&(t=0),this.checkerAnimDuration=t,this},playCheckerAnimation:function(){return void 0===this.checkerAnimProgressTask&&(this.checkerAnimProgressTask=new Qu(this,{eventEmitter:null})),this.checkerAnimProgressTask.restart({key:"checkerAnimProgress",from:0,to:1,duration:this.checkerAnimDuration}),this},stopCheckerAnimation:function(){return void 0===this.checkerAnimProgressTask||this.checkerAnimProgressTask.stop(),this}},ec={};Object.assign(ec,cu,{setBoxSize:function(t){return this.dirty=this.dirty||this.boxSize!==t,this.boxSize=t,this},setCheckerSize:function(t){return this.dirty=this.dirty||this.checkerSize!==t,this.checkerSize=t,this}},Zu,tc);var ic=Phaser.Utils.Objects.GetValue,nc=Phaser.Utils.Objects.IsPlainObject,sc=23730,rc=function(t){a(i,t);var e=d(i);function i(t,s,r,o,a,h,l){var u;n(this,i),nc(s)?(s=ic(l=s,"x",0),r=ic(l,"y",0),o=ic(l,"width",2),a=ic(l,"height",2),h=ic(l,"color",sc)):nc(h)&&(h=ic(l=h,"color",sc)),(u=e.call(this,t,s,r,o,a)).type="rexCheckbox",void 0===h&&(h=sc),u.setBoxShape(ic(l,"circleBox",!1)),u.setBoxFillStyle(h,ic(l,"boxFillAlpha",1)),u.setUncheckedBoxFillStyle(ic(l,"uncheckedColor",null),ic(l,"uncheckedBoxFillAlpha",1)),u.setBoxStrokeStyle(ic(l,"boxLineWidth",4),ic(l,"boxStrokeColor",h),ic(l,"boxStrokeAlpha",1)),u.setUncheckedBoxStrokeStyle(u.boxLineWidth,ic(l,"uncheckedBoxStrokeColor",u.boxStrokeColor),ic(l,"uncheckedBoxStrokeAlpha",u.boxStrokeAlpha)),u.setCheckerStyle(ic(l,"checkerColor",16777215),ic(l,"checkerAlpha",1)),u.setBoxSize(ic(l,"boxSize",1)),u.setCheckerSize(ic(l,"checkerSize",1)),u.setCheckerAnimationDuration(ic(l,"animationDuration",150)),u.buildShapes();var c=ic(l,"checked");return void 0===c&&(c=ic(l,"value",!1)),u.setValue(c),u}return r(i,[{key:"value",get:function(){return this._value},set:function(t){t=!!t,this._value!==t&&(this.dirty=!0,this._value=t,t?this.playCheckerAnimation():this.stopCheckerAnimation(),this.emit("valuechange",t));}},{key:"setValue",value:function(t){return this.value=t,this}},{key:"toggleValue",value:function(){return this.setValue(!this.value),this}},{key:"checked",get:function(){return this.value},set:function(t){this.value=t;}},{key:"setChecked",value:function(t){return void 0===t&&(t=!0),this.setValue(t),this}},{key:"toggleChecked",value:function(){return this.toggleValue(),this}},{key:"checkerAnimProgress",get:function(){return this._checkerAnimProgress},set:function(t){this._checkerAnimProgress!==t&&(this._checkerAnimProgress=t,this.dirty=!0);}}]),i}(uu);Object.assign(rc.prototype,ec);var oc=Phaser.Utils.Objects.GetValue,ac=function(t){a(i,t);var e=d(i);function i(t,s){var r;return n(this,i),(r=e.call(this,t,s))._enable=void 0,t.setInteractive(oc(s,"inputConfig",void 0)),r.resetFromJSON(s),r.boot(),r}return r(i,[{key:"resetFromJSON",value:function(t){return this.pointer=void 0,this.lastClickTime=void 0,this.setEnable(oc(t,"enable",!0)),this.setMode(oc(t,"mode",1)),this.setClickInterval(oc(t,"clickInterval",100)),this.setDragThreshold(oc(t,"threshold",void 0)),this}},{key:"boot",value:function(){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);}},{key:"shutdown",value:function(t){this.isShutdown||(this.pointer=null,p(h(i.prototype),"shutdown",this).call(this,t));}},{key:"enable",get:function(){return this._enable},set:function(t){if(this._enable!==t){t||this.cancel(),this._enable=t;var e=t?"enable":"disable";this.emit(e,this,this.parent);}}},{key:"setEnable",value:function(t){return void 0===t&&(t=!0),this.enable=t,this}},{key:"toggleEnable",value:function(){return this.setEnable(!this.enable),this}},{key:"setMode",value:function(t){return "string"==typeof t&&(t=hc[t]),this.mode=t,this}},{key:"setClickInterval",value:function(t){return this.clickInterval=t,this}},{key:"setDragThreshold",value:function(t){return this.dragThreshold=t,this}},{key:"onPress",value:function(t,e,i,n){void 0===this.pointer&&(this.pointer=t,this.emit("down",this,this.parent,t,n),0===this.mode&&this.click(t.downTime,t,n));}},{key:"onRelease",value:function(t,e,i,n){this.pointer===t&&(this.emit("up",this,this.parent,t,n),1===this.mode&&this.click(t.upTime,t,n),this.pointer=void 0);}},{key:"onPointOut",value:function(t,e){this.pointer===t&&this.cancel();}},{key:"onMove",value:function(t,e,i,n){this.pointer===t&&void 0!==this.dragThreshold&&1===this.mode&&t.getDistance()>=this.dragThreshold&&this.cancel();}},{key:"click",value:function(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 n=this.lastClickTime;return void 0!==n&&t-n<=this.clickInterval||(this.lastClickTime=t,this.emit("click",this,this.parent,e,i)),this}},{key:"cancel",value:function(){return this.pointer=void 0,this}},{key:"onOver",value:function(t,e,i,n){return this.enable?(this.emit("over",this,this.parent,t,n),this):this}},{key:"onOut",value:function(t,e){return this.enable?(this.emit("out",this,this.parent,t,e),this):this}}]),i}(ro),hc={press:0,pointerdown:0,release:1,pointerup:1},lc=Phaser.Utils.Objects.GetValue,uc=function(t){a(i,t);var e=d(i);function i(t,s,r,o,a,h,l){var c;return n(this,i),(c=e.call(this,t,s,r,o,a,h,l))._click=new ac(u(c),lc(l,"click")),c._click.on("click",(function(){this.toggleValue();}),u(c)),c.setReadOnly(lc(l,"readOnly",!1)),c}return r(i,[{key:"readOnly",get:function(){return !this._click.enable},set:function(t){this._click.enable=!t;}},{key:"setReadOnly",value:function(t){return void 0===t&&(t=!0),this.readOnly=t,this}}]),i}(rc);T.register("checkbox",(function(t,e,i,n,s,r){var o=new uc(this.scene,t,e,i,n,s,r);return this.scene.add.existing(o),o})),Z(window,"RexPlugins.UI.Checkbox",uc);var cc={setTrackFillStyle:function(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:function(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:function(t,e){return void 0===e&&(e=1),this.dirty=this.dirty||this.thumbColor!==t||this.checkAlpha!==e,this.thumbColor=t,this.thumbAlpha=e,this}},dc={setTrackSize:function(t,e){return this.dirty=this.dirty||this.trackWidth!==t||this.trackHeight!==e,this.trackWidth=t,this.trackHeight=e,this},setTrackRadius:function(t){return this.dirty=this.dirty||this.trackRadius!==t,this.trackRadius=t,this},setThumbSize:function(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:function(t){return this.dirty=this.dirty||this.thumbRadius!==t,this.thumbRadius=t,this}},fc={setThumbPosition:function(t,e){return void 0===e&&(e=1-t),this.thumbLeftX=t,this.thumbRightX=e,this},setRTL:function(t){return void 0===t&&(t=!0),this.rtl=t,this}},pc=function(t,e,i){return (e-t)*i+t},vc=Phaser.Math.Linear,gc={buildShapes:function(){this.addShape((new Nu).setName("track")).addShape((new Nu).setName("thumb"));},updateShapes:function(){var t=this.width,e=this.height,i=this.value?this.toggleAnimProgress:1-this.toggleAnimProgress,n=this.getShape("track");if(this.isSizeChanged){var s=t*this.trackWidth,r=e*this.trackHeight,o=(t-s)/2,a=(e-r)/2,h=e*this.trackRadius;n.setTopLeftPosition(o,a).setSize(s,r).setRadius(h);}var l,u,c,d=(l=this.falseValueTrackColor,u=this.trackFillColor,c=i,(255&pc(gr(l),gr(u),c))<<16|(255&pc(yr(l),yr(u),c))<<8|255&pc(kr(l),kr(u),c)),f=vc(this.falseValueTrackFillAlpha,this.trackFillAlpha,i);n.fillStyle(d,f);var p=this.getShape("thumb");if(this.isSizeChanged){var v=t*this.thumbWidth,g=e*this.thumbHeight,y=e*this.thumbRadius;p.setSize(v,g).setRadius(y);}var k=vc(this.thumbLeftX,this.thumbRightX,i)*t;this.rtl&&(k=t-k);var m=e/2;p.setCenterPosition(k,m),p.fillStyle(this.thumbColor,this.thumbAlpha);}},yc={setToggleAnimationDuration:function(t){return void 0===t&&(t=0),this.toggleAnimDuration=t,this},playToggleAnimation:function(){return void 0===this.toggleAnimProgressTask&&(this.toggleAnimProgressTask=new Qu(this,{eventEmitter:null})),this.toggleAnimProgressTask.restart({key:"toggleAnimProgress",from:0,to:1,duration:this.toggleAnimDuration}),this},stopToggleAnimation:function(){return void 0===this.toggleAnimProgressTask||this.toggleAnimProgressTask.stop(),this}},kc={};Object.assign(kc,cc,dc,fc,gc,yc);var mc=Phaser.Utils.Objects.GetValue,bc=Phaser.Utils.Objects.IsPlainObject,xc=23730,Cc=function(t){a(i,t);var e=d(i);function i(t,s,r,o,a,h,l){var u;n(this,i),bc(s)?(s=mc(l=s,"x",0),r=mc(l,"y",0),o=mc(l,"width",2),a=mc(l,"height",2),h=mc(l,"color",xc)):bc(h)&&(h=mc(l=h,"color",xc)),(u=e.call(this,t,s,r,o,a)).type="rexToggleSwitch",void 0===h&&(h=xc),u.setTrackFillStyle(h,mc(l,"trackFillAlpha",1)),u.setFalseValueTrackFillStyle(mc(l,"falseValueTrackColor",function(t){var e=.3*gr(t)+.59*yr(t)+.11*kr(t);return (255&e)<<16|(255&e)<<8|255&e}(h)),mc(l,"falseValueTrackFillAlpha",1)),u.setThumbStyle(mc(l,"thumbColor",16777215),mc(l,"thumbAlpha",1)),u.setTrackSize(mc(l,"trackWidth",.9),mc(l,"trackHeight",.5)),u.setTrackRadius(mc(l,"trackRadius",.5*u.trackHeight));var c=mc(l,"thumbHeight",void 0),d=mc(l,"thumbWidth",c);return void 0===d&&(d=.9*u.trackHeight),u.setThumbSize(d,c),u.setThumbRadius(mc(l,"thumbRadius",.5*u.thumbHeight)),u.setThumbPosition(mc(l,"thumbLeft",.3),mc(l,"thumbRight",void 0)),u.setRTL(mc(l,"rtl",!1)),u.setToggleAnimationDuration(mc(l,"animationDuration",150)),u.buildShapes(),u.setValue(mc(l,"value",!1),0),u}return r(i,[{key:"value",get:function(){return this._value},set:function(t){t=!!t,this._value!==t&&(this.dirty=!0,this._value=t,this.playToggleAnimation(),this.emit("valuechange",t));}},{key:"setValue",value:function(t,e){void 0===e&&(e=this.toggleAnimDuration);var i=this.toggleAnimDuration;return this.toggleAnimDuration=e,this.value=t,this.toggleAnimDuration=i,this}},{key:"toggleValue",value:function(t){return this.setValue(!this.value,t),this}},{key:"toggleAnimProgress",get:function(){return this._toggleAnimProgress},set:function(t){this._toggleAnimProgress!==t&&(this._toggleAnimProgress=t,this.dirty=!0);}}]),i}(uu);Object.assign(Cc.prototype,kc);var wc=Phaser.Utils.Objects.GetValue,Sc=function(t){a(i,t);var e=d(i);function i(t,s,r,o,a,h,l){var c;return n(this,i),(c=e.call(this,t,s,r,o,a,h,l))._click=new ac(u(c),wc(l,"click")),c._click.on("click",(function(){this.toggleValue();}),u(c)),c.setReadOnly(wc(l,"readOnly",!1)),c}return r(i,[{key:"readOnly",get:function(){return !this._click.enable},set:function(t){this._click.enable=!t;}},{key:"setReadOnly",value:function(t){return void 0===t&&(t=!0),this.readOnly=t,this}}]),i}(Cc);T.register("toggleSwitch",(function(t,e,i,n,s,r){var o=new Sc(this.scene,t,e,i,n,s,r);return this.scene.add.existing(o),o})),Z(window,"RexPlugins.UI.ToggleSwitch",Sc);var Pc={loadFromURL:function(t,e){var i=this,n=new Image;return n.onload=function(){i.width!==n.width||i.height!==n.height?i.resize(n.width,n.height):i.clear(),i.context.drawImage(n,0,0),i.updateTexture(),e&&e(),n.onload=null,n.src="",n.remove();},n.src=t,this},loadFromURLPromise:function(t){var e=this;return new Promise((function(i,n){e.loadFromURL(t,i);}))},loadFromFile:function(t,e){var i=URL.createObjectURL(t);return this.loadFromURL(i,(function(){URL.revokeObjectURL(i),e&&e();})),this},loadFromFilePromise:function(t){var e=this;return new Promise((function(i,n){e.loadFromFile(t,i);}))}},Tc=function(t){a(i,t);var e=d(i);function i(){return n(this,i),e.apply(this,arguments)}return r(i)}(pe);Object.assign(Tc.prototype,Pc),T.register("canvas",(function(t,e,i,n){var s=new Tc(this.scene,t,e,i,n);return this.scene.add.existing(s),s})),Z(window,"RexPlugins.UI.Canvas",Tc);var Oc=Phaser.Utils.Objects.GetValue,Mc=function(t){a(s,t);var e=d(s);function s(t,i,r,o,a,h){var l;return n(this,s),(l=e.call(this,t,i,r)).type="rexCircleMaskImage",l.setTexture(o,a,h),l}return r(s,[{key:"setTexture",value:function(t,e,n){"object"===i(e)&&(n=e,e=void 0),"string"==typeof n&&(n={maskType:n});var s=Oc(n,"maskType",0),r=Oc(n,"backgroundColor",void 0),o=Oc(n,"strokeColor",void 0),a=Oc(n,"strokeWidth",null!=o?10:0);if(void 0===s?s=0:"string"==typeof s&&(s=Ec[s]),this._textureKey=t,this._frameName=e,null===s)return this.loadTexture(t,e),this.dirty=!0,this;var h=this.scene.sys.textures.getFrame(t,e);if(!h)return this;h.cutWidth!==this.width||h.cutHeight!==this.height?this.setCanvasSize(h.cutWidth,h.cutHeight):this.clear();var l=this.canvas,u=this.context,c=l.width,d=l.height;null!=r&&(u.fillStyle=r,u.fillRect(0,0,c,d)),u.save(),u.beginPath();var f=a/2;switch(s){case 1:var p=(k=Math.floor(c/2))-f,v=(m=Math.floor(d/2))-f;u.ellipse(k,m,p,v,0,0,2*Math.PI);break;case 2:var g=Oc(n,"radius",0),y=Oc(n,"iteration",void 0);me(u,f,f,c-a,d-a,g,y);break;default:var k=Math.floor(c/2),m=Math.floor(d/2),b=Math.min(k,m)-f;u.arc(k,m,b,0,2*Math.PI);}return null!=o&&(u.strokeStyle=o,u.lineWidth=a,u.stroke()),u.clip(),this.loadTexture(t,e),u.restore(),this.dirty=!0,this}},{key:"resize",value:function(t,e){return this.setDisplaySize(t,e),this}}]),s}(pe),Ec={circle:0,ellipse:1,roundRectangle:2};T.register("circleMaskImage",(function(t,e,i,n,s){var r=new Mc(this.scene,t,e,i,n,s);return this.scene.add.existing(r),r})),Z(window,"RexPlugins.UI.CircleMaskImage",Mc);var _c=Phaser.Utils.Objects.GetValue,Rc=function(t){a(s,t);var e=d(s);function s(t,i,r,o,a,h){var l;return n(this,s),(l=e.call(this,t,i,r)).type="rexAlphaMaskImage",l.maskFrame=null,l.setTexture(o,a,h),l}return r(s,[{key:"setTexture",value:function(t,e,n){"object"===i(e)&&(n=e,e=void 0),"string"==typeof n&&(n={mask:{key:n}});var s=_c(n,"mask.key"),r=_c(n,"mask.frame"),o=_c(n,"mask.invertAlpha",!1),a=_c(n,"mask.scale"),h=_c(n,"backgroundColor");if(s){this._maskKey=s,this._maskFrame=r,this._maskScale=a;var l=s?this.scene.sys.textures.get(s):null;this.maskFrame=l?l.get(r):null;}this._textureKey=t,this._frameName=e;var u=this.maskFrame;if(null===u)return this.loadTexture(t,e),this.dirty=!0,this;var c=null!=h;this.loadTexture(t,e);var d,f,p=this.canvas,v=this.context,g=p.width,y=p.height;v.save(),v.globalCompositeOperation=o?"destination-out":"destination-in",null!=this._maskScale?(d=u.cutWidth*this._maskScale,f=u.cutHeight*this._maskScale):(d=g,f=y);var k=(g-d)/2,m=(y-f)/2;return this.drawFrame(this._maskKey,this._maskFrame,k,m,d,f),v.restore(),c&&(v.save(),v.globalCompositeOperation="destination-over",v.fillStyle=h,v.fillRect(0,0,g,y),v.restore()),this.dirty=!0,this}},{key:"resize",value:function(t,e){return this.setDisplaySize(t,e),this}}]),s}(pe);T.register("alphaMaskImage",(function(t,e,i,n,s){var r=new Rc(this.scene,t,e,i,n,s);return this.scene.add.existing(r),r})),Z(window,"RexPlugins.UI.AlphaMaskImage",Rc);var Lc=Phaser.Math.Linear,Bc=Phaser.Math.Percent,Dc={setValue:function(t,e,i){return null==t||(void 0!==e&&(t=Bc(t,e,i)),this.value=t),this},addValue:function(t,e,i){return void 0!==e&&(t=Bc(t,e,i)),this.value+=t,this},getValue:function(t,e){var i=this.value;return void 0!==t&&(i=Lc(t,e,i)),i}},Ic=Phaser.Math.Percent,jc={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=Ic(t,e,i)),void 0===this.easeValueTask&&(this.easeValueTask=new Qu(this,{eventEmitter:null})),this.easeValueTask.restart({key:this.easeValuePropName,to:t,duration:this.easeValueDuration,ease:this.easeFunction})),this},easeValueRepeat:function(t,e,i,n){return void 0===i&&(i=-1),void 0===n&&(n=0),void 0===this.easeValueTask&&(this.easeValueTask=new Qu(this,{eventEmitter:null})),this.easeValueTask.restart({key:this.easeValuePropName,from:t,to:e,duration:this.easeValueDuration,ease:this.easeFunction,repeat:i,repeatDelay:n}),this}},zc=Phaser.Utils.Objects.GetValue,Ac=Phaser.Math.Clamp;function Fc(t){var e=function(t){a(i,t);var e=d(i);function i(){return n(this,i),e.apply(this,arguments)}return r(i,[{key:"bootProgressBase",value:function(t){this.eventEmitter=zc(t,"eventEmitter",this);var e=zc(t,"valuechangeCallback",null);if(null!==e){var i=zc(t,"valuechangeCallbackScope",void 0);this.eventEmitter.on("valuechange",e,i);}return this.setEaseValuePropName("value").setEaseValueDuration(zc(t,"easeValue.duration",0)).setEaseValueFunction(zc(t,"easeValue.ease","Linear")),this}},{key:"value",get:function(){return this._value},set:function(t){t=Ac(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);}}]),i}(t);return Object.assign(e.prototype,Dc,jc),e}var Wc=Phaser.Math.RadToDeg,Yc=Phaser.Math.DegToRad,Xc=function(t,e,i,n,s,r,o,a){var h=360===Math.abs(o-r),l=Yc(r),u=Yc(o),c=Math.cos(l),d=Math.sin(l),f=Math.cos(u),p=Math.sin(u);return t.startAt(e+c*n,i+d*n),t.arc(e,i,n,r,o,a),h&&0===s||(t.lineTo(e+f*s,i+p*s),s>0&&t.arc(e,i,s,o,r,!a)),t.close(),t},Vc={buildShapes:function(){this.addShape((new Vu).setName("track")).addShape((new Vu).setName("bar")).addShape((new ku).setName("center"));},updateShapes:function(){var t=this.radius,e=this.thickness*this.radius,i=this.radius,n=i-e,s=this.getShape("track");null!=this.trackColor&&this.thickness>0?(s.fillStyle(this.trackColor),Xc(s,t,t,i,n,0,360,!1)):s.reset();var r=this.getShape("bar");if(null!=this.barColor&&this.thickness>0){var o,a,h;if(1===this.value)o=!1,a=0,h=360;else o=this.anticlockwise,a=Wc(this.startAngle),h=360*(o?1-this.value:this.value)+a;r.fillStyle(this.barColor),Xc(r,t,t,i,n,a,h,!1);}else r.reset();var l=this.getShape("center");this.centerColor&&n>0?l.setCenterPosition(t,t).setRadius(n).fillStyle(this.centerColor):l.reset();}},Gc=Phaser.Utils.Objects.GetValue,Uc=Phaser.Utils.Objects.IsPlainObject,Hc=Phaser.Math.Clamp,Nc=Phaser.Math.DegToRad(270),Kc=function(t){a(i,t);var e=d(i);function i(t,s,r,o,a,h,l){var u;n(this,i),Uc(s)&&(s=Gc(l=s,"x",0),r=Gc(l,"y",0),o=Gc(l,"radius",1),a=Gc(l,"barColor",void 0),h=Gc(l,"value",0)),void 0===o&&(o=1);var c=2*o;return (u=e.call(this,t,s,r,c,c)).type="rexCircularProgress",u.bootProgressBase(l),u.setRadius(o),u.setTrackColor(Gc(l,"trackColor",void 0)),u.setBarColor(a),u.setCenterColor(Gc(l,"centerColor",void 0)),u.setThickness(Gc(l,"thickness",.2)),u.setStartAngle(Gc(l,"startAngle",Nc)),u.setAnticlockwise(Gc(l,"anticlockwise",!1)),u.buildShapes(),u.setValue(h),u}return r(i,[{key:"resize",value:function(t,e){return (t=Math.floor(Math.min(t,e)))===this.width||(p(h(i.prototype),"resize",this).call(this,t,t),this.setRadius(t/2)),this}},{key:"radius",get:function(){return this._radius},set:function(t){this.dirty=this.dirty||this._radius!=t,this._radius=t;var e=2*t;this.resize(e,e);}},{key:"setRadius",value:function(t){return this.radius=t,this}},{key:"trackColor",get:function(){return this._trackColor},set:function(t){this.dirty=this.dirty||this._trackColor!=t,this._trackColor=t;}},{key:"setTrackColor",value:function(t){return this.trackColor=t,this}},{key:"barColor",get:function(){return this._barColor},set:function(t){this.dirty=this.dirty||this._barColor!=t,this._barColor=t;}},{key:"setBarColor",value:function(t){return this.barColor=t,this}},{key:"startAngle",get:function(){return this._startAngle},set:function(t){this.dirty=this.dirty||this._startAngle!=t,this._startAngle=t;}},{key:"setStartAngle",value:function(t){return this.startAngle=t,this}},{key:"anticlockwise",get:function(){return this._anticlockwise},set:function(t){this.dirty=this.dirty||this._anticlockwise!=t,this._anticlockwise=t;}},{key:"setAnticlockwise",value:function(t){return void 0===t&&(t=!0),this.anticlockwise=t,this}},{key:"thickness",get:function(){return this._thickness},set:function(t){t=Hc(t,0,1),this.dirty=this.dirty||this._thickness!=t,this._thickness=t;}},{key:"setThickness",value:function(t){return this.thickness=t,this}},{key:"centerColor",get:function(){return this._centerColor},set:function(t){this.dirty=this.dirty||this._centerColor!=t,this._centerColor=t;}},{key:"setCenterColor",value:function(t){return this.centerColor=t,this}}]),i}(Fc(uu));Object.assign(Kc.prototype,Vc),T.register("circularProgress",(function(t,e,i,n,s,r){var o=new Kc(this.scene,t,e,i,n,s,r);return this.scene.add.existing(o),o})),Z(window,"RexPlugins.UI.CircularProgress",Kc);var Jc=function(t,e,i,n,s,r,o,a,h,l,u,c){void 0===l&&(l=0),void 0===u&&(u=2*Math.PI),void 0===c&&(c=!1),e.beginPath(),e.ellipse(i,n,s,r,0,l,u,c),null!=o&&(e.fillStyle=o,e.fill()),null!=a&&(e.strokeStyle=a,e.lineWidth=h,e.stroke());},Zc=function(){var t,e=this.radius,i=this.thickness*this.radius,n=this.radius-i/2,s=this.radius-i,r=(this.canvas,this.context);if(this.trackColor&&i>0&&(r.save(),Jc(0,r,e,e,n,n,void 0,this.trackColor,i),r.restore()),this.barColor&&n>0){var o,a,h;if(1===this.value)o=!1,a=0,h=2*Math.PI;else o=this.anticlockwise,a=this.startAngle,h=2*Math.PI*(o?1-this.value:this.value)+a;r.save(),Jc(0,r,e,e,n,n,void 0,this.barColor,i,a,h,o),r.restore();}this.centerColor&&s>0&&(this.centerColor2?((t=this.context.createRadialGradient(e,e,0,e,e,s)).addColorStop(0,this.centerColor),t.addColorStop(1,this.centerColor2)):t=this.centerColor,r.save(),Jc(0,r,e,e,s,s,t),r.restore());this.textFormatCallback&&(this.textColor||this.textStrokeColor)&&(r.save(),function(t,e,i,n,s,r,o,a,h,l,u){void 0===h&&null!=a&&(h=2),void 0===l&&(l="start"),void 0===u&&(u="alphabetic"),e.font=r,e.textAlign=l,e.textBaseline=u,e.fillStyle=o,e.strokeStyle=a,e.lineWidth=h,e.lineCap="round",e.lineJoin="round",null!=a&&"none"!==a&&h>0&&e.strokeText(s,i,n),null!=o&&"none"!==o&&e.fillText(s,i,n);}(0,r,e,e,this.getFormatText(),this.textFont,this.textColor,this.textStrokeColor,this.textStrokeThickness,"center","middle"),r.restore());},qc=Phaser.Utils.Objects.GetValue,$c=Phaser.Utils.Objects.IsPlainObject,Qc=Phaser.Math.Clamp,td=Phaser.Math.DegToRad(270),ed=function(t){a(i,t);var e=d(i);function i(t,s,r,o,a,h,l){var u;n(this,i),$c(s)&&(s=qc(l=s,"x",0),r=qc(l,"y",0),o=qc(l,"radius",1),a=qc(l,"barColor",void 0),h=qc(l,"value",0));var c=2*o;(u=e.call(this,t,s,r,c,c)).type="rexCircularProgressCanvas",u.bootProgressBase(l),u.setRadius(o),u.setTrackColor(qc(l,"trackColor",void 0)),u.setBarColor(a),u.setCenterColor(qc(l,"centerColor",void 0)),u.setThickness(qc(l,"thickness",.2)),u.setStartAngle(qc(l,"startAngle",td)),u.setAnticlockwise(qc(l,"anticlockwise",!1)),u.setTextColor(qc(l,"textColor",void 0)),u.setTextStrokeColor(qc(l,"textStrokeColor",void 0),qc(l,"textStrokeThickness",void 0));var d=qc(l,"textFont",void 0);return d?u.setTextFont(d):u.setTextFont(qc(l,"textSize","16px"),qc(l,"textFamily","Courier"),qc(l,"textStyle","")),u.setTextFormatCallback(qc(l,"textFormatCallback",void 0),qc(l,"textFormatCallbackScope",void 0)),u.setValue(h),u}return r(i,[{key:"resize",value:function(t,e){return (t=Math.floor(Math.min(t,e)))===this.width||(p(h(i.prototype),"resize",this).call(this,t,t),this.setRadius(t/2)),this}},{key:"radius",get:function(){return this._radius},set:function(t){this.dirty=this.dirty||this._radius!=t,this._radius=t;var e=2*t;this.resize(e,e);}},{key:"setRadius",value:function(t){return this.radius=t,this}},{key:"trackColor",get:function(){return this._trackColor},set:function(t){t=ye(t,this.canvas,this.context),this.dirty=this.dirty||this._trackColor!=t,this._trackColor=t;}},{key:"setTrackColor",value:function(t){return this.trackColor=t,this}},{key:"barColor",get:function(){return this._barColor},set:function(t){t=ye(t,this.canvas,this.context),this.dirty=this.dirty||this._barColor!=t,this._barColor=t;}},{key:"setBarColor",value:function(t){return this.barColor=t,this}},{key:"startAngle",get:function(){return this._startAngle},set:function(t){this.dirty=this.dirty||this._startAngle!=t,this._startAngle=t;}},{key:"setStartAngle",value:function(t){return this.startAngle=t,this}},{key:"anticlockwise",get:function(){return this._anticlockwise},set:function(t){this.dirty=this.dirty||this._anticlockwise!=t,this._anticlockwise=t;}},{key:"setAnticlockwise",value:function(t){return void 0===t&&(t=!0),this.anticlockwise=t,this}},{key:"thickness",get:function(){return this._thickness},set:function(t){t=Qc(t,0,1),this.dirty=this.dirty||this._thickness!=t,this._thickness=t;}},{key:"setThickness",value:function(t){return this.thickness=t,this}},{key:"centerColor",get:function(){return this._centerColor},set:function(t){t=ye(t,this.canvas,this.context),this.dirty=this.dirty||this._centerColor!=t,this._centerColor=t;}},{key:"centerColor2",get:function(){return this._centerColor2},set:function(t){t=ye(t,this.canvas,this.context),this.dirty=this.dirty||this._centerColor2!=t,this._centerColor2=t;}},{key:"setCenterColor",value:function(t,e){return this.centerColor=t,this.centerColor2=e,this}},{key:"textColor",get:function(){return this._textColor},set:function(t){t=ye(t,this.canvas,this.context),this.dirty=this.dirty||this._textColor!=t,this._textColor=t;}},{key:"setTextColor",value:function(t){return this.textColor=t,this}},{key:"textStrokeColor",get:function(){return this._textStrokeColor},set:function(t){t=ye(t,this.canvas,this.context),this.dirty=this.dirty||this._textStrokeColor!=t,this._textStrokeColor=t;}},{key:"textStrokeThickness",get:function(){return this._textStrokeThickness},set:function(t){this.dirty=this.dirty||this._textStrokeThickness!=t,this._textStrokeThickness=t;}},{key:"setTextStrokeColor",value:function(t,e){return void 0===e&&(e=2),this.textStrokeColor=t,this.textStrokeThickness=e,this}},{key:"textFont",get:function(){return this._textFont},set:function(t){this.dirty=this.dirty||this._textFont!=t,this._textFont=t;}},{key:"setTextFont",value:function(t,e,i){var n;return n=void 0===e?t:i+" "+t+" "+e,this.textFont=n,this}},{key:"setTextFormatCallback",value:function(t,e){return this.textFormatCallback=t,this.textFormatCallbackScope=e,this}},{key:"updateTexture",value:function(){return this.clear(),Zc.call(this),p(h(i.prototype),"updateTexture",this).call(this),this}},{key:"getFormatText",value:function(t){return void 0===t&&(t=this.value),this.textFormatCallbackScope?this.textFormatCallback(t):this.textFormatCallback.call(this.textFormatCallbackScope,t)}}]),i}(Fc(pe));T.register("circularProgressCanvas",(function(t,e,i,n,s,r){var o=new ed(this.scene,t,e,i,n,s,r);return this.scene.add.existing(o),o})),Z(window,"RexPlugins.UI.CircularProgressCanvas",ed);var id=function(t,e,i,n,s,r){var o=(e+n)/2;return r>=0?t.startAt(o+r,i).lineTo(n+r,i).lineTo(n,s).lineTo(e,s).lineTo(e+r,i).lineTo(o+r,i):t.startAt(o,i).lineTo(n,i).lineTo(n-r,s).lineTo(e-r,s).lineTo(e,i).lineTo(o,i),t},nd=Phaser.Utils.Objects.GetValue,sd=Phaser.Utils.Objects.IsPlainObject,rd=function(t){a(i,t);var e=d(i);function i(t,s,r,o,a,h,l,u){var c;return n(this,i),sd(s)?(s=nd(u=s,"x",0),r=nd(u,"y",0),o=nd(u,"width",2),a=nd(u,"height",2),h=nd(u,"barColor",void 0),l=nd(u,"value",0)):sd(o)?(o=nd(u=o,"width",2),a=nd(u,"height",2),h=nd(u,"barColor",void 0),l=nd(u,"value",0)):sd(h)&&(h=nd(u=h,"barColor",void 0),l=nd(u,"value",0)),(c=e.call(this,t,s,r,o,a,u)).type="rexLineProgress",c.bootProgressBase(u),c.addShape((new Vu).setName("trackFill")).addShape((new Vu).setName("bar")).addShape((new Vu).setName("trackStroke")),c.setTrackColor(nd(u,"trackColor",void 0)),c.setBarColor(h),c.setTrackStroke(nd(u,"trackStrokeThickness",2),nd(u,"trackStrokeColor",void 0)),c.setSkewX(nd(u,"skewX",0)),c.setRTL(nd(u,"rtl",!1)),c.setValue(l),c}return r(i,[{key:"trackColor",get:function(){return this._trackColor},set:function(t){this.dirty=this.dirty||this._trackColor!=t,this._trackColor=t;}},{key:"setTrackColor",value:function(t){return this.trackColor=t,this}},{key:"trackStrokeColor",get:function(){return this._trackStrokeColor},set:function(t){this.dirty=this.dirty||this._trackStrokeColor!=t,this._trackStrokeColor=t;}},{key:"trackStrokeThickness",get:function(){return this._trackStrokeThickness},set:function(t){this.dirty=this.dirty||this._trackStrokeThickness!=t,this._trackStrokeThickness=t;}},{key:"setTrackStroke",value:function(t,e){return this.trackStrokeThickness=t,this.trackStrokeColor=e,this}},{key:"barColor",get:function(){return this._barColor},set:function(t){this.dirty=this.dirty||this._barColor!=t,this._barColor=t;}},{key:"setBarColor",value:function(t){return this.barColor=t,this}},{key:"skewX",get:function(){return this._skewX},set:function(t){this.dirty=this.dirty||this._skewX!=t,this._skewX=t;}},{key:"setSkewX",value:function(t){return this.skewX=t,this}},{key:"rtl",get:function(){return this._rtl},set:function(t){t=!!t,this.dirty=this.dirty||this._rtl!=t,this._rtl=t;}},{key:"setRTL",value:function(t){return void 0===t&&(t=!0),this.rtl=t,this}}]),i}(Fc(uu)),od={updateShapes:function(){var t=this.skewX,e=this.width-Math.abs(t),i=this.height,n=this.getShape("trackFill");n.fillStyle(this.trackColor),n.isFilled&&id(n,0,0,e,i,t).close();var s,r,o=this.getShape("bar");(o.fillStyle(this.barColor),o.isFilled)&&(this.rtl?(s=e*(1-this.value),r=e):(s=0,r=e*this.value),id(o,s,0,r,i,t).close());var a=this.getShape("trackStroke");a.lineStyle(this.trackStrokeThickness,this.trackStrokeColor),a.isStroked&&id(a,0,0,e,i,t).end();}};Object.assign(rd.prototype,od),T.register("lineProgress",(function(t,e,i,n,s,r,o){var a=new rd(this.scene,t,e,i,n,s,r,o);return this.scene.add.existing(a),a})),Z(window,"RexPlugins.UI.LineProgress",rd);var ad=function(t,e,i,n,s,r,o){void 0===o&&(o="round"),function(t,e){t.save(),t.beginPath();var i=e[0];t.moveTo(i.x,i.y);for(var n=1,s=e.length;n0&&(r.save(),ad(0,r,this.trackPoints,void 0,this.trackStrokeColor,this.trackStrokeThickness),r.restore());},ld=function(t,e,i,n,s,r){void 0===r&&(r=[]),r.length=4;for(var o=0;o<4;o++)r[o]||(r[o]={});var a;return s>=0?((a=r[0]).x=t+s,a.y=e,(a=r[1]).x=i+s,a.y=e,(a=r[2]).x=i,a.y=n,(a=r[3]).x=t,a.y=n):((a=r[0]).x=t,a.y=e,(a=r[1]).x=i,a.y=e,(a=r[2]).x=i-s,a.y=n,(a=r[3]).x=t-s,a.y=n),r},ud=Phaser.Utils.Objects.GetValue,cd=Phaser.Utils.Objects.IsPlainObject,dd=function(t){a(i,t);var e=d(i);function i(t,s,r,o,a,h,l,u){var c;return n(this,i),cd(s)?(s=ud(u=s,"x",0),r=ud(u,"y",0),o=ud(u,"width",2),a=ud(u,"height",2),h=ud(u,"barColor",void 0),l=ud(u,"value",0)):cd(o)?(o=ud(u=o,"width",2),a=ud(u,"height",2),h=ud(u,"barColor",void 0),l=ud(u,"value",0)):cd(h)&&(h=ud(u=h,"barColor",void 0),l=ud(u,"value",0)),(c=e.call(this,t,s,r,o,a)).type="rexLineProgressCanvas",c.trackPoints=[],c.barPoints=[],c.bootProgressBase(u),c.setTrackColor(ud(u,"trackColor",void 0)),c.setBarColor(h,ud(u,"barColor2",void 0),ud(u,"isHorizontalGradient",void 0)),c.setTrackStroke(ud(u,"trackStrokeThickness",2),ud(u,"trackStrokeColor",void 0)),c.setSkewX(ud(u,"skewX",0)),c.setRTL(ud(u,"rtl",!1)),c.setValue(l),c}return r(i,[{key:"trackColor",get:function(){return this._trackColor},set:function(t){t=ye(t,this.canvas,this.context),this.dirty=this.dirty||this._trackColor!=t,this._trackColor=t;}},{key:"setTrackColor",value:function(t){return this.trackColor=t,this}},{key:"trackStrokeColor",get:function(){return this._trackStrokeColor},set:function(t){t=ye(t,this.canvas,this.context),this.dirty=this.dirty||this._trackStrokeColor!=t,this._trackStrokeColor=t;}},{key:"trackStrokeThickness",get:function(){return this._trackStrokeThickness},set:function(t){this.dirty=this.dirty||this._trackStrokeThickness!=t,this._trackStrokeThickness=t;}},{key:"setTrackStroke",value:function(t,e){return this.trackStrokeThickness=t,this.trackStrokeColor=e,this}},{key:"barColor",get:function(){return this._barColor},set:function(t){t=ye(t,this.canvas,this.context),this.dirty=this.dirty||this._barColor!=t,this._barColor=t;}},{key:"barColor2",get:function(){return this._barColor2},set:function(t){t=ye(t,this.canvas,this.context),this.dirty=this.dirty||this._barColor2!=t,this._barColor2=t;}},{key:"isHorizontalGradient",get:function(){return this._isHorizontalGradient},set:function(t){this.dirty|=this._isHorizontalGradient!=t,this._isHorizontalGradient=t;}},{key:"setBarColor",value:function(t,e,i){return void 0===i&&(i=!0),this.barColor=t,this.barColor2=e,this.isHorizontalGradient=i,this}},{key:"skewX",get:function(){return this._skewX},set:function(t){this.dirty=this.dirty||this._skewX!=t,this._skewX=t;}},{key:"setSkewX",value:function(t){return this.skewX=t,this}},{key:"rtl",get:function(){return this._rtl},set:function(t){t=!!t,this.dirty=this.dirty||this._rtl!=t,this._rtl=t;}},{key:"setRTL",value:function(t){return void 0===t&&(t=!0),this.rtl=t,this}},{key:"updateTexture",value:function(){return this.clear(),hd.call(this),p(h(i.prototype),"updateTexture",this).call(this),this}}]),i}(Fc(pe));T.register("circularProgressCanvas",(function(t,e,i,n,s,r,o){var a=new dd(this.scene,t,e,i,n,s,r,o);return this.scene.add.existing(a),a})),Z(window,"RexPlugins.UI.LineProgressCanvas",dd),Phaser.Math.Wrap;var fd=Phaser.Math.Linear,pd=function(){var t,e,i,n,s,r,o=this.getShape("triangle"),a=this.padding,h=this.width-a.right,l=0+a.left,u=this.height-a.bottom,c=0+a.top,d=(l+h)/2,f=(c+u)/2,p={0:{a:{x:l,y:c},b:{x:h,y:f},c:{x:l,y:u}},1:{a:{x:l,y:c},b:{x:d,y:u},c:{x:h,y:c}},2:{a:{x:h,y:c},b:{x:l,y:f},c:{x:h,y:u}},3:{a:{x:l,y:u},b:{x:d,y:c},c:{x:h,y:u}}};if(void 0===this.previousDirection){var v=p[this.direction],g=v.a,y=v.b,k=v.c;t=g.x,e=g.y,i=y.x,n=y.y,s=k.x,r=k.y;}else {var m=p[this.previousDirection],b=p[this.direction],x=this.easeDirectionProgress;t=fd(m.a.x,b.a.x,x),e=fd(m.a.y,b.a.y,x),i=fd(m.b.x,b.b.x,x),n=fd(m.b.y,b.b.y,x),s=fd(m.c.x,b.c.x,x),r=fd(m.c.y,b.c.y,x);}o.startAt(t,e).lineTo(i,n).lineTo(s,r),this.arrowOnly?o.end():o.close();},vd=(0, Phaser.Math.DegToRad)(120),gd=function(t){t=this.getShape("triangle");var e=this.width/2,i=this.height/2,n=Math.min(e,i)*this.radius,s=this.verticeRotation;t.startAt(e+n*Math.cos(s+vd),i+n*Math.sin(s+vd)).lineTo(e+n*Math.cos(s),i+n*Math.sin(s)).lineTo(e+n*Math.cos(s-vd),i+n*Math.sin(s-vd)),this.arrowOnly?t.end():t.close();},yd={buildShapes:function(){this.addShape((new Vu).setName("triangle"));},updateShapes:function(){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?pd.call(this):gd.call(this);}},kd={setEaseDuration:function(t){return void 0===t&&(t=0),this.easeDuration=t,this},playEaseDirectionation:function(){return void 0===this.easeDirectionProgressTask&&(this.easeDirectionProgressTask=new Qu(this,{eventEmitter:null})),this.easeDirectionProgressTask.restart({key:"easeDirectionProgress",from:0,to:1,duration:this.easeDuration}),this},stopEaseDirection:function(){return void 0===this.easeDirectionProgressTask||this.easeDirectionProgressTask.stop(),this}},md=Phaser.Utils.Objects.GetValue,bd=Phaser.Utils.Objects.IsPlainObject,xd=Phaser.Math.DegToRad,Cd=Phaser.Math.RadToDeg,wd=function(t){a(s,t);var e=d(s);function s(t,i,r,o,a,h,l){var u,c,d,f,p,v,g,y,k;if(n(this,s),bd(i)){var m=i;i=m.x,r=m.y,o=m.width,a=m.height,h=m.color,l=m.alpha,c=m.strokeColor,d=m.strokeAlpha,f=m.strokeWidth,p=m.arrowOnly,v=m.direction,g=m.easeDuration,y=m.padding,k=m.radius;}return void 0===i&&(i=0),void 0===r&&(r=0),void 0===o&&(o=1),void 0===a&&(a=o),void 0===p&&(p=!1),void 0===v&&(v=0),void 0===g&&(g=0),void 0===y&&(y=0),void 0===k&&(k=void 0),(u=e.call(this,t,i,r,o,a)).type="rexTriangle",u.setFillStyle(h,l),void 0!==c&&void 0===f&&(f=2),u.setStrokeStyle(f,c,d),u.setArrowOnly(p),u.setDirection(v,g),u.setPadding(y),u.setRadius(k),u.buildShapes(),u}return r(s,[{key:"arrowOnly",get:function(){return this._arrowOnly},set:function(t){this.dirty=this.dirty||this._arrowOnly!=t,this._arrowOnly=t;}},{key:"setArrowOnly",value:function(t){return void 0===t&&(t=!0),this.arrowOnly=t,this}},{key:"direction",get:function(){return this._direction},set:function(t){t=Pd(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());}},{key:"setDirection",value:function(t,e){return void 0!==e&&this.setEaseDuration(e),this.direction=t,this}},{key:"toggleDirection",value:function(t){return this.setDirection(this.direction+2,t),this}},{key:"easeDirectionProgress",get:function(){return this._easeDirectionProgress},set:function(t){this._easeDirectionProgress!==t&&(this._easeDirectionProgress=t,this.dirty=!0);}},{key:"setPadding",value:function(t,e,n,s){if("object"===i(t)){var r=t,o=md(r,"x",null);null!==o?(t=o,n=o):(t=md(r,"left",0),n=md(r,"right",t));var a=md(r,"y",null);null!==a?(e=a,s=a):(e=md(r,"top",0),s=md(r,"bottom",e));}else void 0===t&&(t=0),void 0===e&&(e=t),void 0===n&&(n=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!=n||this.padding.bottom!=s,this.padding.left=t,this.padding.top=e,this.padding.right=n,this.padding.bottom=s,this.setRadius(),this}},{key:"radius",get:function(){return this._radius},set:function(t){this.dirty=this.dirty||this._radius!=t,this._radius=t;}},{key:"setRadius",value:function(t){return this.radius=t,this.shapeMode=null==t?0:1,this}},{key:"verticeRotation",get:function(){return this._verticeRotation},set:function(t){this.dirty=this.dirty||this._verticeRotation!=t,this._verticeRotation=t;}},{key:"setVerticeRotation",value:function(t){return this.verticeRotation=t,this}},{key:"verticeAngle",get:function(){return Cd(this.verticeRotation)},set:function(t){this.verticeRotation=xd(t);}},{key:"setVerticeAngle",value:function(t){return this.verticeAngle=t,this}}]),s}(uu),Sd={right:0,down:1,left:2,up:3},Pd=function(t){return "string"==typeof t&&(t=Sd[t]),t%=4};Object.assign(wd.prototype,yd,kd),T.register("triangle",(function(t,e,i,n,s,r){var o=new wd(this.scene,t,e,i,n,s,r);return this.scene.add.existing(o),o})),Z(window,"RexPlugins.UI.Triangle",wd),lt();var Td=Phaser.GameObjects.Zone,Od=Phaser.Utils.Array.Add,Md=Phaser.Utils.Array.Remove,Ed=function(t){a(i,t);var e=d(i);function i(t,s,r,o,a){var h;return n(this,i),void 0===s&&(s=0),void 0===r&&(r=0),void 0===o&&(o=1),void 0===a&&(a=1),(h=e.call(this,t,s,r,o,a)).children=[],h}return r(i,[{key:"destroy",value:function(t){if(this.scene&&!this.ignoreDestroy){if(t)for(var e,n=this.children.length-1;n>=0;n--)(e=this.children[n]).parentContainer||e.displayList||e.destroy(t);this.clear(!t),p(h(i.prototype),"destroy",this).call(this,t);}}},{key:"contains",value:function(t){return -1!==this.children.indexOf(t)}},{key:"add",value:function(t){var e=this;return Od(this.children,t,0,(function(t){t.once("destroy",e.onChildDestroy,e);}),this),this}},{key:"remove",value:function(t,e){var i=this;return Md(this.children,t,(function(t){t.off("destroy",i.onChildDestroy,i),e&&t.destroy();})),this}},{key:"onChildDestroy",value:function(t,e){this.remove(t,!1);}},{key:"clear",value:function(t){for(var e,i=0,n=this.children.length;i0;){var n=i.shift();!e(n)&&n.isRexContainerLite&&i.push.apply(i,m(n.children));}},uf=Phaser.Utils.Array,cf={getChildren:function(t){if(t)for(var e=0,i=this.children.length;e=0;e--)this.remove(this.backgroundChildren[e],t);return this}},Pp=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},Tp=/(\S+)\[(\d+)\]/i,Op={getInnerPadding:function(t){return On(this.space,t)},setInnerPadding:function(t,e){return Mn(this.space,t,e),this},getOuterPadding:function(t){return On(this.getSizerConfig(this).padding,t)},setOuterPadding:function(t,e){return Mn(this.getSizerConfig(this).padding,t,e),this},getChildOuterPadding:function(t,e){return "string"==typeof t&&(t=this.getElement(t)),On(this.getSizerConfig(t).padding,e)},setChildOuterPadding:function(t,e,i){return "string"==typeof t&&(t=this.getElement(t)),Mn(this.getSizerConfig(t).padding,e,i),this}},Mp=function(t){var e=this.childrenWidth,i=void 0!==this.minWidth?this.minWidth:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn("Layout width warn: ".concat(this.constructor.name,"'s minWidth (").concat(i,") < childrenWidth (").concat(e,")"))):this.layoutWarnEnable&&(i>t||e>t)&&console.warn("Layout width warn: ".concat(this.constructor.name,"'s minWidth (").concat(i,") or childrenWidth (").concat(e," > targetWidth ").concat(t,")")),t},Ep=function(t){var e=this.childrenHeight,i=void 0!==this.minHeight?this.minHeight:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn("Layout height warn: ".concat(this.constructor.name,"'s minHeight (").concat(i,") < childrenHeight (").concat(e,")"))):this.layoutWarnEnable&&(i>t||e>t)&&console.warn("Layout height warn: ".concat(this.constructor.name,"'s minHeight (").concat(i,") or childrenHeight (").concat(e,") > targetHeight (").concat(t,")")),t},_p={getShownChildren:function(t){void 0===t&&(t=[]);for(var e,i=this.children,n=0,s=i.length;n0;){var i=e.shift();i.rexSizer&&i.rexSizer.hidden||(i!==this&&t.push(i),i.isRexContainerLite&&e.push.apply(e,m(i.children)));}return t}},Rp=function(){this._childrenWidth=void 0,this._childrenHeight=void 0;for(var t,e=this.getChildrenSizers(),i=0,n=e.length;i0){var e=t.runTransitionInCallback();t.delayCall(e,this.next,this);}else this.next();}},{key:"exit_TRANS_OPNE",value:function(){this.parent.removeDelayCall();}},{key:"next_OPEN",value:function(){return "TRANS_CLOSE"}},{key:"enter_OPEN",value:function(){this.parent.onOpen();}},{key:"exit_OPEN",value:function(){this.parent.removeDelayCall();}},{key:"next_TRANS_CLOSE",value:function(){return "CLOSE"}},{key:"enter_TRANS_CLOSE",value:function(){var t=this.parent;if(t.transitOutTime>0){var e=t.runTransitionOutCallback();t.delayCall(e,this.next,this);}else this.next();}},{key:"exit_TRANS_CLOSE",value:function(){this.parent.removeDelayCall();}},{key:"next_CLOSE",value:function(){return "TRANS_OPNE"}},{key:"enter_CLOSE",value:function(){this.parent.onClose();}},{key:"exit_CLOSE",value:function(){}},{key:"canOpen",value:function(){return "IDLE"===this.state||"CLOSE"===this.state}},{key:"canClose",value:function(){return "IDLE"===this.state||"OPEN"===this.state}}]),i}(jv),Av={delayCall:function(t,e,i){return this.delayCallTimer=function(t,e,i,n,s){var r=no(t);return r.time.delayedCall(e,(function(){r.game.events.once("poststep",(function(){i.call(n,s);}));}))}(this,t,e,i),this},removeDelayCall:function(){return this.delayCallTimer&&(this.delayCallTimer.remove(!1),this.delayCallTimer=void 0),this}},Fv={setTransitInTime:function(t){return this.transitInTime=t,this},setTransitOutTime:function(t){return this.transitOutTime=t,this},setTransitInCallback:function(t){return t||(t=D),this.transitInCallback=t,this},setTransitOutCallback:function(t){return t||(t=D),this.transitOutCallback=t,this}},Wv={runTransitionInCallback:function(){return this.transitInCallback(this.parent,this.transitInTime),this.transitInTime},onOpen:function(){},requestOpen:function(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}},Yv={runTransitionOutCallback:function(){return this.transitOutCallback(this.parent,this.transitOutTime),this.transitOutTime},onClose:function(){this.oneShotMode&&this.parent.destroy();},requestClose:function(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}},Xv={};Object.assign(Xv,Av,Fv,Wv,Yv);var Vv=Phaser.Utils.Objects.GetValue,Gv=function(t){a(i,t);var e=d(i);function i(t,s){var r;return n(this,i),(r=e.call(this,t,s)).setTransitInTime(Vv(s,"duration.in",200)),r.setTransitOutTime(Vv(s,"duration.out",200)),r.setTransitInCallback(Vv(s,"transitIn")),r.setTransitOutCallback(Vv(s,"transitOut")),r.oneShotMode=Vv(s,"destroy",!1),r.delayCallTimer=void 0,r._state=new zv(u(r),{eventEmitter:!1,initState:Vv(s,"initState","IDLE")}),r.openEventData=void 0,r.closeEventData=void 0,r}return r(i,[{key:"state",get:function(){return this._state.state}},{key:"shutdown",value:function(t){this.isShutdown||(this.transitInCallback=void 0,this.transitOutCallback=void 0,this.openEventData=void 0,this.closeEventData=void 0,this.removeDelayCall(),p(h(i.prototype),"shutdown",this).call(this,t));}}]),i}(ro);Object.assign(Gv.prototype,Xv);var Uv=function(t){a(i,t);var e=d(i);function i(t,s,r){var o;return n(this,i),(o=e.call(this,t,0,0,2,2,s,1)).setAlpha(r),o.setScrollFactor(0),o.boot(),o}return r(i,[{key:"boot",value:function(){this.scene.sys.events.on("prerender",this.resize,this);}},{key:"destroy",value:function(t){this.scene&&!this.ignoreDestroy&&(this.scene.sys.events.off("prerender",this.resize,this),p(h(i.prototype),"destroy",this).call(this,t));}},{key:"tint",get:function(){return this.fillColor},set:function(t){this.setFillStyle(t,this.fillAlpha);}},{key:"resize",value:function(){var t=this.scene,e=t.sys.scale.gameSize,i=t.sys.cameras.main,n=e.width,s=e.height,r=1/i.zoom,o=n/2,a=s/2,h=n*r,l=s*r;this.x===o&&this.y===a||this.setPosition(o,a),this.width===h&&this.height===l||this.setSize(h,l).setOrigin(.5);}}]),i}(Phaser.GameObjects.Rectangle),Hv=Phaser.Utils.Objects.GetValue,Nv=function(t){a(i,t);var e=d(i);function i(t,s){var r;return n(this,i),(r=e.call(this,t,{eventEmitter:!1})).resetFromJSON(s),r.boot(),r}return r(i,[{key:"resetFromJSON",value:function(t){return this.setHitAreaMode(Hv(t,"hitAreaMode",0)),this.setEnable(Hv(t,"enable",!0)),this.setStopMode(Hv(t,"stopAllLevels",!0)),this}},{key:"boot",value:function(){this.parent.on("pointerdown",(function(t,e,i,n){this.stopAllLevels&&n.stopPropagation();}),this).on("pointerup",(function(t,e,i,n){this.stopAllLevels&&n.stopPropagation();}),this).on("pointermove",(function(t,e,i,n){this.stopAllLevels&&n.stopPropagation();}),this).on("pointerover",(function(t,e,i,n){this.stopAllLevels&&n.stopPropagation();}),this).on("pointerout",(function(t,e){this.stopAllLevels&&e.stopPropagation();}),this);}},{key:"setHitAreaMode",value:function(t){"string"==typeof t&&(t=Kv[t]);var e=this.parent;return e.input&&e.removeInteractive(),0===t?e.setInteractive():e.setInteractive({hitArea:{},hitAreaCallback:function(){return !0}}),this}},{key:"setEnable",value:function(t){return void 0===t&&(t=!0),t?this.parent.setInteractive():this.parent.disableInteractive(),this.enable=t,this}},{key:"setStopMode",value:function(t){return void 0===t&&(t=!0),this.stopAllLevels=t,this}},{key:"toggleEnable",value:function(){return this.setEnable(!this.enable),this}}]),i}(ro),Kv={default:0,fullWindow:1},Jv=Phaser.Utils.Objects.GetValue,Zv=function(t){a(i,t);var e=d(i);function i(t,s){var r;n(this,i);var o=Jv(s,"color",0),a=Jv(s,"alpha",.8);return (r=e.call(this,t,o,a)).touchEventStop=new Nv(u(r),{hitAreaMode:1}),r}return r(i)}(Uv),qv=function(t,e){void 0!==t._modalScaleSave?(t.scaleX=t._modalScaleSave,t.scaleY=t._modalScaleSave):t._modalScaleSave=t.scaleX,Fp(t,e);},$v=function(t,e){Wp(t,e,void 0,void 0,!1);},Qv=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Zp(t,e);},tg=function(t,e){qp(t,e,!1);},eg=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Zp(t,e,t.alpha);},ig=function(t,e){qp(t,e,!1);},ng=function(t,e,i,n,s){return !!t&&(!(n&&!n(t,e,i))&&(!!Dr(t,!0).contains(e,i)&&!(s&&!s(t,e,i))))},sg=Phaser.Utils.Objects.GetValue,rg=function(t){a(i,t);var e=d(i);function i(t,s){var r;n(this,i),void 0===s&&(s={}),null==s.transitIn&&(s.transitIn=og.popUp),null==s.transitOut&&(s.transitOut=og.scaleDown),s.destroy=sg(s,"destroy",!0),r=e.call(this,t,s);var o=sg(s,"cover");r.cover=!1!==o?function(t,e){var i=t.scene,n=new Zv(i,e);return i.add.existing(n),t.isRexContainerLite?(t.pin(n,{syncPosition:!1,syncRotation:!1,syncScale:!1,syncAlpha:!1,syncScrollFactor:!1}),t.moveDepthBelow(n)):i.children.moveBelow(n,t),n}(t,o):void 0,r.cover&&(r.setCoverTransitInCallback(sg(o,"transitIn",eg)),r.setCoverTransitOutCallback(sg(o,"transitOut",ig)));var a=sg(s,"touchOutsideClose",!1),h=sg(s,"duration.hold",-1),l=sg(s,"timeOutClose",h>=0),c=sg(s,"anyTouchClose",!1);return sg(s,"manualClose",!1)&&(a=!1,c=!1,l=!1),c&&(a=!1),l?r.setDisplayTime(h):r.setDisplayTime(-1),c?r.once("open",r.anyTouchClose,u(r)):a&&r.once("open",r.touchOutsideClose,u(r)),sg(s,"openOnStart",!0)&&r.delayCall(0,r.requestOpen,u(r)),r}return r(i,[{key:"shutdown",value:function(t){this.isShutdown||(this.cover||this.scene.input.off("pointerup",this.touchCloseCallback,this),this.cover&&!t&&(this.cover.destroy(),this.cover=void 0),p(h(i.prototype),"shutdown",this).call(this,t));}},{key:"touchOutsideClose",value:function(){return this.cover?this.cover.on("pointerup",this.touchCloseCallback,this):this.scene.input.on("pointerup",this.touchCloseCallback,this),this.clickOutsideTest=!0,this}},{key:"anyTouchClose",value:function(){return this.cover?this.cover.once("pointerup",this.touchCloseCallback,this):this.scene.input.once("pointerup",this.touchCloseCallback,this),this}},{key:"touchCloseCallback",value:function(t){this.clickOutsideTest&&ng(this.parent,t.worldX,t.worldY)||this.requestClose();}},{key:"runTransitionInCallback",value:function(){var t=p(h(i.prototype),"runTransitionInCallback",this).call(this),e=this.cover;return e&&this.coverTransitInCallback&&this.coverTransitInCallback(e,t),t}},{key:"runTransitionOutCallback",value:function(){var t=p(h(i.prototype),"runTransitionOutCallback",this).call(this),e=this.cover;return e&&this.coverTransitOutCallback&&this.coverTransitOutCallback(e,t),t}},{key:"onOpen",value:function(){var t=this.displayTime;t>=0&&this.delayCall(t,this.requestClose,this),this.emit("open",this.parent,this),p(h(i.prototype),"onOpen",this).call(this);}},{key:"onClose",value:function(){this.emit("close",this.closeEventData),p(h(i.prototype),"onClose",this).call(this);}},{key:"setDisplayTime",value:function(t){return this.displayTime=t,this}},{key:"setTransitInCallback",value:function(t){switch("string"==typeof t&&(t=og[t]),t){case og.popUp:t=qv;break;case og.fadeIn:t=Qv;}return p(h(i.prototype),"setTransitInCallback",this).call(this,t),this}},{key:"setTransitOutCallback",value:function(t){switch("string"==typeof t&&(t=og[t]),t){case og.scaleDown:t=$v;break;case og.fadeOut:t=tg;}return p(h(i.prototype),"setTransitOutCallback",this).call(this,t),this}},{key:"setCoverTransitInCallback",value:function(t){return this.coverTransitInCallback=t,this}},{key:"setCoverTransitOutCallback",value:function(t){return this.coverTransitOutCallback=t,this}}]),i}(Gv),og={popUp:0,fadeIn:1,scaleDown:0,fadeOut:1},ag=function(t,e){var i=new rg(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},hg=function(t,e){t.emit("modal.requestClose",e);},lg=function(t){return t&&"function"==typeof t},ug={modal:function(t,e){return lg(t)&&(e=t,t=void 0),void 0===this._modalBehavior&&(this.onCreateModalBehavior&&this.onCreateModalBehavior(this,t),this._modalBehavior=ag(this,t)),e&&this._modalBehavior.once("close",e),this._modalBehavior.requestOpen(),this},modalPromise:function(t){var e=this;return new Promise((function(i,n){e.modal(t,i);}))},modalClose:function(t){return hg(this,t),this}},cg=function(t,e,i,n){if(e)return ng(t,e.worldX,e.worldY,i,n);for(var s=t.scene.input.manager,r=s.pointersTotal,o=s.pointers,a=0;a=this.dragThreshold||this.isPointerInside(t))&&this.cancel();}},{key:"click",value:function(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}},{key:"cancel",value:function(){return this.pointer=void 0,this}}]),i}(ro),Og={press:0,pointerdown:0,release:1,pointerup:1},Mg={onClickOutside:function(t,e,i,n){return t?("function"==typeof t&&(n=i,i=e,e=t,t=this),void 0===t._clickOutside&&(t._clickOutside=new Tg(t,n)),t._clickOutside.on("clickoutside",e,i),this):this},offClickOutside:function(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:function(t,e){return t&&"object"!==i(t)&&(e=t,t=this),void 0===t._clickOutside||t._clickOutside.setEnable(e),this},disableClickOutside:function(t){return t&&"object"!==i(t)&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(!1),this}},Eg=function(t){a(i,t);var e=d(i);function i(){var t;return n(this,i),(t=e.call(this,{eventEmitter:!1})).goto("IDLE"),t}return r(i,[{key:"setCooldownTime",value:function(t){return this.cooldownTime=t,this.cooldownMode=void 0!==t,this}},{key:"request",value:function(){return this.runMethod("request")}},{key:"update_IDLE",value:function(){this.compensationTime=0;}},{key:"request_IDLE",value:function(){return this.next(),!0}},{key:"next_IDLE",value:function(){if(this.cooldownMode)return "COOLDOWN"}},{key:"enter_COOLDOWN",value:function(){this.remainderTime=this.cooldownTime+this.compensationTime;}},{key:"update_COOLDOWN",value:function(t,e){this.remainderTime-=e,this.remainderTime<0&&(this.compensationTime=this.cooldownTime>e?-this.remainderTime:0,this.goto("IDLE"));}},{key:"request_COOLDOWN",value:function(){return !1}}]),i}(jv),_g=Phaser.Utils.Objects.GetValue,Rg=function(t){a(i,t);var e=d(i);function i(t,s){var r;return n(this,i),(r=e.call(this,t,s))._enable=void 0,r.cooldown=new Eg,r.parent.setInteractive(_g(s,"inputConfig",void 0)),r.resetFromJSON(s),r.boot(),r}return r(i,[{key:"resetFromJSON",value:function(t){return this.pointer=void 0,this.prevIsInTouch=!1,this.isInTouching=!1,this.setEnable(_g(t,"enable",!0)),this.setCooldown(_g(t,"cooldown",void 0)),this}},{key:"boot",value:function(){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);}},{key:"shutdown",value:function(t){this.isShutdown||(this.scene.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,p(h(i.prototype),"shutdown",this).call(this,t));}},{key:"enable",get:function(){return this._enable},set:function(t){if(this._enable!==t)return t||(this.prevIsInTouch=!1,this.isInTouching=!1,this.pointer=void 0),this._enable=t,this}},{key:"setEnable",value:function(t){return void 0===t&&(t=!0),this.enable=t,this}},{key:"cooldownTime",get:function(){return this.cooldown.cooldownTime},set:function(t){this.cooldown.setCooldownTime(t);}},{key:"setCooldown",value:function(t){return this.cooldownTime=t,this}},{key:"toggleEnable",value:function(){return this.setEnable(!this.enable),this}},{key:"onPointIn",value:function(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.pointer=t,this.isInTouching=!0);}},{key:"onPointOut",value:function(t){this.enable&&this.pointer===t&&(this.pointer=void 0,this.isInTouching=!1);}},{key:"preupdate",value:function(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;}}]),i}(ro),Lg={isPointerInBounds:function(t){return void 0===t?t=this:"string"==typeof t&&(t=this.getElement(t)),!!t&&cg(t)},onTouching:function(t,e,i,n){return t?("function"==typeof t&&(n=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new Rg(t,n)),t._inTouching.on("intouch",e,i),this):this},offTouching:function(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:function(t,e,i,n){return t?("function"==typeof t&&(n=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new Rg(t,n)),t._inTouching.on("touchend",e,i),this):this},offTouchingEnd:function(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:function(t,e){return t&&"object"!==i(t)&&(e=t,t=this),void 0===t._inTouching||t._inTouching.setEnable(e),this},disableTouching:function(t){return t&&"object"!==i(t)&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(!1),this}},Bg=function(t,e,i){for(var n,s=0,r=t.length;s0),this.onDragStart()));}},{key:"onPointerUp",value:function(t){this.enable&&((!this.bounds||this.bounds.contains(t.x,t.y))&&this.pointer===t&&(this.pointer=void 0,this.movedState=!1,this.tracerState=Jg,this.onDragEnd()));}},{key:"onPointerMove",value:function(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()));}}},{key:"dragCancel",value:function(){return this.tracerState===Zg&&this.onDragEnd(),this.pointer=void 0,this.tracerState=Jg,this}},{key:"onDragStart",value:function(){this.emit("dragstart",this);}},{key:"onDragEnd",value:function(){this.emit("dragend",this);}},{key:"onDrag",value:function(){this.emit("drag",this);}},{key:"preUpdate",value:function(t,e){}},{key:"postUpdate",value:function(t,e){}},{key:"startTicking",value:function(){p(h(i.prototype),"startTicking",this).call(this),this.scene.sys.events.on("preupdate",this.preUpdate,this),this.scene.sys.events.on("postupdate",this.postUpdate,this);}},{key:"stopTicking",value:function(){p(h(i.prototype),"stopTicking",this).call(this),this.scene&&(this.scene.sys.events.off("preupdate",this.preUpdate,this),this.scene.sys.events.off("postupdate",this.postUpdate,this));}},{key:"setRecongizedStateObject",value:function(t){return this.recongizedState=t,this}},{key:"state",get:function(){return this.recongizedState.state},set:function(t){this.recongizedState.state=t;}},{key:"cancel",value:function(){return this.state=qg,this}}]),i}(ao),Jg=0,Zg=1,qg="IDLE",$g=Phaser.Utils.Objects.GetValue,Qg=Phaser.Math.Distance.Between,ty=function(t){a(i,t);var e=d(i);function i(t,s){var r;n(this,i);var o=u(r=e.call(this,t,s)),a={states:{IDLE:{enter:function(){o.stop(),o.tapsCount=0,o.x=0,o.y=0,o.worldX=0,o.worldY=0;},exit:function(){var t=o.lastPointer;o.x=t.x,o.y=t.y,o.worldX=t.worldX,o.worldY=t.worldY;}},BEGIN:{enter:function(){o.start(),o.tapsCount=0,o.emit("tappingstart",o,o.gameObject,o.lastPointer);}},RECOGNIZED:{enter:function(){o.start(),o.emit("tap",o,o.gameObject,o.lastPointer),o.emit("".concat(o.tapsCount,"tap"),o,o.gameObject,o.lastPointer);}}},init:function(){this.state=ey;},eventEmitter:!1};return r.setRecongizedStateObject(new jv(a)),r}return r(i,[{key:"resetFromJSON",value:function(t){p(h(i.prototype),"resetFromJSON",this).call(this,t),this.setHoldTime($g(t,"time",250)),this.setTapInterval($g(t,"tapInterval",200)),this.setDragThreshold($g(t,"threshold",9)),this.setTapOffset($g(t,"tapOffset",10));var e=$g(t,"taps",void 0);return void 0!==e?this.setTaps(e):(this.setMaxTaps($g(t,"maxTaps",void 0)),this.setMinTaps($g(t,"minTaps",void 0))),this}},{key:"onDragStart",value:function(){switch(this.state){case ey:this.state=iy;break;case iy:var t=this.lastPointer;Qg(t.upX,t.upY,t.x,t.y)>this.tapOffset&&(this.state=ny,this.state=iy);break;case ny:this.state=iy;}}},{key:"onDragEnd",value:function(){this.state===iy&&(this.tapsCount++,this.emit("tapping",this,this.gameObject,this.lastPointer),void 0!==this.maxTaps&&this.tapsCount===this.maxTaps&&(this.state=ny));}},{key:"onDrag",value:function(){this.state!==ey&&this.pointer.getDistance()>this.dragThreshold&&(this.state=ey);}},{key:"preUpdate",value:function(t,e){if(this.isRunning&&this.enable&&this.state===iy){var i=this.lastPointer;if(i.isDown)t-i.downTime>this.holdTime&&(this.state=ey);else t-i.upTime>this.tapInterval&&(void 0===this.minTaps||this.tapsCount>=this.minTaps?this.state=ny:this.state=ey);}}},{key:"postUpdate",value:function(t,e){this.isRunning&&this.enable&&this.state===ny&&(this.state=ey);}},{key:"isTapped",get:function(){return this.state===ny}},{key:"setHoldTime",value:function(t){return this.holdTime=t,this}},{key:"setTapInterval",value:function(t){return this.tapInterval=t,this}},{key:"setDragThreshold",value:function(t){return this.dragThreshold=t,this}},{key:"setTapOffset",value:function(t){return this.tapOffset=t,this}},{key:"setMaxTaps",value:function(t){return this.maxTaps=t,this}},{key:"setMinTaps",value:function(t){return this.minTaps=t,this}},{key:"setTaps",value:function(t,e){return void 0===e&&(e=t),this.setMinTaps(t).setMaxTaps(e),this}}]),i}(Kg),ey="IDLE",iy="BEGIN",ny="RECOGNIZED",sy=Phaser.Utils.Objects.GetValue,ry=function(t){a(i,t);var e=d(i);function i(t,s){var r;n(this,i);var o=u(r=e.call(this,t,s)),a={states:{IDLE:{enter:function(){o.x=0,o.y=0,o.worldX=0,o.worldY=0;},exit:function(){var t=o.lastPointer;o.x=t.x,o.y=t.y,o.worldX=t.worldX,o.worldY=t.worldY;}},BEGIN:{enter:function(){o.start();},exit:function(){o.stop();}},RECOGNIZED:{enter:function(){o.emit("pressstart",o,o.gameObject,o.lastPointer);},exit:function(){o.emit("pressend",o,o.gameObject,o.lastPointer);}}},init:function(){this.state=oy;},eventEmitter:!1};return r.setRecongizedStateObject(new jv(a)),r}return r(i,[{key:"resetFromJSON",value:function(t){return p(h(i.prototype),"resetFromJSON",this).call(this,t),this.setDragThreshold(sy(t,"threshold",9)),this.setHoldTime(sy(t,"time",251)),this}},{key:"onDragStart",value:function(){this.state=ay,0===this.holdTime&&(this.state=hy);}},{key:"onDragEnd",value:function(){this.state=oy;}},{key:"onDrag",value:function(){this.state!==oy&&this.pointer.getDistance()>this.dragThreshold&&(this.state=oy);}},{key:"preUpdate",value:function(t,e){this.isRunning&&this.enable&&(this.state===ay&&t-this.pointer.downTime>=this.holdTime&&(this.state=hy));}},{key:"isPressed",get:function(){return this.state===hy}},{key:"setHoldTime",value:function(t){return this.holdTime=t,this}},{key:"setDragThreshold",value:function(t){return this.dragThreshold=t,this}}]),i}(Kg),oy="IDLE",ay="BEGIN",hy="RECOGNIZED",ly=Phaser.Utils.Objects.GetValue,uy=function(t){a(i,t);var e=d(i);function i(t,s){var r;n(this,i);var o=u(r=e.call(this,t,s)),a={states:{IDLE:{},BEGIN:{enter:function(){var t=o.pointer;o.startX=t.x,o.startY=t.y,o.startWorldX=t.worldX,o.startWorldY=t.worldY;}},RECOGNIZED:{enter:function(){o.emit("panstart",o,o.gameObject,o.lastPointer);},exit:function(){var t=o.lastPointer;o.endX=t.x,o.endY=t.y,o.endWorldX=t.worldX,o.endWorldY=t.worldY,o.emit("panend",o,o.gameObject,o.lastPointer);}}},init:function(){this.state=cy;},eventEmitter:!1};return r.setRecongizedStateObject(new jv(a)),r}return r(i,[{key:"resetFromJSON",value:function(t){return p(h(i.prototype),"resetFromJSON",this).call(this,t),this.setDragThreshold(ly(t,"threshold",10)),this}},{key:"onDragStart",value:function(){this.state=dy,0===this.dragThreshold&&(this.state=fy);}},{key:"onDragEnd",value:function(){this.state=cy;}},{key:"onDrag",value:function(){switch(this.state){case dy:this.pointer.getDistance()>=this.dragThreshold&&(this.state=fy);break;case fy:var t=this.pointer.position,e=this.pointer.prevPosition;this.dx=t.x-e.x,this.dy=t.y-e.y;var i=this.pointer;this.x=i.x,this.y=i.y,this.worldX=i.worldX,this.worldY=i.worldY,this.emit("pan",this,this.gameObject,this.lastPointer);}}},{key:"isPanned",get:function(){return this.state===fy}},{key:"setDragThreshold",value:function(t){return this.dragThreshold=t,this}}]),i}(Kg),cy="IDLE",dy="BEGIN",fy="RECOGNIZED",py=Phaser.Math.Distance.Between,vy=Phaser.Math.Angle.Between,gy={getDt:function(){return eu(this.scene)},getVelocity:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return py(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 vy(e.x,e.y,t.x,t.y)}},yy={"up&down":0,"left&right":1,"4dir":2,"8dir":3},ky={},my=Phaser.Utils.Objects.GetValue,by=Phaser.Math.RadToDeg,xy=function(t){a(i,t);var e=d(i);function i(t,s){var r;n(this,i);var o=u(r=e.call(this,t,s)),a={states:{IDLE:{enter:function(){o.x=0,o.y=0,o.worldX=0,o.worldY=0;},exit:function(){var t=o.lastPointer;o.x=t.x,o.y=t.y,o.worldX=t.worldX,o.worldY=t.worldY;}},BEGIN:{enter:function(){o.validDrag=!1;}},RECOGNIZED:{enter:function(){o.start(),o.updateDirectionStates(),o.emit("swipe",o,o.gameObject,o.lastPointer);},exit:function(){o.stop(),o.clearDirectionStates();}}},init:function(){this.state=Cy;},eventEmitter:!1};return r.setRecongizedStateObject(new jv(a)),r.clearDirectionStates(),r}return r(i,[{key:"resetFromJSON",value:function(t){return p(h(i.prototype),"resetFromJSON",this).call(this,t),this.setDragThreshold(my(t,"threshold",10)),this.setVelocityThreshold(my(t,"velocityThreshold",1e3)),this.setDirectionMode(my(t,"dir","8dir")),this}},{key:"onDragStart",value:function(){this.state=wy;}},{key:"onDragEnd",value:function(){this.state=Cy;}},{key:"onDrag",value:function(){this.state===wy&&(this.validDrag||(this.validDrag=0===this.dragThreshold||this.pointer.getDistance()>=this.dragThreshold),this.validDrag&&this.dragVelocity>this.velocityThreshold&&(this.state=Sy));}},{key:"postUpdate",value:function(t,e){this.isRunning&&this.enable&&this.state===Sy&&(this.state=Cy);}},{key:"isSwiped",get:function(){return this.state===Sy}},{key:"dragVelocity",get:function(){var t;switch(this.dirMode){case 0:t=this.getVelocityY();break;case 1:t=this.getVelocityX();break;default:t=this.getVelocity();}return t}},{key:"setDragThreshold",value:function(t){return this.dragThreshold=t,this}},{key:"setVelocityThreshold",value:function(t){return this.velocityThreshold=t,this}},{key:"setDirectionMode",value:function(t){return "string"==typeof t&&(t=yy[t]),this.dirMode=t,this}},{key:"updateDirectionStates",value:function(){return function(t,e,i){switch(void 0===i?i={}:!0===i&&(i=ky),i.left=!1,i.right=!1,i.up=!1,i.down=!1,t=(t+360)%360,e){case 0:t<180?i.down=!0:i.up=!0;break;case 1:t>90&&t<=270?i.left=!0:i.right=!0;break;case 2:t>45&&t<=135?i.down=!0:t>135&&t<=225?i.left=!0:t>225&&t<=315?i.up=!0:i.right=!0;break;case 3:t>22.5&&t<=67.5?(i.down=!0,i.right=!0):t>67.5&&t<=112.5?i.down=!0:t>112.5&&t<=157.5?(i.down=!0,i.left=!0):t>157.5&&t<=202.5?i.left=!0:t>202.5&&t<=247.5?(i.left=!0,i.up=!0):t>247.5&&t<=292.5?i.up=!0:t>292.5&&t<=337.5?(i.up=!0,i.right=!0):i.right=!0;}}(by(this.getVelocityAngle()),this.dirMode,this),this}},{key:"clearDirectionStates",value:function(){return this.left=!1,this.right=!1,this.up=!1,this.down=!1,this}}]),i}(Kg);Object.assign(xy.prototype,gy);var Cy="IDLE",wy="BEGIN",Sy="RECOGNIZED",Py=Phaser.Utils.Objects.GetValue,Ty=Phaser.Utils.Array.SpliceOne,Oy=Phaser.Math.Distance.Between,My=Phaser.Math.Angle.Between,Ey=function(){function t(e,i){n(this,t);var s=e.input.manager.pointersTotal-1;s<2&&e.input.addPointer(2-s),this.scene=e,this.setEventEmitter(Py(i,"eventEmitter",void 0)),this._enable=void 0,this.pointers=[],this.movedState={},this.resetFromJSON(i),this.boot();}return r(t,[{key:"resetFromJSON",value:function(t){return this.setEnable(Py(t,"enable",!0)),this.bounds=Py(t,"bounds",void 0),this.tracerState=Ry,this.pointers.length=0,xt(this.movedState),this}},{key:"boot",value:function(){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);}},{key:"shutdown",value:function(){this.scene&&(this.destroyEventEmitter(),this.pointers.length=0,xt(this.movedState),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);}},{key:"destroy",value:function(){this.shutdown();}},{key:"enable",get:function(){return this._enable},set:function(t){if(this._enable!==t)return t||this.dragCancel(),this._enable=t,this}},{key:"setEnable",value:function(t){return void 0===t&&(t=!0),this.enable=t,this}},{key:"toggleEnable",value:function(){return this.setEnable(!this.enable),this}},{key:"onPointerDown",value:function(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.tracerState){case Ry:this.tracerState=Ly,this.onDrag1Start();break;case Ly:this.tracerState=By,this.onDrag2Start();}}},{key:"onPointerUp",value:function(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],Ty(this.pointers,e),this.tracerState){case Ly:this.tracerState=Ry,this.onDrag1End();break;case By:this.tracerState=Ly,this.onDrag2End(),this.onDrag1Start();}}}},{key:"onPointerMove",value:function(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 Ly:this.onDrag1();break;case By:this.onDrag2();}}}},{key:"dragCancel",value:function(){return this.tracerState===By&&this.onDrag2End(),this.pointers.length=0,xt(this.movedState),this.tracerState=Ry,this}},{key:"onDrag1Start",value:function(){this.emit("drag1start",this);}},{key:"onDrag1End",value:function(){this.emit("drag1end",this);}},{key:"onDrag1",value:function(){this.emit("drag1",this);}},{key:"onDrag2Start",value:function(){this.emit("drag2start",this);}},{key:"onDrag2End",value:function(){this.emit("drag2end",this);}},{key:"onDrag2",value:function(){this.emit("drag2",this);}},{key:"distanceBetween",get:function(){if(this.tracerState!==By)return 0;var t=this.pointers[0],e=this.pointers[1];return Oy(t.x,t.y,e.x,e.y)}},{key:"angleBetween",get:function(){if(this.tracerState!==By)return 0;var t=this.pointers[0],e=this.pointers[1];return My(t.x,t.y,e.x,e.y)}},{key:"drag1Vector",get:function(){var t=this.pointers[0];if(t&&this.movedState[t.id]){var e=t.position,i=t.prevPosition;_y.x=e.x-i.x,_y.y=e.y-i.y;}else _y.x=0,_y.y=0;return _y}},{key:"centerX",get:function(){if(this.tracerState!==By)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return (t.x+e.x)/2}},{key:"centerY",get:function(){if(this.tracerState!==By)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return (t.y+e.y)/2}},{key:"prevCenterX",get:function(){if(this.tracerState!==By)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}},{key:"prevCenterY",get:function(){if(this.tracerState!==By)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}},{key:"movementCenterX",get:function(){return this.centerX-this.prevCenterX}},{key:"movementCenterY",get:function(){return this.centerY-this.prevCenterY}},{key:"setRecongizedStateObject",value:function(t){return this.recongizedState=t,this}},{key:"state",get:function(){return this.recongizedState.state},set:function(t){this.recongizedState.state=t;}},{key:"cancel",value:function(){return this.state=Dy,this}}]),t}();Object.assign(Ey.prototype,nr);var _y={},Ry=0,Ly=1,By=2,Dy="IDLE",Iy=Phaser.Utils.Objects.GetValue,jy=function(t){a(i,t);var e=d(i);function i(t,s){var r;n(this,i);var o=u(r=e.call(this,t,s)),a={states:{IDLE:{enter:function(){o.prevDistance=void 0,o.scaleFactor=1;}},BEGIN:{},RECOGNIZED:{enter:function(){o.emit("pinchstart",o);},exit:function(){o.emit("pinchend",o);}}},init:function(){this.state=zy;},eventEmitter:!1};return r.setRecongizedStateObject(new jv(a)),r}return r(i,[{key:"resetFromJSON",value:function(t){return p(h(i.prototype),"resetFromJSON",this).call(this,t),this.setDragThreshold(Iy(t,"threshold",0)),this}},{key:"onDrag2Start",value:function(){this.scaleFactor=1,this.prevDistance=this.distanceBetween,this.state=Ay,0===this.dragThreshold&&(this.state=Fy);}},{key:"onDrag2End",value:function(){this.state=zy;}},{key:"onDrag2",value:function(){switch(this.state){case Ay: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=Fy;}break;case Fy:t=this.distanceBetween;this.scaleFactor=t/this.prevDistance,this.emit("pinch",this),this.prevDistance=t;}}},{key:"isPinched",get:function(){return this.state===Fy}},{key:"setDragThreshold",value:function(t){return this.dragThreshold=t,this}}]),i}(Ey),zy="IDLE",Ay="BEGIN",Fy="RECOGNIZED",Wy=Phaser.Math.RotateAround,Yy=function(t,e,i,n){return Wy(t,e,i,n),t.rotation+=n,t},Xy={},Vy=Phaser.Utils.Objects.GetValue,Gy=Phaser.Math.Angle.WrapDegrees,Uy=Phaser.Math.Angle.ShortestBetween,Hy=Phaser.Math.RadToDeg,Ny=Phaser.Math.DegToRad,Ky=function(t){a(i,t);var e=d(i);function i(t,s){var r;n(this,i);var o=u(r=e.call(this,t,s)),a={states:{IDLE:{enter:function(){o.prevAngle=void 0,o.angle=0;}},BEGIN:{},RECOGNIZED:{enter:function(){o.emit("rotatestart",o);},exit:function(){o.emit("rotateend",o);}}},init:function(){this.state=Zy;},eventEmitter:!1};return r.setRecongizedStateObject(new jv(a)),r}return r(i,[{key:"resetFromJSON",value:function(t){return p(h(i.prototype),"resetFromJSON",this).call(this,t),this.setDragThreshold(Vy(t,"threshold",0)),this}},{key:"onDrag2Start",value:function(){this.prevAngle=Gy(Hy(this.angleBetween)),this.state=qy,0===this.dragThreshold&&(this.state=$y);}},{key:"onDrag2End",value:function(){this.state=Zy;}},{key:"onDrag2",value:function(){switch(this.state){case qy:if(this.pointers[0].getDistance()>=this.dragThreshold&&this.pointers[1].getDistance()>=this.dragThreshold){var t=Gy(Hy(this.angleBetween));this.angle=Uy(this.prevAngle,t),this.prevAngle=t,this.state=$y;}break;case $y:t=Gy(Hy(this.angleBetween));this.angle=Uy(this.prevAngle,t),this.prevAngle=t,this.emit("rotate",this);}}},{key:"isRotated",get:function(){return this.state===$y}},{key:"rotation",get:function(){return Ny(this.angle)}},{key:"setDragThreshold",value:function(t){return this.dragThreshold=t,this}}]),i}(Ey),Jy={spinObject:function(t,e){if(!this.isRotation)return this;void 0===e&&(e=this.pointers[0].camera);var i=this.movementCenterX,n=this.movementCenterY,s=function(t,e,i,n){return void 0===n?n={}:!0===n&&(n=Xy),i.getWorldPoint(t,e,n),n}(this.centerX,this.centerY,e,!0),r=s.x,o=s.y,a=this.rotation;if(Array.isArray(t))for(var h=t,l=0,u=h.length;l0?c.pop().setTexture(f,M):r(d,f,M),l&&d.add.existing(O);var E=b+w*T+a*w,_=x+S*P+h*S;u&&(O.setOrigin(a,h).setPosition(E,_).setScale(g,y).setRotation(k),Cm(O,b,x,k)),C.push(O);}return C},Sm={gridCutImage:function(t,e,i,n){void 0===n&&(n={}),n.objectPool=this.imagesPool;for(var s,r=wm(t,e,i,n),o=0,a=r.length;o=0;n--)(o=s[n])instanceof e&&(o.destroy(),Ym(s,n));else {n=0;for(var s,r=(s=t.postPipelines).length;nn&&(i.width=i.height*n),i}(t,{width:this.width,height:this.height},!0);return t.setDisplaySize(e.width,e.height),this.resetChildScaleState(t),this}},{key:"resize",value:function(t,e){return p(h(i.prototype),"resize",this).call(this,t,e),this.scaleImage(),this}},{key:"setTexture",value:function(t,e){var i=this.image;return i.setTexture(t,e),null!==t?(this.setChildVisible(i,!0),this.scaleImage()):this.setChildVisible(i,!1),this}}]),i}(If);Object.assign(Km.prototype,Pm),T.register("imageBox",(function(t,e,i,n,s){var r=new Km(this.scene,t,e,i,n,s);return this.scene.add.existing(r),r})),Z(window,"RexPlugins.UI.ImageBox",Km),T.register("fullWindowRectangle",(function(t,e){var i=new Uv(this.scene,t,e);return this.scene.add.existing(i),i})),Z(window,"RexPlugins.UI.FullWindowRectangle",Uv),T.register("cover",(function(t){var e=new Zv(this.scene,t);return this.scene.add.existing(e),e})),Z(window,"RexPlugins.UI.Cover",Zv);var Jm=function(t,e){if(this.scene.sys.scale.autoRound&&(t=Math.floor(t),e=Math.floor(e)),this.width===t&&this.height===e)return this;var i=this.node.style;return i.width="".concat(t,"px"),i.height="".concat(e,"px"),this.updateSize(),this},Zm={id:["id",void 0],text:["value",void 0],maxLength:["maxLength",void 0],minLength:["minLength",void 0],placeholder:["placeholder",void 0],tooltip:["title",void 0],readOnly:["readOnly",!1],spellCheck:["spellcheck",!1],autoComplete:["autocomplete","off"]},qm={align:["textAlign",void 0],paddingLeft:["padding-left",void 0],paddingRight:["padding-right",void 0],paddingTop:["padding-top",void 0],paddingBottom:["padding-bottom",void 0],fontFamily:["fontFamily",void 0],fontSize:["font-size",void 0],color:["color","#ffffff"],backgroundColor:["backgroundColor","transparent"],border:["border",0],borderColor:["borderColor","transparent"],outline:["outline","none"],direction:["direction",void 0]},$m={input:"textchange",click:"click",dblclick:"dblclick",mousedown:"pointerdown",mousemove:"pointermove",mouseup:"pointerup",touchstart:"pointerdown",touchmove:"pointermove",touchend:"pointerup",keydown:"keydown",keyup:"keyup",keypress:"keypress",compositionstart:"compositionStart",compositionend:"compositionEnd",compositionupdate:"compositionUpdate",focus:"focus",blur:"blur",select:"select"},Qm=Phaser.Utils.Objects.GetValue,tb=function(t,e,i,n){var s=Qm(n,"preventDefault",!1),r=Qm(n,"preTest"),o=function(n){e.addEventListener(n,(function(e){r&&!r(t,n)||t.emit(i[n],t,e),s&&e.preventDefault();}));};for(var a in i)o(a);},eb=Phaser.GameObjects.DOMElement,ib=Phaser.Utils.Objects.IsPlainObject,nb=Phaser.Utils.Objects.GetValue,sb=function(t){a(i,t);var e=d(i);function i(t,s,r,o,a,h){var l,c;n(this,i),ib(s)?(s=nb(h=s,"x",0),r=nb(h,"y",0),o=nb(h,"width",0),a=nb(h,"height",0)):ib(o)&&(o=nb(h=o,"width",0),a=nb(h,"height",0)),void 0===h&&(h={});var d=nb(h,"inputType",void 0);void 0===d&&(d=nb(h,"type","text")),"textarea"===d?(c=document.createElement("textarea")).style.resize="none":(c=document.createElement("input")).type=d,ml(Zm,h,c);var f=nb(h,"style",void 0);f=ml(qm,h,f);var p=c.style;for(var v in h)v in Zm||v in qm||v in p&&(f[v]=h[v]);return f["box-sizing"]="border-box",(l=e.call(this,t,s,r,c,f)).type="rexInputText",l.resize(o,a),tb(u(l),c,$m),bl(c),nb(h,"selectAll",!1)&&l.selectAll(),l._isFocused=!1,l.on("focus",(function(){this._isFocused=!0;}),u(l)).on("blur",(function(){this._isFocused=!1;}),u(l)),l}return r(i,[{key:"inputType",get:function(){return "textarea"===this.node.tagName.toLowerCase()?"textarea":this.node.type}},{key:"text",get:function(){return this.node.value},set:function(t){this.node.value=t;}},{key:"setText",value:function(t){return this.text=t,this}},{key:"maxLength",get:function(){return this.node.maxLength},set:function(t){this.node.maxLength=t;}},{key:"setMaxLength",value:function(t){return this.maxLength=t,this}},{key:"minLength",get:function(){return this.node.minLength},set:function(t){this.node.minLength=t;}},{key:"setMinLength",value:function(t){return this.minLength=t,this}},{key:"placeholder",get:function(){return this.node.placeholder},set:function(t){this.node.placeholder=t;}},{key:"setPlaceholder",value:function(t){return this.placeholder=t,this}},{key:"selectText",value:function(t,e){return void 0===t?this.node.select():this.node.setSelectionRange(t,e),this}},{key:"selectAll",value:function(){return this.selectText(),this}},{key:"selectionStart",get:function(){return this.node.selectionStart}},{key:"selectionEnd",get:function(){return this.node.selectionEnd}},{key:"selectedText",get:function(){var t=this.node;return t.value.substring(t.selectionStart,t.selectionEnd)}},{key:"cursorPosition",get:function(){return this.node.selectionStart},set:function(t){this.node.setSelectionRange(t,t);}},{key:"setCursorPosition",value:function(t){return void 0===t?t=this.text.length:t<0&&(t=this.text.length+t),this.cursorPosition=t,this}},{key:"tooltip",get:function(){return this.node.title},set:function(t){this.node.title=t;}},{key:"setTooltip",value:function(t){return this.tooltip=t,this}},{key:"setTextChangedCallback",value:function(t){return this.onTextChanged=t,this}},{key:"readOnly",get:function(){return this.node.readOnly},set:function(t){this.node.readOnly=t;}},{key:"setReadOnly",value:function(t){return void 0===t&&(t=!0),this.readOnly=t,this}},{key:"spellCheck",get:function(){return this.node.spellcheck},set:function(t){this.node.spellcheck=t;}},{key:"setSpellCheck",value:function(t){return this.spellCheck=t,this}},{key:"fontColor",get:function(){return this.node.style.color},set:function(t){this.node.style.color=t;}},{key:"setFontColor",value:function(t){return this.fontColor=t,this}},{key:"setStyle",value:function(t,e){return this.node.style[t]=e,this}},{key:"getStyle",value:function(t){return this.node.style[t]}},{key:"scrollToBottom",value:function(){return this.node.scrollTop=this.node.scrollHeight,this}},{key:"setEnabled",value:function(t){return void 0===t&&(t=!0),this.node.disabled=!t,this}},{key:"setBlur",value:function(){return this.node.blur(),this}},{key:"setFocus",value:function(){return this.node.focus(),this}},{key:"isFocused",get:function(){return this._isFocused}}]),i}(eb),rb={resize:Jm};Object.assign(sb.prototype,rb),T.register("inputText",(function(t){var e=new sb(this.scene,t);return this.scene.add.existing(e),e})),Z(window,"RexPlugins.UI.InputText",sb);var ob=Phaser.Utils.Objects.GetValue,ab=function(t,e){return void 0===t&&(t=0),new Promise((function(i,n){setTimeout((function(){i(e);}),t);}))},hb=function(t){var e=t.game,i=t.fileInput,n=t.closeDelay;return wh(V(e).events,"focus").then((function(){return ab(n)})).then((function(){var t={files:i.files};return Promise.resolve(t)}))},lb=Phaser.Utils.Objects.GetValue,ub=function(t){return this.setOrigin(t.originX,t.originY),this.setPosition(t.x,t.y),this.resize(t.displayWidth,t.displayHeight),this},cb=function(t,e,i,n,s,r){if(null===s||!1===s);else if(lg(s))s();else {var o=function(t,e,i){if(void 0===i)switch(e){case"image":case"svg":i="textures";break;case"animation":i="json";break;case"tilemapTiledJSON":case"tilemapCSV":i="tilemap";break;case"glsl":i="shader";break;default:i=e;}return t=V(t),"textures"===i?t.textures:t.cache[i]}(t,i,s);o.exists(n)&&o.remove(n);}var a=t.load;if(r&&a.once("filecomplete-".concat(i,"-").concat(n),(function(t,e,i){r(i);})),lg(e))e();else {var h=window.URL.createObjectURL(e);a[i](n,h);}a.start();},db={loadFile:function(t,e,i,n,s){var r=this.scene;return cb(r,t,e,i,n,s),this},loadFilePromise:function(t,e,i,n){var s=this.scene;return new Promise((function(r,o){cb(s,t,e,i,n,(function(t){r(t);}));}))}},fb=Phaser.GameObjects.DOMElement,pb=Phaser.Utils.Objects.IsPlainObject,vb=Phaser.Utils.Objects.GetValue,gb=function(t){a(i,t);var e=d(i);function i(t,s,r,o,a,h){var l;n(this,i),pb(s)?(s=vb(h=s,"x",0),r=vb(h,"y",0),o=vb(h,"width",0),a=vb(h,"height",0)):pb(o)&&(o=vb(h=o,"width",0),a=vb(h,"height",0));var c=document.createElement("input");c.type="file",c.style.display="none";var d=document.createElement("label");d.appendChild(c);var f=vb(h,"style",void 0);(l=e.call(this,t,s,r,d,f)).type="rexFileChooser",l.resetFromJSON(h),l.resize(o,a);var p=u(l);return c.onchange=function(){p.emit("change",p);},l.setCloseDelay(vb(h,"closeDelay",200)),c.onclick=function(){hb({game:t,fileInput:c,closeDelay:p.closeDelay}).then((function(){p.emit("select",p);}));},l}return r(i,[{key:"resetFromJSON",value:function(t){return this.setAccept(vb(t,"accept","")),this.setMultiple(vb(t,"multiple",!1)),this}},{key:"setAccept",value:function(t){return void 0===t&&(t=""),this.fileInput.setAttribute("accept",t),this}},{key:"setMultiple",value:function(t){return void 0===t&&(t=!0),t?this.fileInput.setAttribute("multiple",""):this.fileInput.removeAttribute("multiple"),this}},{key:"setCloseDelay",value:function(t){return void 0===t&&(t=200),this.closeDelay=t,this}},{key:"fileInput",get:function(){return this.node.children[0]}},{key:"open",value:function(){return this.fileInput.click(),this}},{key:"files",get:function(){return this.fileInput.files}}]),i}(fb),yb={resize:Jm,syncTo:ub};Object.assign(gb.prototype,yb,db),T.register("fileChooser",(function(t){var e=new gb(this.scene,t);return this.scene.add.existing(e),e})),Z(window,"RexPlugins.UI.FileChooser",gb);var kb={setDropEnable:function(t){return void 0===t&&(t=!0),this.dropEnable=t,this},toggleDropEnable:function(){return this.dropEnable=!this.dropEnable,this}},mb={resize:Jm,syncTo:ub};Object.assign(mb,kb,{addFilter:function(t,e){return this.filters||(this.filters={}),this.filters[t]=e,this},addFilters:function(t){for(var e in this.filters||(this.filters={}),t)this.filters[e]=t[e];return this}},db);var bb={dragenter:"dragenter",dragleave:"dragleave",dragover:"dragover",drop:"drop"},xb=Phaser.GameObjects.DOMElement,Cb=Phaser.Utils.Objects.IsPlainObject,wb=Phaser.Utils.Objects.GetValue,Sb=function(t){a(i,t);var e=d(i);function i(t,s,r,o,a,h){var l;n(this,i),Cb(s)?(s=wb(h=s,"x",0),r=wb(h,"y",0),o=wb(h,"width",0),a=wb(h,"height",0)):Cb(o)&&(o=wb(h=o,"width",0),a=wb(h,"height",0)),void 0===h&&(h={});var c=document.createElement("div"),d=wb(h,"style",void 0);(l=e.call(this,t,s,r,c,d)).type="rexFileDropZone",l.resize(o,a),l._files=[],l.setDropEnable(wb(h,"dropEnable",!0));var f=wb(h,"filters");return f&&l.addFilters(f),tb(u(l),c,bb,{preventDefault:!0,preTest:function(t){return t.dropEnable}}),l.on("drop",(function(t,e){this._files=e.dataTransfer.files;var i=this._files;if(i&&this.filters)for(var n in this.filters){for(var s=this.filters[n],r=[],o=0,a=i.length;o0&&this.emit("drop.".concat(n),r);}}),u(l)),l}return r(i,[{key:"files",get:function(){return this._files}}]),i}(xb);Object.assign(Sb.prototype,mb),T.register("fileDropZone",(function(t){var e=new Sb(this.scene,t);return this.scene.add.existing(e),e})),Z(window,"RexPlugins.UI.FileDropZone",Sb);var Pb=function(t){a(i,t);var e=d(i);function i(t,s){var r;return n(this,i),c(r=e.call(this,t),new Proxy(u(r),u(r)))}return r(i,[{key:"get",value:function(t,e){if(hr(t,e))return t[e];var i=t.parent;return hr(i,e)?i[e]:void 0}},{key:"set",value:function(t,e,i){return hr(t,e)?t[e]=i:hr(t.parent,e)&&(t.parent[e]=i),!0}},{key:"key",get:function(){return this.parent.texture.key},set:function(t){this.parent.setTexture(t,this.frame);}},{key:"frame",get:function(){return this.parent.frame.name},set:function(t){this.parent.setFrame(t);}},{key:"scale",get:function(){return this.parent.scaleX},set:function(t){this.parent.setScale(t);}}]),i}(ro),Tb=Phaser.Utils.Objects.GetValue,Ob=function(t){a(i,t);var e=d(i);function i(t,s){var r;n(this,i),(r=e.call(this,t,s)).style=Tb(s,"style",u(r));var o=Tb(s,"propertiesMap");return r.activeStyle=Mb(s,"active",o),r.hoverStyle=Mb(s,"hover",o),r.disableStyle=Mb(s,"disable",o),r.onModifyStyle=Tb(s,"onModifyStyle"),r}return r(i,[{key:"getStyle",value:function(t){return Il(this.style,t)}},{key:"modifyStyle",value:function(t){for(var e in t)this.style[e]=t[e];return this.onModifyStyle&&this.onModifyStyle(this.parent,t),this}},{key:"applyStyle",value:function(t){if(t){var e=this.getStyle(t);return jl(e,t)?void 0:(this.modifyStyle(t),e)}}},{key:"setActiveState",value:function(t){return Eb.call(this,"active",t),this}},{key:"setHoverState",value:function(t){return Eb.call(this,"hover",t),this}},{key:"setDisableState",value:function(t){return Eb.call(this,"disable",t),this}}]),i}(ro),Mb=function(t,e,i){var n=Dl(t,e);if(i)for(var s in n)i.hasOwnProperty(s)&&(n[i[s]]=n[s],delete n[s]);return n},Eb=function(t,e){void 0===e&&(e=!0);var i="".concat(t,"State"),n="".concat(t,"Style"),s="".concat(t,"StyleSave");this[i]!==e&&(this[i]=e,e?this[s]=this.applyStyle(this[n]):(this.applyStyle(this[s]),this[s]=void 0));},_b={addStyleManager:function(t){return this.styleManager=new Ob(this,t),this},setActiveState:function(t){return this.styleManager.setActiveState(t),this},setHoverState:function(t){return this.styleManager.setHoverState(t),this},setDisableState:function(t){return this.styleManager.setDisableState(t),this}},Rb=Phaser.GameObjects.Image,Lb=Phaser.Utils.Objects.GetValue,Bb=function(t){a(i,t);var e=d(i);function i(t,s){var r;n(this,i),void 0===s&&(s={});var o=Lb(s,"x",0),a=Lb(s,"y",0),h=Lb(s,"key",""),l=Lb(s,"frame",void 0);(r=e.call(this,t,o,a,h,l)).type="rexStatesImage";var c=Lb(s,"effects",!0);return c&&fr(u(r),c),r.style=new Pb(u(r),s),s.style=r.style,r.addStyleManager(s),delete s.style,r}return r(i)}(Rb);Object.assign(Bb.prototype,_b),T.register("statesImage",(function(t){var e=new Bb(this.scene,t);return this.scene.add.existing(e),e})),Z(window,"RexPlugins.UI.StatesImage",Bb);var Db=function(t){a(i,t);var e=d(i);function i(t,s){var r;return n(this,i),void 0===s&&(s={}),(r=e.call(this,t,s)).type="rexStatesRoundRectangleShape",s.style=u(r),s.propertiesMap=Ib,r.addStyleManager(s),delete s.style,delete s.propertiesMap,r}return r(i)}(se),Ib={color:"fillColor",alpha:"fillAlpha",strokeWidth:"lineWidth"};Object.assign(Db.prototype,_b),T.register("statesRoundRectangle",(function(t){var e=new Db(this.scene,t);return this.scene.add.existing(e),e})),Z(window,"RexPlugins.UI.StatesRoundRectangle",Db);var jb=function(t){a(i,t);var e=d(i);function i(t,s){var r;return n(this,i),c(r=e.call(this,t),new Proxy(u(r),u(r)))}return r(i,[{key:"get",value:function(t,e){if(hr(t,e))return t[e];var i=t.parent;return hr(i,e)?i[e]:void 0}},{key:"set",value:function(t,e,i){return hr(t,e)?t[e]=i:hr(t.parent,e)&&(t.parent[e]=i),!0}},{key:"key",get:function(){return this.parent.texture.key},set:function(t){this.parent.setTexture(t,this.frame);}},{key:"frame",get:function(){return this.parent.frame.name},set:function(t){this.parent.setFrame(t);}},{key:"leftWidth",get:function(){return this.parent.leftWidth},set:function(t){var e=this.parent;parent.setSlices(e.width,e.height,t,e.rightWidth,e.topHeight,e.bottomHeight);}},{key:"rightWidth",get:function(){return this.parent.rightWidth},set:function(t){var e=this.parent;parent.setSlices(e.width,e.height,e.leftWidth,t,e.topHeight,e.bottomHeight);}},{key:"topHeight",get:function(){return this.parent.topHeight},set:function(t){var e=this.parent;parent.setSlices(e.width,e.height,e.leftWidth,e.rightWidth,t,e.bottomHeight);}},{key:"bottomHeight",get:function(){return this.parent.bottomHeight},set:function(t){var e=this.parent;parent.setSlices(e.width,e.height,e.leftWidth,e.rightWidth,e.topHeight,t);}}]),i}(ro),zb=Phaser.GameObjects.NineSlice,Ab=Phaser.Utils.Objects.GetValue,Fb=function(t){a(i,t);var e=d(i);function i(t,s){var r;n(this,i),void 0===s&&(s={});var o=Ab(s,"x",0),a=Ab(s,"y",0),h=Ab(s,"key",null),l=Ab(s,"frame",null),c=Ab(s,"width",0),d=Ab(s,"height",0),f=Ab(s,"leftWidth",0),p=Ab(s,"rightWidth",0),v=Ab(s,"topHeight",0),g=Ab(s,"bottomHeight",0);(r=e.call(this,t,o,a,h,l,c,d,f,p,v,g)).type="rexStatesNineSlice";var y=Ab(s,"effects",!0);return y&&fr(u(r),y),r.style=new jb(u(r),s),s.style=r.style,r.addStyleManager(s),delete s.style,r}return r(i)}(zb);Object.assign(Fb.prototype,_b),T.register("statesNineSlice",(function(t){var e=new Fb(this.scene,t);return this.scene.add.existing(e),e})),Z(window,"RexPlugins.UI.StatesNineSlice",Fb);var Wb=Phaser.GameObjects.Text,Yb=Phaser.Utils.Objects.GetValue,Xb=function(t){a(i,t);var e=d(i);function i(t,s){var r;n(this,i),void 0===s&&(s={});var o=Yb(s,"x",0),a=Yb(s,"y",0),h=Yb(s,"text","");return (r=e.call(this,t,o,a,h,s)).type="rexStatesText",s.style=r.style,s.onModifyStyle=function(t,e){var i=e.hasOwnProperty("fontStyle")||e.hasOwnProperty("fontSize")||e.hasOwnProperty("fontFamily");t.style.update(i);},r.addStyleManager(s),delete s.style,r}return r(i)}(Wb);Object.assign(Xb.prototype,_b),T.register("statesText",(function(t){var e=new Xb(this.scene,t);return this.scene.add.existing(e),e})),Z(window,"RexPlugins.UI.StatesText",Xb);var Vb=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 n=!1;void 0===i.animation?i.animation={}:!1===i.animation&&(n=!0,i.animation={});var s=i.animation;n&&(s.duration=0);var r=s.onProgress;s.onProgress=function(e){r&&r(e),t.needRedraw();};var o=s.onComplete;return s.onComplete=function(e){o&&o(e),t.needRedraw();},e},Gb=function(t){a(i,t);var e=d(i);function i(t,s,r,o,a,h){var l;return n(this,i),(l=e.call(this,t,s,r,o,a)).type="rexChart",l.chart=void 0,void 0!==h&&l.setChart(h),l}return r(i,[{key:"destroy",value:function(t){this.scene&&(this.chart&&(this.chart.destroy(),this.chart=void 0),p(h(i.prototype),"destroy",this).call(this,t));}},{key:"resize",value:function(t,e){if(t===this.width&&e===this.height)return this;if(p(h(i.prototype),"resize",this).call(this,t,e),this.chart){var n=this.chart;n.height=this.canvas.height,n.width=this.canvas.width,n.aspectRatio=n.height?n.width/n.height:null,n.update();}return this}}]),i}(Tc),Ub={setChart:function(t){if(!window.Chart){return 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}return this.chart&&this.chart.destroy(),this.chart=new Chart(this.context,Vb(this,t)),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,n=0,s=i.length;n(h=0===this.orientation?Math.abs(a.left-t):Math.abs(a.top-e))&&(s=h,n=r);}var h;a=i[i.length-1];return s>(h=0===this.orientation?Math.abs(a.right-t):Math.abs(a.bottom-e))&&(s=h,n=r+1),n},Jb=Phaser.Utils.Objects.IsPlainObject,Zb=Phaser.Utils.Objects.GetValue,qb=Phaser.Display.Align.CENTER,$b={min:0,full:-1},Qb=function(t,e,n,s,r,o,a,h,l,u){gp.call(this,t);var c=t.isRexSpace,d=i(e);if(null===e)return this;if("number"===d);else if("string"===d)e=$b[e];else if(Jb(e)){var f;e=Zb(f=e,"proportion",void 0),n=Zb(f,"align",qb),s=Zb(f,"padding",0),r=Zb(f,"expand",!1),o=Zb(f,"key",void 0),a=Zb(f,"index",void 0),t.isRexSizer||(h=Zb(f,"minWidth",void 0),l=Zb(f,"minHeight",void 0)),u=Zb(f,"fitRatio",0);}return "string"==typeof n&&(n=Af[n]),void 0===e&&(e=c?1:0),void 0===n&&(n=qb),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===h&&(c?h=0:t.isRexSizer||(h=t._minWidth)),void 0===l&&(c?l=0:t.isRexSizer||(l=t._minHeight)),void 0===u&&(u=0),(f=this.getSizerConfig(t)).proportion=e,f.align=n,f.padding=pp(s),f.expand=r,f.fitRatio=0===e?u: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?Er(t):h:t.minHeight=void 0===l?_r(t):l),r&&(0===this.orientation?t.minHeight=l:t.minWidth=h)),void 0!==o&&this.addChildrenMap(o,t),this},tx={add:Qb,addSpace:function(t){return this.insertSpace(void 0,t),this},insertSpace:function(t,e){return void 0===e&&(e=1),Qb.call(this,new Nb(this.scene),{proportion:e,minWidth:0,minHeight:0,index:t}),this},insert:function(t,e,i,n,s,r,o,a){return Jb(i)&&(i.index=t),Qb.call(this,e,i,n,s,r,o,t,a),this},insertAtPosition:function(t,e,i,n,s,r,o,a,h){var l=Kb.call(this,t,e);return -1===l&&(l=void 0),this.insert(l,i,n,s,r,o,a,h),this}},ex=Phaser.Utils.Array.Remove,ix={remove:function(t,e){return this.getParentSizer(t)!==this||(ex(this.sizerChildren,t),bp.call(this,t,e)),this},removeAll:function(t){for(var e=this.sizerChildren.length-1;e>=0;e--)this.remove(this.sizerChildren[e],t);return this},clear:function(t){return this.sizerChildren.length=0,yk.call(this,t),this}},nx={getChildAlign:function(t){return this.getSizerConfig(t).align},setChildAlign:function(t,e){return "string"==typeof e&&(e=Af[e]),this.getSizerConfig(t).align=e,this}},sx={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,n,s=0,r=this.sizerChildren;if(0===this.orientation)for(var o=this.space.item,a=!0,h=0,l=r.length;h0&&this.proportionLength>0&&(i=n.proportion*this.proportionLength):n.expand&&(i=e-this.space.left-this.space.right-s.left-s.right);return i},getExpandedChildHeight:function(t,e){var i;void 0===e&&(e=this.height);var n=t.rexSizer,s=n.padding;0===this.orientation?n.expand&&(i=e-this.space.top-this.space.bottom-s.top-s.bottom):n.proportion>0&&this.proportionLength>0&&(i=n.proportion*this.proportionLength);return i},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,n=0,s=i.length;n0?(e=t-this.getChildrenWidth(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0;}return t},resolveHeight:function(t){t=Ep.call(this,t);if(void 0===this.proportionLength&&1===this.orientation){var e=t-this.childrenHeight;e>0?(e=t-this.getChildrenHeight(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0;}return t}};Object.assign(sx,tx,ix,nx,{getChildProportion:function(t){return this.getSizerConfig(t).proportion},setChildProportion:function(t,e){return this.getSizerConfig(t).proportion=e,this}},{getChildExpand:function(t){return this.getSizerConfig(t).expand},setChildExpand:function(t,e){return this.getSizerConfig(t).expand=e,this}});var rx=function(){for(var t,e,i=0,n=this.sizerChildren,s=0,r=n.length;s0&&(i+=e);return i},ox={x:0,h:0,horizontal:0,"left-to-right":0,y:1,v:1,vertical:1,"top-to-bottom":1},ax=function(t){return "string"==typeof t&&(t=ox[t]),t},hx=Phaser.Utils.Objects.IsPlainObject,lx=Phaser.Utils.Objects.GetValue,ux=function(t){a(i,t);var e=d(i);function i(t,s,r,o,a,h,l){var u;return n(this,i),hx(s)?(s=lx(l=s,"x",0),r=lx(l,"y",0),o=lx(l,"width",void 0),a=lx(l,"height",void 0),h=lx(l,"orientation",0)):hx(o)?(o=lx(l=o,"width",void 0),a=lx(l,"height",void 0),h=lx(l,"orientation",0)):hx(h)&&(h=lx(l=h,"orientation",0)),void 0===h&&(h=0),(u=e.call(this,t,s,r,o,a,l)).type="rexSizer",u.sizerChildren=[],u.setOrientation(h),u.setItemSpacing(lx(l,"space.item",0)),u.setStartChildIndex(lx(l,"startChildIndex",0)),u.setRTL(lx(l,"rtl",!1)),u.addChildrenMap("items",u.sizerChildren),u}return r(i,[{key:"setOrientation",value:function(t){return this.orientation=ax(t),this}},{key:"setItemSpacing",value:function(t){return this.space.item=t,this}},{key:"setStartChildIndex",value:function(t){return this.startChildIndex=t,this}},{key:"setRTL",value:function(t){return void 0===t&&(t=!0),this.rtl=t,this}},{key:"childrenProportion",get:function(){return void 0===this._childrenProportion&&(this._childrenProportion=rx.call(this)),this._childrenProportion}}]),i}(lk);Object.assign(ux.prototype,sx),T.register("sizer",(function(t,e,i,n,s,r){var o=new ux(this.scene,t,e,i,n,s,r);return this.scene.add.existing(o),o})),Z(window,"RexPlugins.UI.Sizer",ux);var cx=function(){return Array.prototype.reduce.call(arguments,dx,0)},dx=function(t,e){return t+e},fx=Phaser.Utils.Objects.IsPlainObject,px=Phaser.Utils.Objects.GetValue,vx=Phaser.Display.Align.CENTER,gx=function(t,e,i,n,s){if("number"==typeof t||"number"==typeof e)if(void 0===t){for(var r=0;r=0;e--){var i=this.sizerChildren[e];i&&this.remove(i,t);}return this},clear:function(t){return kx(this.sizerChildren,null),yk.call(this,t),this}},bx={setColumnSpace:function(t){if(this.space.column||(this.space.column=[]),this.space.column.length=this.columnCount-1,"number"==typeof t)kx(this.space.column,t);else for(var e=0,i=this.columnCount-1;e=0;n--){var s=n*this.columnCount+t;this.sizerChildren.splice(s,0,null);}return this.columnProportions.push(e),this.columnWidth.length+=1,this.space.column.splice(t,0,i),this},Sx={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);for(var e,i,n,s,r=0,o=this.sizerChildren,a=0;a0){var i=t-this.getChildrenWidth(!1);i>=0&&(this.proportionWidthLength=i/e);}else this.proportionWidthLength=0;}return t},resolveHeight:function(t){t=Ep.call(this,t);if(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,n;for(var s in this.sizerChildren)(e=this.sizerChildren[s])&&e.isRexSizer&&!e.ignoreLayout&&(n=this.getColumnWidth(parseInt(s)%this.columnCount),i=this.getExpandedChildWidth(e,n),i=e.resolveWidth(i),e.resolveChildrenWidth(i));},runWidthWrap:function(t){var e,i,n;for(var s in this.sizerChildren)!(e=this.sizerChildren[s])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(n=this.getColumnWidth(parseInt(s)%this.columnCount),i=this.getExpandedChildWidth(e,n),e.isRexSizer&&(i=e.resolveWidth(i)),e.runWidthWrap(i));return this},resetGrid:function(t,e,i,n,s){if(void 0===i&&(i=0),void 0===n&&(n=0),this.columnCount=t,this.rowCount=e,this.gridCount=t*e,this.removeAll(),this.sizerChildren.length=t*e,kx(this.sizerChildren,null),this.columnProportions=[],this.columnProportions.length=t,"number"==typeof i)kx(this.columnProportions,i);else for(var r=0;r0&&(e+=t);return e},Tx=function(){for(var t,e=0,i=0;i0&&(e+=t);return e},Ox=Phaser.Utils.Objects.IsPlainObject,Mx=Phaser.Utils.Objects.GetValue,Ex=function(t){a(i,t);var e=d(i);function i(t,s,r,o,a,h,l,u,c,d){var f;return n(this,i),Ox(s)?(s=Mx(d=s,"x",0),r=Mx(d,"y",0),o=Mx(d,"width",void 0),a=Mx(d,"height",void 0),h=Mx(d,"column",d.col||0),l=Mx(d,"row",0),u=Mx(d,"columnProportions",0),c=Mx(d,"rowProportions",0)):Ox(o)?(o=Mx(d=o,"width",void 0),a=Mx(d,"height",void 0),h=Mx(d,"column",d.col||0),l=Mx(d,"row",0),u=Mx(d,"columnProportions",0),c=Mx(d,"rowProportions",0)):Ox(h)?(h=Mx(d=h,"column",d.col||0),l=Mx(d,"row",0),u=Mx(d,"columnProportions",0),c=Mx(d,"rowProportions",0)):Ox(u)&&(u=Mx(d=u,"columnProportions",0),c=Mx(d,"rowProportions",0)),(f=e.call(this,t,s,r,o,a,d)).type="rexGridSizer",f.sizerChildren=[],f.addChildrenMap("items",f.sizerChildren),f.setCreateCellContainerCallback(Mx(d,"createCellContainerCallback")),f.setIndentLeft(Mx(d,"space.indentLeftOdd",0),Mx(d,"space.indentLeftEven",0)),f.setIndentTop(Mx(d,"space.indentTopOdd",0),Mx(d,"space.indentTopEven",0)),f.resetGrid(h,l,u,c,Mx(d,"space",void 0)),f}return r(i,[{key:"destroy",value:function(t){this.scene&&!this.ignoreDestroy&&(p(h(i.prototype),"destroy",this).call(this,t),this.columnProportions=void 0,this.rowProportions=void 0,this.columnWidth=void 0,this.rowHeight=void 0,this.createCellContainerCallback=void 0);}},{key:"setColumnProportion",value:function(t,e){return t>=this.columnProportions.length||(this.columnProportions[t]=e),this}},{key:"setRowProportion",value:function(t,e){return t>=this.rowProportions.length||(this.rowProportions[t]=e),this}},{key:"totalColumnProportions",get:function(){return void 0===this._totalColumnProportions&&(this._totalColumnProportions=Px.call(this)),this._totalColumnProportions}},{key:"totalRowProportions",get:function(){return void 0===this._totalRowProportions&&(this._totalRowProportions=Tx.call(this)),this._totalRowProportions}},{key:"getChildAt",value:function(t,e){return this.sizerChildren[e*this.columnCount+t]}},{key:"childToGridIndex",value:function(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)}},{key:"getColumnWidth",value:function(t){var e=this.columnProportions[t];return 0===e?this.columnWidth[t]:e*this.proportionWidthLength}},{key:"getRowHeight",value:function(t){var e=this.rowProportions[t];return 0===e?this.rowHeight[t]:e*this.proportionHeightLength}},{key:"setCreateCellContainerCallback",value:function(t){return this.createCellContainerCallback=t,this}}]),i}(lk);Object.assign(Ex.prototype,Sx),T.register("gridSizer",(function(t,e,i,n,s,r,o,a,h){var l=new Ex(this.scene,t,e,i,n,s,r,o,a,h);return this.scene.add.existing(l),l})),Z(window,"RexPlugins.UI.GridSizer",Ex);var _x=function(t,e,i,n){return e/t<=i?e/(n-1):0},Rx=function(t,e){void 0===e?e={lines:[],width:0,height:0}:(e.lines.length=0,e.width=0,e.height=0);for(var i,n,s,r,o=this.sizerChildren,a=this.space.item,h=this.space.line,l=this.space.indentLeftOdd,u=this.space.indentLeftEven,c=this.space.indentTopOdd,d=this.space.indentTopEven,f=0,p=e.lines,v=void 0,g=0,y=o.length;ga.height/2)){s>(h=Dx(a.left,a.centerY,t,e))&&(s=h,n=r);var h,l=i[r+1];if(!l||l.y!==a.y)s>(h=Dx(a.right,a.centerY,t,e))&&(s=h,n=r+1);}}return n},jx=Phaser.Utils.Objects.IsPlainObject,zx=Phaser.Utils.Objects.GetValue,Ax=Phaser.Display.Align.CENTER,Fx=function(t,e,i,n){if("\n"===t)return this.addNewLine(),this;var s;(gp.call(this,t),jx(e))&&(e=zx(s=e,"padding",0),i=zx(s,"key",void 0),n=zx(s,"index",void 0));return void 0===e&&(e=0),(s=this.getSizerConfig(t)).align=Ax,s.padding=pp(e),void 0===n||n>=this.sizerChildren.length?this.sizerChildren.push(t):this.sizerChildren.splice(n,0,t),void 0!==i&&this.addChildrenMap(i,t),this},Wx={add:function(t,e,i){if(dg(t))for(var n=t,s=0,r=n.length;s=0;e--)this.remove(this.sizerChildren[e],t);return this},clear:function(t){return this.sizerChildren.length=0,yk.call(this,t),this}},Vx={getChildrenWidth:function(){return this.rexSizer.hidden?0:this.maxChildWidth+this.space.left+this.space.right},getChildrenHeight:function(){return this.rexSizer.hidden?0:this.widthWrapResult.height+this.space.top+this.space.bottom},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,n=0,s=i.length;n=0;i--)DC.call(this,e[i],t);return this}},jC=function(t,e,i){if(t){var n=this.setValueCallback,s=this.setValueCallbackScope;n&&(s?n.call(s,t,e,i):n(t,e,i)),this.fireEvent("button.statechange",t,e,i);}},zC=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 n=t._selected;t._selected=i,jC.call(e,t,i,n);}},enumerable:!0,configurable:!0}),t.selected=!1;},AC={add:function(t){return this.buttons.push(t),t._click||(t._click=new ac(t,this.clickConfig),t._click.on("click",(function(t,e,i,n){this.fireEvent("button.click",e,i,n);}),this).on("enable",(function(t,e){this.fireEvent("button.enable",e);}),this).on("disable",(function(t,e){this.fireEvent("button.disable",e);}),this),t.on("pointerover",(function(e,i,n,s){this.fireEvent("button.over",t,e,s);}),this).on("pointerout",(function(e,i){this.fireEvent("button.out",t,e,i);}),this).on("pointerdown",(function(e,i,n,s){this.fireEvent("button.down",t,e,s);}),this).on("pointerup",(function(e,i){this.fireEvent("button.up",t,e,i);}),this)),this.buttonsType&&(void 0===t.name&&console.error("".concat(this.parent.constructor.name,": Option button miss value")),zC.call(this,t)),this},addMultiple:function(t){for(var e=0,i=t.length;e2?o-2:0),h=2;h=0;i--)tw.call(this,e[i],t);return this}},iw=Phaser.Utils.Objects.GetValue,nw=function(t){a(i,t);var e=d(i);function i(t,s){var r;n(this,i),void 0===s&&(s={});var o=iw(s,"row",0),a=iw(s,"column",s.col||0),h=iw(s,"createCellContainerCallback"),l=iw(s,"buttons",void 0),c=iw(s,"expand",!0),d=c?1:0;if(h&&(s.createCellContainerCallback=void 0),void 0!==l){o=Math.max(o,l.length);for(var f=0,p=l.length;fs&&sw.addNewLine(this);}else for(r=0,o=t.length;r=0;i--)lw.call(this,e[i],t);return this}},cw=Phaser.Utils.Objects.GetValue,dw=function(t){a(i,t);var e=d(i);function i(t,s){var r;n(this,i),void 0===s&&(s={});var o=s.space;"number"==typeof o&&(s.space={item:o,line:o}),(r=e.call(this,t,s)).type="rexFixWidthButtons",r.buttonGroup=new UC({parent:u(r),eventEmitter:cw(s,"eventEmitter",u(r)),groupName:cw(s,"groupName",void 0),clickConfig:cw(s,"click",void 0)}).setButtonsType(s);var a=cw(s,"background",void 0),h=cw(s,"buttons",void 0);return r.buttonsAlign=cw(s,"align",void 0),a&&r.addBackground(a),h&&r.addButtons(h),r.addChildrenMap("background",a),r.addChildrenMap("buttons",r.buttonGroup.buttons),r}return r(i,[{key:"destroy",value:function(t){this.scene&&!this.ignoreDestroy&&(p(h(i.prototype),"destroy",this).call(this,t),this.buttonGroup.destroy(),this.buttonGroup=void 0);}},{key:"buttons",get:function(){return this.buttonGroup.buttons}},{key:"groupName",get:function(){return this.buttonGroup.groupName},set:function(t){this.buttonGroup.groupName=t;}},{key:"eventEmitter",get:function(){return this.buttonGroup.eventEmitter}}]),i}(Kx);Object.assign(dw.prototype,ow,uw,GC,NC),T.register("fixWidthButtons",(function(t){var e=new dw(this.scene,t);return this.scene.add.existing(e),e})),Z(window,"RexPlugins.UI.FixWidthButtons",dw);var fw=Phaser.Utils.Objects.GetValue,pw=function(t){a(i,t);var e=d(i);function i(t,s){var r;n(this,i),(r=e.call(this,t,s)).type="rexFileSelectorButton";var o=new gb(t);return t.add.existing(o),r.addBackground(o),r.addChildrenMap("fileChooser",o),r.setAccept(fw(s,"accept","")),r.setMultiple(fw(s,"multiple",!1)),o.on("change",(function(t){var e=t.files;0!==e.length&&(e=Array.from(e),this.emit("select",e,this));}),u(r)),r}return r(i,[{key:"files",get:function(){return this.childrenMap.fileChooser.files}}]),i}(eC);Object.assign(pw.prototype,{setAccept:function(t){return this.childrenMap.fileChooser.setAccept(t),this},setMultiple:function(t){return this.childrenMap.fileChooser.setMultiple(t),this},loadFile:function(t,e,i,n,s){return this.childrenMap.fileChooser.loadFile(t,e,i,n,s),this},loadFilePromise:function(t,e,i,n){return this.childrenMap.fileChooser.loadFilePromise(t,e,i,n)}}),T.register("fileSelectorButton",(function(t){var e=new pw(this.scene,t);return this.scene.add.existing(e),e})),Z(window,"RexPlugins.UI.FileSelectorButton",pw);var vw={getChoice:function(t){var e=this.childrenMap.choicesSizer;return e?e.getButton(t):void 0},getAction:function(t){return this.childrenMap.actionsSizer.getButton(t)},getToolbar:function(t){return this.childrenMap.toolbarSizer.getButton(t)},getLeftToolbar:function(t){return this.childrenMap.leftToolbarSizer.getButton(t)},setChoiceEnable:function(t,e){var i=this.childrenMap.choicesSizer;return i&&i.setButtonEnable(t,e),this},setActionEnable:function(t,e){return this.childrenMap.actionsSizer.setButtonEnable(t,e),this},setToolbarEnable:function(t,e){return this.childrenMap.toolbarSizer.setButtonEnable(t,e),this},setLeftToolbarEnable:function(t,e){return this.childrenMap.leftToolbarSizer.setButtonEnable(t,e),this},toggleChoiceEnable:function(t){var e=this.childrenMap.choicesSizer;return e&&e.toggleButtonEnable(t),this},toggleActionEnable:function(t){return this.childrenMap.actionsSizer.toggleButtonEnable(t),this},toggleToolbarEnable:function(t){return this.childrenMap.toolbarSizer.toggleButtonEnable(t),this},toggleLeftToolbarEnable:function(t){return this.childrenMap.leftToolbarSizer.toggleButtonEnable(t),this},getChoiceEnable:function(t){var e=this.childrenMap.choicesSizer;return !!e&&e.getButtonEnable(t)},getActionEnable:function(t){return this.childrenMap.actionsSizer.getButtonEnable(t)},getToolbarEnable:function(t){return this.childrenMap.toolbarSizer.getButtonEnable(t)},getLeftToolbarEnable:function(t){return this.childrenMap.leftToolbarSizer.getButtonEnable(t)},emitChoiceClick:function(t){var e=this.childrenMap.choicesSizer;return e&&e.emitButtonClick(t),this},emitActionClick:function(t){return this.childrenMap.actionsSizer.emitButtonClick(t),this},emitToolbarClick:function(t){return this.childrenMap.toolbarSizer.emitButtonClick(t),this},emitLeftToolbarClick:function(t){return this.childrenMap.leftToolbarSizer.emitButtonClick(t),this},showChoice:function(t){var e=this.childrenMap.choicesSizer;return e&&e.showButton(t),this},showAction:function(t){return this.childrenMap.actionsSizer.showButton(t),this},showToolbar:function(t){return this.childrenMap.toolbarSizer.showButton(t),this},showLeftToolbar:function(t){return this.childrenMap.leftToolbarSizer.showButton(t),this},hideChoice:function(t){var e=this.childrenMap.choicesSizer;return e&&e.hideButton(t),this},hideAction:function(t){return this.childrenMap.actionsSizer.hideButton(t),this},hideToolbar:function(t){return this.childrenMap.toolbarSizer.hideButton(t),this},hideLeftToolbar:function(t){return this.childrenMap.leftToolbarSizer.hideButton(t),this},addChoice:function(t){var e=this.childrenMap.choicesSizer;return e&&e.addButton(t),this},addAction:function(t){return this.childrenMap.actionsSizer.addButton(t),this},addToolbar:function(t){return this.childrenMap.toolbarSizer.addButton(t),this},addLeftToolbar:function(t){return this.childrenMap.leftToolbarSizer.addButton(t),this},removeChoice:function(t,e){var i=this.childrenMap.choicesSizer;return i&&i.removeButton(t,e),this},removeAction:function(t,e){return this.childrenMap.actionsSizer.removeButton(t,e),this},removeToolbar:function(t,e){return this.childrenMap.toolbarSizer.removeButton(t,e),this},removeLeftToolbar:function(t,e){return this.childrenMap.leftToolbarSizer.removeButton(t,e),this},clearChoices:function(t){var e=this.childrenMap.choicesSizer;return e&&e.clearButtons(t),this},clearActions:function(t){return this.childrenMap.actionsSizer.clearButtons(t),this},clearToolbar:function(t){return this.childrenMap.toolbarSizer.clearButtons(t),this},clearLeftToolbar:function(t){return this.childrenMap.leftToolbarSizer.clearButtons(t),this},forEachChoice:function(t,e){var i=this.childrenMap.choicesSizer;return i&&i.forEachButtton(t,e),this},forEachAction:function(t,e){return this.childrenMap.actionsSizer.forEachButtton(t,e),this},forEachToolbar:function(t,e){return this.childrenMap.toolbarSizer.forEachButtton(t,e),this},forEachLeftToolbar:function(t,e){return this.childrenMap.leftToolbarSizer.forEachButtton(t,e),this},setAllButtonsEnable:function(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:function(){var t=this.childrenMap.choicesSizer;return t?t.getAllButtonsState():{}},getChoicesButtonState:function(t){var e=this.childrenMap.choicesSizer;return void 0===t?e?e.getAllButtonsState():{}:!!e&&e.getButtonState(t)},setChoicesButtonState:function(t,e){var i=this.childrenMap.choicesSizer;return i&&i.setButtonState(t,e),this},clearChoicesButtonStates:function(){var t=this.childrenMap.choicesSizer;return t&&t.clearAllButtonsState(),this},getChoicesSelectedButtonName:function(){var t=this.childrenMap.choicesSizer;return t?t.getSelectedButtonName():""},setChoicesSelectedButtonName:function(t){var e=this.childrenMap.choicesSizer;return e&&e.setSelectedButtonName(t),this}},gw={onCreateModalBehavior:function(t){t.on("button.click",(function(e,i,n,s,r){if("actions"===i){var o={index:n,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:function(t,e){return t&&!1===t.defaultBehavior?this.onCreateModalBehavior=!1:delete this.onCreateModalBehavior,ug.modal.call(this,t,e),this}},yw={};Object.assign(yw,vw,gw);var kw=Phaser.Utils.Objects.GetValue,mw=function(t){a(i,t);var e=d(i);function i(t,s){var r;n(this,i),void 0===s&&(s={}),s.orientation=1,(r=e.call(this,t,s)).type="rexDialog",r.eventEmitter=kw(s,"eventEmitter",u(r));var o,a,h,l,c=kw(s,"background",void 0),d=kw(s,"title",void 0),f=kw(s,"toolbar",void 0),p=kw(s,"toolbarBackground",void 0),v=kw(s,"leftToolbar",void 0),g=kw(s,"leftToolbarBackground",void 0),y=kw(s,"content",void 0),k=kw(s,"description",void 0),m=kw(s,"choices",void 0),b=kw(s,"choicesBackground",void 0),x=kw(s,"actions",void 0),C=kw(s,"actionsBackground",void 0),w=kw(s,"click",void 0);if(c&&r.addBackground(c),f&&(h=new JC(t,{groupName:"toolbar",background:p,buttons:f,orientation:0,space:{item:kw(s,"space.toolbarItem",0)},click:w,eventEmitter:r.eventEmitter})),v&&(l=new JC(t,{groupName:"leftToolbar",background:g,buttons:v,orientation:0,space:{item:kw(s,"space.leftToolbarItem",0)},click:w,eventEmitter:r.eventEmitter})),d||f||v){var S,P=!!d&&kw(s,"expand.title",!0),T=kw(s,"align.title","center"),O=!(d&&!P&&"center"===T||!d&&(f||v));S=O?new ux(t,{orientation:0}):new wk(t);var M=!!O||{height:!0};if(l&&S.add(l,{align:"left",expand:M}),d){O&&!P&&"right"===T&&S.addSpace();var E={left:kw(s,"space.titleLeft",0),right:kw(s,"space.titleRight",0)},_=P?1:0;S.add(d,{align:T,proportion:_,expand:M,padding:E}),O&&!P&&"left"===T&&S.addSpace();}h&&(O&&!d&&S.addSpace(),S.add(h,{align:"right",expand:M})),(y||k||m||x)&&(E={bottom:kw(s,"space.title",0),top:kw(s,"space.titleTop",0)});_=kw(s,"proportion.title",0);r.add(S,{padding:E,proportion:_,expand:!0});}if(y){var R=kw(s,"align.content","center"),L=kw(s,"space.content",0),B=(E={left:kw(s,"space.contentLeft",0),right:kw(s,"space.contentRight",0),bottom:k||m||x?L:0},_=kw(s,"proportion.content",0),kw(s,"expand.content",!0));r.add(y,{align:R,padding:E,proportion:_,expand:B});}if(k){R=kw(s,"align.description","center");var D=kw(s,"space.description",0);E={left:kw(s,"space.descriptionLeft",0),right:kw(s,"space.descriptionRight",0),bottom:m||x?D:0},_=kw(s,"proportion.description",0),B=kw(s,"expand.description",!0);r.add(k,{align:R,padding:E,proportion:_,expand:B});}if(m){var I=kw(s,"choicesType","").split("-"),j=bw(I,"wrap")?dw:bw(I,"grid")?nw:JC,z=bw(I,"radio")?"radio":bw(I,"checkboxes")?"checkboxes":void 0,A={left:kw(s,"space.choicesBackgroundLeft",0),right:kw(s,"space.choicesBackgroundRight",0),top:kw(s,"space.choicesBackgroundTop",0),bottom:kw(s,"space.choicesBackgroundBottom",0)},F=kw(s,"space.choice",0);j===JC?A.item=F:j===dw?(A.item=F,A.line=kw(s,"space.choiceLine",F)):(A.column=kw(s,"space.choiceColumn",F),A.row=kw(s,"space.choiceRow",F));var W={width:kw(s,"choicesWidth",void 0),height:kw(s,"choicesHeight",void 0),groupName:"choices",buttonsType:z,background:b,buttons:m,space:A,click:w,eventEmitter:r.eventEmitter,setValueCallback:kw(s,"choicesSetValueCallback",void 0),setValueCallbackScope:kw(s,"choicesSetValueCallbackScope",void 0)};j===JC&&(W.orientation=bw(I,"x")?0:1),o=new j(t,W);var Y=kw(s,"space.choices",0);E={left:kw(s,"space.choicesLeft",0),right:kw(s,"space.choicesRight",0),bottom:x?Y:0},R=kw(s,"align.choices","center"),_=kw(s,"proportion.choices",0),B=kw(s,"expand.choices",!0);r.add(o,{align:R,padding:E,proportion:_,expand:B}),r.buttonsType=z;}if(x){a=new JC(t,{groupName:"actions",background:C,buttons:x,orientation:0,space:{item:kw(s,"space.action",0)},expand:kw(s,"expand.actions",!1),align:kw(s,"align.actions","center"),click:w,eventEmitter:r.eventEmitter});E={left:kw(s,"space.actionsLeft",0),right:kw(s,"space.actionsRight",0),bottom:kw(s,"space.actionsBottom",0)},_=kw(s,"proportion.action",0);r.add(a,{align:"center",padding:E,proportion:_,expand:!0});}return Cw(u(r),"click"),Cw(u(r),"over"),Cw(u(r),"out"),Cw(u(r),"enable"),Cw(u(r),"disable"),r.addChildrenMap("background",c),r.addChildrenMap("title",d),r.addChildrenMap("toolbar",f),r.addChildrenMap("leftToolbar",v),r.addChildrenMap("content",y),r.addChildrenMap("description",k),r.addChildrenMap("choices",o?o.buttons:void 0),r.addChildrenMap("actions",a?a.buttons:void 0),r.addChildrenMap("choicesSizer",o),r.addChildrenMap("actionsSizer",a),r.addChildrenMap("toolbarSizer",h),r.addChildrenMap("leftToolbarSizer",l),r}return r(i)}(ux),bw=function(t,e){return -1!==t.indexOf(e)},xw={actions:"action",choices:"choice",toolbar:"toolbar",leftToolbar:"leftToolbar"},Cw=function(t,e){t.on("button.".concat(e),(function(i,n,s,r,o){xw.hasOwnProperty(n)&&t.emit("".concat(xw[n],".").concat(e),i,s,r,o);}));};Object.assign(mw.prototype,yw),T.register("dialog",(function(t){var e=new mw(this.scene,t);return this.scene.add.existing(e),e})),Z(window,"RexPlugins.UI.Dialog",mw);var ww=function(t,e,i){var n=new pC(t,e,i);return t.add.existing(n),n},Sw=function(t){this.childrenMap.title.resetDisplayContent(t.title);},Pw=function(t){var e=this.childrenMap.content;if(e.resetDisplayContent)e.resetDisplayContent(t.content);else {var i=t.content||"";e.setText(i);}},Tw=function(t){var e=this.childrenMap.actions;if(e){var i=t.buttons;if(i){for(var n=this.scene,s=this.defaultActionConfig,r=this.defaultActionButtonCreator,o=0,a=i.length;o=t.dragThreshold?"DRAG":"DRAGBEGIN":"IDLE"}},{key:"update_DRAGBEGIN",value:function(t,e){this.next();}},{key:"next_DRAG",value:function(){var t,e=this.parent;return e.dragState.isUp&&(t=e.outOfBounds?"BACK":e.slidingEnable?"SLIDE":"IDLE"),t}},{key:"update_DRAG",value:function(t,e){var i=this.parent;i.dragState.justMoved&&i.dragging(),this.next();}},{key:"enter_DRAG",value:function(){this.parent.onDragStart();}},{key:"exit_DRAG",value:function(){this.parent.onDragEnd();}},{key:"next_SLIDE",value:function(){var t,e=this.parent;return e.dragState.isDown?t="DRAG":e.isSliding||(t="IDLE"),t}},{key:"enter_SLIDE",value:function(){this.parent.onSliding();}},{key:"exit_SLIDE",value:function(){this.parent.stop();}},{key:"update_SLIDE",value:function(t,e){this.parent.sliding(t,e),this.next();}},{key:"next_BACK",value:function(){var t,e=this.parent;return e.dragState.isDown?t="DRAG":e.isPullBack||(t="IDLE"),t}},{key:"enter_BACK",value:function(){this.parent.onPullBack();}},{key:"exit_BACK",value:function(){this.parent.stop();}},{key:"update_BACK",value:function(t,e){this.parent.pullBack(t,e),this.next();}}]),i}(jv),vS=Phaser.Utils.Objects.GetValue,gS=Phaser.Math.Distance.Between,yS=function(t){a(i,t);var e=d(i);function i(t,s){var r;return n(this,i),(r=e.call(this,t,s))._enable=void 0,t.setInteractive(vS(s,"inputConfig",void 0)),r.resetFromJSON(s),r.boot(),r}return r(i,[{key:"resetFromJSON",value:function(t){return this.pointer=void 0,this.isInTouched=!1,this.holdStartTime=void 0,this.x=void 0,this.y=void 0,this.preX=void 0,this.preY=void 0,this.localX=void 0,this.localY=void 0,this.justMoved=!1,this.setEnable(vS(t,"enable",!0)),this.holdThreshold=vS(t,"holdThreshold",50),this.pointerOutReleaseEnable=vS(t,"pointerOutRelease",!0),this}},{key:"boot",value:function(){this.parent.on("pointerdown",this.onPointIn,this),this.parent.on("pointerup",this.onPointOut,this),this.pointerOutReleaseEnable&&this.parent.on("pointerout",this.onPointOut,this),this.parent.on("pointermove",this.onPointerMove,this),this.scene.sys.events.on("preupdate",this.preupdate,this);}},{key:"shutdown",value:function(t){this.isShutdown||(this.scene.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,p(h(i.prototype),"shutdown",this).call(this,t));}},{key:"enable",get:function(){return this._enable},set:function(t){this._enable!==t&&(t||(this.isInTouched=!1,this.pointer=void 0),this._enable=t);}},{key:"setEnable",value:function(t){return void 0===t&&(t=!0),this.enable=t,this}},{key:"toggleEnable",value:function(){return this.setEnable(!this.enable),this}},{key:"setPointerOutReleaseEnable",value:function(t){return void 0===t&&(t=!0),this.pointerOutReleaseEnable=t,this}},{key:"isDown",get:function(){return this.pointer&&this.pointer.isDown}},{key:"isUp",get:function(){return !this.isDown}},{key:"dx",get:function(){return this.x-this.preX}},{key:"dy",get:function(){return this.y-this.preY}},{key:"dt",get:function(){return eu(this.scene)}},{key:"speed",get:function(){return this.x===this.preX&&this.y===this.preY?0:gS(this.preX,this.preY,this.x,this.y)/(.001*this.dt)}},{key:"speedX",get:function(){return this.dx/(.001*this.dt)}},{key:"speedY",get:function(){return this.dy/(.001*this.dt)}},{key:"onPointIn",value:function(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.pointer=t,this.localX=e,this.localY=i);}},{key:"onPointOut",value:function(t){this.enable&&this.pointer===t&&(this.pointer=void 0);}},{key:"onPointerMove",value:function(t,e,i){this.enable&&t.isDown&&this.pointer===t&&(this.localX=e,this.localY=i);}},{key:"preupdate",value:function(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));}}}]),i}(ro),kS=Phaser.Utils.Objects.GetValue,mS=function(){function t(e){n(this,t),this.resetFromJSON(e);}return r(t,[{key:"resetFromJSON",value:function(t){return this.setValue(kS(t,"value",0)),this.setSpeed(kS(t,"speed",0)),this.setAcceleration(kS(t,"acceleration",0)),this}},{key:"reset",value:function(){this.setValue(0),this.setSpeed(0),this.setAcceleration(0);}},{key:"setValue",value:function(t){return this.value=t,this}},{key:"setSpeed",value:function(t){return this.speed=t,this}},{key:"setAcceleration",value:function(t){return this.acceleration=t,this}},{key:"updateSpeed",value:function(t){return 0!==this.acceleration&&(this.speed+=this.acceleration*t,this.speed<0&&(this.speed=0)),this}},{key:"getDeltaValue",value:function(t){return this.updateSpeed(t),this.speed<=0?0:this.speed*t}},{key:"update",value:function(t){return this.updateSpeed(t),this.speed>0&&(this.value+=this.getDeltaValue(t)),this}},{key:"isMoving",get:function(){return this.speed>0}}]),t}(),bS=function(){function t(){n(this,t),this.value,this.dir,this.movement=new mS;}return r(t,[{key:"init",value:function(t,e,i,n,s){return this.value=t,this.end=s,this.dir=void 0!==s?tthis.end&&(this.value=this.end):this.valuethis.maxValue}},{key:"overMin",value:function(t){return null!=this.minValue&&t0,Math.abs(e),i);}},{key:"sliding",value:function(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;}},{key:"onPullBack",value:function(){var t=this.value,e=this.outOfMinBound?this.minValue:this.maxValue,i=Math.abs(e-t),n=this.backDeceleration,s=Math.sqrt(2*n*i);this._slowDown.init(t,void 0,s,n,e);}},{key:"pullBack",value:function(t,e){e*=.001,this.value=this._slowDown.update(e).value,this._slowDown.isMoving||this._state.next();}},{key:"stop",value:function(){this._slowDown.stop();}}]),i}(ro),SS={y:0,v:0,vertical:0,x:1,h:1,horizontal:1},PS=Phaser.Utils.Objects.GetValue,TS=function(t){a(i,t);var e=d(i);function i(t,s){var r;(n(this,i),(r=e.call(this,t,s)).parent!==r.scene?r.focusMode=PS(s,"focus",!1):r.focusMode=!1,r.setSpeed(PS(s,"speed",.1)),r.setEnable(PS(s,"enable",!0)),r.focusMode)?(t=r.parent).setInteractive(PS(s,"inputConfig",void 0)).on("wheel",(function(t,e,i,n,s){this.enable&&this.scroll(i);}),u(r)):r.scene.input.on("wheel",r.onSceneScroll,u(r));return r}return r(i,[{key:"destroy",value:function(){this.focusMode||this.scene.input.off("wheel",this.onSceneScroll,this);}},{key:"onSceneScroll",value:function(t,e,i,n,s,r){this.enable&&this.scroll(n);}},{key:"setEnable",value:function(t){return void 0===t&&(t=!0),this.enable=t,this}},{key:"setSpeed",value:function(t){return this.speed=t,this}},{key:"scroll",value:function(t){t*=this.speed,this.emit("scroll",t,this.parent,this);}}]),i}(ro),OS=Phaser.Utils.Objects.GetValue,MS=function(t,e,i,n){var s,r,o,a,h="Y"===(i=i.toUpperCase()),l=2===t.scrollMode,u=t.childrenMap.child,c="slider".concat(i);if(s=l||n.hasOwnProperty(c)?OS(n,c,void 0):OS(n,"slider",void 0)){var d,f,p;!0===s&&(s={}),s.orientation=h?1:0,r=function(t,e){void 0===e&&(e={});var i=qe(e);(e={slider:i}).orientation=i.orientation,delete i.orientation,e.background=i.background,delete i.background,e.buttons=i.buttons,delete i.buttons;var n=new fS(t,e);t.add.existing(n);var s=n.childrenMap.slider;return n.addChildrenMap("track",s.childrenMap.track),n.addChildrenMap("indicator",s.childrenMap.indicator),n.addChildrenMap("thumb",s.childrenMap.thumb),n}(t.scene,s);var v=OS(s,"position",0);"string"==typeof v&&(v=ES[v]);var g=OS(n,"space.slider".concat(i),void 0);void 0===g&&void 0===(g=OS(n,"space.slider",void 0))&&(g=l?0:OS(n,"space.child",0));var y="number"==typeof g;h?0===v?(d=2,f=1,p=y?{left:g}:g):(d=0,f=1,p=y?{right:g}:g):0===v?(d=1,f=2,p=y?{top:g}:g):(d=1,f=0,p=y?{bottom:g}:g),e.add(r,{column:d,row:f,align:"center",padding:p,expand:!0}),t["hideUnscrollableSlider".concat(i)]=OS(s,"hideUnscrollableSlider",!1),t["adaptThumb".concat(i,"SizeMode")]=OS(s,"adaptThumbSize",!1),t["minThumb".concat(i,"Size")]=OS(s,"minThumbSize",void 0);}else t["hideUnscrollableSlider".concat(i)]=!1,t["adaptThumb".concat(i,"SizeMode")]=!1,t["minThumb".concat(i,"Size")]=void 0;var k="scroller".concat(i);(o=l||n.hasOwnProperty(k)?OS(n,k,!0):OS(n,"scroller",!0))&&u&&(!0===o&&(o={}),o.orientation=h?0:1,a=new wS(u,o));var m,b,x,C,w=OS(n,l?"mouseWheelScroller".concat(i):"mouseWheelScroller",!1);(w&&u&&(m=new TS(u,w)),t.addChildrenMap("slider".concat(i),r),t.addChildrenMap("scroller".concat(i),a),t.addChildrenMap("mouseWheelScroller".concat(i),m),l&&!h||(t.hideUnscrollableSlider=t["hideUnscrollableSlider".concat(i)],t.adaptThumbSizeMode=t["adaptThumb".concat(i,"SizeMode")],t.minThumbSize=t["minThumb".concat(i,"Size")],t.addChildrenMap("slider",r),t.addChildrenMap("scroller",a),t.addChildrenMap("mouseWheelScroller",m)),r)&&(l?(b=h?"t":"s",C="scroll".concat(i)):(b="t",C="scroll"),r.on("valuechange",(function(e){t[b]=e,t.emit(C,t);})));a&&(l?(x="childO".concat(i),C="scroll".concat(i)):(x="childOY",C="scroll"),a.on("valuechange",(function(e){t[x]=e,t.emit(C,t);})));if(m){var S="addChildO".concat(i);m.on("scroll",(function(e){t[S](-e,!0);}));}},ES={right:0,left:1,bottom:0,top:1},_S=Phaser.Utils.Objects.GetValue,RS=function(t,e){var i=t.scene,n=[0,1,0],s=[0,1,0],r=_S(e,"width"),o=_S(e,"height");r||(n[1]=0),o||(s[1]=0);var a=new Ex(i,{column:3,row:3,columnProportions:n,rowProportions:s});switch(function(t,e,i){var n=Aw(i,"child"),s=Aw(n,"gameObject",void 0);if(s){var r=Aw(i,"space.child",0);t.childMargin={};var o=t.childMargin,a={};if("number"==typeof r)switch(t.scrollMode){case 0:case 1:o.top=0,o.bottom=0,o.left=0,o.right=0;break;default:o.top=r,o.bottom=r,o.left=r,o.right=r;}else switch(t.scrollMode){case 0:o.top=Aw(r,"top",0),o.bottom=Aw(r,"bottom",0),a.left=Aw(r,"left",0),a.right=Aw(r,"right",0);break;case 1:o.top=Aw(r,"left",0),o.bottom=Aw(r,"right",0),a.top=Aw(r,"top",0),a.bottom=Aw(r,"bottom",0);break;default:o.top=Aw(r,"top",0),o.bottom=Aw(r,"bottom",0),o.left=Aw(r,"left",0),o.right=Aw(r,"right",0);}e.add(s,{column:1,row:1,align:Aw(n,"align","center"),padding:a,expand:{width:Aw(n,"expandWidth",!0),height:Aw(n,"expandHeight",!0)}});}t.addChildrenMap("child",s);}(t,a,e),t.scrollMode){case 0:MS(t,a,"y",e);break;case 1:MS(t,a,"x",e);break;default:MS(t,a,"y",e),MS(t,a,"x",e);}return a},LS=function(t){var e,i,n,s;switch(this.scrollMode){case 0:case 1:e=this.topChildOY,i=this.bottomChildOY,n=this.childrenMap.scroller,s=this.childrenMap.slider;break;default:"Y"===(t=t.toUpperCase())?(e=this.topChildOY,i=this.bottomChildOY):(e=this.leftChildOX,i=this.rightChildOX),n=this.childrenMap["scroller".concat(t)],s=this.childrenMap["slider".concat(t)];}n&&n.setBounds(e,i),s&&s.setEnable(e!==i);},BS=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".concat(t)],i=this["hideUnscrollableSlider".concat(t)],n=this["isOverflow".concat(t)];e&&i&&this.setChildVisible(e,n);}},DS=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,n=a.childrenMap.thumb,s=this.minThumbSize;if(0===this.scrollMode){var r=i.displayHeight*e;void 0!==s&&r0?t.setText(e).getTextBounds().wrappedText.split("\n"):e.split("\n");}return i},XS=function(t){return (t-this.textLineSpacing)/(this.textLineHeight+this.textLineSpacing)},VS=function(t){return t*(this.textLineHeight+this.textLineSpacing)-this.textLineSpacing},GS=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 n=this.lines.getLineStartIndex(t),s=this.lines.getLineEndIndex(i-1);e=this.lines.getSliceTagText(n,s,!0);}return e},US=function(t,e){switch(WS(t)){case 0:var i=(s=t.style).wordWrapWidth,n=s.wordWrapCallback;s.wordWrapWidth=0,s.wordWrapCallback=void 0,t.setText(e),s.wordWrapWidth=i,s.wordWrapCallback=n;break;case 1:var s,r=(s=t.style).wrapMode;s.wrapMode=0,t.setText(e),s.wrapMode=r;break;case 2:var o=t._maxWidth;t._maxWidth=0,t.setText(e),t._maxWidth=o;}},HS=function(){var t=this.textObject.rexSizer;this.textObject.y+=t.offsetY-t.preOffsetY,t.preOffsetY=t.offsetY,this.resetChildPositionState(this.textObject),this.textCropEnable&&NS.call(this);},NS=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);}},KS=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 n=t.style,s=Math.max(e,0);0===this.textObjectType?n.wordWrapWidth=s:(0===n.wrapMode&&(n.wrapMode=1),n.wrapWidth=s);break;case 2:t.setMaxWidth(e);}this.setText();}},JS={setText:function(t){return void 0!==t&&(this.text=t),this.lines=YS(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(XS.call(this,-this.textOY)),0),e=VS.call(this,t)+this.textOY,i=GS.call(this,t);return US(this.textObject,i),this.textObject.rexSizer.offsetY=e,HS.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,Rp.call(this),this},layoutChildren:function(){var t,e,i,n,s,r,o,a=this.left,h=this.top;(t=this.textObject).rexSizer.hidden||(n=a+(i=(e=t.rexSizer).padding).left,s=h+i.top,r=this.width-i.left-i.right,o=this.height-i.top-i.bottom,KS.call(this,t,r,o),hp(t,n,s,r,o,e.align),e.preOffsetY=0,HS.call(this),this.textMask&&(this.textMask.setPosition().resize(),this.resetChildPositionState(this.textMask)));}},ZS=Phaser.Utils.Objects.IsPlainObject,qS=Phaser.Utils.Objects.GetValue,$S=Phaser.Display.Align.TOP_LEFT,QS=function(t){a(i,t);var e=d(i);function i(t,s,r,o,a,h){var l;n(this,i),ZS(s)?(s=qS(h=s,"x",0),r=qS(h,"y",0),o=qS(h,"width",void 0),a=qS(h,"height",void 0)):ZS(o)&&(o=qS(h=o,"width",void 0),a=qS(h,"height",void 0)),(l=e.call(this,t,s,r,o,a,h)).type="rexTextBlock",l.textObject=void 0,l.linesCount=0,l.textMask=void 0,l.textObjectType=void 0,l._textLineHeight=void 0,l._textLineSpacing=void 0,l._visibleLinesCount=void 0,l._textHeight=void 0,l._textVisibleHeight=void 0,l._textObjectRealHeight=0,l.lines=void 0,l.text=qS(h,"content",""),l._textOY=0,l.execeedTopState=!1,l.execeedBottomState=!1,l.setClampMode(qS(h,"clamplTextOY",!0)),l.alwaysScrollable=qS(h,"alwaysScrollable",!1);var c=qS(h,"background",void 0),d=qS(h,"text",void 0);void 0===d&&(d=tP(t)),l.textCropEnable=qS(h,"textCrop",!!d.setCrop);var f=qS(h,"textMask",!l.textCropEnable);c&&l.addBackground(c),l.add(d),l.sizerChildren=[d];var p=l.getSizerConfig(d);return p.align=$S,p.padding=pp(0),p.expand=!0,l.textObject=d,l.textObjectType=WS(d),p.preOffsetY=0,p.offsetY=0,f&&(l.textMask=Qx.call(u(l),l.textObject,u(l))),l.addChildrenMap("background",c),l.addChildrenMap("text",d),l}return r(i,[{key:"destroy",value:function(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;}p(h(i.prototype),"destroy",this).call(this,t);}}},{key:"setClampMode",value:function(t){return void 0===t&&(t=!0),this.clampTextOY=t,this}},{key:"textLineHeight",get:function(){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}},{key:"textLineSpacing",get:function(){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}},{key:"visibleLinesCount",get:function(){return void 0===this._visibleLinesCount&&(this._visibleLinesCount=Math.floor(XS.call(this,this._textObjectRealHeight))),this._visibleLinesCount}},{key:"topTextOY",get:function(){return 0}},{key:"bottomTextOY",get:function(){return -this.textVisibleHeight}},{key:"textHeight",get:function(){return void 0===this._textHeight&&(this._textHeight=VS.call(this,this.linesCount)),this._textHeight}},{key:"textObjectHeight",get:function(){return this._textObjectRealHeight-(this.textLineHeight+this.textLineSpacing)}},{key:"textVisibleHeight",get:function(){if(void 0===this._textVisibleHeight){var t=this.textHeight-this.textObjectHeight;!this.alwaysScrollable&&t<0&&(t=0),this._textVisibleHeight=t;}return this._textVisibleHeight}},{key:"textOYExceedTop",value:function(t){return void 0===t&&(t=this.textOY),t>this.topTextOY}},{key:"textOYExeceedBottom",value:function(t){return void 0===t&&(t=this.textOY),tthis.linesCount?t=0:n?t=e:s&&(t=i)),this._textOY!==t&&(this._textOY=t,this.updateTextObject()),n&&(this.execeedTopState||this.emit("execeedtop",this,t,e)),this.execeedTopState=n,s&&(this.execeedBottomState||this.emit("execeedbottom",this,t,i)),this.execeedBottomState=s;}},{key:"setTextOY",value:function(t){return this.textOY=t,this}},{key:"t",get:function(){var t=this.textVisibleHeight;return 0===t?0:this.textOY/-t},set:function(t){this.textOY=-this.textVisibleHeight*t;}},{key:"setTextOYByPercentage",value:function(t){return this.t=t,this}}]),i}(lk),tP=function(t){return t.add.text(0,0,"")};Object.assign(QS.prototype,JS);Phaser.Math.Clamp;var eP={scrollToLine:function(t){return this.setChildOY(-this.lineHeight*t),this},scrollToNextLine:function(t){void 0===t&&(t=1);var e=this.lineIndex+t;return this.scrollToLine(e),this}},iP=Phaser.Utils.Objects.GetValue,nP=function(t){a(i,t);var e=d(i);function i(t,s){var r;n(this,i),void 0===s&&(s={});var o=iP(s,"text",void 0),a=iP(s,"textWidth",void 0),h=iP(s,"textHeight",void 0),l=iP(s,"textCrop",!!o.setCrop),u=iP(s,"textMask",!l),c=iP(s,"content",""),d=new QS(t,{width:a,height:h,text:o,textMask:u,textCrop:l&&!u,content:c,clamplTextOY:iP(s,"clamplChildOY",!1),alwaysScrollable:iP(s,"alwaysScrollable",!1)});t.add.existing(d),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}});}(d),s.scrollMode=0,s.type="rexTextArea",s.child={gameObject:d,expandWidth:void 0===a,expandHeight:void 0===h};var f=iP(s,"space",void 0);return f&&(f.child=iP(f,"text",0)),(r=e.call(this,t,s)).addChildrenMap("text",o),r}return r(i,[{key:"text",get:function(){return this.childrenMap.child.text}},{key:"lineHeight",get:function(){var t=this.childrenMap.child;return t.textLineHeight+t.textLineSpacing}},{key:"lineIndex",get:function(){return Math.floor(-this.childOY/this.lineHeight)}},{key:"linesCount",get:function(){return this.childrenMap.child.linesCount}},{key:"contentHeight",get:function(){return this.childrenMap.child.textHeight}}]),i}(AS);Object.assign(nP.prototype,{setText:function(t){return this.childrenMap.child.setText(t),this.resizeController(),this},appendText:function(t){return this.setText(this.text+t),this}},eP);var sP=Phaser.Utils.Objects.GetValue,rP=function(t,e,i){e=e?M(e):{};var n=sP(i,"background",iC),s=sP(i,"text",rC),r=sP(i,"track",iC),o=sP(i,"thumb",iC);n?e.background=n(t,e.background):delete e.background,s?e.text=s(t,e.text):delete e.text;var a=e.slider;!1!==a&&(void 0===a&&(a={}),r?a.track=r(t,a.track):delete a.track,o?a.thumb=o(t,a.thumb):delete a.thumb,e.slider=a);var h=new nP(t,e);return t.add.existing(h),h},oP=Phaser.Utils.Objects.GetValue,aP=Phaser.Utils.Objects.GetValue,hP=function(t){a(i,t);var e=d(i);function i(t,s,r){var o;n(this,i),s=s?M(s):{},void 0===r&&(r={});var a=aP(r,"background",iC);a?s.background=a(t,s.background):delete s.background,s.title=ww(t,s.title,r.title),s.content=function(t,e,i){var n,s=oP(e,"$type");void 0===s&&e&&(e.hasOwnProperty("slider")||e.hasOwnProperty("scroller"))&&(s="textarea"),n="textarea"===s?new rP(t,e,i):new ww(t,e,i);return t.add.existing(n),n}(t,s.content,r.content),s.content instanceof nP&&Bl(s,"height")&&!Bl(s,"proportion.content")&&Z(s,"proportion.content",1);var h=s.button,l=s.buttonA||h,c=s.buttonB||h,d=s.buttonMode;void 0===d&&(d=l&&c?2:l?1:0);var f=r.button,p=r.buttonA||f,v=r.buttonB||f;switch(d){case 2:s.actions=[ww(t,l,p),ww(t,c,v)];break;case 1:s.actions=[ww(t,l,p)];break;case 0:break;default:s.actions=[];}var g=s.choice;g&&(s.choices=[]),(o=e.call(this,t,s)).type="rexConfirmDialog",o.buttonMode=d,o.defaultActionConfig=h,o.defaultActionButtonCreator=f,o.defaultChoiceConfig=g,o.defaultChoiceCreator=r.choice;var y=o.childrenMap.actions;return o.addChildrenMap("buttonA",y?y[0]:null),o.addChildrenMap("buttonB",y?y[1]:null),Dw.call(u(o)),o}return r(i)}(mw);Object.assign(hP.prototype,Mw),T.register("confirmDialog",(function(t,e){var i=new hP(this.scene,t,e);return this.scene.add.existing(i),i})),Z(window,"RexPlugins.UI.ConfirmDialog",hP);var lP=Phaser.Utils.Objects.GetValue,uP=function(t,e,i){var n=lP(t,"proportion.".concat(e),i.proportion),s=lP(t,"align.".concat(e),"center"),r=lP(t,"space.".concat(e),void 0);if("number"==typeof r&&i.paddingKey){var o=r;(r={})[i.paddingKey]=o;}return {proportion:n,align:s,padding:r,expand:lP(t,"expand.".concat(e),!0)}},cP=function(t){return uP(t,"header",{proportion:0,paddingKey:"bottom"})},dP=function(t){return uP(t,"leftSide",{proportion:0,paddingKey:"right"})},fP=function(t){return uP(t,"content",{proportion:1})},pP=function(t){return uP(t,"rightSide",{proportion:0,paddingKey:"left"})},vP=function(t){return uP(t,"footer",{proportion:0,paddingKey:"top"})},gP=function(t,e){var i=new ux(t,{orientation:e});return t.add.existing(i),i},yP=Phaser.Utils.Objects.GetValue,kP=[function(t){var e=this.scene,i=t.header;i&&this.add(i,cP(t));var n=gP(e,0);this.add(n,{proportion:1,align:"center",padding:0,expand:!0});var s=t.leftSide;s&&n.add(s,dP(t));var r=t.content;r&&n.add(r,fP(t));var o=t.rightSide;o&&n.add(o,pP(t));var a=t.footer;a&&this.add(a,vP(t));},function(t){var e=this.scene,i=t.header;i&&this.add(i,cP(t));var n=gP(e,0);this.add(n,{proportion:1,align:"center",padding:0,expand:!0});var s=t.leftSide;s&&n.add(s,dP(t));var r=gP(e,1);n.add(r,{proportion:1,align:"center",padding:0,expand:!0});var o=gP(e,0);r.add(o,{proportion:1,align:"center",padding:0,expand:!0});var a=t.content;a&&o.add(a,fP(t));var h=t.rightSide;h&&o.add(h,pP(t));var l=t.footer;l&&r.add(l,vP(t));},function(t){var e=this.scene,i=t.header;i&&this.add(i,cP(t));var n=gP(e,0);this.add(n,{proportion:1,align:"center",padding:0,expand:!0});var s=gP(e,1);n.add(s,{proportion:1,align:"center",padding:0,expand:!0});var r=gP(e,0);s.add(r,{proportion:1,align:"center",padding:0,expand:!0});var o=t.leftSide;o&&r.add(o,dP(t));var a=t.content;a&&r.add(a,fP(t));var h=t.footer;h&&s.add(h,vP(t));var l=t.rightSide;l&&n.add(l,pP(t));},function(t){var e=this.scene,i=t.header;i&&this.add(i,cP(t));var n=gP(e,0);this.add(n,{proportion:1,align:"center",padding:0,expand:!0});var s=t.leftSide;s&&n.add(s,dP(t));var r=gP(e,1);n.add(r,{proportion:1,align:"center",padding:0,expand:!0});var o=t.content;o&&r.add(o,fP(t));var a=t.footer;a&&r.add(a,vP(t));var h=t.rightSide;h&&n.add(h,pP(t));}],mP={FFF:0,LFF:1,FFR:2,LFR:3},bP=function(t){a(i,t);var e=d(i);function i(t,s){var r;return n(this,i),void 0===s&&(s={}),s.orientation=1,(r=e.call(this,t,s)).type="rexHolyGrail",r.build(s),r}return r(i)}(ux),xP={build:function(t){this.clear(!0);var e=yP(t,"background",void 0);e&&this.addBackground(e);var i=yP(t,"layoutMode",0);"string"==typeof i&&(i=mP[i.toUpperCase()]),(kP[i]||kP[0]).call(this,t),this.addChildrenMap("background",t.background),this.addChildrenMap("header",t.header),this.addChildrenMap("leftSide",t.leftSide),this.addChildrenMap("content",t.content),this.addChildrenMap("rightSide",t.rightSide),this.addChildrenMap("footer",t.footer);}};Object.assign(bP.prototype,xP),T.register("holyGrail",(function(t){var e=new bP(this.scene,t);return this.scene.add.existing(e),e})),Z(window,"RexPlugins.UI.HolyGrail",bP);var CP={getButtonsSizer:function(t){return this.childrenMap["".concat(t,"ButtonsSizer")]},getButton:function(t,e){var i=this.getButtonsSizer(t);return i?i.getButton(e):void 0},setButtonEnable:function(t,e,i){return this.getButtonsSizer(t).setButtonEnable(e,i),this},setLeftButtonEnable:function(t,e){return this.childrenMap.leftButtonsSizer.setButtonEnable(t,e),this},setRightButtonEnable:function(t,e){return this.childrenMap.rightButtonsSizer.setButtonEnable(t,e),this},setTopButtonEnable:function(t,e){return this.childrenMap.topButtonsSizer.setButtonEnable(t,e),this},setBottomButtonEnable:function(t,e){return this.childrenMap.bottomButtonsSizer.setButtonEnable(t,e),this},toggleButtonEnable:function(t,e){return this.getButtonsSizer(t).toggleButtonEnable(e),this},toggleLeftButtonEnable:function(t){return this.childrenMap.leftButtonsSizer.toggleButtonEnable(t),this},toggleRightButtonEnable:function(t){return this.childrenMap.rightButtonsSizer.toggleButtonEnable(t),this},toggleTopButtonEnable:function(t){return this.childrenMap.topButtonsSizer.toggleButtonEnable(t),this},toggleBottomButtonEnable:function(t){return this.childrenMap.bottomButtonsSizer.toggleButtonEnable(t),this},getButtonEnable:function(t,e){return this.getButtonsSizer(t).getButtonEnable(e)},getLeftButtonEnable:function(t){return this.childrenMap.leftButtonsSizer.getButtonEnable(t)},getRightButtonEnable:function(t){return this.childrenMap.rightButtonsSizer.getButtonEnable(t)},getTopButtonEnable:function(t){return this.childrenMap.topButtonsSizer.getButtonEnable(t)},getBottomButtonEnable:function(t){return this.childrenMap.bottomButtonsSizer.getButtonEnable(t)},emitButtonClick:function(t,e){var i=this.getButtonsSizer(t);return i?(i.emitButtonClick(e),this):this},emitLeftButtonClick:function(t){return this.childrenMap.leftButtonsSizer.emitButtonClick(t),this},emitRightButtonClick:function(t){return this.childrenMap.rightButtonsSizer.emitButtonClick(t),this},emitTopButtonClick:function(t){return this.childrenMap.topButtonsSizer.emitButtonClick(t),this},emitBottomButtonClick:function(t){return this.childrenMap.bottomButtonsSizer.emitButtonClick(t),this},getLeftButton:function(t){return this.childrenMap.leftButtonsSizer.getButton(t)},getRightButton:function(t){return this.childrenMap.rightButtonsSizer.getButton(t)},getTopButton:function(t){return this.childrenMap.topButtonsSizer.getButton(t)},getBottomButton:function(t){return this.childrenMap.bottomButtonsSizer.getButton(t)},showButton:function(t,e){return wv(this.getButton(t,e)),this},showLeftButton:function(t){return wv(this.getLeftButton(t)),this},showRightButton:function(t){return wv(this.getRightButton(t)),this},showTopButton:function(t){return wv(this.getTopButton(t)),this},showBottomButton:function(t){return wv(this.getBottomButton(t)),this},hideButton:function(t,e){return Sv(this.getButton(t,e)),this},hideLeftButton:function(t){return Sv(this.getLeftButton(t)),this},hideRightButton:function(t){return Sv(this.getRightButton(t)),this},hideTopButton:function(t){return Sv(this.getTopButton(t)),this},hideBottomButton:function(t){return Sv(this.getBottomButton(t)),this},addButton:function(t,e){return this.getButtonsSizer(t).addButton(e),this},addLeftButton:function(t){return this.addButton("left",t),this},addRightButton:function(t){return this.addButton("right",t),this},addTopButton:function(t){return this.addButton("top",t),this},removeButton:function(t,e,i){return this.getButtonsSizer(t).removeButton(e,i),this},removeLeftButton:function(t,e){return this.removeButton("left",t,e),this},removeRightButton:function(t,e){return this.removeButton("right",t,e),this},removeTopButton:function(t,e){return this.removeButton("top",t,e),this},removeBottomButton:function(t,e){return this.removeButton("bottom",t,e),this},clearButtons:function(t,e){return this.getButtonsSizer(t).clearButtons(e),this},clearLeftButtons:function(t){return this.clearButtons("left",t),this},clearRightButtons:function(t){return this.clearButtons("right",t),this},clearTopButtons:function(t){return this.clearButtons("top",t),this},clearBottomButtonss:function(t){return this.clearButtons("bottom",t),this},forEachButton:function(t,e,i){return this.getButtonsSizer(t).forEachButtton(e,i),this},forEachLeftButton:function(t,e){return this.childrenMap.leftButtonsSizer.forEachButtton(t,e),this},forEachRightButton:function(t,e){return this.childrenMap.rightButtonsSizer.forEachButtton(t,e),this},forEachTopButton:function(t,e){return this.childrenMap.topButtonsSizer.forEachButtton(t,e),this},forEachBottomButton:function(t,e){return this.childrenMap.bottomButtonsSizer.forEachButtton(t,e),this}},wP=Phaser.Utils.Objects.GetValue,SP=function(t){a(i,t);var e=d(i);function i(t,s){var r;n(this,i),void 0===s&&(s={}),s.column=3,s.row=3,(r=e.call(this,t,s)).type="rexTabs",r.eventEmitter=wP(s,"eventEmitter",u(r));var o,a,h,l,c=wP(s,"background",void 0),d=wP(s,"panel",void 0),f=wP(s,"leftButtons",void 0),p=wP(s,"leftButtonsBackground",void 0),v=wP(s,"rightButtons",void 0),g=wP(s,"rightButtonsBackground",void 0),y=wP(s,"topButtons",void 0),k=wP(s,"topButtonsBackground",void 0),m=wP(s,"bottomButtons",void 0),b=wP(s,"bottomButtonsBackground",void 0),x=wP(s,"click",void 0);if(c&&r.addBackground(c),d&&r.add(d,1,1,"center",0,!0),f){var C=wP(s,"space.leftButtonsOffset",0),w=wP(s,"space.leftButton",0);o=new JC(t,{groupName:"left",background:p,buttons:f,orientation:1,space:{item:w},align:wP(s,"align.leftButtons",void 0),click:x,eventEmitter:r.eventEmitter});var S={top:C};r.add(o,0,1,"top",S,!1);}if(v){var P=wP(s,"space.rightButtonsOffset",0),T=wP(s,"space.rightButton",0);a=new JC(t,{groupName:"right",background:g,buttons:v,orientation:1,space:{item:T},align:wP(s,"align.rightButtons",void 0),click:x,eventEmitter:r.eventEmitter});S={top:P};r.add(a,2,1,"top",S,!1);}if(y){var O=wP(s,"space.topButtonsOffset",0),M=wP(s,"space.topButton",0);h=new JC(t,{groupName:"top",background:k,buttons:y,orientation:0,space:{item:M},align:wP(s,"align.topButtons",void 0),click:x,eventEmitter:r.eventEmitter});S={left:O};r.add(h,1,0,"left",S,!1);}if(m){var E=wP(s,"space.bottomButtonsOffset",0),_=wP(s,"space.bottomButton",0);l=new JC(t,{groupName:"bottom",background:b,buttons:m,orientation:0,space:{item:_},align:wP(s,"align.bottomButtons",void 0),click:x,eventEmitter:r.eventEmitter});S={left:E};r.add(l,1,2,"left",S,!1);}return r.addChildrenMap("background",c),r.addChildrenMap("panel",d),r.addChildrenMap("leftButtons",f),r.addChildrenMap("rightButtons",v),r.addChildrenMap("topButtons",y),r.addChildrenMap("bottomButtons",m),r.addChildrenMap("leftButtonsSizer",o),r.addChildrenMap("rightButtonsSizer",a),r.addChildrenMap("topButtonsSizer",h),r.addChildrenMap("bottomButtonsSizer",l),r}return r(i)}(Ex);Object.assign(SP.prototype,CP),T.register("tabs",(function(t){var e=new SP(this.scene,t);return this.scene.add.existing(e),e})),Z(window,"RexPlugins.UI.Tabs",SP),T.register("slider",(function(t){var e=new lS(this.scene,t);return this.scene.add.existing(e),e})),Z(window,"RexPlugins.UI.Slider",lS);var PP=function(){function t(e,i){n(this,t),this.container=null,this._deltaHeight=0,this.setParent(e);}return r(t,[{key:"setParent",value:function(t){this.parent=t,this.parentContainer=t.getParentContainer();}},{key:"destroy",value:function(t){void 0===t&&(t=!1),t||this.destroyContainer(),this.deltaHeight=0,this.data=void 0,this.container=null,this.parent=void 0,this.parentContainer=void 0;}},{key:"table",get:function(){return this.parent}},{key:"scrollMode",get:function(){return this.parentContainer.scrollMode}},{key:"colIndx",get:function(){return this.parent.cellIndxeToColIndex(this.index)}},{key:"rowIndx",get:function(){return this.parent.cellIndxeToRowIndex(this.index)}},{key:"getContainer",value:function(){return this.container}},{key:"setContainer",value:function(t){return t?(this.container&&this.container.destroy(),this.container=t,this.parentContainer.add(t),this):(this.destroyContainer(),this)}},{key:"destroyContainer",value:function(){return this.container&&(this.container.destroy(),this.container=null),this}},{key:"popContainer",value:function(){if(this.container){var t=this.container;return this.container=null,this.parentContainer.remove(t),t}return null}},{key:"setXY",value:function(t,e){return this.container&&this.parentContainer.setChildLocalPosition(this.container,t,e),this}},{key:"setCellContainerAlign",value:function(t){return "string"==typeof t&&(t=Af[t]),this.cellContainerAlign=t,this}},{key:"deltaHeight",get:function(){return this._deltaHeight},set:function(t){null==t&&(t=0);var e=this.parent;0===this._deltaHeight&&0!==t?e.nonZeroDeltaHeightCount++:0!==this._deltaHeight&&0===t&&e.nonZeroDeltaHeightCount--;var i=this._deltaHeight!==t;if(this._deltaHeight=t,i){e.resetTotalRowsHeight();var n=0===this.scrollMode?"cellheightchange":"cellwidthchange";this.parentContainer.emit(n,this,this.container,this.parentContainer);}}},{key:"deltaWidth",get:function(){return this.deltaHeight},set:function(t){this.deltaHeight=t;}},{key:"setDeltaHeight",value:function(t){return this.deltaHeight=t,this}},{key:"setDeltaWidth",value:function(t){return this.deltaHeight=t,this}},{key:"height",get:function(){return 0===this.scrollMode?this.deltaHeight+this.parent.defaultCellHeight:this.parent.defaultCellWidth},set:function(t){1!==this.scrollMode&&this.setDeltaHeight(t-this.parent.defaultCellHeight);}},{key:"setHeight",value:function(t){return this.height=t,this}},{key:"width",get:function(){return 0===this.scrollMode?this.parent.defaultCellWidth:this.deltaHeight+this.parent.defaultCellHeight},set:function(t){0!==this.scrollMode&&this.setDeltaHeight(t-this.parent.defaultCellHeight);}},{key:"setWidth",value:function(t){return this.width=t,this}},{key:"scene",get:function(){return this.parentContainer.scene}}]),t}();Object.assign(PP.prototype,Ct);var TP=Phaser.Utils.Objects.GetValue,OP=Phaser.Utils.Array.SpliceOne,MP=function(){function t(e,i){n(this,t),this.parent=e,this.cells=[],this.cellPool=new st,this.resetFromJSON(i);}return r(t,[{key:"resetFromJSON",value:function(t){void 0===t&&(t={}),this.colCount=void 0,this.nonZeroDeltaHeightCount=0,this.resetTotalRowsHeight();var e=t.cellHeight;void 0===e&&(e=30);var i=t.cellWidth;return void 0===i&&(i=30),this.setDefaultCellHeight(e),this.setDefaultCellWidth(i),this.initCells(TP(t,"cellsCount",0)),this.setColumnCount(TP(t,"columns",1)),this}},{key:"destroy",value:function(t){this.cellPool.destroy(),this.cells=void 0,this.parent=void 0;}},{key:"defaultCellHeightMode",get:function(){return 0===this.nonZeroDeltaHeightCount}},{key:"setDefaultCellHeight",value:function(t){return this.defaultCellHeight=t,this}},{key:"setDefaultCellWidth",value:function(t){return this.defaultCellWidth=t,this}},{key:"initCells",value:function(t){var e=this.cells;e.length=t;for(var i=0;i=0&&t=0&&i0&&n)){if(0===r)return 2===e&&(i+=1),i;if(1===e){var o=i;(n=(i+=1)>=0&&i=this.colCount?null:e*this.colCount+t}},{key:"rowIndexToHeight",value:function(t,e){if(this.defaultCellHeightMode)return (e-t+1)*this.defaultCellHeight;for(var i=0,n=t;n<=e;n++)i+=this.getRowHeight(n);return i}},{key:"colIndexToWidth",value:function(t,e){return (e-t+1)*this.defaultCellWidth}},{key:"getRowHeight",value:function(t){var e=this.colCount;if(e<=1)return this.getCellHeight(this.colRowToCellIndex(0,t));for(var i,n=0,s=0;sthis.topTableOY,r=tthis.leftTableOX,r=tt?this.removeCells(t,e-t):this.insertNewCells(e,t-e)),this},insertNewCells:function(t,e){return "object"===i(t)&&(t=t.index),void 0===e&&(e=1),e<=0||(t=GP(t,0,this.cellsCount),this.table.insertNewCells(t,e)),this},removeCells:function(t,e){if("object"===i(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 n,s=t,r=t+e;sb.bottom&&(l=c.getTopLeft().y,t.setOrigin(0,1).setPosition(h+d,l+f));},IT={down:0,up:1},jT=Phaser.Utils.Objects.GetValue,zT=function(t){a(i,t);var e=d(i);function i(t,s){var r;n(this,i),void 0===s&&(s={}),null==s.transitIn&&(s.transitIn=function(t,e){Fp(t,e,"y","Cubic");}),null==s.transitOut&&(s.transitOut=function(t,e){!function(t,e,i,n,s){void 0===n&&(n="Linear");var r={mode:0};switch(i){case 0:case"x":r.end={x:0};break;case 1:case"y":r.end={y:0};break;default:r.end=0;}r.duration=e,r.ease=n,void 0===s?s=new zp(t,r):s.resetFromJSON(r),s.restart();}(t,e,"y","Linear");}),s.manualClose=!0,s.clickOutsideClose=!0,s.destroy=!0,r=e.call(this,t,s),DT(t,s),t.isRexSizer&&t.layout();var o=jT(s,"touchOutsideClose",!1),a=jT(s,"anyTouchClose",!1);return a&&(o=!1),a?r.once("open",r.anyTouchClose,u(r)):o&&r.once("open",r.touchOutsideClose,u(r)),r.requestOpen(),r}return r(i,[{key:"shutdown",value:function(t){this.isShutdown||(this.scene.input.off("pointerup",this.touchCloseCallback,this),p(h(i.prototype),"shutdown",this).call(this,t));}},{key:"touchOutsideClose",value:function(){return this.scene.input.on("pointerup",this.touchCloseCallback,this),this.clickOutsideTest=!0,this}},{key:"anyTouchClose",value:function(){return this.scene.input.once("pointerup",this.touchCloseCallback,this),this}},{key:"touchCloseCallback",value:function(t){this.clickOutsideTest&&ng(this.parent,t.worldX,t.worldY)||this.requestClose();}},{key:"onOpen",value:function(){this.emit("open",this.parent,this),p(h(i.prototype),"onOpen",this).call(this);}},{key:"onClose",value:function(){this.emit("close",this.parent,this),p(h(i.prototype),"onClose",this).call(this);}}]),i}(Gv),AT={openListPanel:function(){if(this.listPanel)return this;var t,e=LT.call(this);e.on("button.over",(function(t,i,n,s){this.listOnButtonOver&&this.listOnButtonOver.call(this,t,i,n,s),this.emit("button.over",this,e,t,i,n,s);}),this).on("button.out",(function(t,i,n,s){this.listOnButtonOut&&this.listOnButtonOut.call(this,t,i,n,s),this.emit("button.out",this,e,t,i,n,s);}),this),t=this.listAlignMode&&"label"!==this.listAlignMode?this.getElement(this.listAlignMode):this;var i=new zT(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,anyTouchClose:!0}).on("open",(function(){e.on("button.click",(function(t,i,n,s){this.listOnButtonClick&&this.listOnButtonClick.call(this,t,i,n,s),this.emit("button.click",this,e,t,i,n,s);}),this),this.emit("list.open",this,e);}),this).on("close",(function(){this.listPanel=void 0,this.dropDownBehavior=void 0;}),this);return this.listPanel=e,this.dropDownBehavior=i,this.pin(e),this},closeListPanel:function(){return this.dropDownBehavior?(this.dropDownBehavior.requestClose(),this):this},toggleListPanel:function(){return this.listPanel?this.closeListPanel():this.openListPanel(),this}};Object.assign(AT,_T);var FT=Phaser.Utils.Objects.GetValue,WT=function(t){a(i,t);var e=d(i);function i(t,s){var r;n(this,i),(r=e.call(this,t,s)).type="rexDropDownList",r.timer=void 0,r.setOptions(FT(s,"options"));var o=FT(s,"list");return r.setWrapEnable(FT(o,"wrap",!1)),r.setCreateButtonCallback(FT(o,"createButtonCallback")),r.setCreateListBackgroundCallback(FT(o,"createBackgroundCallback")),r.setButtonClickCallback(FT(o,"onButtonClick")),r.setButtonOverCallback(FT(o,"onButtonOver")),r.setButtonOutCallback(FT(o,"onButtonOut")),r.setListExpandDirection(FT(o,"expandDirection")),r.setListEaseInDuration(FT(o,"easeIn",500)),r.setListEaseOutDuration(FT(o,"easeOut",100)),r.setListTransitInCallback(FT(o,"transitIn")),r.settListTransitOutCallback(FT(o,"transitOut")),r.setListSize(FT(o,"width"),FT(o,"height")),r.setListAlignmentMode(FT(o,"alignParent","text")),r.setListAlignmentSide(FT(o,"alignSide","")),r.setListBounds(FT(o,"bounds")),r.setListSpace(FT(o,"space")),r.setListDraggable(FT(o,"draggable",!1)),r.setValueChangeCallback(FT(s,"setValueCallback"),FT(s,"setValueCallbackScope")),r.setValue(FT(s,"value")),r.onClick(r.toggleListPanel,u(r)),r}return r(i,[{key:"destroy",value:function(t){this.scene&&!this.ignoreDestroy&&(this.listPanel&&(this.listPanel.destroy(t),this.listPanel=void 0),p(h(i.prototype),"destroy",this).call(this,t));}},{key:"setOptions",value:function(t){return void 0===t&&(t=[]),this.options=t,this}},{key:"setValueChangeCallback",value:function(t,e){return this.valueChangeCallback=t,this.valueChangeCallbackScope=e,this}},{key:"setValue",value:function(t){return this.value=t,this}},{key:"value",get:function(){return this._value},set:function(t){if(this._value!==t){var e=this._value;this._value=t;var i=this.valueChangeCallback,n=this.valueChangeCallbackScope;i&&(n?i.call(n,this,t,e):i(this,t,e)),this.emit("valuechange",this,t,e);}}},{key:"emitButtonClick",value:function(t){var e=this.options[t];return e?(this.emit("button.click",this,void 0,e,t),this):this}}]),i}(eC);Object.assign(WT.prototype,AT),T.register("dropDownList",(function(t){var e=new WT(this.scene,t);return this.scene.add.existing(e),e})),Z(window,"RexPlugins.UI.DropDownList",WT);var YT=function(t,e,i){void 0===i&&(i={});var n=(e=e?M(e):{}).label||e.button,s=e.button||e.label;delete e.label,delete e.button;var r=i.label||i.button||i,o=i.button||i.label||i,a=fC(t,n,r);return a.list=e.list||{},a.list.createButtonCallback=function(t,e){var i=ww(t,s,o).resetDisplayContent({text:e.text});return e.hasOwnProperty("value")&&(i.value=e.value),i},a.list.onButtonOver=function(t,e,i,n){t.setHoverState&&t.setHoverState(!0);},a.list.onButtonOut=function(t,e,i,n){t.setHoverState&&t.setHoverState(!1);},a},XT=function(t){a(i,t);var e=d(i);function i(t,s,r){var o;return n(this,i),s=YT(t,s,r),(o=e.call(this,t,s)).type="rexSimpleDropDownList",o}return r(i,[{key:"setOptions",value:function(t){void 0===t&&(t=[]);for(var e=0,n=t.length;e=this.pageCount-1}},{key:"totalLinesCount",get:function(){return this.lines?this.lines.length:0}},{key:"startLineIndex",get:function(){return this._startLineIndex},set:function(t){t=ZT(t,0,this.totalLinesCount-1),this._startLineIndex=t;}},{key:"setStartLineIndex",value:function(t){return this.startLineIndex=t,this}},{key:"pageLinesCount",get:function(){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,n;switch(WS(t)){case 0:case 1:e=t.height-t.padding.top-t.padding.bottom,i=t.lineSpacing,n=t.style.metrics.fontSize+t.style.strokeThickness;break;case 2:e=t.height,i=0;var s=t.fontSize/t.fontData.size;n=t.fontData.lineHeight*s;}return (e-i)/(n+i)}(this.parent));break;case 2:t=this.totalLinesCount;}return t}},{key:"content",get:function(){return this.sections.join(this.pageBreak)}}]),i}(ro);Object.assign(qT.prototype,KT);var $T,QT=Phaser.Utils.Objects.GetFastValue,tO=Phaser.Utils.Objects.GetValue,eO=function(t){a(i,t);var e=d(i);function i(t,s){var r;return n(this,i),(r=e.call(this,t,s)).timer=null,r.resetFromJSON(s),r}return r(i,[{key:"resetFromJSON",value:function(t){this.setTextWrapEnable(tO(t,"wrap",!1)),this.setTypeMode(tO(t,"typeMode",0)),this.setTypingSpeed(tO(t,"speed",333)),this.setTextCallback=QT(t,"setTextCallback",null),this.setTextCallbackScope=QT(t,"setTextCallbackScope",null),this.setTypingContent(QT(t,"text","")),this.typingIdx=QT(t,"typingIdx",0),this.insertIdx=null,this.insertChar=null;var e=QT(t,"elapsed",null);return null!==e&&this.start(void 0,void 0,this.typingIdx,e),this}},{key:"shutdown",value:function(t){this.isShutdown||(this.freeTimer(),p(h(i.prototype),"shutdown",this).call(this,t));}},{key:"setTypeMode",value:function(t){return "string"==typeof t&&(t=nO[t]),this.typeMode=t,this}},{key:"setTypeSpeed",value:function(t){return this.speed=t,this}},{key:"setTypingSpeed",value:function(t){return this.speed=t,this}},{key:"setTextWrapEnable",value:function(t){return void 0===t&&(t=!0),this.textWrapEnable=t,this}},{key:"text",get:function(){return this._text},set:function(t){var e=iO(t);this.textWrapEnable&&(e=function(t,e){switch(WS(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;}},{key:"isTyping",get:function(){return null!==this.getTimer()}},{key:"isLastChar",get:function(){return this.typingIdx===this.textLen}},{key:"start",value:function(t,e,i,n){return void 0!==t&&this.setTypingContent(t),void 0!==e&&(this.speed=e),void 0===i&&(i=0),this.typingIdx=i+1,0===this.speed?this.stop(!0):(this.setText(""),this.startTimer(n)),this}},{key:"appendText",value:function(t){var e=this.text.concat(iO(t));return this.isTyping?this.setTypingContent(e):this.start(e,void 0,this.textLen),this}},{key:"stop",value:function(t){if(this.getTimer()&&this.freeTimer(),t){for(;!this.isLastChar;)this.getTypingString(this.text,this.typingIdx,this.textLen,this.typeMode),this.emit("typechar",this.insertChar),this.typingIdx++;this.setText(this.text),this.emit("type"),this.emit("complete",this,this.parent);}return this}},{key:"pause",value:function(){var t=this.getTimer();return t&&(t.paused=!0),this}},{key:"resume",value:function(){var t=this.getTimer();return t&&(t.paused=!1),this}},{key:"setTypingContent",value:function(t){return this.text=t,this.textLen=this.getTextLength(this.text),this}},{key:"onTyping",value:function(){var t=this.getTypingString(this.text,this.typingIdx,this.textLen,this.typeMode);this.setText(t),this.emit("typechar",this.insertChar),this.emit("type"),this.isLastChar?(this.freeTimer(),this.emit("complete",this,this.parent)):(this.timer.delay=this.speed,this.typingIdx++);}},{key:"getTypingString",value:function(t,e,i,n){var s;if(0===n){var r=0,o=e;this.insertIdx=o,s=this.getSubString(t,r,o);}else if(1===n){r=(o=i)-e;this.insertIdx=0,s=this.getSubString(t,r,o);}else if(2===n){var a=i/2;o=(r=Math.floor(a-e/2))+e;this.insertIdx=e%2?e:0,s=this.getSubString(t,r,o);}else if(3===n){var h,l=Math.floor(e/2);if(l>0){r=(o=i)-l;h=this.getSubString(t,r,o);}else h="";var u,c=e-l;if(c>0){o=(r=0)+c;this.insertIdx=o,u=this.getSubString(t,r,o);}else u="",this.insertIdx=0;s=u+h;}return this.insertChar=s.charAt(this.insertIdx-1),s}},{key:"startTimer",value:function(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}},{key:"getTimer",value:function(){return this.timer}},{key:"freeTimer",value:function(){return this.timer&&(this.timer.remove(),this.timer=null),this}},{key:"setText",value:function(t){this.setTextCallback&&(t=this.setTextCallbackScope?this.setTextCallback.call(this.setTextCallbackScope,t,this.isLastChar,this.insertIdx):this.setTextCallback(t,this.isLastChar,this.insertIdx)),this.textWrapEnable?US(this.parent,t):this.parent.setText(t);}},{key:"getTextLength",value:function(t){var e=this.parent;return e.getPlainText?e.getPlainText(t).length:t.length}},{key:"getSubString",value:function(t,e,i){var n=this.parent;return n.getSubString?n.getSubString(t,e,i):t.slice(e,i)}}]),i}(ro),iO=function(t){return Array.isArray(t)?t=t.join("\n"):"number"==typeof t&&(t=t.toString()),t},nO={"left-to-right":0,"right-to-left":1,"middle-to-sides":2,"sides-to-middle":3},sO=Phaser.Utils.Objects.GetValue,rO=function(t){a(i,t);var e=d(i);function i(t,s){return n(this,i),void 0===s&&(s={}),s.hasOwnProperty("layoutMode")||(s.layoutMode=1),e.call(this,t,s)}return r(i)}((void 0===$T&&($T="rexTextBox"),function(t){a(i,t);var e=d(i);function i(t,s){var r;n(this,i),(r=e.call(this,t,s)).type=$T;var o=r.childrenMap.text;return r.page=new qT(o,sO(s,"page",void 0)),r.typing=new eO(o,sO(s,"typing",s.type)),r.typing.on("complete",r.onPageEnd,u(r)).on("type",r.onType,u(r)).on("typechar",r.onTypeChar,u(r)),r.textWidth=o.width,r.textHeight=o.height,r}return r(i,[{key:"start",value:function(t,e){return this.page.setText(t),void 0!==e&&this.setTypingSpeed(e),this.emit("start"),this.typeNextPage(),this}},{key:"typeNextPage",value:function(){if(this.isLastPage)this.emit("complete");else {var t=this.page.getNextPage();this.typing.start(t);}return this}},{key:"pause",value:function(){return this.isTyping&&(this.typing.pause(),this.emit("pause")),this}},{key:"resume",value:function(){return this.isTyping||(this.emit("resume"),this.typing.resume()),this}},{key:"stop",value:function(t){return this.typing.stop(t),this}},{key:"showLastPage",value:function(){return this.typing.stop(),this.page.showLastPage(),this.emit("type"),this.onPageEnd(),this}},{key:"setTypeSpeed",value:function(t){return this.typing.setTypingSpeed(t),this}},{key:"setTypingSpeed",value:function(t){return this.typing.setTypingSpeed(t),this}},{key:"isTyping",get:function(){return this.typing.isTyping}},{key:"isLastPage",get:function(){return this.page.isLastPage}},{key:"isFirstPage",get:function(){return this.page.isFirstPage}},{key:"pageCount",get:function(){return this.page.pageCount}},{key:"pageIndex",get:function(){return this.page.pageIndex}},{key:"typingSpeed",get:function(){return this.typing.speed}},{key:"onType",value:function(){var t=this.childrenMap.text;this.textWidth===t.width&&this.textHeight===t.height||(this.textWidth=t.width,this.textHeight=t.height,this.getTopmostSizer().layout()),this.emit("type");}},{key:"onTypeChar",value:function(t){this.emit("typechar",t);}},{key:"onPageEnd",value:function(){var t=this.isLastPage;this.emit("pageend"),t&&this.emit("complete");}}]),i}(bC)));T.register("textBox",(function(t){var e=new rO(this.scene,t);return this.scene.add.existing(e),e})),Z(window,"RexPlugins.UI.TextBox",rO);var oO=Phaser.Utils.Objects.GetValue,aO=function(t){a(i,t);var e=d(i);function i(t,s){var r;n(this,i),(r=e.call(this,t,s)).type="rexNumberBar";var o,a=oO(s,"background",void 0),h=oO(s,"icon",void 0),l=oO(s,"iconMask",void 0),c=oO(s,"slider",void 0),d=oO(s,"text",void 0),f=oO(s,"space.icon",0),p=oO(s,"space.slider",0);(a&&r.addBackground(a),h)&&(0===r.orientation?(c||d)&&(v={right:f}):(c||d)&&(v={bottom:f}),r.add(h,{proportion:0,align:"center",padding:v}),l&&(l=Qx.call(u(r),h,h,1)));if(c){var v,g;if(c.orientation=r.orientation,c.eventEmitter=u(r),c.value=null,c.hasOwnProperty("input")||(c.input=-1),o=new lS(t,c),t.add.existing(o),0===r.orientation?d&&(v={right:p}):d&&(v={bottom:p}),0===r.orientation)g=void 0===oO(c,"width",void 0)?1:0;else g=void 0===oO(c,"height",void 0)?1:0;r.add(o,{proportion:g,align:"center",padding:v});}d&&r.add(d),r.addChildrenMap("background",a),r.addChildrenMap("icon",h),r.addChildrenMap("iconMask",l),r.addChildrenMap("slider",o),r.addChildrenMap("text",d);var y=oO(s,"valuechangeCallback",null);if(null!==y){var k=oO(s,"valuechangeCallbackScope",void 0);r.on("valuechange",y,k);}return r.setEnable(oO(s,"enable",void 0)),r.setValue(oO(s,"value",0)),r}return r(i,[{key:"enable",get:function(){return !!this.childrenMap.slider&&this.childrenMap.slider.enable},set:function(t){this.childrenMap.slider&&this.childrenMap.slider.setEnable(t);}},{key:"setEnable",value:function(t){return void 0===t&&(t=!0),this.enable=t,this}},{key:"value",get:function(){return this.childrenMap.slider?this.childrenMap.slider.value:0},set:function(t){this.childrenMap.slider&&(this.childrenMap.slider.value=t);}},{key:"setValue",value:function(t,e,i){return this.childrenMap.slider&&this.childrenMap.slider.setValue(t,e,i),this}},{key:"addValue",value:function(t,e,i){return this.childrenMap.slider&&this.childrenMap.slider.addValue(t,e,i),this}},{key:"getValue",value:function(t,e){return this.childrenMap.slider?this.childrenMap.slider.getValue(t,e):0}},{key:"easeValueTo",value:function(t,e,i){return this.childrenMap.slider&&this.childrenMap.slider.easeValueTo(t,e,i),this}},{key:"stopEaseValue",value:function(){return this.childrenMap.slider&&this.childrenMap.slider.stopEaseValue(),this}},{key:"setEaseValueDuration",value:function(t){return this.childrenMap.slider&&this.childrenMap.slider.setEaseValueDuration(t),this}},{key:"setEaseValueFunction",value:function(t){return this.childrenMap.slider&&this.childrenMap.slider.setEaseValueFunction(t),this}},{key:"text",get:function(){var t=this.childrenMap.text;return void 0===t?"":t.text?t.text:t.getData("text")},set:function(t){var e=this.childrenMap.text;void 0!==e&&(e.setText?e.setText(t):e.setData("text",t));}},{key:"setText",value:function(t){return this.text=t,this}}]),i}(ux);T.register("numberBar",(function(t){var e=new aO(this.scene,t);return this.scene.add.existing(e),e})),Z(window,"RexPlugins.UI.NumberBar",aO),T.register("scrollBar",(function(t){var e=new fS(this.scene,t);return this.scene.add.existing(e),e})),Z(window,"RexPlugins.UI.ScrollBar",fS);var hO=Phaser.Utils.Objects.GetValue,lO={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"},uO=function(t){a(i,t);var e=d(i);function i(t,s){var r;n(this,i),(r=e.call(this,t,s)).type="rexBadge";var o=hO(s,"background",void 0);o&&r.addBackground(o),r.addChildrenMap("background",o);var a=hO(s,"main",void 0);for(var h in a&&r.add(a,{key:"main",align:"center",expand:!1}),r.addChildrenMap("main",a),lO){var l=hO(s,h,void 0);l&&(r.add(l,{key:h,align:lO[h],expand:!1}),r.addChildrenMap(h,l));}return r}return r(i)}(wk);T.register("badgeLabel",(function(t){var e=new uO(this.scene,t);return this.scene.add.existing(e),e})),Z(window,"RexPlugins.UI.BadgeLabel",uO);var cO=wk.prototype.add,dO=function(t,e,i,n,s,r,o,a,h){return t.setVisible(!1),cO.call(this,t,e,i,n,s,r,o,a,h),this},fO={add:dO,addPage:dO},pO=If.prototype.setChildVisible,vO={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?(pO.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 n=this.currentPage;return n&&(pO.call(this,n,!0),this.emit("pagevisible",n,this._currentKey,this),void 0===e&&(e=this.fadeInDuration),e>0&&n.setAlpha(0).fadeIn(e,1)),this},hasPage:function(t){return this.sizerChildren.hasOwnProperty(t)}};Object.assign(vO,fO);var gO=Phaser.Utils.Objects.GetValue,yO=function(t){a(i,t);var e=d(i);function i(t,s){var r;return n(this,i),(r=e.call(this,t,s)).type="rexPages",r.childrenMap=r.sizerChildren,r._previousKey=void 0,r._currentKey=void 0,r.setSwapMode(gO(s,"swapMode",0)),r.setFadeInDuration(gO(s,"fadeIn",0)),r}return r(i,[{key:"setSwapMode",value:function(t){return "string"==typeof t&&(t=kO[t]),this.swapMode=t,this}},{key:"setFadeInDuration",value:function(t){return this.fadeInDuration=t,this}},{key:"previousKey",get:function(){return this._previousKey}},{key:"currentKey",get:function(){return this._currentKey},set:function(t){this.swapPage(t);}},{key:"currentPage",get:function(){return this.getPage(this.currentKey)}},{key:"previousPage",get:function(){return this.getPage(this.previousKey)}},{key:"keys",get:function(){return Object.keys(this.sizerChildren)}}]),i}(wk);Object.assign(yO.prototype,vO);var kO={invisible:0,destroy:1};T.register("pages",(function(t){var e=new yO(this.scene,t);return this.scene.add.existing(e),e})),Z(window,"RexPlugins.UI.Pages",yO);var mO=function(t){a(i,t);var e=d(i);function i(){return n(this,i),e.apply(this,arguments)}return r(i,[{key:"tint",get:function(){return 0===this.vertices.length?16777215:this.vertices[0].color}},{key:"setInteractive",value:function(){var t=function(t,e,i){for(var n=this.faces,s=0;s=e.length))return e[t].name},getPageIndex:function(t){for(var e=this.getElement("tabs.buttons"),i=0,n=e.length;ithis.topChildOY}},{key:"childOYExeceedBottom",value:function(t){return void 0===t&&(t=this.childOY),tthis.leftChildOX}},{key:"childOXExeceedRight",value:function(t){return void 0===t&&(t=this.childOX),tthis.childHeight?t=0:n?t=e:s&&(t=i)),this._childOY!==t&&(this._childOY=t,this.resetChildPosition()),n&&(this.execeedTopState||this.emit("execeedtop",this,t,e)),this.execeedTopState=n,s&&(this.execeedBottomState||this.emit("execeedbottom",this,t,i)),this.execeedBottomState=s;}},{key:"childOX",get:function(){return this._childOX},set:function(t){var e=this.leftChildOX,i=this.rightChildOX,n=this.childOXExceedLeft(t),s=this.childOXExeceedRight(t);this.clampChildOX&&(this.childVisibleWidth>this.childWidth?t=0:n?t=e:s&&(t=i)),this._childOX!==t&&(this._childOX=t,this.resetChildPosition()),n&&(this.execeedLeftState||this.emit("execeedleft",this,t,e)),this.execeedLeftState=n,s&&(this.execeedRightState||this.emit("execeedright",this,t,i)),this.execeedRightState=s;}},{key:"setChildOY",value:function(t){return this.childOY=t,this}},{key:"setChildOX",value:function(t){return this.childOX=t,this}},{key:"t",get:function(){var t=this.visibleHeight;return 0===t?0:this.childOY/-t},set:function(t){this.childOY=-this.visibleHeight*t;}},{key:"s",get:function(){var t=this.visibleWidth;return 0===t?0:this.childOX/-t},set:function(t){this.childOX=-this.visibleWidth*t;}},{key:"setChildOYByPercentage",value:function(t){return this.t=t,this}},{key:"setChildOXByPercentage",value:function(t){return this.s=t,this}}]),i}(lk);Object.assign(LM.prototype,MM);var BM=["top","bottom","centerY","center"],DM=["left","right","centerX","center"],IM=function(t,e,i){var n,s="Y"===(e=e.toUpperCase()),r=this.childrenMap.child;if(s){if(i)for(var o=0,a=BM.length;o=0?0:Math.abs(l)<=Math.abs(u)?l:u;}}else {if(i)for(o=0,a=DM.length;o=0?0:Math.abs(c)<=Math.abs(d)?c:d;}}switch(this.scrollMode){case 0:case 1:this.childOY+=n;break;default:this["childO".concat(e)]+=n;}},jM=Phaser.Utils.Objects.GetValue,zM=function(t){a(i,t);var e=d(i);function i(t,s){var r;n(this,i),void 0===s&&(s={});var o=jw(s),a=jM(s,"panel",void 0);void 0===a&&(a={}),a.scrollMode=o,a.clamplChildOY=jM(s,"clamplChildOY",!1),a.clamplChildOX=jM(s,"clamplChildOX",!1);var h,l,u=new LM(t,a);switch(t.add.existing(u),o){case 0:h=jM(s,"expand.panel",!0),l=!0;break;case 1:h=!0,l=jM(s,"expand.panel",!0);break;default:h=!0,l=!0;}s.type="rexScrollablePanel",s.child={gameObject:u,expandWidth:h,expandHeight:l,align:jM(s,"align.panel","center")};var c=jM(s,"space",void 0);return c&&(c.child=jM(c,"panel",0)),(r=e.call(this,t,s)).addChildrenMap("panel",u.child),r.addChildrenMap("panelLayer",u.maskLayer),r.addChildrenMap("mask",u.maskGameObject),r.addChildrenMap("scrollableBlock",u),r}return r(i,[{key:"setChildrenInteractive",value:function(t){return void 0===t&&(t={}),t.hasOwnProperty("eventEmitter")||(t.eventEmitter=this),t.hasOwnProperty("targets")||(t.targets=[this.childrenMap.panel]),ok(this.childrenMap.child,t),this}}]),i}(AS),AM={scrollToChild:function(t,e){if(!this.hasChild(t))return this;switch(this.scrollMode){case 0:IM.call(this,t,"y",e);break;case 1:IM.call(this,t,"x",e);break;default:IM.call(this,t,"y",e),IM.call(this,t,"x",e);}return this}};Object.assign(zM.prototype,AM),T.register("scrollablePanel",(function(t){var e=new zM(this.scene,t);return this.scene.add.existing(e),e})),Z(window,"RexPlugins.UI.ScrollablePanel",zM);var FM=function(t,e){t.popUp(e);},WM=function(t,e){t.scaleDown(e);},YM=function(t,e){t.fadeIn(e);},XM=function(t,e){t.fadeOut(e);},VM=function t(e,i,n){var s,r=bt(n,"reverse",!1);if(dg(e[0]))if(r)for(o=(a=e.length)-1;o>=0;o--)s=t(e[o],i,n);else for(var o=0,a=e.length;on?1:it)return this;for(var e=this.commands.length-1;;){var i=this.commands[this.index],n=i[1];if(dg(n)||(n=Ru(KM,i,1)),VM(n,this.scope),this.emit("runcommand",n,this.scope),this.index===e)return this.complete(),this;if(this.index++,this.nextTime=this.getNextDt(this.nextTime),this.nextTime>t)return this}}},{key:"complete",value:function(){this.clock.stop(),this.state=2,this.emit("complete",this.parent,this);}},{key:"getNextDt",value:function(t){var e=this.commands[this.index][0];return 1===this.timeUnit&&(e*=1e3),1===this.dtMode&&(e+=t),e}},{key:"setDtMode",value:function(t){return "string"==typeof t&&(t=ZM[t]),this.dtMode=t,this}},{key:"setTimeUnit",value:function(t){return "string"==typeof t&&(t=JM[t]),this.timeUnit=t,this}}]),i}(ro),KM=[],JM={ms:0,s:1,sec:1},ZM={abs:0,absolute:0,inc:1,increment:1},qM=Phaser.Utils.Objects.GetValue,$M=function(t){a(i,t);var e=d(i);function i(t,s){var r;return n(this,i),void 0===s&&(s={text:createDefaultTextObject(t)}),(r=e.call(this,t,s)).type="rexToast",r.setTransitInTime(qM(s,"duration.in",200)),r.setDisplayTime(qM(s,"duration.hold",1200)),r.setTransitOutTime(qM(s,"duration.out",200)),r.setTransitInCallback(qM(s,"transitIn",QM.popUp)),r.setTransitOutCallback(qM(s,"transitOut",QM.scaleDown)),r.player=new NM(u(r),{dtMode:1}),r.messages=[],r.scaleX0=void 0,r.scaleY0=void 0,r.setVisible(!1),r}return r(i,[{key:"destroy",value:function(t){this.scene&&!this.ignoreDestroy&&(this.player.destroy(),this.player=void 0,this.messages=void 0,p(h(i.prototype),"destroy",this).call(this,t));}},{key:"setDisplayTime",value:function(t){return this.displayTime=t,this}},{key:"setTransitOutTime",value:function(t){return this.transitOutTime=t,this}},{key:"setTransitInTime",value:function(t){return this.transitInTime=t,this}},{key:"setTransitInCallback",value:function(t){switch("string"==typeof t&&(t=QM[t]),t){case QM.popUp:t=FM;break;case QM.fadeIn:t=YM;}return t||(t=D),this.transitInCallback=t,this}},{key:"setTransitOutCallback",value:function(t){switch("string"==typeof t&&(t=QM[t]),t){case QM.scaleDown:t=WM;break;case QM.fadeOut:t=XM;}return t||(t=D),this.transitOutCallback=t,this}},{key:"setScale",value:function(t,e){return void 0===e&&(e=t),this.scaleX0=t,this.scaleY0=e,p(h(i.prototype),"setScale",this).call(this,t,e),this}},{key:"showMessage",value:function(t){if(void 0===this.scaleX0&&(this.scaleX0=this.scaleX),void 0===this.scaleY0&&(this.scaleY0=this.scaleY),void 0===t){if(0===this.messages.length)return this;t=this.messages.shift();}if(this.player.isPlaying)return this.messages.push(t),this;this.setScale(this.scaleX0,this.scaleY0).setVisible(!0),"string"==typeof t?this.setText(t):t(this),this.layout();var e=[[0,[this.transitInCallback,this,this.transitInTime]],[this.transitInTime,[D]],[this.displayTime,[this.transitOutCallback,this,this.transitOutTime]],[this.transitOutTime,[this.setVisible,!1]],[30,[D]]];return this.player.load(e,this).once("complete",(function(){this.showMessage();}),this).start(),this}}]),i}(eC),QM={popUp:0,fadeIn:1,scaleDown:0,fadeOut:1};T.register("toast",(function(t){var e=new $M(this.scene,t);return this.scene.add.existing(e),e})),Z(window,"RexPlugins.UI.Toast",$M);for(var tE,eE=function(t,e,i){void 0===i&&(i=!0),i?e=e?M(e):{}:e||(e={});var n=new Ql(t,e);return t.add.existing(n),n},iE=["AliceBlue","AntiqueWhite","Aqua","Aquamarine","Azure","Beige","Bisque","Black","BlanchedAlmond","Blue","BlueViolet","Brown","BurlyWood","CadetBlue","Chartreuse","Chocolate","Coral","CornflowerBlue","Cornsilk","Crimson","Cyan","DarkBlue","DarkCyan","DarkGoldenRod","DarkGray","DarkGrey","DarkGreen","DarkKhaki","DarkMagenta","DarkOliveGreen","DarkOrange","DarkOrchid","DarkRed","DarkSalmon","DarkSeaGreen","DarkSlateBlue","DarkSlateGray","DarkSlateGrey","DarkTurquoise","DarkViolet","DeepPink","DeepSkyBlue","DimGray","DimGrey","DodgerBlue","FireBrick","FloralWhite","ForestGreen","Fuchsia","Gainsboro","GhostWhite","Gold","GoldenRod","Gray","Grey","Green","GreenYellow","HoneyDew","HotPink","IndianRed","Indigo","Ivory","Khaki","Lavender","LavenderBlush","LawnGreen","LemonChiffon","LightBlue","LightCoral","LightCyan","LightGoldenRodYellow","LightGray","LightGrey","LightGreen","LightPink","LightSalmon","LightSeaGreen","LightSkyBlue","LightSlateGray","LightSlateGrey","LightSteelBlue","LightYellow","Lime","LimeGreen","Linen","Magenta","Maroon","MediumAquaMarine","MediumBlue","MediumOrchid","MediumPurple","MediumSeaGreen","MediumSlateBlue","MediumSpringGreen","MediumTurquoise","MediumVioletRed","MidnightBlue","MintCream","MistyRose","Moccasin","NavajoWhite","Navy","OldLace","Olive","OliveDrab","Orange","OrangeRed","Orchid","PaleGoldenRod","PaleGreen","PaleTurquoise","PaleVioletRed","PapayaWhip","PeachPuff","Peru","Pink","Plum","PowderBlue","Purple","RebeccaPurple","Red","RosyBrown","RoyalBlue","SaddleBrown","Salmon","SandyBrown","SeaGreen","SeaShell","Sienna","Silver","SkyBlue","SlateBlue","SlateGray","SlateGrey","Snow","SpringGreen","SteelBlue","Tan","Teal","Thistle","Tomato","Turquoise","Violet","Wheat","White","WhiteSmoke","Yellow","YellowGreen"],nE=[15792383,16444375,65535,8388564,15794175,16119260,16770244,0,16772045,255,9055202,10824234,14596231,6266528,8388352,13789470,16744272,6591981,16775388,14423100,65535,139,35723,12092939,11119017,11119017,25600,12433259,9109643,5597999,16747520,10040012,9109504,15308410,9419919,4734347,3100495,3100495,52945,9699539,16716947,49151,6908265,6908265,2003199,11674146,16775920,2263842,16711935,14474460,16316671,16766720,14329120,8421504,8421504,32768,11403055,15794160,16738740,13458524,4915330,16777200,15787660,15132410,16773365,8190976,16775885,11393254,15761536,14745599,16448210,13882323,13882323,9498256,16758465,16752762,2142890,8900346,7833753,7833753,11584734,16777184,65280,3329330,16445670,16711935,8388608,6737322,205,12211667,9662683,3978097,8087790,64154,4772300,13047173,1644912,16121850,16770273,16770229,16768685,128,16643558,8421376,7048739,16753920,16729344,14315734,15657130,10025880,11529966,14381203,16773077,16767673,13468991,16761035,14524637,11591910,8388736,6697881,16711680,12357519,4286945,9127187,16416882,16032864,3050327,16774638,10506797,12632256,8900331,6970061,7372944,7372944,16775930,65407,4620980,13808780,32896,14204888,16737095,4251856,15631086,16113331,16777215,16119285,16776960,10145074],sE={},rE=0,oE=iE.length;rE0&&{height:this.colorComponentsHeight,formatLabel:this.colorComponentsFormatLabelConfig,inputText:this.colorComponentsInputTextConfig,space:this.colorComponentsSpace};var o=new UE(t,{width:n,height:r,background:e,space:this.colorPickerSpace,hPalette:{position:this.colorPickerHPalettePosition},colorComponents:s,value:this.value});return t.add.existing(o),o},NE={openColorPicker:function(){if(!this.colorPicker){var t=HE.call(this).layout(),e=new zT(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(NE,vE);var KE=Phaser.Utils.Objects.GetValue,JE=function(t){a(i,t);var e=d(i);function i(t,s){var r;n(this,i),void 0===s&&(s={}),(r=e.call(this,t,s)).type="rexColorInput",s.hasOwnProperty("colorPicker")||(s.colorPicker={background:{color:0}});var o=s.colorPicker,a=!1!==o&&null!==o;if(a){var h;r.setColorPickerSize(KE(o,"width",160),KE(o,"height",170));var l=KE(o,"background");h=l?function(t){return iC(t,l)}:KE(o,"createBackgroundCallback"),r.setCreateColorPickerBackgroundCallback(h),r.setColorPickerHPalettePosition(KE(o,"hPalettePosition",0)),r.setColorPickerExpandDirection(KE(o,"expandDirection")),r.setColorPickerEaseInDuration(KE(o,"easeIn",200)),r.setColorPickerEaseOutDuration(KE(o,"easeOut",200)),r.setColorPickerTransitInCallback(KE(o,"transitIn")),r.setColorPickerTransitOutCallback(KE(o,"transitOut")),r.setColorPickerBounds(KE(o,"bounds"));var c=KE(o,"space");void 0===c&&(c={left:10,right:10,top:10,bottom:10,item:8}),r.setColorPickerSpace(c);}var d=s.colorComponents;if(a&&(!1!==d&&null!==d)){r.setColorComponentsHeight(KE(d,"height",30)),r.setColorComponentsFormatLabelConfig(KE(d,"formatLabel"));var f=KE(d,"inputText");f||(f=KE(s,"inputText")),r.setColorComponentsInputTextConfig(f);var p=KE(d,"space");void 0===p&&(p={item:8}),r.setColorComponentsSpace(p);}var v=r.childrenMap.swatch;return v&&a&&r.onClick(v,r.openColorPicker,u(r)),r}return r(i)}(pE);Object.assign(JE.prototype,NE),T.register("colorInput",(function(t){var e=new JE(this.scene,t);return this.scene.add.existing(e),e})),Z(window,"RexPlugins.UI.ColorInput",JE),T.register("colorInputLite",(function(t){var e=new pE(this.scene,t);return this.scene.add.existing(e),e})),Z(window,"RexPlugins.UI.ColorInputBase",pE),T.register("colorPicker",(function(t){var e=new jE(this.scene,t);return this.scene.add.existing(e),e})),Z(window,"RexPlugins.UI.ColorPicker",jE),T.register("colorComponents",(function(t){var e=new VE(this.scene,t);return this.scene.add.existing(e),e})),Z(window,"RexPlugins.UI.ColorComponents",VE);var ZE=function(t,e){return function(i,n,s,r){"panel"!==n&&s.moveChild(i,r?0:t,e);}},qE=function(t,e){return function(i,n,s,r){"panel"===n&&s.moveChild(i,r?0:t,e);}},$E={visible:{show:function(){return function(t,e,i,n){"panel"!==e&&i.setChildVisible(t,!0);}},hide:function(){return function(t,e,i,n){"panel"!==e&&i.setChildVisible(t,!1);}}},fade:{show:function(t,e){return void 0===e&&(e=1),function(i,n,s,r){"panel"!==n&&s.fadeChild(i,r?0:t,e);}},hide:function(t,e){return void 0===e&&(e=0),function(i,n,s,r){"panel"!==n&&s.fadeChild(i,r?0:t,e);}}},move:{show:ZE,hide:ZE},"move-panel":{show:qE,hide:qE}},QE=If.prototype.setChildVisible,t_={setChildVisible:function(t,e){if("string"==typeof t){var i=t;t=this.sizerChildren[i];}else i=bk(this.sizerChildren,t);return void 0===e&&(e=this.currentChildKey===i),QE.call(this,t,e),this}},e_={fadeChild:function(t,e,i){var n;return "string"==typeof t?(n=t,t=this.sizerChildren[n]):n=bk(this.sizerChildren,t),void 0===e&&(e=500),void 0===i&&(i=this.currentChildKey===n?1:0),t.fadeIn(e,{start:t.alpha,end:i}),this},fadeChildPromise:function(t,e,i){return "string"==typeof t&&(t=this.sizerChildren[key]),this.fadeChild(t,e,i),t._fade?Sh(t._fade):Promise.resolve()}},i_={moveChild:function(t,e,i,n){var s;"string"==typeof t?(s=t,t=this.sizerChildren[s]):s=bk(this.sizerChildren,t),void 0===e&&(e=500);var r,o,a,h,l=this.currentChildKey===s;if(void 0===n)switch(s){case"leftSide":case"rightSide":n=Er(t);break;case"topSide":case"bottomSide":n=_r(t);break;default:if(l)switch(this.previousChildKey){case"leftSide":case"rightSide":n=Er(this.sizerChildren[this.previousChildKey]);break;case"topSide":case"bottomSide":n=_r(this.sizerChildren[this.previousChildKey]);break;default:n=0;}else switch(this.currentChildKey){case"leftSide":case"rightSide":n=Er(this.sizerChildren[this.currentChildKey]);break;case"topSide":case"bottomSide":n=_r(this.sizerChildren[this.currentChildKey]);break;default:n=0;}}if(l)switch(s){case"panel":switch(this.previousChildKey){case"leftSide":r=!0;break;case"rightSide":o=!0;break;case"topSide":a=!0;break;case"bottomSide":h=!0;}break;case"leftSide":o=!0;break;case"rightSide":r=!0;break;case"topSide":h=!0;break;case"bottomSide":a=!0;}else switch(s){case"panel":switch(this.currentChildKey){case"leftSide":o=!0;break;case"rightSide":r=!0;break;case"topSide":h=!0;break;case"bottomSide":a=!0;}break;case"leftSide":r=!0;break;case"rightSide":o=!0;break;case"topSide":a=!0;break;case"bottomSide":h=!0;}return r?t.moveTo(e,"-=".concat(n),void 0,i):o?t.moveTo(e,"+=".concat(n),void 0,i):a?t.moveTo(e,void 0,"-=".concat(n),i):h?t.moveTo(e,void 0,"+=".concat(n),i):t.moveTo(0),this},moveChildPromise:function(t,e,i,n){return "string"==typeof t&&(t=this.sizerChildren[key]),this.moveChild(t,e,i,n),t._easeMove?Sh(t._easeMove):Promise.resolve()}},n_={};Object.assign(n_,t_,e_,i_);var s_=Phaser.Utils.Objects.GetValue,r_=function(t){a(i,t);var e=d(i);function i(t,s){var r;n(this,i),(r=e.call(this,t,s)).type="rexSides",r.childrenMap=r.sizerChildren,r.previousChildKey=void 0,r.currentChildKey=void 0;var o=s_(s,"showChildCallback",void 0);if(o)if(lg(o)){var a=s_(s,"showChildCallbackScope",void 0);r.on("showchild",o,a);var h=s_(s,"hideChildCallback",void 0),l=s_(s,"hideChildCallbackScope",void 0);r.on("hidechild",h,l);}else {var u=function(t){var e,i,n,s,r=k("string"==typeof t?[t]:t);return e=r[0],i=r.slice(1),$E.hasOwnProperty(e)?(n=$E[e].show.apply(null,i),s=$E[e].hide.apply(null,i)):(n=D,s=D),{show:n,hide:s}}(o);r.on("showchild",u.show),r.on("hidechild",u.hide);}var c=s_(s,"background",void 0),d=s_(s,"panel",void 0),f=s_(s,"leftSide",void 0),p=s_(s,"rightSide",void 0),v=s_(s,"topSide",void 0),g=s_(s,"bottomSide",void 0);if(c&&r.addBackground(c),d&&r.add(d,"panel","center",0,!0),f){var y=s_(s,"expand.left",!0);r.add(f,"leftSide","left-top",0,{height:y});}if(p){y=s_(s,"expand.right",!0);r.add(p,"rightSide","right-top",0,{height:y});}if(v){y=s_(s,"expand.top",!0);r.add(v,"topSide","left-top",0,{width:y});}if(g){y=s_(s,"expand.bottom",!0);r.add(g,"bottomSide","left-bottom",0,{width:y});}return r}return r(i,[{key:"reset",value:function(){return this.previousChildKey=void 0,this.currentChildKey="panel",this.showChild("panel",!0),this.hideChild("leftSide",!0),this.hideChild("rightSide",!0),this.hideChild("topSide",!0),this.hideChild("bottomSide",!0),this}}]),i}(wk);Object.assign(r_.prototype,{showChild:function(t,e){var i=this.sizerChildren[t];return i&&(this.emit("showchild",i,t,this,e),this.resetChildState(i)),this},hideChild:function(t,e){var i=this.sizerChildren[t];return i&&(this.emit("hidechild",i,t,this,e),this.resetChildState(i)),this},swapChild:function(t,e){return this.currentChildKey===t||("panel"===this.currentChildKey||"panel"===t?(this.previousChildKey=this.currentChildKey,this.currentChildKey=t,this.hideChild(this.previousChildKey,e),this.showChild(this.currentChildKey,e)):(this.swapChild("panel",e),this.swapChild(t,e))),this},showPanel:function(t){return this.swapChild("panel",t),this},showLeftSide:function(){return this.swapChild("leftSide"),this},showRightSide:function(){return this.swapChild("rightSide"),this},showTopSide:function(){return this.swapChild("topSide"),this},showBottomSide:function(){return this.swapChild("bottomSide"),this},hideLeftSide:function(){return "leftSide"==this.currentChildKey&&this.showPanel(),this},hideRightSide:function(){return "rightSide"==this.currentChildKey&&this.showPanel(),this},hideTopSide:function(){return "topSide"==this.currentChildKey&&this.showPanel(),this},hideBottomSide:function(){return "bottomSide"==this.currentChildKey&&this.showPanel(),this},toggleLeftSide:function(){var t="panel"!==this.currentChildKey?"panel":"leftSide";return this.swapChild(t),this},toggleRightSide:function(){var t="panel"!==this.currentChildKey?"panel":"rightSide";return this.swapChild(t),this},toggleTopSide:function(){var t="panel"!==this.currentChildKey?"panel":"topSide";return this.swapChild(t),this},toggleBottomSide:function(){var t="panel"!==this.currentChildKey?"panel":"bottomSide";return this.swapChild(t),this}},n_),T.register("sides",(function(t){var e=new r_(this.scene,t);return this.scene.add.existing(e),e})),Z(window,"RexPlugins.UI.Sides",r_);var o_=function(t){a(i,t);var e=d(i);function i(t,s){var r;return n(this,i),s=fC(t,s),(r=e.call(this,t,s)).type="rexTweaker.Title",r}return r(i,[{key:"setTitle",value:function(t){return (t=t?M(t):{}).hasOwnProperty("text")||(t.hasOwnProperty("title")?t.text=t.title:t.text=""),this.resetDisplayContent(t),this}}]),i}(eC),a_=function(t){a(i,t);var e=d(i);function i(t,s){var r;n(this,i),void 0===s&&(s={}),(r=e.call(this,t,s)).type="rexTweaker.FolderTitle";var o=new wd(t,s.expandedIcon);return t.add.existing(o),r.addSpace().add(o,{proportion:0,expand:!1,padding:1,fitRatio:1}),r.addChildrenMap("expandedIcon",o),r}return r(i,[{key:"setExpandedState",value:function(t){void 0===t&&(t=!0);var e=t?"down":"right";return this.childrenMap.expandedIcon.setDirection(e),this}}]),i}(o_),h_=function(t,e){var i=new aR(t,e);return t.add.existing(i),i},l_=function(t,e,i){return iC(t,i)},u_=function(t){a(i,t);var e=d(i);function i(t,s){var r;return n(this,i),(r=e.call(this,t,s)).type="rexTweaker.Folder",r}return r(i,[{key:"setTitle",value:function(t){return this.childrenMap.title.setTitle(t),this}}]),i}(OM);Object.assign(u_.prototype,{setBindingTarget:function(t){return this.childrenMap.child.setBindingTarget(t),this}},{getMaxInputRowTitleWidth:function(){return this.childrenMap.child.getMaxInputRowTitleWidth()+this.getInnerPadding("left")},setInputRowTitleWidth:function(t){return t-=this.getInnerPadding("left"),this.childrenMap.child.setInputRowTitleWidth(t),this}});var c_=Phaser.Utils.Objects.GetValue,d_=Phaser.Utils.Objects.GetValue,f_={getMaxInputRowTitleWidth:function(){for(var t=0,e=this.childrenMap.pages.children,i=0,n=e.length;i1?e-1:0),n=1;n0?0:1,o.setMinWidth(this.itemWidth)),this.add(o,{proportion:r,expand:!0}),n.onValueChange&&a.on("valuechange",n.onValueChange),n.onValidate&&a.setValidateCallback(n.onValidate),o.setAutoUpdateEnable(n.autoUpdate),o.setBindingTarget(t,e),n.monitor&&o.startMonitorTarget(),n.key&&this.root.addChildrenMap(n.key,o),this},addButton:nR,addButtons:nR,addSeparator:function(t){var e=this.scene,i=sR(this.styles,"separator"),n=l_(e,0,i);return this.add(n,{expand:!0}),this},setBindingTarget:function(t){for(var e=this.sizerChildren,i=0,n=e.length;is?r:-r),u.localY=d+(c>n?o:-o);}},zR=Phaser.Utils.Objects.IsPlainObject,AR=Phaser.Utils.Objects.GetValue,FR=Phaser.Math.DegToRad,WR=Phaser.Math.RadToDeg,YR=function(t){a(i,t);var e=d(i);function i(t,s,r,o,a){var h;if(n(this,i),zR(s)){var l=s;s=AR(l,"x",0),r=AR(l,"y",0),o=AR(l,"key",null),a=AR(l,"frame",null);}return (h=e.call(this,t,s,r,o,a)).type="rexSkewmage",h._skewX=0,h._skewY=0,h}return r(i,[{key:"skewX",get:function(){return this._skewX},set:function(t){this._skewX=t,jR(this,this._skewX,this._skewY);}},{key:"skewXDeg",get:function(){return WR(this._skewX)},set:function(t){this.skewX=FR(t);}},{key:"skewY",get:function(){return this._skewY},set:function(t){this._skewY=t,jR(this,this._skewX,this._skewY);}},{key:"skewYDeg",get:function(){return WR(this._skewY)},set:function(t){this.skewY=FR(t);}},{key:"setSkewX",value:function(t){return this.skewX=t,this}},{key:"setSkewY",value:function(t){return this.skewY=t,this}},{key:"setSkew",value:function(t,e){return void 0===e&&(e=t),this.skewX=t,this.skewY=e,this}},{key:"setSkewXDeg",value:function(t){return this.skewXDeg=t,this}},{key:"setSkewYDeg",value:function(t){return this.skewYDeg=t,this}},{key:"setSkewDeg",value:function(t,e){return void 0===e&&(e=t),this.skewXDeg=t,this.skewYDeg=e,this}}]),i}(IR),XR=Phaser.Utils.Objects.IsPlainObject,VR=Phaser.Utils.Objects.GetValue,GR=function(t){a(i,t);var e=d(i);function i(){return n(this,i),e.apply(this,arguments)}return r(i,[{key:"skewState",get:function(){return this.isRunning}}]),i}(sM(function(t){a(i,t);var e=d(i);function i(t,s,r,o,a){var h;if(n(this,i),XR(s)){var l=s;s=VR(l,"x",0),r=VR(l,"y",0),o=VR(l,"width",32),a=VR(l,"height",32);}var u=BO(t,o,a);return (h=e.call(this,t,s,r,u,null)).type="rexSkewRenderTexture",h.rt=h.texture,h}return r(i,[{key:"destroy",value:function(t){this.scene&&!this.ignoreDestroy&&(p(h(i.prototype),"destroy",this).call(this,t),this.rt.destroy(),this.rt=null);}}]),i}(YR)));T.register("skew",(function(t,e){return new GR(t,e)})),Z(window,"RexPlugins.UI.Skew",GR),T.register("anchor",(function(t,e){return new Bp(t,e)})),Z(window,"RexPlugins.UI.Anchor",Bp),T.register("textTyping",(function(t,e){return new eO(t,e)})),Z(window,"RexPlugins.UI.TextTyping",eO),T.register("textPage",(function(t,e){return new qT(t,e)})),Z(window,"RexPlugins.UI.TextPage",qT);var UR=void 0,HR=Phaser.Utils.Objects.GetValue,NR=Phaser.Utils.Objects.Clone,KR=function(t){return t.hasOwnProperty("align")?t.align:t.hasOwnProperty("halign")?t.halign:"left"},JR=Phaser.Utils.Objects.GetValue,ZR=Phaser.Utils.Objects.Merge,qR={open:function(t,e){var i;void 0===t&&(t={}),t=ZR(t,this.openConfig),(i=this)!==UR&&(void 0!==UR&&UR.close(),UR=i),lg(t)&&(e=t,t=void 0);var n=JR(t,"inputType",void 0);void 0===n&&(n=JR(t,"type","text")),void 0===e&&(e=JR(t,"onClose",void 0));var s=JR(t,"onOpen",void 0),r=JR(t,"onTextChanged",void 0);return this.inputText=function(t,e){void 0===e&&(e={}),e=NR(e);var i=t.scene,n=t.style,s=HR(e,"backgroundColor",n.backgroundColor);null===s&&(s="transparent"),e.text=HR(e,"text",t.text),e.fontFamily=HR(e,"fontFamily",n.fontFamily),e.fontSize=HR(e,"fontSize",n.fontSize),e.color=HR(e,"color",n.color),e.backgroundColor=s,e.direction=HR(e,"rtl",n.rtl)?"rtl":"ltr",e.align=HR(e,"align",KR(n)),"rtl"===e.direction&&lC(t)&&(e.align="right");var r=new sb(i,t.x,t.y,HR(e,"width",t.width),HR(e,"height",t.height),e);r.setOrigin(t.originX,t.originY).setScrollFactor(t.scrollFactorX,t.scrollFactorY);var o=t.parentContainer;return o?o.add(r):i.add.existing(r),r}(this.parent,t).on("textchange",(function(t){var e=t.text;r?r(this.parent,e):this.parent.text=e;}),this).setFocus(),this.parent.setVisible(!1),this.onClose=e,JR(t,"enterClose","textarea"!==n)&&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),s&&s(this.parent),this.emit("open",this.parent);}),this),this},close:function(){return this===UR&&(UR=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}},$R=Phaser.Utils.Objects.GetValue,QR=function(t){a(i,t);var e=d(i);function i(t,s){var r;return n(this,i),(r=e.call(this,t)).inputText=void 0,r.onClose=void 0,r.delayCall=void 0,r.setOpenConfig(s),$R(s,"clickEnable",!0)&&t.on("pointerdown",(function(){this.open();}),u(r)).setInteractive(),r}return r(i,[{key:"shutdown",value:function(t){this.isShutdown||(this.close(),p(h(i.prototype),"shutdown",this).call(this,t));}},{key:"setOpenConfig",value:function(t){return void 0===t&&(t={}),this.openConfig=t,this}},{key:"isOpened",get:function(){return void 0!==this.inputText}},{key:"text",get:function(){return this.isOpened?this.inputText.text:this.parent.text}}]),i}(ro);Object.assign(QR.prototype,qR);T.register("textEdit",(function(t,e){return new QR(t,e)})),Z(window,"RexPlugins.UI.TextEdit",QR);var tL=65535,eL=function(t,e,i){if(null==e)return t;if(0===e)return sL(t,0,i),t;var n=t.text.length;if(0===n)return sL(t,e,i),t;var s=Math.floor(1.5*e/n);void 0!==i&&s>i&&(s=Math.floor(i));for(var r={},o=nL(t,s,e,i,r),a=0;a<=tL&&0!==o;a++){if((s+=o)<0){s=0;break}o=nL(t,s,e,i,r);}return a===tL&&console.warn("FontSizeFit: Test count exceeds ".concat(tL)),t.setFontSize(s),sL(t,e,i),t},iL=function(t,e,i){return void 0===i[e]&&(t.setFontSize(e),i[e]={width:t.width,height:t.height}),i[e]},nL=function(t,e,i,n,s){var r,o=iL(t,e,s),a=iL(t,e+1,s);if(void 0!==n)if(o.height<=n&&a.height>n)r=0;else {if(o.height>n)return -1;r=Math.floor(n-o.height);}if(o.width<=i&&a.width>i)return 0;if(o.width>i)return -1;var h=Math.floor(i-o.width);return void 0===r?h:Math.min(h,r)},sL=function(t,e,i){var n=t.style;n&&(n.fixedWidth=e,n.parent.width=e,void 0!==i&&(n.fixedHeight=i,n.parent.height=i),n.update(!1));},rL=Phaser.Utils.Objects.GetValue,oL=function(t){a(i,Phaser.Plugins.ScenePlugin);var e=d(i);function i(t,s){var r;return n(this,i),(r=e.call(this,t,s)).add=new T(t),r}return r(i,[{key:"start",value:function(){this.scene.events.on("destroy",this.destroy,this);}},{key:"isInTouching",value:function(t,e,i,n){return !!t.visible&&cg(t,e,i,n)}},{key:"viewport",get:function(){return Jr(this.scene,this.scene.cameras.main,!0)}}]),i}(),aL={getParentSizer:Ld,getTopmostSizer:Bd,hide:Sv,show:wv,isShown:Pv,edit:function(t,e,i){return t._edit||(t._edit=new QR(t,{clickEnable:!1})),t._edit.open(e,i),t._edit},wrapExpandText:uC,fontSizeExpandText:function(t,e){"number"==typeof e&&(e={minWidth:e});var i=rL(e,"minWidth",0),n=rL(e,"minHeight",0),s=rL(e,"fitHeight",!1);return t._minWidth=i,t._minHeight=n,s?(t.runWidthWrap=function(e){return t.setFixedSize&&t.setFixedSize(0,0),t.setFontSize(1),t},t.resize=function(e,i){return eL(t,e,i),t}):(t.runWidthWrap=function(e){return t.setFixedSize&&t.setFixedSize(0,0),eL(t,e,void 0),t},t.resize=function(e,i){return t.width===e&&t.height===i||t.setFixedSize(e,i),t}),t},fontSizeResize:eL,setFontSizeToFitWidth:eL,waitEvent:wh,waitComplete:Sh,delayPromise:ab,setChildrenInteractive:ok,fadeIn:Zp,fadeOutDestroy:qp,easeMoveTo:av,easeMoveFrom:hv,modal:ag,modalPromise:function(t,e){var i=ag(t,e);return new Promise((function(t,e){i.once("close",(function(e){t(e);}));}))},modalClose:hg,requestDrag:lR,openFileChooser:function(t,e){var i=lb(e,"closeDelay",200),n=function(t){var e=document.createElement("input");e.type="file";var i=ob(t,"accept",""),n=ob(t,"multiple",!1);return e.setAttribute("accept",i),n?e.setAttribute("multiple",""):e.removeAttribute("multiple"),e}(e);return n.click(),hb({game:t,fileInput:n,closeDelay:i}).then((function(t){return n.remove(),Promise.resolve(t)}))}};return Object.assign(oL.prototype,aL),oL}));